From 781f5c359c1351e75dac2553d0041ac9649bc7da Mon Sep 17 00:00:00 2001 From: Eric Lewis Date: Wed, 19 Jun 2024 10:47:03 -0400 Subject: [PATCH] fix: challenge must be a string The backend expects the challenge in hex format, and SHA256Digest returns only the raw format. This fixes stamping. --- Sources/Shared/Stamper.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/Shared/Stamper.swift b/Sources/Shared/Stamper.swift index 8006b69..c47588b 100644 --- a/Sources/Shared/Stamper.swift +++ b/Sources/Shared/Stamper.swift @@ -117,7 +117,11 @@ public class Stamper { } } - self.passkeyManager?.assertPasskey(challenge: Data(payload)) + guard let challenge = payload.compactMap { String(format: "%02x", $0) }.joined().data(using: .utf8) else { + continuation.resume(throwing: StampError.assertionFailed) + } + + self.passkeyManager?.assertPasskey(challenge: challenge) } }