<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-ljYjSBnb58ufLJgdl8cOXJT6xnVRlzdCQWwGG2AKTZTViiH+0tHxU4k1cDsqjw/cQIvxmoIBl6WSR1bOeG+uFQ==">
+ <link rel="modulepreload" href="./script.js" integrity="sha512-Lkb5w3ts0GdkX4MFDhtyGZFN8o4PtN1u+jq0tX4XqCCN/sV+ddnsro9zNQ12vt6fSBS6NJUPUCxwqiIpNgSAMA==">
<title>static-encrypt-passkey</title>
</head>
buffer.set(salt);
buffer.set(iv, salt.byteLength);
buffer.set(ciphertext, salt.byteLength + iv.byteLength);
- let binary = '';
- for (let i = 0; i < buffer.byteLength; i++) {
- binary += String.fromCharCode(buffer[i]);
- }
- const content = btoa(binary);
- return content;
+ return buffer.toBase64();
}
/**
*/
export async function decrypt(content) {
// Extract random values
- const buffer = Uint8Array.from(atob(content), c => c.charCodeAt(0));
+ const buffer = Uint8Array.fromBase64(content);
const salt = buffer.slice(0, 64); // For HKDF
const iv = buffer.slice(64, 76); // For AES-GCM
const ciphertext = buffer.slice(76);