Skip to content

Commit d7fdbfb

Browse files
authored
Merge pull request #335 from dajiaji/move-hybridkem-x25519-kyber768-to-x
Move hybridkem-x25519-kyber768 impl to x/hybridkem-x25519-kyber768.
2 parents b35ac49 + 3137c43 commit d7fdbfb

File tree

11 files changed

+23
-27
lines changed

11 files changed

+23
-27
lines changed

core/mod.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export {
3131
} from "./src/kdfs/hkdf.ts";
3232
export { Dhkem } from "./src/kems/dhkem.ts";
3333
export { Ec } from "./src/kems/dhkemPrimitives/ec.ts";
34+
export { Hybridkem } from "./src/kems/hybridkem.ts";
3435
export {
3536
base64UrlToBytes,
3637
concat,

src/kems/hybridkem.ts renamed to core/src/kems/hybridkem.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
1-
import type {
2-
DhkemInterface,
3-
KdfInterface,
4-
KemInterface,
5-
RecipientContextParams,
6-
SenderContextParams,
7-
} from "../../mod_core.ts";
1+
import type { DhkemInterface } from "../interfaces/dhkemInterface.ts";
2+
import type { KdfInterface } from "../interfaces/kdfInterface.ts";
3+
import type { KemInterface } from "../interfaces/kemInterface.ts";
4+
import type { SenderContextParams } from "../interfaces/senderContextParams.ts";
5+
import type { RecipientContextParams } from "../interfaces/recipientContextParams.ts";
86

7+
import { EMPTY } from "../consts.ts";
98
import {
10-
concat,
119
DeserializeError,
12-
i2Osp,
1310
InvalidParamError,
14-
isCryptoKeyPair,
15-
KemId,
16-
LABEL_DKP_PRK,
17-
LABEL_SK,
1811
NotSupportedError,
1912
SerializeError,
20-
SUITE_ID_HEADER_KEM,
21-
XCryptoKey,
22-
} from "../../mod_core.ts";
23-
24-
const EMPTY = new Uint8Array();
13+
} from "../errors.ts";
14+
import { KemId } from "../identifiers.ts";
15+
import { LABEL_DKP_PRK, LABEL_SK } from "../interfaces/dhkemPrimitives.ts";
16+
import { SUITE_ID_HEADER_KEM } from "../interfaces/kemInterface.ts";
17+
import { concat, i2Osp, isCryptoKeyPair } from "../utils/misc.ts";
18+
import { XCryptoKey } from "../xCryptoKey.ts";
2519

2620
export class Hybridkem implements KemInterface {
2721
public readonly id: KemId = KemId.NotAssigned;

mod_core.ts

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

x/hybridkem-x25519-kyber768/mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { HybridkemX25519Kyber768 } from "../../src/kems/hybridkemX25519Kyber768.ts";
1+
export { HybridkemX25519Kyber768 } from "./src/hybridkemX25519Kyber768.ts";

src/kems/hybridkemX25519Kyber768.ts renamed to x/hybridkem-x25519-kyber768/src/hybridkemX25519Kyber768.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { DhkemInterface } from "../../mod_core.ts";
1+
import type { DhkemInterface } from "../../../mod_core.ts";
22

3-
import { Dhkem, KemId } from "../../mod_core.ts";
4-
import { HkdfSha256 } from "../../x/dhkem-x25519/src/hkdfSha256.ts";
5-
import { X25519 } from "../../x/dhkem-x25519/src/x25519.ts";
3+
import { Dhkem, Hybridkem, KemId } from "../../../mod_core.ts";
4+
5+
import { HkdfSha256 } from "../../../x/dhkem-x25519/src/hkdfSha256.ts";
6+
import { X25519 } from "../../../x/dhkem-x25519/src/x25519.ts";
67

7-
import { Hybridkem } from "./hybridkem.ts";
88
import { KemKyber768 } from "./kemKyber768.ts";
99

1010
class DhkemX25519HkdfSha256 extends Dhkem implements DhkemInterface {

src/kems/kemKyber768.ts renamed to x/hybridkem-x25519-kyber768/src/kemKyber768.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
KemInterface,
66
RecipientContextParams,
77
SenderContextParams,
8-
} from "../../mod_core.ts";
8+
} from "../../../mod_core.ts";
99

1010
import {
1111
DecapError,
@@ -19,9 +19,9 @@ import {
1919
NotSupportedError,
2020
SerializeError,
2121
XCryptoKey,
22-
} from "../../mod_core.ts";
22+
} from "../../../mod_core.ts";
2323

24-
import { Kyber768 } from "./primitives/kyber/kyber768.ts";
24+
import { Kyber768 } from "./kyber/kyber768.ts";
2525

2626
const ALG_NAME = "Keyber768";
2727

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)