Skip to content

Commit

Permalink
add external user id auth hash in device to enable identity verificat…
Browse files Browse the repository at this point in the history
…ion (#161)

* add external user id auth hash in device resolver to enable identity verification

* add identifier_auth_hash to device resolver

Co-authored-by: Thomas Cousin <[email protected]>
  • Loading branch information
tcousin-ext and Thomas Cousin authored Dec 2, 2021
1 parent dfb480f commit 310ad8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Resolver/DeviceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function resolve(array $data): array
$resolver = (new OptionsResolver())
->setDefined('identifier')
->setAllowedTypes('identifier', 'string')
->setDefined('identifier_auth_hash')
->setAllowedTypes('identifier_auth_hash', 'string')
->setDefined('language')
->setAllowedTypes('language', 'string')
->setDefined('timezone')
Expand Down Expand Up @@ -69,6 +71,8 @@ public function resolve(array $data): array
->setAllowedTypes('country', 'string')
->setDefined('external_user_id')
->setAllowedTypes('external_user_id', 'string')
->setDefined('external_user_id_auth_hash')
->setAllowedTypes('external_user_id_auth_hash', 'string')
->setDefault('app_id', $this->config->getApplicationId())
->setAllowedTypes('app_id', 'string');

Expand Down
4 changes: 4 additions & 0 deletions tests/Resolver/DeviceResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function testResolveWithValidValues(): void
{
$expectedData = [
'identifier' => 'value',
'identifier_auth_hash' => 'value',
'language' => 'value',
'timezone' => 3564,
'game_version' => 'value',
Expand All @@ -47,6 +48,7 @@ public function testResolveWithValidValues(): void
'lat' => 22.7624291,
'country' => 'LT',
'external_user_id' => 'value',
'external_user_id_auth_hash' => 'value',
'app_id' => 'value',
'ip' => '127.0.0.1',
];
Expand Down Expand Up @@ -93,6 +95,7 @@ public function testResolveWithMissingRequiredValue(): void
public function newDeviceWrongValueTypesProvider(): iterable
{
yield [['identifier' => 666]];
yield [['identifier_auth_hash' => 666]];
yield [['language' => 666]];
yield [['timezone' => 'wrongType']];
yield [['game_version' => 666]];
Expand All @@ -115,6 +118,7 @@ public function newDeviceWrongValueTypesProvider(): iterable
yield [['app_id' => 666]];
yield [['device_type' => 666]];
yield [['external_user_id' => 666]];
yield [['external_user_id_auth_hash' => 666]];
}

/**
Expand Down

0 comments on commit 310ad8b

Please sign in to comment.