fix: update webAuthnBufferDecode to support Base64URL for WebAuthn updates (#1734)

This commit is contained in:
XDTD
2023-04-12 21:33:54 +08:00
committed by GitHub
parent 94eef7dceb
commit 968d8646b2
3 changed files with 13 additions and 5 deletions

View File

@ -71,8 +71,12 @@ export function deleteUserWebAuthnCredential(credentialID) {
}).then(res => res.json());
}
// Base64 to ArrayBuffer
// Base64URL to ArrayBuffer
export function webAuthnBufferDecode(value) {
value = value.replace(/-/g, "+").replace(/_/g, "/");
while (value.length % 4) {
value += "=";
}
return Uint8Array.from(atob(value), c => c.charCodeAt(0));
}