Шифрование тест

This commit is contained in:
RoyceDa
2026-03-20 18:22:49 +02:00
parent 59d40e3005
commit 46af6661a1
2 changed files with 12 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ type KeyInput = Buffer | Uint8Array;
async function importAesCtrKey(input: KeyInput): Promise<CryptoKey> {
console.info("Importing AES-CTR key for E2EE:", Buffer.from(input).toString('hex'));
const keyBytes = toArrayBuffer(input);
if (keyBytes.byteLength !== 32) {
throw new Error(`E2EE key must be 32 bytes, got ${keyBytes.byteLength}`);