Non-standard passkey implementations (e.g., 1Password) return `Array` instead of `BufferSource`.
<link rel="canonical" href="https://108117.xyz/">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="./style.css">
<link rel="canonical" href="https://108117.xyz/">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="./style.css">
- <link rel="modulepreload" href="./script.js" integrity="sha512-Lkb5w3ts0GdkX4MFDhtyGZFN8o4PtN1u+jq0tX4XqCCN/sV+ddnsro9zNQ12vt6fSBS6NJUPUCxwqiIpNgSAMA==">
+ <link rel="modulepreload" href="./script.js" integrity="sha512-sHPFqLYMufpPGU53gpoPM2s55ijr6QaxHj9GApSkciPYW6FyvTRHNESHEbrlRrJCMABcxrXmNukGtn89h2H/Iw==">
<title>static-encrypt-passkey</title>
</head>
<title>static-encrypt-passkey</title>
</head>
paddedPlaintext.set([p]); // Offset to discard on decode
paddedPlaintext.set(encodedPlaintext, p); // Gap filled with zero bytes, e.g. [3, 0, 0, ...encodedPlaintext]
paddedPlaintext.set([p]); // Offset to discard on decode
paddedPlaintext.set(encodedPlaintext, p); // Gap filled with zero bytes, e.g. [3, 0, 0, ...encodedPlaintext]
- const prf = await createPrf();
+ // As per the specification, the PRF extension *should* already return a BufferSource which can be directly
+ // passed to Web Crypto API, however non-standard passkey implementations (e.g., 1Password) return Array.
+ const prf = new Uint8Array(await createPrf());
const key = await getKey(prf, salt, info);
const ciphertext = new Uint8Array(await crypto.subtle.encrypt(
{ name: 'AES-GCM', iv },
const key = await getKey(prf, salt, info);
const ciphertext = new Uint8Array(await crypto.subtle.encrypt(
{ name: 'AES-GCM', iv },
// Prepare non-crypto inputs
const info = new TextEncoder().encode('https://github.com/ardislu/static-encrypt-passkey');
// Prepare non-crypto inputs
const info = new TextEncoder().encode('https://github.com/ardislu/static-encrypt-passkey');
- const prf = await getPrf();
+ // As per the specification, the PRF extension *should* already return a BufferSource which can be directly
+ // passed to Web Crypto API, however non-standard passkey implementations (e.g., 1Password) return Array.
+ const prf = new Uint8Array(await getPrf());
const key = await getKey(prf, salt, info);
const encodedPlaintext = new Uint8Array(await crypto.subtle.decrypt(
{ name: 'AES-GCM', iv },
const key = await getKey(prf, salt, info);
const encodedPlaintext = new Uint8Array(await crypto.subtle.decrypt(
{ name: 'AES-GCM', iv },