Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.wasm32-unknown-unknown]
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""] # for getrandom 0.3
20 changes: 14 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
branches:
- main

env:
RUSTFLAGS: -Dwarnings

jobs:
test:
name: Build and Test
Expand All @@ -17,6 +14,10 @@ jobs:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable, nightly]
env:
# This environment variable would override the RUSTFLAGS value set in .config/cargo.toml when
# building for WASM. Thus, we only use it on host builds.
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.rust }}
Expand All @@ -37,6 +38,10 @@ jobs:
check_fmt_and_docs:
name: Lints and Docs
runs-on: ubuntu-latest
env:
# This environment variable would override the RUSTFLAGS value set in .config/cargo.toml when
# building for WASM. Thus, we only use it on host builds.
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -69,8 +74,11 @@ jobs:
target: wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: jetli/wasm-pack-action@v0.4.0
node-version: "22"
- name: install cargo-binstall
uses: cargo-bins/cargo-binstall@v1.12.6
- name: install wasm-pack
run: cargo binstall wasm-pack --version 0.13.1
- name: build with default features
run: wasm-pack build
- name: node test
Expand All @@ -82,7 +90,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: "22"
- run: npm ci
- run: npm run build
- run: npm run test
Expand Down
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hpke-dispatch"
version = "0.7.0"
version = "0.8.0"
edition = "2021"
description = "runtime algorithmic selection for hybrid public key encryption"
license = "MPL-2.0"
Expand Down Expand Up @@ -31,10 +31,10 @@ kem-dh-p521-hkdf-sha512 = ["hpke/p521"]
kem-x25519-hkdf-sha256 = ["hpke/x25519"]

[dependencies]
rand = "0.8.5"
rand = "0.9.2"
num_enum = "0.7.0"
cfg-if = "1.0.0"
hpke = { version = "0.12.0", default-features = false, features = ["std"] }
hpke = { version = "0.13.0", default-features = false, features = ["std"] }
zeroize = "1.6"

[dependencies.serde_crate]
Expand All @@ -43,9 +43,10 @@ features = ["derive"]
optional = true
package = "serde"

[target.'cfg(target_arch = "wasm32")'.dependencies]
[target.wasm32-unknown-unknown.dependencies]
wasm-bindgen = "0.2.87"
getrandom = { version = "0.2.10", features = ["js", "js-sys"] }
getrandom_2 = { package = "getrandom", version = "0.2.16", features = ["js", "js-sys"] } # for getrandom 0.2
getrandom_3 = { package = "getrandom", version = "0.3.3", features = ["wasm_js"] } # for getrandom 0.3

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
19 changes: 10 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hpke",
"description": "hybrid public key encryption",
"version": "0.7.0",
"version": "0.8.0",
"license": "MPL-2.0",
"repository": {
"type": "git",
Expand Down Expand Up @@ -35,6 +35,6 @@
"prettier": "^2.7.1",
"ts-mocha": "^10.0.0",
"typescript": "^4.7.4",
"wasm-pack": "^0.13.0"
"wasm-pack": "^0.13.1"
}
}
2 changes: 1 addition & 1 deletion src/base_mode_seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ where
info,
plaintext,
aad,
&mut rand::thread_rng(),
&mut rand::rng(),
)?;

Ok(EncappedKeyAndCiphertext {
Expand Down
2 changes: 1 addition & 1 deletion src/kem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl FromStr for Kem {
}

impl Kem {
/// generate a [`Keypair`] for this [`Config`] or [`Kem`].
/// generate a [`Keypair`] for this [`Kem`].
#[must_use]
pub fn gen_keypair(self) -> Keypair {
crate::gen_keypair(self)
Expand Down
2 changes: 1 addition & 1 deletion src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn gen_keypair(kem: Kem) -> Keypair {
}

fn gen_kp<KemT: hpke::kem::Kem>() -> Keypair {
let (private_key, public_key) = KemT::gen_keypair(&mut rand::thread_rng());
let (private_key, public_key) = KemT::gen_keypair(&mut rand::rng());
let public_key = public_key.to_bytes().to_vec();
let private_key = private_key.to_bytes().to_vec();

Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
unused_qualifications
)]
#![warn(missing_docs, clippy::cargo)]
#![allow(clippy::missing_errors_doc, clippy::use_self)]
#![allow(
clippy::missing_errors_doc,
clippy::use_self,
clippy::multiple_crate_versions
)]
#![doc = include_str!("../README.md")]

use hpke::Deserializable;
Expand Down
Loading