diff options
| author | 2023-04-18 03:02:17 +0800 | |
|---|---|---|
| committer | 2023-04-18 03:02:17 +0800 | |
| commit | 4919f028c884a041da7ff098abb02389b4eac598 (patch) | |
| tree | b0f482568c4b8c8a680ce6e2e70a7b7ca87dc190 /pkg/encryption.test.ts | |
| parent | b135aac8531c1e1488147ad8c6f98eddbdbe0c99 (diff) | |
| download | HydroRoll-4919f028c884a041da7ff098abb02389b4eac598.tar.gz HydroRoll-4919f028c884a041da7ff098abb02389b4eac598.zip | |
✨add envshare docs
Diffstat (limited to 'pkg/encryption.test.ts')
| -rw-r--r-- | pkg/encryption.test.ts | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/pkg/encryption.test.ts b/pkg/encryption.test.ts deleted file mode 100644 index 5d4cf15..0000000 --- a/pkg/encryption.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, it, expect, beforeAll } from "@jest/globals"; -import { decrypt, encrypt } from "./encryption"; -import crypto from "node:crypto"; -import { toBase58 } from "../util/base58"; - -beforeAll(() => { - global.crypto = crypto.webcrypto; -}); -describe("aes", () => { - it("encrypts and decrypts correctly", async () => { - for (let i = 0; i < 500; i++) { - const buf = new Uint8Array(Math.ceil(Math.random() * 10 * i)); - crypto.getRandomValues(buf); - - const text = toBase58(buf); - - const { encrypted, key, iv } = await encrypt(text); - - const decrypted = await decrypt(toBase58(encrypted), key, toBase58(iv), 2); - - expect(decrypted).toEqual(text); - } - }, 30_000); -}); |
