Skip to content

Commit

Permalink
Bump deno version to 2.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
dajiaji committed Oct 11, 2024
1 parent c70f2a2 commit de9189e
Show file tree
Hide file tree
Showing 47 changed files with 450 additions and 387 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@ name: Deno CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
deno-version: [1.x, 2.x]
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: ${{ matrix.deno-version }}
- name: Run deno test
run: |
deno fmt --check
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci_browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Browser CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: read
Expand All @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: 2.x
- uses: actions/setup-node@v4
with:
node-version: v20.x
Expand Down Expand Up @@ -120,4 +120,4 @@ jobs:
- 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
run: npm install && npx playwright install && npx playwright test
run: npm install && npx playwright install && npx playwright test
8 changes: 4 additions & 4 deletions .github/workflows/ci_bun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: bun CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: read
Expand All @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: 2.x
- uses: actions/setup-node@v4
with:
node-version: v20.x
Expand All @@ -28,4 +28,4 @@ jobs:
deno task npm
deno task bun-link
- name: Run test
run: deno task test:bun
run: deno task test:bun
8 changes: 4 additions & 4 deletions .github/workflows/ci_cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Cloudflare Workers CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: read
Expand All @@ -16,11 +16,11 @@ jobs:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: 2.x
- uses: actions/setup-node@v4
with:
node-version: v20.x
- name: Prepare test
run: deno task npm
- name: Run test
run: deno task test:cloudflare
run: deno task test:cloudflare
8 changes: 4 additions & 4 deletions .github/workflows/ci_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Node.js CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
Expand All @@ -21,7 +21,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: 2.x
- name: Run dnt & minify
run: |
npm install -g esbuild
Expand Down Expand Up @@ -88,4 +88,4 @@ jobs:
deno task minify > ../../npm/packages/hpke-js/hpke.min.js
- name: Publish to npm (dry) for /packages/hpke-js
working-directory: ./npm/packages/hpke-js
run: npm publish --dry-run
run: npm publish --dry-run
61 changes: 30 additions & 31 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '38 17 * * 6'
- cron: "38 17 * * 6"

jobs:
analyze:
Expand All @@ -32,41 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: 2.x
- name: Run dnt
run: |
deno task test
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,12 @@ Browsers:
<head></head>
<body>
<script type="module">
import { AeadId, CipherSuite, KdfId, KemId } from "https://esm.sh/hpke-js@<SEMVER>";
import {
AeadId,
CipherSuite,
KdfId,
KemId,
} from "https://esm.sh/hpke-js@<SEMVER>";
// import {
// Aes128Gcm, CipherSuite, DhkemP256HkdfSha256, HkdfSha256,
// } from "https://esm.sh/@hpke/core@<SEMVER>";
Expand All @@ -464,19 +469,18 @@ Browsers:
const suite = new CipherSuite({
kem: KemId.DhkemP256HkdfSha256,
kdf: KdfId.HkdfSha256,
aead: AeadId.Aes128Gcm
aead: AeadId.Aes128Gcm,
});
const rkp = await suite.kem.generateKeyPair();
const sender = await suite.createSenderContext({
recipientPublicKey: rkp.publicKey
recipientPublicKey: rkp.publicKey,
});
// encrypt
const ct = await sender.seal(new TextEncoder().encode("Hello world!"));
const recipient = await suite.createRecipientContext({
recipientKey: rkp.privateKey, // rkp (CryptoKeyPair) is also acceptable.
enc: sender.enc,
Expand All @@ -490,8 +494,7 @@ Browsers:
} catch (err) {
alert("failed:", err.message);
}
}
};
</script>
<button type="button" onclick="doHpke()">do HPKE</button>
</body>
Expand Down
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"test": {
"exclude": [
"npm/",
"**/*.md",
"**/*/*.js",
"**/*/npm/",
"**/*/.wrangler/",
Expand All @@ -45,7 +46,7 @@
},
"tasks": {
"test:all": "deno task test && deno task npm && deno task test:cloudflare && deno task bun-link && deno task test:bun",
"test": "deno fmt && deno lint && deno test --import-map=./import_map.json -A --fail-fast --doc --coverage=coverage --parallel --allow-read",
"test": "deno fmt && deno lint && deno test --import-map=./import_map.json --fail-fast --doc --coverage=coverage --parallel --allow-read",
"test:common": "cd packages/common && deno task test",
"test:core": "cd packages/core && deno task test",
"test:chacha20poly1305": "cd packages/chacha20poly1305 && deno task test",
Expand Down
16 changes: 9 additions & 7 deletions packages/chacha20poly1305/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ try {
<script type="module">
// import * as hpke from "https://esm.sh/hpke-js@<SEMVER>";
import {
CipherSuite, DhkemP256HkdfSha256, HkdfSha256,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "https://esm.sh/@hpke/core@<SEMVER>";
import { Chacha20Poly1305 } from "https://esm.sh/@hpke/chacha20poly1305@<SEMVER>";
Expand All @@ -225,18 +227,18 @@ try {
const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Chacha20Poly1305()
aead: new Chacha20Poly1305(),
});
const rkp = await suite.kem.generateKeyPair();
const sender = await suite.createSenderContext({
recipientPublicKey: rkp.publicKey
recipientPublicKey: rkp.publicKey,
});
// encrypt
const ct = await sender.seal(new TextEncoder().encode("Hello world!"));
const recipient = await suite.createRecipientContext({
recipientKey: rkp.privateKey, // rkp (CryptoKeyPair) is also acceptable.
enc: sender.enc,
Expand All @@ -250,7 +252,7 @@ try {
} catch (err) {
alert("failed:", err.message);
}
}
};
</script>
<button type="button" onclick="doHpke()">do HPKE</button>
</body>
Expand Down
Loading

0 comments on commit de9189e

Please sign in to comment.