From 5c49d88645064a6416877c6ff228ee3f685e132c Mon Sep 17 00:00:00 2001 From: Ajitomi Daisuke Date: Sun, 13 Oct 2024 11:57:47 +0900 Subject: [PATCH] Use isDenoV1. --- packages/core/test/kemContext.test.ts | 12 ++++++++++++ packages/core/test/sample.test.ts | 23 ++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/packages/core/test/kemContext.test.ts b/packages/core/test/kemContext.test.ts index c359102d3..8635b1872 100644 --- a/packages/core/test/kemContext.test.ts +++ b/packages/core/test/kemContext.test.ts @@ -131,6 +131,9 @@ describe("generateKeyPair", () => { }); it("should return a proper instance with DhkemX448HkdfSha512", async () => { + if (isDenoV1()) { + return; + } // assert const kemContext = new DhkemX448HkdfSha512(); const kp = await kemContext.generateKeyPair(); @@ -363,6 +366,9 @@ describe("serialize/deserializePublicKey", () => { }); it("should return a proper instance with DhkemX448HkdfSha512", async () => { + if (isDenoV1()) { + return; + } // assert const kemContext = new DhkemX448HkdfSha512(); const kp = await kemContext.generateKeyPair(); @@ -848,6 +854,9 @@ describe("importKey", () => { }); it("should return a valid private key for DhkemX448HkdfSha512 from JWK", async () => { + if (isDenoV1()) { + return; + } const kemContext = new DhkemX448HkdfSha512(); const jwk = { @@ -866,6 +875,9 @@ describe("importKey", () => { }); it("should return a valid public key for DhkemX448HkdfSha512 from JWK", async () => { + if (isDenoV1()) { + return; + } const kemContext = new DhkemX448HkdfSha512(); const jwk = { diff --git a/packages/core/test/sample.test.ts b/packages/core/test/sample.test.ts index bbeb04e44..950b57839 100644 --- a/packages/core/test/sample.test.ts +++ b/packages/core/test/sample.test.ts @@ -1,7 +1,7 @@ import { assertEquals, assertRejects } from "@std/assert"; import { describe, it } from "@std/testing/bdd"; -import { isDeno } from "@hpke/common"; +import { isDeno, isDenoV1 } from "@hpke/common"; import { Aes128Gcm, Aes256Gcm, @@ -283,6 +283,9 @@ describe("README examples", () => { describe("Base mode with DhkemX25519HkdfSha256/HkdfSha256/Aes128Gcm", () => { it("should work normally", async () => { + if (isDenoV1()) { + return; + } // setup const suite = new CipherSuite({ kem: new DhkemX25519HkdfSha256(), @@ -366,6 +369,9 @@ describe("README examples", () => { }); it("should work normally with importKey('jwk') and using CryptoKeyPair", async () => { + if (isDenoV1()) { + return; + } // setup const suite = new CipherSuite({ kem: new DhkemX25519HkdfSha256(), @@ -416,6 +422,9 @@ describe("README examples", () => { }); describe("Base mode with DhkemX448HkdfSha256/HkdfSha512/Aes256Gcm)", () => { it("should work normally", async () => { + if (isDenoV1()) { + return; + } // setup const suite = new CipherSuite({ kem: new DhkemX448HkdfSha512(), @@ -499,6 +508,9 @@ describe("README examples", () => { }); it("should work normally with importKey('jwk') and using CryptoKeyPair", async () => { + if (isDenoV1()) { + return; + } // setup const suite = new CipherSuite({ kem: new DhkemX448HkdfSha512(), @@ -589,6 +601,9 @@ describe("README examples", () => { describe("Base mode with DhkemX25519HkdfSha256/HkdfSha256/ExportOnly", () => { it("should work normally", async () => { + if (isDenoV1()) { + return; + } // setup const suite = new CipherSuite({ kem: new DhkemX25519HkdfSha256(), @@ -749,6 +764,9 @@ describe("README examples", () => { describe("AuthPSK mode with DhkemX25519HkdfSha256", () => { it("should work normally", async () => { + if (isDenoV1()) { + return; + } // setup const suite = new CipherSuite({ kem: new DhkemX25519HkdfSha256(), @@ -793,6 +811,9 @@ describe("README examples", () => { describe("AuthPSK mode with DhkemX448HkdfSha512", () => { it("should work normally", async () => { + if (isDenoV1()) { + return; + } // setup const suite = new CipherSuite({ kem: new DhkemX448HkdfSha512(),