Add new Radix UI components and associated dependencies in package-lock.json

This commit is contained in:
Sebastian Unterschütz
2026-05-01 11:59:27 +02:00
parent 331d60581e
commit f5466f9062
21 changed files with 5010 additions and 481 deletions

View File

@@ -6,7 +6,7 @@
export async function importKey(keyData: Uint8Array): Promise<CryptoKey> {
return await self.crypto.subtle.importKey(
"raw",
keyData,
keyData.buffer as ArrayBuffer,
{ name: "AES-GCM" },
false,
["decrypt", "encrypt"]
@@ -33,6 +33,55 @@ export async function decryptLog(
return new TextDecoder().decode(decrypted);
}
export async function encryptData(
plaintext: string,
key: CryptoKey
): Promise<Uint8Array> {
const enc = new TextEncoder();
const data = enc.encode(plaintext);
const nonce = self.crypto.getRandomValues(new Uint8Array(12));
const encrypted = await self.crypto.subtle.encrypt(
{
name: "AES-GCM",
iv: nonce,
},
key,
data
);
const result = new Uint8Array(nonce.length + encrypted.byteLength);
result.set(nonce);
result.set(new Uint8Array(encrypted), nonce.length);
return result;
}
export async function generateBlindIndex(
value: string,
key: Uint8Array
): Promise<string> {
const enc = new TextEncoder();
const data = enc.encode(value);
const hmacKey = await self.crypto.subtle.importKey(
"raw",
key,
{ name: "HMAC", hash: "SHA-256" },
false,
["sign"]
);
const signature = await self.crypto.subtle.sign(
"HMAC",
hmacKey,
data
);
return Array.from(new Uint8Array(signature))
.map(b => b.toString(16).padStart(2, '0'))
.join('');
}
/**
* Derives a 256-bit key from a password and salt using PBKDF2.
* (Used if WebAuthn is not providing a raw key directly)