One Hat Cyber Team
Your IP:
216.73.216.176
Server IP:
198.54.114.155
Server:
Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
5.6.40
Create File
|
Create Folder
Execute
Dir :
~
/
proc
/
thread-self
/
root
/
proc
/
self
/
cwd
/
View File Name :
Verify2.tar
ClientFactory.php 0000644 00000001130 15111373457 0010025 0 ustar 00 <?php namespace Vonage\Verify2; use Psr\Container\ContainerInterface; use Vonage\Client\APIResource; use Vonage\Client\Credentials\Handler\BasicHandler; use Vonage\Client\Credentials\Handler\KeypairHandler; class ClientFactory { public function __invoke(ContainerInterface $container): Client { $api = $container->make(APIResource::class); $api->setIsHAL(false) ->setErrorsOn200(false) ->setAuthHandler([new KeypairHandler(), new BasicHandler()]) ->setBaseUrl('https://api.nexmo.com/v2/verify'); return new Client($api); } } Client.php 0000644 00000002303 15111373457 0006500 0 ustar 00 <?php namespace Vonage\Verify2; use Vonage\Client\APIClient; use Vonage\Client\APIResource; use Vonage\Client\Exception\Exception; use Vonage\Verify2\Request\BaseVerifyRequest; class Client implements APIClient { public function __construct(protected APIResource $api) { } public function getAPIResource(): APIResource { return $this->api; } public function startVerification(BaseVerifyRequest $request): ?array { return $this->getAPIResource()->create($request->toArray()); } public function check(string $requestId, $code): bool { try { $response = $this->getAPIResource()->create(['code' => $code], '/' . $requestId); } catch (Exception $e) { // For horrible reasons in the API Error Handler, throw the error unless it's a 409. if ($e->getCode() === 409) { throw new \Vonage\Client\Exception\Request('Conflict: The current Verify workflow step does not support a code.'); } throw $e; } return true; } public function cancelRequest(string $requestId): bool { $this->api->delete($requestId); return true; } } VerifyObjects/VerifySilentAuthEvent.php 0000644 00000001430 15111373457 0014307 0 ustar 00 <?php namespace Vonage\Verify2\VerifyObjects; use Vonage\Entity\Hydrator\ArrayHydrateInterface; class VerifySilentAuthEvent implements ArrayHydrateInterface { private array $data; public function __construct(array $data) { $this->data = $data; } public function __get($property) { return $this->data[$property] ?? null; } public function __set($property, $value) { $this->data[$property] = $value; return $this; } public function __isset(string $name): bool { return isset($this->data[$name]); } public function fromArray(array $data): static { $this->data = $data; return $this; } public function toArray(): array { return $this->data; } } VerifyObjects/VerifyEvent.php 0000644 00000001272 15111373457 0012312 0 ustar 00 <?php namespace Vonage\Verify2\VerifyObjects; class VerifyEvent { private array $data; public function __construct(array $data) { $this->data = $data; } public function __get($property) { return $this->data[$property] ?? null; } public function __set($property, $value) { $this->data[$property] = $value; return $this; } public function __isset(string $name): bool { return isset($this->data[$name]); } public function fromArray(array $data): static { $this->data = $data; return $this; } public function toArray(): array { return $this->data; } } VerifyObjects/VerifyStatusUpdate.php 0000644 00000001301 15111373457 0013650 0 ustar 00 <?php namespace Vonage\Verify2\VerifyObjects; class VerifyStatusUpdate { private array $data; public function __construct(array $data) { $this->data = $data; } public function __get($property) { return $this->data[$property] ?? null; } public function __set($property, $value) { $this->data[$property] = $value; return $this; } public function __isset(string $name): bool { return isset($this->data[$name]); } public function fromArray(array $data): static { $this->data = $data; return $this; } public function toArray(): array { return $this->data; } } VerifyObjects/VerificationLocale.php 0000644 00000001374 15111373457 0013611 0 ustar 00 <?php namespace Vonage\Verify2\VerifyObjects; class VerificationLocale { private array $allowedCodes = [ 'en-us', 'en-gb', 'es-es', 'es-mx', 'es-us', 'it-it', 'fr-fr', 'de-de', 'ru-ru', 'hi-in', 'pt-br', 'pt-pt', 'id-id', ]; public function __construct(protected string $code = 'en-us') { if (! in_array($code, $this->allowedCodes, true)) { throw new \InvalidArgumentException('Invalid Locale Code Provided'); } } public function getCode(): string { return $this->code; } public function setCode(string $code): static { $this->code = $code; return $this; } } VerifyObjects/VerificationWorkflow.php 0000644 00000004213 15111373457 0014217 0 ustar 00 <?php namespace Vonage\Verify2\VerifyObjects; use Vonage\Entity\Hydrator\ArrayHydrateInterface; class VerificationWorkflow implements ArrayHydrateInterface { public const WORKFLOW_SMS = 'sms'; public const WORKFLOW_WHATSAPP = 'whatsapp'; public const WORKFLOW_WHATSAPP_INTERACTIVE = 'whatsapp_interactive'; public const WORKFLOW_VOICE = 'voice'; public const WORKFLOW_EMAIL = 'email'; public const WORKFLOW_SILENT_AUTH = 'silent_auth'; protected array $allowedWorkflows = [ self::WORKFLOW_SMS, self::WORKFLOW_WHATSAPP, self::WORKFLOW_WHATSAPP_INTERACTIVE, self::WORKFLOW_VOICE, self::WORKFLOW_EMAIL, self::WORKFLOW_SILENT_AUTH ]; public function __construct( protected string $channel, protected string $to, protected string $from = '' ) { if (! in_array($channel, $this->allowedWorkflows, true)) { throw new \InvalidArgumentException($this->channel . ' is not a valid workflow'); } } public function getChannel(): string { return $this->channel; } public function setChannel(string $channel): static { $this->channel = $channel; return $this; } public function getTo(): string { return $this->to; } public function setTo(string $to): static { $this->to = $to; return $this; } public function getFrom(): string { return $this->from; } public function setFrom(string $from): static { $this->from = $from; return $this; } public function fromArray(array $data): static { $this->channel = $data['channel']; $this->to = $data['to']; if (array_key_exists('from', $data)) { $this->from = $data['from']; } return $this; } public function toArray(): array { $returnArray = [ 'channel' => $this->getChannel(), 'to' => $this->getTo() ]; if (!empty($this->getFrom())) { $returnArray['from'] = $this->getFrom(); } return $returnArray; } } VerifyObjects/VerifyWhatsAppInteractiveEvent.php 0000644 00000001441 15111373457 0016156 0 ustar 00 <?php namespace Vonage\Verify2\VerifyObjects; use Vonage\Entity\Hydrator\ArrayHydrateInterface; class VerifyWhatsAppInteractiveEvent implements ArrayHydrateInterface { private array $data; public function __construct(array $data) { $this->data = $data; } public function __get($property) { return $this->data[$property] ?? null; } public function __set($property, $value) { $this->data[$property] = $value; return $this; } public function __isset(string $name): bool { return isset($this->data[$name]); } public function fromArray(array $data): static { $this->data = $data; return $this; } public function toArray(): array { return $this->data; } } Webhook/Factory.php 0000644 00000002101 15111373457 0010263 0 ustar 00 <?php namespace Vonage\Verify2\Webhook; use Vonage\Verify2\VerifyObjects\VerifyEvent; use Vonage\Verify2\VerifyObjects\VerifySilentAuthEvent; use Vonage\Verify2\VerifyObjects\VerifyStatusUpdate; use Vonage\Verify2\VerifyObjects\VerifyWhatsAppInteractiveEvent; class Factory extends \Vonage\Webhook\Factory { /** * Warning: This logic is fairly brittle, since there are no current better ways of determining * the type of event or update. */ public static function createFromArray(array $data) { if ($data['type'] === 'event') { if ($data['channel'] === 'silent_auth') { return new VerifySilentAuthEvent($data); } if ($data['channel'] === 'whatsapp_interactive') { return new VerifyWhatsAppInteractiveEvent($data); } return new VerifyEvent($data); } if ($data['type'] === 'summary') { return new VerifyStatusUpdate($data); } throw new \OutOfBoundsException('Could not create Verify2 Object from payload'); } } Request/EmailRequest.php 0000644 00000001457 15111373457 0011323 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationLocale; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; class EmailRequest extends BaseVerifyRequest { public function __construct( protected string $to, protected string $brand, protected string $from, protected ?VerificationLocale $locale = null, ) { if (!$this->locale) { $this->locale = new VerificationLocale(); } if ($this->code) { $this->setCode($this->code); } $workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_EMAIL, $to, $from); $this->addWorkflow($workflow); } public function toArray(): array { return $this->getBaseVerifyUniversalOutputArray(); } } Request/BaseVerifyRequest.php 0000644 00000007544 15111373457 0012336 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationLocale; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; abstract class BaseVerifyRequest implements RequestInterface { private const TIMEOUT_MIN = 60; private const TIMEOUT_MAX = 900; private const LENGTH_MIN = 4; private const LENGTH_MAX = 10; protected ?VerificationLocale $locale = null; protected int $timeout = 300; protected ?bool $fraudCheck = null; protected ?string $clientRef = null; protected int $length = 4; protected string $brand; protected array $workflows = []; protected ?string $code = null; public function getLocale(): ?VerificationLocale { return $this->locale; } public function setLocale(?VerificationLocale $verificationLocale): static { $this->locale = $verificationLocale; return $this; } public function getTimeout(): int { return $this->timeout; } public function setTimeout(int $timeout): static { $range = [ 'options' => [ 'min_range' => self::TIMEOUT_MIN, 'max_range' => self::TIMEOUT_MAX ] ]; if (!filter_var($timeout, FILTER_VALIDATE_INT, $range)) { throw new \OutOfBoundsException('Timeout ' . $timeout . ' is not valid'); } $this->timeout = $timeout; return $this; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): static { $this->code = $code; return $this; } public function getClientRef(): ?string { return $this->clientRef; } public function setClientRef(?string $clientRef): static { $this->clientRef = $clientRef; return $this; } public function getLength(): int { return $this->length; } public function setLength(int $length): static { $range = [ 'options' => [ 'min_range' => self::LENGTH_MIN, 'max_range' => self::LENGTH_MAX ] ]; if (!filter_var($length, FILTER_VALIDATE_INT, $range)) { throw new \OutOfBoundsException('PIN Length ' . $length . ' is not valid'); } $this->length = $length; return $this; } public function getBrand(): string { return $this->brand; } public function setBrand(string $brand): static { $this->brand = $brand; return $this; } public function getWorkflows(): array { return array_map(static function ($workflow) { return $workflow->toArray(); }, $this->workflows); } public function addWorkflow(VerificationWorkflow $verificationWorkflow): static { $this->workflows[] = $verificationWorkflow; return $this; } public function getFraudCheck(): ?bool { return $this->fraudCheck ?? null; } public function setFraudCheck(bool $fraudCheck): BaseVerifyRequest { $this->fraudCheck = $fraudCheck; return $this; } public function getBaseVerifyUniversalOutputArray(): array { $returnArray = [ 'locale' => $this->getLocale()->getCode(), 'channel_timeout' => $this->getTimeout(), 'code_length' => $this->getLength(), 'brand' => $this->getBrand(), 'workflow' => $this->getWorkflows() ]; if ($this->getFraudCheck() === false) { $returnArray['fraud_check'] = $this->getFraudCheck(); } if ($this->getClientRef()) { $returnArray['client_ref'] = $this->getClientRef(); } if ($this->getCode()) { $returnArray['code'] = $this->getCode(); } return $returnArray; } } Request/WhatsAppInteractiveRequest.php 0000644 00000001323 15111373457 0014211 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationLocale; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; class WhatsAppInteractiveRequest extends BaseVerifyRequest { public function __construct( protected string $to, protected string $brand, protected ?VerificationLocale $locale = null ) { if (!$this->locale) { $this->locale = new VerificationLocale(); } $workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_WHATSAPP_INTERACTIVE, $to); $this->addWorkflow($workflow); } public function toArray(): array { return $this->getBaseVerifyUniversalOutputArray(); } } Request/SilentAuthRequest.php 0000644 00000001063 15111373457 0012345 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; class SilentAuthRequest extends BaseVerifyRequest { public function __construct( protected string $to, protected string $brand, ) { $workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_SILENT_AUTH, $to); $this->addWorkflow($workflow); } public function toArray(): array { return [ 'brand' => $this->getBrand(), 'workflow' => $this->getWorkflows() ]; } } Request/VoiceRequest.php 0000644 00000001413 15111373457 0011331 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationLocale; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; class VoiceRequest extends BaseVerifyRequest { public function __construct( protected string $to, protected string $brand, protected ?VerificationLocale $locale = null, ) { if (!$this->locale) { $this->locale = new VerificationLocale(); } $workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_VOICE, $to); if ($this->code) { $workflow->setCode($this->code); } $this->addWorkflow($workflow); } public function toArray(): array { return $this->getBaseVerifyUniversalOutputArray(); } } Request/SMSRequest.php 0000644 00000001265 15111373457 0010733 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationLocale; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; class SMSRequest extends BaseVerifyRequest { public function __construct( protected string $to, protected string $brand, protected ?VerificationLocale $locale = null, ) { if (!$this->locale) { $this->locale = new VerificationLocale(); } $workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_SMS, $to); $this->addWorkflow($workflow); } public function toArray(): array { return $this->getBaseVerifyUniversalOutputArray(); } } Request/RequestInterface.php 0000644 00000001723 15111373457 0012170 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationLocale; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; interface RequestInterface { public function setLocale(VerificationLocale $verificationLocale): static; public function setTimeout(int $timeout): static; public function setClientRef(string $clientRef): static; public function setLength(int $length): static; public function setBrand(string $brand): static; public function addWorkflow(VerificationWorkflow $verificationWorkflow): static; public function getLocale(): ?VerificationLocale; public function getTimeout(): int; public function getClientRef(): ?string; public function getLength(): int; public function getBrand(): string; public function getWorkflows(): array; public function getBaseVerifyUniversalOutputArray(): array; public function setCode(string $code): static; public function getCode(): ?string; } Request/WhatsAppRequest.php 0000644 00000001347 15111373457 0012021 0 ustar 00 <?php namespace Vonage\Verify2\Request; use Vonage\Verify2\VerifyObjects\VerificationLocale; use Vonage\Verify2\VerifyObjects\VerificationWorkflow; class WhatsAppRequest extends BaseVerifyRequest { public function __construct( protected string $to, protected string $brand, protected ?string $from = null, protected ?VerificationLocale $locale = null, ) { if (!$this->locale) { $this->locale = new VerificationLocale(); } $workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_WHATSAPP, $to); $this->addWorkflow($workflow); } public function toArray(): array { return $this->getBaseVerifyUniversalOutputArray(); } }