mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
15 lines
476 B
TypeScript
15 lines
476 B
TypeScript
import { assertEquals } from '@std/assert';
|
|
import { encodeHex } from '@std/encoding/hex';
|
|
import { generateSecretKey } from 'nostr-tools';
|
|
|
|
import { aesDecrypt, aesEncrypt } from './aes.ts';
|
|
|
|
Deno.test('aesDecrypt & aesEncrypt', async () => {
|
|
const sk = generateSecretKey();
|
|
const data = generateSecretKey();
|
|
|
|
const encrypted = await aesEncrypt(sk, data);
|
|
const decrypted = await aesDecrypt(sk, encrypted);
|
|
|
|
assertEquals(encodeHex(decrypted), encodeHex(data));
|
|
});
|