diff --git a/src/Component/SimpleConnection/RequestVerifier.php b/src/Component/SimpleConnection/RequestVerifier.php new file mode 100644 index 0000000..81a5819 --- /dev/null +++ b/src/Component/SimpleConnection/RequestVerifier.php @@ -0,0 +1,15 @@ +apiKey, $secret); + + return hash_equals($hash, $registerRequest->token); + } +} diff --git a/src/Component/SimpleConnection/TokenCreator.php b/src/Component/SimpleConnection/TokenCreator.php new file mode 100644 index 0000000..2545c34 --- /dev/null +++ b/src/Component/SimpleConnection/TokenCreator.php @@ -0,0 +1,13 @@ +systemUrl = 'url'; + $request->apiKey = $apiKey; + $request->token = $token; + + static::assertTrue($verifier->verify($secret, $request)); + } +} diff --git a/tests/src/Component/SimpleConnection/TokenCreatorTest.php b/tests/src/Component/SimpleConnection/TokenCreatorTest.php new file mode 100644 index 0000000..d9f2e1a --- /dev/null +++ b/tests/src/Component/SimpleConnection/TokenCreatorTest.php @@ -0,0 +1,19 @@ + 'test_url', + 'apiKey' => 'test_key', + 'token' => 'token' + ]; + + /** @var RequestConnectionRegister $request */ + $request = SerializerFactory::create()->fromArray($requestData, RequestConnectionRegister::class); + + static::assertEquals($requestData['systemUrl'], $request->systemUrl); + static::assertEquals($requestData['apiKey'], $request->apiKey); + static::assertEquals($requestData['token'], $request->token); + } +}