From ce74d65fd9aef393a3585dd4c45e5317e74e3f45 Mon Sep 17 00:00:00 2001 From: Nadim Kobeissi Date: Sat, 19 Aug 2023 13:17:38 +0200 Subject: [PATCH] Noise Explorer v1.0.4 --- .releaserc | 2 +- CHANGELOG.md | 7 +- README.md | 2 +- html/cmd/index.html | 142 +-- html/res/css/style.css | 1136 ++++++++--------- html/res/img/logo.svg | 312 ++--- html/res/js/noiseWebIde.js | 816 ++++++------ implementations/go/I1K.noise.go | 2 +- implementations/go/I1K1.noise.go | 2 +- implementations/go/I1N.noise.go | 2 +- implementations/go/I1X.noise.go | 2 +- implementations/go/I1X1.noise.go | 2 +- implementations/go/IK.noise.go | 2 +- implementations/go/IK1.noise.go | 2 +- implementations/go/IKpsk1.noise.go | 2 +- implementations/go/IKpsk2.noise.go | 2 +- implementations/go/IN.noise.go | 2 +- implementations/go/INpsk1.noise.go | 2 +- implementations/go/INpsk2.noise.go | 2 +- implementations/go/IX.noise.go | 2 +- implementations/go/IX1.noise.go | 2 +- implementations/go/IXpsk2.noise.go | 2 +- implementations/go/K.noise.go | 2 +- implementations/go/K1K.noise.go | 2 +- implementations/go/K1K1.noise.go | 2 +- implementations/go/K1N.noise.go | 2 +- implementations/go/K1X.noise.go | 2 +- implementations/go/K1X1.noise.go | 2 +- implementations/go/KK.noise.go | 2 +- implementations/go/KK1.noise.go | 2 +- implementations/go/KKpsk0.noise.go | 2 +- implementations/go/KKpsk2.noise.go | 2 +- implementations/go/KN.noise.go | 2 +- implementations/go/KNpsk0.noise.go | 2 +- implementations/go/KNpsk2.noise.go | 2 +- implementations/go/KX.noise.go | 2 +- implementations/go/KX1.noise.go | 2 +- implementations/go/KXpsk2.noise.go | 2 +- implementations/go/Kpsk0.noise.go | 2 +- implementations/go/N.noise.go | 2 +- implementations/go/NK.noise.go | 2 +- implementations/go/NK1.noise.go | 2 +- implementations/go/NKpsk0.noise.go | 2 +- implementations/go/NKpsk2.noise.go | 2 +- implementations/go/NN.noise.go | 2 +- implementations/go/NNpsk0.noise.go | 2 +- implementations/go/NNpsk2.noise.go | 2 +- implementations/go/NX.noise.go | 2 +- implementations/go/NX1.noise.go | 2 +- implementations/go/NXpsk2.noise.go | 2 +- implementations/go/Npsk0.noise.go | 2 +- implementations/go/X.noise.go | 2 +- implementations/go/X1K.noise.go | 2 +- implementations/go/X1K1.noise.go | 2 +- implementations/go/X1N.noise.go | 2 +- implementations/go/X1X.noise.go | 2 +- implementations/go/X1X1.noise.go | 2 +- implementations/go/XK.noise.go | 2 +- implementations/go/XK1.noise.go | 2 +- implementations/go/XKpsk3.noise.go | 2 +- implementations/go/XN.noise.go | 2 +- implementations/go/XNpsk3.noise.go | 2 +- implementations/go/XX.noise.go | 2 +- implementations/go/XX1.noise.go | 2 +- implementations/go/XXpsk3.noise.go | 2 +- implementations/go/Xpsk1.noise.go | 2 +- implementations/go/tests/I1K/I1K.noise.go | 2 +- implementations/go/tests/I1K1/I1K1.noise.go | 2 +- implementations/go/tests/I1N/I1N.noise.go | 2 +- implementations/go/tests/I1X/I1X.noise.go | 2 +- implementations/go/tests/I1X1/I1X1.noise.go | 2 +- implementations/go/tests/IK/IK.noise.go | 2 +- implementations/go/tests/IK1/IK1.noise.go | 2 +- .../go/tests/IKpsk1/IKpsk1.noise.go | 2 +- .../go/tests/IKpsk2/IKpsk2.noise.go | 2 +- implementations/go/tests/IN/IN.noise.go | 2 +- .../go/tests/INpsk1/INpsk1.noise.go | 2 +- .../go/tests/INpsk2/INpsk2.noise.go | 2 +- implementations/go/tests/IX/IX.noise.go | 2 +- implementations/go/tests/IX1/IX1.noise.go | 2 +- .../go/tests/IXpsk2/IXpsk2.noise.go | 2 +- implementations/go/tests/K/K.noise.go | 2 +- implementations/go/tests/K1K/K1K.noise.go | 2 +- implementations/go/tests/K1K1/K1K1.noise.go | 2 +- implementations/go/tests/K1N/K1N.noise.go | 2 +- implementations/go/tests/K1X/K1X.noise.go | 2 +- implementations/go/tests/K1X1/K1X1.noise.go | 2 +- implementations/go/tests/KK/KK.noise.go | 2 +- implementations/go/tests/KK1/KK1.noise.go | 2 +- .../go/tests/KKpsk0/KKpsk0.noise.go | 2 +- .../go/tests/KKpsk2/KKpsk2.noise.go | 2 +- implementations/go/tests/KN/KN.noise.go | 2 +- .../go/tests/KNpsk0/KNpsk0.noise.go | 2 +- .../go/tests/KNpsk2/KNpsk2.noise.go | 2 +- implementations/go/tests/KX/KX.noise.go | 2 +- implementations/go/tests/KX1/KX1.noise.go | 2 +- .../go/tests/KXpsk2/KXpsk2.noise.go | 2 +- implementations/go/tests/Kpsk0/Kpsk0.noise.go | 2 +- implementations/go/tests/N/N.noise.go | 2 +- implementations/go/tests/NK/NK.noise.go | 2 +- implementations/go/tests/NK1/NK1.noise.go | 2 +- .../go/tests/NKpsk0/NKpsk0.noise.go | 2 +- .../go/tests/NKpsk2/NKpsk2.noise.go | 2 +- implementations/go/tests/NN/NN.noise.go | 2 +- .../go/tests/NNpsk0/NNpsk0.noise.go | 2 +- .../go/tests/NNpsk2/NNpsk2.noise.go | 2 +- implementations/go/tests/NX/NX.noise.go | 2 +- implementations/go/tests/NX1/NX1.noise.go | 2 +- .../go/tests/NXpsk2/NXpsk2.noise.go | 2 +- implementations/go/tests/Npsk0/Npsk0.noise.go | 2 +- implementations/go/tests/X/X.noise.go | 2 +- implementations/go/tests/X1K/X1K.noise.go | 2 +- implementations/go/tests/X1K1/X1K1.noise.go | 2 +- implementations/go/tests/X1N/X1N.noise.go | 2 +- implementations/go/tests/X1X/X1X.noise.go | 2 +- implementations/go/tests/X1X1/X1X1.noise.go | 2 +- implementations/go/tests/XK/XK.noise.go | 2 +- implementations/go/tests/XK1/XK1.noise.go | 2 +- .../go/tests/XKpsk3/XKpsk3.noise.go | 2 +- implementations/go/tests/XN/XN.noise.go | 2 +- .../go/tests/XNpsk3/XNpsk3.noise.go | 2 +- implementations/go/tests/XX/XX.noise.go | 2 +- implementations/go/tests/XX1/XX1.noise.go | 2 +- .../go/tests/XXpsk3/XXpsk3.noise.go | 2 +- implementations/go/tests/Xpsk1/Xpsk1.noise.go | 2 +- implementations/rs/Cargo.toml | 120 +- implementations/rs/I1K/Cargo.toml | 2 +- implementations/rs/I1K1/Cargo.toml | 2 +- implementations/rs/I1N/Cargo.toml | 2 +- implementations/rs/I1X/Cargo.toml | 2 +- implementations/rs/I1X1/Cargo.toml | 2 +- implementations/rs/IK/Cargo.toml | 2 +- implementations/rs/IK1/Cargo.toml | 2 +- implementations/rs/IKpsk1/Cargo.toml | 2 +- implementations/rs/IKpsk2/Cargo.toml | 2 +- implementations/rs/IN/Cargo.toml | 2 +- implementations/rs/INpsk1/Cargo.toml | 2 +- implementations/rs/INpsk2/Cargo.toml | 2 +- implementations/rs/IX/Cargo.toml | 2 +- implementations/rs/IX1/Cargo.toml | 2 +- implementations/rs/IXpsk2/Cargo.toml | 2 +- implementations/rs/K/Cargo.toml | 2 +- implementations/rs/K1K/Cargo.toml | 2 +- implementations/rs/K1K1/Cargo.toml | 2 +- implementations/rs/K1N/Cargo.toml | 2 +- implementations/rs/K1X/Cargo.toml | 2 +- implementations/rs/K1X1/Cargo.toml | 2 +- implementations/rs/KK/Cargo.toml | 2 +- implementations/rs/KK1/Cargo.toml | 2 +- implementations/rs/KKpsk0/Cargo.toml | 2 +- implementations/rs/KKpsk2/Cargo.toml | 2 +- implementations/rs/KN/Cargo.toml | 2 +- implementations/rs/KNpsk0/Cargo.toml | 2 +- implementations/rs/KNpsk2/Cargo.toml | 2 +- implementations/rs/KX/Cargo.toml | 2 +- implementations/rs/KX1/Cargo.toml | 2 +- implementations/rs/KXpsk2/Cargo.toml | 2 +- implementations/rs/Kpsk0/Cargo.toml | 2 +- implementations/rs/N/Cargo.toml | 2 +- implementations/rs/NK/Cargo.toml | 2 +- implementations/rs/NK1/Cargo.toml | 2 +- implementations/rs/NKpsk0/Cargo.toml | 2 +- implementations/rs/NKpsk2/Cargo.toml | 2 +- implementations/rs/NN/Cargo.toml | 2 +- implementations/rs/NNpsk0/Cargo.toml | 2 +- implementations/rs/NNpsk2/Cargo.toml | 2 +- implementations/rs/NX/Cargo.toml | 2 +- implementations/rs/NX1/Cargo.toml | 2 +- implementations/rs/NXpsk2/Cargo.toml | 2 +- implementations/rs/Npsk0/Cargo.toml | 2 +- implementations/rs/X/Cargo.toml | 2 +- implementations/rs/X1K/Cargo.toml | 2 +- implementations/rs/X1K1/Cargo.toml | 2 +- implementations/rs/X1N/Cargo.toml | 2 +- implementations/rs/X1X/Cargo.toml | 2 +- implementations/rs/X1X1/Cargo.toml | 2 +- implementations/rs/XK/Cargo.toml | 2 +- implementations/rs/XK1/Cargo.toml | 2 +- implementations/rs/XKpsk3/Cargo.toml | 2 +- implementations/rs/XN/Cargo.toml | 2 +- implementations/rs/XNpsk3/Cargo.toml | 2 +- implementations/rs/XX/Cargo.toml | 2 +- implementations/rs/XX1/Cargo.toml | 2 +- implementations/rs/XXpsk3/Cargo.toml | 2 +- implementations/rs/Xpsk1/Cargo.toml | 2 +- implementations/wasm/I1K/Cargo.toml | 4 +- implementations/wasm/I1K/README.md | 2 +- implementations/wasm/I1K/pkg/README.md | 2 +- .../wasm/I1K/pkg/noiseexplorer_i1k_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/I1K/pkg/noiseexplorer_i1k_wasm.d.ts | 39 +- .../wasm/I1K/pkg/noiseexplorer_i1k_wasm.js | 206 ++- .../I1K/pkg/noiseexplorer_i1k_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_i1k_wasm_bg.wasm.d.ts | 9 + implementations/wasm/I1K/pkg/package.json | 6 +- implementations/wasm/I1K1/Cargo.toml | 4 +- implementations/wasm/I1K1/README.md | 2 +- implementations/wasm/I1K1/pkg/README.md | 2 +- .../wasm/I1K1/pkg/noiseexplorer_i1k1_bg.wasm | Bin 4328 -> 3058 bytes .../I1K1/pkg/noiseexplorer_i1k1_wasm.d.ts | 39 +- .../wasm/I1K1/pkg/noiseexplorer_i1k1_wasm.js | 206 ++- .../I1K1/pkg/noiseexplorer_i1k1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_i1k1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/I1K1/pkg/package.json | 6 +- implementations/wasm/I1N/Cargo.toml | 4 +- implementations/wasm/I1N/README.md | 2 +- implementations/wasm/I1N/pkg/README.md | 2 +- .../wasm/I1N/pkg/noiseexplorer_i1n_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/I1N/pkg/noiseexplorer_i1n_wasm.d.ts | 39 +- .../wasm/I1N/pkg/noiseexplorer_i1n_wasm.js | 206 ++- .../I1N/pkg/noiseexplorer_i1n_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_i1n_wasm_bg.wasm.d.ts | 9 + implementations/wasm/I1N/pkg/package.json | 6 +- implementations/wasm/I1X/Cargo.toml | 4 +- implementations/wasm/I1X/README.md | 2 +- implementations/wasm/I1X/pkg/README.md | 2 +- .../wasm/I1X/pkg/noiseexplorer_i1x_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/I1X/pkg/noiseexplorer_i1x_wasm.d.ts | 39 +- .../wasm/I1X/pkg/noiseexplorer_i1x_wasm.js | 206 ++- .../I1X/pkg/noiseexplorer_i1x_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_i1x_wasm_bg.wasm.d.ts | 9 + implementations/wasm/I1X/pkg/package.json | 6 +- implementations/wasm/I1X1/Cargo.toml | 4 +- implementations/wasm/I1X1/README.md | 2 +- implementations/wasm/I1X1/pkg/README.md | 2 +- .../wasm/I1X1/pkg/noiseexplorer_i1x1_bg.wasm | Bin 4328 -> 3058 bytes .../I1X1/pkg/noiseexplorer_i1x1_wasm.d.ts | 39 +- .../wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.js | 206 ++- .../I1X1/pkg/noiseexplorer_i1x1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_i1x1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/I1X1/pkg/package.json | 6 +- implementations/wasm/IK/Cargo.toml | 4 +- implementations/wasm/IK/README.md | 2 +- implementations/wasm/IK/pkg/README.md | 2 +- .../wasm/IK/pkg/noiseexplorer_ik_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/IK/pkg/noiseexplorer_ik_wasm.d.ts | 39 +- .../wasm/IK/pkg/noiseexplorer_ik_wasm.js | 206 ++- .../wasm/IK/pkg/noiseexplorer_ik_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../IK/pkg/noiseexplorer_ik_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IK/pkg/package.json | 6 +- implementations/wasm/IK1/Cargo.toml | 4 +- implementations/wasm/IK1/README.md | 2 +- implementations/wasm/IK1/pkg/README.md | 2 +- .../wasm/IK1/pkg/noiseexplorer_ik1_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/IK1/pkg/noiseexplorer_ik1_wasm.d.ts | 39 +- .../wasm/IK1/pkg/noiseexplorer_ik1_wasm.js | 206 ++- .../IK1/pkg/noiseexplorer_ik1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_ik1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IK1/pkg/package.json | 6 +- implementations/wasm/IKpsk1/Cargo.toml | 4 +- implementations/wasm/IKpsk1/README.md | 2 +- implementations/wasm/IKpsk1/pkg/README.md | 2 +- .../IKpsk1/pkg/noiseexplorer_ikpsk1_bg.wasm | Bin 4328 -> 3058 bytes .../IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.d.ts | 39 +- .../IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.js | 206 ++- .../pkg/noiseexplorer_ikpsk1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_ikpsk1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IKpsk1/pkg/package.json | 6 +- implementations/wasm/IKpsk2/Cargo.toml | 4 +- implementations/wasm/IKpsk2/README.md | 2 +- implementations/wasm/IKpsk2/pkg/README.md | 2 +- .../IKpsk2/pkg/noiseexplorer_ikpsk2_bg.wasm | Bin 4320 -> 3058 bytes .../IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.d.ts | 39 +- .../IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_ikpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_ikpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IKpsk2/pkg/package.json | 6 +- implementations/wasm/IN/Cargo.toml | 4 +- implementations/wasm/IN/README.md | 2 +- implementations/wasm/IN/pkg/README.md | 2 +- .../wasm/IN/pkg/noiseexplorer_in_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/IN/pkg/noiseexplorer_in_wasm.d.ts | 39 +- .../wasm/IN/pkg/noiseexplorer_in_wasm.js | 206 ++- .../wasm/IN/pkg/noiseexplorer_in_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../IN/pkg/noiseexplorer_in_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IN/pkg/package.json | 6 +- implementations/wasm/INpsk1/Cargo.toml | 4 +- implementations/wasm/INpsk1/README.md | 2 +- implementations/wasm/INpsk1/pkg/README.md | 2 +- .../INpsk1/pkg/noiseexplorer_inpsk1_bg.wasm | Bin 4328 -> 3058 bytes .../INpsk1/pkg/noiseexplorer_inpsk1_wasm.d.ts | 39 +- .../INpsk1/pkg/noiseexplorer_inpsk1_wasm.js | 206 ++- .../pkg/noiseexplorer_inpsk1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_inpsk1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/INpsk1/pkg/package.json | 6 +- implementations/wasm/INpsk2/Cargo.toml | 4 +- implementations/wasm/INpsk2/README.md | 2 +- implementations/wasm/INpsk2/pkg/README.md | 2 +- .../INpsk2/pkg/noiseexplorer_inpsk2_bg.wasm | Bin 4328 -> 3058 bytes .../INpsk2/pkg/noiseexplorer_inpsk2_wasm.d.ts | 39 +- .../INpsk2/pkg/noiseexplorer_inpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_inpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_inpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/INpsk2/pkg/package.json | 6 +- implementations/wasm/IX/Cargo.toml | 4 +- implementations/wasm/IX/README.md | 2 +- implementations/wasm/IX/pkg/README.md | 2 +- .../wasm/IX/pkg/noiseexplorer_ix_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/IX/pkg/noiseexplorer_ix_wasm.d.ts | 39 +- .../wasm/IX/pkg/noiseexplorer_ix_wasm.js | 206 ++- .../wasm/IX/pkg/noiseexplorer_ix_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../IX/pkg/noiseexplorer_ix_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IX/pkg/package.json | 6 +- implementations/wasm/IX1/Cargo.toml | 4 +- implementations/wasm/IX1/README.md | 2 +- implementations/wasm/IX1/pkg/README.md | 2 +- .../wasm/IX1/pkg/noiseexplorer_ix1_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/IX1/pkg/noiseexplorer_ix1_wasm.d.ts | 39 +- .../wasm/IX1/pkg/noiseexplorer_ix1_wasm.js | 206 ++- .../IX1/pkg/noiseexplorer_ix1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_ix1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IX1/pkg/package.json | 6 +- implementations/wasm/IXpsk2/Cargo.toml | 4 +- implementations/wasm/IXpsk2/README.md | 2 +- implementations/wasm/IXpsk2/pkg/README.md | 2 +- .../IXpsk2/pkg/noiseexplorer_ixpsk2_bg.wasm | Bin 4328 -> 3058 bytes .../IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.d.ts | 39 +- .../IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_ixpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_ixpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/IXpsk2/pkg/package.json | 6 +- implementations/wasm/K/Cargo.toml | 4 +- implementations/wasm/K/README.md | 2 +- implementations/wasm/K/pkg/README.md | 2 +- .../wasm/K/pkg/noiseexplorer_k_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/K/pkg/noiseexplorer_k_wasm.d.ts | 39 +- .../wasm/K/pkg/noiseexplorer_k_wasm.js | 206 ++- .../wasm/K/pkg/noiseexplorer_k_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../K/pkg/noiseexplorer_k_wasm_bg.wasm.d.ts | 9 + implementations/wasm/K/pkg/package.json | 6 +- implementations/wasm/K1K/Cargo.toml | 4 +- implementations/wasm/K1K/README.md | 2 +- implementations/wasm/K1K/pkg/README.md | 2 +- .../wasm/K1K/pkg/noiseexplorer_k1k_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/K1K/pkg/noiseexplorer_k1k_wasm.d.ts | 39 +- .../wasm/K1K/pkg/noiseexplorer_k1k_wasm.js | 206 ++- .../K1K/pkg/noiseexplorer_k1k_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_k1k_wasm_bg.wasm.d.ts | 9 + implementations/wasm/K1K/pkg/package.json | 6 +- implementations/wasm/K1K1/Cargo.toml | 4 +- implementations/wasm/K1K1/README.md | 2 +- implementations/wasm/K1K1/pkg/README.md | 2 +- .../wasm/K1K1/pkg/noiseexplorer_k1k1_bg.wasm | Bin 4328 -> 3058 bytes .../K1K1/pkg/noiseexplorer_k1k1_wasm.d.ts | 39 +- .../wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.js | 206 ++- .../K1K1/pkg/noiseexplorer_k1k1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_k1k1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/K1K1/pkg/package.json | 6 +- implementations/wasm/K1N/Cargo.toml | 4 +- implementations/wasm/K1N/README.md | 2 +- implementations/wasm/K1N/pkg/README.md | 2 +- .../wasm/K1N/pkg/noiseexplorer_k1n_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/K1N/pkg/noiseexplorer_k1n_wasm.d.ts | 39 +- .../wasm/K1N/pkg/noiseexplorer_k1n_wasm.js | 206 ++- .../K1N/pkg/noiseexplorer_k1n_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_k1n_wasm_bg.wasm.d.ts | 9 + implementations/wasm/K1N/pkg/package.json | 6 +- implementations/wasm/K1X/Cargo.toml | 4 +- implementations/wasm/K1X/README.md | 2 +- implementations/wasm/K1X/pkg/README.md | 2 +- .../wasm/K1X/pkg/noiseexplorer_k1x_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/K1X/pkg/noiseexplorer_k1x_wasm.d.ts | 39 +- .../wasm/K1X/pkg/noiseexplorer_k1x_wasm.js | 206 ++- .../K1X/pkg/noiseexplorer_k1x_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_k1x_wasm_bg.wasm.d.ts | 9 + implementations/wasm/K1X/pkg/package.json | 6 +- implementations/wasm/K1X1/Cargo.toml | 4 +- implementations/wasm/K1X1/README.md | 2 +- implementations/wasm/K1X1/pkg/README.md | 2 +- .../wasm/K1X1/pkg/noiseexplorer_k1x1_bg.wasm | Bin 4328 -> 3058 bytes .../K1X1/pkg/noiseexplorer_k1x1_wasm.d.ts | 39 +- .../wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.js | 206 ++- .../K1X1/pkg/noiseexplorer_k1x1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_k1x1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/K1X1/pkg/package.json | 6 +- implementations/wasm/KK/Cargo.toml | 4 +- implementations/wasm/KK/README.md | 2 +- implementations/wasm/KK/pkg/README.md | 2 +- .../wasm/KK/pkg/noiseexplorer_kk_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/KK/pkg/noiseexplorer_kk_wasm.d.ts | 39 +- .../wasm/KK/pkg/noiseexplorer_kk_wasm.js | 206 ++- .../wasm/KK/pkg/noiseexplorer_kk_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../KK/pkg/noiseexplorer_kk_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KK/pkg/package.json | 6 +- implementations/wasm/KK1/Cargo.toml | 4 +- implementations/wasm/KK1/README.md | 2 +- implementations/wasm/KK1/pkg/README.md | 2 +- .../wasm/KK1/pkg/noiseexplorer_kk1_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/KK1/pkg/noiseexplorer_kk1_wasm.d.ts | 39 +- .../wasm/KK1/pkg/noiseexplorer_kk1_wasm.js | 206 ++- .../KK1/pkg/noiseexplorer_kk1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_kk1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KK1/pkg/package.json | 6 +- implementations/wasm/KKpsk0/Cargo.toml | 4 +- implementations/wasm/KKpsk0/README.md | 2 +- implementations/wasm/KKpsk0/pkg/README.md | 2 +- .../KKpsk0/pkg/noiseexplorer_kkpsk0_bg.wasm | Bin 4328 -> 3058 bytes .../KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.d.ts | 39 +- .../KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.js | 206 ++- .../pkg/noiseexplorer_kkpsk0_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_kkpsk0_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KKpsk0/pkg/package.json | 6 +- implementations/wasm/KKpsk2/Cargo.toml | 4 +- implementations/wasm/KKpsk2/README.md | 2 +- implementations/wasm/KKpsk2/pkg/README.md | 2 +- .../KKpsk2/pkg/noiseexplorer_kkpsk2_bg.wasm | Bin 4328 -> 3058 bytes .../KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.d.ts | 39 +- .../KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_kkpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_kkpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KKpsk2/pkg/package.json | 6 +- implementations/wasm/KN/Cargo.toml | 4 +- implementations/wasm/KN/README.md | 2 +- implementations/wasm/KN/pkg/README.md | 2 +- .../wasm/KN/pkg/noiseexplorer_kn_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/KN/pkg/noiseexplorer_kn_wasm.d.ts | 39 +- .../wasm/KN/pkg/noiseexplorer_kn_wasm.js | 206 ++- .../wasm/KN/pkg/noiseexplorer_kn_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../KN/pkg/noiseexplorer_kn_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KN/pkg/package.json | 6 +- implementations/wasm/KNpsk0/Cargo.toml | 4 +- implementations/wasm/KNpsk0/README.md | 2 +- implementations/wasm/KNpsk0/pkg/README.md | 2 +- .../KNpsk0/pkg/noiseexplorer_knpsk0_bg.wasm | Bin 4328 -> 3058 bytes .../KNpsk0/pkg/noiseexplorer_knpsk0_wasm.d.ts | 39 +- .../KNpsk0/pkg/noiseexplorer_knpsk0_wasm.js | 206 ++- .../pkg/noiseexplorer_knpsk0_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_knpsk0_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KNpsk0/pkg/package.json | 6 +- implementations/wasm/KNpsk2/Cargo.toml | 4 +- implementations/wasm/KNpsk2/README.md | 2 +- implementations/wasm/KNpsk2/pkg/README.md | 2 +- .../KNpsk2/pkg/noiseexplorer_knpsk2_bg.wasm | Bin 4328 -> 3058 bytes .../KNpsk2/pkg/noiseexplorer_knpsk2_wasm.d.ts | 39 +- .../KNpsk2/pkg/noiseexplorer_knpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_knpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_knpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KNpsk2/pkg/package.json | 6 +- implementations/wasm/KX/Cargo.toml | 4 +- implementations/wasm/KX/README.md | 2 +- implementations/wasm/KX/pkg/README.md | 2 +- .../wasm/KX/pkg/noiseexplorer_kx_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/KX/pkg/noiseexplorer_kx_wasm.d.ts | 39 +- .../wasm/KX/pkg/noiseexplorer_kx_wasm.js | 206 ++- .../wasm/KX/pkg/noiseexplorer_kx_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../KX/pkg/noiseexplorer_kx_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KX/pkg/package.json | 6 +- implementations/wasm/KX1/Cargo.toml | 4 +- implementations/wasm/KX1/README.md | 2 +- implementations/wasm/KX1/pkg/README.md | 2 +- .../wasm/KX1/pkg/noiseexplorer_kx1_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/KX1/pkg/noiseexplorer_kx1_wasm.d.ts | 39 +- .../wasm/KX1/pkg/noiseexplorer_kx1_wasm.js | 206 ++- .../KX1/pkg/noiseexplorer_kx1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_kx1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KX1/pkg/package.json | 6 +- implementations/wasm/KXpsk2/Cargo.toml | 4 +- implementations/wasm/KXpsk2/README.md | 2 +- implementations/wasm/KXpsk2/pkg/README.md | 2 +- .../KXpsk2/pkg/noiseexplorer_kxpsk2_bg.wasm | Bin 4328 -> 3058 bytes .../KXpsk2/pkg/noiseexplorer_kxpsk2_wasm.d.ts | 39 +- .../KXpsk2/pkg/noiseexplorer_kxpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_kxpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_kxpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/KXpsk2/pkg/package.json | 6 +- implementations/wasm/Kpsk0/Cargo.toml | 4 +- implementations/wasm/Kpsk0/README.md | 2 +- implementations/wasm/Kpsk0/pkg/README.md | 2 +- .../Kpsk0/pkg/noiseexplorer_kpsk0_bg.wasm | Bin 4328 -> 3058 bytes .../Kpsk0/pkg/noiseexplorer_kpsk0_wasm.d.ts | 39 +- .../Kpsk0/pkg/noiseexplorer_kpsk0_wasm.js | 206 ++- .../pkg/noiseexplorer_kpsk0_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_kpsk0_wasm_bg.wasm.d.ts | 9 + implementations/wasm/Kpsk0/pkg/package.json | 6 +- implementations/wasm/N/Cargo.toml | 4 +- implementations/wasm/N/README.md | 2 +- implementations/wasm/N/pkg/README.md | 2 +- .../wasm/N/pkg/noiseexplorer_n_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/N/pkg/noiseexplorer_n_wasm.d.ts | 39 +- .../wasm/N/pkg/noiseexplorer_n_wasm.js | 206 ++- .../wasm/N/pkg/noiseexplorer_n_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../N/pkg/noiseexplorer_n_wasm_bg.wasm.d.ts | 9 + implementations/wasm/N/pkg/package.json | 6 +- implementations/wasm/NK/Cargo.toml | 4 +- implementations/wasm/NK/README.md | 2 +- implementations/wasm/NK/pkg/README.md | 2 +- .../wasm/NK/pkg/noiseexplorer_nk_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/NK/pkg/noiseexplorer_nk_wasm.d.ts | 39 +- .../wasm/NK/pkg/noiseexplorer_nk_wasm.js | 206 ++- .../wasm/NK/pkg/noiseexplorer_nk_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../NK/pkg/noiseexplorer_nk_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NK/pkg/package.json | 6 +- implementations/wasm/NK1/Cargo.toml | 4 +- implementations/wasm/NK1/README.md | 2 +- implementations/wasm/NK1/pkg/README.md | 2 +- .../wasm/NK1/pkg/noiseexplorer_nk1_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/NK1/pkg/noiseexplorer_nk1_wasm.d.ts | 39 +- .../wasm/NK1/pkg/noiseexplorer_nk1_wasm.js | 206 ++- .../NK1/pkg/noiseexplorer_nk1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_nk1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NK1/pkg/package.json | 6 +- implementations/wasm/NKpsk0/Cargo.toml | 4 +- implementations/wasm/NKpsk0/README.md | 2 +- implementations/wasm/NKpsk0/pkg/README.md | 2 +- .../NKpsk0/pkg/noiseexplorer_nkpsk0_bg.wasm | Bin 4328 -> 3058 bytes .../NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.d.ts | 39 +- .../NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.js | 206 ++- .../pkg/noiseexplorer_nkpsk0_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_nkpsk0_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NKpsk0/pkg/package.json | 6 +- implementations/wasm/NKpsk2/Cargo.toml | 4 +- implementations/wasm/NKpsk2/README.md | 2 +- implementations/wasm/NKpsk2/pkg/README.md | 2 +- .../NKpsk2/pkg/noiseexplorer_nkpsk2_bg.wasm | Bin 4328 -> 3058 bytes .../NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.d.ts | 39 +- .../NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_nkpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_nkpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NKpsk2/pkg/package.json | 6 +- implementations/wasm/NN/Cargo.toml | 4 +- implementations/wasm/NN/README.md | 2 +- implementations/wasm/NN/pkg/README.md | 2 +- .../wasm/NN/pkg/noiseexplorer_nn_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/NN/pkg/noiseexplorer_nn_wasm.d.ts | 39 +- .../wasm/NN/pkg/noiseexplorer_nn_wasm.js | 206 ++- .../wasm/NN/pkg/noiseexplorer_nn_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../NN/pkg/noiseexplorer_nn_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NN/pkg/package.json | 6 +- implementations/wasm/NNpsk0/Cargo.toml | 4 +- implementations/wasm/NNpsk0/README.md | 2 +- implementations/wasm/NNpsk0/pkg/README.md | 2 +- .../NNpsk0/pkg/noiseexplorer_nnpsk0_bg.wasm | Bin 4328 -> 3058 bytes .../NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.d.ts | 39 +- .../NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.js | 206 ++- .../pkg/noiseexplorer_nnpsk0_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_nnpsk0_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NNpsk0/pkg/package.json | 6 +- implementations/wasm/NNpsk2/Cargo.toml | 4 +- implementations/wasm/NNpsk2/README.md | 2 +- implementations/wasm/NNpsk2/pkg/README.md | 2 +- .../NNpsk2/pkg/noiseexplorer_nnpsk2_bg.wasm | Bin 4328 -> 3058 bytes .../NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.d.ts | 39 +- .../NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_nnpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_nnpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NNpsk2/pkg/package.json | 6 +- implementations/wasm/NX/Cargo.toml | 4 +- implementations/wasm/NX/README.md | 2 +- implementations/wasm/NX/pkg/README.md | 2 +- .../wasm/NX/pkg/noiseexplorer_nx_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/NX/pkg/noiseexplorer_nx_wasm.d.ts | 39 +- .../wasm/NX/pkg/noiseexplorer_nx_wasm.js | 206 ++- .../wasm/NX/pkg/noiseexplorer_nx_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../NX/pkg/noiseexplorer_nx_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NX/pkg/package.json | 6 +- implementations/wasm/NX1/Cargo.toml | 4 +- implementations/wasm/NX1/README.md | 2 +- implementations/wasm/NX1/pkg/README.md | 2 +- .../wasm/NX1/pkg/noiseexplorer_nx1_bg.wasm | Bin 4328 -> 3058 bytes .../wasm/NX1/pkg/noiseexplorer_nx1_wasm.d.ts | 39 +- .../wasm/NX1/pkg/noiseexplorer_nx1_wasm.js | 206 ++- .../NX1/pkg/noiseexplorer_nx1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_nx1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NX1/pkg/package.json | 6 +- implementations/wasm/NXpsk2/Cargo.toml | 4 +- implementations/wasm/NXpsk2/README.md | 2 +- implementations/wasm/NXpsk2/pkg/README.md | 2 +- .../NXpsk2/pkg/noiseexplorer_nxpsk2_bg.wasm | Bin 4328 -> 3086 bytes .../NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.d.ts | 39 +- .../NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.js | 206 ++- .../pkg/noiseexplorer_nxpsk2_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_nxpsk2_wasm_bg.wasm.d.ts | 9 + implementations/wasm/NXpsk2/pkg/package.json | 6 +- implementations/wasm/Npsk0/Cargo.toml | 4 +- implementations/wasm/Npsk0/README.md | 2 +- implementations/wasm/Npsk0/pkg/README.md | 2 +- .../Npsk0/pkg/noiseexplorer_npsk0_bg.wasm | Bin 4328 -> 3086 bytes .../Npsk0/pkg/noiseexplorer_npsk0_wasm.d.ts | 39 +- .../Npsk0/pkg/noiseexplorer_npsk0_wasm.js | 206 ++- .../pkg/noiseexplorer_npsk0_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_npsk0_wasm_bg.wasm.d.ts | 9 + implementations/wasm/Npsk0/pkg/package.json | 6 +- implementations/wasm/X/Cargo.toml | 4 +- implementations/wasm/X/README.md | 2 +- implementations/wasm/X/pkg/README.md | 2 +- .../wasm/X/pkg/noiseexplorer_x_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/X/pkg/noiseexplorer_x_wasm.d.ts | 39 +- .../wasm/X/pkg/noiseexplorer_x_wasm.js | 206 ++- .../wasm/X/pkg/noiseexplorer_x_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../X/pkg/noiseexplorer_x_wasm_bg.wasm.d.ts | 9 + implementations/wasm/X/pkg/package.json | 6 +- implementations/wasm/X1K/Cargo.toml | 4 +- implementations/wasm/X1K/README.md | 2 +- implementations/wasm/X1K/pkg/README.md | 2 +- .../wasm/X1K/pkg/noiseexplorer_x1k_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/X1K/pkg/noiseexplorer_x1k_wasm.d.ts | 39 +- .../wasm/X1K/pkg/noiseexplorer_x1k_wasm.js | 206 ++- .../X1K/pkg/noiseexplorer_x1k_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_x1k_wasm_bg.wasm.d.ts | 9 + implementations/wasm/X1K/pkg/package.json | 6 +- implementations/wasm/X1K1/Cargo.toml | 4 +- implementations/wasm/X1K1/README.md | 2 +- implementations/wasm/X1K1/pkg/README.md | 2 +- .../wasm/X1K1/pkg/noiseexplorer_x1k1_bg.wasm | Bin 4328 -> 3086 bytes .../X1K1/pkg/noiseexplorer_x1k1_wasm.d.ts | 39 +- .../wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.js | 206 ++- .../X1K1/pkg/noiseexplorer_x1k1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_x1k1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/X1K1/pkg/package.json | 6 +- implementations/wasm/X1N/Cargo.toml | 4 +- implementations/wasm/X1N/README.md | 2 +- implementations/wasm/X1N/pkg/README.md | 2 +- .../wasm/X1N/pkg/noiseexplorer_x1n_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/X1N/pkg/noiseexplorer_x1n_wasm.d.ts | 39 +- .../wasm/X1N/pkg/noiseexplorer_x1n_wasm.js | 206 ++- .../X1N/pkg/noiseexplorer_x1n_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_x1n_wasm_bg.wasm.d.ts | 9 + implementations/wasm/X1N/pkg/package.json | 6 +- implementations/wasm/X1X/Cargo.toml | 4 +- implementations/wasm/X1X/README.md | 2 +- implementations/wasm/X1X/pkg/README.md | 2 +- .../wasm/X1X/pkg/noiseexplorer_x1x_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/X1X/pkg/noiseexplorer_x1x_wasm.d.ts | 39 +- .../wasm/X1X/pkg/noiseexplorer_x1x_wasm.js | 206 ++- .../X1X/pkg/noiseexplorer_x1x_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_x1x_wasm_bg.wasm.d.ts | 9 + implementations/wasm/X1X/pkg/package.json | 6 +- implementations/wasm/X1X1/Cargo.toml | 4 +- implementations/wasm/X1X1/README.md | 2 +- implementations/wasm/X1X1/pkg/README.md | 2 +- .../wasm/X1X1/pkg/noiseexplorer_x1x1_bg.wasm | Bin 4328 -> 3086 bytes .../X1X1/pkg/noiseexplorer_x1x1_wasm.d.ts | 39 +- .../wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.js | 206 ++- .../X1X1/pkg/noiseexplorer_x1x1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_x1x1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/X1X1/pkg/package.json | 6 +- implementations/wasm/XK/Cargo.toml | 4 +- implementations/wasm/XK/README.md | 2 +- implementations/wasm/XK/pkg/README.md | 2 +- .../wasm/XK/pkg/noiseexplorer_xk_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/XK/pkg/noiseexplorer_xk_wasm.d.ts | 39 +- .../wasm/XK/pkg/noiseexplorer_xk_wasm.js | 206 ++- .../wasm/XK/pkg/noiseexplorer_xk_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../XK/pkg/noiseexplorer_xk_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XK/pkg/package.json | 6 +- implementations/wasm/XK1/Cargo.toml | 4 +- implementations/wasm/XK1/README.md | 2 +- implementations/wasm/XK1/pkg/README.md | 2 +- .../wasm/XK1/pkg/noiseexplorer_xk1_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/XK1/pkg/noiseexplorer_xk1_wasm.d.ts | 39 +- .../wasm/XK1/pkg/noiseexplorer_xk1_wasm.js | 206 ++- .../XK1/pkg/noiseexplorer_xk1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_xk1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XK1/pkg/package.json | 6 +- implementations/wasm/XKpsk3/Cargo.toml | 4 +- implementations/wasm/XKpsk3/README.md | 2 +- implementations/wasm/XKpsk3/pkg/README.md | 2 +- .../XKpsk3/pkg/noiseexplorer_xkpsk3_bg.wasm | Bin 4328 -> 3086 bytes .../XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.d.ts | 39 +- .../XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.js | 206 ++- .../pkg/noiseexplorer_xkpsk3_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_xkpsk3_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XKpsk3/pkg/package.json | 6 +- implementations/wasm/XN/Cargo.toml | 4 +- implementations/wasm/XN/README.md | 2 +- implementations/wasm/XN/pkg/README.md | 2 +- .../wasm/XN/pkg/noiseexplorer_xn_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/XN/pkg/noiseexplorer_xn_wasm.d.ts | 39 +- .../wasm/XN/pkg/noiseexplorer_xn_wasm.js | 206 ++- .../wasm/XN/pkg/noiseexplorer_xn_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../XN/pkg/noiseexplorer_xn_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XN/pkg/package.json | 6 +- implementations/wasm/XNpsk3/Cargo.toml | 4 +- implementations/wasm/XNpsk3/README.md | 2 +- implementations/wasm/XNpsk3/pkg/README.md | 2 +- .../XNpsk3/pkg/noiseexplorer_xnpsk3_bg.wasm | Bin 4328 -> 3086 bytes .../XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.d.ts | 39 +- .../XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.js | 206 ++- .../pkg/noiseexplorer_xnpsk3_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_xnpsk3_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XNpsk3/pkg/package.json | 6 +- implementations/wasm/XX/Cargo.toml | 4 +- implementations/wasm/XX/README.md | 2 +- implementations/wasm/XX/pkg/README.md | 2 +- .../wasm/XX/pkg/noiseexplorer_xx_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/XX/pkg/noiseexplorer_xx_wasm.d.ts | 39 +- .../wasm/XX/pkg/noiseexplorer_xx_wasm.js | 206 ++- .../wasm/XX/pkg/noiseexplorer_xx_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../XX/pkg/noiseexplorer_xx_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XX/pkg/package.json | 6 +- implementations/wasm/XX1/Cargo.toml | 4 +- implementations/wasm/XX1/README.md | 2 +- implementations/wasm/XX1/pkg/README.md | 2 +- .../wasm/XX1/pkg/noiseexplorer_xx1_bg.wasm | Bin 4328 -> 3086 bytes .../wasm/XX1/pkg/noiseexplorer_xx1_wasm.d.ts | 39 +- .../wasm/XX1/pkg/noiseexplorer_xx1_wasm.js | 206 ++- .../XX1/pkg/noiseexplorer_xx1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_xx1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XX1/pkg/package.json | 6 +- implementations/wasm/XXpsk3/Cargo.toml | 4 +- implementations/wasm/XXpsk3/README.md | 2 +- implementations/wasm/XXpsk3/pkg/README.md | 2 +- .../XXpsk3/pkg/noiseexplorer_xxpsk3_bg.wasm | Bin 4328 -> 3086 bytes .../XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.d.ts | 39 +- .../XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.js | 206 ++- .../pkg/noiseexplorer_xxpsk3_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../noiseexplorer_xxpsk3_wasm_bg.wasm.d.ts | 9 + implementations/wasm/XXpsk3/pkg/package.json | 6 +- implementations/wasm/Xpsk1/Cargo.toml | 4 +- implementations/wasm/Xpsk1/README.md | 2 +- implementations/wasm/Xpsk1/pkg/README.md | 2 +- .../Xpsk1/pkg/noiseexplorer_xpsk1_bg.wasm | Bin 4328 -> 3086 bytes .../Xpsk1/pkg/noiseexplorer_xpsk1_wasm.d.ts | 39 +- .../Xpsk1/pkg/noiseexplorer_xpsk1_wasm.js | 206 ++- .../pkg/noiseexplorer_xpsk1_wasm_bg.wasm | Bin 3267 -> 2260 bytes .../pkg/noiseexplorer_xpsk1_wasm_bg.wasm.d.ts | 9 + implementations/wasm/Xpsk1/pkg/package.json | 6 +- src/package.json | 6 +- src/versions.json | 16 +- src/wasm/9Cargo.toml | 2 +- 719 files changed, 12611 insertions(+), 6116 deletions(-) mode change 100755 => 100644 implementations/wasm/I1K/pkg/noiseexplorer_i1k_bg.wasm mode change 100755 => 100644 implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm_bg.wasm create mode 100644 implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/I1K/pkg/package.json mode change 100755 => 100644 implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_bg.wasm mode change 100755 => 100644 implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm_bg.wasm create mode 100644 implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/I1K1/pkg/package.json mode change 100755 => 100644 implementations/wasm/I1N/pkg/noiseexplorer_i1n_bg.wasm mode change 100755 => 100644 implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm_bg.wasm create mode 100644 implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/I1N/pkg/package.json mode change 100755 => 100644 implementations/wasm/I1X/pkg/noiseexplorer_i1x_bg.wasm mode change 100755 => 100644 implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm_bg.wasm create mode 100644 implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/I1X/pkg/package.json mode change 100755 => 100644 implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_bg.wasm mode change 100755 => 100644 implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm_bg.wasm create mode 100644 implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/I1X1/pkg/package.json mode change 100755 => 100644 implementations/wasm/IK/pkg/noiseexplorer_ik_bg.wasm mode change 100755 => 100644 implementations/wasm/IK/pkg/noiseexplorer_ik_wasm_bg.wasm create mode 100644 implementations/wasm/IK/pkg/noiseexplorer_ik_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IK/pkg/package.json mode change 100755 => 100644 implementations/wasm/IK1/pkg/noiseexplorer_ik1_bg.wasm mode change 100755 => 100644 implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm_bg.wasm create mode 100644 implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IK1/pkg/package.json mode change 100755 => 100644 implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_bg.wasm mode change 100755 => 100644 implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm_bg.wasm create mode 100644 implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IKpsk1/pkg/package.json mode change 100755 => 100644 implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IKpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/IN/pkg/noiseexplorer_in_bg.wasm mode change 100755 => 100644 implementations/wasm/IN/pkg/noiseexplorer_in_wasm_bg.wasm create mode 100644 implementations/wasm/IN/pkg/noiseexplorer_in_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IN/pkg/package.json mode change 100755 => 100644 implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_bg.wasm mode change 100755 => 100644 implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm_bg.wasm create mode 100644 implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/INpsk1/pkg/package.json mode change 100755 => 100644 implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/INpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/IX/pkg/noiseexplorer_ix_bg.wasm mode change 100755 => 100644 implementations/wasm/IX/pkg/noiseexplorer_ix_wasm_bg.wasm create mode 100644 implementations/wasm/IX/pkg/noiseexplorer_ix_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IX/pkg/package.json mode change 100755 => 100644 implementations/wasm/IX1/pkg/noiseexplorer_ix1_bg.wasm mode change 100755 => 100644 implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm_bg.wasm create mode 100644 implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IX1/pkg/package.json mode change 100755 => 100644 implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/IXpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/K/pkg/noiseexplorer_k_bg.wasm mode change 100755 => 100644 implementations/wasm/K/pkg/noiseexplorer_k_wasm_bg.wasm create mode 100644 implementations/wasm/K/pkg/noiseexplorer_k_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/K/pkg/package.json mode change 100755 => 100644 implementations/wasm/K1K/pkg/noiseexplorer_k1k_bg.wasm mode change 100755 => 100644 implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm_bg.wasm create mode 100644 implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/K1K/pkg/package.json mode change 100755 => 100644 implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_bg.wasm mode change 100755 => 100644 implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm_bg.wasm create mode 100644 implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/K1K1/pkg/package.json mode change 100755 => 100644 implementations/wasm/K1N/pkg/noiseexplorer_k1n_bg.wasm mode change 100755 => 100644 implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm_bg.wasm create mode 100644 implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/K1N/pkg/package.json mode change 100755 => 100644 implementations/wasm/K1X/pkg/noiseexplorer_k1x_bg.wasm mode change 100755 => 100644 implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm_bg.wasm create mode 100644 implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/K1X/pkg/package.json mode change 100755 => 100644 implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_bg.wasm mode change 100755 => 100644 implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm_bg.wasm create mode 100644 implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/K1X1/pkg/package.json mode change 100755 => 100644 implementations/wasm/KK/pkg/noiseexplorer_kk_bg.wasm mode change 100755 => 100644 implementations/wasm/KK/pkg/noiseexplorer_kk_wasm_bg.wasm create mode 100644 implementations/wasm/KK/pkg/noiseexplorer_kk_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KK/pkg/package.json mode change 100755 => 100644 implementations/wasm/KK1/pkg/noiseexplorer_kk1_bg.wasm mode change 100755 => 100644 implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm_bg.wasm create mode 100644 implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KK1/pkg/package.json mode change 100755 => 100644 implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_bg.wasm mode change 100755 => 100644 implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm_bg.wasm create mode 100644 implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KKpsk0/pkg/package.json mode change 100755 => 100644 implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KKpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/KN/pkg/noiseexplorer_kn_bg.wasm mode change 100755 => 100644 implementations/wasm/KN/pkg/noiseexplorer_kn_wasm_bg.wasm create mode 100644 implementations/wasm/KN/pkg/noiseexplorer_kn_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KN/pkg/package.json mode change 100755 => 100644 implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_bg.wasm mode change 100755 => 100644 implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm_bg.wasm create mode 100644 implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KNpsk0/pkg/package.json mode change 100755 => 100644 implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KNpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/KX/pkg/noiseexplorer_kx_bg.wasm mode change 100755 => 100644 implementations/wasm/KX/pkg/noiseexplorer_kx_wasm_bg.wasm create mode 100644 implementations/wasm/KX/pkg/noiseexplorer_kx_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KX/pkg/package.json mode change 100755 => 100644 implementations/wasm/KX1/pkg/noiseexplorer_kx1_bg.wasm mode change 100755 => 100644 implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm_bg.wasm create mode 100644 implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KX1/pkg/package.json mode change 100755 => 100644 implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/KXpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_bg.wasm mode change 100755 => 100644 implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm_bg.wasm create mode 100644 implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/Kpsk0/pkg/package.json mode change 100755 => 100644 implementations/wasm/N/pkg/noiseexplorer_n_bg.wasm mode change 100755 => 100644 implementations/wasm/N/pkg/noiseexplorer_n_wasm_bg.wasm create mode 100644 implementations/wasm/N/pkg/noiseexplorer_n_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/N/pkg/package.json mode change 100755 => 100644 implementations/wasm/NK/pkg/noiseexplorer_nk_bg.wasm mode change 100755 => 100644 implementations/wasm/NK/pkg/noiseexplorer_nk_wasm_bg.wasm create mode 100644 implementations/wasm/NK/pkg/noiseexplorer_nk_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NK/pkg/package.json mode change 100755 => 100644 implementations/wasm/NK1/pkg/noiseexplorer_nk1_bg.wasm mode change 100755 => 100644 implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm_bg.wasm create mode 100644 implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NK1/pkg/package.json mode change 100755 => 100644 implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_bg.wasm mode change 100755 => 100644 implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm_bg.wasm create mode 100644 implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NKpsk0/pkg/package.json mode change 100755 => 100644 implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NKpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/NN/pkg/noiseexplorer_nn_bg.wasm mode change 100755 => 100644 implementations/wasm/NN/pkg/noiseexplorer_nn_wasm_bg.wasm create mode 100644 implementations/wasm/NN/pkg/noiseexplorer_nn_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NN/pkg/package.json mode change 100755 => 100644 implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_bg.wasm mode change 100755 => 100644 implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm_bg.wasm create mode 100644 implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NNpsk0/pkg/package.json mode change 100755 => 100644 implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NNpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/NX/pkg/noiseexplorer_nx_bg.wasm mode change 100755 => 100644 implementations/wasm/NX/pkg/noiseexplorer_nx_wasm_bg.wasm create mode 100644 implementations/wasm/NX/pkg/noiseexplorer_nx_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NX/pkg/package.json mode change 100755 => 100644 implementations/wasm/NX1/pkg/noiseexplorer_nx1_bg.wasm mode change 100755 => 100644 implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm_bg.wasm create mode 100644 implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NX1/pkg/package.json mode change 100755 => 100644 implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_bg.wasm mode change 100755 => 100644 implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm_bg.wasm create mode 100644 implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/NXpsk2/pkg/package.json mode change 100755 => 100644 implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_bg.wasm mode change 100755 => 100644 implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm_bg.wasm create mode 100644 implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/Npsk0/pkg/package.json mode change 100755 => 100644 implementations/wasm/X/pkg/noiseexplorer_x_bg.wasm mode change 100755 => 100644 implementations/wasm/X/pkg/noiseexplorer_x_wasm_bg.wasm create mode 100644 implementations/wasm/X/pkg/noiseexplorer_x_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/X/pkg/package.json mode change 100755 => 100644 implementations/wasm/X1K/pkg/noiseexplorer_x1k_bg.wasm mode change 100755 => 100644 implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm_bg.wasm create mode 100644 implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/X1K/pkg/package.json mode change 100755 => 100644 implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_bg.wasm mode change 100755 => 100644 implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm_bg.wasm create mode 100644 implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/X1K1/pkg/package.json mode change 100755 => 100644 implementations/wasm/X1N/pkg/noiseexplorer_x1n_bg.wasm mode change 100755 => 100644 implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm_bg.wasm create mode 100644 implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/X1N/pkg/package.json mode change 100755 => 100644 implementations/wasm/X1X/pkg/noiseexplorer_x1x_bg.wasm mode change 100755 => 100644 implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm_bg.wasm create mode 100644 implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/X1X/pkg/package.json mode change 100755 => 100644 implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_bg.wasm mode change 100755 => 100644 implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm_bg.wasm create mode 100644 implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/X1X1/pkg/package.json mode change 100755 => 100644 implementations/wasm/XK/pkg/noiseexplorer_xk_bg.wasm mode change 100755 => 100644 implementations/wasm/XK/pkg/noiseexplorer_xk_wasm_bg.wasm create mode 100644 implementations/wasm/XK/pkg/noiseexplorer_xk_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XK/pkg/package.json mode change 100755 => 100644 implementations/wasm/XK1/pkg/noiseexplorer_xk1_bg.wasm mode change 100755 => 100644 implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm_bg.wasm create mode 100644 implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XK1/pkg/package.json mode change 100755 => 100644 implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_bg.wasm mode change 100755 => 100644 implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm_bg.wasm create mode 100644 implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XKpsk3/pkg/package.json mode change 100755 => 100644 implementations/wasm/XN/pkg/noiseexplorer_xn_bg.wasm mode change 100755 => 100644 implementations/wasm/XN/pkg/noiseexplorer_xn_wasm_bg.wasm create mode 100644 implementations/wasm/XN/pkg/noiseexplorer_xn_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XN/pkg/package.json mode change 100755 => 100644 implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_bg.wasm mode change 100755 => 100644 implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm_bg.wasm create mode 100644 implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XNpsk3/pkg/package.json mode change 100755 => 100644 implementations/wasm/XX/pkg/noiseexplorer_xx_bg.wasm mode change 100755 => 100644 implementations/wasm/XX/pkg/noiseexplorer_xx_wasm_bg.wasm create mode 100644 implementations/wasm/XX/pkg/noiseexplorer_xx_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XX/pkg/package.json mode change 100755 => 100644 implementations/wasm/XX1/pkg/noiseexplorer_xx1_bg.wasm mode change 100755 => 100644 implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm_bg.wasm create mode 100644 implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XX1/pkg/package.json mode change 100755 => 100644 implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_bg.wasm mode change 100755 => 100644 implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm_bg.wasm create mode 100644 implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/XXpsk3/pkg/package.json mode change 100755 => 100644 implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_bg.wasm mode change 100755 => 100644 implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm_bg.wasm create mode 100644 implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm_bg.wasm.d.ts mode change 100755 => 100644 implementations/wasm/Xpsk1/pkg/package.json diff --git a/.releaserc b/.releaserc index 79fe59725..53f6d2f8e 100755 --- a/.releaserc +++ b/.releaserc @@ -1,6 +1,6 @@ { "branch": "next", - "repositoryUrl": "https://github.com/georgio/noiseexplorer", + "repositoryUrl": "https://github.com/symbolicsoft/noiseexplorer", "tagFormat": "v${version}", "plugins": [ [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ade25f3a..9fb1a7c04 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## Noise Explorer v1.0.4 +- Go: + - _fix(go): Do not increment nonce on invalid message (https://github.com/symbolicsoft/noiseexplorer/pull/4)._ + + ## Noise Explorer v1.0.3 - Rust: - _fix(rust): Updated Rust crate dependencies so that implementations compile automatically again_. @@ -7,7 +12,7 @@ - Go: - _fix(go): Nonces are now 64-bit instead of 32-bit._ - - _fix(go): Top-level API now provides an error which can be checked to detect invalid nonce incrementation._ + - _fix(go): Top-level API now provides an error which can be checked to detect invalid nonce incrementation. ## Noise Explorer v1.0.2 - Noise Explorer: diff --git a/README.md b/README.md index 7a778881c..a2f6c3494 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # [Noise Explorer](https://noiseexplorer.com) -## Version 1.0.3, based on Noise Protocol Revision 34. +## Version 1.0.4, based on Noise Protocol Revision 34. ### Overview The Noise Explorer command-line tool can parse Noise Handshake Patterns according to the original specification. It can generate cryptographic models for formal verification, including security queries, top-level processes and malicious principals, for testing against an active or passive attacker. Noise Explorer can also generate fully functional discrete implementations for any Noise Handshake Pattern, written in the [Go](https://golang.org) and [Rust](https://www.rust-lang.org) programming languages, as well as [WebAssembly](https://webassembly.org) binaries. diff --git a/html/cmd/index.html b/html/cmd/index.html index 97eeabe4e..f79421434 100755 --- a/html/cmd/index.html +++ b/html/cmd/index.html @@ -1,71 +1,71 @@ - - - - - - Noise Explorer: Command-Line Tool - - - - - - - - - - -
- -

Noise Explorer beta

-
- -
-
-

Noise Explorer Command-Line Tool

-

The Noise Explorer command-line tool can parse Noise Handshake Patterns according to the original specification. It can generate cryptographic models for formal verification, including security queries, top-level processes and malicious principals, for testing against an active or passive attacker.

-

Noise Explorer can also render results from the ProVerif output into an elegant and easy to read HTML format: the pattern results that can be explored on this very website were generated using the Noise Explorer command-line tool.

-
-			$> node noiseExplorer --help
-			Noise Explorer version 0.3 (specification revision 34)
-			Noise Explorer has three individual modes: generation, rendering and web interface.
-
-			Generation:
-			--generate=(json|pv|go|rs|wasm): Specify output format.
-			--pattern=[file]: Specify input pattern file (required).
-			--attacker=(active|passive): Specify ProVerif attacker type (default: active).
-
-			Rendering:
-			--render: Render results from ProVerif output files into HTML.
-			--pattern=[file]: Specify input pattern file (required).
-			--activeModel=[file]: Specify ProVerif active attacker model.
-			--activeResults=[file]: Specify active results file for --render (required).
-			--passiveResults=[file]: Specify passive results file for --render (required).
-
-			Web interface:
-			--web=(port): Make Noise Explorer's web interface available at http://localhost:(port) (default: 8000).
-
-			Help:
-			--help: View this help text.
-			
-

License

-

All Noise Explorer software, including this website, is licensed under the GNU General Public License, Version 3.

-

Download Noise Explorer for your Computer

-

You are welcome to view the Noise Explorer code repository.

-
-
- - - - + + + + + + Noise Explorer: Command-Line Tool + + + + + + + + + + +
+ +

Noise Explorer beta

+
+ +
+
+

Noise Explorer Command-Line Tool

+

The Noise Explorer command-line tool can parse Noise Handshake Patterns according to the original specification. It can generate cryptographic models for formal verification, including security queries, top-level processes and malicious principals, for testing against an active or passive attacker.

+

Noise Explorer can also render results from the ProVerif output into an elegant and easy to read HTML format: the pattern results that can be explored on this very website were generated using the Noise Explorer command-line tool.

+
+			$> node noiseExplorer --help
+			Noise Explorer version 0.3 (specification revision 34)
+			Noise Explorer has three individual modes: generation, rendering and web interface.
+
+			Generation:
+			--generate=(json|pv|go|rs|wasm): Specify output format.
+			--pattern=[file]: Specify input pattern file (required).
+			--attacker=(active|passive): Specify ProVerif attacker type (default: active).
+
+			Rendering:
+			--render: Render results from ProVerif output files into HTML.
+			--pattern=[file]: Specify input pattern file (required).
+			--activeModel=[file]: Specify ProVerif active attacker model.
+			--activeResults=[file]: Specify active results file for --render (required).
+			--passiveResults=[file]: Specify passive results file for --render (required).
+
+			Web interface:
+			--web=(port): Make Noise Explorer's web interface available at http://localhost:(port) (default: 8000).
+
+			Help:
+			--help: View this help text.
+			
+

License

+

All Noise Explorer software, including this website, is licensed under the GNU General Public License, Version 3.

+

Download Noise Explorer for your Computer

+

You are welcome to view the Noise Explorer code repository.

+
+
+ + + + diff --git a/html/res/css/style.css b/html/res/css/style.css index 5f046fa8b..5a3db026f 100755 --- a/html/res/css/style.css +++ b/html/res/css/style.css @@ -1,568 +1,568 @@ -html { - font-family: 'IBM Plex Sans', sans-serif; - font-size: 14px; - --noiseGreen: #46B29D; - --noiseOrange: #E37B40; - --noiseRed: #DE5B49; - --noiseClearGray: #C4D2E3; - --noiseLightGray: #647B96; - --noiseDarkGray: #565C63; - --noiseBeige: #FFFCFC; - --noiseTextColor: #222; -} - -body { - background-color: #FFF; - color: var(--noiseTextColor); -} - -a { - color: var(--noiseLightGray); - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -hr { - width: 50%; - opacity: 0.5; -} - -ul { - padding-left: 20px; -} - -li { - margin-bottom: 10px; -} - -h3 { - margin: 5% 0 0 0; -} - -span.passed { - color: var(--noiseGreen); -} - -span.failed { - color: var(--noiseRed); -} - -span.mono { - font-family: 'IBM Plex Mono', monospace; - font-weight: bold; -} - -div.header { - width: 900px; - height: 100px; - margin: 0 auto; -} - -div.header img#logo { - float: left; - height: 100px; - width: auto; -} - -div.header h1 { - margin: 30px 0 0 20px; - float: left; - font-weight: bold; - font-size: 36px; - font-family: 'IBM Plex Sans', sans-serif; -} - -div.header h1 span.beta { - font-variant: small-caps; - font-size: 14px; - background-color: var(--noiseRed); - color: #FFF; - padding: 0px 4px 3px 4px; - border-radius: 3px; - position: relative; - bottom: 5px; -} - -div.nav { - width: 890px; - margin: 0 auto; - background-color: rgba(0, 0, 0, 0.05); - padding: 3px 5px; - position: relative; -} - -div.nav span.menu { - position: absolute; - left: 0; - top: 0; - background: rgba(255, 255, 255, 0.8); - font-variant: small-caps; - padding: 3px 5px; - font-weight: bold; -} - -div.nav a { - margin-right: 20px; - padding: 2px; -} - -div.nav a.currentNav { - color: var(--noiseGreen); -} - -div.nav div.navLinks { - margin-left: 50px; -} - -div.results { - width: 900px; - margin: 10px auto; - padding-bottom: 300px; -} - -div.results.singleColumn { - float: none; - height: auto; - padding-bottom: 0px; -} - -div.results.singleColumn div.resultsExplanation { - float: none !important; - height: auto; - width: 855px; - padding-bottom: 20px; -} - -div.arrowsFrame { - width: 250px; - padding: 60px 40px 40px 40px; - border: 1px solid var(--noiseLightGray); - background-color: var(--noiseBeige); - position: relative; - float: left; -} - -div.arrowsFrame h1 { - position: absolute; - top: 0; - left: 0; - background-color: #FFF; - margin: 0; - padding: 10px; - border: 1px solid var(--noiseLightGray); - border-top: none; - border-left: none; -} - -div.arrows { - margin: 0px auto; - width: 100%; - text-align: center; - padding-bottom: 211px; -} - -div.arrows svg { - margin-top: 40px; -} - -div.arrows svg line { - fill: none; - stroke-width: 3px; - shape-rendering: crispEdges; - stroke: var(--noiseDarkGray); -} - -div.arrows svg polyline { - stroke: var(--noiseDarkGray); - fill: none; - stroke-width: 3px; - shape-rendering: geometricPrecision; -} - -div.arrows svg circle { - fill: var(--noiseClearGray); - stroke: var(--noiseDarkGray); - stroke-width: 3px; - shape-rendering: geometricPrecision; -} - -div.arrows svg.noColor line[data-seclevel="0"], -div.arrows svg.noColor polyline[data-seclevel="0"] { - stroke: var(--noiseDarkGray); -} - -div.arrows svg.noColor circle[data-seclevel="0"] { - stroke: var(--noiseDarkGray); -} - -div.arrows svg line[data-seclevel="0"], -div.arrows svg polyline[data-seclevel="0"] { - stroke: var(--noiseRed); -} - -div.arrows svg line[data-seclevel="1"], -div.arrows svg polyline[data-seclevel="1"] { - stroke: var(--noiseOrange); -} - -div.arrows svg line[data-seclevel="2"], -div.arrows svg polyline[data-seclevel="2"] { - stroke: var(--noiseOrange); -} - -div.arrows svg line[data-seclevel="3"], -div.arrows svg polyline[data-seclevel="3"] { - stroke: var(--noiseGreen); -} - -div.arrows svg line[data-seclevel="4"], -div.arrows svg polyline[data-seclevel="4"] { - stroke: var(--noiseGreen); -} - -div.arrows svg line[data-seclevel="5"], -div.arrows svg polyline[data-seclevel="5"] { - stroke: var(--noiseGreen); -} - -div.arrows svg circle[data-seclevel="0"] { - stroke: var(--noiseRed); -} - -div.arrows svg circle[data-seclevel="1"] { - stroke: var(--noiseOrange); -} - -div.arrows svg circle[data-seclevel="2"] { - stroke: var(--noiseOrange); -} - -div.arrows svg circle[data-seclevel="3"] { - stroke: var(--noiseGreen); -} - -div.arrows svg circle[data-seclevel="4"] { - stroke: var(--noiseGreen); -} - -div.arrows svg text.msg { - font-family: 'IBM Plex Mono', monospace; - font-size: 16px; - font-weight: bold; - fill: var(--noiseDarkGray); - font-variant: small-caps; - shape-rendering: geometricPrecision; - text-anchor: middle; -} - -div.arrows svg text.tokens { - font-family: 'IBM Plex Mono', monospace; - font-size: 14px; - fill: var(--noiseDarkGray); - font-weight: bold; - shape-rendering: geometricPrecision; - width: 250px; - text-anchor: middle; -} - -div.arrows svg text.ellipsis { - font-size: 64px; - fill: var(--noiseDarkGray); - text-anchor: middle; -} - -div.resultsExplanation { - float: right; - width: 500px; - background-color: var(--noiseBeige); - padding: 0 20px 20px 20px; - border-radius: 3px; - border: 2px solid #FFF5F5; - text-align: justify; - padding-bottom: 310px; -} - -div.resultsExplanation a.detailedAnalysis { - font-variant: small-caps; - background-color: var(--noiseLightGray); - color: #FFF; - padding: 1px 3px; - border-radius: 3px; - font-size: 12px; - margin-left: 5px; - font-family: 'IBM Plex Mono', monospace; -} - -div.resultsExplanation a.detailedAnalysis:hover { - text-decoration: none; - background-color: var(--noiseDarkGray); -} - -div.resultsExplanation p { - margin-top: 5px; -} - -div.resultsExplanation span.resultNums { - font-family: 'IBM Plex Mono', monospace; - font-weight: bold; - font-size: 10px; - background-color: var(--noiseDarkGray); - color: #FFF; - padding: 1px 3px; - border-radius: 3px; -} - -div.rawResults { - background-color: var(--noiseDarkGray); - border: 2px solid var(--noiseLightGray); - border-radius: 3px; - color: #FFF; - font-family: 'IBM Plex Mono', monospace; - margin: 20px auto 0 auto; - width: 860px; - padding: 0 20px; - height: 400px; - font-size: 10px; - overflow-y: auto; - font-variant: small-caps; -} - -div.rawResults h2 { - font-family: 'IBM Plex Sans', sans-serif; -} - -div.patternEditor { - height: 250px; -} - -textarea#patternInput { - display: block; - width: 250px; - height: 200px; - padding: 20px; - border: 3px solid var(--noiseGreen); - font-weight: bold; - border-radius: 3px; - font-family: 'IBM Plex Mono', monospace; - font-size: 16px; - resize: none; - overflow: hidden; - outline: none; - float: left; -} - -textarea#patternInput.parseInvalid { - border-color: var(--noiseRed) !important; -} - -a#pvActiveLink, -a#pvPassiveLink, -a#goLink, -a#rsLink, -a#wasmLink { - display: inline-block; - padding: 10px; - border: 1px solid var(--noiseDarkGray); - background-color: var(--noiseGreen); - color: #FFF; - font-weight: bold; - text-decoration: none; - width: 170px; - height: 40px; - border-radius: 3px; - margin-right: 20px; - background-repeat: no-repeat; - text-align: right; - background-position: 5px; -} - -a#pvActiveLink, -a#pvPassiveLink { - background-image: url('/res/img/models.svg'); - background-size: 45px; -} - -a#goLink, -a#rsLink, -a#wasmLink { - background-image: url('/res/img/implementations.svg'); - background-size: 45px; -} - -a#pvActiveLink.parseInvalid, -a#pvPassiveLink.parseInvalid, -a#goLink.parseInvalid, -a#rsLink.parseInvalid, -a#wasmLink.parseInvalid { - background-color: var(--noiseRed) !important; -} - -span.modelType { - display: block; - font-variant: small-caps; - font-size: 14px; -} - -div#patternInputParseStatus { - float: left; - height: 50px; - width: 150px; - margin-left: 20px; - font-family: 'IBM Plex Mono', monospace; - color: var(--noiseGreen); - font-variant: small-caps; - text-align: left; -} - -div#patternInputParseStatus.parseInvalid { - color: var(--noiseRed) !important; -} - -input#patternSearch { - border-radius: 3px; - border: 1px solid #CCC; - font-size: 16px; - padding: 4px 8px; - display: block; - width: 80%; - margin: 20px auto 20px auto; -} - -p#patternSearchNotFound { - display: none; - text-align: center; -} - -p#patternSearchNotFound.visible { - display: block; -} - -a.patternEntry { - display: inline-block; - vertical-align: middle; - white-space: pre-line; - border: 3px solid var(--noiseClearGray); - background-clip: padding-box; - border-radius: 3px; - color: var(--noiseTextColor); - background: #FFF; - padding: 5px 10px 10px 15px; - font-weight: bold; - width: 210px; - height: 200px; - margin: 10px 10px; - text-align: left; - font-family: 'IBM Plex Mono', monospace; - line-height: normal; - font-size: 14px; -} - -a.patternEntry:hover { - text-decoration: none; - border-color: var(--noiseGreen); -} - -a.patternEntry.hidden { - display: none; -} - -pre { - background-color: var(--noiseDarkGray); - color: #FFF; - padding: 20px; - border-radius: 3px; - font-family: 'IBM Plex Mono', monospace; - white-space: pre-line; -} - -div.footer { - width: 890px; - margin: 30px auto 0 auto; - background-color: rgba(0, 0, 0, 0.05); - padding: 3px 5px; - position: relative; -} - -div.footer span { - margin-left: 55px; -} - -div.footer span.about { - position: absolute; - left: 0; - top: 0; - background: rgba(255, 255, 255, 0.8); - font-variant: small-caps; - padding: 3px 5px; - font-weight: bold; - margin-left: 0; -} - -div.results.detailed { - padding-bottom: 0px; -} - -div.results.detailed h3 { - margin-top: 30px; -} - -div.results.detailed div.arrowsFrame { - float: none; - height: 150px; - width: 820px; -} - -div.results.detailed div.arrowsFrame div.arrows { - height: 150px; - padding-bottom: 0px; -} - -div.results.detailed div.arrowsFrame div.arrows svg { - margin-top: 0px; - height: 150px; - width: 520px; -} - -div.results.detailed div.arrowsFrame div.arrows svg line { - stroke-width: 6px; -} - -div.results.detailed div.arrowsFrame div.arrows svg polyline { - stroke-width: 6px; -} - -div.results.detailed div.arrowsFrame div.arrows svg circle { - stroke-width: 6px; -} - -div.results.detailed div.arrowsFrame div.arrows svg text.msg { - font-size: 26px; -} - -div.results.detailed div.arrowsFrame div.arrows svg text.tokens { - font-size: 26px; -} - -div.results.detailed div.resultsExplanation { - float: none; - width: 860px; - background-color: var(--noiseDarkGray); - border-color: var(--noiseLightGray); - color: #FFF; - margin-top: 20px; - padding-bottom: 20px; -} - -div.results.detailed p.proverif { - font-family: 'IBM Plex Mono', monospace; - white-space: pre-line; - font-size: 12px; - background: var(--noiseClearGray); - color: var(--noiseTextColor); - border-radius: 3px; - padding: 0 10px 15px 10px; - text-align: left; -} +html { + font-family: 'IBM Plex Sans', sans-serif; + font-size: 14px; + --noiseGreen: #46B29D; + --noiseOrange: #E37B40; + --noiseRed: #DE5B49; + --noiseClearGray: #C4D2E3; + --noiseLightGray: #647B96; + --noiseDarkGray: #565C63; + --noiseBeige: #FFFCFC; + --noiseTextColor: #222; +} + +body { + background-color: #FFF; + color: var(--noiseTextColor); +} + +a { + color: var(--noiseLightGray); + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +hr { + width: 50%; + opacity: 0.5; +} + +ul { + padding-left: 20px; +} + +li { + margin-bottom: 10px; +} + +h3 { + margin: 5% 0 0 0; +} + +span.passed { + color: var(--noiseGreen); +} + +span.failed { + color: var(--noiseRed); +} + +span.mono { + font-family: 'IBM Plex Mono', monospace; + font-weight: bold; +} + +div.header { + width: 900px; + height: 100px; + margin: 0 auto; +} + +div.header img#logo { + float: left; + height: 100px; + width: auto; +} + +div.header h1 { + margin: 30px 0 0 20px; + float: left; + font-weight: bold; + font-size: 36px; + font-family: 'IBM Plex Sans', sans-serif; +} + +div.header h1 span.beta { + font-variant: small-caps; + font-size: 14px; + background-color: var(--noiseRed); + color: #FFF; + padding: 0px 4px 3px 4px; + border-radius: 3px; + position: relative; + bottom: 5px; +} + +div.nav { + width: 890px; + margin: 0 auto; + background-color: rgba(0, 0, 0, 0.05); + padding: 3px 5px; + position: relative; +} + +div.nav span.menu { + position: absolute; + left: 0; + top: 0; + background: rgba(255, 255, 255, 0.8); + font-variant: small-caps; + padding: 3px 5px; + font-weight: bold; +} + +div.nav a { + margin-right: 20px; + padding: 2px; +} + +div.nav a.currentNav { + color: var(--noiseGreen); +} + +div.nav div.navLinks { + margin-left: 50px; +} + +div.results { + width: 900px; + margin: 10px auto; + padding-bottom: 300px; +} + +div.results.singleColumn { + float: none; + height: auto; + padding-bottom: 0px; +} + +div.results.singleColumn div.resultsExplanation { + float: none !important; + height: auto; + width: 855px; + padding-bottom: 20px; +} + +div.arrowsFrame { + width: 250px; + padding: 60px 40px 40px 40px; + border: 1px solid var(--noiseLightGray); + background-color: var(--noiseBeige); + position: relative; + float: left; +} + +div.arrowsFrame h1 { + position: absolute; + top: 0; + left: 0; + background-color: #FFF; + margin: 0; + padding: 10px; + border: 1px solid var(--noiseLightGray); + border-top: none; + border-left: none; +} + +div.arrows { + margin: 0px auto; + width: 100%; + text-align: center; + padding-bottom: 211px; +} + +div.arrows svg { + margin-top: 40px; +} + +div.arrows svg line { + fill: none; + stroke-width: 3px; + shape-rendering: crispEdges; + stroke: var(--noiseDarkGray); +} + +div.arrows svg polyline { + stroke: var(--noiseDarkGray); + fill: none; + stroke-width: 3px; + shape-rendering: geometricPrecision; +} + +div.arrows svg circle { + fill: var(--noiseClearGray); + stroke: var(--noiseDarkGray); + stroke-width: 3px; + shape-rendering: geometricPrecision; +} + +div.arrows svg.noColor line[data-seclevel="0"], +div.arrows svg.noColor polyline[data-seclevel="0"] { + stroke: var(--noiseDarkGray); +} + +div.arrows svg.noColor circle[data-seclevel="0"] { + stroke: var(--noiseDarkGray); +} + +div.arrows svg line[data-seclevel="0"], +div.arrows svg polyline[data-seclevel="0"] { + stroke: var(--noiseRed); +} + +div.arrows svg line[data-seclevel="1"], +div.arrows svg polyline[data-seclevel="1"] { + stroke: var(--noiseOrange); +} + +div.arrows svg line[data-seclevel="2"], +div.arrows svg polyline[data-seclevel="2"] { + stroke: var(--noiseOrange); +} + +div.arrows svg line[data-seclevel="3"], +div.arrows svg polyline[data-seclevel="3"] { + stroke: var(--noiseGreen); +} + +div.arrows svg line[data-seclevel="4"], +div.arrows svg polyline[data-seclevel="4"] { + stroke: var(--noiseGreen); +} + +div.arrows svg line[data-seclevel="5"], +div.arrows svg polyline[data-seclevel="5"] { + stroke: var(--noiseGreen); +} + +div.arrows svg circle[data-seclevel="0"] { + stroke: var(--noiseRed); +} + +div.arrows svg circle[data-seclevel="1"] { + stroke: var(--noiseOrange); +} + +div.arrows svg circle[data-seclevel="2"] { + stroke: var(--noiseOrange); +} + +div.arrows svg circle[data-seclevel="3"] { + stroke: var(--noiseGreen); +} + +div.arrows svg circle[data-seclevel="4"] { + stroke: var(--noiseGreen); +} + +div.arrows svg text.msg { + font-family: 'IBM Plex Mono', monospace; + font-size: 16px; + font-weight: bold; + fill: var(--noiseDarkGray); + font-variant: small-caps; + shape-rendering: geometricPrecision; + text-anchor: middle; +} + +div.arrows svg text.tokens { + font-family: 'IBM Plex Mono', monospace; + font-size: 14px; + fill: var(--noiseDarkGray); + font-weight: bold; + shape-rendering: geometricPrecision; + width: 250px; + text-anchor: middle; +} + +div.arrows svg text.ellipsis { + font-size: 64px; + fill: var(--noiseDarkGray); + text-anchor: middle; +} + +div.resultsExplanation { + float: right; + width: 500px; + background-color: var(--noiseBeige); + padding: 0 20px 20px 20px; + border-radius: 3px; + border: 2px solid #FFF5F5; + text-align: justify; + padding-bottom: 310px; +} + +div.resultsExplanation a.detailedAnalysis { + font-variant: small-caps; + background-color: var(--noiseLightGray); + color: #FFF; + padding: 1px 3px; + border-radius: 3px; + font-size: 12px; + margin-left: 5px; + font-family: 'IBM Plex Mono', monospace; +} + +div.resultsExplanation a.detailedAnalysis:hover { + text-decoration: none; + background-color: var(--noiseDarkGray); +} + +div.resultsExplanation p { + margin-top: 5px; +} + +div.resultsExplanation span.resultNums { + font-family: 'IBM Plex Mono', monospace; + font-weight: bold; + font-size: 10px; + background-color: var(--noiseDarkGray); + color: #FFF; + padding: 1px 3px; + border-radius: 3px; +} + +div.rawResults { + background-color: var(--noiseDarkGray); + border: 2px solid var(--noiseLightGray); + border-radius: 3px; + color: #FFF; + font-family: 'IBM Plex Mono', monospace; + margin: 20px auto 0 auto; + width: 860px; + padding: 0 20px; + height: 400px; + font-size: 10px; + overflow-y: auto; + font-variant: small-caps; +} + +div.rawResults h2 { + font-family: 'IBM Plex Sans', sans-serif; +} + +div.patternEditor { + height: 250px; +} + +textarea#patternInput { + display: block; + width: 250px; + height: 200px; + padding: 20px; + border: 3px solid var(--noiseGreen); + font-weight: bold; + border-radius: 3px; + font-family: 'IBM Plex Mono', monospace; + font-size: 16px; + resize: none; + overflow: hidden; + outline: none; + float: left; +} + +textarea#patternInput.parseInvalid { + border-color: var(--noiseRed) !important; +} + +a#pvActiveLink, +a#pvPassiveLink, +a#goLink, +a#rsLink, +a#wasmLink { + display: inline-block; + padding: 10px; + border: 1px solid var(--noiseDarkGray); + background-color: var(--noiseGreen); + color: #FFF; + font-weight: bold; + text-decoration: none; + width: 170px; + height: 40px; + border-radius: 3px; + margin-right: 20px; + background-repeat: no-repeat; + text-align: right; + background-position: 5px; +} + +a#pvActiveLink, +a#pvPassiveLink { + background-image: url('/res/img/models.svg'); + background-size: 45px; +} + +a#goLink, +a#rsLink, +a#wasmLink { + background-image: url('/res/img/implementations.svg'); + background-size: 45px; +} + +a#pvActiveLink.parseInvalid, +a#pvPassiveLink.parseInvalid, +a#goLink.parseInvalid, +a#rsLink.parseInvalid, +a#wasmLink.parseInvalid { + background-color: var(--noiseRed) !important; +} + +span.modelType { + display: block; + font-variant: small-caps; + font-size: 14px; +} + +div#patternInputParseStatus { + float: left; + height: 50px; + width: 150px; + margin-left: 20px; + font-family: 'IBM Plex Mono', monospace; + color: var(--noiseGreen); + font-variant: small-caps; + text-align: left; +} + +div#patternInputParseStatus.parseInvalid { + color: var(--noiseRed) !important; +} + +input#patternSearch { + border-radius: 3px; + border: 1px solid #CCC; + font-size: 16px; + padding: 4px 8px; + display: block; + width: 80%; + margin: 20px auto 20px auto; +} + +p#patternSearchNotFound { + display: none; + text-align: center; +} + +p#patternSearchNotFound.visible { + display: block; +} + +a.patternEntry { + display: inline-block; + vertical-align: middle; + white-space: pre-line; + border: 3px solid var(--noiseClearGray); + background-clip: padding-box; + border-radius: 3px; + color: var(--noiseTextColor); + background: #FFF; + padding: 5px 10px 10px 15px; + font-weight: bold; + width: 210px; + height: 200px; + margin: 10px 10px; + text-align: left; + font-family: 'IBM Plex Mono', monospace; + line-height: normal; + font-size: 14px; +} + +a.patternEntry:hover { + text-decoration: none; + border-color: var(--noiseGreen); +} + +a.patternEntry.hidden { + display: none; +} + +pre { + background-color: var(--noiseDarkGray); + color: #FFF; + padding: 20px; + border-radius: 3px; + font-family: 'IBM Plex Mono', monospace; + white-space: pre-line; +} + +div.footer { + width: 890px; + margin: 30px auto 0 auto; + background-color: rgba(0, 0, 0, 0.05); + padding: 3px 5px; + position: relative; +} + +div.footer span { + margin-left: 55px; +} + +div.footer span.about { + position: absolute; + left: 0; + top: 0; + background: rgba(255, 255, 255, 0.8); + font-variant: small-caps; + padding: 3px 5px; + font-weight: bold; + margin-left: 0; +} + +div.results.detailed { + padding-bottom: 0px; +} + +div.results.detailed h3 { + margin-top: 30px; +} + +div.results.detailed div.arrowsFrame { + float: none; + height: 150px; + width: 820px; +} + +div.results.detailed div.arrowsFrame div.arrows { + height: 150px; + padding-bottom: 0px; +} + +div.results.detailed div.arrowsFrame div.arrows svg { + margin-top: 0px; + height: 150px; + width: 520px; +} + +div.results.detailed div.arrowsFrame div.arrows svg line { + stroke-width: 6px; +} + +div.results.detailed div.arrowsFrame div.arrows svg polyline { + stroke-width: 6px; +} + +div.results.detailed div.arrowsFrame div.arrows svg circle { + stroke-width: 6px; +} + +div.results.detailed div.arrowsFrame div.arrows svg text.msg { + font-size: 26px; +} + +div.results.detailed div.arrowsFrame div.arrows svg text.tokens { + font-size: 26px; +} + +div.results.detailed div.resultsExplanation { + float: none; + width: 860px; + background-color: var(--noiseDarkGray); + border-color: var(--noiseLightGray); + color: #FFF; + margin-top: 20px; + padding-bottom: 20px; +} + +div.results.detailed p.proverif { + font-family: 'IBM Plex Mono', monospace; + white-space: pre-line; + font-size: 12px; + background: var(--noiseClearGray); + color: var(--noiseTextColor); + border-radius: 3px; + padding: 0 10px 15px 10px; + text-align: left; +} diff --git a/html/res/img/logo.svg b/html/res/img/logo.svg index 283e72eb1..8093a1b6f 100755 --- a/html/res/img/logo.svg +++ b/html/res/img/logo.svg @@ -1,157 +1,157 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/html/res/js/noiseWebIde.js b/html/res/js/noiseWebIde.js index 4b8bc945a..11b2e5a87 100755 --- a/html/res/js/noiseWebIde.js +++ b/html/res/js/noiseWebIde.js @@ -1,408 +1,408 @@ -let genReady = { - pv: { - active: false, - passive: false - }, - go: false, - rs: false, - wasm: false -}; - -let $ = (id) => { return document.getElementById(id) }; - -let getArrows = (parsedPattern) => { - let renderData = NOISEREADER.render( - parsedPattern, [], [], [], [] - ); - return renderData.arrowSvg; -}; - -let pvRender = (patternInput, parsedPattern, passive, pv, cb) => { - let parsedPv = NOISE2PV.parse(parsedPattern, passive); - pv[0] = pv[0].replace('(* $NOISE2PV_T$ *)', parsedPv.t) - pv[1] = pv[1].replace('(* $NOISE2PV_S$ *)', parsedPv.s); - pv[5] = pv[5].replace('(* $NOISE2PV_I$ *)', parsedPv.i); - pv[5] = pv[5].replace('(* $NOISE2PV_W$ *)', parsedPv.w); - pv[5] = pv[5].replace('(* $NOISE2PV_R$ *)', parsedPv.r); - pv[7] = pv[7].replace('(* $NOISE2PV_E$ *)', parsedPv.e); - pv[7] = pv[7].replace('(* $NOISE2PV_Q$ *)', parsedPv.q); - pv[8] = pv[8].replace('(* $NOISE2PV_N$ *)', `(*\n${patternInput}\n*)`); - pv[8] = pv[8].replace('(* $NOISE2PV_G$ *)', parsedPv.g); - pv[8] = pv[8].replace('(* $NOISE2PV_A$ *)', parsedPv.a); - pv[8] = pv[8].replace('(* $NOISE2PV_B$ *)', parsedPv.b); - pv[8] = pv[8].replace('(* $NOISE2PV_K$ *)', parsedPv.k); - pv[8] = pv[8].replace('(* $NOISE2PV_P$ *)', parsedPv.p); - cb(pv.join('\n')); -}; - -let goRender = (patternInput, parsedPattern, go, cb) => { - let parsedGo = NOISE2GO.parse(parsedPattern); - fetch('/res/js/versions.json').then(response => { - if (!response.ok) { - throw new Error("HTTP error " + response.status); - } - return response.json(); - }).then(json => { - go[0] = go[0].replace('/* $NOISE2GO_N$ */', `/*\n${patternInput}\n*/`); - go[0] = go[0].replace('/* $NOISE2GO_V$ */', `${json.major_go}.${json.minor_go}.${json.patch_go}`); - go[5] = go[5].replace('/* $NOISE2GO_I$ */', parsedGo.i); - go[5] = go[5].replace('/* $NOISE2GO_W$ */', parsedGo.w); - go[5] = go[5].replace('/* $NOISE2GO_R$ */', parsedGo.r); - go[6] = go[6].replace('/* $NOISE2GO_P$ */', parsedGo.p); - cb(go); - }); -}; - -let rsRender = (patternInput, parsedPattern, rs, cb) => { - let parsedRs = NOISE2RS.parse(parsedPattern); - fetch('/res/js/versions.json').then(response => { - if (!response.ok) { - throw new Error("HTTP error " + response.status); - } - return response.json(); - }).then(json => { - rs[0] = rs[0].replace('/* $NOISE2RS_N$ */', `/*\n${patternInput}\n*/`); - rs[1] = rs[1].replace(/\$NOISE2RS_N\$/g, parsedPattern.name.toLowerCase()); - rs[5] = rs[5].replace('/* $NOISE2RS_I$ */', parsedRs.i); - rs[5] = rs[5].replace('/* $NOISE2RS_W$ */', parsedRs.w); - rs[5] = rs[5].replace('/* $NOISE2RS_R$ */', parsedRs.r); - rs[6] = rs[6].replace('/* $NOISE2RS_P$ */', parsedRs.p); - rs[9] = rs[9].replace(/\$NOISE2RS_N\$/g, parsedPattern.name.toLowerCase()); - rs[9] = rs[9].replace(/\$NOISE2RS_V\$/g, `${json.major_rust}.${json.minor_rust}.${json.patch_rust}`); - cb(rs); - }); -}; - -let wasmRender = (patternInput, parsedPattern, wasm, cb) => { - let parsedWasm = NOISE2WASM.parse(parsedPattern); - fetch('/res/js/versions.json').then(response => { - if (!response.ok) { - throw new Error("HTTP error " + response.status); - } - return response.json(); - }).then(json => { - wasm[0] = wasm[0].replace('/* $NOISE2WASM_N$ */', `/*\n${patternInput}\n*/`); - wasm[5] = wasm[5].replace('/* $NOISE2WASM_I$ */', parsedWasm.i); - wasm[5] = wasm[5].replace('/* $NOISE2WASM_W$ */', parsedWasm.w); - wasm[5] = wasm[5].replace('/* $NOISE2WASM_R$ */', parsedWasm.r); - wasm[6] = wasm[6].replace('/* $NOISE2WASM_P$ */', parsedWasm.p); - wasm[9] = wasm[9].replace(/\$NOISE2WASM_N\$/g, parsedPattern.name.toLowerCase()); - wasm[9] = wasm[9].replace(/\$NOISE2WASM_V\$/g, `${json.major_wasm}.${json.minor_wasm}.${json.patch_wasm}`); - wasm[10] = wasm[10].replace(/\$NOISE2WASM_N\$/g, parsedPattern.name.toLowerCase()); - wasm[11] = wasm[11].replace(/\$NOISE2WASM_N\$/g, parsedPattern.name.toLowerCase()); - wasm[11] = wasm[11].replace(/\$NOISE2WASM_V\$/g, `${json.major_wasm}.${json.minor_wasm}.${json.patch_wasm}`); - cb(wasm); - }); -}; - -let getPv = (patternInput, parsedPattern, passive, cb) => { - let pvTemplates = [ - '0params', - '1types', - '2consts', - '3utils', - '4prims', - '5state', - '6channels', - '7queries', - '8processes' - ]; - let pv = ['', '', '', '', '', '', '', '', '']; - pvTemplates.forEach((templateFile, i) => { - let xhr = new XMLHttpRequest(); - xhr.open('GET', `/res/pv/${templateFile}.pv`); - xhr.onreadystatechange = () => { - if ( - (xhr.readyState !== 4) || - (xhr.status !== 200) - ) { - return false; - } - pv[i] = xhr.responseText; - let full = 0; - pv.forEach((slot) => { - slot.length? full++ : full; - }); - if (full === pv.length) { - pvRender(patternInput, parsedPattern, passive, pv, cb); - } - }; - xhr.send(); - }); -}; - -let getGo = (patternInput, parsedPattern, cb) => { - let goTemplates = [ - '0params', - '1types', - '2consts', - '3utils', - '4prims', - '5state', - '6processes' - ]; - let go = ['', '', '', '', '', '', '']; - goTemplates.forEach((templateFile, i) => { - let xhr = new XMLHttpRequest(); - xhr.open('GET', `/res/go/${templateFile}.go`); - xhr.onreadystatechange = () => { - if ( - (xhr.readyState !== 4) || - (xhr.status !== 200) - ) { - return false; - } - go[i] = xhr.responseText; - let full = 0; - go.forEach((slot) => { - slot.length? full++ : full; - }); - if (full === go.length) { - goRender(patternInput, parsedPattern, go, cb); - } - }; - xhr.send(); - }); -}; - -let getRs = (patternInput, parsedPattern, cb) => { - let rsTemplates = [ - '0params.rs', - '1types.rs', - '2consts.rs', - '3utils.rs', - '4prims.rs', - '5state.rs', - '6processes.rs', - '7error.rs', - '8macros.rs', - '9Cargo.toml', - ]; - let rs = ['', '', '', '', '', '', '', '', '', '']; - rsTemplates.forEach((templateFile, i) => { - let xhr = new XMLHttpRequest(); - xhr.open('GET', `/res/rs/${templateFile}`); - xhr.onreadystatechange = () => { - if ( - (xhr.readyState !== 4) || - (xhr.status !== 200) - ) { - return false; - } - rs[i] = xhr.responseText; - let full = 0; - rs.forEach((slot) => { - slot.length? full++ : full; - }); - if (full === rs.length) { - rsRender(patternInput, parsedPattern, rs, cb); - } - }; - xhr.send(); - }); -}; - -let getWasm = (patternInput, parsedPattern, cb) => { - let wasmTemplates = [ - '0params.rs', - '1types.rs', - '2consts.rs', - '3utils.rs', - '4prims.rs', - '5state.rs', - '6processes.rs', - '7error.rs', - '8macros.rs', - '9Cargo.toml', - '10Makefile.m', - '11README.md' - ]; - let wasm = ['', '', '', '', '', '', '', '', '', '', '', '']; - wasmTemplates.forEach((templateFile, i) => { - let xhr = new XMLHttpRequest(); - xhr.open('GET', `/res/wasm/${templateFile}`); - xhr.onreadystatechange = () => { - if ( - (xhr.readyState !== 4) || - (xhr.status !== 200) - ) { - return false; - } - wasm[i] = xhr.responseText; - let full = 0; - wasm.forEach((slot) => { - slot.length? full++ : full; - }); - if (full === wasm.length) { - wasmRender(patternInput, parsedPattern, wasm, cb); - } - }; - xhr.send(); - }); -}; - -let processPatternInput = (patternInput) => { - let parsedPattern = {}; - genReady.pv.active = false; - genReady.pv.passive = false; - genReady.go = false; - $('pvActiveLink').href = '#'; - $('pvPassiveLink').href = '#'; - $('goLink').href = '#'; - $('rsLink').href = '#'; - $('wasmLink').href = '#'; - try { - parsedPattern = peg$parse(patternInput); - } catch (e) { - $('patternInputParseStatus').innerText = e.toString().toLowerCase(); - $('patternInput').classList.add('parseInvalid'); - $('patternInputParseStatus').classList.add('parseInvalid'); - $('pvActiveLink').classList.add('parseInvalid'); - $('pvPassiveLink').classList.add('parseInvalid'); - $('goLink').classList.add('parseInvalid'); - $('rsLink').classList.add('parseInvalid'); - $('wasmLink').classList.add('parseInvalid'); - return false; - } - let arrowSvg = getArrows(parsedPattern); - $('patternInputParseStatus').innerText = 'parsing completed successfully.'; - $('patternInput').classList.remove('parseInvalid'); - $('patternInputParseStatus').classList.remove('parseInvalid'); - $('pvActiveLink').classList.remove('parseInvalid'); - $('pvPassiveLink').classList.remove('parseInvalid'); - $('goLink').classList.remove('parseInvalid'); - $('rsLink').classList.remove('parseInvalid'); - $('wasmLink').classList.remove('parseInvalid'); - $('patternName').innerText = parsedPattern.name; - $('patternArrows').innerHTML = arrowSvg; - return true; -}; - -let processPatternKeyUp = (key) => { - if (key === 'Enter') { - $('patternInput').value += ' '; - } -}; - -let pvGen = (patternInput, attacker, aId, autoClick) => { - let parsedPattern = {}; - let passive = /^passive$/.test(attacker); - if (genReady.pv[attacker]) { - return true; - } - try { - parsedPattern = peg$parse(patternInput); - } catch (e) { - alert('Please first ensure that your Noise pattern is valid.'); - return false; - } - getPv(patternInput, parsedPattern, passive, (pv) => { - let pvBlob = window.URL.createObjectURL( - new Blob([pv], { type: 'text/plain' }) - ); - genReady.pv[attacker] = true; - $(aId).href = pvBlob; - $(aId).download = `${parsedPattern.name}.noise.${attacker}.pv`; - autoClick? $(aId).click() : false; - }); - return false; -}; - -let goGen = (patternInput, aId, autoClick) => { - let parsedPattern = {}; - if (genReady.go) { - return true; - } - try { - parsedPattern = peg$parse(patternInput); - } catch (e) { - alert('Please first ensure that your Noise pattern is valid.'); - return false; - } - getGo(patternInput, parsedPattern, (go) => { - let goBlob = window.URL.createObjectURL( - new Blob([go.join('\n')], { type: 'text/plain' }) - ); - genReady.go = true; - $(aId).href = goBlob; - $(aId).download = `${parsedPattern.name}.noise.go`; - autoClick? $(aId).click() : false; - }); - return false; -}; - -let rsGen = (patternInput, aId, autoClick) => { - let parsedPattern = {}; - if (genReady.rs) { - return true; - } - try { - parsedPattern = peg$parse(patternInput); - } catch (e) { - alert('Please first ensure that your Noise pattern is valid.'); - return false; - } - getRs(patternInput, parsedPattern, (rs) => { - let zip = new JSZip(); - let src = zip.folder('src'); - src.file('lib.rs', rs[0]); - src.file('types.rs', rs[1]); - src.file('consts.rs', rs[2]); - src.file('utils.rs', rs[3]); - src.file('prims.rs', rs[4]); - src.file('state.rs', rs[5]); - src.file('noisesession.rs', rs[6]); - src.file('error.rs', rs[7]); - src.file('macros.rs', rs[8]); - zip.file('Cargo.toml', rs[9]); - zip.generateAsync({ - type:'blob' - }).then((blob) => { - let rsBlob = window.URL.createObjectURL(blob); - genReady.rs = true; - $(aId).href = rsBlob; - $(aId).download = `${parsedPattern.name}.noise.rs.zip`; - autoClick? $(aId).click() : false; - }); - }); - return false; -}; - -let wasmGen = (patternInput, aId, autoClick) => { - let parsedPattern = {}; - if (genReady.wasm) { - return true; - } - try { - parsedPattern = peg$parse(patternInput); - } catch (e) { - alert('Please first ensure that your Noise pattern is valid.'); - return false; - } - getWasm(patternInput, parsedPattern, (wasm) => { - let zip = new JSZip(); - let src = zip.folder('src'); - src.file('lib.rs', wasm[0]); - src.file('types.rs', wasm[1]); - src.file('consts.rs', wasm[2]); - src.file('utils.rs', wasm[3]); - src.file('prims.rs', wasm[4]); - src.file('state.rs', wasm[5]); - src.file('noisesession.rs', wasm[6]); - src.file('error.rs', wasm[7]); - src.file('macros.rs', wasm[8]); - zip.file('Cargo.toml', wasm[9]); - zip.file('Makefile', wasm[10]); - zip.file('README.md', wasm[11]); - zip.generateAsync({ - type:'blob' - }).then((blob) => { - let wasmBlob = window.URL.createObjectURL(blob); - genReady.wasm = true; - $(aId).href = wasmBlob; - $(aId).download = `${parsedPattern.name}.noise.wasm.zip`; - autoClick? $(aId).click() : false; - }); - }); - return false; -}; +let genReady = { + pv: { + active: false, + passive: false + }, + go: false, + rs: false, + wasm: false +}; + +let $ = (id) => { return document.getElementById(id) }; + +let getArrows = (parsedPattern) => { + let renderData = NOISEREADER.render( + parsedPattern, [], [], [], [] + ); + return renderData.arrowSvg; +}; + +let pvRender = (patternInput, parsedPattern, passive, pv, cb) => { + let parsedPv = NOISE2PV.parse(parsedPattern, passive); + pv[0] = pv[0].replace('(* $NOISE2PV_T$ *)', parsedPv.t) + pv[1] = pv[1].replace('(* $NOISE2PV_S$ *)', parsedPv.s); + pv[5] = pv[5].replace('(* $NOISE2PV_I$ *)', parsedPv.i); + pv[5] = pv[5].replace('(* $NOISE2PV_W$ *)', parsedPv.w); + pv[5] = pv[5].replace('(* $NOISE2PV_R$ *)', parsedPv.r); + pv[7] = pv[7].replace('(* $NOISE2PV_E$ *)', parsedPv.e); + pv[7] = pv[7].replace('(* $NOISE2PV_Q$ *)', parsedPv.q); + pv[8] = pv[8].replace('(* $NOISE2PV_N$ *)', `(*\n${patternInput}\n*)`); + pv[8] = pv[8].replace('(* $NOISE2PV_G$ *)', parsedPv.g); + pv[8] = pv[8].replace('(* $NOISE2PV_A$ *)', parsedPv.a); + pv[8] = pv[8].replace('(* $NOISE2PV_B$ *)', parsedPv.b); + pv[8] = pv[8].replace('(* $NOISE2PV_K$ *)', parsedPv.k); + pv[8] = pv[8].replace('(* $NOISE2PV_P$ *)', parsedPv.p); + cb(pv.join('\n')); +}; + +let goRender = (patternInput, parsedPattern, go, cb) => { + let parsedGo = NOISE2GO.parse(parsedPattern); + fetch('/res/js/versions.json').then(response => { + if (!response.ok) { + throw new Error("HTTP error " + response.status); + } + return response.json(); + }).then(json => { + go[0] = go[0].replace('/* $NOISE2GO_N$ */', `/*\n${patternInput}\n*/`); + go[0] = go[0].replace('/* $NOISE2GO_V$ */', `${json.major_go}.${json.minor_go}.${json.patch_go}`); + go[5] = go[5].replace('/* $NOISE2GO_I$ */', parsedGo.i); + go[5] = go[5].replace('/* $NOISE2GO_W$ */', parsedGo.w); + go[5] = go[5].replace('/* $NOISE2GO_R$ */', parsedGo.r); + go[6] = go[6].replace('/* $NOISE2GO_P$ */', parsedGo.p); + cb(go); + }); +}; + +let rsRender = (patternInput, parsedPattern, rs, cb) => { + let parsedRs = NOISE2RS.parse(parsedPattern); + fetch('/res/js/versions.json').then(response => { + if (!response.ok) { + throw new Error("HTTP error " + response.status); + } + return response.json(); + }).then(json => { + rs[0] = rs[0].replace('/* $NOISE2RS_N$ */', `/*\n${patternInput}\n*/`); + rs[1] = rs[1].replace(/\$NOISE2RS_N\$/g, parsedPattern.name.toLowerCase()); + rs[5] = rs[5].replace('/* $NOISE2RS_I$ */', parsedRs.i); + rs[5] = rs[5].replace('/* $NOISE2RS_W$ */', parsedRs.w); + rs[5] = rs[5].replace('/* $NOISE2RS_R$ */', parsedRs.r); + rs[6] = rs[6].replace('/* $NOISE2RS_P$ */', parsedRs.p); + rs[9] = rs[9].replace(/\$NOISE2RS_N\$/g, parsedPattern.name.toLowerCase()); + rs[9] = rs[9].replace(/\$NOISE2RS_V\$/g, `${json.major_rust}.${json.minor_rust}.${json.patch_rust}`); + cb(rs); + }); +}; + +let wasmRender = (patternInput, parsedPattern, wasm, cb) => { + let parsedWasm = NOISE2WASM.parse(parsedPattern); + fetch('/res/js/versions.json').then(response => { + if (!response.ok) { + throw new Error("HTTP error " + response.status); + } + return response.json(); + }).then(json => { + wasm[0] = wasm[0].replace('/* $NOISE2WASM_N$ */', `/*\n${patternInput}\n*/`); + wasm[5] = wasm[5].replace('/* $NOISE2WASM_I$ */', parsedWasm.i); + wasm[5] = wasm[5].replace('/* $NOISE2WASM_W$ */', parsedWasm.w); + wasm[5] = wasm[5].replace('/* $NOISE2WASM_R$ */', parsedWasm.r); + wasm[6] = wasm[6].replace('/* $NOISE2WASM_P$ */', parsedWasm.p); + wasm[9] = wasm[9].replace(/\$NOISE2WASM_N\$/g, parsedPattern.name.toLowerCase()); + wasm[9] = wasm[9].replace(/\$NOISE2WASM_V\$/g, `${json.major_wasm}.${json.minor_wasm}.${json.patch_wasm}`); + wasm[10] = wasm[10].replace(/\$NOISE2WASM_N\$/g, parsedPattern.name.toLowerCase()); + wasm[11] = wasm[11].replace(/\$NOISE2WASM_N\$/g, parsedPattern.name.toLowerCase()); + wasm[11] = wasm[11].replace(/\$NOISE2WASM_V\$/g, `${json.major_wasm}.${json.minor_wasm}.${json.patch_wasm}`); + cb(wasm); + }); +}; + +let getPv = (patternInput, parsedPattern, passive, cb) => { + let pvTemplates = [ + '0params', + '1types', + '2consts', + '3utils', + '4prims', + '5state', + '6channels', + '7queries', + '8processes' + ]; + let pv = ['', '', '', '', '', '', '', '', '']; + pvTemplates.forEach((templateFile, i) => { + let xhr = new XMLHttpRequest(); + xhr.open('GET', `/res/pv/${templateFile}.pv`); + xhr.onreadystatechange = () => { + if ( + (xhr.readyState !== 4) || + (xhr.status !== 200) + ) { + return false; + } + pv[i] = xhr.responseText; + let full = 0; + pv.forEach((slot) => { + slot.length? full++ : full; + }); + if (full === pv.length) { + pvRender(patternInput, parsedPattern, passive, pv, cb); + } + }; + xhr.send(); + }); +}; + +let getGo = (patternInput, parsedPattern, cb) => { + let goTemplates = [ + '0params', + '1types', + '2consts', + '3utils', + '4prims', + '5state', + '6processes' + ]; + let go = ['', '', '', '', '', '', '']; + goTemplates.forEach((templateFile, i) => { + let xhr = new XMLHttpRequest(); + xhr.open('GET', `/res/go/${templateFile}.go`); + xhr.onreadystatechange = () => { + if ( + (xhr.readyState !== 4) || + (xhr.status !== 200) + ) { + return false; + } + go[i] = xhr.responseText; + let full = 0; + go.forEach((slot) => { + slot.length? full++ : full; + }); + if (full === go.length) { + goRender(patternInput, parsedPattern, go, cb); + } + }; + xhr.send(); + }); +}; + +let getRs = (patternInput, parsedPattern, cb) => { + let rsTemplates = [ + '0params.rs', + '1types.rs', + '2consts.rs', + '3utils.rs', + '4prims.rs', + '5state.rs', + '6processes.rs', + '7error.rs', + '8macros.rs', + '9Cargo.toml', + ]; + let rs = ['', '', '', '', '', '', '', '', '', '']; + rsTemplates.forEach((templateFile, i) => { + let xhr = new XMLHttpRequest(); + xhr.open('GET', `/res/rs/${templateFile}`); + xhr.onreadystatechange = () => { + if ( + (xhr.readyState !== 4) || + (xhr.status !== 200) + ) { + return false; + } + rs[i] = xhr.responseText; + let full = 0; + rs.forEach((slot) => { + slot.length? full++ : full; + }); + if (full === rs.length) { + rsRender(patternInput, parsedPattern, rs, cb); + } + }; + xhr.send(); + }); +}; + +let getWasm = (patternInput, parsedPattern, cb) => { + let wasmTemplates = [ + '0params.rs', + '1types.rs', + '2consts.rs', + '3utils.rs', + '4prims.rs', + '5state.rs', + '6processes.rs', + '7error.rs', + '8macros.rs', + '9Cargo.toml', + '10Makefile.m', + '11README.md' + ]; + let wasm = ['', '', '', '', '', '', '', '', '', '', '', '']; + wasmTemplates.forEach((templateFile, i) => { + let xhr = new XMLHttpRequest(); + xhr.open('GET', `/res/wasm/${templateFile}`); + xhr.onreadystatechange = () => { + if ( + (xhr.readyState !== 4) || + (xhr.status !== 200) + ) { + return false; + } + wasm[i] = xhr.responseText; + let full = 0; + wasm.forEach((slot) => { + slot.length? full++ : full; + }); + if (full === wasm.length) { + wasmRender(patternInput, parsedPattern, wasm, cb); + } + }; + xhr.send(); + }); +}; + +let processPatternInput = (patternInput) => { + let parsedPattern = {}; + genReady.pv.active = false; + genReady.pv.passive = false; + genReady.go = false; + $('pvActiveLink').href = '#'; + $('pvPassiveLink').href = '#'; + $('goLink').href = '#'; + $('rsLink').href = '#'; + $('wasmLink').href = '#'; + try { + parsedPattern = peg$parse(patternInput); + } catch (e) { + $('patternInputParseStatus').innerText = e.toString().toLowerCase(); + $('patternInput').classList.add('parseInvalid'); + $('patternInputParseStatus').classList.add('parseInvalid'); + $('pvActiveLink').classList.add('parseInvalid'); + $('pvPassiveLink').classList.add('parseInvalid'); + $('goLink').classList.add('parseInvalid'); + $('rsLink').classList.add('parseInvalid'); + $('wasmLink').classList.add('parseInvalid'); + return false; + } + let arrowSvg = getArrows(parsedPattern); + $('patternInputParseStatus').innerText = 'parsing completed successfully.'; + $('patternInput').classList.remove('parseInvalid'); + $('patternInputParseStatus').classList.remove('parseInvalid'); + $('pvActiveLink').classList.remove('parseInvalid'); + $('pvPassiveLink').classList.remove('parseInvalid'); + $('goLink').classList.remove('parseInvalid'); + $('rsLink').classList.remove('parseInvalid'); + $('wasmLink').classList.remove('parseInvalid'); + $('patternName').innerText = parsedPattern.name; + $('patternArrows').innerHTML = arrowSvg; + return true; +}; + +let processPatternKeyUp = (key) => { + if (key === 'Enter') { + $('patternInput').value += ' '; + } +}; + +let pvGen = (patternInput, attacker, aId, autoClick) => { + let parsedPattern = {}; + let passive = /^passive$/.test(attacker); + if (genReady.pv[attacker]) { + return true; + } + try { + parsedPattern = peg$parse(patternInput); + } catch (e) { + alert('Please first ensure that your Noise pattern is valid.'); + return false; + } + getPv(patternInput, parsedPattern, passive, (pv) => { + let pvBlob = window.URL.createObjectURL( + new Blob([pv], { type: 'text/plain' }) + ); + genReady.pv[attacker] = true; + $(aId).href = pvBlob; + $(aId).download = `${parsedPattern.name}.noise.${attacker}.pv`; + autoClick? $(aId).click() : false; + }); + return false; +}; + +let goGen = (patternInput, aId, autoClick) => { + let parsedPattern = {}; + if (genReady.go) { + return true; + } + try { + parsedPattern = peg$parse(patternInput); + } catch (e) { + alert('Please first ensure that your Noise pattern is valid.'); + return false; + } + getGo(patternInput, parsedPattern, (go) => { + let goBlob = window.URL.createObjectURL( + new Blob([go.join('\n')], { type: 'text/plain' }) + ); + genReady.go = true; + $(aId).href = goBlob; + $(aId).download = `${parsedPattern.name}.noise.go`; + autoClick? $(aId).click() : false; + }); + return false; +}; + +let rsGen = (patternInput, aId, autoClick) => { + let parsedPattern = {}; + if (genReady.rs) { + return true; + } + try { + parsedPattern = peg$parse(patternInput); + } catch (e) { + alert('Please first ensure that your Noise pattern is valid.'); + return false; + } + getRs(patternInput, parsedPattern, (rs) => { + let zip = new JSZip(); + let src = zip.folder('src'); + src.file('lib.rs', rs[0]); + src.file('types.rs', rs[1]); + src.file('consts.rs', rs[2]); + src.file('utils.rs', rs[3]); + src.file('prims.rs', rs[4]); + src.file('state.rs', rs[5]); + src.file('noisesession.rs', rs[6]); + src.file('error.rs', rs[7]); + src.file('macros.rs', rs[8]); + zip.file('Cargo.toml', rs[9]); + zip.generateAsync({ + type:'blob' + }).then((blob) => { + let rsBlob = window.URL.createObjectURL(blob); + genReady.rs = true; + $(aId).href = rsBlob; + $(aId).download = `${parsedPattern.name}.noise.rs.zip`; + autoClick? $(aId).click() : false; + }); + }); + return false; +}; + +let wasmGen = (patternInput, aId, autoClick) => { + let parsedPattern = {}; + if (genReady.wasm) { + return true; + } + try { + parsedPattern = peg$parse(patternInput); + } catch (e) { + alert('Please first ensure that your Noise pattern is valid.'); + return false; + } + getWasm(patternInput, parsedPattern, (wasm) => { + let zip = new JSZip(); + let src = zip.folder('src'); + src.file('lib.rs', wasm[0]); + src.file('types.rs', wasm[1]); + src.file('consts.rs', wasm[2]); + src.file('utils.rs', wasm[3]); + src.file('prims.rs', wasm[4]); + src.file('state.rs', wasm[5]); + src.file('noisesession.rs', wasm[6]); + src.file('error.rs', wasm[7]); + src.file('macros.rs', wasm[8]); + zip.file('Cargo.toml', wasm[9]); + zip.file('Makefile', wasm[10]); + zip.file('README.md', wasm[11]); + zip.generateAsync({ + type:'blob' + }).then((blob) => { + let wasmBlob = window.URL.createObjectURL(blob); + genReady.wasm = true; + $(aId).href = wasmBlob; + $(aId).download = `${parsedPattern.name}.noise.wasm.zip`; + autoClick? $(aId).click() : false; + }); + }); + return false; +}; diff --git a/implementations/go/I1K.noise.go b/implementations/go/I1K.noise.go index 8434c253f..abf2d7a80 100755 --- a/implementations/go/I1K.noise.go +++ b/implementations/go/I1K.noise.go @@ -9,7 +9,7 @@ I1K: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/I1K1.noise.go b/implementations/go/I1K1.noise.go index 52b81af04..24e04bf26 100755 --- a/implementations/go/I1K1.noise.go +++ b/implementations/go/I1K1.noise.go @@ -9,7 +9,7 @@ I1K1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/I1N.noise.go b/implementations/go/I1N.noise.go index 732fb5eb1..392952f25 100755 --- a/implementations/go/I1N.noise.go +++ b/implementations/go/I1N.noise.go @@ -7,7 +7,7 @@ I1N: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/I1X.noise.go b/implementations/go/I1X.noise.go index 7b9765b25..cf955b3e5 100755 --- a/implementations/go/I1X.noise.go +++ b/implementations/go/I1X.noise.go @@ -7,7 +7,7 @@ I1X: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/I1X1.noise.go b/implementations/go/I1X1.noise.go index 14129408f..631ac1652 100755 --- a/implementations/go/I1X1.noise.go +++ b/implementations/go/I1X1.noise.go @@ -7,7 +7,7 @@ I1X1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IK.noise.go b/implementations/go/IK.noise.go index 69397ab1b..e9895d955 100755 --- a/implementations/go/IK.noise.go +++ b/implementations/go/IK.noise.go @@ -8,7 +8,7 @@ IK: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IK1.noise.go b/implementations/go/IK1.noise.go index d99c6be0c..87562d36e 100755 --- a/implementations/go/IK1.noise.go +++ b/implementations/go/IK1.noise.go @@ -9,7 +9,7 @@ IK1: */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IKpsk1.noise.go b/implementations/go/IKpsk1.noise.go index 5113bec50..bc3e8295b 100755 --- a/implementations/go/IKpsk1.noise.go +++ b/implementations/go/IKpsk1.noise.go @@ -8,7 +8,7 @@ IKpsk1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IKpsk2.noise.go b/implementations/go/IKpsk2.noise.go index efe4ffea4..e81d1e188 100755 --- a/implementations/go/IKpsk2.noise.go +++ b/implementations/go/IKpsk2.noise.go @@ -8,7 +8,7 @@ IKpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IN.noise.go b/implementations/go/IN.noise.go index 0c1b08b97..b5a0dd873 100755 --- a/implementations/go/IN.noise.go +++ b/implementations/go/IN.noise.go @@ -6,7 +6,7 @@ IN: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/INpsk1.noise.go b/implementations/go/INpsk1.noise.go index 0b17a2c0c..43b0b622b 100755 --- a/implementations/go/INpsk1.noise.go +++ b/implementations/go/INpsk1.noise.go @@ -6,7 +6,7 @@ INpsk1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/INpsk2.noise.go b/implementations/go/INpsk2.noise.go index b62b99519..51048d14a 100755 --- a/implementations/go/INpsk2.noise.go +++ b/implementations/go/INpsk2.noise.go @@ -6,7 +6,7 @@ INpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IX.noise.go b/implementations/go/IX.noise.go index 8fa2054f1..f3f574adf 100755 --- a/implementations/go/IX.noise.go +++ b/implementations/go/IX.noise.go @@ -6,7 +6,7 @@ IX: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IX1.noise.go b/implementations/go/IX1.noise.go index a56550980..beeca6540 100755 --- a/implementations/go/IX1.noise.go +++ b/implementations/go/IX1.noise.go @@ -7,7 +7,7 @@ IX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/IXpsk2.noise.go b/implementations/go/IXpsk2.noise.go index 855772ee3..82c8e4a29 100755 --- a/implementations/go/IXpsk2.noise.go +++ b/implementations/go/IXpsk2.noise.go @@ -6,7 +6,7 @@ IXpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/K.noise.go b/implementations/go/K.noise.go index 0ab1e17ca..60d342321 100755 --- a/implementations/go/K.noise.go +++ b/implementations/go/K.noise.go @@ -6,7 +6,7 @@ K: -> e, es, ss */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/K1K.noise.go b/implementations/go/K1K.noise.go index be5be643f..8ae9db251 100755 --- a/implementations/go/K1K.noise.go +++ b/implementations/go/K1K.noise.go @@ -10,7 +10,7 @@ K1K: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/K1K1.noise.go b/implementations/go/K1K1.noise.go index e0fd65e1d..4f70ddd45 100755 --- a/implementations/go/K1K1.noise.go +++ b/implementations/go/K1K1.noise.go @@ -10,7 +10,7 @@ K1K1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/K1N.noise.go b/implementations/go/K1N.noise.go index 2677f5e9e..98d4a32bd 100755 --- a/implementations/go/K1N.noise.go +++ b/implementations/go/K1N.noise.go @@ -9,7 +9,7 @@ K1N: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/K1X.noise.go b/implementations/go/K1X.noise.go index 0340596a5..755124c33 100755 --- a/implementations/go/K1X.noise.go +++ b/implementations/go/K1X.noise.go @@ -9,7 +9,7 @@ K1X: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/K1X1.noise.go b/implementations/go/K1X1.noise.go index b7fa92ab3..aab9b651a 100755 --- a/implementations/go/K1X1.noise.go +++ b/implementations/go/K1X1.noise.go @@ -9,7 +9,7 @@ K1X1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KK.noise.go b/implementations/go/KK.noise.go index 2fd8236fe..b9b4a11d6 100755 --- a/implementations/go/KK.noise.go +++ b/implementations/go/KK.noise.go @@ -9,7 +9,7 @@ KK: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KK1.noise.go b/implementations/go/KK1.noise.go index db6e1460a..9c2997ff4 100755 --- a/implementations/go/KK1.noise.go +++ b/implementations/go/KK1.noise.go @@ -9,7 +9,7 @@ KK1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KKpsk0.noise.go b/implementations/go/KKpsk0.noise.go index 471f6f4d4..8454ee2b6 100755 --- a/implementations/go/KKpsk0.noise.go +++ b/implementations/go/KKpsk0.noise.go @@ -9,7 +9,7 @@ KKpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KKpsk2.noise.go b/implementations/go/KKpsk2.noise.go index d95cd8f09..063327d58 100755 --- a/implementations/go/KKpsk2.noise.go +++ b/implementations/go/KKpsk2.noise.go @@ -9,7 +9,7 @@ KKpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KN.noise.go b/implementations/go/KN.noise.go index cb90adcd7..01e0af0a0 100755 --- a/implementations/go/KN.noise.go +++ b/implementations/go/KN.noise.go @@ -8,7 +8,7 @@ KN: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KNpsk0.noise.go b/implementations/go/KNpsk0.noise.go index 0ddcaa5ce..7ebf2758c 100755 --- a/implementations/go/KNpsk0.noise.go +++ b/implementations/go/KNpsk0.noise.go @@ -8,7 +8,7 @@ KNpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KNpsk2.noise.go b/implementations/go/KNpsk2.noise.go index 6ed4339d1..b2a2f5ae0 100755 --- a/implementations/go/KNpsk2.noise.go +++ b/implementations/go/KNpsk2.noise.go @@ -8,7 +8,7 @@ KNpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KX.noise.go b/implementations/go/KX.noise.go index ea7e6d28b..248273a33 100755 --- a/implementations/go/KX.noise.go +++ b/implementations/go/KX.noise.go @@ -8,7 +8,7 @@ KX: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KX1.noise.go b/implementations/go/KX1.noise.go index 83069318e..87f0ed596 100755 --- a/implementations/go/KX1.noise.go +++ b/implementations/go/KX1.noise.go @@ -9,7 +9,7 @@ KX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/KXpsk2.noise.go b/implementations/go/KXpsk2.noise.go index d5c409a21..8be92d0be 100755 --- a/implementations/go/KXpsk2.noise.go +++ b/implementations/go/KXpsk2.noise.go @@ -8,7 +8,7 @@ KXpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/Kpsk0.noise.go b/implementations/go/Kpsk0.noise.go index c9a894e79..f153f1d49 100755 --- a/implementations/go/Kpsk0.noise.go +++ b/implementations/go/Kpsk0.noise.go @@ -6,7 +6,7 @@ Kpsk0: -> psk, e, es, ss */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/N.noise.go b/implementations/go/N.noise.go index 4898dd66c..d69d07321 100755 --- a/implementations/go/N.noise.go +++ b/implementations/go/N.noise.go @@ -5,7 +5,7 @@ N: -> e, es */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NK.noise.go b/implementations/go/NK.noise.go index 8e0ac4ea1..bfae67229 100755 --- a/implementations/go/NK.noise.go +++ b/implementations/go/NK.noise.go @@ -8,7 +8,7 @@ NK: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NK1.noise.go b/implementations/go/NK1.noise.go index 7e89cc66c..c14b29be0 100755 --- a/implementations/go/NK1.noise.go +++ b/implementations/go/NK1.noise.go @@ -8,7 +8,7 @@ NK1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NKpsk0.noise.go b/implementations/go/NKpsk0.noise.go index 53b4bbe80..ce1814876 100755 --- a/implementations/go/NKpsk0.noise.go +++ b/implementations/go/NKpsk0.noise.go @@ -8,7 +8,7 @@ NKpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NKpsk2.noise.go b/implementations/go/NKpsk2.noise.go index 6e7c0f478..0052641f0 100755 --- a/implementations/go/NKpsk2.noise.go +++ b/implementations/go/NKpsk2.noise.go @@ -8,7 +8,7 @@ NKpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NN.noise.go b/implementations/go/NN.noise.go index 3c2fbe4e4..c69cb330e 100755 --- a/implementations/go/NN.noise.go +++ b/implementations/go/NN.noise.go @@ -6,7 +6,7 @@ NN: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NNpsk0.noise.go b/implementations/go/NNpsk0.noise.go index 02082a38a..0a34e5d03 100755 --- a/implementations/go/NNpsk0.noise.go +++ b/implementations/go/NNpsk0.noise.go @@ -6,7 +6,7 @@ NNpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NNpsk2.noise.go b/implementations/go/NNpsk2.noise.go index 6944ff3a2..ff12e0ca4 100755 --- a/implementations/go/NNpsk2.noise.go +++ b/implementations/go/NNpsk2.noise.go @@ -6,7 +6,7 @@ NNpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NX.noise.go b/implementations/go/NX.noise.go index 90b830270..ece301595 100755 --- a/implementations/go/NX.noise.go +++ b/implementations/go/NX.noise.go @@ -6,7 +6,7 @@ NX: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NX1.noise.go b/implementations/go/NX1.noise.go index 477d274b5..71de765c5 100755 --- a/implementations/go/NX1.noise.go +++ b/implementations/go/NX1.noise.go @@ -7,7 +7,7 @@ NX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/NXpsk2.noise.go b/implementations/go/NXpsk2.noise.go index 3afa3879a..56f99dfac 100755 --- a/implementations/go/NXpsk2.noise.go +++ b/implementations/go/NXpsk2.noise.go @@ -6,7 +6,7 @@ NXpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/Npsk0.noise.go b/implementations/go/Npsk0.noise.go index b9b80d6b1..84d9952f4 100755 --- a/implementations/go/Npsk0.noise.go +++ b/implementations/go/Npsk0.noise.go @@ -6,7 +6,7 @@ Npsk0: */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/X.noise.go b/implementations/go/X.noise.go index 75715c58f..5fb735062 100755 --- a/implementations/go/X.noise.go +++ b/implementations/go/X.noise.go @@ -5,7 +5,7 @@ X: -> e, es, s, ss */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/X1K.noise.go b/implementations/go/X1K.noise.go index a4f39de6c..349b42a1f 100755 --- a/implementations/go/X1K.noise.go +++ b/implementations/go/X1K.noise.go @@ -10,7 +10,7 @@ X1K: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/X1K1.noise.go b/implementations/go/X1K1.noise.go index 11f1faf28..7e5156dc0 100755 --- a/implementations/go/X1K1.noise.go +++ b/implementations/go/X1K1.noise.go @@ -10,7 +10,7 @@ X1K1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/X1N.noise.go b/implementations/go/X1N.noise.go index 31b560e2b..96ffe0216 100755 --- a/implementations/go/X1N.noise.go +++ b/implementations/go/X1N.noise.go @@ -8,7 +8,7 @@ X1N: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/X1X.noise.go b/implementations/go/X1X.noise.go index 21ddc2d93..502f7f6e5 100755 --- a/implementations/go/X1X.noise.go +++ b/implementations/go/X1X.noise.go @@ -8,7 +8,7 @@ X1X: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/X1X1.noise.go b/implementations/go/X1X1.noise.go index 0f0cc408c..2a74f8ae7 100755 --- a/implementations/go/X1X1.noise.go +++ b/implementations/go/X1X1.noise.go @@ -8,7 +8,7 @@ X1X1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XK.noise.go b/implementations/go/XK.noise.go index 22cf03008..ec25b11a3 100755 --- a/implementations/go/XK.noise.go +++ b/implementations/go/XK.noise.go @@ -9,7 +9,7 @@ XK: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XK1.noise.go b/implementations/go/XK1.noise.go index beaa6c179..305aada3f 100755 --- a/implementations/go/XK1.noise.go +++ b/implementations/go/XK1.noise.go @@ -9,7 +9,7 @@ XK1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XKpsk3.noise.go b/implementations/go/XKpsk3.noise.go index 716c871fe..0be7350fe 100755 --- a/implementations/go/XKpsk3.noise.go +++ b/implementations/go/XKpsk3.noise.go @@ -9,7 +9,7 @@ XKpsk3: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XN.noise.go b/implementations/go/XN.noise.go index 2ee324458..2cddb8fdf 100755 --- a/implementations/go/XN.noise.go +++ b/implementations/go/XN.noise.go @@ -7,7 +7,7 @@ XN: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XNpsk3.noise.go b/implementations/go/XNpsk3.noise.go index 80e17b4ef..b0f719bc6 100755 --- a/implementations/go/XNpsk3.noise.go +++ b/implementations/go/XNpsk3.noise.go @@ -7,7 +7,7 @@ XNpsk3: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XX.noise.go b/implementations/go/XX.noise.go index 445d6f6b3..73b04f82b 100755 --- a/implementations/go/XX.noise.go +++ b/implementations/go/XX.noise.go @@ -7,7 +7,7 @@ XX: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XX1.noise.go b/implementations/go/XX1.noise.go index e3c62f246..9a80a212a 100755 --- a/implementations/go/XX1.noise.go +++ b/implementations/go/XX1.noise.go @@ -7,7 +7,7 @@ XX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/XXpsk3.noise.go b/implementations/go/XXpsk3.noise.go index 7ea1d0a86..afb69b062 100755 --- a/implementations/go/XXpsk3.noise.go +++ b/implementations/go/XXpsk3.noise.go @@ -7,7 +7,7 @@ XXpsk3: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/Xpsk1.noise.go b/implementations/go/Xpsk1.noise.go index e46a2fa34..0dbb762dd 100755 --- a/implementations/go/Xpsk1.noise.go +++ b/implementations/go/Xpsk1.noise.go @@ -6,7 +6,7 @@ Xpsk1: */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/I1K/I1K.noise.go b/implementations/go/tests/I1K/I1K.noise.go index b183fe146..480cd5443 100755 --- a/implementations/go/tests/I1K/I1K.noise.go +++ b/implementations/go/tests/I1K/I1K.noise.go @@ -9,7 +9,7 @@ I1K: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/I1K1/I1K1.noise.go b/implementations/go/tests/I1K1/I1K1.noise.go index 43192d12f..7def89b64 100755 --- a/implementations/go/tests/I1K1/I1K1.noise.go +++ b/implementations/go/tests/I1K1/I1K1.noise.go @@ -9,7 +9,7 @@ I1K1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/I1N/I1N.noise.go b/implementations/go/tests/I1N/I1N.noise.go index 26a6d06b8..1b5cc82fa 100755 --- a/implementations/go/tests/I1N/I1N.noise.go +++ b/implementations/go/tests/I1N/I1N.noise.go @@ -7,7 +7,7 @@ I1N: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/I1X/I1X.noise.go b/implementations/go/tests/I1X/I1X.noise.go index ea37a6aca..1b005b312 100755 --- a/implementations/go/tests/I1X/I1X.noise.go +++ b/implementations/go/tests/I1X/I1X.noise.go @@ -7,7 +7,7 @@ I1X: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/I1X1/I1X1.noise.go b/implementations/go/tests/I1X1/I1X1.noise.go index 9788647d5..0da4f27a5 100755 --- a/implementations/go/tests/I1X1/I1X1.noise.go +++ b/implementations/go/tests/I1X1/I1X1.noise.go @@ -7,7 +7,7 @@ I1X1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IK/IK.noise.go b/implementations/go/tests/IK/IK.noise.go index 32b4d4df9..cdc179bf2 100755 --- a/implementations/go/tests/IK/IK.noise.go +++ b/implementations/go/tests/IK/IK.noise.go @@ -8,7 +8,7 @@ IK: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IK1/IK1.noise.go b/implementations/go/tests/IK1/IK1.noise.go index d90a0506f..aa680b01e 100755 --- a/implementations/go/tests/IK1/IK1.noise.go +++ b/implementations/go/tests/IK1/IK1.noise.go @@ -9,7 +9,7 @@ IK1: */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IKpsk1/IKpsk1.noise.go b/implementations/go/tests/IKpsk1/IKpsk1.noise.go index 02e7cc92f..6cab43427 100755 --- a/implementations/go/tests/IKpsk1/IKpsk1.noise.go +++ b/implementations/go/tests/IKpsk1/IKpsk1.noise.go @@ -8,7 +8,7 @@ IKpsk1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IKpsk2/IKpsk2.noise.go b/implementations/go/tests/IKpsk2/IKpsk2.noise.go index b88076267..de2e6d317 100755 --- a/implementations/go/tests/IKpsk2/IKpsk2.noise.go +++ b/implementations/go/tests/IKpsk2/IKpsk2.noise.go @@ -8,7 +8,7 @@ IKpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IN/IN.noise.go b/implementations/go/tests/IN/IN.noise.go index 336b7c9c2..fcf6fc88c 100755 --- a/implementations/go/tests/IN/IN.noise.go +++ b/implementations/go/tests/IN/IN.noise.go @@ -6,7 +6,7 @@ IN: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/INpsk1/INpsk1.noise.go b/implementations/go/tests/INpsk1/INpsk1.noise.go index ec5da7516..5bde6d777 100755 --- a/implementations/go/tests/INpsk1/INpsk1.noise.go +++ b/implementations/go/tests/INpsk1/INpsk1.noise.go @@ -6,7 +6,7 @@ INpsk1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/INpsk2/INpsk2.noise.go b/implementations/go/tests/INpsk2/INpsk2.noise.go index eb57b794a..51d0991cd 100755 --- a/implementations/go/tests/INpsk2/INpsk2.noise.go +++ b/implementations/go/tests/INpsk2/INpsk2.noise.go @@ -6,7 +6,7 @@ INpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IX/IX.noise.go b/implementations/go/tests/IX/IX.noise.go index 02e1de33a..bd587ca56 100755 --- a/implementations/go/tests/IX/IX.noise.go +++ b/implementations/go/tests/IX/IX.noise.go @@ -6,7 +6,7 @@ IX: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IX1/IX1.noise.go b/implementations/go/tests/IX1/IX1.noise.go index d1a872f85..992d29af3 100755 --- a/implementations/go/tests/IX1/IX1.noise.go +++ b/implementations/go/tests/IX1/IX1.noise.go @@ -7,7 +7,7 @@ IX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/IXpsk2/IXpsk2.noise.go b/implementations/go/tests/IXpsk2/IXpsk2.noise.go index e236bcecc..8bf7f0c51 100755 --- a/implementations/go/tests/IXpsk2/IXpsk2.noise.go +++ b/implementations/go/tests/IXpsk2/IXpsk2.noise.go @@ -6,7 +6,7 @@ IXpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/K/K.noise.go b/implementations/go/tests/K/K.noise.go index 83f7fec6b..f3938b90c 100755 --- a/implementations/go/tests/K/K.noise.go +++ b/implementations/go/tests/K/K.noise.go @@ -6,7 +6,7 @@ K: -> e, es, ss */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/K1K/K1K.noise.go b/implementations/go/tests/K1K/K1K.noise.go index db91e69c4..d0f7ec491 100755 --- a/implementations/go/tests/K1K/K1K.noise.go +++ b/implementations/go/tests/K1K/K1K.noise.go @@ -10,7 +10,7 @@ K1K: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/K1K1/K1K1.noise.go b/implementations/go/tests/K1K1/K1K1.noise.go index d1695ab0d..84204cf0c 100755 --- a/implementations/go/tests/K1K1/K1K1.noise.go +++ b/implementations/go/tests/K1K1/K1K1.noise.go @@ -10,7 +10,7 @@ K1K1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/K1N/K1N.noise.go b/implementations/go/tests/K1N/K1N.noise.go index 402ccdb5a..fce20f01d 100755 --- a/implementations/go/tests/K1N/K1N.noise.go +++ b/implementations/go/tests/K1N/K1N.noise.go @@ -9,7 +9,7 @@ K1N: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/K1X/K1X.noise.go b/implementations/go/tests/K1X/K1X.noise.go index c78ca2315..ff3b0b0ce 100755 --- a/implementations/go/tests/K1X/K1X.noise.go +++ b/implementations/go/tests/K1X/K1X.noise.go @@ -9,7 +9,7 @@ K1X: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/K1X1/K1X1.noise.go b/implementations/go/tests/K1X1/K1X1.noise.go index fcb404fa2..3d9a37220 100755 --- a/implementations/go/tests/K1X1/K1X1.noise.go +++ b/implementations/go/tests/K1X1/K1X1.noise.go @@ -9,7 +9,7 @@ K1X1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KK/KK.noise.go b/implementations/go/tests/KK/KK.noise.go index c5c0cc24c..e660d712e 100755 --- a/implementations/go/tests/KK/KK.noise.go +++ b/implementations/go/tests/KK/KK.noise.go @@ -9,7 +9,7 @@ KK: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KK1/KK1.noise.go b/implementations/go/tests/KK1/KK1.noise.go index b34e2dbd5..c89c07a81 100755 --- a/implementations/go/tests/KK1/KK1.noise.go +++ b/implementations/go/tests/KK1/KK1.noise.go @@ -9,7 +9,7 @@ KK1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KKpsk0/KKpsk0.noise.go b/implementations/go/tests/KKpsk0/KKpsk0.noise.go index fc505366b..ad0136664 100755 --- a/implementations/go/tests/KKpsk0/KKpsk0.noise.go +++ b/implementations/go/tests/KKpsk0/KKpsk0.noise.go @@ -9,7 +9,7 @@ KKpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KKpsk2/KKpsk2.noise.go b/implementations/go/tests/KKpsk2/KKpsk2.noise.go index 03d018905..d2d529ac8 100755 --- a/implementations/go/tests/KKpsk2/KKpsk2.noise.go +++ b/implementations/go/tests/KKpsk2/KKpsk2.noise.go @@ -9,7 +9,7 @@ KKpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KN/KN.noise.go b/implementations/go/tests/KN/KN.noise.go index a86b5a593..cc400226e 100755 --- a/implementations/go/tests/KN/KN.noise.go +++ b/implementations/go/tests/KN/KN.noise.go @@ -8,7 +8,7 @@ KN: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KNpsk0/KNpsk0.noise.go b/implementations/go/tests/KNpsk0/KNpsk0.noise.go index 6e0d27e7d..507f94533 100755 --- a/implementations/go/tests/KNpsk0/KNpsk0.noise.go +++ b/implementations/go/tests/KNpsk0/KNpsk0.noise.go @@ -8,7 +8,7 @@ KNpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KNpsk2/KNpsk2.noise.go b/implementations/go/tests/KNpsk2/KNpsk2.noise.go index d12138f88..5a80c7ab8 100755 --- a/implementations/go/tests/KNpsk2/KNpsk2.noise.go +++ b/implementations/go/tests/KNpsk2/KNpsk2.noise.go @@ -8,7 +8,7 @@ KNpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KX/KX.noise.go b/implementations/go/tests/KX/KX.noise.go index 33bb1bba5..0a43bcc00 100755 --- a/implementations/go/tests/KX/KX.noise.go +++ b/implementations/go/tests/KX/KX.noise.go @@ -8,7 +8,7 @@ KX: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KX1/KX1.noise.go b/implementations/go/tests/KX1/KX1.noise.go index 24179a9dd..54b88f22e 100755 --- a/implementations/go/tests/KX1/KX1.noise.go +++ b/implementations/go/tests/KX1/KX1.noise.go @@ -9,7 +9,7 @@ KX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/KXpsk2/KXpsk2.noise.go b/implementations/go/tests/KXpsk2/KXpsk2.noise.go index 9b34d283f..f978cd20b 100755 --- a/implementations/go/tests/KXpsk2/KXpsk2.noise.go +++ b/implementations/go/tests/KXpsk2/KXpsk2.noise.go @@ -8,7 +8,7 @@ KXpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/Kpsk0/Kpsk0.noise.go b/implementations/go/tests/Kpsk0/Kpsk0.noise.go index 82444b79f..d21f0f43e 100755 --- a/implementations/go/tests/Kpsk0/Kpsk0.noise.go +++ b/implementations/go/tests/Kpsk0/Kpsk0.noise.go @@ -6,7 +6,7 @@ Kpsk0: -> psk, e, es, ss */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/N/N.noise.go b/implementations/go/tests/N/N.noise.go index 9f61eabbe..d9af285bc 100755 --- a/implementations/go/tests/N/N.noise.go +++ b/implementations/go/tests/N/N.noise.go @@ -5,7 +5,7 @@ N: -> e, es */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NK/NK.noise.go b/implementations/go/tests/NK/NK.noise.go index 9455e3857..9f739c049 100755 --- a/implementations/go/tests/NK/NK.noise.go +++ b/implementations/go/tests/NK/NK.noise.go @@ -8,7 +8,7 @@ NK: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NK1/NK1.noise.go b/implementations/go/tests/NK1/NK1.noise.go index e11399004..3fa1e14d5 100755 --- a/implementations/go/tests/NK1/NK1.noise.go +++ b/implementations/go/tests/NK1/NK1.noise.go @@ -8,7 +8,7 @@ NK1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NKpsk0/NKpsk0.noise.go b/implementations/go/tests/NKpsk0/NKpsk0.noise.go index 20f9dfc3f..722d9cea3 100755 --- a/implementations/go/tests/NKpsk0/NKpsk0.noise.go +++ b/implementations/go/tests/NKpsk0/NKpsk0.noise.go @@ -8,7 +8,7 @@ NKpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NKpsk2/NKpsk2.noise.go b/implementations/go/tests/NKpsk2/NKpsk2.noise.go index 93b9e5df8..29443a06a 100755 --- a/implementations/go/tests/NKpsk2/NKpsk2.noise.go +++ b/implementations/go/tests/NKpsk2/NKpsk2.noise.go @@ -8,7 +8,7 @@ NKpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NN/NN.noise.go b/implementations/go/tests/NN/NN.noise.go index 5babe7db9..74cafe8a3 100755 --- a/implementations/go/tests/NN/NN.noise.go +++ b/implementations/go/tests/NN/NN.noise.go @@ -6,7 +6,7 @@ NN: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NNpsk0/NNpsk0.noise.go b/implementations/go/tests/NNpsk0/NNpsk0.noise.go index 4622ab869..1f798e4c6 100755 --- a/implementations/go/tests/NNpsk0/NNpsk0.noise.go +++ b/implementations/go/tests/NNpsk0/NNpsk0.noise.go @@ -6,7 +6,7 @@ NNpsk0: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NNpsk2/NNpsk2.noise.go b/implementations/go/tests/NNpsk2/NNpsk2.noise.go index 87db7b253..87ac5f2ed 100755 --- a/implementations/go/tests/NNpsk2/NNpsk2.noise.go +++ b/implementations/go/tests/NNpsk2/NNpsk2.noise.go @@ -6,7 +6,7 @@ NNpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NX/NX.noise.go b/implementations/go/tests/NX/NX.noise.go index 065d5cc99..76e20b375 100755 --- a/implementations/go/tests/NX/NX.noise.go +++ b/implementations/go/tests/NX/NX.noise.go @@ -6,7 +6,7 @@ NX: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NX1/NX1.noise.go b/implementations/go/tests/NX1/NX1.noise.go index 16fc4c73d..8ce6cc59e 100755 --- a/implementations/go/tests/NX1/NX1.noise.go +++ b/implementations/go/tests/NX1/NX1.noise.go @@ -7,7 +7,7 @@ NX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/NXpsk2/NXpsk2.noise.go b/implementations/go/tests/NXpsk2/NXpsk2.noise.go index 6bb777e07..dc6012205 100755 --- a/implementations/go/tests/NXpsk2/NXpsk2.noise.go +++ b/implementations/go/tests/NXpsk2/NXpsk2.noise.go @@ -6,7 +6,7 @@ NXpsk2: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/Npsk0/Npsk0.noise.go b/implementations/go/tests/Npsk0/Npsk0.noise.go index 81b83db0e..38f4deaf3 100755 --- a/implementations/go/tests/Npsk0/Npsk0.noise.go +++ b/implementations/go/tests/Npsk0/Npsk0.noise.go @@ -6,7 +6,7 @@ Npsk0: */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/X/X.noise.go b/implementations/go/tests/X/X.noise.go index bc9b6fd70..282c7fe44 100755 --- a/implementations/go/tests/X/X.noise.go +++ b/implementations/go/tests/X/X.noise.go @@ -5,7 +5,7 @@ X: -> e, es, s, ss */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/X1K/X1K.noise.go b/implementations/go/tests/X1K/X1K.noise.go index 833f44fe4..7249bfc29 100755 --- a/implementations/go/tests/X1K/X1K.noise.go +++ b/implementations/go/tests/X1K/X1K.noise.go @@ -10,7 +10,7 @@ X1K: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/X1K1/X1K1.noise.go b/implementations/go/tests/X1K1/X1K1.noise.go index 82f2b025f..aaed91fe9 100755 --- a/implementations/go/tests/X1K1/X1K1.noise.go +++ b/implementations/go/tests/X1K1/X1K1.noise.go @@ -10,7 +10,7 @@ X1K1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/X1N/X1N.noise.go b/implementations/go/tests/X1N/X1N.noise.go index 0f5c0faae..e3f246fb0 100755 --- a/implementations/go/tests/X1N/X1N.noise.go +++ b/implementations/go/tests/X1N/X1N.noise.go @@ -8,7 +8,7 @@ X1N: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/X1X/X1X.noise.go b/implementations/go/tests/X1X/X1X.noise.go index d56a7ecae..9d07a03c7 100755 --- a/implementations/go/tests/X1X/X1X.noise.go +++ b/implementations/go/tests/X1X/X1X.noise.go @@ -8,7 +8,7 @@ X1X: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/X1X1/X1X1.noise.go b/implementations/go/tests/X1X1/X1X1.noise.go index 7aead4cad..f9b476c5c 100755 --- a/implementations/go/tests/X1X1/X1X1.noise.go +++ b/implementations/go/tests/X1X1/X1X1.noise.go @@ -8,7 +8,7 @@ X1X1: <- */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XK/XK.noise.go b/implementations/go/tests/XK/XK.noise.go index fb8fbaf43..31dff1ab9 100755 --- a/implementations/go/tests/XK/XK.noise.go +++ b/implementations/go/tests/XK/XK.noise.go @@ -9,7 +9,7 @@ XK: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XK1/XK1.noise.go b/implementations/go/tests/XK1/XK1.noise.go index 5f1f64991..f5aabc189 100755 --- a/implementations/go/tests/XK1/XK1.noise.go +++ b/implementations/go/tests/XK1/XK1.noise.go @@ -9,7 +9,7 @@ XK1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XKpsk3/XKpsk3.noise.go b/implementations/go/tests/XKpsk3/XKpsk3.noise.go index a78a3f461..71f38fa5a 100755 --- a/implementations/go/tests/XKpsk3/XKpsk3.noise.go +++ b/implementations/go/tests/XKpsk3/XKpsk3.noise.go @@ -9,7 +9,7 @@ XKpsk3: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XN/XN.noise.go b/implementations/go/tests/XN/XN.noise.go index 3fb58d354..4b88752ee 100755 --- a/implementations/go/tests/XN/XN.noise.go +++ b/implementations/go/tests/XN/XN.noise.go @@ -7,7 +7,7 @@ XN: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XNpsk3/XNpsk3.noise.go b/implementations/go/tests/XNpsk3/XNpsk3.noise.go index 475bcb6d5..5c03010c7 100755 --- a/implementations/go/tests/XNpsk3/XNpsk3.noise.go +++ b/implementations/go/tests/XNpsk3/XNpsk3.noise.go @@ -7,7 +7,7 @@ XNpsk3: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XX/XX.noise.go b/implementations/go/tests/XX/XX.noise.go index 8a2c5b7c7..46ad4f8f7 100755 --- a/implementations/go/tests/XX/XX.noise.go +++ b/implementations/go/tests/XX/XX.noise.go @@ -7,7 +7,7 @@ XX: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XX1/XX1.noise.go b/implementations/go/tests/XX1/XX1.noise.go index dc8b11687..d096ce3e1 100755 --- a/implementations/go/tests/XX1/XX1.noise.go +++ b/implementations/go/tests/XX1/XX1.noise.go @@ -7,7 +7,7 @@ XX1: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/XXpsk3/XXpsk3.noise.go b/implementations/go/tests/XXpsk3/XXpsk3.noise.go index 5a7cf9761..5e9072477 100755 --- a/implementations/go/tests/XXpsk3/XXpsk3.noise.go +++ b/implementations/go/tests/XXpsk3/XXpsk3.noise.go @@ -7,7 +7,7 @@ XXpsk3: -> */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/go/tests/Xpsk1/Xpsk1.noise.go b/implementations/go/tests/Xpsk1/Xpsk1.noise.go index d85785933..cd4009d0e 100755 --- a/implementations/go/tests/Xpsk1/Xpsk1.noise.go +++ b/implementations/go/tests/Xpsk1/Xpsk1.noise.go @@ -6,7 +6,7 @@ Xpsk1: */ -// Implementation Version: 1.0.3 +// Implementation Version: 1.0.4 /* ---------------------------------------------------------------- * * PARAMETERS * diff --git a/implementations/rs/Cargo.toml b/implementations/rs/Cargo.toml index 33347ea4a..614c0c5ef 100755 --- a/implementations/rs/Cargo.toml +++ b/implementations/rs/Cargo.toml @@ -1,67 +1,67 @@ [package] name = "noiseexplorer" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" [dependencies] -noiseexplorer_i1k = {version = "1.0.3", path = "./I1K"} -noiseexplorer_i1k1 = {version = "1.0.3", path = "./I1K1"} -noiseexplorer_i1n = {version = "1.0.3", path = "./I1N"} -noiseexplorer_i1x = {version = "1.0.3", path = "./I1X"} -noiseexplorer_i1x1 = {version = "1.0.3", path = "./I1X1"} -noiseexplorer_ik = {version = "1.0.3", path = "./IK"} -noiseexplorer_ik1 = {version = "1.0.3", path = "./IK1"} -noiseexplorer_ikpsk1 = {version = "1.0.3", path = "./IKpsk1"} -noiseexplorer_ikpsk2 = {version = "1.0.3", path = "./IKpsk2"} -noiseexplorer_in = {version = "1.0.3", path = "./IN"} -noiseexplorer_inpsk1 = {version = "1.0.3", path = "./INpsk1"} -noiseexplorer_inpsk2 = {version = "1.0.3", path = "./INpsk2"} -noiseexplorer_ix = {version = "1.0.3", path = "./IX"} -noiseexplorer_ix1 = {version = "1.0.3", path = "./IX1"} -noiseexplorer_ixpsk2 = {version = "1.0.3", path = "./IXpsk2"} -noiseexplorer_k = {version = "1.0.3", path = "./K"} -noiseexplorer_k1k = {version = "1.0.3", path = "./K1K"} -noiseexplorer_k1k1 = {version = "1.0.3", path = "./K1K1"} -noiseexplorer_k1n = {version = "1.0.3", path = "./K1N"} -noiseexplorer_k1x = {version = "1.0.3", path = "./K1X"} -noiseexplorer_k1x1 = {version = "1.0.3", path = "./K1X1"} -noiseexplorer_kk = {version = "1.0.3", path = "./KK"} -noiseexplorer_kk1 = {version = "1.0.3", path = "./KK1"} -noiseexplorer_kkpsk0 = {version = "1.0.3", path = "./KKpsk0"} -noiseexplorer_kkpsk2 = {version = "1.0.3", path = "./KKpsk2"} -noiseexplorer_kn = {version = "1.0.3", path = "./KN"} -noiseexplorer_knpsk0 = {version = "1.0.3", path = "./KNpsk0"} -noiseexplorer_knpsk2 = {version = "1.0.3", path = "./KNpsk2"} -noiseexplorer_kpsk0 = {version = "1.0.3", path = "./Kpsk0"} -noiseexplorer_kx1 = {version = "1.0.3", path = "./KX1"} -noiseexplorer_kxpsk2 = {version = "1.0.3", path = "./KXpsk2"} -noiseexplorer_kx = {version = "1.0.3", path = "./KX"} -noiseexplorer_n = {version = "1.0.3", path = "./N"} -noiseexplorer_npsk0 = {version = "1.0.3", path = "./Npsk0"} -noiseexplorer_nxpsk2 = {version = "1.0.3", path = "./NXpsk2"} -noiseexplorer_nk1 = {version = "1.0.3", path = "./NK1"} -noiseexplorer_nk = {version = "1.0.3", path = "./NK"} -noiseexplorer_nkpsk0 = {version = "1.0.3", path = "./NKpsk0"} -noiseexplorer_nn = {version = "1.0.3", path = "./NN"} -noiseexplorer_nnpsk0 = {version = "1.0.3", path = "./NNpsk0"} -noiseexplorer_nkpsk2 = {version = "1.0.3", path = "./NKpsk2"} -noiseexplorer_nnpsk2 = {version = "1.0.3", path = "./NNpsk2"} -noiseexplorer_nx = {version = "1.0.3", path = "./NX"} -noiseexplorer_nx1 = {version = "1.0.3", path = "./NX1"} -noiseexplorer_x = {version = "1.0.3", path = "./X"} -noiseexplorer_xk = {version = "1.0.3", path = "./XK"} -noiseexplorer_xkpsk3 = {version = "1.0.3", path = "./XKpsk3"} -noiseexplorer_xk1 = {version = "1.0.3", path = "./XK1"} -noiseexplorer_xpsk1 = {version = "1.0.3", path = "./Xpsk1"} -noiseexplorer_xn = {version = "1.0.3", path = "./XN"} -noiseexplorer_xnpsk3 = {version = "1.0.3", path = "./XNpsk3"} -noiseexplorer_xx = {version = "1.0.3", path = "./XX"} -noiseexplorer_xxpsk3 = {version = "1.0.3", path = "./XXpsk3"} -noiseexplorer_xx1 = {version = "1.0.3", path = "./XX1"} -noiseexplorer_x1x1 = {version = "1.0.3", path = "./X1X1"} -noiseexplorer_x1n = {version = "1.0.3", path = "./X1N"} -noiseexplorer_x1k = {version = "1.0.3", path = "./X1K"} -noiseexplorer_x1k1 = {version = "1.0.3", path = "./X1K1"} -noiseexplorer_x1x = {version = "1.0.3", path = "./X1X"} +noiseexplorer_i1k = {version = "1.0.4", path = "./I1K"} +noiseexplorer_i1k1 = {version = "1.0.4", path = "./I1K1"} +noiseexplorer_i1n = {version = "1.0.4", path = "./I1N"} +noiseexplorer_i1x = {version = "1.0.4", path = "./I1X"} +noiseexplorer_i1x1 = {version = "1.0.4", path = "./I1X1"} +noiseexplorer_ik = {version = "1.0.4", path = "./IK"} +noiseexplorer_ik1 = {version = "1.0.4", path = "./IK1"} +noiseexplorer_ikpsk1 = {version = "1.0.4", path = "./IKpsk1"} +noiseexplorer_ikpsk2 = {version = "1.0.4", path = "./IKpsk2"} +noiseexplorer_in = {version = "1.0.4", path = "./IN"} +noiseexplorer_inpsk1 = {version = "1.0.4", path = "./INpsk1"} +noiseexplorer_inpsk2 = {version = "1.0.4", path = "./INpsk2"} +noiseexplorer_ix = {version = "1.0.4", path = "./IX"} +noiseexplorer_ix1 = {version = "1.0.4", path = "./IX1"} +noiseexplorer_ixpsk2 = {version = "1.0.4", path = "./IXpsk2"} +noiseexplorer_k = {version = "1.0.4", path = "./K"} +noiseexplorer_k1k = {version = "1.0.4", path = "./K1K"} +noiseexplorer_k1k1 = {version = "1.0.4", path = "./K1K1"} +noiseexplorer_k1n = {version = "1.0.4", path = "./K1N"} +noiseexplorer_k1x = {version = "1.0.4", path = "./K1X"} +noiseexplorer_k1x1 = {version = "1.0.4", path = "./K1X1"} +noiseexplorer_kk = {version = "1.0.4", path = "./KK"} +noiseexplorer_kk1 = {version = "1.0.4", path = "./KK1"} +noiseexplorer_kkpsk0 = {version = "1.0.4", path = "./KKpsk0"} +noiseexplorer_kkpsk2 = {version = "1.0.4", path = "./KKpsk2"} +noiseexplorer_kn = {version = "1.0.4", path = "./KN"} +noiseexplorer_knpsk0 = {version = "1.0.4", path = "./KNpsk0"} +noiseexplorer_knpsk2 = {version = "1.0.4", path = "./KNpsk2"} +noiseexplorer_kpsk0 = {version = "1.0.4", path = "./Kpsk0"} +noiseexplorer_kx1 = {version = "1.0.4", path = "./KX1"} +noiseexplorer_kxpsk2 = {version = "1.0.4", path = "./KXpsk2"} +noiseexplorer_kx = {version = "1.0.4", path = "./KX"} +noiseexplorer_n = {version = "1.0.4", path = "./N"} +noiseexplorer_npsk0 = {version = "1.0.4", path = "./Npsk0"} +noiseexplorer_nxpsk2 = {version = "1.0.4", path = "./NXpsk2"} +noiseexplorer_nk1 = {version = "1.0.4", path = "./NK1"} +noiseexplorer_nk = {version = "1.0.4", path = "./NK"} +noiseexplorer_nkpsk0 = {version = "1.0.4", path = "./NKpsk0"} +noiseexplorer_nn = {version = "1.0.4", path = "./NN"} +noiseexplorer_nnpsk0 = {version = "1.0.4", path = "./NNpsk0"} +noiseexplorer_nkpsk2 = {version = "1.0.4", path = "./NKpsk2"} +noiseexplorer_nnpsk2 = {version = "1.0.4", path = "./NNpsk2"} +noiseexplorer_nx = {version = "1.0.4", path = "./NX"} +noiseexplorer_nx1 = {version = "1.0.4", path = "./NX1"} +noiseexplorer_x = {version = "1.0.4", path = "./X"} +noiseexplorer_xk = {version = "1.0.4", path = "./XK"} +noiseexplorer_xkpsk3 = {version = "1.0.4", path = "./XKpsk3"} +noiseexplorer_xk1 = {version = "1.0.4", path = "./XK1"} +noiseexplorer_xpsk1 = {version = "1.0.4", path = "./Xpsk1"} +noiseexplorer_xn = {version = "1.0.4", path = "./XN"} +noiseexplorer_xnpsk3 = {version = "1.0.4", path = "./XNpsk3"} +noiseexplorer_xx = {version = "1.0.4", path = "./XX"} +noiseexplorer_xxpsk3 = {version = "1.0.4", path = "./XXpsk3"} +noiseexplorer_xx1 = {version = "1.0.4", path = "./XX1"} +noiseexplorer_x1x1 = {version = "1.0.4", path = "./X1X1"} +noiseexplorer_x1n = {version = "1.0.4", path = "./X1N"} +noiseexplorer_x1k = {version = "1.0.4", path = "./X1K"} +noiseexplorer_x1k1 = {version = "1.0.4", path = "./X1K1"} +noiseexplorer_x1x = {version = "1.0.4", path = "./X1X"} hex = "0.3.2" \ No newline at end of file diff --git a/implementations/rs/I1K/Cargo.toml b/implementations/rs/I1K/Cargo.toml index 9bb3e9a0f..bb8b0898f 100755 --- a/implementations/rs/I1K/Cargo.toml +++ b/implementations/rs/I1K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1k" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/I1K1/Cargo.toml b/implementations/rs/I1K1/Cargo.toml index e6c5adaca..c2fb06c7d 100755 --- a/implementations/rs/I1K1/Cargo.toml +++ b/implementations/rs/I1K1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1k1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/I1N/Cargo.toml b/implementations/rs/I1N/Cargo.toml index f3ccecd1a..a4719b3dd 100755 --- a/implementations/rs/I1N/Cargo.toml +++ b/implementations/rs/I1N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1n" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/I1X/Cargo.toml b/implementations/rs/I1X/Cargo.toml index db8db949b..e31f1f188 100755 --- a/implementations/rs/I1X/Cargo.toml +++ b/implementations/rs/I1X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1x" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/I1X1/Cargo.toml b/implementations/rs/I1X1/Cargo.toml index acd2d9f9f..c608e4a6a 100755 --- a/implementations/rs/I1X1/Cargo.toml +++ b/implementations/rs/I1X1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1x1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IK/Cargo.toml b/implementations/rs/IK/Cargo.toml index a5daad364..b6c635c5b 100755 --- a/implementations/rs/IK/Cargo.toml +++ b/implementations/rs/IK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ik" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IK1/Cargo.toml b/implementations/rs/IK1/Cargo.toml index c35b16229..0d162c9b0 100755 --- a/implementations/rs/IK1/Cargo.toml +++ b/implementations/rs/IK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ik1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IKpsk1/Cargo.toml b/implementations/rs/IKpsk1/Cargo.toml index 369be1257..3154066ec 100755 --- a/implementations/rs/IKpsk1/Cargo.toml +++ b/implementations/rs/IKpsk1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ikpsk1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IKpsk2/Cargo.toml b/implementations/rs/IKpsk2/Cargo.toml index 75d6598e6..420a15d11 100755 --- a/implementations/rs/IKpsk2/Cargo.toml +++ b/implementations/rs/IKpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ikpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IN/Cargo.toml b/implementations/rs/IN/Cargo.toml index fbc7c88f3..d627ee85f 100755 --- a/implementations/rs/IN/Cargo.toml +++ b/implementations/rs/IN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_in" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/INpsk1/Cargo.toml b/implementations/rs/INpsk1/Cargo.toml index bd8e08cc4..5f2eeb918 100755 --- a/implementations/rs/INpsk1/Cargo.toml +++ b/implementations/rs/INpsk1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_inpsk1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/INpsk2/Cargo.toml b/implementations/rs/INpsk2/Cargo.toml index ae29d3b45..ae806449c 100755 --- a/implementations/rs/INpsk2/Cargo.toml +++ b/implementations/rs/INpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_inpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IX/Cargo.toml b/implementations/rs/IX/Cargo.toml index 2926cff88..c51d21325 100755 --- a/implementations/rs/IX/Cargo.toml +++ b/implementations/rs/IX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ix" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IX1/Cargo.toml b/implementations/rs/IX1/Cargo.toml index 27d0d7fa3..15c6d484f 100755 --- a/implementations/rs/IX1/Cargo.toml +++ b/implementations/rs/IX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ix1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/IXpsk2/Cargo.toml b/implementations/rs/IXpsk2/Cargo.toml index 4ba1b217f..ce7dfd13a 100755 --- a/implementations/rs/IXpsk2/Cargo.toml +++ b/implementations/rs/IXpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ixpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/K/Cargo.toml b/implementations/rs/K/Cargo.toml index 74bf39aae..29c39bcc1 100755 --- a/implementations/rs/K/Cargo.toml +++ b/implementations/rs/K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/K1K/Cargo.toml b/implementations/rs/K1K/Cargo.toml index b9035845f..4d3bf313b 100755 --- a/implementations/rs/K1K/Cargo.toml +++ b/implementations/rs/K1K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1k" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/K1K1/Cargo.toml b/implementations/rs/K1K1/Cargo.toml index c834a6a41..e92a45db7 100755 --- a/implementations/rs/K1K1/Cargo.toml +++ b/implementations/rs/K1K1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1k1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/K1N/Cargo.toml b/implementations/rs/K1N/Cargo.toml index 9ac6112ef..52e5ded52 100755 --- a/implementations/rs/K1N/Cargo.toml +++ b/implementations/rs/K1N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1n" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/K1X/Cargo.toml b/implementations/rs/K1X/Cargo.toml index 53ef54c4c..ca9cf6974 100755 --- a/implementations/rs/K1X/Cargo.toml +++ b/implementations/rs/K1X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1x" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/K1X1/Cargo.toml b/implementations/rs/K1X1/Cargo.toml index c4ed36fc3..1d79b74d4 100755 --- a/implementations/rs/K1X1/Cargo.toml +++ b/implementations/rs/K1X1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1x1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KK/Cargo.toml b/implementations/rs/KK/Cargo.toml index 4ac702bd7..2b11c2d66 100755 --- a/implementations/rs/KK/Cargo.toml +++ b/implementations/rs/KK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kk" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KK1/Cargo.toml b/implementations/rs/KK1/Cargo.toml index 1998ede3a..d6663988d 100755 --- a/implementations/rs/KK1/Cargo.toml +++ b/implementations/rs/KK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kk1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KKpsk0/Cargo.toml b/implementations/rs/KKpsk0/Cargo.toml index d5ef67d90..9bf5617c1 100755 --- a/implementations/rs/KKpsk0/Cargo.toml +++ b/implementations/rs/KKpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kkpsk0" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KKpsk2/Cargo.toml b/implementations/rs/KKpsk2/Cargo.toml index 083cf9d9a..913ebb109 100755 --- a/implementations/rs/KKpsk2/Cargo.toml +++ b/implementations/rs/KKpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kkpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KN/Cargo.toml b/implementations/rs/KN/Cargo.toml index b2ccbfee7..6df392344 100755 --- a/implementations/rs/KN/Cargo.toml +++ b/implementations/rs/KN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kn" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KNpsk0/Cargo.toml b/implementations/rs/KNpsk0/Cargo.toml index 39cfac2fb..3850541cf 100755 --- a/implementations/rs/KNpsk0/Cargo.toml +++ b/implementations/rs/KNpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_knpsk0" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KNpsk2/Cargo.toml b/implementations/rs/KNpsk2/Cargo.toml index 9badf9128..f9e473619 100755 --- a/implementations/rs/KNpsk2/Cargo.toml +++ b/implementations/rs/KNpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_knpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KX/Cargo.toml b/implementations/rs/KX/Cargo.toml index 98dc2375f..bdbda6b6c 100755 --- a/implementations/rs/KX/Cargo.toml +++ b/implementations/rs/KX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kx" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KX1/Cargo.toml b/implementations/rs/KX1/Cargo.toml index ffe77bbb2..5091f567c 100755 --- a/implementations/rs/KX1/Cargo.toml +++ b/implementations/rs/KX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kx1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/KXpsk2/Cargo.toml b/implementations/rs/KXpsk2/Cargo.toml index 3f1c12e6e..212e92e69 100755 --- a/implementations/rs/KXpsk2/Cargo.toml +++ b/implementations/rs/KXpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kxpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/Kpsk0/Cargo.toml b/implementations/rs/Kpsk0/Cargo.toml index 856eecc2f..e7d49f44e 100755 --- a/implementations/rs/Kpsk0/Cargo.toml +++ b/implementations/rs/Kpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kpsk0" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/N/Cargo.toml b/implementations/rs/N/Cargo.toml index 752837db8..48d5a92c5 100755 --- a/implementations/rs/N/Cargo.toml +++ b/implementations/rs/N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_n" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NK/Cargo.toml b/implementations/rs/NK/Cargo.toml index 783ded3af..64a577926 100755 --- a/implementations/rs/NK/Cargo.toml +++ b/implementations/rs/NK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nk" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NK1/Cargo.toml b/implementations/rs/NK1/Cargo.toml index 4d12fbdef..270aa4d19 100755 --- a/implementations/rs/NK1/Cargo.toml +++ b/implementations/rs/NK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nk1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NKpsk0/Cargo.toml b/implementations/rs/NKpsk0/Cargo.toml index 31cbb10ee..b26962434 100755 --- a/implementations/rs/NKpsk0/Cargo.toml +++ b/implementations/rs/NKpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nkpsk0" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NKpsk2/Cargo.toml b/implementations/rs/NKpsk2/Cargo.toml index e96e3ace7..8d4be41f5 100755 --- a/implementations/rs/NKpsk2/Cargo.toml +++ b/implementations/rs/NKpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nkpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NN/Cargo.toml b/implementations/rs/NN/Cargo.toml index f8b4a34c6..962c5bb39 100755 --- a/implementations/rs/NN/Cargo.toml +++ b/implementations/rs/NN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nn" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NNpsk0/Cargo.toml b/implementations/rs/NNpsk0/Cargo.toml index b107085fc..71c48b35c 100755 --- a/implementations/rs/NNpsk0/Cargo.toml +++ b/implementations/rs/NNpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nnpsk0" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NNpsk2/Cargo.toml b/implementations/rs/NNpsk2/Cargo.toml index 428caa083..2c570d40a 100755 --- a/implementations/rs/NNpsk2/Cargo.toml +++ b/implementations/rs/NNpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nnpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NX/Cargo.toml b/implementations/rs/NX/Cargo.toml index 2b095ab5f..195753877 100755 --- a/implementations/rs/NX/Cargo.toml +++ b/implementations/rs/NX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nx" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NX1/Cargo.toml b/implementations/rs/NX1/Cargo.toml index 648a641eb..a4c7fc90e 100755 --- a/implementations/rs/NX1/Cargo.toml +++ b/implementations/rs/NX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nx1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/NXpsk2/Cargo.toml b/implementations/rs/NXpsk2/Cargo.toml index 75db380b8..7fe809256 100755 --- a/implementations/rs/NXpsk2/Cargo.toml +++ b/implementations/rs/NXpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nxpsk2" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/Npsk0/Cargo.toml b/implementations/rs/Npsk0/Cargo.toml index 1c9600a83..86e3daee1 100755 --- a/implementations/rs/Npsk0/Cargo.toml +++ b/implementations/rs/Npsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_npsk0" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/X/Cargo.toml b/implementations/rs/X/Cargo.toml index cd78d2121..46c891e99 100755 --- a/implementations/rs/X/Cargo.toml +++ b/implementations/rs/X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/X1K/Cargo.toml b/implementations/rs/X1K/Cargo.toml index 62660f08d..169fe5127 100755 --- a/implementations/rs/X1K/Cargo.toml +++ b/implementations/rs/X1K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1k" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/X1K1/Cargo.toml b/implementations/rs/X1K1/Cargo.toml index b8ac71961..46a891054 100755 --- a/implementations/rs/X1K1/Cargo.toml +++ b/implementations/rs/X1K1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1k1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/X1N/Cargo.toml b/implementations/rs/X1N/Cargo.toml index 5ae5a0d5d..ee9d789d0 100755 --- a/implementations/rs/X1N/Cargo.toml +++ b/implementations/rs/X1N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1n" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/X1X/Cargo.toml b/implementations/rs/X1X/Cargo.toml index aebb8f246..30d0f34d0 100755 --- a/implementations/rs/X1X/Cargo.toml +++ b/implementations/rs/X1X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1x" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/X1X1/Cargo.toml b/implementations/rs/X1X1/Cargo.toml index d762c2a12..28566877c 100755 --- a/implementations/rs/X1X1/Cargo.toml +++ b/implementations/rs/X1X1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1x1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XK/Cargo.toml b/implementations/rs/XK/Cargo.toml index 97f8c4559..4adc18c6c 100755 --- a/implementations/rs/XK/Cargo.toml +++ b/implementations/rs/XK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xk" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XK1/Cargo.toml b/implementations/rs/XK1/Cargo.toml index 89d505834..03f9687c5 100755 --- a/implementations/rs/XK1/Cargo.toml +++ b/implementations/rs/XK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xk1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XKpsk3/Cargo.toml b/implementations/rs/XKpsk3/Cargo.toml index d9f7724d4..83913e667 100755 --- a/implementations/rs/XKpsk3/Cargo.toml +++ b/implementations/rs/XKpsk3/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xkpsk3" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XN/Cargo.toml b/implementations/rs/XN/Cargo.toml index 5d9ceeb3b..4174c982d 100755 --- a/implementations/rs/XN/Cargo.toml +++ b/implementations/rs/XN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xn" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XNpsk3/Cargo.toml b/implementations/rs/XNpsk3/Cargo.toml index e1e0df400..ce3119ec5 100755 --- a/implementations/rs/XNpsk3/Cargo.toml +++ b/implementations/rs/XNpsk3/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xnpsk3" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XX/Cargo.toml b/implementations/rs/XX/Cargo.toml index fb7d625e3..36417d501 100755 --- a/implementations/rs/XX/Cargo.toml +++ b/implementations/rs/XX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xx" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XX1/Cargo.toml b/implementations/rs/XX1/Cargo.toml index a9d3d497f..b167d9aa1 100755 --- a/implementations/rs/XX1/Cargo.toml +++ b/implementations/rs/XX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xx1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/XXpsk3/Cargo.toml b/implementations/rs/XXpsk3/Cargo.toml index ddcb3b389..97a01eb9b 100755 --- a/implementations/rs/XXpsk3/Cargo.toml +++ b/implementations/rs/XXpsk3/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xxpsk3" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/rs/Xpsk1/Cargo.toml b/implementations/rs/Xpsk1/Cargo.toml index a4f499ddc..196d59c15 100755 --- a/implementations/rs/Xpsk1/Cargo.toml +++ b/implementations/rs/Xpsk1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xpsk1" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" diff --git a/implementations/wasm/I1K/Cargo.toml b/implementations/wasm/I1K/Cargo.toml index dc66543cd..c111ff521 100755 --- a/implementations/wasm/I1K/Cargo.toml +++ b/implementations/wasm/I1K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1k_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/I1K/README.md b/implementations/wasm/I1K/README.md index a3b4add88..ac7d1752a 100755 --- a/implementations/wasm/I1K/README.md +++ b/implementations/wasm/I1K/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1k_wasm (v1.0.3) +# noiseexplorer_i1k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1K/pkg/README.md b/implementations/wasm/I1K/pkg/README.md index 6c579e064..ac7d1752a 100755 --- a/implementations/wasm/I1K/pkg/README.md +++ b/implementations/wasm/I1K/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1k_wasm (v1.0.1) +# noiseexplorer_i1k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1K/pkg/noiseexplorer_i1k_bg.wasm b/implementations/wasm/I1K/pkg/noiseexplorer_i1k_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV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FJhV*|N5s?M|T9Ovi)meEvuHO5w{j7`p;l z!GorHs*r1VYItalJ`~qFo+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.d.ts b/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.d.ts +++ b/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.js b/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.js index 6ab2dddcb..4db1e2af7 100755 --- a/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.js +++ b/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_i1k_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm_bg.wasm b/implementations/wasm/I1K/pkg/noiseexplorer_i1k_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2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bL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_i1k_wasm_bg.wasm", "noiseexplorer_i1k_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_i1k_wasm.js", "types": "noiseexplorer_i1k_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/I1K1/Cargo.toml b/implementations/wasm/I1K1/Cargo.toml index 3b394a62c..4a4c3153f 100755 --- a/implementations/wasm/I1K1/Cargo.toml +++ b/implementations/wasm/I1K1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1k1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/I1K1/README.md b/implementations/wasm/I1K1/README.md index 49d33b357..94d5d2c1b 100755 --- a/implementations/wasm/I1K1/README.md +++ b/implementations/wasm/I1K1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1k1_wasm (v1.0.3) +# noiseexplorer_i1k1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1K1/pkg/README.md b/implementations/wasm/I1K1/pkg/README.md index 2578b63ac..94d5d2c1b 100755 --- a/implementations/wasm/I1K1/pkg/README.md +++ b/implementations/wasm/I1K1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1k1_wasm (v1.0.0) +# noiseexplorer_i1k1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_bg.wasm b/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZ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asm.d.ts +++ b/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm.js b/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm.js index 6ab2dddcb..de2d94c74 100755 --- a/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm.js +++ b/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_i1k1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm_bg.wasm b/implementations/wasm/I1K1/pkg/noiseexplorer_i1k1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!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$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_i1k1_wasm_bg.wasm", "noiseexplorer_i1k1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_i1k1_wasm.js", "types": "noiseexplorer_i1k1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/I1N/Cargo.toml b/implementations/wasm/I1N/Cargo.toml index 577f50bba..279376ced 100755 --- a/implementations/wasm/I1N/Cargo.toml +++ b/implementations/wasm/I1N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1n_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/I1N/README.md b/implementations/wasm/I1N/README.md index 9b4e75947..20fba2fec 100755 --- a/implementations/wasm/I1N/README.md +++ b/implementations/wasm/I1N/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1n_wasm (v1.0.3) +# noiseexplorer_i1n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1N/pkg/README.md b/implementations/wasm/I1N/pkg/README.md index aa70f9d50..20fba2fec 100755 --- a/implementations/wasm/I1N/pkg/README.md +++ b/implementations/wasm/I1N/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1n_wasm (v1.0.0) +# noiseexplorer_i1n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1N/pkg/noiseexplorer_i1n_bg.wasm b/implementations/wasm/I1N/pkg/noiseexplorer_i1n_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#y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100755 --- a/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm.d.ts +++ b/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm.js b/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm.js index 6ab2dddcb..63e5a3042 100755 --- a/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm.js +++ b/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_i1n_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm_bg.wasm b/implementations/wasm/I1N/pkg/noiseexplorer_i1n_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~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w{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_i1n_wasm_bg.wasm", "noiseexplorer_i1n_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_i1n_wasm.js", "types": "noiseexplorer_i1n_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/I1X/Cargo.toml b/implementations/wasm/I1X/Cargo.toml index c7b7634a8..50a47572c 100755 --- a/implementations/wasm/I1X/Cargo.toml +++ b/implementations/wasm/I1X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1x_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/I1X/README.md b/implementations/wasm/I1X/README.md index a6ac2598e..d39cf28db 100755 --- a/implementations/wasm/I1X/README.md +++ b/implementations/wasm/I1X/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1x_wasm (v1.0.3) +# noiseexplorer_i1x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1X/pkg/README.md b/implementations/wasm/I1X/pkg/README.md index f0802e88d..d39cf28db 100755 --- a/implementations/wasm/I1X/pkg/README.md +++ b/implementations/wasm/I1X/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1x_wasm (v1.0.0) +# noiseexplorer_i1x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1X/pkg/noiseexplorer_i1x_bg.wasm b/implementations/wasm/I1X/pkg/noiseexplorer_i1x_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC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ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm.d.ts +++ b/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm.js b/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm.js index 6ab2dddcb..4070979ae 100755 --- a/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm.js +++ b/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_i1x_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm_bg.wasm b/implementations/wasm/I1X/pkg/noiseexplorer_i1x_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk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x zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_i1x_wasm_bg.wasm", "noiseexplorer_i1x_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_i1x_wasm.js", "types": "noiseexplorer_i1x_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/I1X1/Cargo.toml b/implementations/wasm/I1X1/Cargo.toml index 03e908c61..33ac39248 100755 --- a/implementations/wasm/I1X1/Cargo.toml +++ b/implementations/wasm/I1X1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_i1x1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/I1X1/README.md b/implementations/wasm/I1X1/README.md index 071e63838..893665ecb 100755 --- a/implementations/wasm/I1X1/README.md +++ b/implementations/wasm/I1X1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1x1_wasm (v1.0.3) +# noiseexplorer_i1x1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1X1/pkg/README.md b/implementations/wasm/I1X1/pkg/README.md index 1c195adc9..893665ecb 100755 --- a/implementations/wasm/I1X1/pkg/README.md +++ b/implementations/wasm/I1X1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_i1x1_wasm (v1.0.0) +# noiseexplorer_i1x1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_bg.wasm b/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3P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/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.d.ts +++ b/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.js b/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.js index 6ab2dddcb..1eb1216bd 100755 --- a/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.js +++ b/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_i1x1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm_bg.wasm b/implementations/wasm/I1X1/pkg/noiseexplorer_i1x1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJ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ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_i1x1_wasm_bg.wasm", "noiseexplorer_i1x1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_i1x1_wasm.js", "types": "noiseexplorer_i1x1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IK/Cargo.toml b/implementations/wasm/IK/Cargo.toml index 50818c345..f34e66113 100755 --- a/implementations/wasm/IK/Cargo.toml +++ b/implementations/wasm/IK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ik_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IK/README.md b/implementations/wasm/IK/README.md index 3d1ed38f6..f51831459 100755 --- a/implementations/wasm/IK/README.md +++ b/implementations/wasm/IK/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ik_wasm (v1.0.3) +# noiseexplorer_ik_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IK/pkg/README.md b/implementations/wasm/IK/pkg/README.md index 46b6ef844..f51831459 100755 --- a/implementations/wasm/IK/pkg/README.md +++ b/implementations/wasm/IK/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ik_wasm (v1.0.0) +# noiseexplorer_ik_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IK/pkg/noiseexplorer_ik_bg.wasm b/implementations/wasm/IK/pkg/noiseexplorer_ik_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}w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plorer_ik_wasm.d.ts b/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm.d.ts +++ b/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm.js b/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm.js index 6ab2dddcb..d9ee1b99c 100755 --- a/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm.js +++ b/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_ik_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm_bg.wasm b/implementations/wasm/IK/pkg/noiseexplorer_ik_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%W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O_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_ik_wasm_bg.wasm", "noiseexplorer_ik_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_ik_wasm.js", "types": "noiseexplorer_ik_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IK1/Cargo.toml b/implementations/wasm/IK1/Cargo.toml index be209884d..66d61e15c 100755 --- a/implementations/wasm/IK1/Cargo.toml +++ b/implementations/wasm/IK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ik1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IK1/README.md b/implementations/wasm/IK1/README.md index 33d5417fb..3bf569aa4 100755 --- a/implementations/wasm/IK1/README.md +++ b/implementations/wasm/IK1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ik1_wasm (v1.0.3) +# noiseexplorer_ik1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IK1/pkg/README.md b/implementations/wasm/IK1/pkg/README.md index 460b7fe3b..3bf569aa4 100755 --- a/implementations/wasm/IK1/pkg/README.md +++ b/implementations/wasm/IK1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ik1_wasm (v1.0.0) +# noiseexplorer_ik1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IK1/pkg/noiseexplorer_ik1_bg.wasm b/implementations/wasm/IK1/pkg/noiseexplorer_ik1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0r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er_ik1_wasm.d.ts b/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm.d.ts +++ b/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm.js b/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm.js index 6ab2dddcb..a0173195d 100755 --- a/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm.js +++ b/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_ik1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm_bg.wasm b/implementations/wasm/IK1/pkg/noiseexplorer_ik1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfv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YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_ik1_wasm_bg.wasm", "noiseexplorer_ik1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_ik1_wasm.js", "types": "noiseexplorer_ik1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IKpsk1/Cargo.toml b/implementations/wasm/IKpsk1/Cargo.toml index 5a298da6c..5b1214716 100755 --- a/implementations/wasm/IKpsk1/Cargo.toml +++ b/implementations/wasm/IKpsk1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ikpsk1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IKpsk1/README.md b/implementations/wasm/IKpsk1/README.md index 5fbd21c19..17ac6d65d 100755 --- a/implementations/wasm/IKpsk1/README.md +++ b/implementations/wasm/IKpsk1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ikpsk1_wasm (v1.0.3) +# noiseexplorer_ikpsk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IKpsk1/pkg/README.md b/implementations/wasm/IKpsk1/pkg/README.md index 7af75f392..17ac6d65d 100755 --- a/implementations/wasm/IKpsk1/pkg/README.md +++ b/implementations/wasm/IKpsk1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ikpsk1_wasm (v1.0.0) +# noiseexplorer_ikpsk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_bg.wasm b/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx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5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.d.ts b/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.d.ts +++ b/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.js b/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.js index 6ab2dddcb..7fb8e2b0d 100755 --- a/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.js +++ b/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_ikpsk1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm_bg.wasm b/implementations/wasm/IKpsk1/pkg/noiseexplorer_ikpsk1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)d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5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_ikpsk1_wasm_bg.wasm", "noiseexplorer_ikpsk1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_ikpsk1_wasm.js", "types": "noiseexplorer_ikpsk1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IKpsk2/Cargo.toml b/implementations/wasm/IKpsk2/Cargo.toml index f228935da..a6b160994 100755 --- a/implementations/wasm/IKpsk2/Cargo.toml +++ b/implementations/wasm/IKpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ikpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IKpsk2/README.md b/implementations/wasm/IKpsk2/README.md index 20c630411..bac2ca7da 100755 --- a/implementations/wasm/IKpsk2/README.md +++ b/implementations/wasm/IKpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ikpsk2_wasm (v1.0.3) +# noiseexplorer_ikpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IKpsk2/pkg/README.md b/implementations/wasm/IKpsk2/pkg/README.md index 56b7e357a..bac2ca7da 100755 --- a/implementations/wasm/IKpsk2/pkg/README.md +++ b/implementations/wasm/IKpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ikpsk2_wasm (v1.0.0) +# noiseexplorer_ikpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_bg.wasm b/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_bg.wasm old mode 100755 new mode 100644 index 35b67602c22ee2782588c0c92e87103482a8d6b0..c835481c8fd41b4dd1a389e5dc18336c80f6af69 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9NonE|bqkjpQ(2@W7}+ye)Y=72aM!GR;kJuLhIT#yLA*KN;40t6DVs$W(0tM`7t z_fcsU6&IW_#&^VtxV~m5{F;efuC0cX?(y+zn9fF%WOiJh=GlrdP1iVQ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zxY=qj9sA{1^zdg!PdW>K`;$k|Y$>|_?$2>4;@%-;{b6G|pG?G2o=wZN5J%B$mL{Ui zMKPb1MHvpAnbvz_fYDn|KEk&ZH8xwkVb;+;`e?#~C? zaelaErg7|9y`Dk8D>-F%wviIZqDPbpA1 zjq@Vi$)!5{?<+0#8tl9e`4Z$0V3?$ihV)DS#K{KQ3ux4*xGtkD4I+X(-YKF*|0IoJ zGLDX-I4kdo{3I=glYH?H*nScEpF+M2`FDUMd{@xuLs-6qhF^r~smSLg6~!Q*Pm|fM zDECvOZ7Q;v5CcrnbESw8#vI;a5bSM8viJY;aSA)c$8R84`B)`yh98RQ&S9Patn4oX znw3#e&O}sJk*0{B9@yVt>&vkD86@%e7szXnbtI5@Fis7_Fb&JF4aaZ|&+v`F=$VFT znwDvsj_I17>6?Msvkc3$EX%eW%e6eqw*sqY8@6d%wrxAMYkRhD2X@af9MiEJ+i@J% z@f_a?oStjArfa#j>$tA#xxO2?J126D{An5fFVh`?nFx|tl9){S3nydHp SmFk`r-N+oqmTwHLoBsr7YXjK; diff --git a/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.d.ts b/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.d.ts +++ b/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.js b/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.js index 6ab2dddcb..73dc64b12 100755 --- a/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.js +++ b/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_ikpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm_bg.wasm b/implementations/wasm/IKpsk2/pkg/noiseexplorer_ikpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2xN@njskw5LCcel(FgQ8ZV#>~|cznVi{a0zJ1UnZ? z#JB{3l*@GBWC2b99M}93oT$K+_6u+*8t#p^f~i}tZ_6TBxOiZ?!R$&yX4yFXpP}!7ZgXI|&sdaw2&b>gK#$S-b-&g^Ti}U4 z##3rEx?e+c4gw1`^fhi9IFe+bXSi5XCdzu$ybs%oR$jj02COgALDztT`XEUjqY^74 zgfrbm@&Nq>1>onxC|A6-lZTDPP$Kj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ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_ikpsk2_wasm_bg.wasm", "noiseexplorer_ikpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_ikpsk2_wasm.js", "types": "noiseexplorer_ikpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IN/Cargo.toml b/implementations/wasm/IN/Cargo.toml index 0253d47dd..30097d356 100755 --- a/implementations/wasm/IN/Cargo.toml +++ b/implementations/wasm/IN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_in_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IN/README.md b/implementations/wasm/IN/README.md index 3899a4f77..c5930362e 100755 --- a/implementations/wasm/IN/README.md +++ b/implementations/wasm/IN/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_in_wasm (v1.0.3) +# noiseexplorer_in_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IN/pkg/README.md b/implementations/wasm/IN/pkg/README.md index d5d2278b0..c5930362e 100755 --- a/implementations/wasm/IN/pkg/README.md +++ b/implementations/wasm/IN/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_in_wasm (v1.0.0) +# noiseexplorer_in_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IN/pkg/noiseexplorer_in_bg.wasm b/implementations/wasm/IN/pkg/noiseexplorer_in_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1mrR7m}tK+{)sfg)Yhh{aR&C9Ddde*LMu0;9Nm zrax7`t>c#Bu=5H8Ed~ReYsH>>I028VLA!hbo#XmyEJFL}Ge_UOLEuBb?dtC9;9>OCf1|@a-Sb`A{ z@9zM76<7_d3YNb9EwDRP+(63yOBLbbU#btMYsTHB4oHDuT0|KX@C8ar2~s!MAfmh? zL)8YT>HE|Q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z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.d.ts b/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.d.ts +++ b/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.js b/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.js index 6ab2dddcb..dc44a6b18 100755 --- a/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.js +++ b/implementations/wasm/IN/pkg/noiseexplorer_in_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_in_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IN/pkg/noiseexplorer_in_wasm_bg.wasm b/implementations/wasm/IN/pkg/noiseexplorer_in_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw zv@6L480&t67MM1*EcElQUJ`u3_z(y!?du!L+LnO%pqVIOASD_G8{(8Z(l5S!Sw3K< zpEBId*%*gw4Aa_`>n!pE36CZLpkd>6BnZR|lz@YQCW?`PBXjJ2A-uW%;p>+$2QT)4 zevWmkhJ=wUxM{)9wzOLozld`MwHr#bYRFL}OiF`XSO3KTueOu}@zvJjCda6|n z2pBhnBHvwe{W`h+D!CsLK!OKbKSe4wL((FvRwWbey9VhS;%gA=l|(-oyQ@aSCvrW~ z&z=EA(_bOCLHbAD{7JlHeGUZu?^jVRd?C6%2q5;a1y<4$W#O=n7=tLri`1!2wzkGd zKq_ciz$js*e?zv=;1XkYprWnAhSa}6&es743XJ)-XS+)3XYw=Vz%MIKd*(uru&$ex z!-e1|o6FBu4ws*F_0P;GKM)94F10l^SB}!e7a0f!C&yY$*?AR@Pxzz%C@qy>=VFN% zmmrXGnGT#RzzKlknqPtw6}ZxV0S-mOz45=`P;bie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w)vV6%qkl zFSN;`3nV!(V3hnsqO0VGR8R8+dL7vonb#i;MD-;3Ihw>n*NwX-g&rnRspB~cdF^2A zDcj^kILFd)c+IoaoiIF+<_Lpg^9eM=Majg=NrtY+ENO*y29_KoR?- zQ*)B$WY$2g`;*}6h^V0ssY6e0Wth2^Ls`w~>1omqo_R~lwx@Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_in_wasm_bg.wasm", "noiseexplorer_in_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_in_wasm.js", "types": "noiseexplorer_in_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/INpsk1/Cargo.toml b/implementations/wasm/INpsk1/Cargo.toml index 032ea136d..3e0ffaeb2 100755 --- a/implementations/wasm/INpsk1/Cargo.toml +++ b/implementations/wasm/INpsk1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_inpsk1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/INpsk1/README.md b/implementations/wasm/INpsk1/README.md index 76f9e63ac..fdd798aea 100755 --- a/implementations/wasm/INpsk1/README.md +++ b/implementations/wasm/INpsk1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_inpsk1_wasm (v1.0.3) +# noiseexplorer_inpsk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/INpsk1/pkg/README.md b/implementations/wasm/INpsk1/pkg/README.md index b9f1e3c76..fdd798aea 100755 --- a/implementations/wasm/INpsk1/pkg/README.md +++ b/implementations/wasm/INpsk1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_inpsk1_wasm (v1.0.0) +# noiseexplorer_inpsk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_bg.wasm b/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1mrR7m}tK+{)sfg)Yhh{aR&C9Ddde*LMu0;9Nm zrax7`t>c#Bu=5H8Ed~ReYsH>>I028VLA!hbo#XmyEJFL}Ge_UOLEuBb?dtC9;9>OCf1|@a-Sb`A{ z@9zM76<7_d3YNb9EwDRP+(63yOBLbbU#btMYsTHB4oHDuT0|KX@C8ar2~s!MAfmh? zL)8YT>HE|Qpo<}tR;piuLa6qdN=O@*qBKAhY88N{M}>cz1?WgF@FYQ_xiHXA>M?45 zdwaVH-hUm_Z%8&V*x3TDgClmPc$rfGtYv^GkHC`k6H#|j&CYe>8hY)xak=VL1I~5O zQKC^0NlzeWyW<4}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!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.d.ts b/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.d.ts +++ b/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.js b/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.js index 6ab2dddcb..599ff01a8 100755 --- a/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.js +++ b/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_inpsk1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm_bg.wasm b/implementations/wasm/INpsk1/pkg/noiseexplorer_inpsk1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw zv@6L480&t67MM1*EcElQUJ`u3_z(y!?du!L+LnO%pqVIOASD_G8{(8Z(l5S!Sw3K< zpEBId*%*gw4Aa_`>n!pE36CZLpkd>6BnZR|lz@YQCW?`PBXjJ2A-uW%;p>+$2QT)4 zevWmkhJ=wUxM{)9wzOLozld`MwHr#bYRFL}OiF`XSO3KTueOu}@zvJjCda6|n z2pBhnBHvwe{W`h+D!CsLK!OKbKSe4wL((FvRwWbey9VhS;%gA=l|(-oyQ@aSCvrW~ z&z=EA(_bOCLHbAD{7JlHeGUZu?^jVRd?C6%2q5;a1y<4$W#O=n7=tLri`1!2wzkGd zKq_ciz$js*e?zv=;1XkYprWnAhSa}6&es743XJ)-XS+)3XYw=Vz%MIKd*(uru&$ex z!-e1|o6FBu4ws*F_0P;GKM)94F10l^SB}!e7a0f!C&yY$*?AR@Pxzz%C@qy>=VFN% zmmrXGnGT#RzzKlknqPtw6}ZxV0S-mOz45=`P;bie9i&!Kbl9+8v*OiUgUghl{*@Et z2NDFk+9GLDi7G)p8>8mo(W3+zVueHz?c%qN- z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rnRspB~cdF^2A zDcj^kILFd)c+IoaoiIF+<_Lpg^9eM=Majg=NrtY+ENO*y29_KoR?- zQ*)B$WY$2g`;*}6h^V0ssY6e0Wth2^Ls`w~>1omqo_R~lwx@Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_inpsk1_wasm_bg.wasm", "noiseexplorer_inpsk1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_inpsk1_wasm.js", "types": "noiseexplorer_inpsk1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/INpsk2/Cargo.toml b/implementations/wasm/INpsk2/Cargo.toml index ed2f5c05b..d40923cca 100755 --- a/implementations/wasm/INpsk2/Cargo.toml +++ b/implementations/wasm/INpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_inpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/INpsk2/README.md b/implementations/wasm/INpsk2/README.md index a70cbb3a9..3a2983e73 100755 --- a/implementations/wasm/INpsk2/README.md +++ b/implementations/wasm/INpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_inpsk2_wasm (v1.0.3) +# noiseexplorer_inpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/INpsk2/pkg/README.md b/implementations/wasm/INpsk2/pkg/README.md index 35d563e31..3a2983e73 100755 --- a/implementations/wasm/INpsk2/pkg/README.md +++ b/implementations/wasm/INpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_inpsk2_wasm (v1.0.0) +# noiseexplorer_inpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_bg.wasm b/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe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(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.d.ts b/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.d.ts +++ b/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.js b/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.js index 6ab2dddcb..dd97db227 100755 --- a/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.js +++ b/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_inpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm_bg.wasm b/implementations/wasm/INpsk2/pkg/noiseexplorer_inpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b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+ENO*y29_KoR?- zQ*)B$WY$2g`;*}6h^V0ssY6e0Wth2^Ls`w~>1omqo_R~lwx@Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_inpsk2_wasm_bg.wasm", "noiseexplorer_inpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_inpsk2_wasm.js", "types": "noiseexplorer_inpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IX/Cargo.toml b/implementations/wasm/IX/Cargo.toml index 19235f9bc..57c7b1ce1 100755 --- a/implementations/wasm/IX/Cargo.toml +++ b/implementations/wasm/IX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ix_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IX/README.md b/implementations/wasm/IX/README.md index e75867465..ec2494ac9 100755 --- a/implementations/wasm/IX/README.md +++ b/implementations/wasm/IX/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ix_wasm (v1.0.3) +# noiseexplorer_ix_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IX/pkg/README.md b/implementations/wasm/IX/pkg/README.md index ee5655e40..ec2494ac9 100755 --- a/implementations/wasm/IX/pkg/README.md +++ b/implementations/wasm/IX/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ix_wasm (v1.0.0) +# noiseexplorer_ix_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IX/pkg/noiseexplorer_ix_bg.wasm b/implementations/wasm/IX/pkg/noiseexplorer_ix_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`P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6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.d.ts b/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.d.ts +++ b/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.js b/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.js index 6ab2dddcb..eba2b2121 100755 --- a/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.js +++ b/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_ix_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm_bg.wasm b/implementations/wasm/IX/pkg/noiseexplorer_ix_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z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`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_ix_wasm_bg.wasm", "noiseexplorer_ix_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_ix_wasm.js", "types": "noiseexplorer_ix_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IX1/Cargo.toml b/implementations/wasm/IX1/Cargo.toml index 9064a2887..6b33cd6d8 100755 --- a/implementations/wasm/IX1/Cargo.toml +++ b/implementations/wasm/IX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ix1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IX1/README.md b/implementations/wasm/IX1/README.md index d6406420c..5aa2b2bb4 100755 --- a/implementations/wasm/IX1/README.md +++ b/implementations/wasm/IX1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ix1_wasm (v1.0.3) +# noiseexplorer_ix1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IX1/pkg/README.md b/implementations/wasm/IX1/pkg/README.md index c9e5f2cce..5aa2b2bb4 100755 --- a/implementations/wasm/IX1/pkg/README.md +++ b/implementations/wasm/IX1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ix1_wasm (v1.0.0) +# noiseexplorer_ix1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IX1/pkg/noiseexplorer_ix1_bg.wasm b/implementations/wasm/IX1/pkg/noiseexplorer_ix1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI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*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.d.ts b/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.d.ts +++ b/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.js b/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.js index 6ab2dddcb..6b3babc4f 100755 --- a/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.js +++ b/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_ix1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm_bg.wasm b/implementations/wasm/IX1/pkg/noiseexplorer_ix1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&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MmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_ix1_wasm_bg.wasm", "noiseexplorer_ix1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_ix1_wasm.js", "types": "noiseexplorer_ix1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/IXpsk2/Cargo.toml b/implementations/wasm/IXpsk2/Cargo.toml index ac5173073..2289ed971 100755 --- a/implementations/wasm/IXpsk2/Cargo.toml +++ b/implementations/wasm/IXpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_ixpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/IXpsk2/README.md b/implementations/wasm/IXpsk2/README.md index 2c021aab1..84660bfd9 100755 --- a/implementations/wasm/IXpsk2/README.md +++ b/implementations/wasm/IXpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ixpsk2_wasm (v1.0.3) +# noiseexplorer_ixpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IXpsk2/pkg/README.md b/implementations/wasm/IXpsk2/pkg/README.md index e806d5669..84660bfd9 100755 --- a/implementations/wasm/IXpsk2/pkg/README.md +++ b/implementations/wasm/IXpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_ixpsk2_wasm (v1.0.0) +# noiseexplorer_ixpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_bg.wasm b/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw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WHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.d.ts b/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.d.ts +++ b/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.js b/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.js index 6ab2dddcb..eb8ed2763 100755 --- a/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.js +++ b/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_ixpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm_bg.wasm b/implementations/wasm/IXpsk2/pkg/noiseexplorer_ixpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e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aB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_ixpsk2_wasm_bg.wasm", "noiseexplorer_ixpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_ixpsk2_wasm.js", "types": "noiseexplorer_ixpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/K/Cargo.toml b/implementations/wasm/K/Cargo.toml index 32a8bbf04..032d462df 100755 --- a/implementations/wasm/K/Cargo.toml +++ b/implementations/wasm/K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/K/README.md b/implementations/wasm/K/README.md index e84f0204e..f96b45b60 100755 --- a/implementations/wasm/K/README.md +++ b/implementations/wasm/K/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k_wasm (v1.0.3) +# noiseexplorer_k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K/pkg/README.md b/implementations/wasm/K/pkg/README.md index 6365e6354..f96b45b60 100755 --- a/implementations/wasm/K/pkg/README.md +++ b/implementations/wasm/K/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k_wasm (v1.0.0) +# noiseexplorer_k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K/pkg/noiseexplorer_k_bg.wasm b/implementations/wasm/K/pkg/noiseexplorer_k_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyW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M#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/K/pkg/noiseexplorer_k_wasm.d.ts b/implementations/wasm/K/pkg/noiseexplorer_k_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/K/pkg/noiseexplorer_k_wasm.d.ts +++ b/implementations/wasm/K/pkg/noiseexplorer_k_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/K/pkg/noiseexplorer_k_wasm.js b/implementations/wasm/K/pkg/noiseexplorer_k_wasm.js index 6ab2dddcb..ed32ed809 100755 --- a/implementations/wasm/K/pkg/noiseexplorer_k_wasm.js +++ b/implementations/wasm/K/pkg/noiseexplorer_k_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_k_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/K/pkg/noiseexplorer_k_wasm_bg.wasm b/implementations/wasm/K/pkg/noiseexplorer_k_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1I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TN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_k_wasm_bg.wasm", "noiseexplorer_k_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_k_wasm.js", "types": "noiseexplorer_k_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/K1K/Cargo.toml b/implementations/wasm/K1K/Cargo.toml index 70c72cb9f..8034a351b 100755 --- a/implementations/wasm/K1K/Cargo.toml +++ b/implementations/wasm/K1K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1k_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/K1K/README.md b/implementations/wasm/K1K/README.md index ce5c9d07f..1368ea4bd 100755 --- a/implementations/wasm/K1K/README.md +++ b/implementations/wasm/K1K/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1k_wasm (v1.0.3) +# noiseexplorer_k1k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1K/pkg/README.md b/implementations/wasm/K1K/pkg/README.md index d831bd1a5..1368ea4bd 100755 --- a/implementations/wasm/K1K/pkg/README.md +++ b/implementations/wasm/K1K/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1k_wasm (v1.0.0) +# noiseexplorer_k1k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1K/pkg/noiseexplorer_k1k_bg.wasm b/implementations/wasm/K1K/pkg/noiseexplorer_k1k_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@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pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.d.ts b/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.d.ts +++ b/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.js b/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.js index 6ab2dddcb..03edd0890 100755 --- a/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.js +++ b/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_k1k_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm_bg.wasm b/implementations/wasm/K1K/pkg/noiseexplorer_k1k_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??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X3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_k1k_wasm_bg.wasm", "noiseexplorer_k1k_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_k1k_wasm.js", "types": "noiseexplorer_k1k_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/K1K1/Cargo.toml b/implementations/wasm/K1K1/Cargo.toml index 205d916d0..de7e0f12f 100755 --- a/implementations/wasm/K1K1/Cargo.toml +++ b/implementations/wasm/K1K1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1k1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/K1K1/README.md b/implementations/wasm/K1K1/README.md index ce16af540..24eb8b96e 100755 --- a/implementations/wasm/K1K1/README.md +++ b/implementations/wasm/K1K1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1k1_wasm (v1.0.3) +# noiseexplorer_k1k1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1K1/pkg/README.md b/implementations/wasm/K1K1/pkg/README.md index b79f2caa5..24eb8b96e 100755 --- a/implementations/wasm/K1K1/pkg/README.md +++ b/implementations/wasm/K1K1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1k1_wasm (v1.0.0) +# noiseexplorer_k1k1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_bg.wasm b/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8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C*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.d.ts b/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.d.ts +++ b/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.js b/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.js index 6ab2dddcb..f511dae6b 100755 --- a/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.js +++ b/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_k1k1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm_bg.wasm b/implementations/wasm/K1K1/pkg/noiseexplorer_k1k1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t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JMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_k1k1_wasm_bg.wasm", "noiseexplorer_k1k1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_k1k1_wasm.js", "types": "noiseexplorer_k1k1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/K1N/Cargo.toml b/implementations/wasm/K1N/Cargo.toml index 4ff85260a..27b19bf37 100755 --- a/implementations/wasm/K1N/Cargo.toml +++ b/implementations/wasm/K1N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1n_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/K1N/README.md b/implementations/wasm/K1N/README.md index 8e8cffc96..c90f929f4 100755 --- a/implementations/wasm/K1N/README.md +++ b/implementations/wasm/K1N/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1n_wasm (v1.0.3) +# noiseexplorer_k1n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1N/pkg/README.md b/implementations/wasm/K1N/pkg/README.md index f93f6fe06..c90f929f4 100755 --- a/implementations/wasm/K1N/pkg/README.md +++ b/implementations/wasm/K1N/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1n_wasm (v1.0.0) +# noiseexplorer_k1n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1N/pkg/noiseexplorer_k1n_bg.wasm b/implementations/wasm/K1N/pkg/noiseexplorer_k1n_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{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h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.d.ts b/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.d.ts +++ b/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.js b/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.js index 6ab2dddcb..8762ecea0 100755 --- a/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.js +++ b/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_k1n_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm_bg.wasm b/implementations/wasm/K1N/pkg/noiseexplorer_k1n_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht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Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_k1n_wasm_bg.wasm", "noiseexplorer_k1n_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_k1n_wasm.js", "types": "noiseexplorer_k1n_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/K1X/Cargo.toml b/implementations/wasm/K1X/Cargo.toml index b0ea2f021..6594a7885 100755 --- a/implementations/wasm/K1X/Cargo.toml +++ b/implementations/wasm/K1X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1x_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/K1X/README.md b/implementations/wasm/K1X/README.md index 9d67328c7..d6381b9f2 100755 --- a/implementations/wasm/K1X/README.md +++ b/implementations/wasm/K1X/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1x_wasm (v1.0.3) +# noiseexplorer_k1x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1X/pkg/README.md b/implementations/wasm/K1X/pkg/README.md index dbb7f46c3..d6381b9f2 100755 --- a/implementations/wasm/K1X/pkg/README.md +++ b/implementations/wasm/K1X/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1x_wasm (v1.0.0) +# noiseexplorer_k1x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1X/pkg/noiseexplorer_k1x_bg.wasm b/implementations/wasm/K1X/pkg/noiseexplorer_k1x_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X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mJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.d.ts b/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.d.ts +++ b/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.js b/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.js index 6ab2dddcb..d27c0a703 100755 --- a/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.js +++ b/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_k1x_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm_bg.wasm b/implementations/wasm/K1X/pkg/noiseexplorer_k1x_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2Y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X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_k1x_wasm_bg.wasm", "noiseexplorer_k1x_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_k1x_wasm.js", "types": "noiseexplorer_k1x_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/K1X1/Cargo.toml b/implementations/wasm/K1X1/Cargo.toml index f244a5b4a..4eca4099f 100755 --- a/implementations/wasm/K1X1/Cargo.toml +++ b/implementations/wasm/K1X1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_k1x1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/K1X1/README.md b/implementations/wasm/K1X1/README.md index 0af139d7e..5c6ed6d70 100755 --- a/implementations/wasm/K1X1/README.md +++ b/implementations/wasm/K1X1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1x1_wasm (v1.0.3) +# noiseexplorer_k1x1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1X1/pkg/README.md b/implementations/wasm/K1X1/pkg/README.md index fab003af8..5c6ed6d70 100755 --- a/implementations/wasm/K1X1/pkg/README.md +++ b/implementations/wasm/K1X1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_k1x1_wasm (v1.0.0) +# noiseexplorer_k1x1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_bg.wasm b/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl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yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.d.ts b/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.d.ts +++ b/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.js b/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.js index 6ab2dddcb..705f05beb 100755 --- a/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.js +++ b/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_k1x1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm_bg.wasm b/implementations/wasm/K1X1/pkg/noiseexplorer_k1x1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4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th2^Ls`w~>1omqo_R~lwx@Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_k1x1_wasm_bg.wasm", "noiseexplorer_k1x1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_k1x1_wasm.js", "types": "noiseexplorer_k1x1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KK/Cargo.toml b/implementations/wasm/KK/Cargo.toml index b35e6b91e..6f438cb81 100755 --- a/implementations/wasm/KK/Cargo.toml +++ b/implementations/wasm/KK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kk_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KK/README.md b/implementations/wasm/KK/README.md index 7f8636598..2dadd913e 100755 --- a/implementations/wasm/KK/README.md +++ b/implementations/wasm/KK/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kk_wasm (v1.0.3) +# noiseexplorer_kk_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KK/pkg/README.md b/implementations/wasm/KK/pkg/README.md index e8b11f907..2dadd913e 100755 --- a/implementations/wasm/KK/pkg/README.md +++ b/implementations/wasm/KK/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kk_wasm (v1.0.0) +# noiseexplorer_kk_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KK/pkg/noiseexplorer_kk_bg.wasm b/implementations/wasm/KK/pkg/noiseexplorer_kk_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0N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v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.d.ts b/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.d.ts +++ b/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.js b/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.js index 6ab2dddcb..e08420aef 100755 --- a/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.js +++ b/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kk_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm_bg.wasm b/implementations/wasm/KK/pkg/noiseexplorer_kk_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@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Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_kk_wasm_bg.wasm", "noiseexplorer_kk_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kk_wasm.js", "types": "noiseexplorer_kk_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KK1/Cargo.toml b/implementations/wasm/KK1/Cargo.toml index bc700fa78..3a3c61974 100755 --- a/implementations/wasm/KK1/Cargo.toml +++ b/implementations/wasm/KK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kk1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KK1/README.md b/implementations/wasm/KK1/README.md index 24c554a53..4302c7c4f 100755 --- a/implementations/wasm/KK1/README.md +++ b/implementations/wasm/KK1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kk1_wasm (v1.0.3) +# noiseexplorer_kk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KK1/pkg/README.md b/implementations/wasm/KK1/pkg/README.md index c5c4b305d..4302c7c4f 100755 --- a/implementations/wasm/KK1/pkg/README.md +++ b/implementations/wasm/KK1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kk1_wasm (v1.0.0) +# noiseexplorer_kk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KK1/pkg/noiseexplorer_kk1_bg.wasm b/implementations/wasm/KK1/pkg/noiseexplorer_kk1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z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QI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.d.ts b/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.d.ts +++ b/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.js b/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.js index 6ab2dddcb..4ec62bc23 100755 --- a/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.js +++ b/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kk1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm_bg.wasm b/implementations/wasm/KK1/pkg/noiseexplorer_kk1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zb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ls`w~>1omqo_R~lwx@Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_kk1_wasm_bg.wasm", "noiseexplorer_kk1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kk1_wasm.js", "types": "noiseexplorer_kk1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KKpsk0/Cargo.toml b/implementations/wasm/KKpsk0/Cargo.toml index c5ef51e8c..df6497f04 100755 --- a/implementations/wasm/KKpsk0/Cargo.toml +++ b/implementations/wasm/KKpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kkpsk0_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KKpsk0/README.md b/implementations/wasm/KKpsk0/README.md index a5d6efdc9..314a37baf 100755 --- a/implementations/wasm/KKpsk0/README.md +++ b/implementations/wasm/KKpsk0/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kkpsk0_wasm (v1.0.3) +# noiseexplorer_kkpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KKpsk0/pkg/README.md b/implementations/wasm/KKpsk0/pkg/README.md index 72cead5e8..314a37baf 100755 --- a/implementations/wasm/KKpsk0/pkg/README.md +++ b/implementations/wasm/KKpsk0/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kkpsk0_wasm (v1.0.0) +# noiseexplorer_kkpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_bg.wasm b/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_E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@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.d.ts b/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.d.ts +++ b/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.js b/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.js index 6ab2dddcb..7494278c5 100755 --- a/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.js +++ b/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kkpsk0_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm_bg.wasm b/implementations/wasm/KKpsk0/pkg/noiseexplorer_kkpsk0_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary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false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KKpsk2/Cargo.toml b/implementations/wasm/KKpsk2/Cargo.toml index 25fe5a9a0..8bb792050 100755 --- a/implementations/wasm/KKpsk2/Cargo.toml +++ b/implementations/wasm/KKpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kkpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KKpsk2/README.md b/implementations/wasm/KKpsk2/README.md index 564403697..9d7141312 100755 --- a/implementations/wasm/KKpsk2/README.md +++ b/implementations/wasm/KKpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kkpsk2_wasm (v1.0.3) +# noiseexplorer_kkpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KKpsk2/pkg/README.md b/implementations/wasm/KKpsk2/pkg/README.md index 61c1fb22f..9d7141312 100755 --- a/implementations/wasm/KKpsk2/pkg/README.md +++ b/implementations/wasm/KKpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kkpsk2_wasm (v1.0.0) +# noiseexplorer_kkpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_bg.wasm b/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1mrR7m}tK+{)sfg)Yhh{aR&C9Ddde*LMu0;9Nm zrax7`t>c#Bu=5H8Ed~ReYsH>>I028VLA!hbo#XmyEJFL}Ge_UOLEuBb?dtC9;9>OCf1|@a-Sb`A{ z@9zM76<7_d3YNb9EwDRP+(63yOBLbbU#btMYsTHB4oHDuT0|KX@C8ar2~s!MAfmh? zL)8YT>HE|Qpo<}tR;piuLa6qdN=O@*qBKAhY88N{M}>cz1?WgF@FYQ_xiHXA>M?45 zdwaVH-hUm_Z%8&V*x3TDgClmPc$rfGtYv^GkHC`k6H#|j&CYe>8hY)xak=VL1I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6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.d.ts b/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.d.ts +++ b/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.js b/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.js index 6ab2dddcb..2bc0fff76 100755 --- a/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.js +++ b/implementations/wasm/KKpsk2/pkg/noiseexplorer_kkpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kkpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KKpsk2/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- "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_kkpsk2_wasm_bg.wasm", "noiseexplorer_kkpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kkpsk2_wasm.js", "types": "noiseexplorer_kkpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KN/Cargo.toml b/implementations/wasm/KN/Cargo.toml index cd1a2bff5..621cbfbb9 100755 --- a/implementations/wasm/KN/Cargo.toml +++ b/implementations/wasm/KN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kn_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KN/README.md b/implementations/wasm/KN/README.md index b8759d531..382d2423f 100755 --- a/implementations/wasm/KN/README.md +++ b/implementations/wasm/KN/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kn_wasm (v1.0.3) +# noiseexplorer_kn_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KN/pkg/README.md b/implementations/wasm/KN/pkg/README.md index 47e0a69de..382d2423f 100755 --- a/implementations/wasm/KN/pkg/README.md +++ b/implementations/wasm/KN/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kn_wasm (v1.0.0) +# noiseexplorer_kn_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KN/pkg/noiseexplorer_kn_bg.wasm b/implementations/wasm/KN/pkg/noiseexplorer_kn_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1mrR7m}tK+{)sfg)Yhh{aR&C9Ddde*LMu0;9Nm zrax7`t>c#Bu=5H8Ed~ReYsH>>I028VLA!hbo#XmyEJFL}Ge_UOLEuBb?dtC9;9>OCf1|@a-Sb`A{ z@9zM76<7_d3YNb9EwDRP+(63yOBLbbU#btMYsTHB4oHDuT0|KX@C8ar2~s!MAfmh? zL)8YT>HE|Qpo<}tR;piuLa6qdN=O@*qBKAhY88N{M}>cz1?WgF@FYQ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c8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.d.ts b/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.d.ts +++ b/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.js b/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.js index 6ab2dddcb..6fbbd2d69 100755 --- a/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.js +++ b/implementations/wasm/KN/pkg/noiseexplorer_kn_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kn_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/K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", + "version": "1.0.4", "files": [ "noiseexplorer_kn_wasm_bg.wasm", "noiseexplorer_kn_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kn_wasm.js", "types": "noiseexplorer_kn_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KNpsk0/Cargo.toml b/implementations/wasm/KNpsk0/Cargo.toml index 2b71f88d3..f79ab5fc2 100755 --- a/implementations/wasm/KNpsk0/Cargo.toml +++ b/implementations/wasm/KNpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_knpsk0_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KNpsk0/README.md b/implementations/wasm/KNpsk0/README.md index e1e435529..891d8f0ae 100755 --- a/implementations/wasm/KNpsk0/README.md +++ b/implementations/wasm/KNpsk0/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_knpsk0_wasm (v1.0.3) +# noiseexplorer_knpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KNpsk0/pkg/README.md b/implementations/wasm/KNpsk0/pkg/README.md index 5926aba66..891d8f0ae 100755 --- a/implementations/wasm/KNpsk0/pkg/README.md +++ b/implementations/wasm/KNpsk0/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_knpsk0_wasm (v1.0.0) +# noiseexplorer_knpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_bg.wasm b/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1mrR7m}tK+{)sfg)Yhh{aR&C9Ddde*LMu0;9Nm zrax7`t>c#Bu=5H8Ed~ReYsH>>I028VLA!hbo#XmyEJFL}Ge_UOLEuBb?dtC9;9>OCf1|@a-Sb`A{ z@9zM76<7_d3YNb9EwDRP+(63yOBLbbU#btMYsTHB4oHDuT0|KX@C8ar2~s!MAfmh?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~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.d.ts b/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.d.ts +++ b/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.js b/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.js index 6ab2dddcb..0501b196d 100755 --- a/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.js +++ b/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_knpsk0_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm_bg.wasm b/implementations/wasm/KNpsk0/pkg/noiseexplorer_knpsk0_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2xN@njskw5LCcel(FgQ8ZV#>~|cznVi{a0zJ1UnZ? z#JB{3l*@GBWC2b99M}93oT$K+_6u+*8t#p^f~i}tZ_6TBxOiZ?!R$&yX4yFXpP}!7ZgXI|&sdaw2&b>gK#$S-b-&g^Ti}U4 z##3rEx?e+c4gw1`^fhi9IFe+bXSi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Qd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_knpsk0_wasm_bg.wasm", "noiseexplorer_knpsk0_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_knpsk0_wasm.js", "types": "noiseexplorer_knpsk0_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KNpsk2/Cargo.toml b/implementations/wasm/KNpsk2/Cargo.toml index 82547a728..08f4c4532 100755 --- a/implementations/wasm/KNpsk2/Cargo.toml +++ b/implementations/wasm/KNpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_knpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KNpsk2/README.md b/implementations/wasm/KNpsk2/README.md index d895547b1..4029c5a60 100755 --- a/implementations/wasm/KNpsk2/README.md +++ b/implementations/wasm/KNpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_knpsk2_wasm (v1.0.3) +# noiseexplorer_knpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KNpsk2/pkg/README.md b/implementations/wasm/KNpsk2/pkg/README.md index c7ec53031..4029c5a60 100755 --- a/implementations/wasm/KNpsk2/pkg/README.md +++ b/implementations/wasm/KNpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_knpsk2_wasm (v1.0.0) +# noiseexplorer_knpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_bg.wasm b/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1mrR7m}tK+{)sfg)Yhh{aR&C9Ddde*LMu0;9Nm zrax7`t>c#Bu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^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.d.ts b/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.d.ts +++ b/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.js b/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.js index 6ab2dddcb..d43b0f993 100755 --- a/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.js +++ b/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_knpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm_bg.wasm b/implementations/wasm/KNpsk2/pkg/noiseexplorer_knpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2xN@njskw5LCcel(FgQ8ZV#>~|cznVi{a0zJ1U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ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_knpsk2_wasm_bg.wasm", "noiseexplorer_knpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_knpsk2_wasm.js", "types": "noiseexplorer_knpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KX/Cargo.toml b/implementations/wasm/KX/Cargo.toml index fb934765a..873e509cf 100755 --- a/implementations/wasm/KX/Cargo.toml +++ b/implementations/wasm/KX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kx_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KX/README.md b/implementations/wasm/KX/README.md index 7cce701ce..064894222 100755 --- a/implementations/wasm/KX/README.md +++ b/implementations/wasm/KX/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kx_wasm (v1.0.3) +# noiseexplorer_kx_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KX/pkg/README.md b/implementations/wasm/KX/pkg/README.md index 633e7a31e..064894222 100755 --- a/implementations/wasm/KX/pkg/README.md +++ b/implementations/wasm/KX/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kx_wasm (v1.0.0) +# noiseexplorer_kx_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KX/pkg/noiseexplorer_kx_bg.wasm b/implementations/wasm/KX/pkg/noiseexplorer_kx_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1m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orHs*r1VYItalJ`~qFo+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.d.ts b/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.d.ts +++ b/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.js b/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.js index 6ab2dddcb..b9b63948d 100755 --- a/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.js +++ b/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kx_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm_bg.wasm b/implementations/wasm/KX/pkg/noiseexplorer_kx_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2xN@njskw5LCcel(FgQ8ZV#>~|cznVi{a0zJ1UnZ? z#JB{3l*@GBWC2b99M}93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iRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_kx_wasm_bg.wasm", "noiseexplorer_kx_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kx_wasm.js", "types": "noiseexplorer_kx_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KX1/Cargo.toml b/implementations/wasm/KX1/Cargo.toml index a3b9724f6..83762a2b1 100755 --- a/implementations/wasm/KX1/Cargo.toml +++ b/implementations/wasm/KX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kx1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KX1/README.md b/implementations/wasm/KX1/README.md index a77dc7590..3cb34dc49 100755 --- a/implementations/wasm/KX1/README.md +++ b/implementations/wasm/KX1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kx1_wasm (v1.0.3) +# noiseexplorer_kx1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KX1/pkg/README.md b/implementations/wasm/KX1/pkg/README.md index 14c05c3b6..3cb34dc49 100755 --- a/implementations/wasm/KX1/pkg/README.md +++ b/implementations/wasm/KX1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kx1_wasm (v1.0.0) +# noiseexplorer_kx1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KX1/pkg/noiseexplorer_kx1_bg.wasm b/implementations/wasm/KX1/pkg/noiseexplorer_kx1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$8!wHmbxmjmBX|$cEIZNV;sGNNuepkscjpmG-gW_0D0HNSDW3a6mzdX}=|1mrR7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*r1VYItalJ`~qFo+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.d.ts b/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.d.ts +++ b/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.js b/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.js index 6ab2dddcb..ec9bdcaec 100755 --- a/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.js +++ b/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kx1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm_bg.wasm b/implementations/wasm/KX1/pkg/noiseexplorer_kx1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2xN@njskw5LCcel(FgQ8ZV#>~|cznVi{a0zJ1UnZ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@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_kx1_wasm_bg.wasm", "noiseexplorer_kx1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kx1_wasm.js", "types": "noiseexplorer_kx1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/KXpsk2/Cargo.toml b/implementations/wasm/KXpsk2/Cargo.toml index 4e23722c1..e7efef46d 100755 --- a/implementations/wasm/KXpsk2/Cargo.toml +++ b/implementations/wasm/KXpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kxpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/KXpsk2/README.md b/implementations/wasm/KXpsk2/README.md index e5412558e..71bbaee02 100755 --- a/implementations/wasm/KXpsk2/README.md +++ b/implementations/wasm/KXpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kxpsk2_wasm (v1.0.3) +# noiseexplorer_kxpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KXpsk2/pkg/README.md b/implementations/wasm/KXpsk2/pkg/README.md index c5792fd63..71bbaee02 100755 --- a/implementations/wasm/KXpsk2/pkg/README.md +++ b/implementations/wasm/KXpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kxpsk2_wasm (v1.0.0) +# noiseexplorer_kxpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_bg.wasm b/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam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kxpsk2_wasm.d.ts +++ b/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm.js b/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm.js index 6ab2dddcb..c4fc164f4 100755 --- a/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm.js +++ b/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kxpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm_bg.wasm b/implementations/wasm/KXpsk2/pkg/noiseexplorer_kxpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh z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Jx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_kxpsk2_wasm_bg.wasm", "noiseexplorer_kxpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kxpsk2_wasm.js", "types": "noiseexplorer_kxpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/Kpsk0/Cargo.toml b/implementations/wasm/Kpsk0/Cargo.toml index 081c1f714..497ae5f28 100755 --- a/implementations/wasm/Kpsk0/Cargo.toml +++ b/implementations/wasm/Kpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_kpsk0_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/Kpsk0/README.md b/implementations/wasm/Kpsk0/README.md index e57e5c417..13601c081 100755 --- a/implementations/wasm/Kpsk0/README.md +++ b/implementations/wasm/Kpsk0/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kpsk0_wasm (v1.0.3) +# noiseexplorer_kpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/Kpsk0/pkg/README.md b/implementations/wasm/Kpsk0/pkg/README.md index e7f0d1fe5..13601c081 100755 --- a/implementations/wasm/Kpsk0/pkg/README.md +++ b/implementations/wasm/Kpsk0/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_kpsk0_wasm (v1.0.0) +# noiseexplorer_kpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_bg.wasm b/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-y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>)z2 diff --git a/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.d.ts b/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.d.ts +++ b/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.js b/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.js index 6ab2dddcb..349afbbd6 100755 --- a/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.js +++ b/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_kpsk0_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm_bg.wasm b/implementations/wasm/Kpsk0/pkg/noiseexplorer_kpsk0_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4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hcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_kpsk0_wasm_bg.wasm", "noiseexplorer_kpsk0_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_kpsk0_wasm.js", "types": "noiseexplorer_kpsk0_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/N/Cargo.toml b/implementations/wasm/N/Cargo.toml index 2c893e827..ce197a918 100755 --- a/implementations/wasm/N/Cargo.toml +++ b/implementations/wasm/N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_n_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/N/README.md b/implementations/wasm/N/README.md index d8b4d4ebd..67c8fbf3b 100755 --- a/implementations/wasm/N/README.md +++ b/implementations/wasm/N/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_n_wasm (v1.0.3) +# noiseexplorer_n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/N/pkg/README.md b/implementations/wasm/N/pkg/README.md index 24865ad0f..67c8fbf3b 100755 --- a/implementations/wasm/N/pkg/README.md +++ b/implementations/wasm/N/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_n_wasm (v1.0.0) +# noiseexplorer_n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/N/pkg/noiseexplorer_n_bg.wasm b/implementations/wasm/N/pkg/noiseexplorer_n_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4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orer_n_wasm.d.ts +++ b/implementations/wasm/N/pkg/noiseexplorer_n_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/N/pkg/noiseexplorer_n_wasm.js b/implementations/wasm/N/pkg/noiseexplorer_n_wasm.js index 6ab2dddcb..00f984ea0 100755 --- a/implementations/wasm/N/pkg/noiseexplorer_n_wasm.js +++ b/implementations/wasm/N/pkg/noiseexplorer_n_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_n_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/N/pkg/noiseexplorer_n_wasm_bg.wasm b/implementations/wasm/N/pkg/noiseexplorer_n_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 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+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_n_wasm_bg.wasm", "noiseexplorer_n_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_n_wasm.js", "types": "noiseexplorer_n_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NK/Cargo.toml b/implementations/wasm/NK/Cargo.toml index e1dcf3d6a..d5029f7fe 100755 --- a/implementations/wasm/NK/Cargo.toml +++ b/implementations/wasm/NK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nk_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NK/README.md b/implementations/wasm/NK/README.md index 741718592..1f6a8a7a3 100755 --- a/implementations/wasm/NK/README.md +++ b/implementations/wasm/NK/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nk_wasm (v1.0.3) +# noiseexplorer_nk_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NK/pkg/README.md b/implementations/wasm/NK/pkg/README.md index 5479984b4..1f6a8a7a3 100755 --- a/implementations/wasm/NK/pkg/README.md +++ b/implementations/wasm/NK/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nk_wasm (v1.0.0) +# noiseexplorer_nk_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NK/pkg/noiseexplorer_nk_bg.wasm b/implementations/wasm/NK/pkg/noiseexplorer_nk_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ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2mPz6}-EKPQ$|Q8$ofG^(+FJhV*|N5s?M|T9Ovi)meEvuHO5w{j7`p;l z!GorHs*r1VYItalJ`~qFo+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.d.ts b/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.d.ts +++ b/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.js b/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.js index 6ab2dddcb..b82b9bf3e 100755 --- a/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.js +++ b/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nk_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm_bg.wasm b/implementations/wasm/NK/pkg/noiseexplorer_nk_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM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7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nk_wasm_bg.wasm", "noiseexplorer_nk_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nk_wasm.js", "types": "noiseexplorer_nk_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NK1/Cargo.toml b/implementations/wasm/NK1/Cargo.toml index 353f96448..57c3ef7d0 100755 --- a/implementations/wasm/NK1/Cargo.toml +++ b/implementations/wasm/NK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nk1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NK1/README.md b/implementations/wasm/NK1/README.md index df0fd0786..fb1a458fb 100755 --- a/implementations/wasm/NK1/README.md +++ b/implementations/wasm/NK1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nk1_wasm (v1.0.3) +# noiseexplorer_nk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NK1/pkg/README.md b/implementations/wasm/NK1/pkg/README.md index 36c247808..fb1a458fb 100755 --- a/implementations/wasm/NK1/pkg/README.md +++ b/implementations/wasm/NK1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nk1_wasm (v1.0.0) +# noiseexplorer_nk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NK1/pkg/noiseexplorer_nk1_bg.wasm b/implementations/wasm/NK1/pkg/noiseexplorer_nk1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0rC;)FE8P*_0uink%Fv~#yXUQ`o3zO8MM;R2)w4QE)90t6IHG?#V_GaQ`#j^QXZfo zam=b?M2x%Y<&R$?=oQ#o{$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6}-EKPQ$|Q8$ofG^(+FJhV*|N5s?M|T9Ovi)meEvuHO5w{j7`p;l z!GorHs*r1VYItalJ`~qFo+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.d.ts b/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.d.ts +++ b/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.js b/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.js index 6ab2dddcb..c1d585d8f 100755 --- a/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.js +++ b/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nk1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm_bg.wasm b/implementations/wasm/NK1/pkg/noiseexplorer_nk1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`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2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nk1_wasm_bg.wasm", "noiseexplorer_nk1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nk1_wasm.js", "types": "noiseexplorer_nk1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NKpsk0/Cargo.toml b/implementations/wasm/NKpsk0/Cargo.toml index d9d80f571..1fc15d16a 100755 --- a/implementations/wasm/NKpsk0/Cargo.toml +++ b/implementations/wasm/NKpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nkpsk0_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NKpsk0/README.md b/implementations/wasm/NKpsk0/README.md index 043e9a2b9..0a918d2e5 100755 --- a/implementations/wasm/NKpsk0/README.md +++ b/implementations/wasm/NKpsk0/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nkpsk0_wasm (v1.0.3) +# noiseexplorer_nkpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NKpsk0/pkg/README.md b/implementations/wasm/NKpsk0/pkg/README.md index 2bb9c772d..0a918d2e5 100755 --- a/implementations/wasm/NKpsk0/pkg/README.md +++ b/implementations/wasm/NKpsk0/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nkpsk0_wasm (v1.0.0) +# noiseexplorer_nkpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_bg.wasm b/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TREFvqRdn=SQ=AG~DM7aXgP z0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nkpsk0_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.d.ts +++ b/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.js b/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.js index 6ab2dddcb..02ec9a7f7 100755 --- a/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.js +++ b/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nkpsk0_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm_bg.wasm b/implementations/wasm/NKpsk0/pkg/noiseexplorer_nkpsk0_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y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T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nkpsk0_wasm_bg.wasm", "noiseexplorer_nkpsk0_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nkpsk0_wasm.js", "types": "noiseexplorer_nkpsk0_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NKpsk2/Cargo.toml b/implementations/wasm/NKpsk2/Cargo.toml index ef61893ba..0c8aa6cfb 100755 --- a/implementations/wasm/NKpsk2/Cargo.toml +++ b/implementations/wasm/NKpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nkpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NKpsk2/README.md b/implementations/wasm/NKpsk2/README.md index aa0bc77d3..d3381f9ad 100755 --- a/implementations/wasm/NKpsk2/README.md +++ b/implementations/wasm/NKpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nkpsk2_wasm (v1.0.3) +# noiseexplorer_nkpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NKpsk2/pkg/README.md b/implementations/wasm/NKpsk2/pkg/README.md index e647200eb..d3381f9ad 100755 --- a/implementations/wasm/NKpsk2/pkg/README.md +++ b/implementations/wasm/NKpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nkpsk2_wasm (v1.0.0) +# noiseexplorer_nkpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_bg.wasm b/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBym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L+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.d.ts b/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.d.ts +++ b/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.js b/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.js index 6ab2dddcb..bcd07b940 100755 --- a/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.js +++ b/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nkpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm_bg.wasm b/implementations/wasm/NKpsk2/pkg/noiseexplorer_nkpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n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ZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nkpsk2_wasm_bg.wasm", "noiseexplorer_nkpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nkpsk2_wasm.js", "types": "noiseexplorer_nkpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NN/Cargo.toml b/implementations/wasm/NN/Cargo.toml index 0c1383b15..28f16ff32 100755 --- a/implementations/wasm/NN/Cargo.toml +++ b/implementations/wasm/NN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nn_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NN/README.md b/implementations/wasm/NN/README.md index 7e361d5ab..414b375db 100755 --- a/implementations/wasm/NN/README.md +++ b/implementations/wasm/NN/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nn_wasm (v1.0.3) +# noiseexplorer_nn_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NN/pkg/README.md b/implementations/wasm/NN/pkg/README.md index fb0cebc84..414b375db 100755 --- a/implementations/wasm/NN/pkg/README.md +++ b/implementations/wasm/NN/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nn_wasm (v1.0.0) +# noiseexplorer_nn_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NN/pkg/noiseexplorer_nn_bg.wasm b/implementations/wasm/NN/pkg/noiseexplorer_nn_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-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Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.d.ts b/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.d.ts +++ b/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.js b/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.js index 6ab2dddcb..e80f45682 100755 --- a/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.js +++ b/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nn_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm_bg.wasm b/implementations/wasm/NN/pkg/noiseexplorer_nn_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_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4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nn_wasm_bg.wasm", "noiseexplorer_nn_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nn_wasm.js", "types": "noiseexplorer_nn_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NNpsk0/Cargo.toml b/implementations/wasm/NNpsk0/Cargo.toml index 8a10b322e..a1c458a24 100755 --- a/implementations/wasm/NNpsk0/Cargo.toml +++ b/implementations/wasm/NNpsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nnpsk0_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NNpsk0/README.md b/implementations/wasm/NNpsk0/README.md index c517d3f9a..0804c688f 100755 --- a/implementations/wasm/NNpsk0/README.md +++ b/implementations/wasm/NNpsk0/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nnpsk0_wasm (v1.0.3) +# noiseexplorer_nnpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NNpsk0/pkg/README.md b/implementations/wasm/NNpsk0/pkg/README.md index c904575bb..0804c688f 100755 --- a/implementations/wasm/NNpsk0/pkg/README.md +++ b/implementations/wasm/NNpsk0/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nnpsk0_wasm (v1.0.0) +# noiseexplorer_nnpsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_bg.wasm b/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$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fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.d.ts b/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.d.ts +++ b/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.js b/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.js index 6ab2dddcb..cb8a8b183 100755 --- a/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.js +++ b/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nnpsk0_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm_bg.wasm b/implementations/wasm/NNpsk0/pkg/noiseexplorer_nnpsk0_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmk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Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nnpsk0_wasm_bg.wasm", "noiseexplorer_nnpsk0_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nnpsk0_wasm.js", "types": "noiseexplorer_nnpsk0_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NNpsk2/Cargo.toml b/implementations/wasm/NNpsk2/Cargo.toml index a49ce90ca..342c0ac7a 100755 --- a/implementations/wasm/NNpsk2/Cargo.toml +++ b/implementations/wasm/NNpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nnpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NNpsk2/README.md b/implementations/wasm/NNpsk2/README.md index aa98ddf87..bbc75f935 100755 --- a/implementations/wasm/NNpsk2/README.md +++ b/implementations/wasm/NNpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nnpsk2_wasm (v1.0.3) +# noiseexplorer_nnpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NNpsk2/pkg/README.md b/implementations/wasm/NNpsk2/pkg/README.md index b85081e27..bbc75f935 100755 --- a/implementations/wasm/NNpsk2/pkg/README.md +++ b/implementations/wasm/NNpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nnpsk2_wasm (v1.0.0) +# noiseexplorer_nnpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_bg.wasm b/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6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MY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.d.ts b/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.d.ts +++ b/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.js b/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.js index 6ab2dddcb..0506dfe27 100755 --- a/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.js +++ b/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nnpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm_bg.wasm b/implementations/wasm/NNpsk2/pkg/noiseexplorer_nnpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa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ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nnpsk2_wasm_bg.wasm", "noiseexplorer_nnpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nnpsk2_wasm.js", "types": "noiseexplorer_nnpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NX/Cargo.toml b/implementations/wasm/NX/Cargo.toml index 3eb76257f..b8b703715 100755 --- a/implementations/wasm/NX/Cargo.toml +++ b/implementations/wasm/NX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nx_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NX/README.md b/implementations/wasm/NX/README.md index f1cce4e1d..5df969f56 100755 --- a/implementations/wasm/NX/README.md +++ b/implementations/wasm/NX/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nx_wasm (v1.0.3) +# noiseexplorer_nx_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NX/pkg/README.md b/implementations/wasm/NX/pkg/README.md index 31ea66ec1..5df969f56 100755 --- a/implementations/wasm/NX/pkg/README.md +++ b/implementations/wasm/NX/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nx_wasm (v1.0.0) +# noiseexplorer_nx_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NX/pkg/noiseexplorer_nx_bg.wasm b/implementations/wasm/NX/pkg/noiseexplorer_nx_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWX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#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.d.ts b/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.d.ts +++ b/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.js b/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.js index 6ab2dddcb..cd65a4463 100755 --- a/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.js +++ b/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nx_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm_bg.wasm b/implementations/wasm/NX/pkg/noiseexplorer_nx_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}t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S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nx_wasm_bg.wasm", "noiseexplorer_nx_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nx_wasm.js", "types": "noiseexplorer_nx_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NX1/Cargo.toml b/implementations/wasm/NX1/Cargo.toml index 6064df26d..4cd771217 100755 --- a/implementations/wasm/NX1/Cargo.toml +++ b/implementations/wasm/NX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nx1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NX1/README.md b/implementations/wasm/NX1/README.md index 7704e0c31..bd098c787 100755 --- a/implementations/wasm/NX1/README.md +++ b/implementations/wasm/NX1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nx1_wasm (v1.0.3) +# noiseexplorer_nx1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NX1/pkg/README.md b/implementations/wasm/NX1/pkg/README.md index fc58e02e0..bd098c787 100755 --- a/implementations/wasm/NX1/pkg/README.md +++ b/implementations/wasm/NX1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nx1_wasm (v1.0.0) +# noiseexplorer_nx1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NX1/pkg/noiseexplorer_nx1_bg.wasm b/implementations/wasm/NX1/pkg/noiseexplorer_nx1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..d9bed3115fa34311594f765e422a824896c6d752 GIT binary patch literal 3058 zcmbtW&2J+~6|bspC!W~e^$fFYAhVisA5bDl+~3_EX{9No$$(bNNND%4r=;C(JDoW0 zq`Pe=m(3oRj~o04Dl=72aMu}6*^I4t}DT#yLA*KN;40t6DV%CA0Nz4w0a z{a(c^D$Y4$jBkl!adX3t`3)1>Tw4w&-J_%BFrAGi$?T{+$+IP6nyzuq8X9N!H-E@C zH_nsuEWZ})4N{#Poh8>t<2*^2c<^fDB1-es=1S|LI9qMJRcl@3=^`qV*S8<8_UFTC z8o%CtyWXBkcw4k2Qx8>_zE2IlE1040oRSc@#IfBymHJLk*T|sWYe->mQq|Wwq9fY8B{>v( zx`c(UAv(O(k`2Xt!B$=r>v5?)!@)YPM@p3H^B=urr-pznicwQt^-yXsA=%;1DFw?U zucNF&$Ld)JA;Xj}wh0rQRdE7PS5`XP6`~3Pd)C1XL@TRE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1/pkg/noiseexplorer_nx1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm.d.ts +++ b/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm.js b/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm.js index 6ab2dddcb..5aceb6061 100755 --- a/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm.js +++ b/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nx1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm_bg.wasm b/implementations/wasm/NX1/pkg/noiseexplorer_nx1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL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yd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nx1_wasm_bg.wasm", "noiseexplorer_nx1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nx1_wasm.js", "types": "noiseexplorer_nx1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/NXpsk2/Cargo.toml b/implementations/wasm/NXpsk2/Cargo.toml index 1df711ca1..2d2217878 100755 --- a/implementations/wasm/NXpsk2/Cargo.toml +++ b/implementations/wasm/NXpsk2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_nxpsk2_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/NXpsk2/README.md b/implementations/wasm/NXpsk2/README.md index 1c440cbfe..e5b56b614 100755 --- a/implementations/wasm/NXpsk2/README.md +++ b/implementations/wasm/NXpsk2/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nxpsk2_wasm (v1.0.3) +# noiseexplorer_nxpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NXpsk2/pkg/README.md b/implementations/wasm/NXpsk2/pkg/README.md index 5a71046d8..e5b56b614 100755 --- a/implementations/wasm/NXpsk2/pkg/README.md +++ b/implementations/wasm/NXpsk2/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_nxpsk2_wasm (v1.0.0) +# noiseexplorer_nxpsk2_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_bg.wasm b/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_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ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.d.ts +++ b/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.js b/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.js index 6ab2dddcb..0ee957f94 100755 --- a/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.js +++ b/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_nxpsk2_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm_bg.wasm b/implementations/wasm/NXpsk2/pkg/noiseexplorer_nxpsk2_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw zv@6L480&t67MM1*EcElQUJ`u3_z(y!?du!L+LnO%pqVIOASD_G8{(8Z(l5S!Sw3K< zpEB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$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_nxpsk2_wasm_bg.wasm", "noiseexplorer_nxpsk2_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_nxpsk2_wasm.js", "types": "noiseexplorer_nxpsk2_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/Npsk0/Cargo.toml b/implementations/wasm/Npsk0/Cargo.toml index ac760cbc1..4a49861ee 100755 --- a/implementations/wasm/Npsk0/Cargo.toml +++ b/implementations/wasm/Npsk0/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_npsk0_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/Npsk0/README.md b/implementations/wasm/Npsk0/README.md index 31c1279fe..ea7f3e183 100755 --- a/implementations/wasm/Npsk0/README.md +++ b/implementations/wasm/Npsk0/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_npsk0_wasm (v1.0.3) +# noiseexplorer_npsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/Npsk0/pkg/README.md b/implementations/wasm/Npsk0/pkg/README.md index b8a6166e4..ea7f3e183 100755 --- a/implementations/wasm/Npsk0/pkg/README.md +++ b/implementations/wasm/Npsk0/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_npsk0_wasm (v1.0.0) +# noiseexplorer_npsk0_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_bg.wasm b/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsSY1(u@{}@291fbY63i&hh>1>`wnX0b4+_&L%!=Q z>Mu}3Re}&Rd%r4MLdHAHFw`H{n_)|*-oQSt_-PN}krIQFx_K;75fC5j0DKi#4Xg^5 zZ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+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.d.ts b/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.d.ts +++ b/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.js b/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.js index 6ab2dddcb..f2f6d956c 100755 --- a/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.js +++ b/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_npsk0_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm_bg.wasm b/implementations/wasm/Npsk0/pkg/noiseexplorer_npsk0_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2xN@njskw5LCcel(FgQ8ZV#>~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= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_npsk0_wasm_bg.wasm", "noiseexplorer_npsk0_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_npsk0_wasm.js", "types": "noiseexplorer_npsk0_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/X/Cargo.toml b/implementations/wasm/X/Cargo.toml index aea769405..5d94b6313 100755 --- a/implementations/wasm/X/Cargo.toml +++ b/implementations/wasm/X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/X/README.md b/implementations/wasm/X/README.md index b8a2d6cb7..fb141384c 100755 --- a/implementations/wasm/X/README.md +++ b/implementations/wasm/X/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x_wasm (v1.0.3) +# noiseexplorer_x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X/pkg/README.md b/implementations/wasm/X/pkg/README.md index 45db22238..fb141384c 100755 --- a/implementations/wasm/X/pkg/README.md +++ b/implementations/wasm/X/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x_wasm (v1.0.0) +# noiseexplorer_x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X/pkg/noiseexplorer_x_bg.wasm b/implementations/wasm/X/pkg/noiseexplorer_x_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsSY1(u@{}@291fbY63i&hh>1>`wnX0b4+_&L%!=Q z>Mu}3Re}&Rd%r4MLdHAHFw`H{n_)|*-oQSt_-PN}krIQFx_K;75fC5j0DKi#4Xg^5 zZvPh8tt>V{*?-9*T>MM+;dE1Rw@U{_fnW?O86@xpQc47=msr3#@}?N-qQBuEP!pkC zOrf+={SqaFY;Q^lv~ej)6NN%e2GDdC@o%vZjm!m3GHA4xCO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 z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/X/pkg/noiseexplorer_x_wasm.d.ts b/implementations/wasm/X/pkg/noiseexplorer_x_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/X/pkg/noiseexplorer_x_wasm.d.ts +++ b/implementations/wasm/X/pkg/noiseexplorer_x_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/X/pkg/noiseexplorer_x_wasm.js b/implementations/wasm/X/pkg/noiseexplorer_x_wasm.js index 6ab2dddcb..030729775 100755 --- a/implementations/wasm/X/pkg/noiseexplorer_x_wasm.js +++ b/implementations/wasm/X/pkg/noiseexplorer_x_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_x_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/X/pkg/noiseexplorer_x_wasm_bg.wasm b/implementations/wasm/X/pkg/noiseexplorer_x_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%F{fcQa_VlFb95FaoRH%f`oP5 ztQ;-`N7-C{wsN@qq^o~rM)`q2xN@njskw5LCcel(FgQ8ZV#>~|cznVi{a0zJ1UnZ? z#JB{3l*@GBWC2b99M}93oT$K+_6u+*8t#p^f~i}tZ_6TBxOiZ?!R$&yX4yFXpP}!7ZgXI|&sdaw2&b>gK#$S-b-&g^Ti}U4 z##3rEx?e+c4gw1`^fhi9IFe+bXSi5XCdzu$ybs%oR$jj02COgALDztT`XEUjqY^74 zgfrbm@&N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8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_x_wasm_bg.wasm", "noiseexplorer_x_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_x_wasm.js", "types": "noiseexplorer_x_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/X1K/Cargo.toml b/implementations/wasm/X1K/Cargo.toml index a1814aef6..8afe8f909 100755 --- a/implementations/wasm/X1K/Cargo.toml +++ b/implementations/wasm/X1K/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1k_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/X1K/README.md b/implementations/wasm/X1K/README.md index 87bbe1d33..9ebaa014a 100755 --- a/implementations/wasm/X1K/README.md +++ b/implementations/wasm/X1K/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1k_wasm (v1.0.3) +# noiseexplorer_x1k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1K/pkg/README.md b/implementations/wasm/X1K/pkg/README.md index 9cd53c587..9ebaa014a 100755 --- a/implementations/wasm/X1K/pkg/README.md +++ b/implementations/wasm/X1K/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1k_wasm (v1.0.0) +# noiseexplorer_x1k_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1K/pkg/noiseexplorer_x1k_bg.wasm b/implementations/wasm/X1K/pkg/noiseexplorer_x1k_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsSY1(u@{}@291fbY63i&hh>1>`wnX0b4+_&L%!=Q z>Mu}3Re}&Rd%r4MLdHAHFw`H{n_)|*-oQSt_-PN}krIQFx_K;75fC5j0DKi#4Xg^5 zZvPh8tt>V{*?-9*T>MM+;dE1Rw@U{_fnW?O86@xpQc47=msr3#@}?N-qQBuEP!pkC zOrf+={SqaFY;Q^lv~ej)6NN%e2GDdC@o%vZjm!m3GHA4xCOT0)M$T_;Zknk3uj29R zl1)r@wnXdT6+2VBET~eMVWLnTp-MINaIT{qB^m{h^aO#S z6M}jPZNZ38!ib*I)K_4hFVEEDO9dL#q3+_M0IcWT?$r)n;W44%1Lg1}$*$laq4q_^yPh zafvs_-@IEd(lcXMtjqRc<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?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.d.ts b/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.d.ts +++ b/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.js b/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.js index 6ab2dddcb..d727341c7 100755 --- a/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.js +++ b/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_x1k_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm_bg.wasm b/implementations/wasm/X1K/pkg/noiseexplorer_x1k_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw zv@6L480&t67MM1*EcElQUJ`u3_z(y!?du!L+LnO%pqVIOASD_G8{(8Z(l5S!Sw3K< zpEBId*%*gw4Aa_`>n!pE36CZLpkd>6BnZR|lz@YQCW?`PBXjJ2A-uW%;p>+$2QT)4 zevWmkhJ=wUxM{)9wzOLozld`MwHr#bYRFL}OiF`XSO3KTueOu}@zvJjCda6|n z2pBhnBHvwe{W`h+D!CsLK!OKbKSe4wL((FvRwWbey9VhS;%gA=l|(-oyQ@aSCvrW~ z&z=EA(_bOCLHbAD{7JlHeGUZu?^jVRd?C6%2q5;a1y<4$W#O=n7=tLri`1!2wzkGd zKq_ciz$js*e?zv=;1XkYprWnAhSa}6&es743XJ)-XS+)3XYw=Vz%MIKd*(uru&$ex z!-e1|o6FBu4ws*F_0P;GKM)94F10l^SB}!e7a0f!C&yY$*?AR@Pxzz%C@qy>=VFN% zmmrXGnGT#RzzKlknqPtw6}ZxV0S-mOz45=`P;bie9i&!Kbl9+8v*OiUgUghl{*@Et z2NDFk+9GLDi7G)p8>8mo(W3+zVueHz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*NwX-g&rnRspB~cdF^2A zDcj^kILFd)c+IoaoiIF+<_Lpg^9eM=Majg=NrtY+ENO*y29_KoR?- zQ*)B$WY$2g`;*}6h^V0ssY6e0Wth2^Ls`w~>1omqo_R~lwx@Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_x1k_wasm_bg.wasm", "noiseexplorer_x1k_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_x1k_wasm.js", "types": "noiseexplorer_x1k_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/X1K1/Cargo.toml b/implementations/wasm/X1K1/Cargo.toml index f299efdbd..1119d12b8 100755 --- a/implementations/wasm/X1K1/Cargo.toml +++ b/implementations/wasm/X1K1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1k1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/X1K1/README.md b/implementations/wasm/X1K1/README.md index 956638031..d629b5d49 100755 --- a/implementations/wasm/X1K1/README.md +++ b/implementations/wasm/X1K1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1k1_wasm (v1.0.3) +# noiseexplorer_x1k1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1K1/pkg/README.md b/implementations/wasm/X1K1/pkg/README.md index 43c1569af..d629b5d49 100755 --- a/implementations/wasm/X1K1/pkg/README.md +++ b/implementations/wasm/X1K1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1k1_wasm (v1.0.0) +# noiseexplorer_x1k1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_bg.wasm b/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1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z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.d.ts b/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.d.ts +++ b/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.js b/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.js index 6ab2dddcb..405c43494 100755 --- a/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.js +++ b/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_x1k1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm_bg.wasm b/implementations/wasm/X1K1/pkg/noiseexplorer_x1k1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6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a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_x1k1_wasm_bg.wasm", "noiseexplorer_x1k1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_x1k1_wasm.js", "types": "noiseexplorer_x1k1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/X1N/Cargo.toml b/implementations/wasm/X1N/Cargo.toml index d9261a180..c9852c420 100755 --- a/implementations/wasm/X1N/Cargo.toml +++ b/implementations/wasm/X1N/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1n_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/X1N/README.md b/implementations/wasm/X1N/README.md index 78e8ae7d8..3143ece1e 100755 --- a/implementations/wasm/X1N/README.md +++ b/implementations/wasm/X1N/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1n_wasm (v1.0.3) +# noiseexplorer_x1n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1N/pkg/README.md b/implementations/wasm/X1N/pkg/README.md index 0df7ae0d8..3143ece1e 100755 --- a/implementations/wasm/X1N/pkg/README.md +++ b/implementations/wasm/X1N/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1n_wasm (v1.0.0) +# noiseexplorer_x1n_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1N/pkg/noiseexplorer_x1n_bg.wasm b/implementations/wasm/X1N/pkg/noiseexplorer_x1n_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37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#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.d.ts b/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.d.ts +++ b/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.js b/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.js index 6ab2dddcb..643296816 100755 --- a/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.js +++ b/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_x1n_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm_bg.wasm b/implementations/wasm/X1N/pkg/noiseexplorer_x1n_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw z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Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_x1n_wasm_bg.wasm", "noiseexplorer_x1n_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_x1n_wasm.js", "types": "noiseexplorer_x1n_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/X1X/Cargo.toml b/implementations/wasm/X1X/Cargo.toml index 13203e244..de9463a06 100755 --- a/implementations/wasm/X1X/Cargo.toml +++ b/implementations/wasm/X1X/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1x_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/X1X/README.md b/implementations/wasm/X1X/README.md index 2756a3a84..b43e81adc 100755 --- a/implementations/wasm/X1X/README.md +++ b/implementations/wasm/X1X/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1x_wasm (v1.0.3) +# noiseexplorer_x1x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1X/pkg/README.md b/implementations/wasm/X1X/pkg/README.md index 5fe40a9d0..b43e81adc 100755 --- a/implementations/wasm/X1X/pkg/README.md +++ b/implementations/wasm/X1X/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1x_wasm (v1.0.0) +# noiseexplorer_x1x_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1X/pkg/noiseexplorer_x1x_bg.wasm b/implementations/wasm/X1X/pkg/noiseexplorer_x1x_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsSY1(u@{}@291fbY63i&hh>1>`wnX0b4+_&L%!=Q z>Mu}3Re}&Rd%r4MLdHAHFw`H{n_)|*-oQSt_-PN}krIQFx_K;75fC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Hs*r1VYItalJ`~qFo+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.d.ts b/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.d.ts +++ b/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.js b/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.js index 6ab2dddcb..a76fb1aac 100755 --- a/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.js +++ b/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_x1x_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm_bg.wasm b/implementations/wasm/X1X/pkg/noiseexplorer_x1x_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw zv@6L480&t67MM1*EcElQUJ`u3_z(y!?du!L+LnO%pqVIOASD_G8{(8Z(l5S!Sw3K< zpEBId*%*gw4Aa_`>n!pE36CZLpkd>6BnZR|lz@YQCW?`PBXjJ2A-uW%;p>+$2QT)4 zevWmkhJ=wUxM{)9wzOLozld`MwHr#bYRFL}OiF`XSO3KTueOu}@zvJjCda6|n z2pBhnBHvwe{W`h+D!CsLK!OKbKSe4wL((FvRwWbey9VhS;%gA=l|(-oyQ@aSCvrW~ z&z=EA(_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N{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_x1x_wasm_bg.wasm", "noiseexplorer_x1x_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_x1x_wasm.js", "types": "noiseexplorer_x1x_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/X1X1/Cargo.toml b/implementations/wasm/X1X1/Cargo.toml index d56a7225e..abef5ada4 100755 --- a/implementations/wasm/X1X1/Cargo.toml +++ b/implementations/wasm/X1X1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_x1x1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/X1X1/README.md b/implementations/wasm/X1X1/README.md index ea3d9b6c7..8d216051b 100755 --- a/implementations/wasm/X1X1/README.md +++ b/implementations/wasm/X1X1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1x1_wasm (v1.0.3) +# noiseexplorer_x1x1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1X1/pkg/README.md b/implementations/wasm/X1X1/pkg/README.md index af53bdfb4..8d216051b 100755 --- a/implementations/wasm/X1X1/pkg/README.md +++ b/implementations/wasm/X1X1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_x1x1_wasm (v1.0.0) +# noiseexplorer_x1x1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_bg.wasm b/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsSY1(u@{}@291fbY63i&hh>1>`wnX0b4+_&L%!=Q z>Mu}3Re}&Rd%r4MLdHAHFw`H{n_)|*-oQSt_-PN}krIQFx_K;75fC5j0DKi#4Xg^5 zZvPh8tt>V{*?-9*T>MM+;dE1Rw@U{_fnW?O86@xpQc47=msr3#@}?N-qQBuEP!pkC zOrf+={SqaFY;Q^lv~ej)6NN%e2GDdC@o%vZjm!m3GHA4xCOT0)M$T_;Zknk3uj29R zl1)r@wnXdT6+2VBET~eMVWLnTp-MINaIT{qB^m{h^aO#S z6M}jPZNZ38!ib*I)K_4hFVEEDO9dL#q3+_M0IcWT?$r)n;W44%1L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XoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.d.ts b/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.d.ts index ec1ab41dc..56d20050f 100755 --- a/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.d.ts +++ b/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.js b/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.js index 6ab2dddcb..9b8091c25 100755 --- a/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.js +++ b/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_x1x1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm_bg.wasm b/implementations/wasm/X1X1/pkg/noiseexplorer_x1x1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw zv@6L480&t67MM1*EcElQUJ`u3_z(y!?du!L+LnO%pqVIOASD_G8{(8Z(l5S!Sw3K< zpEBId*%*gw4Aa_`>n!pE36CZLpkd>6BnZR|lz@YQCW?`PBXjJ2A-uW%;p>+$2QT)4 zevWmkhJ=wUxM{)9wzOLozld`MwHr#bYRFL}OiF`XSO3KTueOu}@zvJjCda6|n z2pBhnBHvwe{W`h+D!CsLK!OKbKSe4wL((FvRwWbey9VhS;%gA=l|(-oyQ@aSCvrW~ z&z=EA(_bOCLHbAD{7JlHeGUZu?^jVRd?C6%2q5;a1y<4$W#O=n7=tLri`1!2wzkGd zKq_ciz$js*e?zv=;1XkYprWnAhSa}6&es743XJ)-XS+)3XYw=Vz%MIKd*(uru&$ex z!-e1|o6FBu4ws*F_0P;GKM)94F10l^SB}!e7a0f!C&yY$*?AR@Pxzz%C@qy>=VFN% zmmrXGnGT#RzzKlknqPtw6}ZxV0S-mOz45=`P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", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XK/Cargo.toml b/implementations/wasm/XK/Cargo.toml index f90202c15..ab6307cbf 100755 --- a/implementations/wasm/XK/Cargo.toml +++ b/implementations/wasm/XK/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xk_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XK/README.md b/implementations/wasm/XK/README.md index acab4e6c6..ba5a791b7 100755 --- a/implementations/wasm/XK/README.md +++ b/implementations/wasm/XK/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xk_wasm (v1.0.3) +# noiseexplorer_xk_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XK/pkg/README.md b/implementations/wasm/XK/pkg/README.md index d1b21d767..ba5a791b7 100755 --- a/implementations/wasm/XK/pkg/README.md +++ b/implementations/wasm/XK/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xk_wasm (v1.0.0) +# noiseexplorer_xk_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XK/pkg/noiseexplorer_xk_bg.wasm b/implementations/wasm/XK/pkg/noiseexplorer_xk_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015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FJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.d.ts b/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.d.ts +++ b/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.js b/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.js index 6ab2dddcb..c8eb03abb 100755 --- a/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.js +++ b/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xk_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm_bg.wasm b/implementations/wasm/XK/pkg/noiseexplorer_xk_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gq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WY$2g`;*}6h^V0ssY6e0Wth2^Ls`w~>1omqo_R~lwx@Q%=n&Iuu4%0Kc$ia| z7vNOL`VOmzERv&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xk_wasm_bg.wasm", "noiseexplorer_xk_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xk_wasm.js", "types": "noiseexplorer_xk_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XK1/Cargo.toml b/implementations/wasm/XK1/Cargo.toml index 8c628ed33..ffae2bb97 100755 --- a/implementations/wasm/XK1/Cargo.toml +++ b/implementations/wasm/XK1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xk1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XK1/README.md b/implementations/wasm/XK1/README.md index 47813cf9d..cab89b6f2 100755 --- a/implementations/wasm/XK1/README.md +++ b/implementations/wasm/XK1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xk1_wasm (v1.0.3) +# noiseexplorer_xk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XK1/pkg/README.md b/implementations/wasm/XK1/pkg/README.md index 37c8a284b..cab89b6f2 100755 --- a/implementations/wasm/XK1/pkg/README.md +++ b/implementations/wasm/XK1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xk1_wasm (v1.0.0) +# noiseexplorer_xk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XK1/pkg/noiseexplorer_xk1_bg.wasm b/implementations/wasm/XK1/pkg/noiseexplorer_xk1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`J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R240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.d.ts b/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.d.ts +++ b/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.js b/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.js index 6ab2dddcb..91507e99e 100755 --- a/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.js +++ b/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xk1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm_bg.wasm b/implementations/wasm/XK1/pkg/noiseexplorer_xk1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}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Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xk1_wasm_bg.wasm", "noiseexplorer_xk1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xk1_wasm.js", "types": "noiseexplorer_xk1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XKpsk3/Cargo.toml b/implementations/wasm/XKpsk3/Cargo.toml index b63aef65b..33e430c6e 100755 --- a/implementations/wasm/XKpsk3/Cargo.toml +++ b/implementations/wasm/XKpsk3/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xkpsk3_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XKpsk3/README.md b/implementations/wasm/XKpsk3/README.md index 78dee328e..2e6c6c428 100755 --- a/implementations/wasm/XKpsk3/README.md +++ b/implementations/wasm/XKpsk3/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xkpsk3_wasm (v1.0.3) +# noiseexplorer_xkpsk3_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XKpsk3/pkg/README.md b/implementations/wasm/XKpsk3/pkg/README.md index 0913c1a0a..2e6c6c428 100755 --- a/implementations/wasm/XKpsk3/pkg/README.md +++ b/implementations/wasm/XKpsk3/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xkpsk3_wasm (v1.0.0) +# noiseexplorer_xkpsk3_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_bg.wasm b/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+L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!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.d.ts b/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.d.ts +++ b/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.js b/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.js index 6ab2dddcb..193a37763 100755 --- a/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.js +++ b/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xkpsk3_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm_bg.wasm b/implementations/wasm/XKpsk3/pkg/noiseexplorer_xkpsk3_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6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v&-uOPWH0*X8k-JHB28#pV^ITt4Zae&?`Mx%S@K#N-tT_P}PMWcY} zw%pJMmZFwru}s4*3^Q*a4?iSaB=`2pILFXs5}sENjXLO>Y}a!ryxO7@0hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xkpsk3_wasm_bg.wasm", "noiseexplorer_xkpsk3_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xkpsk3_wasm.js", "types": "noiseexplorer_xkpsk3_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XN/Cargo.toml b/implementations/wasm/XN/Cargo.toml index b31306efc..14e3ca531 100755 --- a/implementations/wasm/XN/Cargo.toml +++ b/implementations/wasm/XN/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xn_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XN/README.md b/implementations/wasm/XN/README.md index c8de8e94d..4b7190dd5 100755 --- a/implementations/wasm/XN/README.md +++ b/implementations/wasm/XN/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xn_wasm (v1.0.3) +# noiseexplorer_xn_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XN/pkg/README.md b/implementations/wasm/XN/pkg/README.md index 833654a76..4b7190dd5 100755 --- a/implementations/wasm/XN/pkg/README.md +++ b/implementations/wasm/XN/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xn_wasm (v1.0.0) +# noiseexplorer_xn_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XN/pkg/noiseexplorer_xn_bg.wasm b/implementations/wasm/XN/pkg/noiseexplorer_xn_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z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- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.d.ts b/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.d.ts +++ b/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.js b/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.js index 6ab2dddcb..136b52a4e 100755 --- a/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.js +++ b/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xn_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm_bg.wasm b/implementations/wasm/XN/pkg/noiseexplorer_xn_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y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9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xn_wasm_bg.wasm", "noiseexplorer_xn_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xn_wasm.js", "types": "noiseexplorer_xn_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XNpsk3/Cargo.toml b/implementations/wasm/XNpsk3/Cargo.toml index 6601e750f..2b4bcc0e1 100755 --- a/implementations/wasm/XNpsk3/Cargo.toml +++ b/implementations/wasm/XNpsk3/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xnpsk3_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XNpsk3/README.md b/implementations/wasm/XNpsk3/README.md index 8b3d972fb..702e54250 100755 --- a/implementations/wasm/XNpsk3/README.md +++ b/implementations/wasm/XNpsk3/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xnpsk3_wasm (v1.0.3) +# noiseexplorer_xnpsk3_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XNpsk3/pkg/README.md b/implementations/wasm/XNpsk3/pkg/README.md index 21a824538..702e54250 100755 --- a/implementations/wasm/XNpsk3/pkg/README.md +++ b/implementations/wasm/XNpsk3/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xnpsk3_wasm (v1.0.0) +# noiseexplorer_xnpsk3_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_bg.wasm b/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n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F~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.d.ts b/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.d.ts +++ b/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.js b/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.js index 6ab2dddcb..0bbfeda8d 100755 --- a/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.js +++ b/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xnpsk3_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm_bg.wasm b/implementations/wasm/XNpsk3/pkg/noiseexplorer_xnpsk3_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38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hn`uma}ts zmX3PW&Z9jr(r9QTN};Y$Y&j;B#v|4ba4x_gv8}xJk#e63d-~2Vhzti;sL#!kfq-VI>sdvd6+3=FP6g(mqMenTBR0X%$tB>S&}XndBM4?T z7EX_BH;4Ysi>#;YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xnpsk3_wasm_bg.wasm", "noiseexplorer_xnpsk3_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xnpsk3_wasm.js", "types": "noiseexplorer_xnpsk3_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XX/Cargo.toml b/implementations/wasm/XX/Cargo.toml index 1b530f50b..bd15cd9e6 100755 --- a/implementations/wasm/XX/Cargo.toml +++ b/implementations/wasm/XX/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xx_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XX/README.md b/implementations/wasm/XX/README.md index 34efbadfb..2615ffb60 100755 --- a/implementations/wasm/XX/README.md +++ b/implementations/wasm/XX/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xx_wasm (v1.0.3) +# noiseexplorer_xx_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XX/pkg/README.md b/implementations/wasm/XX/pkg/README.md index 7e907521e..2615ffb60 100755 --- a/implementations/wasm/XX/pkg/README.md +++ b/implementations/wasm/XX/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xx_wasm (v1.0.0) +# noiseexplorer_xx_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XX/pkg/noiseexplorer_xx_bg.wasm b/implementations/wasm/XX/pkg/noiseexplorer_xx_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9Qt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ementations/wasm/XX/pkg/noiseexplorer_xx_wasm.d.ts b/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm.d.ts +++ b/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm.js b/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm.js index 6ab2dddcb..92e696d28 100755 --- a/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm.js +++ b/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xx_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm_bg.wasm b/implementations/wasm/XX/pkg/noiseexplorer_xx_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfv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YEGF#4&vKz)m?fOO_E^&v)s?eyd5{7-1Xh@=S)z#ss_hjVN~FJx zQ&q-sGX;GC5KPIw{iz#D(IhcC5;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xx_wasm_bg.wasm", "noiseexplorer_xx_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xx_wasm.js", "types": "noiseexplorer_xx_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XX1/Cargo.toml b/implementations/wasm/XX1/Cargo.toml index 98583addd..d3c7bcd3c 100755 --- a/implementations/wasm/XX1/Cargo.toml +++ b/implementations/wasm/XX1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xx1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XX1/README.md b/implementations/wasm/XX1/README.md index a1019faf4..c8610bf24 100755 --- a/implementations/wasm/XX1/README.md +++ b/implementations/wasm/XX1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xx1_wasm (v1.0.3) +# noiseexplorer_xx1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XX1/pkg/README.md b/implementations/wasm/XX1/pkg/README.md index c21771d1f..c8610bf24 100755 --- a/implementations/wasm/XX1/pkg/README.md +++ b/implementations/wasm/XX1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xx1_wasm (v1.0.0) +# noiseexplorer_xx1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XX1/pkg/noiseexplorer_xx1_bg.wasm b/implementations/wasm/XX1/pkg/noiseexplorer_xx1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsS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asm.d.ts +++ b/implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm.js b/implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm.js index 6ab2dddcb..fad4790aa 100755 --- a/implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm.js +++ b/implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xx1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm_bg.wasm b/implementations/wasm/XX1/pkg/noiseexplorer_xx1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiYT*mf^+5o!e=V?*mM9B{b;KA%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T-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xx1_wasm_bg.wasm", "noiseexplorer_xx1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xx1_wasm.js", "types": "noiseexplorer_xx1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/XXpsk3/Cargo.toml b/implementations/wasm/XXpsk3/Cargo.toml index ce219abdd..d5d9e8ecc 100755 --- a/implementations/wasm/XXpsk3/Cargo.toml +++ b/implementations/wasm/XXpsk3/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xxpsk3_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/XXpsk3/README.md b/implementations/wasm/XXpsk3/README.md index 50bb67808..c42c80626 100755 --- a/implementations/wasm/XXpsk3/README.md +++ b/implementations/wasm/XXpsk3/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xxpsk3_wasm (v1.0.3) +# noiseexplorer_xxpsk3_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XXpsk3/pkg/README.md b/implementations/wasm/XXpsk3/pkg/README.md index 9f2174fde..c42c80626 100755 --- a/implementations/wasm/XXpsk3/pkg/README.md +++ b/implementations/wasm/XXpsk3/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xxpsk3_wasm (v1.0.0) +# noiseexplorer_xxpsk3_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_bg.wasm b/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsSY1(u@{}@291fbY63i&hh>1>`wnX0b4+_&L%!=Q z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PQ$|Q8$ofG^(+FJhV*|N5s?M|T9Ovi)meEvuHO5w{j7`p;l z!GorHs*r1VYItalJ`~qFo+O?ErPzJzkU;l(i`hvYAGUAr3Q!P>-S1^Hxhsz2=|WO~ zaF%4b+{u(W{O)ND_8RQG5BU=04`G<3i3d4W{)vkXJTKs(HpO)n&(a_w$da8rKItFJ z1SXUCFiytBeUTl@d^pWc{sG%BLjSLjFGKzvg+chP;h_&<`4S%dB9x~hTNG3bgKRNN z=RHyENu+Bg#&aPCn4*5Eh!Ms*yul#Y+mK}M|K;Npc8HIUAXoWVC2x)&igM>5O9583 zmjTU-I4|ZRF3LzH;-?P#8*F_UHa~+T9{&t^1G0()5)am?Wm&f6SgzHvJj=HNE3~?{ zW!tu6yLQL+Y~K#-(C#{xV>^!HIvvMzd?#>1r|Vj-?K-aOc3jW(-M|gqZpZ4_9jD`V zIvua$cY;pX>3WuDdyeON9nbT8FYrRI>s!9!H47@FdcDimx1NmA z>t(OEmjrU)$uyC%l}g(k@^4-$U$!onjc0TR^{2QWWIx$k%=TfV6Q*I}TFJl-gEX;X z{l6Gl%%P9CZs`Z4O2e|(?KYWr{0At&v+HCKJQI-4U6d>?x#|5P_yZZ>MyUT zUJtWHuczM6`*e*1M9}FbIA20fCWFMY;w#RxmJG5S@AQ4TfU(AR240$k(o6h-FOzuv z)qh=6I=~eQ-Bfl{>7*f!xbD#LQ*#4Bq|=KC*=O`Gfh&i3mM#)p$-Fj=XQM?tlA7^- zATb=v4(pgs@WL+Bt-*c0LI{&r>}}WEwnW=a9M?-d-x5&mZdu-zW8JQv#8aqMtnF~y Ws;}PD*UEcZv}1diIDs{EZvPVl=>)z2 diff --git a/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.d.ts b/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.d.ts index ec1ab41dc..248fa94d4 100755 --- a/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.d.ts +++ b/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; + readonly __wbg_noisesession_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.js b/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.js index 6ab2dddcb..683eca666 100755 --- a/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.js +++ b/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xxpsk3_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm_bg.wasm b/implementations/wasm/XXpsk3/pkg/noiseexplorer_xxpsk3_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..aa1e0cc9bbc866f05f302355e78d9042b595f474 GIT binary patch literal 2260 zcmZ`*O>f&q5S?9;vK&%18>Fpkx$ufb0SBoJB>`;bQg{m_Mi2xAdM|8Bre#txWs#H= z14Wd6oO;Tw1$ybRha7t7p+I}cF}L;~xo?(~QZ$Gqle@F?@#gK!*c9gHf{4Us?O4v| zbS%uTm>&}z6JFLFQn@ayS-0;W9nHFNdeV>5qv9+Z&4?_|6}E6ll4VKZSc2YN`9ZAI z&ZF~Db}8u{Ht8P?qRXSxEQ-jwz7$-9aaIW{t&4n63EnHUF0yzU7SU_#82$TcV*oZE>@)dMA^-jZ5=4P7tYC5 zj;38nF2Gp#8??Z*sb!&`fAf;y1IC9yXlY;HP}a5t%m>Xx0Rt(~FxU{M+>w6q{mb$J zGyRm|ZqCLyTw|Elu3Tr4A4qsK2>=ZnuOmSqW}pNd3^Y-U3>=wb_bcJe^-tfvggJPz z5A<`aTQww%WWh}fezv9EviL=uE2!O2qE$nVB4JV*r8a|Qh zk$(0JD4PBXxed}k^X6~j9qV%-=>NEiY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;xd+QDWJ$-aa&Iu( zmy9CPT-kY~vkRqs)2M86(aolqn_Xb;+y7wtBO2*tZGVv_bu}$-99OD7M7AbL07H?$+s#qT#sS3x@5e-rSk= zcM;@fHLNy^ezQ@mR>Gzq$bShk>GwMQ-DiRn{6bg>{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xxpsk3_wasm_bg.wasm", "noiseexplorer_xxpsk3_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xxpsk3_wasm.js", "types": "noiseexplorer_xxpsk3_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/implementations/wasm/Xpsk1/Cargo.toml b/implementations/wasm/Xpsk1/Cargo.toml index 41be1a498..2484eb719 100755 --- a/implementations/wasm/Xpsk1/Cargo.toml +++ b/implementations/wasm/Xpsk1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "noiseexplorer_xpsk1_wasm" -version = "1.0.3" +version = "1.0.4" authors = ["Symbolic Software "] edition = "2018" @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1" diff --git a/implementations/wasm/Xpsk1/README.md b/implementations/wasm/Xpsk1/README.md index 52a5d48d9..1c2cde533 100755 --- a/implementations/wasm/Xpsk1/README.md +++ b/implementations/wasm/Xpsk1/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xpsk1_wasm (v1.0.3) +# noiseexplorer_xpsk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/Xpsk1/pkg/README.md b/implementations/wasm/Xpsk1/pkg/README.md index 49d387c66..1c2cde533 100755 --- a/implementations/wasm/Xpsk1/pkg/README.md +++ b/implementations/wasm/Xpsk1/pkg/README.md @@ -1,4 +1,4 @@ -# noiseexplorer_xpsk1_wasm (v1.0.0) +# noiseexplorer_xpsk1_wasm (v1.0.4) This implementation is generated by [Noise Explorer](https://noiseexplorer.com) and can be compiled to a [WebAssembly](https://webassembly.org) binary by following the instructions below. # Dev Dependencies: diff --git a/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_bg.wasm b/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_bg.wasm old mode 100755 new mode 100644 index e2457061f19604be12a10fe232015de3837c24bc..1427af46efdef6fe00de189c2c1a38e2a3686e83 GIT binary patch literal 3086 zcmbtW&yV9s6|O2foy<7d$qch>L(gg|Mnc_!?)bNzkye^QnjX+<83`>1PTh{C*7l?)i9flCh6>`JSp-O<63hIuLWlfjkEjB zAMxhad3v4~*Mhx8+LNQR^!jLAq$v{*UN2n4S+QPRYhBFG)(dafS{FsOjLY=R?uYC3 z#c-M>ZGFtO8ZFr&lNr!@HkquCvh zE_s(RXchuHjvx4W=OEA!>rPtcZB*37HSrR(!n^r1$06T zCrt4o5IRL(bJf;Ca+f2q>gU82-Kq@~>9QtDJXK%7ssP3}zsf5xipyvEQ}x?AZYd5s zuR+j6zzkS`LjaY!B1jr-B}fpc)WZ&*Hjt=X+YLZM?AZFB!)_Xt&#H3Nui?GAA#!*! zt3192yCGHbLqtmaREe&Zt0zPKsSY1(u@{}@291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sk1_wasm.d.ts +++ b/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm.d.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** */ export class Key { @@ -14,13 +15,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -48,13 +49,35 @@ export class PublicKey { free(): void; } +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly __wbg_noisesession_free: (a: number) => void; + readonly __wbg_key_free: (a: number) => void; + readonly __wbg_keypair_free: (a: number) => void; + readonly __wbg_psk_free: (a: number) => void; + readonly __wbg_privatekey_free: (a: number) => void; + readonly __wbg_publickey_free: (a: number) => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ +export function initSync(module: SyncInitInput): InitOutput; + /** -* If `module_or_path` is {RequestInfo}, makes a request and +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * -* @param {RequestInfo | BufferSource | WebAssembly.Module} module_or_path +* @param {InitInput | Promise} module_or_path * -* @returns {Promise} +* @returns {Promise} */ -export default function init (module_or_path?: RequestInfo | BufferSource | WebAssembly.Module): Promise; - \ No newline at end of file +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm.js b/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm.js index 6ab2dddcb..bb8f4d942 100755 --- a/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm.js +++ b/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm.js @@ -1,27 +1,35 @@ - let wasm; -let cachedTextDecoder = new TextDecoder('utf-8'); +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); } - return cachegetUint8Memory; + return cachedUint8Memory0; } -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } /** */ export class Key { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_key_free(ptr); } } @@ -29,10 +37,15 @@ export class Key { */ export class Keypair { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_keypair_free(ptr); } } @@ -41,13 +54,13 @@ export class Keypair { * and remote parties before, during, and after a handshake. * * It contains: -* - `hs`: Keeps track of the local party\'s state while a handshake is being +* - `hs`: Keeps track of the local party's state while a handshake is being * performed. * - `h`: Stores the handshake hash output after a successful handshake in a * Hash object. Is initialized as array of 0 bytes. -* - `cs1`: Keeps track of the local party\'s post-handshake state. Contains a +* - `cs1`: Keeps track of the local party's post-handshake state. Contains a * cryptographic key and a nonce. -* - `cs2`: Keeps track of the remote party\'s post-handshake state. Contains a +* - `cs2`: Keeps track of the remote party's post-handshake state. Contains a * cryptographic key and a nonce. * - `mc`: Keeps track of the total number of incoming and outgoing messages, * including those sent during a handshake. @@ -58,10 +71,15 @@ export class Keypair { */ export class NoiseSession { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_noisesession_free(ptr); } } @@ -69,10 +87,15 @@ export class NoiseSession { */ export class PrivateKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_privatekey_free(ptr); } } @@ -80,10 +103,15 @@ export class PrivateKey { */ export class Psk { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_psk_free(ptr); } } @@ -91,59 +119,107 @@ export class Psk { */ export class PublicKey { - free() { - const ptr = this.ptr; - this.ptr = 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + + return ptr; + } + free() { + const ptr = this.__destroy_into_raw(); wasm.__wbg_publickey_free(ptr); } } -function init(module) { - if (typeof module === 'undefined') { - module = import.meta.url.replace(/\.js$/, '_bg.wasm'); +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - let result; +} + +function __wbg_get_imports() { const imports = {}; imports.wbg = {}; imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); + throw new Error(getStringFromWasm0(arg0, arg1)); }; - if (module instanceof URL || typeof module === 'string' || module instanceof Request) { + return imports; +} - const response = fetch(module); - if (typeof WebAssembly.instantiateStreaming === 'function') { - result = WebAssembly.instantiateStreaming(response, imports) - .catch(e => { - console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - return response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - }); - } else { - result = response - .then(r => r.arrayBuffer()) - .then(bytes => WebAssembly.instantiate(bytes, imports)); - } - } else { +function __wbg_init_memory(imports, maybe_memory) { - result = WebAssembly.instantiate(module, imports) - .then(result => { - if (result instanceof WebAssembly.Instance) { - return { instance: result, module }; - } else { - return result; - } - }); +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedUint8Memory0 = null; + + + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); } - return result.then(({instance, module}) => { - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - return wasm; - }); + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); } -export default init; +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + if (typeof input === 'undefined') { + input = new URL('noiseexplorer_xpsk1_wasm_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} +export { initSync } +export default __wbg_init; diff --git a/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm_bg.wasm b/implementations/wasm/Xpsk1/pkg/noiseexplorer_xpsk1_wasm_bg.wasm old mode 100755 new mode 100644 index 9b16a35f0fa5eda600bdd8eabd51dfbbaaa1a25f..2db526943dab5b6b0024c2c93a7a3e3ae456b81d GIT binary patch literal 2260 zcmZ`*&u<$=6n-p0ytS*ijd4$62DQmW#}ZKWi=pbSzQRaJ$=9VKgLnT2@XB>2LDm`-t5{1Dq?4M=FR)@y>H%o35EH&AR@6@JC^e~ z9Sid-=Ep?GgqJmkRIUqa*6sU8N3(96p7f*is5r|;Ga}1#g)JPCWLZ);mY}y+z7s38 z^XPn(T}pb7P5MXaD9$5%@_3XUon}!))?4MtAiAss*O!8eFwXw1b&(G$!8@haMHWxP zB6@9oqmoa$!?^caeC<`k{T;yOinir?%aRB3KoM`e2R2svhW7cH1Y%oKU^f$f$%fF> z5}tHfvmQue5QtsrDWT-9tb4-6inO07yV17)`yB?G~(q!N4}jVqjD%VFfgIl0Qw zv@6L480&t67MM1*EcElQUJ`u3_z(y!?du!L+LnO%pqVIOASD_G8{(8Z(l5S!Sw3K< zpEBId*%*gw4Aa_`>n!pE36CZLpkd>6BnZR|lz@YQCW?`PBXjJ2A-uW%;p>+$2QT)4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{8m`5RKrF!QqNp-o#)(g6EC`? zCgDu8Ru3bqL8>st^}Ig2bJuG4I=N6DPpP!?sc_AaJqlmn!8}Pz~J-K!m+BgzOKx z?Jw*P2jQd{4M!r?3;OLz(2ltJ7);cxrw`Y6s|VzN{1LWuNKydr8QsYi-=wd xOJ!ffbYs;ot*-mm6VspvGsj=6uK8&~w>lHyvcI;zcC)JUK`{(Nf1?sz{}b" ], - "version": "1.0.0", + "version": "1.0.4", "files": [ "noiseexplorer_xpsk1_wasm_bg.wasm", "noiseexplorer_xpsk1_wasm.js", @@ -11,5 +11,7 @@ ], "module": "noiseexplorer_xpsk1_wasm.js", "types": "noiseexplorer_xpsk1_wasm.d.ts", - "sideEffects": "false" + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/src/package.json b/src/package.json index 222d1f4f2..771cd6d36 100755 --- a/src/package.json +++ b/src/package.json @@ -1,13 +1,13 @@ { "name": "NoiseExplorer", - "version": "1.0.3", + "version": "1.0.4", "description": "Noise Pattern Formal Verification Model Generator.", "author": "Symbolic Software", "main": "noiseExplorer.js", - "repository": "https://source.symbolic.software/noiseexplorer/noiseexplorer", + "repository": "https://github.com/symbolicsoft/noiseexplorer", "license": "GPL-3.0", "dependencies": { - "conventional-commits-parser": "^3.2.1", + "conventional-commits-parser": "^3.2.4", "minimist": "latest", "pegjs": "^0.10.0" } diff --git a/src/versions.json b/src/versions.json index 24da9270f..6803e8fde 100755 --- a/src/versions.json +++ b/src/versions.json @@ -1,26 +1,26 @@ { "major_engine": 1, "minor_engine": 0, - "patch_engine": 3, + "patch_engine": 4, "major_go": 1, "minor_go": 0, - "patch_go": 3, + "patch_go": 4, "major_rust": 1, "minor_rust": 0, - "patch_rust": 3, + "patch_rust": 4, "major_wasm": 1, "minor_wasm": 0, - "patch_wasm": 3, + "patch_wasm": 4, "major_pv": 1, "minor_pv": 0, - "patch_pv": 3, + "patch_pv": 4, "major_codegen": 1, "minor_codegen": 0, - "patch_codegen": 3, + "patch_codegen": 4, "major_testgen": 1, "minor_testgen": 0, - "patch_testgen": 3, + "patch_testgen": 4, "major_web": 1, "minor_web": 0, - "patch_web": 3 + "patch_web": 4 } \ No newline at end of file diff --git a/src/wasm/9Cargo.toml b/src/wasm/9Cargo.toml index efcc04a3b..1adbc55ed 100755 --- a/src/wasm/9Cargo.toml +++ b/src/wasm/9Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] blake2-rfc = "0.2.18" constant_time_eq = "0.1.5" -chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/georgio/chacha20-poly1305-aead"} +chacha20-poly1305-aead = {version = "0.1.2", git = "https://github.com/symbolicsoft/chacha20-poly1305-aead"} getrandom = "0.1.3" hex = "0.4.3" rust-crypto-wasm = "0.3.1"