Skip to content

Commit

Permalink
Merge pull request #475 from dajiaji/ml-kem-initial-commit
Browse files Browse the repository at this point in the history
ml-kem: initial commit.
  • Loading branch information
dajiaji authored Nov 10, 2024
2 parents 6d80135 + 24fba7f commit 0b586f0
Show file tree
Hide file tree
Showing 42 changed files with 3,284 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci_browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
cp -rf ../hybridkem-x25519-kyber768/test/runtimes/browsers/pages/* test/runtimes/browsers/pages/hybridkem-x25519-kyber768
mkdir test/runtimes/browsers/pages/hybridkem-x-wing
cp -rf ../hybridkem-x-wing/test/runtimes/browsers/pages/* test/runtimes/browsers/pages/hybridkem-x-wing
mkdir test/runtimes/browsers/pages/ml-kem
cp -rf ../ml-kem/test/runtimes/browsers/pages/* test/runtimes/browsers/pages/ml-kem
mkdir test/runtimes/browsers/pages/dhkem-secp256k1
cp -rf ../dhkem-secp256k1/test/runtimes/browsers/pages/* test/runtimes/browsers/pages/dhkem-secp256k1
- name: Build docs for @hpke/common
Expand All @@ -57,6 +59,7 @@ jobs:
deno task minify > ../hpke-js/test/runtimes/browsers/pages/chacha20poly1305/src/hpke-common.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/hybridkem-x25519-kyber768/src/hpke-common.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/hybridkem-x-wing/src/hpke-common.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/ml-kem/src/hpke-common.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/dhkem-secp256k1/src/hpke-common.js
- name: Build docs for @hpke/core
working-directory: ./packages/core
Expand All @@ -68,6 +71,7 @@ jobs:
deno task minify > ../hpke-js/test/runtimes/browsers/pages/chacha20poly1305/src/hpke-core.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/hybridkem-x25519-kyber768/src/hpke-core.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/hybridkem-x-wing/src/hpke-core.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/ml-kem/src/hpke-core.js
deno task minify > ../hpke-js/test/runtimes/browsers/pages/dhkem-secp256k1/src/hpke-core.js
- name: Build docs for @hpke/chacha20poly1305
working-directory: ./packages/chacha20poly1305
Expand Down Expand Up @@ -99,6 +103,11 @@ jobs:
run: |
npx typedoc --name "@hpke/hybridkem-x-wing" --out ../hpke-js/test/runtimes/browsers/pages/hybridkem-x-wing/docs mod.ts
deno task minify > ../hpke-js/test/runtimes/browsers/pages/hybridkem-x-wing/src/hpke-hybridkem-x-wing.js
- name: Build docs for @hpke/ml-kem
working-directory: ./packages/ml-kem
run: |
npx typedoc --name "@hpke/ml-kem" --out ../hpke-js/test/runtimes/browsers/pages/ml-kem/docs mod.ts
deno task minify > ../hpke-js/test/runtimes/browsers/pages/ml-kem/src/hpke-ml-kem.js
- name: Build docs for @hpke/hpke-js
working-directory: ./packages/hpke-js
run: |
Expand Down Expand Up @@ -128,6 +137,8 @@ jobs:
run: npm install && npx playwright install && npx playwright test
- working-directory: ./packages/hybridkem-x-wing/test/runtimes/browsers
run: npm install && npx playwright install && npx playwright test
- working-directory: ./packages/ml-kem/test/runtimes/browsers
run: npm install && npx playwright install && npx playwright test
- working-directory: ./packages/dhkem-secp256k1/test/runtimes/browsers
run: npm install && npx playwright install && npx playwright test
- working-directory: ./packages/hpke-js/test/runtimes/browsers
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,11 @@ jobs:
- name: Publish to npm (dry) for /packages/hpke-js
working-directory: ./npm/packages/hpke-js
run: npm publish --dry-run
- name: Run dnt & minify for /packages/ml-kem
working-directory: ./packages/ml-kem
run: |
deno task dnt
deno task minify > ../../npm/packages/ml-kem/hpke-ml-kem.min.js
- name: Publish to npm (dry) for /packages/ml-kem
working-directory: ./npm/packages/ml-kem
run: npm publish --dry-run
6 changes: 6 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,9 @@ jobs:
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish @hpke/ml-kem to npm
continue-on-error: true
working-directory: ./npm/packages/ml-kem
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
34 changes: 23 additions & 11 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
"./packages/hybridkem-x25519-kyber768",
"./packages/hybridkem-x-wing",
"./packages/hpke-js",
"./packages/ml-kem",
"./packages/core/samples/deno",
"./packages/chacha20poly1305/samples/deno",
"./packages/dhkem-x25519/samples/deno",
"./packages/dhkem-x448/samples/deno",
"./packages/dhkem-secp256k1/samples/deno",
"./packages/hybridkem-x25519-kyber768/samples/deno",
"./packages/hybridkem-x-wing/samples/deno",
"./packages/hpke-js/samples/deno"
"./packages/hpke-js/samples/deno",
"./packages/ml-kem/samples/deno"
],
"fmt": {
"exclude": [
Expand Down Expand Up @@ -58,7 +60,8 @@
"test:hybridkem-x25519-kyber768": "cd packages/hybridkem-x25519-kyber768 && deno task test",
"test:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task test",
"test:hpke-js": "cd packages/hpke-js && deno task test",
"test:cloudflare": "deno task test:cloudflare:core && deno task test:cloudflare:chacha20poly1305 && deno task test:cloudflare:dhkem-x25519 && deno task test:cloudflare:dhkem-x448 && deno task test:cloudflare:dhkem-secp256k1 && deno task test:cloudflare:hybridkem-x25519-kyber768 && deno task test:cloudflare:hybridkem-x-wing && deno task test:cloudflare:hpke-js",
"test:ml-kem": "cd packages/ml-kem && deno task test",
"test:cloudflare": "deno task test:cloudflare:core && deno task test:cloudflare:chacha20poly1305 && deno task test:cloudflare:dhkem-x25519 && deno task test:cloudflare:dhkem-x448 && deno task test:cloudflare:dhkem-secp256k1 && deno task test:cloudflare:hybridkem-x25519-kyber768 && deno task test:cloudflare:hybridkem-x-wing && deno task test:cloudflare:hpke-js && deno task test:cloudflare:ml-kem",
"test:cloudflare:core": "cd npm && npm run test -w test/core/runtimes/cloudflare",
"test:cloudflare:chacha20poly1305": "cd npm && npm run test -w test/chacha20poly1305/runtimes/cloudflare",
"test:cloudflare:dhkem-x25519": "cd npm && npm run test -w test/dhkem-x25519/runtimes/cloudflare",
Expand All @@ -67,7 +70,8 @@
"test:cloudflare:hybridkem-x25519-kyber768": "cd npm && npm run test -w test/hybridkem-x25519-kyber768/runtimes/cloudflare",
"test:cloudflare:hybridkem-x-wing": "cd npm && npm run test -w test/hybridkem-x-wing/runtimes/cloudflare",
"test:cloudflare:hpke-js": "cd npm && npm run test -w test/hpke-js/runtimes/cloudflare",
"test:bun": "deno task test:bun:core && deno task test:bun:chacha20poly1305 && deno task test:bun:dhkem-x25519 && deno task test:bun:dhkem-x448 && deno task test:bun:dhkem-secp256k1 && deno task test:bun:hybridkem-x25519-kyber768 && deno task test:bun:hybridkem-x-wing && deno task test:bun:hpke-js",
"test:cloudflare:ml-kem": "cd npm && npm run test -w test/ml-kem/runtimes/cloudflare",
"test:bun": "deno task test:bun:core && deno task test:bun:chacha20poly1305 && deno task test:bun:dhkem-x25519 && deno task test:bun:dhkem-x448 && deno task test:bun:dhkem-secp256k1 && deno task test:bun:hybridkem-x25519-kyber768 && deno task test:bun:hybridkem-x-wing && deno task test:bun:hpke-js && deno task test:bun:ml-kem",
"test:bun:core": "cd packages/core && deno task test:bun",
"test:bun:chacha20poly1305": "cd packages/chacha20poly1305 && deno task test:bun",
"test:bun:dhkem-x25519": "cd packages/dhkem-x25519 && deno task test:bun",
Expand All @@ -76,9 +80,10 @@
"test:bun:hybridkem-x25519-kyber768": "cd packages/hybridkem-x25519-kyber768 && deno task test:bun",
"test:bun:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task test:bun",
"test:bun:hpke-js": "cd packages/hpke-js && deno task test:bun",
"test:bun:ml-kem": "cd packages/ml-kem && deno task test:bun",
"cov": "deno coverage ./coverage --lcov --exclude='test'",
"npm": "deno task dnt && deno task npm-link && deno task npm-pack && cd npm && npm install",
"dnt": "deno task dnt:common && deno task dnt:core && deno task dnt:chacha20poly1305 && deno task dnt:dhkem-x25519 && deno task dnt:dhkem-x448 && deno task dnt:dhkem-secp256k1 && deno task dnt:hybridkem-x25519-kyber768 && deno task dnt:hybridkem-x-wing && deno task dnt:hpke-js",
"dnt": "deno task dnt:common && deno task dnt:core && deno task dnt:chacha20poly1305 && deno task dnt:dhkem-x25519 && deno task dnt:dhkem-x448 && deno task dnt:dhkem-secp256k1 && deno task dnt:hybridkem-x25519-kyber768 && deno task dnt:hybridkem-x-wing && deno task dnt:hpke-js && deno task dnt:ml-kem",
"dnt:common": "cd packages/common && deno task dnt",
"dnt:core": "cd packages/core && deno task dnt",
"dnt:chacha20poly1305": "cd packages/chacha20poly1305 && deno task dnt",
Expand All @@ -88,7 +93,8 @@
"dnt:hybridkem-x25519-kyber768": "cd packages/hybridkem-x25519-kyber768 && deno task dnt",
"dnt:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task dnt",
"dnt:hpke-js": "cd packages/hpke-js && deno task dnt",
"npm-link": "deno task npm-link:common && deno task npm-link:core && deno task npm-link:chacha20poly1305 && deno task npm-link:dhkem-x25519 && deno task npm-link:dhkem-x448 && deno task npm-link:dhkem-secp256k1 && deno task npm-link:hybridkem-x25519-kyber768 && deno task npm-link:hybridkem-x-wing && deno task npm-link:hpke-js",
"dnt:ml-kem": "cd packages/ml-kem && deno task dnt",
"npm-link": "deno task npm-link:common && deno task npm-link:core && deno task npm-link:chacha20poly1305 && deno task npm-link:dhkem-x25519 && deno task npm-link:dhkem-x448 && deno task npm-link:dhkem-secp256k1 && deno task npm-link:hybridkem-x25519-kyber768 && deno task npm-link:hybridkem-x-wing && deno task npm-link:hpke-js && deno task npm-link:ml-kem",
"npm-link:common": "cd npm/packages/common && npm link",
"npm-link:core": "cd npm/packages/core && npm link",
"npm-link:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm link",
Expand All @@ -98,7 +104,8 @@
"npm-link:hybridkem-x25519-kyber768": "cd npm/packages/hybridkem-x25519-kyber768 && npm link",
"npm-link:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm link",
"npm-link:hpke-js": "cd npm/packages/hpke-js && npm link",
"npm-pack": "deno task npm-pack:common && deno task npm-pack:core && deno task npm-pack:chacha20poly1305 && deno task npm-pack:dhkem-x25519 && deno task npm-pack:dhkem-x448 && deno task npm-pack:dhkem-secp256k1 && deno task npm-pack:hybridkem-x25519-kyber768 && deno task npm-pack:hybridkem-x-wing && deno task npm-pack:hpke-js",
"npm-link:ml-kem": "cd npm/packages/ml-kem && npm link",
"npm-pack": "deno task npm-pack:common && deno task npm-pack:core && deno task npm-pack:chacha20poly1305 && deno task npm-pack:dhkem-x25519 && deno task npm-pack:dhkem-x448 && deno task npm-pack:dhkem-secp256k1 && deno task npm-pack:hybridkem-x25519-kyber768 && deno task npm-pack:hybridkem-x-wing && deno task npm-pack:hpke-js && deno task npm-pack:ml-kem",
"npm-pack:common": "cd npm/packages/common && npm pack --dry-run",
"npm-pack:core": "cd npm/packages/core && npm pack --dry-run",
"npm-pack:chacha20poly1305": "cd npm/packages/chacha20poly1305 && npm pack --dry-run",
Expand All @@ -108,7 +115,8 @@
"npm-pack:hybridkem-x25519-kyber768": "cd npm/packages/hybridkem-x25519-kyber768 && npm pack --dry-run",
"npm-pack:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && npm pack --dry-run",
"npm-pack:hpke-js": "cd npm/packages/hpke-js && npm pack --dry-run",
"bun-link": "deno task bun-link:common && deno task bun-link:core && deno task bun-link:chacha20poly1305 && deno task bun-link:dhkem-x25519 && deno task bun-link:dhkem-x448 && deno task bun-link:dhkem-secp256k1 && deno task bun-link:hybridkem-x25519-kyber768 && deno task bun-link:hybridkem-x-wing && deno task bun-link:hpke-js",
"npm-pack:ml-kem": "cd npm/packages/ml-kem && npm pack --dry-run",
"bun-link": "deno task bun-link:common && deno task bun-link:core && deno task bun-link:chacha20poly1305 && deno task bun-link:dhkem-x25519 && deno task bun-link:dhkem-x448 && deno task bun-link:dhkem-secp256k1 && deno task bun-link:hybridkem-x25519-kyber768 && deno task bun-link:hybridkem-x-wing && deno task bun-link:hpke-js && deno task bun-link:ml-kem",
"bun-link:common": "cd npm/packages/common && bun link",
"bun-link:core": "cd npm/packages/core && bun link",
"bun-link:chacha20poly1305": "cd npm/packages/chacha20poly1305 && bun link",
Expand All @@ -118,8 +126,9 @@
"bun-link:hybridkem-x25519-kyber768": "cd npm/packages/hybridkem-x25519-kyber768 && bun link",
"bun-link:hybridkem-x-wing": "cd npm/packages/hybridkem-x-wing && bun link",
"bun-link:hpke-js": "cd npm/packages/hpke-js && bun link",
"bun-link:ml-kem": "cd npm/packages/ml-kem && bun link",
"sample": "deno task sample:deno && deno task sample:node",
"sample:deno": "deno task sample:deno:core && deno task sample:deno:chacha20poly1305 && deno task sample:deno:dhkem-x25519 && deno task sample:deno:dhkem-x448 && deno task sample:deno:dhkem-secp256k1 && deno task sample:deno:hybridkem-x25519-kyber768 && deno task sample:deno:hybridkem-x-wing && deno task sample:deno:hpke-js",
"sample:deno": "deno task sample:deno:core && deno task sample:deno:chacha20poly1305 && deno task sample:deno:dhkem-x25519 && deno task sample:deno:dhkem-x448 && deno task sample:deno:dhkem-secp256k1 && deno task sample:deno:hybridkem-x25519-kyber768 && deno task sample:deno:hybridkem-x-wing && deno task sample:deno:hpke-js && deno task sample:deno:ml-kem",
"sample:deno:core": "cd packages/core && deno task sample:deno",
"sample:deno:chacha20poly1305": "cd packages/chacha20poly1305 && deno task sample:deno",
"sample:deno:dhkem-x25519": "cd packages/dhkem-x25519 && deno task sample:deno",
Expand All @@ -128,7 +137,8 @@
"sample:deno:hybridkem-x25519-kyber768": "cd packages/hybridkem-x25519-kyber768 && deno task sample:deno",
"sample:deno:hybridkem-x-wing": "cd packages/hybridkem-x-wing && deno task sample:deno",
"sample:deno:hpke-js": "cd packages/hpke-js && deno task sample:deno",
"sample:node": "deno task sample:node:core && deno task sample:node:chacha20poly1305 && deno task sample:node:dhkem-x25519 && deno task sample:node:dhkem-x448 && deno task sample:node:dhkem-secp256k1 && deno task sample:node:hybridkem-x25519-kyber768 && deno task sample:node:hybridkem-x-wing && deno task sample:node:hpke-js",
"sample:deno:ml-kem": "cd packages/ml-kem && deno task sample:deno",
"sample:node": "deno task sample:node:core && deno task sample:node:chacha20poly1305 && deno task sample:node:dhkem-x25519 && deno task sample:node:dhkem-x448 && deno task sample:node:dhkem-secp256k1 && deno task sample:node:hybridkem-x25519-kyber768 && deno task sample:node:hybridkem-x-wing && deno task sample:node:hpke-js && deno task sample:node:ml-kem",
"sample:node:core": "cd npm && npm run test -w samples/core",
"sample:node:chacha20poly1305": "cd npm && npm run test -w samples/chacha20poly1305",
"sample:node:dhkem-x25519": "cd npm && npm run test -w samples/dhkem-x25519",
Expand All @@ -137,14 +147,16 @@
"sample:node:hybridkem-x25519-kyber768": "cd npm && npm run test -w samples/hybridkem-x25519-kyber768",
"sample:node:hybridkem-x-wing": "cd npm && npm run test -w samples/hybridkem-x-wing",
"sample:node:hpke-js": "cd npm && npm run test -w samples/hpke-js",
"update:cloudflare": "deno task update:cloudflare:core || deno task update:cloudflare:chacha20poly1305 || deno task update:cloudflare:dhkem-x25519 || deno task update:cloudflare:dhkem-x448 || deno task update:cloudflare:dhkem-secp256k1 || deno task update:cloudflare:hybridkem-x25519-kyber768 || deno task update:cloudflare:hybridkem-x-wing || deno task update:cloudflare:hpke-js",
"sample:node:ml-kem": "cd npm && npm run test -w samples/ml-kem",
"update:cloudflare": "deno task update:cloudflare:core || deno task update:cloudflare:chacha20poly1305 || deno task update:cloudflare:dhkem-x25519 || deno task update:cloudflare:dhkem-x448 || deno task update:cloudflare:dhkem-secp256k1 || deno task update:cloudflare:hybridkem-x25519-kyber768 || deno task update:cloudflare:hybridkem-x-wing || deno task update:cloudflare:hpke-js || deno task update:cloudflare:ml-kem",
"update:cloudflare:core": "cd packages/core/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:chacha20poly1305": "cd packages/chacha20poly1305/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:dhkem-x25519": "cd packages/dhkem-x25519/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:dhkem-x448": "cd packages/dhkem-x448/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:dhkem-secp256k1": "cd packages/dhkem-secp256k1/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:hybridkem-x25519-kyber768": "cd packages/hybridkem-x25519-kyber768/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:hybridkem-x-wing": "cd packages/hybridkem-x-wing/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:hpke-js": "cd packages/hpke-js/test/runtimes/cloudflare && npm audit fix"
"update:cloudflare:hpke-js": "cd packages/hpke-js/test/runtimes/cloudflare && npm audit fix",
"update:cloudflare:ml-kem": "cd packages/ml-kem/test/runtimes/cloudflare && npm audit fix"
}
}
5 changes: 5 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b586f0

Please sign in to comment.