From 919a72a0d4e7dde9f8703834b9b4a800596a7e4b Mon Sep 17 00:00:00 2001 From: mryhryki Date: Sun, 30 Jul 2023 10:52:34 +0900 Subject: [PATCH] Fix code format --- src/index.test.ts | 25 ++++++++++++++++++------- src/test/01_flow.ts | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index 8057932..5941ff7 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -37,13 +37,24 @@ await Promise.all(Algorithms.map(async (alg) => { })); Deno.test("Compatibility (AES-CBC)", async (t) => { - const PlainData = "RMQc7sORwEpfXljFKRdp5mxlaAOvsndumTsAt3IvPLAb6L15hZ9wWX8pDkm9EHNE1dVsGvy01AiiOaVUltKKrK2SBJrtzhzywunE"; - const EncryptData = "8c0310307c7928ac3d9a1dc54b18bc35e7f73e4d85c2f3271d53a38efafd19850171efb525060e860c0fe01cd363dad53573ed1c7dd01c3d845e5cd65017628e7ecfbf96449ad4c06f69d9e69d87afaf01a64875a4f48339973b60ca1493a7783ef9e1ee9f06c8270f41c6cb08d23959"; - const Key = "b940fe16e9d74d4ad66686d6345b16db742279983af0a38f7fbfc3fcdb3195d8"; + const PlainData = + "RMQc7sORwEpfXljFKRdp5mxlaAOvsndumTsAt3IvPLAb6L15hZ9wWX8pDkm9EHNE1dVsGvy01AiiOaVUltKKrK2SBJrtzhzywunE"; + const EncryptData = + "8c0310307c7928ac3d9a1dc54b18bc35e7f73e4d85c2f3271d53a38efafd19850171efb525060e860c0fe01cd363dad53573ed1c7dd01c3d845e5cd65017628e7ecfbf96449ad4c06f69d9e69d87afaf01a64875a4f48339973b60ca1493a7783ef9e1ee9f06c8270f41c6cb08d23959"; + const Key = + "b940fe16e9d74d4ad66686d6345b16db742279983af0a38f7fbfc3fcdb3195d8"; const IV = "55bb4e5f8996d0a9e6a8a62c5adcff5b"; - await t.step(`printf '${PlainData}' | openssl aes-256-cbc -K "${Key}" -iv "${IV}" -nosalt | xxd -p`, async () => { - const result = await encrypt({ alg: "AES-CBC", iv: IV, key: Key, plainData: new TextEncoder().encode(PlainData) }); - assertEquals(result.data, EncryptData); - }); + await t.step( + `printf '${PlainData}' | openssl aes-256-cbc -K "${Key}" -iv "${IV}" -nosalt | xxd -p`, + async () => { + const result = await encrypt({ + alg: "AES-CBC", + iv: IV, + key: Key, + plainData: new TextEncoder().encode(PlainData), + }); + assertEquals(result.data, EncryptData); + }, + ); }); diff --git a/src/test/01_flow.ts b/src/test/01_flow.ts index 27e4935..7b9297d 100644 --- a/src/test/01_flow.ts +++ b/src/test/01_flow.ts @@ -47,7 +47,7 @@ const flow = async ({ encrypt, decrypt, alg, iv }: FlowArgs): Promise => { assert(encryptResult.iv, iv); } - const {plainData} = await decrypt({ ...encryptResult, key: KEY }); + const { plainData } = await decrypt({ ...encryptResult, key: KEY }); assert( new TextDecoder().decode(plainData), PlainData,