diff options
| author | 2023-04-19 17:30:39 +0800 | |
|---|---|---|
| committer | 2023-04-19 17:30:39 +0800 | |
| commit | 3adc965dd09490b7efa1cce9f09b0a3b30970277 (patch) | |
| tree | f813abb07d7b003984aa74e3154752b6ffc3ccd5 /envshare/pkg/encoding.test.ts | |
| parent | c7c9ca6f0c8eddf6d34cd40779f3b2d9463f3a46 (diff) | |
| download | HydroRoll-3adc965dd09490b7efa1cce9f09b0a3b30970277.tar.gz HydroRoll-3adc965dd09490b7efa1cce9f09b0a3b30970277.zip | |
✨优化文档
Diffstat (limited to 'envshare/pkg/encoding.test.ts')
| -rw-r--r-- | envshare/pkg/encoding.test.ts | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/envshare/pkg/encoding.test.ts b/envshare/pkg/encoding.test.ts deleted file mode 100644 index be0a7f8..0000000 --- a/envshare/pkg/encoding.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, it, expect, beforeAll } from "@jest/globals"; -import { decodeCompositeKey, encodeCompositeKey } from "./encoding"; -import { generateKey } from "./encryption"; -import { generateId } from "./id"; -import crypto from "node:crypto"; - -beforeAll(() => { - global.crypto = crypto.webcrypto; -}); -describe("composite key encoding", () => { - it("encodes and decodes composite keys", async () => { - for (let i = 0; i < 10000; i++) { - const id = generateId(); - const key = new Uint8Array(await crypto.subtle.exportKey("raw", await generateKey())); - - const encoded = encodeCompositeKey(1, id, key); - - const decoded = decodeCompositeKey(encoded); - expect(decoded.id).toEqual(id); - expect(decoded.encryptionKey).toEqual(key); - } - }); -}); |
