fbe9252db1
- Use plain client data json everywhere - Expose AAGUID and backed_up on Credentials - Make attestation verifiers configurable - Auto-suggest names for passkeys and show icons
13 lines
488 B
JavaScript
13 lines
488 B
JavaScript
export function base64urlToBuffer(base64url) {
|
|
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/")
|
|
const padding = "=".repeat((4 - base64.length % 4) % 4)
|
|
const binary = atob(base64 + padding)
|
|
return Uint8Array.from(binary, c => c.charCodeAt(0)).buffer
|
|
}
|
|
|
|
export function bufferToBase64url(buffer) {
|
|
const bytes = new Uint8Array(buffer)
|
|
const binary = String.fromCharCode(...bytes)
|
|
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "")
|
|
}
|