Skip to content

Commit 7956958

Browse files
peterheiderPeter Heider
andauthored
fix: fix attestation validation by re-encoding response.clientDataJSON (#405)
Co-authored-by: Peter Heider <[email protected]>
1 parent 4cc5a9e commit 7956958

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Services/Webauthn.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ public static function prepareAttestation(User $user): PublicKeyCredentialCreati
165165
*/
166166
public static function validateAttestation(User $user, array $credentials, string $keyName): Model
167167
{
168+
if (($clientDataJSON = Arr::get($credentials, 'response.clientDataJSON')) !== null) {
169+
Arr::set($credentials, 'response.clientDataJSON', Base64UrlSafe::encodeUnpadded(Base64::decode($clientDataJSON)));
170+
}
171+
168172
$publicKey = app(CredentialAttestationValidator::class)($user, $credentials);
169173

170174
return tap(static::create($user, $keyName, $publicKey), function ($webauthnKey) {

0 commit comments

Comments
 (0)