Skip to content

Commit ff58bbd

Browse files
committed
fix happy path test
1 parent 603f3aa commit ff58bbd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tests/WebAuthnTests/WebAuthnManagerTests+Authentication.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ extension WebAuthnManagerTests {
120120
expect: WebAuthnError.potentialReplayAttack
121121
)
122122
}
123-
123+
// c155900296b95a46f75d57328e4523910e74d629331fcd12cce2e95644114182
124+
// cf28f38af10da2d9ca9e2d3bd373f0574253404075ca5d748869bbb01f8677be
124125
func testFinishAuthenticationSucceeds() throws {
125126
let credentialID = TestConstants.mockCredentialID
126127
let oldSignCount: UInt32 = 0
@@ -130,14 +131,16 @@ extension WebAuthnManagerTests {
130131
.counter([0, 0, 0, 1])
131132
.buildAsBase64URLEncoded()
132133

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)
135137
let rawAuthenticatorData = authenticatorData.urlDecoded.decoded!
136138
let signatureBase = rawAuthenticatorData + clientDataHash
137139
let signature = try TestECCKeyPair.signature(data: signatureBase).derRepresentation
138140

139141
let verifiedAuthentication = try finishAuthentication(
140142
credentialID: credentialID,
143+
clientDataJSON: clientData.base64URLEncodedString(),
141144
authenticatorData: authenticatorData,
142145
signature: signature.base64URLEncodedString(),
143146
credentialCurrentSignCount: oldSignCount

0 commit comments

Comments
 (0)