Skip to content

Commit faaf6ae

Browse files
authored
Merge pull request #333 from dajiaji/move-dhkem-x448-impl
Move dhkem-x448 impl to x/dhkem-x448.
2 parents 29ebf07 + 92e0161 commit faaf6ae

14 files changed

+33
-21
lines changed

core/mod.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export {
3030
HkdfSha512Native,
3131
} from "./src/kdfs/hkdf.ts";
3232
export { Dhkem } from "./src/kems/dhkem.ts";
33+
export { Ec } from "./src/kems/dhkemPrimitives/ec.ts";
3334
export {
3435
base64UrlToBytes,
3536
concat,

mod_core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export {
3232
HkdfSha512Native,
3333
} from "./core/src/kdfs/hkdf.ts";
3434
export { Dhkem } from "./core/src/kems/dhkem.ts";
35+
export { Ec } from "./core/src/kems/dhkemPrimitives/ec.ts";
3536
export {
3637
base64UrlToBytes,
3738
concat,

src/cipherSuite.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import { Aes128Gcm, Aes256Gcm } from "../core/src/aeads/aesGcm.ts";
55
import { ExportOnly } from "../core/src/aeads/exportOnly.ts";
66
import { Chacha20Poly1305 } from "../x/chacha20poly1305/src/chacha20Poly1305.ts";
77
import { InvalidParamError } from "../core/src/errors.ts";
8-
import { HkdfSha256 } from "../x/dhkem-x25519/src/hkdfSha256.ts";
98
import { HkdfSha384 } from "./kdfs/hkdfSha384.ts";
10-
import { HkdfSha512 } from "./kdfs/hkdfSha512.ts";
119
import { DhkemP256HkdfSha256 } from "./kems/dhkemP256.ts";
1210
import { DhkemP384HkdfSha384 } from "./kems/dhkemP384.ts";
1311
import { DhkemP521HkdfSha512 } from "./kems/dhkemP521.ts";
14-
import { DhkemX25519HkdfSha256 } from "../x/dhkem-x25519/src/dhkemX25519.ts";
15-
import { DhkemX448HkdfSha512 } from "./kems/dhkemX448.ts";
1612
import { AeadId, KdfId, KemId } from "../core/src/identifiers.ts";
1713
import { CipherSuiteNative } from "../core/src/cipherSuiteNative.ts";
1814

15+
import { DhkemX25519HkdfSha256, HkdfSha256 } from "../x/dhkem-x25519/mod.ts";
16+
17+
import { DhkemX448HkdfSha512, HkdfSha512 } from "../x/dhkem-x448/mod.ts";
18+
1919
/**
2020
* The Hybrid Public Key Encryption (HPKE) ciphersuite,
2121
* which supports all of the ciphersuites defined in

src/kems/dhkemP521.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { KemId } from "../../core/src/identifiers.ts";
2-
import { HkdfSha512 } from "../kdfs/hkdfSha512.ts";
3-
import { Dhkem } from "../../core/src/kems/dhkem.ts";
4-
import { Ec } from "../../core/src/kems/dhkemPrimitives/ec.ts";
1+
import { Dhkem, Ec, KemId } from "../../mod_core.ts";
2+
3+
import { HkdfSha512 } from "../../x/dhkem-x448/mod.ts";
54

65
export class DhkemP521HkdfSha512 extends Dhkem {
76
public readonly id: KemId = KemId.DhkemP521HkdfSha512;

test/cipherSuiteNative.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
DhkemP521HkdfSha512Native,
2424
} from "../core/src/kems/dhkemNative.ts";
2525
import { DhkemX25519HkdfSha256 } from "../x/dhkem-x25519/src/dhkemX25519.ts";
26-
import { DhkemX448HkdfSha512 } from "../src/kems/dhkemX448.ts";
26+
import { DhkemX448HkdfSha512 } from "../x/dhkem-x448/src/dhkemX448.ts";
2727
import { isDeno } from "../core/src/utils/misc.ts";
2828

2929
import { concat, hexToBytes, loadCrypto } from "../core/test/utils.ts";

test/dhkemPrimitives.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import { describe, it } from "@std/testing/bdd";
44
import * as errors from "../core/src/errors.ts";
55
import { KemId } from "../core/src/identifiers.ts";
66
import { HkdfSha384 } from "../src/kdfs/hkdfSha384.ts";
7-
import { HkdfSha512 } from "../src/kdfs/hkdfSha512.ts";
87
import { Ec } from "../core/src/kems/dhkemPrimitives/ec.ts";
9-
import { X448 } from "../src/kems/dhkemPrimitives/x448.ts";
108
import { isDeno } from "../core/src/utils/misc.ts";
119

1210
import { HkdfSha256 } from "../x/dhkem-x25519/src/hkdfSha256.ts";
1311
import { X25519 } from "../x/dhkem-x25519/src/x25519.ts";
1412

13+
import { HkdfSha512 } from "../x/dhkem-x448/src/hkdfSha512.ts";
14+
import { X448 } from "../x/dhkem-x448/src/x448.ts";
15+
1516
describe("derivePublicKey", () => {
1617
describe("with valid parameters", () => {
1718
it("should return a proper public key with Ec(DhkemP256HkdfSha256)", async () => {

test/kdfContext.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { assertEquals, assertRejects } from "@std/assert";
33
import { describe, it } from "@std/testing/bdd";
44

55
import { HkdfSha384 } from "../src/kdfs/hkdfSha384.ts";
6-
import { HkdfSha512 } from "../src/kdfs/hkdfSha512.ts";
76
import { AeadId, KdfId, KemId } from "../core/src/identifiers.ts";
87
import { i2Osp } from "../core/src/utils/misc.ts";
98
import { loadCrypto } from "../core/test/utils.ts";
109

1110
import { HkdfSha256 } from "../x/dhkem-x25519/src/hkdfSha256.ts";
11+
import { HkdfSha512 } from "../x/dhkem-x448/src/hkdfSha512.ts";
1212

1313
// deno-fmt-ignore
1414
const SUITE_ID_HEADER_HPKE = new Uint8Array([

test/kemContext.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import { KemId } from "../core/src/identifiers.ts";
66
import { DhkemP256HkdfSha256 } from "../src/kems/dhkemP256.ts";
77
import { DhkemP384HkdfSha384 } from "../src/kems/dhkemP384.ts";
88
import { DhkemP521HkdfSha512 } from "../src/kems/dhkemP521.ts";
9-
import { DhkemX448HkdfSha512 } from "../src/kems/dhkemX448.ts";
109
import { isDeno } from "../core/src/utils/misc.ts";
1110
import { loadCrypto } from "../core/test/utils.ts";
1211

1312
import { DhkemX25519HkdfSha256 } from "../x/dhkem-x25519/src/dhkemX25519.ts";
13+
import { DhkemX448HkdfSha512 } from "../x/dhkem-x448/src/dhkemX448.ts";
1414

1515
describe("constructor", () => {
1616
describe("with valid parameters", () => {

test/sample.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import * as errors from "../core/src/errors.ts";
77
import { DhkemP256HkdfSha256 } from "../src/kems/dhkemP256.ts";
88
import { DhkemP384HkdfSha384 } from "../src/kems/dhkemP384.ts";
99
import { DhkemP521HkdfSha512 } from "../src/kems/dhkemP521.ts";
10-
import { DhkemX448HkdfSha512 } from "../src/kems/dhkemX448.ts";
1110
import { HkdfSha384 } from "../src/kdfs/hkdfSha384.ts";
12-
import { HkdfSha512 } from "../src/kdfs/hkdfSha512.ts";
1311
import { isDeno } from "../core/src/utils/misc.ts";
1412

1513
import { DhkemX25519HkdfSha256 } from "../x/dhkem-x25519/src/dhkemX25519.ts";
1614
import { HkdfSha256 } from "../x/dhkem-x25519/src/hkdfSha256.ts";
1715

16+
import { DhkemX448HkdfSha512 } from "../x/dhkem-x448/src/dhkemX448.ts";
17+
import { HkdfSha512 } from "../x/dhkem-x448/src/hkdfSha512.ts";
18+
1819
import { concat, loadCrypto } from "../core/test/utils.ts";
1920

2021
describe("README examples", () => {

x/dhkem-x448/deno.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
"@std/assert": "jsr:@std/[email protected]",
88
"@std/testing": "jsr:@std/testing@^1.0.0"
99
},
10+
"publish": {
11+
"exclude": [
12+
"dnt.ts",
13+
"samples/",
14+
"test/",
15+
"tsconfig.json"
16+
]
17+
},
1018
"fmt": {
1119
"include": [
1220
"**/*.md",

0 commit comments

Comments
 (0)