Skip to content

Commit a94f26d

Browse files
committed
Move chacha20poly1305 impl to x/chacha20poly1305.
1 parent 134b539 commit a94f26d

30 files changed

+440
-62
lines changed

.github/workflows/ci_bun.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,18 @@ jobs:
2525
- uses: actions/setup-node@v4
2626
with:
2727
node-version: v20.x
28-
- run: |
29-
npm install -g esbuild
30-
deno task dnt
31-
deno task minify > test/runtimes/hpke.js
3228
- uses: antongolub/action-setup-bun@v1
3329
with:
3430
bun-version: ${{ matrix.bun-version }}
3531
- name: Install esbuild
3632
run: npm install -g esbuild
37-
- name: Run dnt
38-
run: deno run -A dnt.ts 0.0.0
39-
- name: Run npm pack
40-
working-directory: ./npm
41-
run: npm pack
42-
- name: Run test
43-
working-directory: ./test/runtimes/bun
44-
run: |
45-
bun install
46-
nohup bun run src/index.ts &
47-
sleep 3
48-
deno test hpke.spec.ts --allow-net --config ../../../deno.json
49-
- working-directory: ./core
33+
- name: Prepare test for core
34+
working-directory: ./core
5035
run: |
5136
deno task dnt
5237
deno run -A dnt.ts 0.0.0
5338
deno task minify > ../x/dhkem-x25519/test/runtimes/hpke-core.js
5439
deno task minify > ../x/dhkem-x448/test/runtimes/hpke-core.js
55-
deno task minify > ../x/chacha20poly1305/test/runtimes/hpke-core.js
5640
deno task minify > ../x/hybridkem-x25519-kyber768/test/runtimes/hpke-core.js
5741
deno task minify > ../x/dhkem-secp256k1/test/runtimes/hpke-core.js
5842
- name: Run npm pack for core
@@ -65,6 +49,22 @@ jobs:
6549
nohup bun src/index.ts &
6650
sleep 3
6751
deno test core.spec.ts --allow-net --config ../../../deno.json
52+
- name: Run test for hpke-js
53+
working-directory: ./
54+
run: |
55+
deno task dnt
56+
deno run -A dnt.ts 0.0.0
57+
deno task minify > test/runtimes/hpke.js
58+
- name: Run npm pack for hpke-js
59+
working-directory: ./npm
60+
run: npm pack
61+
- name: Run test for hpke-js
62+
working-directory: ./test/runtimes/bun
63+
run: |
64+
bun install
65+
nohup bun run src/index.ts &
66+
sleep 3
67+
deno test hpke.spec.ts --allow-net --config ../../../deno.json
6868
- working-directory: ./x/dhkem-x25519
6969
run: |
7070
deno task dnt
@@ -88,13 +88,17 @@ jobs:
8888
- working-directory: ./x/chacha20poly1305
8989
run: |
9090
deno task dnt
91-
deno task minify > test/runtimes/hpke-chacha20poly1305.js
91+
deno run -A dnt.ts 0.0.0
92+
- name: Run npm pack for chacha20poly1305
93+
working-directory: ./x/chacha20poly1305/npm
94+
run: npm pack
9295
- name: Run test for chacha20poly1305
9396
working-directory: ./x/chacha20poly1305/test/runtimes/bun
9497
run: |
95-
nohup bun src/index.js &
98+
bun install
99+
nohup bun src/index.ts &
96100
sleep 3
97-
deno test chacha20poly1305.spec.ts --allow-net
101+
deno test chacha20poly1305.spec.ts --allow-net --config ../../../deno.json
98102
- working-directory: ./x/hybridkem-x25519-kyber768
99103
run: |
100104
deno task dnt

