Compare commits

...
172 Commits
Author SHA1 Message Date
github-actions[bot] 03fe7dcb1d [CI Skip] release/stable 7.5.1
skip-checks: true
2025-08-25 14:05:16 +00:00
Valentin Fernandezandgithub-actions[bot] d99abde915 7.5.1 (#596)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-25 17:03:27 +03:00
github-actions[bot] 06502e8fe8 [CI Skip] bump/beta 7.4.2-4-x
skip-checks: true
2025-08-25 13:48:20 +00:00
Valentin Fernandezandgithub-actions[bot] f3004fdb31 bump deps (#595)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-25 16:46:30 +03:00
github-actions[bot] f5834e684f [CI Skip] bump/beta 7.4.2-3-x
skip-checks: true
2025-08-13 17:01:23 +00:00
Valentin Fernandezandgithub-actions[bot] d7a1060824 Remove ASM build (#594)
* Remove ASM build

* remove CI build blag

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-13 13:59:40 -03:00
c6f8748878 Tweak install-build-deps.sh script (#593)
* add additional flag

* downgrade bindgen

* Fix rust build

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: José Molina <jose@blockdeep.io>
2025-08-13 13:34:01 -03:00
Valentin Fernandezandgithub-actions[bot] 24a46c7262 Setup nightly as default (#592)
* run CI

* run CI

* setup nightly as default

* install  nightly-2024-11-22

* rustup show

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-13 17:01:17 +03:00
Valentin Fernandezandgithub-actions[bot] 78a282bda3 Readd lock file (#591)
* get rust versions

* modify build-wasm

* switch to nightly on build-wasm

* prevent script from using stable

* extra log

* new log

* run CI on current branch

* run CI on current branch

* Minor fixes

* Remove rust installation

* nightly on build.sh

* add log

* logs

* small change

* rust version is nightly

* auto-approve

* re add lock file

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-12 12:02:48 -03:00
Valentin Fernandezandgithub-actions[bot] 1713dccba3 Ci Fix (#590)
* get rust versions

* modify build-wasm

* switch to nightly on build-wasm

* prevent script from using stable

* extra log

* new log

* run CI on current branch

* run CI on current branch

* Minor fixes

* Remove rust installation

* nightly on build.sh

* add log

* logs

* small change

* rust version is nightly

* auto-approve

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-12 11:40:51 -03:00
Valentin Fernandezandgithub-actions[bot] 0a22251212 default to nightly build (#589)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-12 09:56:45 -03:00
Valentin Fernandezandgithub-actions[bot] 540d46717b default to installed rust version (#588)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-11 13:33:46 -03:00
Valentin Fernandezandgithub-actions[bot] e5112e690d fix rust version to 1.84 (#587)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-11 12:01:58 -03:00
Valentin Fernandezandgithub-actions[bot] 2f8c91fc15 rollback bindgen version change (#586)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-11 11:41:17 -03:00
rajk93 6d552f1ced Added validation checks in PBKDF2 and Scrypt hashing functions (#584)
* chore: added validation checks in PBKDF2 and Scrypt functions

* chore(eslint): ignore linting for mod.ts

* chore(ci): bump RUST_VER

* chore(ci): bump RUST_VER

* chore(CI): downgrade RUST_VER and update xargo build script

* chore(CI): revert last change and use RUST_VER as stable

* chore(CI): bump BINDGEN_VER

* chore(CI): bump BINDGEN_VER

* chore(CI): bump BINARYEN_VER

* chore(CI): downgrade BINARYEN_VER

* chore(CI): recomended fix for wasm-bindgen

* chore(test): point wasm to package

* Revert "chore(test): point wasm to package"

This reverts commit 66104540fdff0e760ca0a6a666d4e09d162c5769.

* chore(test): temporary test

* Revert "chore(test): temporary test"

This reverts commit af10b8d8b9bb597e02ea9c8d6cc3bf62676a6609.

* chore(test): added more logs to build-wasm.sh script

* Revert "chore(test): added more logs to build-wasm.sh script"

This reverts commit c5073005ae9daa84308296736a41636da8f3d21b.

* chore(test): added more logs to test all

* Revert "chore(test): added more logs to test all"

This reverts commit 9b0ac43c2c053ac408164bbf9b31b46d0844af1b.

* chore: add references for RFCs
2025-07-23 12:10:03 +05:30
rajk93 afa992b40b Revert CI improvements and wasm-bindgen version (#583)
* chore: revert wasm-bindgen

* chore: revert pull_request in github action workflow

* chore: revert CI improvements

* chore: revert CI improvements
2025-07-16 13:01:04 +05:30
Valentin Fernandez 401c6e5763 chore: Improve CI (#580)
* Prevent false possitive result

* Use stable cargo version

* Remove 2nd continue-on-error
2025-06-26 09:53:32 -03:00
rajk93andValentin Fernandez 76d051b16e chore: added check in ext_secp_recover for signature normalization (#579)
* chore: added check in ext_secp_recover for signature normalization

* update wasm-bindgen

* Add test for non-normalized signature

---------

Co-authored-by: Valentin Fernandez <tinchofernandez8@gmail.com>
2025-06-24 12:01:13 -03:00
github-actions[bot] 5b69d5aadc [CI Skip] bump/beta 7.4.2-2-x
skip-checks: true
2025-01-17 22:18:32 +00:00
Tarik Gul 780323538a Bump dev to 0.83.2 (#578) 2025-01-18 00:14:18 +02:00
github-actions[bot] 042d653852 [CI Skip] bump/beta 7.4.2-1-x
skip-checks: true
2025-01-02 19:57:35 +00:00
Tarik Gul da47390fa4 Set permissions on all scripts (#577)
* Set permissions on all scripts

* cleanup
2025-01-02 21:53:46 +02:00
Tarik Gul 488abd68bb Set execute for build script in CI (#576) 2025-01-02 21:40:37 +02:00
Tarik Gul d926ee63f4 Bump yarn to 4.6.0 (#575) 2025-01-02 21:26:31 +02:00
Tarik Gul 6777f8ef5e 2025 (#574)
* 2025

* include more files
2025-01-02 17:31:20 +02:00
github-actions[bot] 1001083009 [CI Skip] bump/beta 7.4.2-0-x
skip-checks: true
2024-10-22 14:24:12 +00:00
Tarik Gul 898b067081 Bump yarn to 4.5.1 (#573) 2024-10-22 17:20:13 +03:00
github-actions[bot] acc07b9345 [CI Skip] release/stable 7.4.1
skip-checks: true
2024-10-21 02:30:29 +00:00
Tarik Gul bc572b16d5 7.4.1 (#572)
* 7.4.1

* spacing
2024-10-21 05:27:10 +03:00
github-actions[bot] 91d2530ea8 [CI Skip] bump/beta 7.3.3-16-x
skip-checks: true
2024-10-21 00:59:52 +00:00
Tarik Gul e679298d8d Bump dev to 0.81.2 (#571) 2024-10-21 03:56:31 +03:00
Tarik Gul 949ad77dab Bump dev to 0.81.1 (#570) 2024-10-21 02:51:21 +03:00
github-actions[bot] 24ce35ae43 [CI Skip] bump/beta 7.3.3-15-x
skip-checks: true
2024-10-20 20:43:34 +00:00
Tarik Gul 9e22f34720 Set CI deno version to 1.42.x (#569) 2024-10-20 23:40:08 +03:00
github-actions[bot] 2b867b2e91 [CI Skip] bump/beta 7.3.3-14-x
skip-checks: true
2024-08-29 15:07:39 +00:00
Tarik Gul 230593ee17 Bump yarn to 4.4.1 (#568) 2024-08-29 18:02:48 +03:00
github-actions[bot] 60a3b8916c [CI Skip] bump/beta 7.3.3-13-x
skip-checks: true
2024-08-29 14:23:31 +00:00
Tarik Gul 1f20fdf377 Bump dev, and typescript (#567) 2024-08-29 17:18:39 +03:00
github-actions[bot] 64dcd40bee [CI Skip] bump/beta 7.3.3-12-x
skip-checks: true
2024-08-20 17:43:05 +00:00
Tarik Gul f3948b90f7 Upgrade deps (#566) 2024-08-20 20:37:19 +03:00
github-actions[bot] 83da578b60 [CI Skip] bump/beta 7.3.3-11-x
skip-checks: true
2024-05-14 00:43:00 +00:00
Tarik Gul 407ec8e1a1 Bump yarn to 4.2.2 (#565) 2024-05-14 03:38:02 +03:00
github-actions[bot] aa30920183 [CI Skip] bump/beta 7.3.3-10-x
skip-checks: true
2024-05-13 23:41:56 +00:00
Tarik Gul 35d56606bd Bump @polkadot/dev to 0.79.1 for topo sort (#564) 2024-05-14 02:37:40 +03:00
github-actions[bot] 4083abb1dd [CI Skip] bump/beta 7.3.3-9-x
skip-checks: true
2024-04-08 17:47:21 +00:00
Tarik Gul c6cb3a9226 Update ci checkout and setup_node v4 (#563) 2024-04-08 20:43:29 +03:00
github-actions[bot] 04d46701b1 [CI Skip] bump/beta 7.3.3-8-x
skip-checks: true
2024-03-26 01:14:57 +00:00
Tarik Gul 61f4c5eb7d Bump yarn to 4.1.1 (#562) 2024-03-26 03:11:57 +02:00
github-actions[bot] d0e99aebef [CI Skip] bump/beta 7.3.3-7-x
skip-checks: true
2024-02-17 13:49:09 +00:00
Tarik Gul dc752685d7 chore(yarn): update yarn to 4.1.0 (#560) 2024-02-17 15:43:24 +02:00
github-actions[bot] 9bf3c1be07 [CI Skip] bump/beta 7.3.3-6-x
skip-checks: true
2024-02-17 02:01:40 +00:00
Tarik Gul 32bd2172aa ci: add user (TarikGul) to auto-approve (#561) 2024-02-17 03:55:58 +02:00
github-actions[bot] 1f58821cd4 [CI Skip] bump/beta 7.3.3-5-x
skip-checks: true
2024-01-08 13:10:59 +00:00
Jaco 8352373fdd 2024 (#559) 2024-01-08 15:07:04 +02:00
github-actions[bot] 610fcee9cd [CI Skip] bump/beta 7.3.3-4-x
skip-checks: true
2023-12-19 15:09:13 +00:00
Jaco b086928d01 Add missing sideEffect declarations (#558) 2023-12-19 17:05:22 +02:00
github-actions[bot] 8b3bd58e79 [CI Skip] bump/beta 7.3.3-3-x
skip-checks: true
2023-12-19 08:46:15 +00:00
Jaco e6fd1e20a5 Bump dev w/ packageDetect adjustments (#557)
* Bump dev w/ packageDetect adjustments

* sideEffects
2023-12-19 10:42:52 +02:00
github-actions[bot] 22075f8262 [CI Skip] bump/beta 7.3.3-2-x
skip-checks: true
2023-12-18 12:05:07 +00:00
Jaco c8805a09dd Bump util (#556) 2023-12-18 14:01:44 +02:00
github-actions[bot] 758066b4ea [CI Skip] bump/beta 7.3.3-1-x
skip-checks: true
2023-12-18 08:29:42 +00:00
Jaco da7c71c32f Bump yarn berry, bump deps (#555) 2023-12-18 10:26:25 +02:00
github-actions[bot] cb38c6f1c5 [CI Skip] bump/beta 7.3.3-0-x
skip-checks: true
2023-12-12 05:34:17 +00:00
Jaco 39d5b3bcce Bump dev deps (w/ TS 5.3.3.) (#554) 2023-12-12 07:30:56 +02:00
github-actions[bot] 41c7af32c9 [CI Skip] release/stable 7.3.2
skip-checks: true
2023-12-06 09:28:24 +00:00
Jaco 68d698502d 7.3.2 (#553) 2023-12-06 11:23:54 +02:00
github-actions[bot] 3d4a87af6a [CI Skip] bump/beta 7.3.2-2-x
skip-checks: true
2023-12-06 08:57:15 +00:00
Jaco 77b1e338cf Sync fflate huffman tree with upstream (#552) 2023-12-06 10:52:27 +02:00
github-actions[bot] 3af17400ba [CI Skip] bump/beta 7.3.2-1-x
skip-checks: true
2023-12-06 08:48:37 +00:00
Jaco e16029776f Fix base64 last decoding offset (#551) 2023-12-06 10:44:07 +02:00
github-actions[bot] 61624a627b [CI Skip] bump/beta 7.3.2-0-x
skip-checks: true
2023-11-18 08:41:17 +00:00
Jaco c964570806 Bump common (#549) 2023-11-18 10:34:43 +02:00
github-actions[bot] f32846d41b [CI Skip] release/stable 7.3.1
skip-checks: true
2023-11-17 09:20:13 +00:00
Jaco 705b08765b 7.3.1 (#548) 2023-11-17 11:13:36 +02:00
github-actions[bot] 4f6771e758 [CI Skip] bump/beta 7.2.3-9-x
skip-checks: true
2023-11-17 08:15:49 +00:00
Jaco 731dee91e4 Update dev, drop Node 16 (#547) 2023-11-17 10:09:14 +02:00
github-actions[bot] b82e28ad4e [CI Skip] bump/beta 7.2.3-8-x
skip-checks: true
2023-10-15 10:55:03 +00:00
Jaco 6d5b3f5404 Bump TS (#546) 2023-10-15 13:46:13 +03:00
github-actions[bot] 1f643dd705 [CI Skip] bump/beta 7.2.3-7-x
skip-checks: true
2023-10-11 08:57:16 +00:00
Jaco af9491f7fd Bump deps (#545) 2023-10-11 11:49:18 +03:00
github-actions[bot] 7377da8e7e [CI Skip] bump/beta 7.2.3-6-x
skip-checks: true
2023-09-15 07:00:35 +00:00
Jaco 32fa12c3fa Bump deps (w/ util) (#543) 2023-09-15 09:53:57 +03:00
github-actions[bot] 6aabb2f869 [CI Skip] bump/beta 7.2.3-5-x
skip-checks: true
2023-09-14 05:23:44 +00:00
Jaco 0edb0289a9 Bump dev deps (#542) 2023-09-14 08:16:59 +03:00
github-actions[bot] 004996d772 [CI Skip] bump/beta 7.2.3-4-x
skip-checks: true
2023-08-31 12:51:49 +00:00
Jaco 7611fd1788 Collapse build:mac command into build (w/ detect) (#541) 2023-08-31 15:44:26 +03:00
github-actions[bot] e4f85e2358 [CI Skip] bump/beta 7.2.3-3-x
skip-checks: true
2023-08-30 06:37:28 +00:00
Jaco 6c5e7deaa5 Bump dev deps (#540) 2023-08-30 09:31:36 +03:00
github-actions[bot] 1f024c1da0 [CI Skip] bump/beta 7.2.3-2-x
skip-checks: true
2023-08-23 10:42:00 +00:00
Jaco 26b6cf843a Bump deps (#539) 2023-08-23 13:35:59 +03:00
github-actions[bot] 8e54efe4a5 [CI Skip] bump/beta 7.2.3-1-x
skip-checks: true
2023-08-20 06:57:44 +00:00
Jaco daecf47197 Bump deps (#537) 2023-08-20 09:51:51 +03:00
github-actions[bot] 6f5ed67aad [CI Skip] bump/beta 7.2.3-0-x
skip-checks: true
2023-08-18 06:44:50 +00:00
Jaco 8556566c1d Bump common (#536) 2023-08-18 09:38:25 +03:00
github-actions[bot] e28a5ffd4b [CI Skip] release/stable 7.2.2
skip-checks: true
2023-08-17 07:42:59 +00:00
Jaco 7f3ca3159d 7.2.2 (#535)
* 7.2.2

* CHANGELOG typo

* Adjust root dependencies
2023-08-17 10:37:26 +03:00
github-actions[bot] 3a3214e602 [CI Skip] bump/beta 7.2.2-12-x
skip-checks: true
2023-08-16 08:21:33 +00:00
Jaco 319f33bec1 Bump dev (#534)
* Bump dev

* Adjust linting
2023-08-16 11:14:44 +03:00
github-actions[bot] a8f5189252 [CI Skip] bump/beta 7.2.2-11-x
skip-checks: true
2023-08-16 06:22:41 +00:00
Jaco ee26a6ef98 Bump deps (w/ eslint updates) (#533) 2023-08-16 09:17:00 +03:00
github-actions[bot] 71291442bb [CI Skip] bump/beta 7.2.2-10-x
skip-checks: true
2023-07-06 07:27:43 +00:00
Jaco f26f855942 Bump deps (#532) 2023-07-06 10:22:27 +03:00
github-actions[bot] 3a06871f82 [CI Skip] bump/beta 7.2.2-9-x
skip-checks: true
2023-06-12 06:04:02 +00:00
Jaco 279da24ca1 Bump util (#531) 2023-06-12 08:57:00 +03:00
github-actions[bot] af81a69ba6 [CI Skip] bump/beta 7.2.2-8-x
skip-checks: true
2023-06-11 07:08:14 +00:00
Jaco 0b39c9d2f1 Bump common (#530) 2023-06-11 10:02:36 +03:00
github-actions[bot] 7d2de26fdb [CI Skip] bump/beta 7.2.2-7-x
skip-checks: true
2023-06-04 14:48:02 +00:00
Jaco fc370eedb2 Bump common (#529) 2023-06-04 17:42:36 +03:00
github-actions[bot] 792baf352c [CI Skip] bump/beta 7.2.2-6-x
skip-checks: true
2023-06-02 10:29:57 +00:00
Jaco a79d6ded77 Bump deps (w/ TS 5.1) (#528) 2023-06-02 13:24:22 +03:00
github-actions[bot] 51b45133d9 [CI Skip] bump/beta 7.2.2-5-x
skip-checks: true
2023-05-25 07:32:56 +00:00
Jaco b3c934d602 Bump dev deps (#527) 2023-05-25 10:27:24 +03:00
github-actions[bot] 25cd084f30 [CI Skip] bump/beta 7.2.2-4-x
skip-checks: true
2023-05-21 09:48:55 +00:00
Jaco 9df575ad7b Bump dev (w/ eslint config adj) (#526) 2023-05-21 12:43:14 +03:00
github-actions[bot] 0175ac56a7 [CI Skip] bump/beta 7.2.2-3-x
skip-checks: true
2023-05-18 09:04:24 +00:00
Jaco e589fba3b1 Adjust tsconfig usage (w/ latest dev) (#525) 2023-05-18 11:59:20 +03:00
github-actions[bot] 570c46e889 [CI Skip] bump/beta 7.2.2-2-x
skip-checks: true
2023-05-18 05:28:27 +00:00
Jaco 4d002c7563 Bump dev deps (#524) 2023-05-18 08:22:56 +03:00
github-actions[bot] 6aeaa69a8b [CI Skip] bump/beta 7.2.2-1-x
skip-checks: true
2023-05-16 06:36:58 +00:00
Jaco 4565f85077 CJS export cleanups (#523) 2023-05-16 09:31:41 +03:00
github-actions[bot] 0d0dcbf005 [CI Skip] bump/beta 7.2.2-0-x
skip-checks: true
2023-05-13 08:49:41 +00:00
Jaco 7e38ff8faf Bump util (#522) 2023-05-13 11:43:56 +03:00
github-actions[bot] 5640651945 [CI Skip] release/stable 7.2.1
skip-checks: true
2023-05-13 08:07:05 +00:00
Jaco 657ac95ad9 7.2.1 (#521) 2023-05-13 11:00:42 +03:00
github-actions[bot] 23441ec34d [CI Skip] bump/beta 7.1.3-3-x
skip-checks: true
2023-05-08 13:40:53 +00:00
Jaco b7768c369c cjs/bytes.js generation adjustment (#520) 2023-05-08 16:36:00 +03:00
github-actions[bot] 646eabf516 [CI Skip] bump/beta 7.1.3-2-x
skip-checks: true
2023-05-06 08:54:15 +00:00
Jaco ac36b68a5e Bump dev (#519) 2023-05-06 11:49:24 +03:00
github-actions[bot] 390edd8b6d [CI Skip] bump/beta 7.1.3-1-x
skip-checks: true
2023-05-05 08:25:04 +00:00
Jaco 083eba1d8f Bump dev (w/ dev loader order fix) (#518) 2023-05-05 11:19:59 +03:00
Jaco 0a70cc7cfb Bump common (#517) 2023-05-01 20:12:38 +03:00
github-actions[bot] 034f625118 [CI Skip] bump/beta 7.1.3-0-x
skip-checks: true
2023-04-29 06:10:29 +00:00
Jaco 919c4aa7d4 Bump common (#516) 2023-04-29 09:04:19 +03:00
github-actions[bot] 85350b15d2 [CI Skip] release/stable 7.1.2
skip-checks: true
2023-04-28 05:44:41 +00:00
Jaco fcc48bf20a 7.1.2 (#515) 2023-04-28 08:40:05 +03:00
github-actions[bot] c408836bc6 [CI Skip] bump/beta 7.1.2-0-x
skip-checks: true
2023-04-22 08:06:12 +00:00
Jaco 194d1a6cd4 Bump common (#514) 2023-04-22 11:01:26 +03:00
github-actions[bot] fbb7d77f06 [CI Skip] release/stable 7.1.1
skip-checks: true
2023-04-22 07:06:48 +00:00
Jaco 1536cd9b48 7.1.1 (#513) 2023-04-22 10:01:26 +03:00
github-actions[bot] 695ccae218 [CI Skip] bump/beta 7.0.4-15-x
skip-checks: true
2023-04-13 11:32:52 +00:00
Jaco bd8d729765 Add util tests for (small) base64 decoder (#512) 2023-04-13 14:28:08 +03:00
github-actions[bot] 2453c8728b [CI Skip] bump/beta 7.0.4-14-x
skip-checks: true
2023-04-08 07:09:53 +00:00
Jaco f39f0d72f2 Bump TypeScript (#511) 2023-04-08 10:04:03 +03:00
github-actions[bot] 89739683f5 [CI Skip] bump/beta 7.0.4-13-x
skip-checks: true
2023-04-04 05:33:47 +00:00
Jaco 7f0c60b4f0 Update lock wf (#510) 2023-04-04 08:27:30 +03:00
github-actions[bot] 6ee5b6da86 [CI Skip] bump/beta 7.0.4-12-x
skip-checks: true
2023-04-01 07:31:39 +00:00
Jaco 68575449f1 Bump deps (#509) 2023-04-01 10:25:56 +03:00
github-actions[bot] ea7035a484 [CI Skip] bump/beta 7.0.4-11-x
skip-checks: true
2023-03-25 15:52:26 +00:00
Jaco cbb7cd94f7 Add repo dev req. for Node.js (#508) 2023-03-25 17:46:17 +02:00
github-actions[bot] d0af71031f [CI Skip] bump/beta 7.0.4-10-x
skip-checks: true
2023-03-25 10:58:53 +00:00
Jaco 929401b8b6 Bump dev (w/ some node:test adjustments) (#507) 2023-03-25 12:51:41 +02:00
github-actions[bot] 778879b1c1 [CI Skip] bump/beta 7.0.4-9-x
skip-checks: true
2023-03-25 07:35:59 +00:00
Jaco cadb0d9123 Bump util (#506) 2023-03-25 09:29:43 +02:00
github-actions[bot] 4e505bbe29 [CI Skip] bump/beta 7.0.4-8-x
skip-checks: true
2023-03-19 08:10:28 +00:00
Jaco 72cbdf6eaa Bump common deps (#505) 2023-03-19 10:05:23 +02:00
github-actions[bot] a032cbce6e [CI Skip] bump/beta 7.0.4-7-x
skip-checks: true
2023-03-18 10:02:53 +00:00
Jaco 12a5b0da0f Bump deps (& remove unused overrides) (#504) 2023-03-18 11:57:41 +02:00
github-actions[bot] f1129ddcbb [CI Skip] bump/beta 7.0.4-6-x
skip-checks: true
2023-03-17 06:05:27 +00:00
Jaco 7d2a29d231 Bump to TS 5.0 (#503) 2023-03-17 07:59:57 +02:00
github-actions[bot] c5550ad559 [CI Skip] bump/beta 7.0.4-5-x
skip-checks: true
2023-03-17 05:25:08 +00:00
Jaco d1fd2a74a4 Bump dev deps (#502) 2023-03-17 07:18:36 +02:00
github-actions[bot] f1d678132a [CI Skip] bump/beta 7.0.4-4-x
skip-checks: true
2023-03-15 16:39:54 +00:00
Jaco 784422a129 Bump dev (w/ /src/ caching only) (#501) 2023-03-15 18:34:19 +02:00
Jaco 0a6b25fbdd Bump dev (#500) 2023-03-15 17:42:17 +02:00
github-actions[bot] 6bc249181b [CI Skip] bump/beta 7.0.4-3-x
skip-checks: true
2023-03-15 14:55:48 +00:00
Jaco a47fb3bff9 Bump dev (#499) 2023-03-15 16:50:05 +02:00
github-actions[bot] d21c3fc639 [CI Skip] bump/beta 7.0.4-2-x
skip-checks: true
2023-03-14 11:01:52 +00:00
Jaco 7da2f705dc Remove stale workflow (#498) 2023-03-14 12:56:26 +02:00
github-actions[bot] 69278851bc [CI Skip] bump/beta 7.0.4-1-x
skip-checks: true
2023-03-12 09:44:54 +00:00
Jaco 41dbf12257 Bump dev (#497) 2023-03-12 11:39:33 +02:00
github-actions[bot] 7a8ce5ea3a [CI Skip] bump/beta 7.0.4-0-x
skip-checks: true
2023-03-11 07:22:45 +00:00
Jaco 7d24e46947 Bump util (#496) 2023-03-11 09:16:35 +02:00
129 changed files with 5573 additions and 5530 deletions
-19
View File
@@ -1,19 +0,0 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/eslint.cjs');
module.exports = {
...base,
ignorePatterns: [
...base.ignorePatterns,
'**/target/*',
'**/test/*.ts'
],
parserOptions: {
...base.parserOptions,
project: [
'./tsconfig.eslint.json'
]
}
};
+1 -1
View File
@@ -11,6 +11,6 @@ jobs:
steps: steps:
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da - uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
with: with:
authors: jacogr authors: jacogr, TarikGul, valentinfernandez1
labels: -auto labels: -auto
token: ${{ secrets.GH_PAT_BOT }} token: ${{ secrets.GH_PAT_BOT }}
+4 -4
View File
@@ -13,13 +13,13 @@ jobs:
- uses: dessant/lock-threads@c1b35aecc5cdb1a34539d14196df55838bb2f836 - uses: dessant/lock-threads@c1b35aecc5cdb1a34539d14196df55838bb2f836
with: with:
github-token: ${{ secrets.GH_PAT_BOT }} github-token: ${{ secrets.GH_PAT_BOT }}
issue-lock-inactive-days: '7' issue-inactive-days: '7'
issue-lock-comment: > issue-comment: >
This thread has been automatically locked since there has not been This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue any recent activity after it was closed. Please open a new issue
if you think you have a related problem or query. if you think you have a related problem or query.
pr-lock-inactive-days: '2' pr-inactive-days: '2'
pr-lock-comment: > pr-comment: >
This pull request has been automatically locked since there This pull request has been automatically locked since there
has not been any recent activity after it was closed. has not been any recent activity after it was closed.
Please open a new issue for related bugs. Please open a new issue for related bugs.
+4 -4
View File
@@ -11,18 +11,18 @@ jobs:
env: env:
YARN_ENABLE_SCRIPTS: false YARN_ENABLE_SCRIPTS: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-node@v3 - uses: actions/setup-node@v4
with: with:
node-version: 'lts/*' node-version: 'lts/*'
- uses: denoland/setup-deno@v1 - uses: denoland/setup-deno@v1
with: with:
deno-version: vx.x.x deno-version: v1.42.x
- name: ${{ matrix.step }} - name: ${{ matrix.step }}
if: always() if: always()
continue-on-error: true continue-on-error: true
run: | run: |
yarn install --immutable | grep -v 'YN0013' yarn install --immutable
if [ "${{ matrix.step }}" != "lint" ]; then if [ "${{ matrix.step }}" != "lint" ]; then
./scripts/install-build-deps.sh ./scripts/install-build-deps.sh
fi fi
+8 -4
View File
@@ -18,15 +18,19 @@ jobs:
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }} GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.GH_PAT_BOT }} token: ${{ secrets.GH_PAT_BOT }}
- uses: actions/setup-node@v3 ref: ${{ github.ref }}
- uses: actions/setup-node@v4
with: with:
node-version: 'lts/*' 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 - name: build
run: | run: |
yarn install --immutable | grep -v 'YN0013' yarn install --immutable
./scripts/install-build-deps.sh
yarn ${{ matrix.step }} yarn ${{ matrix.step }}
-19
View File
@@ -1,19 +0,0 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '35 1/3 * * *'
jobs:
stale:
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/stale@v7
with:
repo-token: ${{ secrets.GH_PAT_BOT }}
stale-issue-message: 'This issue has been open for 365 days with no activity and is not labelled as an enhancement. It will be closed in 7 days.'
stale-issue-label: 'stale'
exempt-issue-labels: '-size-l,-size-m,-size-s,-size-xl,-size-xs,[bug]'
days-before-stale: 365
days-before-close: 7
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/dev authors & contributors // Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/prettier.cjs'); module.exports = require('@polkadot/dev/config/prettier.cjs');
+4
View File
@@ -0,0 +1,4 @@
{
"eslint.enable": true,
"eslint.experimental.useFlatConfig": true
}
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-785
View File
File diff suppressed because one or more lines are too long
+934
View File
File diff suppressed because one or more lines are too long
+9 -7
View File
@@ -1,13 +1,15 @@
compressionLevel: mixed
enableGlobalCache: false
enableImmutableInstalls: false enableImmutableInstalls: false
enableProgressBars: false enableProgressBars: false
logFilters:
- code: YN0013
level: discard
nodeLinker: node-modules nodeLinker: node-modules
plugins: yarnPath: .yarn/releases/yarn-4.6.0.cjs
- 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
+82
View File
@@ -1,5 +1,87 @@
# CHANGELOG # CHANGELOG
## 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:
- Drop support for Node 16 (EOL 11 Sep 2023)
## 7.2.2 Aug 17, 2023
Changes:
- Adjust cjs exports for consistency
- Adjust usage of `?.` as per (latest) linting rules
## 7.2.1 May 13, 2023
Changes:
- Adjust `cjs/bytes.js` generation to follow `export.<var> = ...` form
- Add `module` to `package.json` export map (ESM-only)
## 7.1.2 Apr 28, 2023
Changes:
- Apply `readonly` specifiers to private class fields where applicable
- Adjust compilation output for `__internal__` class fields
## 7.1.1 Apr 22, 2023
Changes:
- Add `wasm-util` as dependency where `x-randomvalues` is a peer
- Drop support for Node 14 (EOL 30 Apr 2023)
## 7.0.3 Mar 11, 2023 ## 7.0.3 Mar 11, 2023
Changes: Changes:
+4 -1
View File
@@ -1,4 +1,7 @@
557 Jaco 7.0.3 (#495) 618 Jaco 2024 (#559)
19 Tarik Gul Bump dev to 0.83.2 (#578)
12 Valentin Fernandez 7.5.1 (#596)
3 rajk93 Added validation checks in PBKDF2 and Scrypt hashing functions (#584)
1 Evgeny Fixed type (#121) 1 Evgeny Fixed type (#121)
1 Shunfan Zhou Support sr25519 agreement (#209) 1 Shunfan Zhou Support sr25519 agreement (#209)
1 Steve Degosserie Expose Schnorrkel's VRF capabilities (#170) 1 Steve Degosserie Expose Schnorrkel's VRF capabilities (#170)
+13
View File
@@ -0,0 +1,13 @@
// Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import baseConfig from '@polkadot/dev/config/eslint';
export default [
...baseConfig,
{
ignores: [
'mod.ts'
]
}
];
+14 -14
View File
@@ -1,9 +1,12 @@
{ {
"author": "Jaco Greeff <jacogr@gmail.com>", "author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues", "bugs": "https://github.com/polkadot-js/wasm/issues",
"engines": {
"node": ">=18.14"
},
"homepage": "https://github.com/polkadot-js/wasm#readme", "homepage": "https://github.com/polkadot-js/wasm#readme",
"license": "Apache-2.0", "license": "Apache-2.0",
"packageManager": "yarn@3.2.0", "packageManager": "yarn@4.6.0",
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
@@ -11,10 +14,10 @@
}, },
"sideEffects": false, "sideEffects": false,
"type": "module", "type": "module",
"version": "7.0.3", "version": "7.5.1",
"versions": { "versions": {
"git": "7.0.3", "git": "7.5.1",
"npm": "7.0.3" "npm": "7.5.1"
}, },
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
@@ -22,7 +25,6 @@
"scripts": { "scripts": {
"build": "yarn build:wasm", "build": "yarn build:wasm",
"build:js": "./scripts/build-js.sh", "build:js": "./scripts/build-js.sh",
"build:mac": "PATH=\"/opt/homebrew/opt/llvm/bin:$PATH\" CC=/opt/homebrew/opt/llvm/bin/clang AR=/opt/homebrew/opt/llvm/bin/llvm-ar yarn build",
"build:release": "polkadot-ci-ghact-build", "build:release": "polkadot-ci-ghact-build",
"build:rollup": "polkadot-exec-rollup --config", "build:rollup": "polkadot-exec-rollup --config",
"build:wasm": "./scripts/build.sh", "build:wasm": "./scripts/build.sh",
@@ -36,19 +38,17 @@
"test:js": "yarn test:wasm-crypto:js", "test:js": "yarn test:wasm-crypto:js",
"test:wasm-crypto:deno": "deno test --allow-read --import-map=import_map.json packages/wasm-crypto/test/deno.ts", "test:wasm-crypto:deno": "deno test --allow-read --import-map=import_map.json packages/wasm-crypto/test/deno.ts",
"test:wasm-crypto:js": "yarn test:wasm-crypto:js:jest && yarn test:wasm-crypto:js:node", "test:wasm-crypto:js": "yarn test:wasm-crypto:js:jest && yarn test:wasm-crypto:js:node",
"test:wasm-crypto:js:jest": "polkadot-dev-run-test --env node --loader ./packages/wasm-crypto/test/loader-build.js test/jest.spec.ts", "test:wasm-crypto:js:jest": "polkadot-dev-run-test --env node --loader ./packages/wasm-crypto/test/loader-build.js",
"test:wasm-crypto:js:node": "node --no-warnings --loader ./packages/wasm-crypto/test/loader-build.js ./packages/wasm-crypto/test/wasm.js && node --no-warnings --loader ./packages/wasm-crypto/test/loader-build.js ./packages/wasm-crypto/test/asm.js", "test:wasm-crypto:js:node": "node --no-warnings --loader ./packages/wasm-crypto/test/loader-build.js ./packages/wasm-crypto/test/wasm.js",
"test:wasm-crypto:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --test-threads=1 --nocapture" "test:wasm-crypto:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --test-threads=1 --nocapture"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.0", "@polkadot/dev": "^0.83.3",
"@polkadot/dev": "^0.71.4", "@polkadot/util": "^13.5.5",
"@polkadot/util": "^11.0.1", "@types/node": "^20.16.1",
"@polkadot/x-randomvalues": "^11.0.1", "fflate": "^0.8.2"
"@types/node": "^18.15.0",
"fflate": "^0.7.4"
}, },
"resolutions": { "resolutions": {
"typescript": "^4.9.5" "typescript": "^5.5.4"
} }
} }
+8 -9
View File
@@ -1,14 +1,12 @@
{ {
"author": "Jaco Greeff <jacogr@gmail.com>", "author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues", "bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "A bridge layer between JS and Wasm", "description": "A bridge layer between JS and Wasm",
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=18"
}, },
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-bridge#readme", "homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-bridge#readme",
"license": "Apache-2.0", "license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-bridge", "name": "@polkadot/wasm-bridge",
"repository": { "repository": {
"directory": "packages/wasm-bridge", "directory": "packages/wasm-bridge",
@@ -16,18 +14,19 @@
"url": "https://github.com/polkadot-js/wasm.git" "url": "https://github.com/polkadot-js/wasm.git"
}, },
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./packageDetect.js",
"./detectPackage.cjs" "./packageDetect.cjs"
], ],
"type": "module", "type": "module",
"version": "7.0.3", "version": "7.5.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"tslib": "^2.5.0" "@polkadot/wasm-util": "7.5.1",
"tslib": "^2.7.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^11.0.1", "@polkadot/util": "^13.5.5",
"@polkadot/x-randomvalues": "^11.0.1" "@polkadot/x-randomvalues": "^13.5.5"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*", "@polkadot/util": "*",
+6 -5
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// A number of functions are "unsafe" and purposefully so - it is // A number of functions are "unsafe" and purposefully so - it is
@@ -18,20 +18,21 @@ import { Wbg } from './wbg.js';
* @description * @description
* Creates a bridge between the JS and WASM environments. * Creates a bridge between the JS and WASM environments.
* *
* For any bridge it is passed an function white is then called internally at the * For any bridge it is passed an function which is then called internally at the
* time of initialization. This affectively implements the layer between WASM and * time of initialization. This affectively implements the layer between WASM and
* the native environment, providing all the plumbing needed for the Wbg classes. * the native environment, providing all the plumbing needed for the Wbg classes.
*/ */
export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> { export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
readonly #createWasm: InitFn<C>;
readonly #heap: unknown[];
readonly #wbg: WasmImports;
#cachegetInt32: Int32Array | null; #cachegetInt32: Int32Array | null;
#cachegetUint8: Uint8Array | null; #cachegetUint8: Uint8Array | null;
#createWasm: InitFn<C>;
#heap: unknown[];
#heapNext: number; #heapNext: number;
#wasm: C | null; #wasm: C | null;
#wasmError: string | null; #wasmError: string | null;
#wasmPromise: InitPromise<C> | null; #wasmPromise: InitPromise<C> | null;
#wbg: WasmImports;
#type: 'asm' | 'wasm' | 'none'; #type: 'asm' | 'wasm' | 'none';
constructor (createWasm: InitFn<C>) { constructor (createWasm: InitFn<C>) {
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export * from './bridge.js'; export * from './bridge.js';
-4
View File
@@ -1,4 +0,0 @@
// Copyright 2017-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
-11
View File
@@ -1,11 +0,0 @@
// Copyright 2017-2023 @polkadot/wasm-bridge 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);
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import './detectPackage.js'; import './packageDetect.js';
export * from './bundle.js'; export * from './bundle.js';
+3 -3
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2023 @polkadot/wasm-bundle authors & contributors // Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } from './types.js'; import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } from './types.js';
@@ -11,7 +11,7 @@ import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } f
* It will attempt to create a WASM interface first and if this fails or is not available in * It will attempt to create a WASM interface first and if this fails or is not available in
* the environment, will fallback to attempting to create an ASM.js interface. * the environment, will fallback to attempting to create an ASM.js interface.
*/ */
export function createWasmFn <C extends WasmBaseInstance> (root: string, wasmBytes: null | Uint8Array, asmFn: null | ((wbg: WasmImports) => C)): InitFn<C> { export function createWasmFn <C extends WasmBaseInstance> (root: 'crypto', wasmBytes: null | Uint8Array, asmFn: null | ((wbg: WasmImports) => C)): InitFn<C> {
return async (wbg: WasmImports): InitPromise<C> => { return async (wbg: WasmImports): InitPromise<C> => {
const result: InitResult<C> = { const result: InitResult<C> = {
error: null, error: null,
@@ -20,7 +20,7 @@ export function createWasmFn <C extends WasmBaseInstance> (root: string, wasmByt
}; };
try { try {
if (!wasmBytes || !wasmBytes.length) { if (!wasmBytes?.length) {
throw new Error('No WebAssembly provided for initialization'); throw new Error('No WebAssembly provided for initialization');
} else if (typeof WebAssembly !== 'object' || typeof WebAssembly.instantiate !== 'function') { } else if (typeof WebAssembly !== 'object' || typeof WebAssembly.instantiate !== 'function') {
throw new Error('WebAssembly is not available in your environment'); throw new Error('WebAssembly is not available in your environment');
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export * from './index.js'; export * from './index.js';
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2017-2025 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
// (packageInfo imports will be kept as-is, user-editable)
import { detectPackage } from '@polkadot/util'; import { detectPackage } from '@polkadot/util';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js'; import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others); detectPackage(packageInfo, null, []);
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '7.0.3' }; export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '7.5.1' };
+7 -7
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Use non-strong types instead of WasmImports which may not // Use non-strong types instead of WasmImports which may not
@@ -7,7 +7,7 @@ export type WasmImports = Record<string, (...args: never[]) => unknown>;
// Use non-strong types instead of WebAssembly.Memory which may not // Use non-strong types instead of WebAssembly.Memory which may not
// be available as part of the TS environment types (it needs dom) // be available as part of the TS environment types (it needs dom)
export type WasmMemory = { buffer: ArrayBuffer }; export interface WasmMemory { buffer: ArrayBuffer }
export declare interface InitResult<C extends WasmBaseInstance> { export declare interface InitResult<C extends WasmBaseInstance> {
error: string | null; error: string | null;
@@ -35,13 +35,13 @@ export interface BridgeBase<C extends WasmBaseInstance> extends InitResult<C> {
resultString (): string; resultString (): string;
} }
export interface WasmBaseInstance { export interface WasmBindGen {
memory: WasmMemory;
// wbindgen functions (required and used internally)
__wbindgen_exn_store (a: number): void; __wbindgen_exn_store (a: number): void;
__wbindgen_free (a: number, b: number): void; __wbindgen_free (a: number, b: number): void;
__wbindgen_malloc (a: number): number; __wbindgen_malloc (a: number): number;
__wbindgen_realloc (a: number, b: number, c: number): number; __wbindgen_realloc (a: number, b: number, c: number): number;
} }
export interface WasmBaseInstance extends WasmBindGen {
memory: WasmMemory;
}
+2 -6
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import type { BridgeBase, WasmBaseInstance } from './types.js'; import type { BridgeBase, WasmBaseInstance } from './types.js';
@@ -20,7 +20,7 @@ const DEFAULT_SELF = { crypto: DEFAULT_CRYPTO };
* Internally the implementation does a thin layer into the supplied bridge. * Internally the implementation does a thin layer into the supplied bridge.
*/ */
export class Wbg<C extends WasmBaseInstance> { export class Wbg<C extends WasmBaseInstance> {
#bridge: BridgeBase<C>; readonly #bridge: BridgeBase<C>;
constructor (bridge: BridgeBase<C>) { constructor (bridge: BridgeBase<C>) {
this.#bridge = bridge; this.#bridge = bridge;
@@ -52,25 +52,21 @@ export class Wbg<C extends WasmBaseInstance> {
}; };
/** @internal */ /** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_crypto_968f1772287e2df0 = (_idx: number): number => { __wbg_crypto_968f1772287e2df0 = (_idx: number): number => {
return this.#bridge.addObject(DEFAULT_CRYPTO); return this.#bridge.addObject(DEFAULT_CRYPTO);
}; };
/** @internal */ /** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_a3d34b4fee3c2869 = (_idx: number): number => { __wbg_getRandomValues_a3d34b4fee3c2869 = (_idx: number): number => {
return this.#bridge.addObject(DEFAULT_CRYPTO.getRandomValues); return this.#bridge.addObject(DEFAULT_CRYPTO.getRandomValues);
}; };
/** @internal */ /** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_f5e14ab7ac8e995d = (_arg0: number, ptr: number, len: number): void => { __wbg_getRandomValues_f5e14ab7ac8e995d = (_arg0: number, ptr: number, len: number): void => {
DEFAULT_CRYPTO.getRandomValues(this.#bridge.getU8a(ptr, len)); DEFAULT_CRYPTO.getRandomValues(this.#bridge.getU8a(ptr, len));
}; };
/** @internal */ /** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_randomFillSync_d5bd2d655fdf256a = (_idx: number, _ptr: number, _len: number): never => { __wbg_randomFillSync_d5bd2d655fdf256a = (_idx: number, _ptr: number, _len: number): never => {
throw new Error('randomFillsync is not available'); throw new Error('randomFillsync is not available');
+4 -2
View File
@@ -5,6 +5,8 @@
"outDir": "./build", "outDir": "./build",
"rootDir": "./src" "rootDir": "./src"
}, },
"references": [ "exclude": [
] "**/mod.ts"
],
"references": []
} }
+8 -7
View File
@@ -1,29 +1,30 @@
{ {
"author": "Jaco Greeff <jacogr@gmail.com>", "author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues", "bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Asm.js content for wasm-crypto", "description": "Asm.js content for wasm-crypto",
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=18"
}, },
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-asmjs#readme", "homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-asmjs#readme",
"license": "Apache-2.0", "license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto-asmjs", "name": "@polkadot/wasm-crypto-asmjs",
"repository": { "repository": {
"directory": "packages/wasm-crypto-asmjs", "directory": "packages/wasm-crypto-asmjs",
"type": "git", "type": "git",
"url": "https://github.com/polkadot-js/wasm.git" "url": "https://github.com/polkadot-js/wasm.git"
}, },
"sideEffects": false, "sideEffects": [
"./packageDetect.js",
"./packageDetect.cjs"
],
"type": "module", "type": "module",
"version": "7.0.3", "version": "7.5.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"tslib": "^2.5.0" "tslib": "^2.7.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^11.0.1" "@polkadot/util": "^13.5.5"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*" "@polkadot/util": "*"
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export { asmJsInit } from './cjs/data.js'; 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 // SPDX-License-Identifier: Apache-2.0
const data = require('../data.js'); const data = require('../data.js');
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export declare const asmJsInit: null; export declare const asmJsInit: null;
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
const asmJsInit = null; const asmJsInit = null;
module.exports.asmJsInit = asmJsInit; exports.asmJsInit = asmJsInit;
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export declare const asmJsInit: null; export declare const asmJsInit: null;
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export const asmJsInit = null; 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 [];
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import './detectPackage.js'; import './packageDetect.js';
export * from './bundle.js'; export * from './bundle.js';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export * from './index.js'; export * from './index.js';
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
// (packageInfo imports will be kept as-is, user-editable)
import { detectPackage } from '@polkadot/util'; import { detectPackage } from '@polkadot/util';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.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 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '7.0.3' }; export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '7.5.1' };
@@ -5,5 +5,8 @@
"outDir": "./build", "outDir": "./build",
"rootDir": "./src" "rootDir": "./src"
}, },
"exclude": [
"**/mod.ts"
],
"references": [] "references": []
} }
+11 -12
View File
@@ -1,14 +1,12 @@
{ {
"author": "Jaco Greeff <jacogr@gmail.com>", "author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues", "bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Init handlers for wasm-crypto", "description": "Init handlers for wasm-crypto",
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=18"
}, },
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-init#readme", "homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-init#readme",
"license": "Apache-2.0", "license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto-init", "name": "@polkadot/wasm-crypto-init",
"repository": { "repository": {
"directory": "packages/wasm-crypto-init", "directory": "packages/wasm-crypto-init",
@@ -16,23 +14,24 @@
"url": "https://github.com/polkadot-js/wasm.git" "url": "https://github.com/polkadot-js/wasm.git"
}, },
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./packageDetect.js",
"./detectPackage.cjs" "./packageDetect.cjs"
], ],
"type": "module", "type": "module",
"version": "7.0.3", "version": "7.5.1",
"browser": "wasm.js", "browser": "wasm.js",
"main": "wasm.js", "main": "wasm.js",
"react-native": "asm.js", "react-native": "asm.js",
"dependencies": { "dependencies": {
"@polkadot/wasm-bridge": "7.0.3", "@polkadot/wasm-bridge": "7.5.1",
"@polkadot/wasm-crypto-asmjs": "7.0.3", "@polkadot/wasm-crypto-asmjs": "7.5.1",
"@polkadot/wasm-crypto-wasm": "7.0.3", "@polkadot/wasm-crypto-wasm": "7.5.1",
"tslib": "^2.5.0" "@polkadot/wasm-util": "7.5.1",
"tslib": "^2.7.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^11.0.1", "@polkadot/util": "^13.5.5",
"@polkadot/x-randomvalues": "^11.0.1" "@polkadot/x-randomvalues": "^13.5.5"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*", "@polkadot/util": "*",
+4 -2
View File
@@ -1,11 +1,13 @@
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types'; import type { InitFn } from '@polkadot/wasm-bridge/types';
import type { WasmCryptoInstance } from './types.js'; import type { WasmCryptoInstance } from './types.js';
import { createWasmFn } from '@polkadot/wasm-bridge'; import { createWasmFn } from '@polkadot/wasm-bridge';
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs'; import * as mod from '@polkadot/wasm-crypto-asmjs';
const { asmJsInit } = mod;
export { packageInfo } from './packageInfo.js'; export { packageInfo } from './packageInfo.js';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types'; import type { InitFn } from '@polkadot/wasm-bridge/types';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export * from './wasm.js'; 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 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export * from './wasm.js'; export * from './wasm.js';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types'; 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]);
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '7.0.3' }; export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '7.5.1' };
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import type { WasmBaseInstance } from '@polkadot/wasm-bridge/types'; import type { WasmBaseInstance } from '@polkadot/wasm-bridge/types';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types'; import type { InitFn } from '@polkadot/wasm-bridge/types';
@@ -5,6 +5,9 @@
"outDir": "./build", "outDir": "./build",
"rootDir": "./src" "rootDir": "./src"
}, },
"exclude": [
"**/mod.ts"
],
"references": [ "references": [
{ "path": "../wasm-bridge/tsconfig.build.json" }, { "path": "../wasm-bridge/tsconfig.build.json" },
{ "path": "../wasm-crypto-asmjs/tsconfig.build.json" }, { "path": "../wasm-crypto-asmjs/tsconfig.build.json" },
+9 -8
View File
@@ -1,30 +1,31 @@
{ {
"author": "Jaco Greeff <jacogr@gmail.com>", "author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues", "bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Wasm content for wasm-crypto", "description": "Wasm content for wasm-crypto",
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=18"
}, },
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-wasm#readme", "homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-wasm#readme",
"license": "Apache-2.0", "license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto-wasm", "name": "@polkadot/wasm-crypto-wasm",
"repository": { "repository": {
"directory": "packages/wasm-crypto-wasm", "directory": "packages/wasm-crypto-wasm",
"type": "git", "type": "git",
"url": "https://github.com/polkadot-js/wasm.git" "url": "https://github.com/polkadot-js/wasm.git"
}, },
"sideEffects": false, "sideEffects": [
"./packageDetect.js",
"./packageDetect.cjs"
],
"type": "module", "type": "module",
"version": "7.0.3", "version": "7.5.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@polkadot/wasm-util": "7.0.3", "@polkadot/wasm-util": "7.5.1",
"tslib": "^2.5.0" "tslib": "^2.7.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^11.0.1" "@polkadot/util": "^13.5.5"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*" "@polkadot/util": "*"
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import { base64Decode, unzlibSync } from '@polkadot/wasm-util'; import { base64Decode, unzlibSync } from '@polkadot/wasm-util';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export declare const bytes: string; export declare const bytes: string;
+4 -4
View File
@@ -1,8 +1,8 @@
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
module.exports.bytes = ''; exports.lenIn = 0;
module.exports.lenIn = 0; exports.lenOut = 0;
module.exports.lenOut = 0; exports.bytes = '';
@@ -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 // SPDX-License-Identifier: Apache-2.0
const bytes = require('../bytes.js'); const bytes = require('../bytes.js');
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export declare const bytes: string; export declare const bytes: string;
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export const bytes = ''; 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,11 +0,0 @@
// Copyright 2017-2023 @polkadot/wasm-crypto-wasm 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);
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import './detectPackage.js'; import './packageDetect.js';
export * from './bundle.js'; export * from './bundle.js';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export * from './index.js'; export * from './index.js';
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/wasm-crypto-init authors & contributors // Copyright 2017-2025 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
// (packageInfo imports will be kept as-is, user-editable)
import { detectPackage } from '@polkadot/util'; import { detectPackage } from '@polkadot/util';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js'; import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others); detectPackage(packageInfo, null, []);
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '7.0.3' }; export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '7.5.1' };
@@ -5,6 +5,9 @@
"outDir": "./build", "outDir": "./build",
"rootDir": "./src" "rootDir": "./src"
}, },
"exclude": [
"**/mod.ts"
],
"references": [ "references": [
{ "path": "../wasm-util/tsconfig.build.json" } { "path": "../wasm-util/tsconfig.build.json" }
] ]
+104 -66
View File
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 4
[[package]] [[package]]
name = "addr2line" name = "addr2line"
@@ -54,9 +54,9 @@ dependencies = [
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]] [[package]]
name = "blake2-rfc" name = "blake2-rfc"
@@ -125,15 +125,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "constant_time_eq" name = "constant_time_eq"
version = "0.1.5" version = "0.1.5"
@@ -315,9 +306,9 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
@@ -325,15 +316,6 @@ version = "0.2.108"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
[[package]]
name = "lock_api"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
dependencies = [
"scopeguard",
]
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.11" version = "0.4.11"
@@ -384,11 +366,11 @@ checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.4.0" version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
dependencies = [ dependencies = [
"parking_lot", "parking_lot_core",
] ]
[[package]] [[package]]
@@ -397,28 +379,17 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "parking_lot"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.7.2" version = "0.9.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
"cloudabi",
"libc", "libc",
"redox_syscall", "redox_syscall",
"smallvec", "smallvec",
"winapi", "windows-targets",
] ]
[[package]] [[package]]
@@ -445,18 +416,18 @@ checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.36" version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.7" version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@@ -504,9 +475,12 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.1.57" version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6"
dependencies = [
"bitflags",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
@@ -538,12 +512,6 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "scrypt" name = "scrypt"
version = "0.2.0" version = "0.2.0"
@@ -601,9 +569,9 @@ checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.4.1" version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]] [[package]]
name = "subtle" name = "subtle"
@@ -686,6 +654,12 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
version = "0.1.13" version = "0.1.13"
@@ -740,9 +714,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.79" version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@@ -750,9 +724,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.79" version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@@ -765,9 +739,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.79" version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@@ -775,9 +749,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.79" version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -788,9 +762,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.79" version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744"
[[package]] [[package]]
name = "wee_alloc" name = "wee_alloc"
@@ -826,6 +800,70 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "zeroize" name = "zeroize"
version = "1.1.0" version = "1.1.0"
+1 -1
View File
@@ -32,7 +32,7 @@ sha2 = "0.8.1"
tiny-bip39 = { version = "0.7", default-features = false } tiny-bip39 = { version = "0.7", default-features = false }
tiny-keccak = { version = "2.0.1", features = ["keccak"] } tiny-keccak = { version = "2.0.1", features = ["keccak"] }
twox-hash = "1.5.0" twox-hash = "1.5.0"
wasm-bindgen = "=0.2.79" wasm-bindgen = "0.2"
wee_alloc = "0.4.3" wee_alloc = "0.4.3"
[dev-dependencies] [dev-dependencies]
+13 -15
View File
@@ -1,14 +1,12 @@
{ {
"author": "Jaco Greeff <jacogr@gmail.com>", "author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues", "bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "A wasm interface layer for use by @polkadot/util-crypto", "description": "A wasm interface layer for use by @polkadot/util-crypto",
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=18"
}, },
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto#readme", "homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto#readme",
"license": "Apache-2.0", "license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto", "name": "@polkadot/wasm-crypto",
"repository": { "repository": {
"directory": "packages/wasm-crypto", "directory": "packages/wasm-crypto",
@@ -16,8 +14,6 @@
"url": "https://github.com/polkadot-js/wasm.git" "url": "https://github.com/polkadot-js/wasm.git"
}, },
"sideEffects": [ "sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs",
"./initNone.js", "./initNone.js",
"./initNone.cjs", "./initNone.cjs",
"./initOnlyAsm.js", "./initOnlyAsm.js",
@@ -25,22 +21,24 @@
"./initOnlyWasm.js", "./initOnlyWasm.js",
"./initOnlyWasm.cjs", "./initOnlyWasm.cjs",
"./initWasmAsm.js", "./initWasmAsm.js",
"./initWasmAsm.cjs" "./initWasmAsm.cjs",
"./packageDetect.js",
"./packageDetect.cjs"
], ],
"type": "module", "type": "module",
"version": "7.0.3", "version": "7.5.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@polkadot/wasm-bridge": "7.0.3", "@polkadot/wasm-bridge": "7.5.1",
"@polkadot/wasm-crypto-asmjs": "7.0.3", "@polkadot/wasm-crypto-asmjs": "7.5.1",
"@polkadot/wasm-crypto-init": "7.0.3", "@polkadot/wasm-crypto-init": "7.5.1",
"@polkadot/wasm-crypto-wasm": "7.0.3", "@polkadot/wasm-crypto-wasm": "7.5.1",
"@polkadot/wasm-util": "7.0.3", "@polkadot/wasm-util": "7.5.1",
"tslib": "^2.5.0" "tslib": "^2.7.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/util": "^11.0.1", "@polkadot/util": "^13.5.5",
"@polkadot/x-randomvalues": "^11.0.1" "@polkadot/x-randomvalues": "^13.5.5"
}, },
"peerDependencies": { "peerDependencies": {
"@polkadot/util": "*", "@polkadot/util": "*",
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import type { WasmCryptoInstance } from '@polkadot/wasm-crypto-init/types'; import type { WasmCryptoInstance } from '@polkadot/wasm-crypto-init/types';
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import './detectPackage.js'; import './packageDetect.js';
export * from './bundle.js'; export * from './bundle.js';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types'; import type { InitFn } from '@polkadot/wasm-bridge/types';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/none'; import { createWasm } from '@polkadot/wasm-crypto-init/none';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/asm'; import { createWasm } from '@polkadot/wasm-crypto-init/asm';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/wasm'; import { createWasm } from '@polkadot/wasm-crypto-init/wasm';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/both'; import { createWasm } from '@polkadot/wasm-crypto-init/both';
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Use `wee_alloc` as the global allocator. // Use `wee_alloc` as the global allocator.
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
export * from './index.js'; 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 // 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 bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo'; import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
import { packageInfo as initInfo } from '@polkadot/wasm-crypto-init/packageInfo'; import { packageInfo as initInfo } from '@polkadot/wasm-crypto-init/packageInfo';
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo'; import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
import { packageInfo as utilInfo } from '@polkadot/wasm-util/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]);
+2 -2
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto', path: 'auto', type: 'auto', version: '7.0.3' }; export const packageInfo = { name: '@polkadot/wasm-crypto', path: 'auto', type: 'auto', version: '7.5.1' };
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
use bip39::{Mnemonic, MnemonicType, Language, Seed}; use bip39::{Mnemonic, MnemonicType, Language, Seed};
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
use std::convert::TryFrom; use std::convert::TryFrom;
+27 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
use blake2_rfc::blake2b::blake2b; use blake2_rfc::blake2b::blake2b;
@@ -100,6 +100,11 @@ pub fn ext_keccak512(data: &[u8]) -> Vec<u8> {
/// Returns a vector with the hashed result /// Returns a vector with the hashed result
#[wasm_bindgen] #[wasm_bindgen]
pub fn ext_pbkdf2(data: &[u8], salt: &[u8], rounds: u32) -> Vec<u8> { 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]; let mut res = [0u8; 64];
// we cast to usize here - due to the WASM, we'd rather have u32 inputs // 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 /// Returns vector with the hashed result
#[wasm_bindgen] #[wasm_bindgen]
pub fn ext_scrypt(password: &[u8], salt: &[u8], log2_n: u8, r: u32, p: u32) -> Vec<u8> { 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) { match ScryptParams::new(log2_n, r, p) {
Ok(p) => { Ok(p) => {
let mut res = [0u8; 64]; let mut res = [0u8; 64];
@@ -254,6 +264,14 @@ pub mod tests {
assert_eq!(hash[..], expected[..]); 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] #[test]
fn can_scrypt() { fn can_scrypt() {
let password = b"password"; let password = b"password";
@@ -264,6 +282,14 @@ pub mod tests {
assert_eq!(hash[..], expected[..]); 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] #[test]
fn can_sha256() { fn can_sha256() {
let data = b"hello world"; let data = b"hello world";
+109 -89
View File
@@ -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 // 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::*; use wasm_bindgen::prelude::*;
#[wasm_bindgen] #[wasm_bindgen]
pub fn ext_secp_pub_compress(pubkey: &[u8]) -> Vec<u8> { pub fn ext_secp_pub_compress(pubkey: &[u8]) -> Vec<u8> {
match PublicKey::from_slice(&pubkey) { match PublicKey::from_slice(&pubkey) {
Ok(p) => p Ok(p) => p.serialize().to_vec(),
.serialize() _ => panic!("Invalid pubkey provided."),
.to_vec(), }
_ => panic!("Invalid pubkey provided.")
}
} }
#[wasm_bindgen] #[wasm_bindgen]
pub fn ext_secp_pub_expand(pubkey: &[u8]) -> Vec<u8> { pub fn ext_secp_pub_expand(pubkey: &[u8]) -> Vec<u8> {
match PublicKey::from_slice(&pubkey) { match PublicKey::from_slice(&pubkey) {
Ok(p) => p Ok(p) => p.serialize_uncompressed().to_vec(),
.serialize_uncompressed() _ => panic!("Invalid pubkey provided."),
.to_vec(), }
_ => panic!("Invalid pubkey provided.")
}
} }
#[wasm_bindgen] #[wasm_bindgen]
pub fn ext_secp_from_seed(seed: &[u8]) -> Vec<u8> { pub fn ext_secp_from_seed(seed: &[u8]) -> Vec<u8> {
match SecretKey::from_slice(seed) { match SecretKey::from_slice(seed) {
Ok(s) => { Ok(s) => {
let mut res = vec![]; let mut res = vec![];
let pubkey = PublicKey::from_secret_key(SECP256K1, &s); let pubkey = PublicKey::from_secret_key(SECP256K1, &s);
res.extend_from_slice(&s.serialize_secret()); res.extend_from_slice(&s.serialize_secret());
res.extend_from_slice(&pubkey.serialize()); res.extend_from_slice(&pubkey.serialize());
res res
}, }
_ => panic!("Invalid seed provided.") _ => panic!("Invalid seed provided."),
} }
} }
#[wasm_bindgen] #[wasm_bindgen]
pub fn ext_secp_recover(hash: &[u8], sig: &[u8], rec: i32) -> Vec<u8> { pub fn ext_secp_recover(hash: &[u8], sig: &[u8], rec: i32) -> Vec<u8> {
match RecoveryId::from_i32(rec) { match RecoveryId::from_i32(rec) {
Ok(r) => match (Message::from_slice(hash), RecoverableSignature::from_compact(&sig, r)) { Ok(r) => match (
(Ok(m), Ok(s)) => match s.recover(&m) { Message::from_slice(hash),
Ok(k) => k RecoverableSignature::from_compact(&sig, r),
.serialize() ) {
.to_vec(), (Ok(m), Ok(s)) => {
_ => panic!("Unable to recover.") let standard = s.to_standard();
}, let mut normalized = standard;
_ => panic!("Invalid signature provided.") normalized.normalize_s();
},
_ => panic!("Invalid recovery data provided.") // 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] #[wasm_bindgen]
pub fn ext_secp_sign(hash: &[u8], seckey: &[u8]) -> Vec<u8> { pub fn ext_secp_sign(hash: &[u8], seckey: &[u8]) -> Vec<u8> {
match (Message::from_slice(hash), SecretKey::from_slice(seckey)) { match (Message::from_slice(hash), SecretKey::from_slice(seckey)) {
(Ok(m), Ok(s)) => { (Ok(m), Ok(s)) => {
let mut res = vec![]; let mut res = vec![];
let (rec, sig) = SECP256K1 let (rec, sig) = SECP256K1.sign_ecdsa_recoverable(&m, &s).serialize_compact();
.sign_ecdsa_recoverable(&m, &s)
.serialize_compact();
res.extend_from_slice(&sig); res.extend_from_slice(&sig);
res.push(rec.to_i32() as u8); res.push(rec.to_i32() as u8);
res res
}, }
_ => panic!("Invalid message or secret provided.") _ => panic!("Invalid message or secret provided."),
} }
} }
#[cfg(test)] #[cfg(test)]
pub mod tests { pub mod tests {
use hex_literal::hex; use super::*;
use super::*; use hex_literal::hex;
#[test] #[test]
fn can_create_pair() { fn can_create_pair() {
let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae"); let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae");
let expected = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae03fd8c74f795ced92064b86191cb2772b1e3a0947740aa0a5a6e379592471fd85b"); let expected = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae03fd8c74f795ced92064b86191cb2772b1e3a0947740aa0a5a6e379592471fd85b");
let res = ext_secp_from_seed(&seckey); let res = ext_secp_from_seed(&seckey);
assert_eq!(res[..], expected[..]); assert_eq!(res[..], expected[..]);
} }
#[test] #[test]
fn can_pub_compress_full() { fn can_pub_compress_full() {
let pubkey = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af"); let pubkey = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af");
let expected = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077"); let expected = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077");
let res = ext_secp_pub_compress(&pubkey); let res = ext_secp_pub_compress(&pubkey);
assert_eq!(res[..], expected[..]); assert_eq!(res[..], expected[..]);
} }
#[test] #[test]
fn can_pub_expand_comp() { fn can_pub_expand_comp() {
let pubkey = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077"); let pubkey = hex!("03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077");
let expected = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af"); let expected = hex!("04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af");
let res = ext_secp_pub_expand(&pubkey); let res = ext_secp_pub_expand(&pubkey);
assert_eq!(res[..], expected[..]); assert_eq!(res[..], expected[..]);
} }
#[test] #[test]
fn can_recover() { fn can_recover() {
let expected = hex!("028d13da15a02f3a70677339d51b14177ee9b49657662b35e56a9d9dee17db1d30"); let expected = hex!("028d13da15a02f3a70677339d51b14177ee9b49657662b35e56a9d9dee17db1d30");
let sig = hex!("7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff"); let sig = hex!("7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff");
let msg = hex!("a30b64ce1eedf409c8afb801d72c05234e64849ea538c15dd3c8cf4ffcf166c9"); let msg = hex!("a30b64ce1eedf409c8afb801d72c05234e64849ea538c15dd3c8cf4ffcf166c9");
let res = ext_secp_recover(&msg, &sig, 0); let res = ext_secp_recover(&msg, &sig, 0);
assert_eq!(res[..], expected[..]); assert_eq!(res[..], expected[..]);
} }
#[test] #[test]
fn can_sign() { fn can_sign() {
// JS expectation - doesn't match? // JS expectation - doesn't match?
// let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba8c4efa521361678d9b8582744d77aa4b8d886d7380b7808a683174afad9c4700300"); // let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba8c4efa521361678d9b8582744d77aa4b8d886d7380b7808a683174afad9c4700300");
let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba83b105adec9e9872647a7d8bb28855b45e22805aea3d097953cbb1391f671d13e01"); let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba83b105adec9e9872647a7d8bb28855b45e22805aea3d097953cbb1391f671d13e01");
let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae"); let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae");
let msg = hex!("68c731589a583d08b70861683b59ce3dd56284cb2f0da5b6cd83e6641dac3aab"); let msg = hex!("68c731589a583d08b70861683b59ce3dd56284cb2f0da5b6cd83e6641dac3aab");
let res = ext_secp_sign(&msg, &seckey); 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 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/ // Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/ // Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
+21 -1
View File
@@ -1,8 +1,13 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* global it */
import { assert, u8aToHex } from '@polkadot/util'; import { assert, u8aToHex } from '@polkadot/util';
/**
* @param {*} wasm
*/
export function bip39Generate (wasm) { export function bip39Generate (wasm) {
it('generates a bip39 phrase', () => { it('generates a bip39 phrase', () => {
const res = wasm.bip39Generate(21); const res = wasm.bip39Generate(21);
@@ -13,6 +18,9 @@ export function bip39Generate (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function bip39GenerateSubsequent (wasm) { export function bip39GenerateSubsequent (wasm) {
it('generates different subsequent mnemonics', () => { it('generates different subsequent mnemonics', () => {
const val1 = wasm.bip39Generate(24); const val1 = wasm.bip39Generate(24);
@@ -25,6 +33,9 @@ export function bip39GenerateSubsequent (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function bip39Validate (wasm) { export function bip39Validate (wasm) {
it('validates a created mnemonic', () => { it('validates a created mnemonic', () => {
const res = wasm.bip39Validate(wasm.bip39Generate(12)); const res = wasm.bip39Validate(wasm.bip39Generate(12));
@@ -35,6 +46,9 @@ export function bip39Validate (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function bip39ToEntropy (wasm) { export function bip39ToEntropy (wasm) {
it('creates correct entropy for a known mnemonic', () => { it('creates correct entropy for a known mnemonic', () => {
const res = u8aToHex(wasm.bip39ToEntropy('legal winner thank year wave sausage worth useful legal winner thank yellow')); const res = u8aToHex(wasm.bip39ToEntropy('legal winner thank year wave sausage worth useful legal winner thank yellow'));
@@ -45,6 +59,9 @@ export function bip39ToEntropy (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function bip39ToMiniSecret (wasm) { export function bip39ToMiniSecret (wasm) {
it('creates the correct minisecret from a mnemonic', () => { it('creates the correct minisecret from a mnemonic', () => {
const res = u8aToHex(wasm.bip39ToMiniSecret('legal winner thank year wave sausage worth useful legal winner thank yellow', 'Substrate')); const res = u8aToHex(wasm.bip39ToMiniSecret('legal winner thank year wave sausage worth useful legal winner thank yellow', 'Substrate'));
@@ -55,6 +72,9 @@ export function bip39ToMiniSecret (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function bip39ToSeed (wasm) { export function bip39ToSeed (wasm) {
it('creates the correct seed for a mnemonic', () => { it('creates the correct seed for a mnemonic', () => {
const res = u8aToHex(wasm.bip39ToSeed('seed sock milk update focus rotate barely fade car face mechanic mercy', '')); const res = u8aToHex(wasm.bip39ToSeed('seed sock milk update focus rotate barely fade car face mechanic mercy', ''));
+25 -5
View File
@@ -1,20 +1,31 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* global it */
import crypto from 'crypto'; import crypto from 'crypto';
import { assert, hexToU8a, stringToU8a, u8aToHex } from '@polkadot/util'; import { assert, hexToU8a, stringToU8a, u8aToHex } from '@polkadot/util';
/** @internal */ /**
* @internal
* @param {*} pair
*/
function extractKeys (pair) { function extractKeys (pair) {
return [pair, pair.slice(32), pair.slice(0, 32)]; return [pair, pair.slice(32), pair.slice(0, 32)];
} }
/** @internal */ /**
* @internal
* @param {*} wasm
*/
function randomPair (wasm) { function randomPair (wasm) {
return extractKeys(wasm.ed25519KeypairFromSeed(crypto.randomBytes(32))); return extractKeys(wasm.ed25519KeypairFromSeed(crypto.randomBytes(32)));
} }
/**
* @param {*} wasm
*/
export function ed25519PairFromSeed (wasm) { export function ed25519PairFromSeed (wasm) {
it('creates a known pair from a known seed', () => { it('creates a known pair from a known seed', () => {
const [pair, pk, sk] = extractKeys(wasm.ed25519KeypairFromSeed(stringToU8a('12345678901234567890123456789012'))); const [pair, pk, sk] = extractKeys(wasm.ed25519KeypairFromSeed(stringToU8a('12345678901234567890123456789012')));
@@ -22,12 +33,15 @@ export function ed25519PairFromSeed (wasm) {
// console.log('\tSEC', u8aToHex(sk)); // console.log('\tSEC', u8aToHex(sk));
// console.log('\tPUB', u8aToHex(pk)); // console.log('\tPUB', u8aToHex(pk));
assert(u8aToHex(sk) === '0x3132333435363738393031323334353637383930313233343536373839303132'); assert(u8aToHex(sk) === '0x3132333435363738393031323334353637383930313233343536373839303132', 'Secretkey does not match');
assert(u8aToHex(pk) === '0x2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee'); assert(u8aToHex(pk) === '0x2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee', 'Public key does not match');
assert(u8aToHex(pair) === '0x31323334353637383930313233343536373839303132333435363738393031322f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee', 'ERROR: pairFromSeed() does not match'); assert(u8aToHex(pair) === '0x31323334353637383930313233343536373839303132333435363738393031322f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee', 'ERROR: pairFromSeed() does not match');
}); });
} }
/**
* @param {*} wasm
*/
export function ed25519SignAndVerify (wasm) { export function ed25519SignAndVerify (wasm) {
it('signs and verifies', () => { it('signs and verifies', () => {
const [, pk, sk] = randomPair(wasm); const [, pk, sk] = randomPair(wasm);
@@ -41,6 +55,9 @@ export function ed25519SignAndVerify (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function ed25519VerifyExisting (wasm) { export function ed25519VerifyExisting (wasm) {
it('verifies a known signature', () => { it('verifies a known signature', () => {
const isValid = wasm.ed25519Verify(hexToU8a('0x90588f3f512496f2dd40571d162e8182860081c74e2085316e7c4396918f07da412ee029978e4dd714057fe973bd9e7d645148bf7b66680d67c93227cde95202'), stringToU8a('this is a message'), hexToU8a('0x2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee')); const isValid = wasm.ed25519Verify(hexToU8a('0x90588f3f512496f2dd40571d162e8182860081c74e2085316e7c4396918f07da412ee029978e4dd714057fe973bd9e7d645148bf7b66680d67c93227cde95202'), stringToU8a('this is a message'), hexToU8a('0x2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee'));
@@ -51,6 +68,9 @@ export function ed25519VerifyExisting (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function ed25519Benchmark (wasm) { export function ed25519Benchmark (wasm) {
it('runs a verification benchamark', () => { it('runs a verification benchamark', () => {
const MESSAGE = stringToU8a('this is a message'); const MESSAGE = stringToU8a('this is a message');
+33 -1
View File
@@ -1,8 +1,13 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* global it */
import { assert, stringToU8a, u8aToHex } from '@polkadot/util'; import { assert, stringToU8a, u8aToHex } from '@polkadot/util';
/**
* @param {*} wasm
*/
export function blake2bHash (wasm) { export function blake2bHash (wasm) {
it('creates a known blake2b hash', () => { it('creates a known blake2b hash', () => {
const hash = u8aToHex(wasm.blake2b(stringToU8a('abc'), new Uint8Array(), 64)); const hash = u8aToHex(wasm.blake2b(stringToU8a('abc'), new Uint8Array(), 64));
@@ -13,6 +18,9 @@ export function blake2bHash (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function hmacSha256 (wasm) { export function hmacSha256 (wasm) {
it('creates a known hmacSha256', () => { it('creates a known hmacSha256', () => {
const hash = u8aToHex(wasm.hmacSha256(stringToU8a('secret'), stringToU8a('some message'))); const hash = u8aToHex(wasm.hmacSha256(stringToU8a('secret'), stringToU8a('some message')));
@@ -23,6 +31,9 @@ export function hmacSha256 (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function hmacSha512 (wasm) { export function hmacSha512 (wasm) {
it('creates a known hmacSha512', () => { it('creates a known hmacSha512', () => {
const hash = u8aToHex(wasm.hmacSha512(stringToU8a('secret'), stringToU8a('some message'))); const hash = u8aToHex(wasm.hmacSha512(stringToU8a('secret'), stringToU8a('some message')));
@@ -33,6 +44,9 @@ export function hmacSha512 (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function keccak256 (wasm) { export function keccak256 (wasm) {
it('creates a known keccak256 hash', () => { it('creates a known keccak256 hash', () => {
const hash = u8aToHex(wasm.keccak256(stringToU8a('test value'))); const hash = u8aToHex(wasm.keccak256(stringToU8a('test value')));
@@ -43,6 +57,9 @@ export function keccak256 (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function keccak512 (wasm) { export function keccak512 (wasm) {
it('creates a known keccak512 hash', () => { it('creates a known keccak512 hash', () => {
const hash = u8aToHex(wasm.keccak512(stringToU8a('test'))); const hash = u8aToHex(wasm.keccak512(stringToU8a('test')));
@@ -53,6 +70,9 @@ export function keccak512 (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function pbkdf2Hash (wasm) { export function pbkdf2Hash (wasm) {
it('creates a known pbkdf2 hash', () => { it('creates a known pbkdf2 hash', () => {
const hash = u8aToHex(wasm.pbkdf2(stringToU8a('hello world'), stringToU8a('this is a salt'), 2048)); const hash = u8aToHex(wasm.pbkdf2(stringToU8a('hello world'), stringToU8a('this is a salt'), 2048));
@@ -63,6 +83,9 @@ export function pbkdf2Hash (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function scryptHash (wasm) { export function scryptHash (wasm) {
it('creates a known scrypt hash', () => { it('creates a known scrypt hash', () => {
const hash = u8aToHex(wasm.scrypt(stringToU8a('password'), stringToU8a('salt'), 14, 8, 1)); const hash = u8aToHex(wasm.scrypt(stringToU8a('password'), stringToU8a('salt'), 14, 8, 1));
@@ -73,6 +96,9 @@ export function scryptHash (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sha256Hash (wasm) { export function sha256Hash (wasm) {
it('creates a known sha256 hash', () => { it('creates a known sha256 hash', () => {
const hash = u8aToHex(wasm.sha256(stringToU8a('hello world'))); const hash = u8aToHex(wasm.sha256(stringToU8a('hello world')));
@@ -83,6 +109,9 @@ export function sha256Hash (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sha512Hash (wasm) { export function sha512Hash (wasm) {
it('creates a known sha512 hash', () => { it('creates a known sha512 hash', () => {
const hash = u8aToHex(wasm.sha512(stringToU8a('hello world'))); const hash = u8aToHex(wasm.sha512(stringToU8a('hello world')));
@@ -93,6 +122,9 @@ export function sha512Hash (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function twoxHash (wasm) { export function twoxHash (wasm) {
it('creates a known twox hash', () => { it('creates a known twox hash', () => {
const hash64 = u8aToHex(wasm.twox(stringToU8a('abc'), 1)); const hash64 = u8aToHex(wasm.twox(stringToU8a('abc'), 1));
+21 -3
View File
@@ -1,6 +1,8 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* global describe */
import { assert } from '@polkadot/util'; import { assert } from '@polkadot/util';
import * as bip39 from './bip39.js'; import * as bip39 from './bip39.js';
@@ -23,6 +25,10 @@ export const tests = {
vrf vrf
}; };
/**
* @param {string} name
* @param {*} wasm
*/
export async function initRun (name, wasm) { export async function initRun (name, wasm) {
const result = await wasm.waitReady(); const result = await wasm.waitReady();
@@ -33,7 +39,12 @@ export async function initRun (name, wasm) {
return result; return result;
} }
/**
* @param {string} name
* @param {*} wasm
*/
export function runAll (name, wasm) { export function runAll (name, wasm) {
/** @type {string[]} */
const failed = []; const failed = [];
let count = 0; let count = 0;
@@ -51,7 +62,6 @@ export function runAll (name, wasm) {
try { try {
console.time(timerId); console.time(timerId);
console.log(); console.log();
// console.log(timerId);
test(wasm); test(wasm);
@@ -71,20 +81,28 @@ export function runAll (name, wasm) {
} }
} }
/**
* @param {string} type
* @param {*} wasm
*/
export function runUnassisted (type, wasm) { export function runUnassisted (type, wasm) {
console.log(`\n*** ${type}: Running tests`); console.log(`\n*** ${type}: Running tests`);
// for these we are pass-through describe and it handlers // For these we are pass-through describe and it handlers
// @ts-expect-error We are hacking this, so expect TS to be unhappy...
globalThis.describe = (name, fn) => { globalThis.describe = (name, fn) => {
console.log('\n', name); console.log('\n', name);
// We expect this to be handled top-level, in the test itself
// eslint-disable-next-line @typescript-eslint/no-floating-promises // eslint-disable-next-line @typescript-eslint/no-floating-promises
fn(); fn();
}; };
// @ts-expect-error We are hacking this, so expect TS to be unhappy...
globalThis.it = (name, fn) => { globalThis.it = (name, fn) => {
console.log(`\t${name}`); console.log(`\t${name}`);
// We expect this to be handled top-level, in the test itself
// eslint-disable-next-line @typescript-eslint/no-floating-promises // eslint-disable-next-line @typescript-eslint/no-floating-promises
fn(); fn();
}; };
+21 -1
View File
@@ -1,8 +1,13 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* global it */
import { assert, hexToU8a, u8aToHex } from '@polkadot/util'; import { assert, hexToU8a, u8aToHex } from '@polkadot/util';
/**
* @param {*} wasm
*/
export function secp256k1Compress (wasm) { export function secp256k1Compress (wasm) {
it('compresses a known publicKey', () => { it('compresses a known publicKey', () => {
const pubkey = '0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af'; const pubkey = '0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af';
@@ -14,6 +19,9 @@ export function secp256k1Compress (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function secp256k1Expand (wasm) { export function secp256k1Expand (wasm) {
it('expands a known compressed key', () => { it('expands a known compressed key', () => {
const pubkey = '0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077'; const pubkey = '0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077';
@@ -25,6 +33,9 @@ export function secp256k1Expand (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function secp256k1FromSeed1 (wasm) { export function secp256k1FromSeed1 (wasm) {
it('creates a known pair from seed (1)', () => { it('creates a known pair from seed (1)', () => {
const seckey = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae'; const seckey = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae';
@@ -36,6 +47,9 @@ export function secp256k1FromSeed1 (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function secp256k1FromSeed2 (wasm) { export function secp256k1FromSeed2 (wasm) {
it('creates a known pair from seed (2)', () => { it('creates a known pair from seed (2)', () => {
// https://github.com/polkadot-js/wasm/issues/307 // https://github.com/polkadot-js/wasm/issues/307
@@ -60,6 +74,9 @@ export function secp256k1FromSeed2 (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function secp256k1Recover (wasm) { export function secp256k1Recover (wasm) {
it('recovers a publicKey from signature', () => { it('recovers a publicKey from signature', () => {
const sig = '0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff'; const sig = '0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff';
@@ -72,6 +89,9 @@ export function secp256k1Recover (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function secp256k1Sign (wasm) { export function secp256k1Sign (wasm) {
it('creates a known signature', () => { it('creates a known signature', () => {
const sec = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae'; const sec = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae';
+49 -5
View File
@@ -1,20 +1,31 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* global it */
import crypto from 'crypto'; import crypto from 'crypto';
import { assert, hexToU8a, stringToU8a, u8aToHex } from '@polkadot/util'; import { assert, hexToU8a, stringToU8a, u8aToHex } from '@polkadot/util';
/** @internal */ /**
* @internal
* @param {*} pair
*/
function extractKeys (pair) { function extractKeys (pair) {
return [pair, pair.slice(64), pair.slice(0, 64)]; return [pair, pair.slice(64), pair.slice(0, 64)];
} }
/** @internal */ /**
* @internal
* @param {*} wasm
*/
function randomPair (wasm) { function randomPair (wasm) {
return extractKeys(wasm.sr25519KeypairFromSeed(crypto.randomBytes(32))); return extractKeys(wasm.sr25519KeypairFromSeed(crypto.randomBytes(32)));
} }
/**
* @param {*} wasm
*/
export function sr25519PairFromSeed (wasm) { export function sr25519PairFromSeed (wasm) {
it('creates a known pair from a known seed', () => { it('creates a known pair from a known seed', () => {
const pair = wasm.sr25519KeypairFromSeed(stringToU8a('12345678901234567890123456789012')); const pair = wasm.sr25519KeypairFromSeed(stringToU8a('12345678901234567890123456789012'));
@@ -26,6 +37,9 @@ export function sr25519PairFromSeed (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519DevFromSeed (wasm) { export function sr25519DevFromSeed (wasm) {
it('creates a known development pair', () => { it('creates a known development pair', () => {
const pair = wasm.sr25519KeypairFromSeed(hexToU8a('0xfac7959dbfe72f052e5a0c3c8d6530f202b02fd8f9f5ca3580ec8deb7797479e')); const pair = wasm.sr25519KeypairFromSeed(hexToU8a('0xfac7959dbfe72f052e5a0c3c8d6530f202b02fd8f9f5ca3580ec8deb7797479e'));
@@ -37,6 +51,9 @@ export function sr25519DevFromSeed (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519VerifyExisting (wasm) { export function sr25519VerifyExisting (wasm) {
it('verifies a known signature', () => { it('verifies a known signature', () => {
const PK = hexToU8a('0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'); const PK = hexToU8a('0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d');
@@ -51,6 +68,9 @@ export function sr25519VerifyExisting (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519SignDeterministic (wasm) { export function sr25519SignDeterministic (wasm) {
it('creates non-deterministic signatures', () => { it('creates non-deterministic signatures', () => {
const [, pk, sk] = randomPair(wasm); const [, pk, sk] = randomPair(wasm);
@@ -64,6 +84,9 @@ export function sr25519SignDeterministic (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519SignAndVerify (wasm) { export function sr25519SignAndVerify (wasm) {
it('verifies a created signature', () => { it('verifies a created signature', () => {
const [, pk, sk] = randomPair(wasm); const [, pk, sk] = randomPair(wasm);
@@ -77,6 +100,9 @@ export function sr25519SignAndVerify (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519DeriveHard (wasm) { export function sr25519DeriveHard (wasm) {
it('derives using a hard path', () => { it('derives using a hard path', () => {
const [pair] = randomPair(wasm); const [pair] = randomPair(wasm);
@@ -85,10 +111,13 @@ export function sr25519DeriveHard (wasm) {
// console.log('\tSEC', u8aToHex(derived.slice(0, 64))); // console.log('\tSEC', u8aToHex(derived.slice(0, 64)));
// console.log('\tPUB', u8aToHex(derived.slice(64))); // console.log('\tPUB', u8aToHex(derived.slice(64)));
assert(derived.length === 96); assert(derived.length === 96, 'Derived key length mismatch');
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519DeriveHardKnown (wasm) { export function sr25519DeriveHardKnown (wasm) {
it('derives a known hard key', () => { it('derives a known hard key', () => {
const derived = wasm.sr25519DeriveKeypairHard(hexToU8a('0x28b0ae221c6bb06856b287f60d7ea0d98552ea5a16db16956849aa371db3eb51fd190cce74df356432b410bd64682309d6dedb27c76845daf388557cbac3ca3446ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x14416c6963650000000000000000000000000000000000000000000000000000')); const derived = wasm.sr25519DeriveKeypairHard(hexToU8a('0x28b0ae221c6bb06856b287f60d7ea0d98552ea5a16db16956849aa371db3eb51fd190cce74df356432b410bd64682309d6dedb27c76845daf388557cbac3ca3446ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x14416c6963650000000000000000000000000000000000000000000000000000'));
@@ -101,6 +130,9 @@ export function sr25519DeriveHardKnown (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519DeriveSoft (wasm) { export function sr25519DeriveSoft (wasm) {
it('derives using a soft path', () => { it('derives using a soft path', () => {
const [pair] = randomPair(wasm); const [pair] = randomPair(wasm);
@@ -109,10 +141,13 @@ export function sr25519DeriveSoft (wasm) {
// console.log('\tSEC', u8aToHex(derived.slice(0, 64))); // console.log('\tSEC', u8aToHex(derived.slice(0, 64)));
// console.log('\tPUB', u8aToHex(derived.slice(64))); // console.log('\tPUB', u8aToHex(derived.slice(64)));
assert(derived.length === 96); assert(derived.length === 96, 'Derived key length mismatch');
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519DeriveSoftKnown (wasm) { export function sr25519DeriveSoftKnown (wasm) {
it('derives a known soft key', () => { it('derives a known soft key', () => {
const derived = wasm.sr25519DeriveKeypairSoft(hexToU8a('0x28b0ae221c6bb06856b287f60d7ea0d98552ea5a16db16956849aa371db3eb51fd190cce74df356432b410bd64682309d6dedb27c76845daf388557cbac3ca3446ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000')); const derived = wasm.sr25519DeriveKeypairSoft(hexToU8a('0x28b0ae221c6bb06856b287f60d7ea0d98552ea5a16db16956849aa371db3eb51fd190cce74df356432b410bd64682309d6dedb27c76845daf388557cbac3ca3446ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000'));
@@ -125,6 +160,9 @@ export function sr25519DeriveSoftKnown (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519DeriveSoftPubkey (wasm) { export function sr25519DeriveSoftPubkey (wasm) {
it('derives a known soft publicKey', () => { it('derives a known soft publicKey', () => {
const derived = u8aToHex(wasm.sr25519DerivePublicSoft(hexToU8a('0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000'))); const derived = u8aToHex(wasm.sr25519DerivePublicSoft(hexToU8a('0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000')));
@@ -135,6 +173,9 @@ export function sr25519DeriveSoftPubkey (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519KeyAgreement (wasm) { export function sr25519KeyAgreement (wasm) {
it('allows for agreements', () => { it('allows for agreements', () => {
const pair1 = wasm.sr25519KeypairFromSeed(hexToU8a('0x3b44c558f9a8f3dc9690d53088558c1ba2529b677e316c6054d1852595b004af')); const pair1 = wasm.sr25519KeypairFromSeed(hexToU8a('0x3b44c558f9a8f3dc9690d53088558c1ba2529b677e316c6054d1852595b004af'));
@@ -154,6 +195,9 @@ export function sr25519KeyAgreement (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function sr25519Benchmark (wasm) { export function sr25519Benchmark (wasm) {
it('runs a verification benchmark', () => { it('runs a verification benchmark', () => {
const MESSAGE = stringToU8a('this is a message'); const MESSAGE = stringToU8a('this is a message');
+20 -1
View File
@@ -1,18 +1,31 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/* global it */
import crypto from 'crypto'; import crypto from 'crypto';
import { assert, stringToU8a, u8aToHex } from '@polkadot/util'; import { assert, stringToU8a, u8aToHex } from '@polkadot/util';
/**
* @internal
* @param {*} pair
*/
function extractKeys (pair) { function extractKeys (pair) {
return [pair, pair.slice(64), pair.slice(0, 64)]; return [pair, pair.slice(64), pair.slice(0, 64)];
} }
/**
* @internal
* @param {*} wasm
*/
function randomPair (wasm) { function randomPair (wasm) {
return extractKeys(wasm.sr25519KeypairFromSeed(crypto.randomBytes(32))); return extractKeys(wasm.sr25519KeypairFromSeed(crypto.randomBytes(32)));
} }
/**
* @param {*} wasm
*/
export function vrfSignAndVerifyCompat (wasm) { export function vrfSignAndVerifyCompat (wasm) {
it('can sign and verify (1)', () => { it('can sign and verify (1)', () => {
const [, pk, sk] = randomPair(wasm); const [, pk, sk] = randomPair(wasm);
@@ -26,6 +39,9 @@ export function vrfSignAndVerifyCompat (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function vrfSignAndVerify (wasm) { export function vrfSignAndVerify (wasm) {
it('can sign and verify (2)', () => { it('can sign and verify (2)', () => {
const [, pk, sk] = randomPair(wasm); const [, pk, sk] = randomPair(wasm);
@@ -39,6 +55,9 @@ export function vrfSignAndVerify (wasm) {
}); });
} }
/**
* @param {*} wasm
*/
export function vrfSignAndVerifyDeterministic (wasm) { export function vrfSignAndVerifyDeterministic (wasm) {
it('has non-deterministic outputs', () => { it('has non-deterministic outputs', () => {
const [,, sk] = randomPair(wasm); const [,, sk] = randomPair(wasm);
+1 -1
View File
@@ -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 // SPDX-License-Identifier: Apache-2.0
import '@polkadot/wasm-crypto/initOnlyAsm'; import '@polkadot/wasm-crypto/initOnlyAsm';
+16 -4
View File
@@ -1,13 +1,25 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// This is a Deno file, so we can allow .ts imports
/* eslint-disable import/extensions */
// NOTE We don't use ts-expect-error here since the build folder may or may
// not exist (so the error may or may not be there)
//
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This should only run against the compiled ouput, where this should exist
import * as wasm from '../build-deno/mod.ts'; import * as wasm from '../build-deno/mod.ts';
import { initRun, tests } from './all/index.js'; import { initRun, tests } from './all/index.js';
declare const globalThis; type Tests = Record<string, (wasm: unknown) => void>;
declare const globalThis: {
it: (name: string, fn: () => void) => unknown;
};
declare const Deno: { declare const Deno: {
test: (name: string, test: () => unknown) => unknown; test: (name: string, test: () => unknown) => unknown;
} };
await initRun('wasm', wasm); await initRun('wasm', wasm);
@@ -15,7 +27,7 @@ await initRun('wasm', wasm);
globalThis.it = (name: string, fn: () => void) => Deno.test(name, () => fn()); globalThis.it = (name: string, fn: () => void) => Deno.test(name, () => fn());
Object Object
.entries<{ [key: string]: (wasm: unknown) => void }>(tests) .entries<Tests>(tests)
.forEach(([describeName, tests]) => { .forEach(([describeName, tests]) => {
console.log('***', describeName); console.log('***', describeName);
+9 -4
View File
@@ -1,8 +1,13 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors // Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev/node/test/node" /> /// <reference types="@polkadot/dev-test/globals.d.ts" />
// NOTE We don't use ts-expect-error here since the build folder may or may
// not exist (so the error may or may not be there)
//
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This should only run against the compiled ouput, where this should exist
import * as wasm from '../build/index.js'; import * as wasm from '../build/index.js';
import { initRun, tests } from './all/index.js'; import { initRun, tests } from './all/index.js';
@@ -10,9 +15,9 @@ describe('wasm-crypto', (): void => {
beforeAll(() => initRun('wasm', wasm)); beforeAll(() => initRun('wasm', wasm));
for (const name of Object.keys(tests)) { for (const name of Object.keys(tests)) {
describe(name, (): void => { describe(`${name}`, (): void => {
Object Object
.values<(wasm: unknown) => void>(tests[name]) .values<(wasm: unknown) => void>(tests[name as keyof typeof tests])
.forEach((fn) => fn(wasm)); .forEach((fn) => fn(wasm));
}); });
} }

Some files were not shown because too many files have changed in this diff Show More