Skip to content

Commit 310ad8b

Browse files
tcousin-extThomas Cousin
andauthored
add external user id auth hash in device to enable identity verification (#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]>
1 parent dfb480f commit 310ad8b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Resolver/DeviceResolver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public function resolve(array $data): array
2727
$resolver = (new OptionsResolver())
2828
->setDefined('identifier')
2929
->setAllowedTypes('identifier', 'string')
30+
->setDefined('identifier_auth_hash')
31+
->setAllowedTypes('identifier_auth_hash', 'string')
3032
->setDefined('language')
3133
->setAllowedTypes('language', 'string')
3234
->setDefined('timezone')
@@ -69,6 +71,8 @@ public function resolve(array $data): array
6971
->setAllowedTypes('country', 'string')
7072
->setDefined('external_user_id')
7173
->setAllowedTypes('external_user_id', 'string')
74+
->setDefined('external_user_id_auth_hash')
75+
->setAllowedTypes('external_user_id_auth_hash', 'string')
7276
->setDefault('app_id', $this->config->getApplicationId())
7377
->setAllowedTypes('app_id', 'string');
7478

tests/Resolver/DeviceResolverTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function testResolveWithValidValues(): void
2727
{
2828
$expectedData = [
2929
'identifier' => 'value',
30+
'identifier_auth_hash' => 'value',
3031
'language' => 'value',
3132
'timezone' => 3564,
3233
'game_version' => 'value',
@@ -47,6 +48,7 @@ public function testResolveWithValidValues(): void
4748
'lat' => 22.7624291,
4849
'country' => 'LT',
4950
'external_user_id' => 'value',
51+
'external_user_id_auth_hash' => 'value',
5052
'app_id' => 'value',
5153
'ip' => '127.0.0.1',
5254
];
@@ -93,6 +95,7 @@ public function testResolveWithMissingRequiredValue(): void
9395
public function newDeviceWrongValueTypesProvider(): iterable
9496
{
9597
yield [['identifier' => 666]];
98+
yield [['identifier_auth_hash' => 666]];
9699
yield [['language' => 666]];
97100
yield [['timezone' => 'wrongType']];
98101
yield [['game_version' => 666]];
@@ -115,6 +118,7 @@ public function newDeviceWrongValueTypesProvider(): iterable
115118
yield [['app_id' => 666]];
116119
yield [['device_type' => 666]];
117120
yield [['external_user_id' => 666]];
121+
yield [['external_user_id_auth_hash' => 666]];
118122
}
119123

120124
/**

0 commit comments

Comments
 (0)