Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bf7e88458 | ||
|
|
e8f1fb3aed | ||
|
|
ba6155880e | ||
|
|
1e696a5520 | ||
|
|
b6c704eca8 | ||
|
|
c7053fa112 | ||
|
|
d76ab093a8 | ||
|
|
4a54a37ae1 | ||
|
|
0eb433f3c2 | ||
|
|
278ecc7210 | ||
|
|
03fe7dcb1d | ||
|
|
d99abde915 | ||
|
|
06502e8fe8 | ||
|
|
f3004fdb31 | ||
|
|
f5834e684f | ||
|
|
d7a1060824 | ||
|
|
c6f8748878 | ||
|
|
24a46c7262 | ||
|
|
78a282bda3 | ||
|
|
1713dccba3 | ||
|
|
0a22251212 | ||
|
|
540d46717b | ||
|
|
e5112e690d | ||
|
|
2f8c91fc15 | ||
|
|
6d552f1ced | ||
|
|
afa992b40b | ||
|
|
401c6e5763 | ||
|
|
76d051b16e | ||
|
|
5b69d5aadc | ||
|
|
780323538a | ||
|
|
042d653852 | ||
|
|
da47390fa4 | ||
|
|
488abd68bb | ||
|
|
d926ee63f4 | ||
|
|
6777f8ef5e | ||
|
|
1001083009 | ||
|
|
898b067081 | ||
|
|
acc07b9345 | ||
|
|
bc572b16d5 | ||
|
|
91d2530ea8 | ||
|
|
e679298d8d | ||
|
|
949ad77dab | ||
|
|
24ce35ae43 | ||
|
|
9e22f34720 | ||
|
|
2b867b2e91 | ||
|
|
230593ee17 | ||
|
|
60a3b8916c | ||
|
|
1f20fdf377 | ||
|
|
64dcd40bee | ||
|
|
f3948b90f7 | ||
|
|
83da578b60 | ||
|
|
407ec8e1a1 | ||
|
|
aa30920183 | ||
|
|
35d56606bd | ||
|
|
4083abb1dd | ||
|
|
c6cb3a9226 | ||
|
|
04d46701b1 | ||
|
|
61f4c5eb7d | ||
|
|
d0e99aebef | ||
|
|
dc752685d7 | ||
|
|
9bf3c1be07 | ||
|
|
32bd2172aa | ||
|
|
1f58821cd4 | ||
|
|
8352373fdd | ||
|
|
610fcee9cd | ||
|
|
b086928d01 | ||
|
|
8b3bd58e79 | ||
|
|
e6fd1e20a5 | ||
|
|
22075f8262 | ||
|
|
c8805a09dd | ||
|
|
758066b4ea | ||
|
|
da7c71c32f | ||
|
|
cb38c6f1c5 | ||
|
|
39d5b3bcce | ||
|
|
41c7af32c9 | ||
|
|
68d698502d | ||
|
|
3d4a87af6a | ||
|
|
77b1e338cf | ||
|
|
3af17400ba | ||
|
|
e16029776f | ||
|
|
61624a627b | ||
|
|
c964570806 |
@@ -11,6 +11,6 @@ jobs:
|
||||
steps:
|
||||
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
|
||||
with:
|
||||
authors: jacogr
|
||||
authors: jacogr, TarikGul, valentinfernandez1
|
||||
labels: -auto
|
||||
token: ${{ secrets.GH_PAT_BOT }}
|
||||
|
||||
@@ -11,13 +11,13 @@ jobs:
|
||||
env:
|
||||
YARN_ENABLE_SCRIPTS: false
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- uses: denoland/setup-deno@v1
|
||||
with:
|
||||
deno-version: vx.x.x
|
||||
deno-version: v1.42.x
|
||||
- name: ${{ matrix.step }}
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
|
||||
@@ -18,15 +18,19 @@ jobs:
|
||||
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GH_PAT_BOT }}
|
||||
- uses: actions/setup-node@v3
|
||||
ref: ${{ github.ref }}
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- name: Set Execute Permissions
|
||||
run: chmod +x ./scripts/*
|
||||
- name: Run Install Build Deps
|
||||
run: bash ./scripts/install-build-deps.sh
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --immutable
|
||||
./scripts/install-build-deps.sh
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports = require('@polkadot/dev/config/prettier.cjs');
|
||||
|
||||
Vendored
-363
File diff suppressed because one or more lines are too long
-550
File diff suppressed because one or more lines are too long
Vendored
-785
File diff suppressed because one or more lines are too long
+934
File diff suppressed because one or more lines are too long
+5
-8
@@ -1,18 +1,15 @@
|
||||
compressionLevel: mixed
|
||||
|
||||
enableGlobalCache: false
|
||||
|
||||
enableImmutableInstalls: false
|
||||
|
||||
enableProgressBars: false
|
||||
|
||||
logFilters:
|
||||
# Discard any "cannot be found in cache" messages
|
||||
- code: YN0013
|
||||
level: discard
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
||||
spec: "@yarnpkg/plugin-version"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.2.0.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.6.0.cjs
|
||||
|
||||
@@ -1,5 +1,63 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 7.5.3 Nov 24, 2025
|
||||
|
||||
Changes:
|
||||
|
||||
- Bump @polkadot dependencies ([#603](https://github.com/polkadot-js/wasm/pull/603))
|
||||
|
||||
|
||||
## 7.5.2 Nov 10, 2025
|
||||
|
||||
Changes:
|
||||
|
||||
- Fix/Revert asm build ([#599](https://github.com/polkadot-js/wasm/pull/599))
|
||||
- Bump @polkadot dependencies ([#601](https://github.com/polkadot-js/wasm/pull/601))
|
||||
|
||||
|
||||
## 7.5.1 aug 25, 2025
|
||||
|
||||
Changes:
|
||||
|
||||
- Bump yarn to 4.5.1 ([#573](https://github.com/polkadot-js/wasm/pull/573))
|
||||
- Update comments and labels from 2024 to 2025 ([#574](https://github.com/polkadot-js/wasm/pull/574))
|
||||
- Bump yarn to 4.6.0 ([#575](https://github.com/polkadot-js/wasm/pull/575))
|
||||
- Set execute for build script in CI ([#576](https://github.com/polkadot-js/wasm/pull/576))
|
||||
- Set permissions on all scripts ([#577](https://github.com/polkadot-js/wasm/pull/577))
|
||||
- Bump dev to 0.83.2 ([#578](https://github.com/polkadot-js/wasm/pull/578))
|
||||
- chore: added check in ext_secp_recover for signature normalization ([#579](https://github.com/polkadot-js/wasm/pull/579))
|
||||
- chore: Improve CI ([#580](https://github.com/polkadot-js/wasm/pull/580))
|
||||
- Revert CI improvements and wasm-bindgen version ([#583](https://github.com/polkadot-js/wasm/pull/583))
|
||||
- Added validation checks in PBKDF2 and Scrypt hashing functions ([#584](https://github.com/polkadot-js/wasm/pull/584))
|
||||
- Rollback wasm-bindgen version change ([#586](https://github.com/polkadot-js/wasm/pull/586))
|
||||
- Fix rust version to 1.84 ([#587](https://github.com/polkadot-js/wasm/pull/587))
|
||||
- Default to installed rust version ([#588](https://github.com/polkadot-js/wasm/pull/588))
|
||||
- Default to nightly rust version ([#589](https://github.com/polkadot-js/wasm/pull/589))
|
||||
- Ci Fix ([#590](https://github.com/polkadot-js/wasm/pull/590))
|
||||
- Read lock file ([#591](https://github.com/polkadot-js/wasm/pull/591))
|
||||
- Setup nightly as default ([#592](https://github.com/polkadot-js/wasm/pull/592))
|
||||
- Tweak install-build-deps.sh script ([#593](https://github.com/polkadot-js/wasm/pull/593))
|
||||
- Remove ASM build ([#594](https://github.com/polkadot-js/wasm/pull/594))
|
||||
- Bump @polkadot deps ([#595](https://github.com/polkadot-js/wasm/pull/595))
|
||||
|
||||
|
||||
## 7.4.1 Oct 20, 2024
|
||||
|
||||
- Bump dev deps to 0.81.2
|
||||
- Bump TS
|
||||
- Ensure CJS is exported correctly
|
||||
- Bump yarn
|
||||
- Add missing sideEffect declarations
|
||||
- Set Deno build in CI to 1.42.x
|
||||
|
||||
|
||||
## 7.3.2 Dec 6, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Apply fixes for OOB array access
|
||||
|
||||
|
||||
## 7.3.1 Nov 17, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
608 Jaco 7.3.1 (#548)
|
||||
618 Jaco 2024 (#559)
|
||||
19 Tarik Gul Bump dev to 0.83.2 (#578)
|
||||
12 Valentin Fernandez 7.5.1 (#596)
|
||||
8 rajk93 7.5.3 (#604)
|
||||
1 Evgeny Fixed type (#121)
|
||||
1 Shunfan Zhou Support sr25519 agreement (#209)
|
||||
1 Steve Degosserie Expose Schnorrkel's VRF capabilities (#170)
|
||||
|
||||
+7
-2
@@ -1,8 +1,13 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import baseConfig from '@polkadot/dev/config/eslint';
|
||||
|
||||
export default [
|
||||
...baseConfig
|
||||
...baseConfig,
|
||||
{
|
||||
ignores: [
|
||||
'mod.ts'
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
+9
-9
@@ -6,7 +6,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/wasm#readme",
|
||||
"license": "Apache-2.0",
|
||||
"packageManager": "yarn@3.2.0",
|
||||
"packageManager": "yarn@4.6.0",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,10 +14,10 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "7.3.1",
|
||||
"version": "7.5.3",
|
||||
"versions": {
|
||||
"git": "7.3.1",
|
||||
"npm": "7.3.1"
|
||||
"git": "7.5.3",
|
||||
"npm": "7.5.3"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
@@ -43,12 +43,12 @@
|
||||
"test:wasm-crypto:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --test-threads=1 --nocapture"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.77.1",
|
||||
"@polkadot/util": "^12.5.1",
|
||||
"@types/node": "^20.9.1",
|
||||
"fflate": "^0.8.1"
|
||||
"@polkadot/dev": "^0.83.3",
|
||||
"@polkadot/util": "^13.5.8",
|
||||
"@types/node": "^20.16.1",
|
||||
"fflate": "^0.8.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"typescript": "^5.2.2"
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.3.1",
|
||||
"version": "7.5.3",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/wasm-util": "7.3.1",
|
||||
"tslib": "^2.6.2"
|
||||
"@polkadot/wasm-util": "7.5.3",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^12.5.1",
|
||||
"@polkadot/x-randomvalues": "^12.5.1"
|
||||
"@polkadot/util": "^13.5.8",
|
||||
"@polkadot/x-randomvalues": "^13.5.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// A number of functions are "unsafe" and purposefully so - it is
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './bridge.js';
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export default [];
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage.js';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } from './types.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './index.js';
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import others from './detectOther.js';
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, others);
|
||||
detectPackage(packageInfo, null, []);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '7.3.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '7.5.3' };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Use non-strong types instead of WasmImports which may not
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BridgeBase, WasmBaseInstance } from './types.js';
|
||||
|
||||
@@ -13,15 +13,18 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"sideEffects": [
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.3.1",
|
||||
"version": "7.5.3",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^12.5.1"
|
||||
"@polkadot/util": "^13.5.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { asmJsInit } from './cjs/data.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const data = require('../data.js');
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const asmJsInit: null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const asmJsInit = null;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const asmJsInit: null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export const asmJsInit = null;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export default [];
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage.js';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './index.js';
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import others from './detectOther.js';
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, others);
|
||||
detectPackage(packageInfo, null, []);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '7.3.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '7.5.3' };
|
||||
|
||||
@@ -14,24 +14,24 @@
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.3.1",
|
||||
"version": "7.5.3",
|
||||
"browser": "wasm.js",
|
||||
"main": "wasm.js",
|
||||
"react-native": "asm.js",
|
||||
"dependencies": {
|
||||
"@polkadot/wasm-bridge": "7.3.1",
|
||||
"@polkadot/wasm-crypto-asmjs": "7.3.1",
|
||||
"@polkadot/wasm-crypto-wasm": "7.3.1",
|
||||
"@polkadot/wasm-util": "7.3.1",
|
||||
"tslib": "^2.6.2"
|
||||
"@polkadot/wasm-bridge": "7.5.3",
|
||||
"@polkadot/wasm-crypto-asmjs": "7.5.3",
|
||||
"@polkadot/wasm-crypto-wasm": "7.5.3",
|
||||
"@polkadot/wasm-util": "7.5.3",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^12.5.1",
|
||||
"@polkadot/x-randomvalues": "^12.5.1"
|
||||
"@polkadot/util": "^13.5.8",
|
||||
"@polkadot/x-randomvalues": "^13.5.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './wasm.js';
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
|
||||
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
|
||||
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
|
||||
|
||||
export default [bridgeInfo, asmInfo, wasmInfo];
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import others from './detectOther.js';
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, others);
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './wasm.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
|
||||
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
|
||||
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
|
||||
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, [asmInfo, bridgeInfo, wasmInfo]);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '7.3.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '7.5.3' };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { WasmBaseInstance } from '@polkadot/wasm-bridge/types';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
|
||||
@@ -13,16 +13,19 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"sideEffects": [
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.3.1",
|
||||
"version": "7.5.3",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/wasm-util": "7.3.1",
|
||||
"tslib": "^2.6.2"
|
||||
"@polkadot/wasm-util": "7.5.3",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^12.5.1"
|
||||
"@polkadot/util": "^13.5.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { base64Decode, unzlibSync } from '@polkadot/wasm-util';
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const bytes: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
exports.lenIn = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const bytes = require('../bytes.js');
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const bytes: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export const bytes = '';
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export default [];
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage.js';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './index.js';
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import others from './detectOther.js';
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, others);
|
||||
detectPackage(packageInfo, null, []);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '7.3.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '7.5.3' };
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[dependencies]
|
||||
std = { default-features = false, features = ["panic_immediate_abort"] }
|
||||
std = { default-features = false, features = ["panic_immediate_abort"] }
|
||||
@@ -14,8 +14,6 @@
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs",
|
||||
"./initNone.js",
|
||||
"./initNone.cjs",
|
||||
"./initOnlyAsm.js",
|
||||
@@ -23,22 +21,24 @@
|
||||
"./initOnlyWasm.js",
|
||||
"./initOnlyWasm.cjs",
|
||||
"./initWasmAsm.js",
|
||||
"./initWasmAsm.cjs"
|
||||
"./initWasmAsm.cjs",
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.3.1",
|
||||
"version": "7.5.3",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/wasm-bridge": "7.3.1",
|
||||
"@polkadot/wasm-crypto-asmjs": "7.3.1",
|
||||
"@polkadot/wasm-crypto-init": "7.3.1",
|
||||
"@polkadot/wasm-crypto-wasm": "7.3.1",
|
||||
"@polkadot/wasm-util": "7.3.1",
|
||||
"tslib": "^2.6.2"
|
||||
"@polkadot/wasm-bridge": "7.5.3",
|
||||
"@polkadot/wasm-crypto-asmjs": "7.5.3",
|
||||
"@polkadot/wasm-crypto-init": "7.5.3",
|
||||
"@polkadot/wasm-crypto-wasm": "7.5.3",
|
||||
"@polkadot/wasm-util": "7.5.3",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^12.5.1",
|
||||
"@polkadot/x-randomvalues": "^12.5.1"
|
||||
"@polkadot/util": "^13.5.8",
|
||||
"@polkadot/x-randomvalues": "^13.5.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { WasmCryptoInstance } from '@polkadot/wasm-crypto-init/types';
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import others from './detectOther.js';
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, others);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage.js';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/none';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/asm';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/wasm';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/both';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Use `wee_alloc` as the global allocator.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './index.js';
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
|
||||
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
|
||||
import { packageInfo as initInfo } from '@polkadot/wasm-crypto-init/packageInfo';
|
||||
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
|
||||
import { packageInfo as utilInfo } from '@polkadot/wasm-util/packageInfo';
|
||||
|
||||
export default [bridgeInfo, asmInfo, initInfo, wasmInfo, utilInfo];
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, [asmInfo, bridgeInfo, initInfo, utilInfo, wasmInfo]);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto', path: 'auto', type: 'auto', version: '7.3.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto', path: 'auto', type: 'auto', version: '7.5.3' };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use bip39::{Mnemonic, MnemonicType, Language, Seed};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use std::convert::TryFrom;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use blake2_rfc::blake2b::blake2b;
|
||||
@@ -100,6 +100,11 @@ pub fn ext_keccak512(data: &[u8]) -> Vec<u8> {
|
||||
/// Returns a vector with the hashed result
|
||||
#[wasm_bindgen]
|
||||
pub fn ext_pbkdf2(data: &[u8], salt: &[u8], rounds: u32) -> Vec<u8> {
|
||||
// As per RFC 2898 [https://datatracker.ietf.org/doc/html/rfc2898], the number of rounds must be greater than 0
|
||||
if rounds == 0 {
|
||||
panic!("PBKDF2 rounds must be greater than 0");
|
||||
}
|
||||
|
||||
let mut res = [0u8; 64];
|
||||
|
||||
// we cast to usize here - due to the WASM, we'd rather have u32 inputs
|
||||
@@ -119,6 +124,11 @@ pub fn ext_pbkdf2(data: &[u8], salt: &[u8], rounds: u32) -> Vec<u8> {
|
||||
/// Returns vector with the hashed result
|
||||
#[wasm_bindgen]
|
||||
pub fn ext_scrypt(password: &[u8], salt: &[u8], log2_n: u8, r: u32, p: u32) -> Vec<u8> {
|
||||
// As per RFC 7914 [https://datatracker.ietf.org/doc/html/rfc7914.html], the cost parameter N (2 ^ log2_n) must be larger than 1
|
||||
if log2_n == 0 {
|
||||
panic!("Scrypt cost parameter N must be larger than 1, log2_n must be at least 1");
|
||||
}
|
||||
|
||||
match ScryptParams::new(log2_n, r, p) {
|
||||
Ok(p) => {
|
||||
let mut res = [0u8; 64];
|
||||
@@ -254,6 +264,14 @@ pub mod tests {
|
||||
assert_eq!(hash[..], expected[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "PBKDF2 rounds must be greater than 0")]
|
||||
fn pbkdf2_zero_rounds_panics() {
|
||||
let salt = b"this is a salt";
|
||||
let data = b"hello world";
|
||||
ext_pbkdf2(data, salt, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_scrypt() {
|
||||
let password = b"password";
|
||||
@@ -264,6 +282,14 @@ pub mod tests {
|
||||
assert_eq!(hash[..], expected[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "Scrypt cost parameter N must be larger than 1, log2_n must be at least 1")]
|
||||
fn scrypt_zero_log2_n_panics() {
|
||||
let password = b"password";
|
||||
let salt = b"salt";
|
||||
ext_scrypt(password, salt, 0, 8, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_sha256() {
|
||||
let data = b"hello world";
|
||||
|
||||
@@ -1,130 +1,150 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use secp256k1::{ecdsa::{RecoverableSignature, RecoveryId}, Message, PublicKey, SecretKey, SECP256K1};
|
||||
use secp256k1::{
|
||||
ecdsa::{RecoverableSignature, RecoveryId},
|
||||
Message, PublicKey, SecretKey, SECP256K1,
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn ext_secp_pub_compress(pubkey: &[u8]) -> Vec<u8> {
|
||||
match PublicKey::from_slice(&pubkey) {
|
||||
Ok(p) => p
|
||||
.serialize()
|
||||
.to_vec(),
|
||||
_ => panic!("Invalid pubkey provided.")
|
||||
}
|
||||
match PublicKey::from_slice(&pubkey) {
|
||||
Ok(p) => p.serialize().to_vec(),
|
||||
_ => panic!("Invalid pubkey provided."),
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn ext_secp_pub_expand(pubkey: &[u8]) -> Vec<u8> {
|
||||
match PublicKey::from_slice(&pubkey) {
|
||||
Ok(p) => p
|
||||
.serialize_uncompressed()
|
||||
.to_vec(),
|
||||
_ => panic!("Invalid pubkey provided.")
|
||||
}
|
||||
match PublicKey::from_slice(&pubkey) {
|
||||
Ok(p) => p.serialize_uncompressed().to_vec(),
|
||||
_ => panic!("Invalid pubkey provided."),
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn ext_secp_from_seed(seed: &[u8]) -> Vec<u8> {
|
||||
match SecretKey::from_slice(seed) {
|
||||
Ok(s) => {
|
||||
let mut res = vec![];
|
||||
let pubkey = PublicKey::from_secret_key(SECP256K1, &s);
|
||||
match SecretKey::from_slice(seed) {
|
||||
Ok(s) => {
|
||||
let mut res = vec![];
|
||||
let pubkey = PublicKey::from_secret_key(SECP256K1, &s);
|
||||
|
||||
res.extend_from_slice(&s.serialize_secret());
|
||||
res.extend_from_slice(&pubkey.serialize());
|
||||
res.extend_from_slice(&s.serialize_secret());
|
||||
res.extend_from_slice(&pubkey.serialize());
|
||||
|
||||
res
|
||||
},
|
||||
_ => panic!("Invalid seed provided.")
|
||||
}
|
||||
res
|
||||
}
|
||||
_ => panic!("Invalid seed provided."),
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn ext_secp_recover(hash: &[u8], sig: &[u8], rec: i32) -> Vec<u8> {
|
||||
match RecoveryId::from_i32(rec) {
|
||||
Ok(r) => match (Message::from_slice(hash), RecoverableSignature::from_compact(&sig, r)) {
|
||||
(Ok(m), Ok(s)) => match s.recover(&m) {
|
||||
Ok(k) => k
|
||||
.serialize()
|
||||
.to_vec(),
|
||||
_ => panic!("Unable to recover.")
|
||||
},
|
||||
_ => panic!("Invalid signature provided.")
|
||||
},
|
||||
_ => panic!("Invalid recovery data provided.")
|
||||
}
|
||||
match RecoveryId::from_i32(rec) {
|
||||
Ok(r) => match (
|
||||
Message::from_slice(hash),
|
||||
RecoverableSignature::from_compact(&sig, r),
|
||||
) {
|
||||
(Ok(m), Ok(s)) => {
|
||||
let standard = s.to_standard();
|
||||
let mut normalized = standard;
|
||||
normalized.normalize_s();
|
||||
|
||||
// check if the signature is normalized
|
||||
if normalized.ne(&standard) {
|
||||
panic!("Non-normalized signature provided.");
|
||||
}
|
||||
|
||||
match s.recover(&m) {
|
||||
Ok(k) => k.serialize().to_vec(),
|
||||
_ => panic!("Unable to recover."),
|
||||
}
|
||||
}
|
||||
_ => panic!("Invalid signature provided."),
|
||||
},
|
||||
_ => panic!("Invalid recovery data provided."),
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn ext_secp_sign(hash: &[u8], seckey: &[u8]) -> Vec<u8> {
|
||||
match (Message::from_slice(hash), SecretKey::from_slice(seckey)) {
|
||||
(Ok(m), Ok(s)) => {
|
||||
let mut res = vec![];
|
||||
let (rec, sig) = SECP256K1
|
||||
.sign_ecdsa_recoverable(&m, &s)
|
||||
.serialize_compact();
|
||||
match (Message::from_slice(hash), SecretKey::from_slice(seckey)) {
|
||||
(Ok(m), Ok(s)) => {
|
||||
let mut res = vec![];
|
||||
let (rec, sig) = SECP256K1.sign_ecdsa_recoverable(&m, &s).serialize_compact();
|
||||
|
||||
res.extend_from_slice(&sig);
|
||||
res.push(rec.to_i32() as u8);
|
||||
res.extend_from_slice(&sig);
|
||||
res.push(rec.to_i32() as u8);
|
||||
|
||||
res
|
||||
},
|
||||
_ => panic!("Invalid message or secret provided.")
|
||||
}
|
||||
res
|
||||
}
|
||||
_ => panic!("Invalid message or secret provided."),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use hex_literal::hex;
|
||||
use super::*;
|
||||
use super::*;
|
||||
use hex_literal::hex;
|
||||
|
||||
#[test]
|
||||
fn can_create_pair() {
|
||||
let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae");
|
||||
let expected = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae03fd8c74f795ced92064b86191cb2772b1e3a0947740aa0a5a6e379592471fd85b");
|
||||
let res = ext_secp_from_seed(&seckey);
|
||||
#[test]
|
||||
fn can_create_pair() {
|
||||
let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae");
|
||||
let expected = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae03fd8c74f795ced92064b86191cb2772b1e3a0947740aa0a5a6e379592471fd85b");
|
||||
let res = ext_secp_from_seed(&seckey);
|
||||
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_pub_compress_full() {
|
||||
let pubkey = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af");
|
||||
let expected = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077");
|
||||
let res = ext_secp_pub_compress(&pubkey);
|
||||
#[test]
|
||||
fn can_pub_compress_full() {
|
||||
let pubkey = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af");
|
||||
let expected = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077");
|
||||
let res = ext_secp_pub_compress(&pubkey);
|
||||
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_pub_expand_comp() {
|
||||
let pubkey = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077");
|
||||
let expected = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af");
|
||||
let res = ext_secp_pub_expand(&pubkey);
|
||||
#[test]
|
||||
fn can_pub_expand_comp() {
|
||||
let pubkey = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077");
|
||||
let expected = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af");
|
||||
let res = ext_secp_pub_expand(&pubkey);
|
||||
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_recover() {
|
||||
let expected = hex!("028d13da15a02f3a70677339d51b14177ee9b49657662b35e56a9d9dee17db1d30");
|
||||
let sig = hex!("7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff");
|
||||
let msg = hex!("a30b64ce1eedf409c8afb801d72c05234e64849ea538c15dd3c8cf4ffcf166c9");
|
||||
let res = ext_secp_recover(&msg, &sig, 0);
|
||||
#[test]
|
||||
fn can_recover() {
|
||||
let expected = hex!("028d13da15a02f3a70677339d51b14177ee9b49657662b35e56a9d9dee17db1d30");
|
||||
let sig = hex!("7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff");
|
||||
let msg = hex!("a30b64ce1eedf409c8afb801d72c05234e64849ea538c15dd3c8cf4ffcf166c9");
|
||||
let res = ext_secp_recover(&msg, &sig, 0);
|
||||
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn can_sign() {
|
||||
// JS expectation - doesn't match?
|
||||
// let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba8c4efa521361678d9b8582744d77aa4b8d886d7380b7808a683174afad9c4700300");
|
||||
let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba83b105adec9e9872647a7d8bb28855b45e22805aea3d097953cbb1391f671d13e01");
|
||||
let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae");
|
||||
let msg = hex!("68c731589a583d08b70861683b59ce3dd56284cb2f0da5b6cd83e6641dac3aab");
|
||||
let res = ext_secp_sign(&msg, &seckey);
|
||||
#[test]
|
||||
fn can_sign() {
|
||||
// JS expectation - doesn't match?
|
||||
// let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba8c4efa521361678d9b8582744d77aa4b8d886d7380b7808a683174afad9c4700300");
|
||||
let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba83b105adec9e9872647a7d8bb28855b45e22805aea3d097953cbb1391f671d13e01");
|
||||
let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae");
|
||||
let msg = hex!("68c731589a583d08b70861683b59ce3dd56284cb2f0da5b6cd83e6641dac3aab");
|
||||
let res = ext_secp_sign(&msg, &seckey);
|
||||
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
assert_eq!(res[..], expected[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "Non-normalized signature provided.")]
|
||||
fn rejects_high_s_signature() {
|
||||
// valid ECDSA signature with a high S value (non-normalized)
|
||||
let sig = hex!(
|
||||
"fa1b7a71500322d70bcd5b982c678c96c95f68893063e1621b8b85c867b80b1caae8c7c4f8b5c6d181e4c8898a3f4c329da0e2c21f6f80552a660e6c1d9fa201");
|
||||
let msg = hex!("9a3c9be3a14a94df8cda1c474c0e9f8b1b35b1d85d2122cb87e6eb3c518e3be3");
|
||||
|
||||
let _ = ext_secp_recover(&msg, &sig, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global it */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global it */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global it */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global describe */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global it */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global it */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* global it */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import '@polkadot/wasm-crypto/initOnlyAsm';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// This is a Deno file, so we can allow .ts imports
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/// <reference types="@polkadot/dev-test/globals.d.ts" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import path from 'node:path';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import * as wasm from '@polkadot/wasm-crypto';
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "7.3.1",
|
||||
"version": "7.5.3",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^12.5.1"
|
||||
"@polkadot/util": "^13.5.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-util authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/// <reference types="@polkadot/dev-test/globals.d.ts" />
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-util authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Use an array for our indexer - this is faster than using map access. In
|
||||
// this case we assume ASCII-only inputs, so we cannot overflow the array
|
||||
const chr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const CHR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' as const;
|
||||
const map = new Array<number>(256);
|
||||
|
||||
// We use charCodeAt for access here and in the decoder loop - this is faster
|
||||
// on lookups (array + numbers) and also faster than accessing the specific
|
||||
// character via data[i]
|
||||
for (let i = 0, count = chr.length; i < count; i++) {
|
||||
map[chr.charCodeAt(i)] = i;
|
||||
for (let i = 0, count = CHR.length; i < count; i++) {
|
||||
map[CHR.charCodeAt(i)] = i;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name base64Decode
|
||||
* @description
|
||||
* A base64Decoding function that operates in all environments. Unlike decoding
|
||||
* A base64 decoding function that operates in all environments. Unlike decoding
|
||||
* from Buffer (Node.js only) or atob (browser-only) this implementation is
|
||||
* slightly slower, but it is platform independent.
|
||||
*
|
||||
* For our usage, since we have access to the static final size (where used), we
|
||||
* decode to a specified output buffer. This also means we have applied a number
|
||||
* of optimizations based on this - checking output position instead of chars.
|
||||
* For our usage, since we have access to the static final size, so we decode
|
||||
* to a specified output buffer. This also means we have applied a number of
|
||||
* optimizations based on this - checking output position instead of chars.
|
||||
*/
|
||||
export function base64Decode (data: string, out: Uint8Array): Uint8Array {
|
||||
let byte = 0;
|
||||
let bits = 0;
|
||||
let pos = -1;
|
||||
|
||||
for (let i = 0, count = out.length; pos < count; i++) {
|
||||
for (let i = 0, last = out.length - 1; pos !== last; i++) {
|
||||
// each character represents 6 bits
|
||||
byte = (byte << 6) | map[data.charCodeAt(i)];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-util authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { base64Decode } from './base64.js';
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { packageInfo as utilInfo } from '@polkadot/wasm-util/packageInfo';
|
||||
|
||||
export default [utilInfo];
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-util authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// MIT License
|
||||
@@ -92,10 +92,12 @@ const hMap = ((cd: Uint8Array, mb: number, r: 0 | 1) => {
|
||||
// u16 "map": index -> # of codes with bit length = index
|
||||
const l = new u16(mb);
|
||||
// length of cd must be 288 (total # of codes)
|
||||
for (; i < s; ++i) ++l[cd[i] - 1];
|
||||
for (; i < s; ++i) {
|
||||
if (cd[i]) ++l[cd[i] - 1];
|
||||
}
|
||||
// u16 "map": index -> minimum code for bit length = index
|
||||
const le = new u16(mb);
|
||||
for (i = 0; i < mb; ++i) {
|
||||
for (i = 1; i < mb; ++i) {
|
||||
le[i] = (le[i - 1] + l[i - 1]) << 1;
|
||||
}
|
||||
let co: Uint16Array;
|
||||
@@ -116,13 +118,17 @@ const hMap = ((cd: Uint8Array, mb: number, r: 0 | 1) => {
|
||||
// m is end value
|
||||
for (const m = v | ((1 << r) - 1); v <= m; ++v) {
|
||||
// every 16 bit value starting with the code yields the same result
|
||||
co[rev[v] >>> rvb] = sv;
|
||||
co[rev[v] >> rvb] = sv;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
co = new u16(s);
|
||||
for (i = 0; i < s; ++i) co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);
|
||||
for (i = 0; i < s; ++i) {
|
||||
if (cd[i]) {
|
||||
co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return co;
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2023 @polkadot/wasm-util authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage.js';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle.js';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user