summaryrefslogtreecommitdiff
path: root/tests/unit_node/crypto/crypto_cipher_test.ts
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-03-14 06:30:29 -0700
committerGitHub <noreply@github.com>2024-03-14 19:00:29 +0530
commitcf3c6f9b0812ad487320834399bc4863dadd9655 (patch)
treef6d3491716661624d2f6453c63cf102c945d77fe /tests/unit_node/crypto/crypto_cipher_test.ts
parentcad79af785d2490aadacd935062b1703adef50d2 (diff)
fix(ext/node): crypto.getCipherInfo() (#22916)
Stub implementation of getCipherInfo(). Good enough for most cases. Note: We do not support all OpenSSL ciphers (likely never will) Fixes https://github.com/denoland/deno/issues/21805
Diffstat (limited to 'tests/unit_node/crypto/crypto_cipher_test.ts')
-rw-r--r--tests/unit_node/crypto/crypto_cipher_test.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit_node/crypto/crypto_cipher_test.ts b/tests/unit_node/crypto/crypto_cipher_test.ts
index d22028624..ab8bb4d37 100644
--- a/tests/unit_node/crypto/crypto_cipher_test.ts
+++ b/tests/unit_node/crypto/crypto_cipher_test.ts
@@ -256,3 +256,25 @@ Deno.test({
);
},
});
+
+Deno.test({
+ name: "getCiphers",
+ fn() {
+ assertEquals(crypto.getCiphers().includes("aes-128-cbc"), true);
+ },
+});
+
+Deno.test({
+ name: "getCipherInfo",
+ fn() {
+ const info = crypto.getCipherInfo("aes-128-cbc")!;
+ assertEquals(info.name, "aes-128-cbc");
+ assertEquals(info.keyLength, 16);
+ assertEquals(info.ivLength, 16);
+
+ const info2 = crypto.getCipherInfo("aes128")!;
+ assertEquals(info2.name, "aes-128-cbc");
+ assertEquals(info2.keyLength, 16);
+ assertEquals(info2.ivLength, 16);
+ },
+});