From 02e7d058482e5a6bfef3f449b7f3e69f7334e28e Mon Sep 17 00:00:00 2001 From: Ajitomi Daisuke Date: Thu, 22 Aug 2024 22:32:58 +0900 Subject: [PATCH] Introduce deno workspace. --- core/mod.ts | 12 ++++++------ deno.json | 12 +++++++++--- deno.lock | 16 ++++++++++------ dnt.ts | 8 ++++++++ import_map_for_dnt.json | 1 - x/chacha20poly1305/deno.json | 7 +------ x/chacha20poly1305/dnt.ts | 2 +- x/chacha20poly1305/import_map.json | 8 ++++++++ .../test/chacha20poly1305.test.ts | 5 ++--- x/dhkem-secp256k1/deno.json | 6 +----- x/dhkem-secp256k1/dnt.ts | 6 +++--- x/dhkem-secp256k1/import_map.json | 9 +++++++++ x/dhkem-secp256k1/src/dhkemSecp256k1.ts | 4 ++-- x/dhkem-secp256k1/src/secp256k1.ts | 4 ++-- x/dhkem-x25519/deno.json | 6 +----- x/dhkem-x25519/dnt.ts | 6 +++--- x/dhkem-x25519/import_map.json | 8 ++++++++ x/dhkem-x25519/src/dhkemX25519.ts | 3 ++- x/dhkem-x25519/src/hkdfSha256.ts | 2 +- x/dhkem-x25519/src/x25519.ts | 4 ++-- x/dhkem-x25519/test/dhkem-x25519.test.ts | 3 ++- x/dhkem-x448/deno.json | 6 +----- x/dhkem-x448/dnt.ts | 6 +++--- x/dhkem-x448/import_map.json | 8 ++++++++ x/dhkem-x448/src/dhkemX448.ts | 2 +- x/dhkem-x448/src/hkdfSha512.ts | 2 +- x/dhkem-x448/src/x448.ts | 17 +++++++---------- x/dhkem-x448/test/dhkem-x448.test.ts | 2 +- x/hybridkem-x25519-kyber768/deno.json | 6 +----- x/hybridkem-x25519-kyber768/dnt.ts | 6 +++--- x/hybridkem-x25519-kyber768/import_map.json | 9 +++++++++ .../src/hybridkemX25519Kyber768.ts | 8 +++----- x/hybridkem-x25519-kyber768/src/kemKyber768.ts | 4 ++-- .../test/conformance.test.ts | 5 +++-- .../test/hybridkemX25519Kyber768.test.ts | 2 +- x/hybridkem-x25519-kyber768/test/testVectors.ts | 2 +- 36 files changed, 126 insertions(+), 91 deletions(-) create mode 100644 x/chacha20poly1305/import_map.json create mode 100644 x/dhkem-secp256k1/import_map.json create mode 100644 x/dhkem-x25519/import_map.json create mode 100644 x/dhkem-x448/import_map.json create mode 100644 x/hybridkem-x25519-kyber768/import_map.json diff --git a/core/mod.ts b/core/mod.ts index bdd4cab3f..d0aace062 100644 --- a/core/mod.ts +++ b/core/mod.ts @@ -15,12 +15,12 @@ export type { RecipientContextParams } from "./src/interfaces/recipientContextPa export type { CipherSuiteSealResponse } from "./src/interfaces/responses.ts"; export type { SenderContextParams } from "./src/interfaces/senderContextParams.ts"; -// export { -// KEM_USAGES, -// LABEL_DKP_PRK, -// LABEL_SK, -// } from "./src/interfaces/dhkemPrimitives.ts"; -// export { SUITE_ID_HEADER_KEM } from "./src/interfaces/kemInterface.ts"; +export { + KEM_USAGES, + LABEL_DKP_PRK, + LABEL_SK, +} from "./src/interfaces/dhkemPrimitives.ts"; +export { SUITE_ID_HEADER_KEM } from "./src/interfaces/kemInterface.ts"; export { Aes128Gcm, Aes256Gcm } from "./src/aeads/aesGcm.ts"; export { ExportOnly } from "./src/aeads/exportOnly.ts"; diff --git a/deno.json b/deno.json index bf6caac0b..0fdfd5a88 100644 --- a/deno.json +++ b/deno.json @@ -1,10 +1,17 @@ { "name": "@dajiaji/hpke", "version": "1.2.9", + "workspace": [ + "./core", + "./x/chacha20poly1305", + "./x/dhkem-secp256k1", + "./x/dhkem-x25519", + "./x/dhkem-x448", + "./x/hybridkem-x25519-kyber768" + ], "exports": "./mod.ts", "imports": { "@deno/dnt": "jsr:@deno/dnt@^0.41.2", - "@hpke/core": "jsr:@hpke/core@^1.2.9", "@std/assert": "jsr:@std/assert@1.0.0", "@std/testing": "jsr:@std/testing@^1.0.0" }, @@ -16,8 +23,7 @@ "deno.lock", "mod.ts", "mod_core.ts", - "src/", - "x/chacha20poly1305/src/" + "src/" ], "exclude": [ "core/LICENSE", diff --git a/deno.lock b/deno.lock index 579b30e11..91babbee4 100644 --- a/deno.lock +++ b/deno.lock @@ -4,7 +4,6 @@ "specifiers": { "jsr:@deno/cache-dir@^0.8.0": "jsr:@deno/cache-dir@0.8.0", "jsr:@deno/dnt@^0.41.2": "jsr:@deno/dnt@0.41.2", - "jsr:@hpke/core@^1.2.9": "jsr:@hpke/core@1.2.9", "jsr:@std/assert@1.0.0": "jsr:@std/assert@1.0.0", "jsr:@std/assert@^0.218.2": "jsr:@std/assert@0.218.2", "jsr:@std/bytes@^0.218.2": "jsr:@std/bytes@0.218.2", @@ -41,9 +40,6 @@ "npm:code-block-writer@^13.0.1" ] }, - "@hpke/core@1.2.9": { - "integrity": "428de3f8885bd7305956d272cafa8759fb98f17ad465e57acd33bbdc0e18998e" - }, "@std/assert@0.218.2": { "integrity": "7f0a5a1a8cf86607cd6c2c030584096e1ffad27fc9271429a8cb48cfbdee5eaf" }, @@ -251,9 +247,17 @@ "workspace": { "dependencies": [ "jsr:@deno/dnt@^0.41.2", - "jsr:@hpke/core@^1.2.9", "jsr:@std/assert@1.0.0", "jsr:@std/testing@^1.0.0" - ] + ], + "members": { + "core": { + "dependencies": [ + "jsr:@deno/dnt@^0.41.2", + "jsr:@std/assert@1.0.0", + "jsr:@std/testing@^1.0.0" + ] + } + } } } diff --git a/dnt.ts b/dnt.ts index f48838114..7ce65fd70 100644 --- a/dnt.ts +++ b/dnt.ts @@ -32,6 +32,14 @@ await build({ package: { name: "hpke-js", version: Deno.args[0], + workspaces: [ + "core", + "x/chacha20poly1305", + "x/dhkem-secp256k1", + "x/dhkem-x25519", + "x/dhkem-x448", + "x/hybridkem-x25519-kyber768", + ], description: "A Hybrid Public Key Encryption (HPKE) module for various JavaScript runtimes", repository: { diff --git a/import_map_for_dnt.json b/import_map_for_dnt.json index f99e260d6..b7ae7091b 100644 --- a/import_map_for_dnt.json +++ b/import_map_for_dnt.json @@ -1,7 +1,6 @@ { "imports": { "@deno/dnt": "jsr:@deno/dnt@^0.41.2", - "@hpke/core": "npm:@hpke/core@^1.2.9", "@std/assert": "jsr:@std/assert@1.0.0", "@std/testing": "jsr:@std/testing@^1.0.0" } diff --git a/x/chacha20poly1305/deno.json b/x/chacha20poly1305/deno.json index 17635b258..9443d1610 100644 --- a/x/chacha20poly1305/deno.json +++ b/x/chacha20poly1305/deno.json @@ -2,15 +2,10 @@ "name": "@hpke/chacha20poly1305", "version": "1.2.9", "exports": "./mod.ts", - "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.2", - "@hpke/core": "jsr:@hpke/core@^1.2.9", - "@std/assert": "jsr:@std/assert@1.0.0", - "@std/testing": "jsr:@std/testing@^1.0.0" - }, "publish": { "exclude": [ "dnt.ts", + "import_map.json", "samples/", "test/", "tsconfig.json" diff --git a/x/chacha20poly1305/dnt.ts b/x/chacha20poly1305/dnt.ts index 6efb0217b..6f2b7a883 100644 --- a/x/chacha20poly1305/dnt.ts +++ b/x/chacha20poly1305/dnt.ts @@ -10,7 +10,7 @@ await build({ test: true, declaration: true, scriptModule: "umd", - importMap: "../../import_map_for_dnt.json", + importMap: "./import_map.json", compilerOptions: { lib: ["ES2022", "DOM"], }, diff --git a/x/chacha20poly1305/import_map.json b/x/chacha20poly1305/import_map.json new file mode 100644 index 000000000..a3315d2d2 --- /dev/null +++ b/x/chacha20poly1305/import_map.json @@ -0,0 +1,8 @@ +{ + "imports": { + "@deno/dnt": "jsr:@deno/dnt@^0.41.2", + "@hpke/core": "../../core/mod.ts", + "@std/assert": "jsr:@std/assert@1.0.0", + "@std/testing": "jsr:@std/testing@^1.0.0" + } +} diff --git a/x/chacha20poly1305/test/chacha20poly1305.test.ts b/x/chacha20poly1305/test/chacha20poly1305.test.ts index d567dae3d..f1aa479c9 100644 --- a/x/chacha20poly1305/test/chacha20poly1305.test.ts +++ b/x/chacha20poly1305/test/chacha20poly1305.test.ts @@ -1,15 +1,14 @@ import { assertEquals } from "@std/assert"; import { describe, it } from "@std/testing/bdd"; -import { AeadId } from "../../../core/src/identifiers.ts"; import { + AeadId, CipherSuite, DhkemP256HkdfSha256, HkdfSha256, -} from "../../../mod_core.ts"; +} from "@hpke/core"; import { loadCrypto } from "../../../core/test/utils.ts"; - import { Chacha20Poly1305 } from "../mod.ts"; describe("Chacha20Poly1305", () => { diff --git a/x/dhkem-secp256k1/deno.json b/x/dhkem-secp256k1/deno.json index 600f28205..d3b5a6a61 100644 --- a/x/dhkem-secp256k1/deno.json +++ b/x/dhkem-secp256k1/deno.json @@ -2,14 +2,10 @@ "name": "@hpke/dhkem-secp256k1", "version": "1.2.9", "exports": "./mod.ts", - "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.2", - "@std/assert": "jsr:@std/assert@1.0.0", - "@std/testing": "jsr:@std/testing@^1.0.0" - }, "publish": { "exclude": [ "dnt.ts", + "import_map.json", "samples/", "test/", "tsconfig.json" diff --git a/x/dhkem-secp256k1/dnt.ts b/x/dhkem-secp256k1/dnt.ts index 6b18094bc..96a159982 100644 --- a/x/dhkem-secp256k1/dnt.ts +++ b/x/dhkem-secp256k1/dnt.ts @@ -9,9 +9,9 @@ await build({ test: true, declaration: true, scriptModule: "umd", - importMap: "./deno.json", + importMap: "./import_map.json", compilerOptions: { - lib: ["es2022", "dom"], + lib: ["ES2022", "DOM"], }, shims: { deno: "dev", @@ -59,5 +59,5 @@ await build({ }); // post build steps -Deno.copyFileSync("../../LICENSE", "npm/LICENSE"); +Deno.copyFileSync("LICENSE", "npm/LICENSE"); Deno.copyFileSync("README.md", "npm/README.md"); diff --git a/x/dhkem-secp256k1/import_map.json b/x/dhkem-secp256k1/import_map.json new file mode 100644 index 000000000..b7f595a1e --- /dev/null +++ b/x/dhkem-secp256k1/import_map.json @@ -0,0 +1,9 @@ +{ + "imports": { + "@deno/dnt": "jsr:@deno/dnt@^0.41.2", + "@hpke/core": "../../core/mod.ts", + "@hpke/dhkem-x25519": "../dhkem-x25519/mod.ts", + "@std/assert": "jsr:@std/assert@1.0.0", + "@std/testing": "jsr:@std/testing@^1.0.0" + } +} diff --git a/x/dhkem-secp256k1/src/dhkemSecp256k1.ts b/x/dhkem-secp256k1/src/dhkemSecp256k1.ts index 3af5e9813..9cae97c2d 100644 --- a/x/dhkem-secp256k1/src/dhkemSecp256k1.ts +++ b/x/dhkem-secp256k1/src/dhkemSecp256k1.ts @@ -1,5 +1,5 @@ -import { Dhkem, KemId } from "../../../mod_core.ts"; -import { HkdfSha256 } from "../../../x/dhkem-x25519/mod.ts"; +import { Dhkem, KemId } from "@hpke/core"; +import { HkdfSha256 } from "@hpke/dhkem-x25519"; import { Secp256k1 } from "./secp256k1.ts"; diff --git a/x/dhkem-secp256k1/src/secp256k1.ts b/x/dhkem-secp256k1/src/secp256k1.ts index c683beead..26e780503 100644 --- a/x/dhkem-secp256k1/src/secp256k1.ts +++ b/x/dhkem-secp256k1/src/secp256k1.ts @@ -1,7 +1,7 @@ // @ts-ignore: for "npm:" import { secp256k1 } from "npm:@noble/curves@1.4.2/secp256k1"; -import type { DhkemPrimitives, KdfInterface } from "../../../mod_core.ts"; +import type { DhkemPrimitives, KdfInterface } from "@hpke/core"; import { DeriveKeyPairError, @@ -12,7 +12,7 @@ import { NotSupportedError, SerializeError, XCryptoKey, -} from "../../../mod_core.ts"; +} from "@hpke/core"; const ALG_NAME = "ECDH"; const EMPTY = new Uint8Array(); diff --git a/x/dhkem-x25519/deno.json b/x/dhkem-x25519/deno.json index 2d6c92b60..cdbe0c688 100644 --- a/x/dhkem-x25519/deno.json +++ b/x/dhkem-x25519/deno.json @@ -2,14 +2,10 @@ "name": "@hpke/dhkem-x25519", "version": "1.2.9", "exports": "./mod.ts", - "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.2", - "@std/assert": "jsr:@std/assert@1.0.0", - "@std/testing": "jsr:@std/testing@^1.0.0" - }, "publish": { "exclude": [ "dnt.ts", + "import_map.json", "samples/", "test/", "tsconfig.json" diff --git a/x/dhkem-x25519/dnt.ts b/x/dhkem-x25519/dnt.ts index e077df894..a60b0028f 100644 --- a/x/dhkem-x25519/dnt.ts +++ b/x/dhkem-x25519/dnt.ts @@ -9,9 +9,9 @@ await build({ test: true, declaration: true, scriptModule: "umd", - importMap: "./deno.json", + importMap: "./import_map.json", compilerOptions: { - lib: ["es2022", "dom"], + lib: ["ES2022", "DOM"], }, shims: { deno: "dev", @@ -59,5 +59,5 @@ await build({ }); // post build steps -Deno.copyFileSync("../../LICENSE", "npm/LICENSE"); +Deno.copyFileSync("LICENSE", "npm/LICENSE"); Deno.copyFileSync("README.md", "npm/README.md"); diff --git a/x/dhkem-x25519/import_map.json b/x/dhkem-x25519/import_map.json new file mode 100644 index 000000000..a3315d2d2 --- /dev/null +++ b/x/dhkem-x25519/import_map.json @@ -0,0 +1,8 @@ +{ + "imports": { + "@deno/dnt": "jsr:@deno/dnt@^0.41.2", + "@hpke/core": "../../core/mod.ts", + "@std/assert": "jsr:@std/assert@1.0.0", + "@std/testing": "jsr:@std/testing@^1.0.0" + } +} diff --git a/x/dhkem-x25519/src/dhkemX25519.ts b/x/dhkem-x25519/src/dhkemX25519.ts index 15bfd9cbb..bd48448db 100644 --- a/x/dhkem-x25519/src/dhkemX25519.ts +++ b/x/dhkem-x25519/src/dhkemX25519.ts @@ -1,4 +1,5 @@ -import { Dhkem, KemId } from "../../../mod_core.ts"; +import { Dhkem, KemId } from "@hpke/core"; + import { HkdfSha256 } from "./hkdfSha256.ts"; import { X25519 } from "./x25519.ts"; diff --git a/x/dhkem-x25519/src/hkdfSha256.ts b/x/dhkem-x25519/src/hkdfSha256.ts index a10c72946..968c3f63e 100644 --- a/x/dhkem-x25519/src/hkdfSha256.ts +++ b/x/dhkem-x25519/src/hkdfSha256.ts @@ -3,7 +3,7 @@ import { hmac } from "npm:@noble/hashes@1.4.0/hmac"; // @ts-ignore: for "npm:" import { sha256 } from "npm:@noble/hashes@1.4.0/sha256"; -import { HkdfSha256Native } from "../../../mod_core.ts"; +import { HkdfSha256Native } from "@hpke/core"; export class HkdfSha256 extends HkdfSha256Native { public override async extract( diff --git a/x/dhkem-x25519/src/x25519.ts b/x/dhkem-x25519/src/x25519.ts index 4945be4b9..820a38f88 100644 --- a/x/dhkem-x25519/src/x25519.ts +++ b/x/dhkem-x25519/src/x25519.ts @@ -1,7 +1,7 @@ // @ts-ignore: for "npm:" import { x25519 } from "npm:@noble/curves@1.4.2/ed25519"; -import type { DhkemPrimitives, KdfInterface } from "../../../mod_core.ts"; +import type { DhkemPrimitives, KdfInterface } from "@hpke/core"; import { base64UrlToBytes, @@ -13,7 +13,7 @@ import { NotSupportedError, SerializeError, XCryptoKey, -} from "../../../mod_core.ts"; +} from "@hpke/core"; const ALG_NAME = "X25519"; const EMPTY = new Uint8Array(); diff --git a/x/dhkem-x25519/test/dhkem-x25519.test.ts b/x/dhkem-x25519/test/dhkem-x25519.test.ts index 20b654275..cb140c896 100644 --- a/x/dhkem-x25519/test/dhkem-x25519.test.ts +++ b/x/dhkem-x25519/test/dhkem-x25519.test.ts @@ -9,7 +9,8 @@ import { HkdfSha256, KdfId, KemId, -} from "../../../core/mod.ts"; +} from "@hpke/core"; + import { loadCrypto } from "../../../core/test/utils.ts"; import { DhkemX25519HkdfSha256 } from "../mod.ts"; diff --git a/x/dhkem-x448/deno.json b/x/dhkem-x448/deno.json index 0bc516ae5..9d76de51f 100644 --- a/x/dhkem-x448/deno.json +++ b/x/dhkem-x448/deno.json @@ -2,14 +2,10 @@ "name": "@hpke/dhkem-x448", "version": "1.2.9", "exports": "./mod.ts", - "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.2", - "@std/assert": "jsr:@std/assert@1.0.0", - "@std/testing": "jsr:@std/testing@^1.0.0" - }, "publish": { "exclude": [ "dnt.ts", + "import_map.json", "samples/", "test/", "tsconfig.json" diff --git a/x/dhkem-x448/dnt.ts b/x/dhkem-x448/dnt.ts index 93a1e2098..c95544ae5 100644 --- a/x/dhkem-x448/dnt.ts +++ b/x/dhkem-x448/dnt.ts @@ -9,9 +9,9 @@ await build({ test: true, declaration: true, scriptModule: "umd", - importMap: "./deno.json", + importMap: "./import_map.json", compilerOptions: { - lib: ["es2022", "dom"], + lib: ["ES2022", "DOM"], }, shims: { deno: "dev", @@ -59,5 +59,5 @@ await build({ }); // post build steps -Deno.copyFileSync("../../LICENSE", "npm/LICENSE"); +Deno.copyFileSync("LICENSE", "npm/LICENSE"); Deno.copyFileSync("README.md", "npm/README.md"); diff --git a/x/dhkem-x448/import_map.json b/x/dhkem-x448/import_map.json new file mode 100644 index 000000000..a3315d2d2 --- /dev/null +++ b/x/dhkem-x448/import_map.json @@ -0,0 +1,8 @@ +{ + "imports": { + "@deno/dnt": "jsr:@deno/dnt@^0.41.2", + "@hpke/core": "../../core/mod.ts", + "@std/assert": "jsr:@std/assert@1.0.0", + "@std/testing": "jsr:@std/testing@^1.0.0" + } +} diff --git a/x/dhkem-x448/src/dhkemX448.ts b/x/dhkem-x448/src/dhkemX448.ts index 563c8272f..27125cd7c 100644 --- a/x/dhkem-x448/src/dhkemX448.ts +++ b/x/dhkem-x448/src/dhkemX448.ts @@ -1,4 +1,4 @@ -import { Dhkem, KemId } from "../../../mod_core.ts"; +import { Dhkem, KemId } from "@hpke/core"; import { HkdfSha512 } from "./hkdfSha512.ts"; import { X448 } from "./x448.ts"; diff --git a/x/dhkem-x448/src/hkdfSha512.ts b/x/dhkem-x448/src/hkdfSha512.ts index 86ff66e65..8f3d90e0a 100644 --- a/x/dhkem-x448/src/hkdfSha512.ts +++ b/x/dhkem-x448/src/hkdfSha512.ts @@ -3,7 +3,7 @@ import { hmac } from "npm:@noble/hashes@1.4.0/hmac"; // @ts-ignore: for "npm:" import { sha512 } from "npm:@noble/hashes@1.4.0/sha512"; -import { HkdfSha512Native } from "../../../mod_core.ts"; +import { HkdfSha512Native } from "@hpke/core"; export class HkdfSha512 extends HkdfSha512Native { public override async extract( diff --git a/x/dhkem-x448/src/x448.ts b/x/dhkem-x448/src/x448.ts index 510c64bdc..04c259895 100644 --- a/x/dhkem-x448/src/x448.ts +++ b/x/dhkem-x448/src/x448.ts @@ -1,25 +1,22 @@ // @ts-ignore: for "npm:" import { x448 } from "npm:@noble/curves@1.4.2/ed448"; -import type { DhkemPrimitives } from "../../../core/src/interfaces/dhkemPrimitives.ts"; -import type { KdfInterface } from "../../../core/src/interfaces/kdfInterface.ts"; +import type { DhkemPrimitives, KdfInterface } from "@hpke/core"; -import { EMPTY } from "../../../core/src/consts.ts"; import { + base64UrlToBytes, DeriveKeyPairError, DeserializeError, - NotSupportedError, - SerializeError, -} from "../../../core/src/errors.ts"; -import { KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, -} from "../../../core/src/interfaces/dhkemPrimitives.ts"; -import { base64UrlToBytes } from "../../../core/src/utils/misc.ts"; -import { XCryptoKey } from "../../../core/src/xCryptoKey.ts"; + NotSupportedError, + SerializeError, + XCryptoKey, +} from "@hpke/core"; const ALG_NAME = "X448"; +const EMPTY = new Uint8Array(); export class X448 implements DhkemPrimitives { private _hkdf: KdfInterface; diff --git a/x/dhkem-x448/test/dhkem-x448.test.ts b/x/dhkem-x448/test/dhkem-x448.test.ts index 2755066e3..4490f0b49 100644 --- a/x/dhkem-x448/test/dhkem-x448.test.ts +++ b/x/dhkem-x448/test/dhkem-x448.test.ts @@ -9,7 +9,7 @@ import { HkdfSha512, KdfId, KemId, -} from "../../../mod_core.ts"; +} from "@hpke/core"; import { loadCrypto } from "../../../core/test/utils.ts"; import { DhkemX448HkdfSha512 } from "../mod.ts"; diff --git a/x/hybridkem-x25519-kyber768/deno.json b/x/hybridkem-x25519-kyber768/deno.json index 0512de7a9..064d52283 100644 --- a/x/hybridkem-x25519-kyber768/deno.json +++ b/x/hybridkem-x25519-kyber768/deno.json @@ -2,14 +2,10 @@ "name": "@hpke/hybridkem-x25519-kyber768", "version": "1.2.9", "exports": "./mod.ts", - "imports": { - "@deno/dnt": "jsr:@deno/dnt@^0.41.2", - "@std/assert": "jsr:@std/assert@1.0.0", - "@std/testing": "jsr:@std/testing@^1.0.0" - }, "publish": { "exclude": [ "dnt.ts", + "import_map.json", "samples/", "test/", "tsconfig.json" diff --git a/x/hybridkem-x25519-kyber768/dnt.ts b/x/hybridkem-x25519-kyber768/dnt.ts index dfef6dff3..f27dc1988 100644 --- a/x/hybridkem-x25519-kyber768/dnt.ts +++ b/x/hybridkem-x25519-kyber768/dnt.ts @@ -9,9 +9,9 @@ await build({ test: true, declaration: true, scriptModule: "umd", - importMap: "./deno.json", + importMap: "./import_map.json", compilerOptions: { - lib: ["es2022", "dom"], + lib: ["ES2022", "DOM"], }, shims: { deno: "dev", @@ -59,5 +59,5 @@ await build({ }); // post build steps -Deno.copyFileSync("../../LICENSE", "npm/LICENSE"); +Deno.copyFileSync("LICENSE", "npm/LICENSE"); Deno.copyFileSync("README.md", "npm/README.md"); diff --git a/x/hybridkem-x25519-kyber768/import_map.json b/x/hybridkem-x25519-kyber768/import_map.json new file mode 100644 index 000000000..b7f595a1e --- /dev/null +++ b/x/hybridkem-x25519-kyber768/import_map.json @@ -0,0 +1,9 @@ +{ + "imports": { + "@deno/dnt": "jsr:@deno/dnt@^0.41.2", + "@hpke/core": "../../core/mod.ts", + "@hpke/dhkem-x25519": "../dhkem-x25519/mod.ts", + "@std/assert": "jsr:@std/assert@1.0.0", + "@std/testing": "jsr:@std/testing@^1.0.0" + } +} diff --git a/x/hybridkem-x25519-kyber768/src/hybridkemX25519Kyber768.ts b/x/hybridkem-x25519-kyber768/src/hybridkemX25519Kyber768.ts index a8a675b60..55497e745 100644 --- a/x/hybridkem-x25519-kyber768/src/hybridkemX25519Kyber768.ts +++ b/x/hybridkem-x25519-kyber768/src/hybridkemX25519Kyber768.ts @@ -1,9 +1,7 @@ -import type { DhkemInterface } from "../../../mod_core.ts"; +import type { DhkemInterface } from "@hpke/core"; -import { Dhkem, Hybridkem, KemId } from "../../../mod_core.ts"; - -import { HkdfSha256 } from "../../../x/dhkem-x25519/src/hkdfSha256.ts"; -import { X25519 } from "../../../x/dhkem-x25519/src/x25519.ts"; +import { Dhkem, Hybridkem, KemId } from "@hpke/core"; +import { HkdfSha256, X25519 } from "@hpke/dhkem-x25519"; import { KemKyber768 } from "./kemKyber768.ts"; diff --git a/x/hybridkem-x25519-kyber768/src/kemKyber768.ts b/x/hybridkem-x25519-kyber768/src/kemKyber768.ts index f29353049..3806cc916 100644 --- a/x/hybridkem-x25519-kyber768/src/kemKyber768.ts +++ b/x/hybridkem-x25519-kyber768/src/kemKyber768.ts @@ -5,7 +5,7 @@ import type { KemInterface, RecipientContextParams, SenderContextParams, -} from "../../../mod_core.ts"; +} from "@hpke/core"; import { DecapError, @@ -19,7 +19,7 @@ import { NotSupportedError, SerializeError, XCryptoKey, -} from "../../../mod_core.ts"; +} from "@hpke/core"; import { Kyber768 } from "./kyber/kyber768.ts"; diff --git a/x/hybridkem-x25519-kyber768/test/conformance.test.ts b/x/hybridkem-x25519-kyber768/test/conformance.test.ts index aebdb46fe..d96902885 100644 --- a/x/hybridkem-x25519-kyber768/test/conformance.test.ts +++ b/x/hybridkem-x25519-kyber768/test/conformance.test.ts @@ -1,9 +1,10 @@ import { assertEquals } from "@std/assert"; import { afterAll, beforeAll, describe, it } from "@std/testing/bdd"; -import type { PreSharedKey } from "../../../core/mod.ts"; +import type { PreSharedKey } from "@hpke/core"; + +import { Aes128Gcm, CipherSuite, HkdfSha256 } from "@hpke/core"; -import { Aes128Gcm, CipherSuite, HkdfSha256 } from "../../../core/mod.ts"; import { hexToBytes } from "../../../core/test/utils.ts"; import { HybridkemX25519Kyber768 } from "../mod.ts"; import { TEST_VECTORS } from "./testVectors.ts"; diff --git a/x/hybridkem-x25519-kyber768/test/hybridkemX25519Kyber768.test.ts b/x/hybridkem-x25519-kyber768/test/hybridkemX25519Kyber768.test.ts index 8fce8d03d..74cb7cf05 100644 --- a/x/hybridkem-x25519-kyber768/test/hybridkemX25519Kyber768.test.ts +++ b/x/hybridkem-x25519-kyber768/test/hybridkemX25519Kyber768.test.ts @@ -8,7 +8,7 @@ import { HkdfSha256, KdfId, KemId, -} from "../../../core/mod.ts"; +} from "@hpke/core"; import { HybridkemX25519Kyber768 } from "../mod.ts"; describe("constructor", () => { diff --git a/x/hybridkem-x25519-kyber768/test/testVectors.ts b/x/hybridkem-x25519-kyber768/test/testVectors.ts index 15331389e..e4832b3c8 100644 --- a/x/hybridkem-x25519-kyber768/test/testVectors.ts +++ b/x/hybridkem-x25519-kyber768/test/testVectors.ts @@ -1,4 +1,4 @@ -import type { AeadId, KdfId, KemId } from "../../../core/src/identifiers.ts"; +import type { AeadId, KdfId, KemId } from "@hpke/core"; interface TestVectorEncryption { aad: string;