deno.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,29 @@
44
"exports": "./mod.ts",
55
"imports": {
66
"@deno/dnt": "jsr:@deno/dnt@^0.41.2",
7+
"@hpke/core": "jsr:@hpke/core@^1.2.9",
78
"@std/assert": "jsr:@std/[email protected]",
89
"@std/testing": "jsr:@std/testing@^1.0.0"
910
},
1011
"publish": {
12+
"include": [
13+
"README.md",
14+
"core/",
15+
"deno.json",
16+
"deno.lock",
17+
"mod.ts",
18+
"src/",
19+
"x/chacha20poly1305/src/"
20+
],
1121
"exclude": [
12-
".github/",
1322
"core/LICENSE",
1423
"core/README.md",
1524
"core/deno.json",
1625
"core/deno.lock",
1726
"core/dnt.ts",
27+
"core/samples/",
1828
"core/test/",
19-
"core/tsconfig.json",
20-
"dnt.ts",
21-
"samples/",
22-
"test/",
23-
"x/"
29+
"core/tsconfig.json"
2430
]
2531
},
2632
"fmt": {

deno.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dnt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ await build({
2222
test: true,
2323
declaration: "inline",
2424
scriptModule: "umd",
25-
importMap: "./deno.json",
25+
importMap: "./import_map_for_dnt.json",
2626
compilerOptions: {
2727
lib: ["ES2022", "DOM"],
2828
},

import_map_for_dnt.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"imports": {
3+
"@deno/dnt": "jsr:@deno/dnt@^0.41.2",
4+
"@hpke/core": "npm:@hpke/core@^1.2.9",
5+
"@std/assert": "jsr:@std/[email protected]",
6+
"@std/testing": "jsr:@std/testing@^1.0.0"
7+
}
8+
}

src/cipherSuite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { KemInterface } from "../core/src/interfaces/kemInterface.ts";
33

44
import { Aes128Gcm, Aes256Gcm } from "../core/src/aeads/aesGcm.ts";
55
import { ExportOnly } from "../core/src/aeads/exportOnly.ts";
6-
import { Chacha20Poly1305 } from "./aeads/chacha20Poly1305.ts";
6+
import { Chacha20Poly1305 } from "../x/chacha20poly1305/src/chacha20Poly1305.ts";
77
import { InvalidParamError } from "../core/src/errors.ts";
88
import { HkdfSha256 } from "./kdfs/hkdfSha256.ts";
99
import { HkdfSha384 } from "./kdfs/hkdfSha384.ts";

test/cipherSuiteNative.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
KemId,
1010
} from "../mod.ts";
1111
import { Aes128Gcm, Aes256Gcm } from "../core/src/aeads/aesGcm.ts";
12-
import { Chacha20Poly1305 } from "../src/aeads/chacha20Poly1305.ts";
12+
import { Chacha20Poly1305 } from "../x/chacha20poly1305/mod.ts";
1313
import { ExportOnly } from "../core/src/aeads/exportOnly.ts";
1414
import { CipherSuiteNative } from "../core/src/cipherSuiteNative.ts";
1515
import {

test/runtimes/bun/bun.lockb

369 Bytes
Binary file not shown.

test/runtimes/bun/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"typescript": "^5.0.0"
1010
},
1111
"dependencies": {
12-
"@dajiaji/hpke": "file:../../../npm/hpke-js-0.0.0.tgz"
12+
"@dajiaji/hpke": "file:../../../npm/hpke-js-0.0.0.tgz",
13+
"@hpke/core": "file:../../../core/npm/hpke-core-0.0.0.tgz"
1314
}
1415
}

tsconfig.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22
"compilerOptions": {
33
"module": "es2022",
44
"target": "es2022",
5+
"paths": {
6+
"@hpke/core": ["./core/mod.ts"],
7+
},
58
"noEmit": true,
69
"allowImportingTsExtensions": true
710
},
811
"include": [
12+
"core/**/*",
913
"mod.ts",
1014
"src/**/*"
11-
]
15+
],
16+
"exclude": [
17+
"core/dnt.ts",
18+
"core/samples/**/*",
19+
"core/test/**/*",
20+
"src/test/**/*"
21+
],
1222
}

0 commit comments

Comments
 (0)