@@ -120,7 +120,8 @@ extension WebAuthnManagerTests {
120
120
expect: WebAuthnError . potentialReplayAttack
121
121
)
122
122
}
123
-
123
+ // c155900296b95a46f75d57328e4523910e74d629331fcd12cce2e95644114182
124
+ // cf28f38af10da2d9ca9e2d3bd373f0574253404075ca5d748869bbb01f8677be
124
125
func testFinishAuthenticationSucceeds( ) throws {
125
126
let credentialID = TestConstants . mockCredentialID
126
127
let oldSignCount : UInt32 = 0
@@ -130,14 +131,16 @@ extension WebAuthnManagerTests {
130
131
. counter ( [ 0 , 0 , 0 , 1 ] )
131
132
. buildAsBase64URLEncoded ( )
132
133
133
- // create a signature. This part is usually performed by the authenticator
134
- let clientDataHash = SHA256 . hash ( data: TestClientDataJSON ( type: " webauthn.get " ) . jsonData)
134
+ // Create a signature. This part is usually performed by the authenticator
135
+ let clientData : Data = TestClientDataJSON ( type: " webauthn.get " ) . jsonData
136
+ let clientDataHash = SHA256 . hash ( data: clientData)
135
137
let rawAuthenticatorData = authenticatorData. urlDecoded. decoded!
136
138
let signatureBase = rawAuthenticatorData + clientDataHash
137
139
let signature = try TestECCKeyPair . signature ( data: signatureBase) . derRepresentation
138
140
139
141
let verifiedAuthentication = try finishAuthentication (
140
142
credentialID: credentialID,
143
+ clientDataJSON: clientData. base64URLEncodedString ( ) ,
141
144
authenticatorData: authenticatorData,
142
145
signature: signature. base64URLEncodedString ( ) ,
143
146
credentialCurrentSignCount: oldSignCount
0 commit comments