12 Commits
Author SHA1 Message Date
breakingbread 2de1b09087 fix(build): add missing bindgen in files 2026-06-14 00:38:16 +02:00
breakingbread 112db2e0fe chore(ci): update and put SHA and variables 2026-06-14 00:27:34 +02:00
breakingbread 90e9a905b0 chore(bump): update wasm-bindgen and add bindgen file in root 2026-06-14 00:18:25 +02:00
breakingbread 7e7ee43bad fix: added missing apache license in package.json file 2026-05-08 20:50:24 +02:00
breakingbread d3871afb58 ci: fix OIDC publishing with Node 24 and registry-url 2026-05-04 13:26:40 +02:00
breakingbread 7fca25291c ci: use OIDC trusted publisher, drop npm token 2026-05-04 13:06:54 +02:00
breakingbread 4476a5bcc4 chore: bump to v0.6.2 2026-05-04 12:59:53 +02:00
breakingbread edc8284936 feat: add zeroize feature to wipe blake3 internal key material on drop 2026-05-04 12:56:18 +02:00
breakingbreadandGitHub c9a6d8f39b ci: add permissions for contents in CI workflow 2026-04-30 20:31:39 +02:00
breakingbreadandGitHub ccb2d39c16 ci: update binaryen download URL in publish workflow 2026-04-30 20:26:02 +02:00
breakingbread 85b27b140d chore: fix indentation and update README.md
- Make readme clearer
2026-04-29 18:03:03 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
7f8fb67345 chore(deps): bump blake3 from 1.8.4 to 1.8.5 (#2)
Bumps [blake3](https://github.com/BLAKE3-team/BLAKE3) from 1.8.4 to 1.8.5.
- [Release notes](https://github.com/BLAKE3-team/BLAKE3/releases)
- [Commits](https://github.com/BLAKE3-team/BLAKE3/compare/1.8.4...1.8.5)

---
updated-dependencies:
- dependency-name: blake3
  dependency-version: 1.8.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-29 02:07:06 +02:00
7 changed files with 62 additions and 98 deletions
+5 -4
View File
@@ -12,18 +12,19 @@ env:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
- name: Install wasm-pack
run: |
curl -L https://github.com/rustwasm/wasm-pack/releases/download/v0.14.0/wasm-pack-v0.14.0-x86_64-unknown-linux-musl.tar.gz | tar xz
curl -L https://github.com/wasm-bindgen/wasm-pack/releases/download/v${{ vars.WASM_PACK_VERSION }}/wasm-pack-v${{ vars.WASM_PACK_VERSION }}-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv wasm-pack-*/wasm-pack /usr/local/bin/
- name: Install wasm-bindgen-cli
run: |
curl -L https://github.com/wasm-bindgen/wasm-bindgen/releases/download/0.2.118/wasm-bindgen-0.2.118-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv wasm-bindgen-*/wasm-bindgen /usr/local/bin/
curl -L https://github.com/wasm-bindgen/wasm-bindgen/releases/download/${{ vars.WASM_BINDGEN_VERSION }}/wasm-bindgen-${{ vars.WASM_BINDGEN_VERSION }}-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv wasm-bindgen-*/wasm-bindgen-test-runner /usr/local/bin/
- name: Rust tests
+11 -12
View File
@@ -4,10 +4,6 @@ on:
release:
types: [ published ]
permissions:
id-token: write
contents: read
env:
CARGO_TERM_COLOR: always
@@ -18,22 +14,28 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4
with:
node-version: '24.15.0'
registry-url: 'https://registry.npmjs.org'
- name: Install wasm-pack
run: |
curl -L https://github.com/wasm-bindgen/wasm-pack/releases/download/v0.14.0/wasm-pack-v0.14.0-x86_64-unknown-linux-musl.tar.gz | tar xz
curl -L https://github.com/wasm-bindgen/wasm-pack/releases/download/v${{ vars.WASM_PACK_VERSION }}/wasm-pack-v${{ vars.WASM_PACK_VERSION }}-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv wasm-pack-*/wasm-pack /usr/local/bin/
- name: Install wasm-bindgen-cli
run: |
curl -L https://github.com/wasm-bindgen/wasm-bindgen/releases/download/0.2.118/wasm-bindgen-0.2.118-x86_64-unknown-linux-musl.tar.gz | tar xz
curl -L https://github.com/wasm-bindgen/wasm-bindgen/releases/download/${{ vars.WASM_BINDGEN_VERSION }}/wasm-bindgen-${{ vars.WASM_BINDGEN_VERSION }}-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv wasm-bindgen-*/wasm-bindgen /usr/local/bin/
sudo mv wasm-bindgen-*/wasm-bindgen-test-runner /usr/local/bin/
- name: Install wasm-opt
run: |
curl -L https://github.com/WebAssembly/binaryen/releases/latest/download/binaryen-version_129-x86_64-linux.tar.gz | tar xz
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_${{ vars.WASM_OPT_VERSION }}/binaryen-version_${{ vars.WASM_OPT_VERSION }}-x86_64-linux.tar.gz | tar xz
sudo mv binaryen-*/bin/wasm-opt /usr/local/bin/
- name: Rust tests
@@ -47,8 +49,5 @@ jobs:
- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
cd pkg
npm publish --access public --provenance
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
npm publish
Generated
+31 -22
View File
@@ -19,6 +19,9 @@ name = "arrayvec"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
dependencies = [
"zeroize",
]
[[package]]
name = "async-trait"
@@ -39,9 +42,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "blake3"
version = "1.8.4"
version = "1.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d2d5991425dfd0785aed03aedcf0b321d61975c9b5b3689c774a2610ae0b51e"
checksum = "0aa83c34e62843d924f905e0f5c866eb1dd6545fc4d719e803d9ba6030371fce"
dependencies = [
"arrayref",
"arrayvec",
@@ -49,11 +52,12 @@ dependencies = [
"cfg-if",
"constant_time_eq",
"cpufeatures",
"zeroize",
]
[[package]]
name = "blake3-wasm-rs"
version = "0.6.1"
version = "0.6.3"
dependencies = [
"blake3",
"hex",
@@ -149,13 +153,12 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "js-sys"
version = "0.3.95"
version = "0.3.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca"
checksum = "f2025f20d7a4fa7785846e7b63d10a76d3f1cee98ee5cb79ea59703f95e42162"
dependencies = [
"cfg-if",
"futures-util",
"once_cell",
"wasm-bindgen",
]
@@ -366,9 +369,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89"
checksum = "a254a4b10c19a76f09a27640e7ffbf9bc30bf67e16a3bf28aaefa4920fe81563"
dependencies = [
"cfg-if",
"once_cell",
@@ -379,9 +382,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.68"
version = "0.4.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8"
checksum = "54568702fabf5d4849ce2b90fadfa64168a097eaf4b351ce9df8b687a0086aaf"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -389,9 +392,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed"
checksum = "24a40fc75b0ec6f3746ceb10d36f53a93dcd68a93b11b6445983945d79eba0dc"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -399,9 +402,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904"
checksum = "908f34bd9b9ce3d4caf07b72dfab63d61504d156856c6bd3cd87fa350cf3985b"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -412,18 +415,18 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129"
checksum = "7acbf7616c27b194bbb550bf77ed0c2c3e5b7fd1260a93082b95fb7f47959b92"
dependencies = [
"unicode-ident",
]
[[package]]
name = "wasm-bindgen-test"
version = "0.3.68"
version = "0.3.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bb55e2540ad1c56eec35fd63e2aea15f83b11ce487fd2de9ad11578dfc047ea"
checksum = "e28a0782b173cf2e98f62aacb487c5c021b7c5925df46098675f28e1fa85e159"
dependencies = [
"async-trait",
"cast",
@@ -443,9 +446,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.68"
version = "0.3.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caf0ca1bd612b988616bac1ab34c4e4290ef18f7148a1d8b7f31c150080e9295"
checksum = "ee997551ce1ad5adda03f7ce37ec34b4140fe9f547fd07b46d55901d1ba1a06b"
dependencies = [
"proc-macro2",
"quote",
@@ -454,9 +457,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-test-shared"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23cda5ecc67248c48d3e705d3e03e00af905769b78b9d2a1678b663b8b9d4472"
checksum = "ae0f005eb61f765eff31a79ef71df7e21819731268a868df41192c1e41d6d3e5"
[[package]]
name = "winapi-util"
@@ -482,6 +485,12 @@ dependencies = [
"windows-link",
]
[[package]]
name = "zeroize"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
[[package]]
name = "zmij"
version = "1.0.21"
+3 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "blake3-wasm-rs"
version = "0.6.1"
version = "0.6.3"
edition = "2024"
license = "MIT OR Apache-2.0"
authors = ["Thomas <[email protected]>"]
@@ -17,10 +17,11 @@ crate-type = ["cdylib", "rlib"]
default = []
wasm = ["dep:wasm-bindgen"]
talc = ["dep:talc"]
zeroize = ["blake3/zeroize"]
[dependencies]
blake3 = { version = "1", features = ["wasm32_simd"] }
wasm-bindgen = { version = "=0.2.118", optional = true }
wasm-bindgen = { version = "=0.2.123", optional = true }
[dev-dependencies]
wasm-bindgen-test = "0.3"
+4 -3
View File
@@ -20,12 +20,13 @@ build: build-all node-esm
build-all:
@echo "Building all target..."
RUSTFLAGS='-C opt-level=3 -C target-feature=+simd128' $(CARGO) build --target $(WASM_TARGET) --release --features wasm,talc
RUSTFLAGS='-C opt-level=3 -C target-feature=+simd128' $(CARGO) build --target $(WASM_TARGET) --release --features wasm,talc,zeroize
@mkdir -p $(ROOT)/bundler $(ROOT)/web $(ROOT)/node
$(WASM_BINDGEN) --target bundler --out-dir $(ROOT)/bundler $(TARGET_DIR)/$(CRATE).wasm
$(WASM_BINDGEN) --target web --out-dir $(ROOT)/web $(TARGET_DIR)/$(CRATE).wasm
$(WASM_BINDGEN) --target nodejs --out-dir $(ROOT)/node $(TARGET_DIR)/$(CRATE).wasm
@mv $(ROOT)/bundler/$(CRATE)_bg.wasm $(ROOT)/$(CRATE)_bg.wasm
@cp $(ROOT)/bundler/$(CRATE)_bg.js $(ROOT)/$(CRATE)_bg.js
@rm -f $(ROOT)/web/$(CRATE)_bg.wasm $(ROOT)/node/$(CRATE)_bg.wasm
$(WASM_OPT) $(WASM_OPT_FLAGS) $(ROOT)/$(CRATE)_bg.wasm -o $(ROOT)/$(CRATE)_bg.wasm
@node -e "['bundler','web','node'].forEach(d=>{const f='$(ROOT)/'+d+'/$(CRATE).js';require('fs').writeFileSync(f,require('fs').readFileSync(f,'utf8').replace(/$(CRATE)_bg\.wasm/g,'../$(CRATE)_bg.wasm'))})"
@@ -44,7 +45,7 @@ build-all:
type: 'module',\
version: '$(VERSION)',\
description: 'BLAKE3 hashing via Rust/WASM - works in Node.js (CJS + ESM), browsers, and bundlers',\
license: 'MIT',\
license: 'MIT OR Apache-2.0',\
repository: { type: 'git', url: 'https://github.com/UneBaguette/blake3.wasm' },\
main: 'index.js',\
types: 'index.d.ts',\
@@ -54,7 +55,7 @@ build-all:
import: './bundler/$(CRATE).js',\
default: './web/$(CRATE).js'\
}},\
files: ['bundler/', 'web/', 'node/', 'node-esm/', 'index.js', 'index.d.ts', '$(CRATE)_bg.wasm', 'README.md', 'LICENSE'],\
files: ['bundler/', 'web/', 'node/', 'node-esm/', 'index.js', 'index.d.ts', '$(CRATE)_bg.wasm', '$(CRATE)_bg.js', 'README.md', 'LICENSE'],\
keywords: ['blake3', 'wasm', 'hash', 'cryptography', 'wasm-bindgen']\
};\
require('fs').writeFileSync('./$(ROOT)/package.json', JSON.stringify(pkg, null, 2) + '\n');"
+8 -54
View File
@@ -35,7 +35,7 @@ blake3.deriveKey('my context', key);
// Conctruct for Streaming
{
using h = new blake3.Hasher();
const h = new blake3.Hasher();
h.update(data.slice(0, 5));
h.update(data.slice(5));
h.finalize();
@@ -45,23 +45,19 @@ blake3.deriveKey('my context', key);
// Streaming
// Keyed (MAC mode)
{
using mac = blake3.Hasher.newKeyed(key);
mac.update(data);
mac.finalize();
}
const mac = blake3.Hasher.newKeyed(key);
mac.update(data);
mac.finalize();
// Streaming
// Key derivation mode
{
using kdf = blake3.Hasher.newDeriveKey('my app v1 :: subkey');
kdf.update(key);
kdf.finalize();
}
const kdf = blake3.Hasher.newDeriveKey('my app v1 :: subkey');
kdf.update(key);
kdf.finalize();
// Batch hashing without re-allocating
{
using h = new blake3.Hasher();
const h = new blake3.Hasher();
h.update(chunk1);
const first = h.finalizeAndReset();
h.update(chunk2);
@@ -73,48 +69,6 @@ blake3.deriveKey('my context', key);
```ts
import { hash, hashXof, keyedHash, deriveKey, Hasher } from 'blake3-wasm-rs';
const data = new TextEncoder().encode('hello world');
const key = new Uint8Array(32).fill(1);
// One-shot hashing
hash(data);
hashXof(data, 64); // variable output length
keyedHash(data, key); // key must be exactly 32 bytes
deriveKey('my context', key);
// Streaming
{
using h = new Hasher();
h.update(data.slice(0, 5));
h.update(data.slice(5));
h.finalize();
h.finalizeXof(64);
h.reset();
}
// Keyed (MAC mode)
{
using mac = Hasher.newKeyed(key);
mac.update(data);
mac.finalize();
}
// Key derivation mode
{
using kdf = Hasher.newDeriveKey('my app v1 :: subkey');
kdf.update(key);
kdf.finalize();
}
// Batch hashing without re-allocating
{
using h = new Hasher();
h.update(chunk1);
const first = h.finalizeAndReset();
h.update(chunk2);
const second = h.finalizeAndReset();
}
```
## API
-1
View File
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright 2026 Thomas <[email protected]>
// @ts-nocheck
export { Hasher, deriveKey, hash, hashXof, keyedHash } from './bundler/blake3_wasm_rs';