Compare commits

...
261 Commits
Author SHA1 Message Date
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
github-actions[bot] 2bd507af55 [CI Skip] release/stable 7.0.3
skip-checks: true
2023-03-11 06:25:47 +00:00
Jaco 7232fd88b5 7.0.3 (#495) 2023-03-11 08:20:24 +02:00
github-actions[bot] dbfd08942a [CI Skip] bump/beta 7.0.3-5-x
skip-checks: true
2023-03-10 06:29:35 +00:00
Jaco 5d7a167d19 Update GH actions (#494) 2023-03-10 08:24:17 +02:00
github-actions[bot] b5478b52b4 [CI Skip] bump/beta 7.0.3-4-x
skip-checks: true
2023-03-09 11:27:31 +00:00
Jaco 66f4af6dda Align tsconfig to allow moduleResolution: nodenext (#493) 2023-03-09 13:21:53 +02:00
github-actions[bot] 74344c862c [CI Skip] bump/beta 7.0.3-3-x
skip-checks: true
2023-03-09 08:44:52 +00:00
Jaco 783476fd8d Use .js imports in src (#492)
* Use .js imports in src

* Bump dev
2023-03-09 10:39:39 +02:00
github-actions[bot] 0a7af910e1 [CI Skip] bump/beta 7.0.3-2-x
skip-checks: true
2023-03-06 12:18:06 +00:00
Jaco 478cd6ffcf Bump dev deps (#491) 2023-03-06 14:11:50 +02:00
github-actions[bot] df61ff95ca [CI Skip] bump/beta 7.0.3-1-x
skip-checks: true
2023-03-05 11:49:20 +00:00
Jaco 9137bd9848 jg-rm-babel-config (#490) 2023-03-05 13:44:14 +02:00
github-actions[bot] 3479d7f63b [CI Skip] bump/beta 7.0.3-0-x
skip-checks: true
2023-03-04 15:50:45 +00:00
Jaco a718bcbb0c Bump common deps (#489) 2023-03-04 17:45:40 +02:00
github-actions[bot] ec1958dfde [CI Skip] release/stable 7.0.2
skip-checks: true
2023-03-04 13:42:57 +00:00
Jaco a1f6452a7d 7.0.2 (#488) 2023-03-04 15:37:42 +02:00
github-actions[bot] 13e8c6af1d [CI Skip] release/stable 7.0.1
skip-checks: true
2023-03-04 12:39:32 +00:00
Jaco 56f98e67a1 7.0.1 (#487) 2023-03-04 14:33:31 +02:00
github-actions[bot] 5023c02a73 [CI Skip] bump/beta 6.4.2-36-x
skip-checks: true
2023-03-04 12:03:32 +00:00
Jaco 3b286e6034 Use tsc compiler (#486) 2023-03-04 13:57:24 +02:00
github-actions[bot] bccb16f691 [CI Skip] bump/beta 6.4.2-35-x
skip-checks: true
2023-03-03 12:07:29 +00:00
Jaco aeae6c137e Swap TS -> JS compiler to use swc (#485) 2023-03-03 14:02:01 +02:00
github-actions[bot] 2a2bd06284 [CI Skip] bump/beta 6.4.2-34-x
skip-checks: true
2023-03-03 09:31:06 +00:00
Jaco 1310dca729 Bump dev & update gh workflows (#484) 2023-03-03 11:25:46 +02:00
github-actions[bot] 34f2b544f0 [CI Skip] bump/beta 6.4.2-33-x
skip-checks: true
2023-03-01 12:11:29 +00:00
Jaco dde2f92445 Add wf continue-on-error: true (#483) 2023-03-01 14:06:04 +02:00
github-actions[bot] b9ad508d27 [CI Skip] bump/beta 6.4.2-32-x
skip-checks: true
2023-03-01 08:16:32 +00:00
Jaco ca7e44c25a Align gh workflows (#482) 2023-03-01 10:09:28 +02:00
github-actions[bot] a0de0ac427 [CI Skip] bump/beta 6.4.2-31-x
skip-checks: true
2023-02-28 10:51:06 +00:00
Jaco 2893343bf2 Bump dev (#481)
* Bump dev

* typo
2023-02-28 12:45:45 +02:00
github-actions[bot] 8b70740a18 [CI Skip] bump/beta 6.4.2-30-x
skip-checks: true
2023-02-27 09:46:41 +00:00
Jaco 5e54136fff Bump deps (#480) 2023-02-27 11:41:21 +02:00
github-actions[bot] 35b4c38be4 [CI Skip] bump/beta 6.4.2-29-x
skip-checks: true
2023-02-27 09:17:59 +00:00
Jaco e1b24a61c6 Bump dev deps (#479) 2023-02-27 11:12:34 +02:00
github-actions[bot] a71d353fff [CI Skip] bump/beta 6.4.2-28-x
skip-checks: true
2023-02-25 08:23:48 +00:00
Jaco 218d2b9217 Remove usage of describe.each (#478) 2023-02-25 10:18:40 +02:00
github-actions[bot] 0429de0429 [CI Skip] bump/beta 6.4.2-27-x
skip-checks: true
2023-02-22 07:20:17 +00:00
Jaco 5f18253ba8 Bump deps (#477)
* Bump deps

* Bump dev
2023-02-22 09:14:54 +02:00
github-actions[bot] b17de3422a [CI Skip] bump/beta 6.4.2-26-x
skip-checks: true
2023-02-20 10:38:08 +00:00
Jaco 935f92dd5b Swap jest test environment (#476)
* Swap jest test environment

* Remove jest config
2023-02-20 12:32:42 +02:00
github-actions[bot] ea79adf45d [CI Skip] bump/beta 6.4.2-25-x
skip-checks: true
2023-02-19 09:39:53 +00:00
Jaco e71807c2a3 Bump deps (#475) 2023-02-19 11:34:35 +02:00
github-actions[bot] 04365b87a5 [CI Skip] bump/beta 6.4.2-24-x
skip-checks: true
2023-02-19 07:49:49 +00:00
Jaco f5856d091b Bump dev (#474)
* Bump dev

* measure overall runUnaasisted duration
2023-02-19 09:44:27 +02:00
github-actions[bot] 45554b753f [CI Skip] bump/beta 6.4.2-23-x
skip-checks: true
2023-02-18 13:12:54 +00:00
Jaco 5967b48515 Convert all tests to ESM (#473)
* Convert all tests to ESM

* Add nodeWithBuildLoader
2023-02-18 15:07:37 +02:00
github-actions[bot] 2d85a62bb7 [CI Skip] bump/beta 6.4.2-23-x
skip-checks: true
2023-02-18 11:47:32 +00:00
Jaco 39ca57f059 Bump deps (#472) 2023-02-18 13:42:24 +02:00
github-actions[bot] 5a08739f24 [CI Skip] bump/beta 6.4.2-22-x
skip-checks: true
2023-02-15 10:02:22 +00:00
Jaco fe09bc21ed Bump deps (#471) 2023-02-15 11:56:43 +02:00
github-actions[bot] 8706cdb9c2 [CI Skip] bump/beta 6.4.2-21-x
skip-checks: true
2023-02-15 07:24:10 +00:00
Jaco 498a58d95a Fix CI release workflow (#470) 2023-02-15 09:17:39 +02:00
Jaco 2501f771a7 Use latest LTS for CI scripts (#469) 2023-02-14 10:49:30 +02:00
github-actions[bot] 55aef41eee [CI Skip] bump/beta 6.4.2-20-x
skip-checks: true
2023-02-12 11:57:25 +00:00
Jaco e14c249ae2 Bump common (#468) 2023-02-12 13:52:14 +02:00
github-actions[bot] 561abdbf0d [CI Skip] bump/beta 6.4.2-19-x
skip-checks: true
2023-02-05 12:12:41 +00:00
Jaco 964432c184 Bump dev (#467) 2023-02-05 14:07:17 +02:00
github-actions[bot] 4944d228cd [CI Skip] bump/beta 6.4.2-18-x
skip-checks: true
2023-02-05 07:57:54 +00:00
Jaco de4a6c69fe Bump dev (#466) 2023-02-05 09:53:11 +02:00
github-actions[bot] f3ffb229ff [CI Skip] bump/beta 6.4.2-17-x
skip-checks: true
2023-02-03 08:53:16 +00:00
Jaco 3910ad5241 Bump deps (incl. TS) (#465) 2023-02-03 10:48:30 +02:00
github-actions[bot] e8cc388f3a [CI Skip] bump/beta 6.4.2-16-x
skip-checks: true
2023-01-28 07:52:24 +00:00
Jaco 888a5d00ed Bump util (#464) 2023-01-28 09:47:48 +02:00
github-actions[bot] dcd5533149 [CI Skip] bump/beta 6.4.2-15-x
skip-checks: true
2023-01-27 08:31:11 +00:00
Jaco f3a5b7e373 Convert pack wasm to ESM (#463)
* Convert pack wasm to ESM

* Cleanup clean scripts

* Adjust
2023-01-27 10:26:14 +02:00
Jaco 6f06fe6b2a Bump dev (#462) 2023-01-27 10:00:18 +02:00
github-actions[bot] ac96179904 [CI Skip] bump/beta 6.4.2-14-x
skip-checks: true
2023-01-25 07:35:27 +00:00
Jaco c37f707b15 Bump actions (#461)
* Bump actions

* Bump dev
2023-01-25 09:29:12 +02:00
github-actions[bot] 80f40a500c [CI Skip] bump/beta 6.4.2-13-x
skip-checks: true
2023-01-22 07:01:14 +00:00
Jaco 445863a940 Bump dev (#460) 2023-01-22 08:56:01 +02:00
github-actions[bot] 30a8ab0d8c [CI Skip] bump/beta 6.4.2-12-x
skip-checks: true
2023-01-15 08:50:16 +00:00
Jaco 4a239f5ed5 Bump dev (#459) 2023-01-15 10:45:51 +02:00
github-actions[bot] 3db8d49d11 [CI Skip] bump/beta 6.4.2-11-x
skip-checks: true
2023-01-15 08:23:38 +00:00
Jaco 9885b65cf0 Bump deps (#458) 2023-01-15 10:18:59 +02:00
github-actions[bot] 5c867e0cd4 [CI Skip] bump/beta 6.4.2-10-x
skip-checks: true
2023-01-13 08:03:58 +00:00
Jaco 00b79f4f9f Bump common (#457) 2023-01-13 09:58:48 +02:00
github-actions[bot] 0f82e9c5d8 [CI Skip] bump/beta 6.4.2-9-x
skip-checks: true
2023-01-08 08:35:35 +00:00
Jaco 007fc9923a Bump deps (#456) 2023-01-08 10:30:40 +02:00
github-actions[bot] ccfe31d9b5 [CI Skip] bump/beta 6.4.2-8-x
skip-checks: true
2023-01-06 10:50:39 +00:00
Jaco f921359f64 Bump deps (#455) 2023-01-06 12:45:58 +02:00
github-actions[bot] 4463395dfe [CI Skip] bump/beta 6.4.2-7-x
skip-checks: true
2023-01-01 08:27:44 +00:00
Jaco f4080e5754 Update headers for 2023 (#454) 2023-01-01 10:23:06 +02:00
github-actions[bot] c6bb302f9c [CI Skip] bump/beta 6.4.2-6-x
skip-checks: true
2022-12-26 07:57:35 +00:00
Jaco 6d7ace4291 Bump dev (#453) 2022-12-26 09:52:45 +02:00
github-actions[bot] 53a62bec02 [CI Skip] bump/beta 6.4.2-5-x
skip-checks: true
2022-12-14 06:15:33 +00:00
Jaco 263caf3238 Bump dev (w/ deprecation warnings) (#451) 2022-12-14 08:09:34 +02:00
github-actions[bot] 6e0d56e955 [CI Skip] bump/beta 6.4.2-4-x
skip-checks: true
2022-12-13 07:09:19 +00:00
Jaco cf9d894556 Adjust TS target (#450) 2022-12-13 09:03:24 +02:00
github-actions[bot] 1c1a10f14b [CI Skip] bump/beta 6.4.2-3-x
skip-checks: true
2022-12-08 07:07:54 +00:00
Jaco 7d3ce85684 Remove CC (#449) 2022-12-08 09:00:31 +02:00
github-actions[bot] 5fd16cda08 [CI Skip] bump/beta 6.4.2-2-x
skip-checks: true
2022-12-08 06:27:23 +00:00
Jaco 87fc9d9ee1 Bump TS (#448) 2022-12-08 08:21:37 +02:00
github-actions[bot] bf1a4b7b7f [CI Skip] bump/beta 6.4.2-1-x
skip-checks: true
2022-12-07 13:56:19 +00:00
Jaco 4c10357c41 Update token retrieval (#447) 2022-12-07 15:49:23 +02:00
github-actions[bot] 4ceb620462 [CI Skip] bump/beta 6.4.2-0-x
skip-checks: true
2022-12-04 10:52:32 +00:00
Jaco 97ef0b0dd6 Bump util (#446) 2022-12-04 12:46:42 +02:00
github-actions[bot] a27a5ccf3c [CI Skip] release/stable 6.4.1
skip-checks: true
2022-12-03 07:54:59 +00:00
Jaco 8e47fb20a1 6.4.1 (#445) 2022-12-03 09:47:40 +02:00
github-actions[bot] a014aea1b4 [CI Skip] bump/beta 6.3.2-37-x
skip-checks: true
2022-12-02 11:51:59 +00:00
Jaco 18cb000218 Apply /*#__PURE__*/ annotations (#444) 2022-12-02 13:46:17 +02:00
github-actions[bot] 0cb6566bab [CI Skip] bump/beta 6.3.2-36-x
skip-checks: true
2022-11-27 14:41:05 +00:00
Jaco 9ae9de4ac9 Bump util (#443) 2022-11-27 16:34:07 +02:00
github-actions[bot] 04ac7dd00d [CI Skip] bump/beta 6.3.2-35-x
skip-checks: true
2022-11-20 09:38:34 +00:00
Jaco 5a4a2fde71 Bump TS (#442) 2022-11-20 11:33:02 +02:00
github-actions[bot] 71237d7df7 [CI Skip] bump/beta 6.3.2-34-x
skip-checks: true
2022-11-13 09:39:03 +00:00
Jaco 424b3fe653 Bump util (#441) 2022-11-13 11:33:24 +02:00
github-actions[bot] 7b56956fdd [CI Skip] bump/beta 6.3.2-33-x
skip-checks: true
2022-11-05 15:42:58 +00:00
Jaco a991236fa3 Bump dev deps (#440) 2022-11-05 17:36:20 +02:00
github-actions[bot] 168e862e3a [CI Skip] bump/beta 6.3.2-32-x
skip-checks: true
2022-10-30 08:16:55 +00:00
Jaco 1dfc6660ba Bump dev (#439) 2022-10-30 10:11:24 +02:00
github-actions[bot] 21b47e7924 [CI Skip] bump/beta 6.3.2-31-x
skip-checks: true
2022-10-22 07:26:39 +00:00
Jaco d6ce0d1bf8 Bump dev (#438) 2022-10-22 10:21:29 +03:00
github-actions[bot] c5cd242033 [CI Skip] bump/beta 6.3.2-30-x
skip-checks: true
2022-10-19 05:16:34 +00:00
Jaco 73d21079a4 Bump deps (#437) 2022-10-19 08:11:15 +03:00
github-actions[bot] e0edfa3cec [CI Skip] bump/beta 6.3.2-29-x
skip-checks: true
2022-10-15 10:22:55 +00:00
Jaco 674b3c7c12 Bump util (#436) 2022-10-15 13:16:36 +03:00
github-actions[bot] 16ecd2b8c2 [CI Skip] bump/beta 6.3.2-28-x
skip-checks: true
2022-10-14 07:25:35 +00:00
Jaco ee575c2589 Bump dev (#435) 2022-10-14 10:19:10 +03:00
github-actions[bot] 57c6b454f6 [CI Skip] bump/beta 6.3.2-27-x
skip-checks: true
2022-10-07 05:08:03 +00:00
Jaco e66f1830b0 Bump util (#434) 2022-10-07 08:01:50 +03:00
github-actions[bot] ea93565e11 [CI Skip] bump/beta 6.3.2-26-x
skip-checks: true
2022-10-06 07:38:57 +00:00
Jaco 8eabfef781 Bump deps (#433) 2022-10-06 10:32:39 +03:00
github-actions[bot] 9bb9e8d241 [CI Skip] bump/beta 6.3.2-25-x
skip-checks: true
2022-09-30 06:08:42 +00:00
Jaco 6da8edae2c Bump deps (#432) 2022-09-30 09:04:02 +03:00
github-actions[bot] eae8054c0e [CI Skip] bump/beta 6.3.2-24-x
skip-checks: true
2022-09-28 10:50:38 +00:00
Jaco fd7f9caca9 Bump TS (#431) 2022-09-28 13:45:00 +03:00
github-actions[bot] e12cffa958 [CI Skip] bump/beta 6.3.2-23-x
skip-checks: true
2022-09-24 06:11:40 +00:00
Jaco 7519e48482 Bump deps (#430) 2022-09-24 09:07:11 +03:00
github-actions[bot] 24780d5723 [CI Skip] bump/beta 6.3.2-22-x
skip-checks: true
2022-09-22 07:16:24 +00:00
Jaco 06d74925ec Bump deps (#429) 2022-09-22 10:11:29 +03:00
github-actions[bot] 6144148bc3 [CI Skip] bump/beta 6.3.2-21-x
skip-checks: true
2022-09-17 07:21:23 +00:00
Jaco 39d8fd81e0 Bump common (#428)
* Bump common

* Bump deps
2022-09-17 10:15:51 +03:00
github-actions[bot] a90ccb9718 [CI Skip] bump/beta 6.3.2-20-x
skip-checks: true
2022-09-12 08:39:09 +00:00
Jaco 2a28c02965 Bump deps (#427) 2022-09-12 11:34:25 +03:00
github-actions[bot] b032b2baf0 [CI Skip] bump/beta 6.3.2-19-x
skip-checks: true
2022-09-09 06:11:02 +00:00
Jaco e111622377 Bump deps (#426) 2022-09-09 09:05:29 +03:00
github-actions[bot] 21a5e14552 [CI Skip] bump/beta 6.3.2-18-x
skip-checks: true
2022-09-02 08:55:26 +00:00
Jaco 71d23d0d34 Bump common (#425) 2022-09-02 11:50:10 +03:00
github-actions[bot] 650320a18b [CI Skip] bump/beta 6.3.2-17-x
skip-checks: true
2022-08-31 05:51:09 +00:00
Jaco e0172f3a7d Adjust test execution (#424) 2022-08-31 08:45:32 +03:00
github-actions[bot] 8db05486c0 [CI Skip] bump/beta 6.3.2-16-x
skip-checks: true
2022-08-26 15:02:57 +00:00
Jaco 22328a1368 Pin Github actions (#422) 2022-08-26 17:57:59 +03:00
github-actions[bot] 7dd2cf97e6 [CI Skip] bump/beta 6.3.2-15-x
skip-checks: true
2022-08-26 12:58:45 +00:00
Jaco 2191a78e19 Bump TS (#421) 2022-08-26 15:52:55 +03:00
github-actions[bot] 856d97740e [CI Skip] bump/beta 6.3.2-14-x
skip-checks: true
2022-08-24 08:59:26 +00:00
Jaco b80f22abae Bump deps (#420) 2022-08-24 11:54:16 +03:00
github-actions[bot] 9dfc893309 [CI Skip] bump/beta 6.3.2-13-x
skip-checks: true
2022-08-21 05:50:29 +00:00
Jaco 1087c5b1cf Bump common (#419) 2022-08-21 08:45:51 +03:00
github-actions[bot] 781632d134 [CI Skip] bump/beta 6.3.2-12-x
skip-checks: true
2022-08-19 08:46:11 +00:00
Jaco 1e149c5844 Bump pjs/dev (#418) 2022-08-19 11:41:21 +03:00
github-actions[bot] 8ba4a5afb3 [CI Skip] bump/beta 6.3.2-11-x
skip-checks: true
2022-08-16 12:10:05 +00:00
Jaco 5ec9f9f52e Bump deps (#417) 2022-08-16 15:04:17 +03:00
github-actions[bot] 1a343bc065 [CI Skip] bump/beta 6.3.2-10-x
skip-checks: true
2022-08-12 09:09:07 +00:00
Jaco 3eff5e7a18 Bump deps (#416) 2022-08-12 12:03:12 +03:00
github-actions[bot] ed5f749d38 [CI Skip] bump/beta 6.3.2-9-x
skip-checks: true
2022-08-12 05:48:39 +00:00
Jaco ab02a865b0 Bump dev (#415) 2022-08-12 08:42:44 +03:00
github-actions[bot] 16fb3fe24c [CI Skip] bump/beta 6.3.2-8-x
skip-checks: true
2022-08-07 08:59:11 +00:00
Jaco 0378fba23c Bump dev (#414) 2022-08-07 11:53:14 +03:00
github-actions[bot] 429eff7c2e [CI Skip] bump/beta 6.3.2-7-x
skip-checks: true
2022-08-05 13:55:44 +00:00
Jaco 068343a2cb Bump dev deps (#413) 2022-08-05 16:50:43 +03:00
github-actions[bot] 5f91e4da6e [CI Skip] bump/beta 6.3.2-6-x
skip-checks: true
2022-08-05 06:04:47 +00:00
Jaco d73f3598e4 Bump dev (#412) 2022-08-05 09:00:16 +03:00
github-actions[bot] a8e512a3d3 [CI Skip] bump/beta 6.3.2-5-x
skip-checks: true
2022-08-02 04:38:56 +00:00
Jaco e35ceda7db Bump deps (#411) 2022-08-02 07:33:25 +03:00
github-actions[bot] 2fc192f2d4 [CI Skip] bump/beta 6.3.2-4-x
skip-checks: true
2022-07-30 05:18:06 +00:00
Jaco 7c1c54a413 Adjust CC ignores (#410) 2022-07-30 08:12:44 +03:00
github-actions[bot] b2bf04e475 [CI Skip] bump/beta 6.3.2-3-x
skip-checks: true
2022-07-30 04:51:42 +00:00
Jaco f0d95d63ad Allow errors on GH actions (#409) 2022-07-30 07:47:10 +03:00
github-actions[bot] c2aba270ff [CI Skip] bump/beta 6.3.2-2-x
skip-checks: true
2022-07-29 10:28:04 +00:00
Jaco 59a2ba5135 Bump common (#408) 2022-07-29 13:23:06 +03:00
github-actions[bot] 77b3674d01 [CI Skip] bump/beta 6.3.2-1-x
skip-checks: true
2022-07-26 11:57:21 +00:00
Jaco 34779964ce Bump deps (#407) 2022-07-26 14:51:40 +03:00
github-actions[bot] a9aa786332 [CI Skip] bump/beta 6.3.2-0-x
skip-checks: true
2022-07-21 07:37:39 +00:00
Jaco cd86d0bf35 Bump common (#406) 2022-07-21 10:32:55 +03:00
github-actions[bot] 6ce3e3d67c [CI Skip] release/stable 6.3.1
skip-checks: true
2022-07-21 05:20:47 +00:00
Jaco af4ed8a1db 6.3.1 (#405) 2022-07-21 08:15:29 +03:00
github-actions[bot] 57248e7ce4 [CI Skip] bump/beta 6.2.4-10-x
skip-checks: true
2022-07-19 06:50:16 +00:00
Jaco fe91118385 Optimize packed WASM base64 decoding loop (#404) 2022-07-19 09:45:11 +03:00
github-actions[bot] b36cd04348 [CI Skip] bump/beta 6.2.4-9-x
skip-checks: true
2022-07-19 05:50:20 +00:00
Jaco 8ae4176af6 Bump dev deps (#403) 2022-07-19 08:45:50 +03:00
github-actions[bot] 775b64f1bd [CI Skip] bump/beta 6.2.4-8-x
skip-checks: true
2022-07-15 10:02:49 +00:00
Jaco 66ebae8c62 Slight adjustment to tests (#402)
* Slight adjustment to tests

* beforeAll adjustment

* Adjust test forEach

* Test import map removal

* Adjust

* Remove input import_map template
2022-07-15 12:57:59 +03:00
github-actions[bot] c925bcf8d9 [CI Skip] bump/beta 6.2.4-7-x
skip-checks: true
2022-07-11 13:43:28 +00:00
Jaco beb995d507 Adjust import_map.in.json (#401) 2022-07-11 16:36:57 +03:00
github-actions[bot] 1523a53e10 [CI Skip] bump/beta 6.2.4-6-x
skip-checks: true
2022-07-11 06:08:08 +00:00
Jaco 188f7d3edc Bump common (#400) 2022-07-11 09:02:04 +03:00
github-actions[bot] 6da14ce25b [CI Skip] bump/beta 6.2.4-5-x
skip-checks: true
2022-07-11 05:25:44 +00:00
Jaco 9cacf07fe3 Bump dev (#399) 2022-07-11 08:20:04 +03:00
github-actions[bot] d0258cb3f3 [CI Skip] bump/beta 6.2.4-4-x
skip-checks: true
2022-07-09 08:01:12 +00:00
Jaco b5ae0089d1 Single deno step (aligning with other repos) (#396)
* Single deno step (aligning with other repos)

* skip root mod.ts
2022-07-09 10:56:18 +03:00
github-actions[bot] e07bd1eb00 [CI Skip] bump/beta 6.2.4-3-x
skip-checks: true
2022-07-08 21:41:19 +00:00
Jaco 6d79a71d93 Bump dev deps (#395) 2022-07-09 00:36:12 +03:00
github-actions[bot] c3289ca919 [CI Skip] bump/beta 6.2.4-2-x
skip-checks: true
2022-07-08 13:37:31 +00:00
Jaco b7648e5883 Adjust eslint config (#394) 2022-07-08 16:32:39 +03:00
github-actions[bot] 03b487ae81 [CI Skip] bump/beta 6.2.4-1-x
skip-checks: true
2022-07-08 07:46:21 +00:00
Jaco b1350bd8b4 Adjust size stats output on build (#393) 2022-07-08 10:41:42 +03:00
github-actions[bot] 1516d23ea4 [CI Skip] bump/beta 6.2.4-0-x
skip-checks: true
2022-07-08 04:50:05 +00:00
Jaco 9abaae980f Bump dev (#392)
* Bump dev

* Rebump
2022-07-08 07:44:57 +03:00
github-actions[bot] 370a529668 [CI Skip] release/stable 6.2.3
skip-checks: true
2022-07-07 06:42:17 +00:00
Jaco b7486f4f3b 6.2.3 (w/ dev publish fix) (#391) 2022-07-07 09:37:32 +03:00
Jaco ff4a877ef9 6.2.3 (#390)
* 6.2.3

* Skip extra installs on linting (non-build)
2022-07-07 09:19:49 +03:00
github-actions[bot] e0f741db37 [CI Skip] bump/beta 6.2.3-4-x
skip-checks: true
2022-07-06 11:09:51 +00:00
Jaco 3107861322 Adjust issue template (#389) 2022-07-06 14:04:54 +03:00
github-actions[bot] 7eff345003 [CI Skip] bump/beta 6.2.3-3-x
skip-checks: true
2022-07-06 10:24:19 +00:00
Jaco 00f7da2136 Bump depv deps (#388) 2022-07-06 13:19:14 +03:00
github-actions[bot] 150a143163 [CI Skip] bump/beta 6.2.3-2-x
skip-checks: true
2022-07-06 09:51:51 +00:00
Jaco f31ec881ef Additional platform-specific tests (#387)
* Additional platform-specific tests

* align casing

* Step rename

* lenIn/lenOut for deno

* Remove install ls

* Run deno tests on full suite

* trigger
2022-07-06 12:46:38 +03:00
github-actions[bot] 0b838d2055 [CI Skip] bump/beta 6.2.3-1-x
skip-checks: true
2022-07-05 21:27:10 +00:00
Jaco b68aefe64d Additional CI actions (#386) 2022-07-06 00:21:24 +03:00
github-actions[bot] 9340c296ee [CI Skip] bump/beta 6.2.3-0-x
skip-checks: true
2022-07-04 06:40:44 +00:00
Jaco 132ed20d18 Bump common (#385) 2022-07-04 09:33:42 +03:00
134 changed files with 4276 additions and 5916 deletions
-1
View File
@@ -1 +0,0 @@
6.2.2
-14
View File
@@ -1,14 +0,0 @@
7
3.2.2
3.2.3
3.2.4
4.0.2
4.1.2
6.1.2
6.1.3
6.1.4
6.1.5
6.2.2
-20
View File
@@ -1,20 +0,0 @@
checks:
argument-count:
config:
threshold: 5
method-complexity:
config:
threshold: 7
method-count:
config:
threshold: 25
method-lines:
config:
threshold: 30
exclude_patterns:
- "**/*.spec.js"
- "**/*.spec.ts"
- "docs/**/*.js"
- "**/test/**/*.js"
- "packages/wasm-crypto-wasm/src/fflate.ts"
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/eslint.cjs');
@@ -8,7 +8,7 @@ module.exports = {
ignorePatterns: [
...base.ignorePatterns,
'**/target/*',
'**/build-wasm/*'
'**/test/*.ts'
],
parserOptions: {
...base.parserOptions,
+49 -13
View File
@@ -1,50 +1,86 @@
<!--
For general support, howto, coding and bundling questions, please use the Substrate & Polkadot StackExchange at https://substrate.stackexchange.com/ and get other ecosystem developers involved. This issues in this repository are meant for the tracking of feature requests and bug reports.
For general support, howto, coding and bundling questions, please
use the Substrate & Polkadot StackExchange at
While all issues are looked at non-bug and non-features would take quite a bit longer to get to and may yield less than satisfactory responses in this format.
https://substrate.stackexchange.com/
Additionally, please ensure you have done a search on the existing and closed issues before logging a new request. This saves time on all sides.
and get other ecosystem developers involved. This issues in this
repository are meant for the tracking of feature requests and bug
reports.
While all issues are looked at non-bug and non-features would take
quite a bit longer to get to and may yield less than satisfactory
responses in this format.
Additionally, please ensure you have done a search on the existing
and closed issues before logging a new request. This saves time on
all sides.
-->
* **I'm submitting a ...**
<!--- Try and classify your actual report -->
<!---
REQUIRED:
Classify the type of report your are submitting
-->
- [ ] Bug report
- [ ] Feature request
- [ ] Support request (please bear the comments above in mind)
- [ ] Support request
- [ ] Other
* **What is the current behavior and expected behavior?**
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
<!---
REQUIRED:
If you're describing a bug, tell us what should happen. If you're
suggesting a change/improvement, tell us how it should work.
-->
* **What is the motivation for changing the behavior?**
<!--- Not obligatory, but suggest a motivation for the request -->
<!--- or ideas how to implement the addition or change -->
<!---
OPTIONAL:
Suggest a motivation for the request or ideas how to implement the
addition or change
-->
* **Please tell us about your environment:**
<!--- Include as many relevant details about the environment you experienced the issue in -->
<!--- Also snsure that you have tested against the latest stable releases if a bug -->
<!---
REQUIRED:
Include as many relevant details about the environment in which you
experienced the issue. Also ensure that you have tested against the
latest stable releases if you believe this to be a bug
-->
- Version:
- Environment:
- [ ] Node.js
- [ ] Browser
- [ ] Other (limited support for other environments available)
- [ ] Other (limited support for other environments)
- Language:
- [ ] JavaScript
- [ ] TypeScript
- [ ] TypeScript (include tsc --version)
- [ ] Other
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-approve@master
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
with:
authors: jacogr
labels: -auto
+2 -2
View File
@@ -8,9 +8,9 @@ jobs:
merge:
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-merge@master
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
with:
checks: build,lint,test
checks: pr (build),pr (lint),pr (test)
labels: -auto
strategy: squash
token: ${{ secrets.GH_PAT_BOT }}
+5 -5
View File
@@ -10,16 +10,16 @@ jobs:
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: dessant/lock-threads@v2
- uses: dessant/lock-threads@c1b35aecc5cdb1a34539d14196df55838bb2f836
with:
github-token: ${{ secrets.GH_PAT_BOT }}
issue-lock-inactive-days: '7'
issue-lock-comment: >
issue-inactive-days: '7'
issue-comment: >
This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue
if you think you have a related problem or query.
pr-lock-inactive-days: '2'
pr-lock-comment: >
pr-inactive-days: '2'
pr-comment: >
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
+15 -4
View File
@@ -3,17 +3,28 @@ on: [pull_request]
jobs:
pr:
continue-on-error: true
strategy:
matrix:
step: ['lint', 'test', 'build']
name: ${{ matrix.step }}
step: ['lint', 'test', 'build', 'deno']
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: ${{ matrix.step }}
if: always()
continue-on-error: true
run: |
yarn install --immutable | grep -v 'YN0013'
./scripts/install-build-deps.sh
if [ "${{ matrix.step }}" != "lint" ]; then
./scripts/install-build-deps.sh
fi
yarn polkadot-dev-deno-map
yarn ${{ matrix.step }}
+7 -5
View File
@@ -10,19 +10,21 @@ jobs:
strategy:
matrix:
step: ['build:release']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
GH_PAT: ${{ secrets.GH_PAT_BOT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
token: ${{ secrets.GH_PAT_BOT }}
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: build
run: |
yarn install --immutable | grep -v 'YN0013'
-20
View File
@@ -1,20 +0,0 @@
name: Semgrep
on:
pull_request: {}
push:
branches:
- master
jobs:
check:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/checkout@v2
- uses: returntocorp/semgrep-action@v1
with:
auditOn: push
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
publishDeployment: 1395
-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@v3
with:
repo-token: ${{ secrets.GH_PAT_BOT }}
stale-issue-message: 'This issue has been open for 21 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: 21
days-before-close: 7
+3 -6
View File
@@ -1,19 +1,16 @@
binaryen/
bindgen/
build/
build-cjs/
build-esm/
build-deno/
build-docs/
build-wasm/
build-*/
bytes/
coverage/
docs/.vuepress/dist/
node_modules/
pkg/
target/
tmp/
wabt/
/import_map.json
/mod.ts
.DS_Store
.env.local
.env.development.local
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2022 @polkadot/dev authors & contributors
// Copyright 2017-2023 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/prettier.cjs');
+71
View File
@@ -1,5 +1,76 @@
# CHANGELOG
## 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-randowmvalues` is a peer
- Drop support for Node 14 (EOL 30 Apr 2023)
## 7.0.3 Mar 11, 2023
Changes:
- Use consistent `.js` imports in source files (TS moduleResolution)
## 7.0.2 Mar 4, 2023
Changes:
- Update to latest `@polkadot/dev` (w/ tsc jsx detection output changes)
## 7.0.1 Mar 4, 2023
Changes:
- Swap TS -> JS compiler to use tsc (from babel)
- Adjust all tests to use `node:test` runner (ESM & CJS variants)
## 6.4.1 Dec 3, 2022
Changes:
- Add `/*#__PURE__*/` annotations for specific `export const something = someFunction(...)`
## 6.3.1 Jul 21, 2022
Changes:
- Optimize packed WASM base64 decoding loop
- Adjust test environment (no duplication)
- Adjust CI check steps, align with other org repos
- Remove unneeded `import_map.in.json` for Deno tests
## 6.2.3 Jul 7, 2022
Changes:
- Optimize WASM init with pre-allocated buffers
- Additional platform-specific tests
## 6.2.2 Jul 4, 2022
Changes:
+1 -1
View File
@@ -1,4 +1,4 @@
450 Jaco 6.2.2 (#384)
583 Jaco 7.2.1 (#521)
1 Evgeny Fixed type (#121)
1 Shunfan Zhou Support sr25519 agreement (#209)
1 Steve Degosserie Expose Schnorrkel's VRF capabilities (#170)
-6
View File
@@ -1,9 +1,3 @@
[![polkadotjs](https://img.shields.io/badge/polkadot-js-orange?style=flat-square)](https://polkadot.js.org)
![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)
[![npm](https://img.shields.io/npm/v/@polkadot/wasm-crypto?logo=npm&style=flat-square)](https://www.npmjs.com/package/@polkadot/wasm-crypto)
[![beta](https://img.shields.io/npm/v/@polkadot/wasm-crypto/beta?label=beta&logo=npm&&style=flat-square)](https://www.npmjs.com/package/@polkadot/wasm-crypto)
[![maintainability](https://img.shields.io/codeclimate/maintainability-percentage/polkadot-js/wasm?logo=code-climate&style=flat-square)](https://codeclimate.com/github/polkadot-js/wasm/maintainability)
# @polkadot/wasm
Various WASM wrappers around Rust crates
-4
View File
@@ -1,4 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/babel-config-cjs.cjs');
+5
View File
@@ -0,0 +1,5 @@
{
"imports": {
"https://esm.sh/v90/@types/bn.js@~5.2/index.d.ts": "https://esm.sh/v90/@types/bn.js@5.1.0/index.d.ts"
}
}
-13
View File
@@ -1,13 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const config = require('@polkadot/dev/config/jest.cjs');
module.exports = {
...config,
moduleNameMapper: {
'@polkadot/wasm-crypto-(init|asmjs|wasm)(.*)$': '<rootDir>/packages/wasm-crypto-$1/build/$2',
// eslint-disable-next-line sort-keys
'@polkadot/wasm-(bridge|crypto|util)(.*)$': '<rootDir>/packages/wasm-$1/build/$2'
}
};
+22 -8
View File
@@ -1,6 +1,9 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"engines": {
"node": ">=18.14"
},
"homepage": "https://github.com/polkadot-js/wasm#readme",
"license": "Apache-2.0",
"packageManager": "yarn@3.2.0",
@@ -10,7 +13,12 @@
"url": "https://github.com/polkadot-js/wasm.git"
},
"sideEffects": false,
"version": "6.2.2",
"type": "module",
"version": "7.2.1",
"versions": {
"git": "7.2.1",
"npm": "7.2.1"
},
"workspaces": [
"packages/*"
],
@@ -22,21 +30,27 @@
"build:rollup": "polkadot-exec-rollup --config",
"build:wasm": "./scripts/build.sh",
"clean": "./scripts/clean.sh",
"deno": "yarn deno:build && yarn deno:check",
"deno:build": "WITH_DENO=1 yarn build",
"deno:check": "deno check --import-map=import_map.json mod.ts",
"lint": "polkadot-dev-run-lint",
"postinstall": "polkadot-dev-yarn-only",
"test": "yarn test:wasm-crypto:rust",
"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:js": "yarn test:wasm-crypto:js:jest && yarn test:wasm-crypto:js:node",
"test:wasm-crypto:js:jest": "polkadot-dev-run-test ./test/jest.spec.js",
"test:wasm-crypto:js:node": "cd packages/wasm-crypto && node ./test/wasm.cjs && node ./test/asm.cjs",
"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:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --test-threads=1 --nocapture"
},
"devDependencies": {
"@babel/core": "^7.18.6",
"@polkadot/dev": "^0.67.50",
"fflate": "^0.7.3",
"override-require": "^1.1.1"
"@polkadot/dev": "^0.73.17",
"@polkadot/util": "^12.1.2",
"@polkadot/x-randomvalues": "^12.1.2",
"@types/node": "^20.1.3",
"fflate": "^0.7.4"
},
"resolutions": {
"typescript": "^4.7.4"
"typescript": "^5.0.4"
}
}
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+6 -7
View File
@@ -1,14 +1,12 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "A bridge layer between JS and Wasm",
"engines": {
"node": ">=14.0.0"
"node": ">=16"
},
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-bridge#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-bridge",
"repository": {
"directory": "packages/wasm-bridge",
@@ -20,14 +18,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "6.2.2",
"version": "7.2.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.6"
"@polkadot/wasm-util": "7.2.1",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/util": "^9.7.1",
"@polkadot/x-randomvalues": "^9.7.1"
"@polkadot/util": "^12.1.2",
"@polkadot/x-randomvalues": "^12.1.2"
},
"peerDependencies": {
"@polkadot/util": "*",
+7 -6
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// A number of functions are "unsafe" and purposefully so - it is
@@ -7,11 +7,11 @@
// then ensures that the internal wasm instance here is available
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import type { BridgeBase, InitFn, InitPromise, WasmBaseInstance, WasmImports } from './types';
import type { BridgeBase, InitFn, InitPromise, WasmBaseInstance, WasmImports } from './types.js';
import { stringToU8a, u8aToString } from '@polkadot/util';
import { Wbg } from './wbg';
import { Wbg } from './wbg.js';
/**
* @name Bridge
@@ -23,15 +23,16 @@ import { Wbg } from './wbg';
* the native environment, providing all the plumbing needed for the Wbg classes.
*/
export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
readonly #createWasm: InitFn<C>;
readonly #heap: unknown[];
readonly #wbg: WasmImports;
#cachegetInt32: Int32Array | null;
#cachegetUint8: Uint8Array | null;
#createWasm: InitFn<C>;
#heap: unknown[];
#heapNext: number;
#wasm: C | null;
#wasmError: string | null;
#wasmPromise: InitPromise<C> | null;
#wbg: WasmImports;
#type: 'asm' | 'wasm' | 'none';
constructor (createWasm: InitFn<C>) {
+3 -3
View File
@@ -1,5 +1,5 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bridge';
export * from './init';
export * from './bridge.js';
export * from './init.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2017-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
+3 -3
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// 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';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2019-2022 @polkadot/wasm-bundle authors & contributors
// Copyright 2019-2023 @polkadot/wasm-bundle authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } from './types';
import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } from './types.js';
/**
* @name createWasmFn
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2017-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '6.2.2' };
export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '7.2.1' };
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Use non-strong types instead of WasmImports which may not
+3 -7
View File
@@ -1,7 +1,7 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// Copyright 2019-2023 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { BridgeBase, WasmBaseInstance } from './types';
import type { BridgeBase, WasmBaseInstance } from './types.js';
import { getRandomValues } from '@polkadot/x-randomvalues';
@@ -20,7 +20,7 @@ const DEFAULT_SELF = { crypto: DEFAULT_CRYPTO };
* Internally the implementation does a thin layer into the supplied bridge.
*/
export class Wbg<C extends WasmBaseInstance> {
#bridge: BridgeBase<C>;
readonly #bridge: BridgeBase<C>;
constructor (bridge: BridgeBase<C>) {
this.#bridge = bridge;
@@ -52,25 +52,21 @@ export class Wbg<C extends WasmBaseInstance> {
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_crypto_968f1772287e2df0 = (_idx: number): number => {
return this.#bridge.addObject(DEFAULT_CRYPTO);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_a3d34b4fee3c2869 = (_idx: number): number => {
return this.#bridge.addObject(DEFAULT_CRYPTO.getRandomValues);
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_getRandomValues_f5e14ab7ac8e995d = (_arg0: number, ptr: number, len: number): void => {
DEFAULT_CRYPTO.getRandomValues(this.#bridge.getU8a(ptr, len));
};
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__wbg_randomFillSync_d5bd2d655fdf256a = (_idx: number, _ptr: number, _len: number): never => {
throw new Error('randomFillsync is not available');
+4 -6
View File
@@ -1,14 +1,12 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Asm.js content for wasm-crypto",
"engines": {
"node": ">=14.0.0"
"node": ">=16"
},
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-asmjs#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto-asmjs",
"repository": {
"directory": "packages/wasm-crypto-asmjs",
@@ -17,13 +15,13 @@
},
"sideEffects": false,
"type": "module",
"version": "6.2.2",
"version": "7.2.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.6"
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/util": "^9.7.1"
"@polkadot/util": "^12.1.2"
},
"peerDependencies": {
"@polkadot/util": "*"
+2 -2
View File
@@ -1,5 +1,5 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { asmJsInit } from './cjs/data.js';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
@@ -1,6 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
const data = require('../data');
const data = require('../data.js');
module.exports = data;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export declare const asmJsInit: null;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
const asmJsInit = null;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export declare const asmJsInit: null;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const asmJsInit = null;
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
@@ -1,11 +1,11 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto-asmjs 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';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
@@ -1,6 +1,6 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '6.2.2' };
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '7.2.1' };
+9 -10
View File
@@ -1,14 +1,12 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Init handlers for wasm-crypto",
"engines": {
"node": ">=14.0.0"
"node": ">=16"
},
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-init#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto-init",
"repository": {
"directory": "packages/wasm-crypto-init",
@@ -20,19 +18,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "6.2.2",
"version": "7.2.1",
"browser": "wasm.js",
"main": "wasm.js",
"react-native": "asm.js",
"dependencies": {
"@babel/runtime": "^7.18.6",
"@polkadot/wasm-bridge": "6.2.2",
"@polkadot/wasm-crypto-asmjs": "6.2.2",
"@polkadot/wasm-crypto-wasm": "6.2.2"
"@polkadot/wasm-bridge": "7.2.1",
"@polkadot/wasm-crypto-asmjs": "7.2.1",
"@polkadot/wasm-crypto-wasm": "7.2.1",
"@polkadot/wasm-util": "7.2.1",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/util": "^9.7.1",
"@polkadot/x-randomvalues": "^9.7.1"
"@polkadot/util": "^12.1.2",
"@polkadot/x-randomvalues": "^12.1.2"
},
"peerDependencies": {
"@polkadot/util": "*",
+4 -4
View File
@@ -1,17 +1,17 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types';
import type { WasmCryptoInstance } from './types';
import type { WasmCryptoInstance } from './types.js';
import { createWasmFn } from '@polkadot/wasm-bridge';
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
/**
* @name createWasm
* @description
* Creates an interface using only ASM.js
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', null, asmJsInit);
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', null, asmJsInit);
+4 -4
View File
@@ -1,18 +1,18 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types';
import type { WasmCryptoInstance } from './types';
import type { WasmCryptoInstance } from './types.js';
import { createWasmFn } from '@polkadot/wasm-bridge';
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
/**
* @name createWasm
* @description
* Creates an interface using WASM and a fallback ASM.js
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', wasmBytes, asmJsInit);
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', wasmBytes, asmJsInit);
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './wasm';
export * from './wasm.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
@@ -1,11 +1,11 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
import { detectPackage } from '@polkadot/util';
import others from './detectOther';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './wasm';
export * from './wasm.js';
+4 -4
View File
@@ -1,16 +1,16 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types';
import type { WasmCryptoInstance } from './types';
import type { WasmCryptoInstance } from './types.js';
import { createWasmFn } from '@polkadot/wasm-bridge';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
/**
* @name createWasm
* @description
* Creates an interface using no WASM and no ASM.js
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', null, null);
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', null, null);
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '6.2.2' };
export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '7.2.1' };
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { WasmBaseInstance } from '@polkadot/wasm-bridge/types';
+4 -4
View File
@@ -1,17 +1,17 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types';
import type { WasmCryptoInstance } from './types';
import type { WasmCryptoInstance } from './types.js';
import { createWasmFn } from '@polkadot/wasm-bridge';
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
/**
* @name createWasm
* @description
* Creates an interface using only WASM
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', wasmBytes, null);
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', wasmBytes, null);
+5 -7
View File
@@ -1,14 +1,12 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Wasm content for wasm-crypto",
"engines": {
"node": ">=14.0.0"
"node": ">=16"
},
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-wasm#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto-wasm",
"repository": {
"directory": "packages/wasm-crypto-wasm",
@@ -17,14 +15,14 @@
},
"sideEffects": false,
"type": "module",
"version": "6.2.2",
"version": "7.2.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.6",
"@polkadot/wasm-util": "6.2.2"
"@polkadot/wasm-util": "7.2.1",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/util": "^9.7.1"
"@polkadot/util": "^12.1.2"
},
"peerDependencies": {
"@polkadot/util": "*"
+5 -5
View File
@@ -1,11 +1,11 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { base64Decode, unzlibSync } from '@polkadot/wasm-util';
import { bytes, sizeUncompressed } from './cjs/bytes.js';
import { bytes, lenIn, lenOut } from './cjs/bytes.js';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
/**
* @name wasmBytes
@@ -13,7 +13,7 @@ export { packageInfo } from './packageInfo';
* The decoded WASM interface as exposed by this package.
*
* The build process will output into cjs/* into a compressed base64 format.
* Upon loading the exposed bytes will be decoded and decompressed form this
* Upon loading the exposed bytes will be decoded and decompressed from this
* specific format and returned.
*/
export const wasmBytes = unzlibSync(base64Decode(bytes), new Uint8Array(sizeUncompressed));
export const wasmBytes = /*#__PURE__*/ unzlibSync(base64Decode(bytes, new Uint8Array(lenIn)), new Uint8Array(lenOut));
+3 -3
View File
@@ -1,8 +1,8 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export declare const bytes: string;
export declare const sizeCompressed: number;
export declare const lenIn: number;
export declare const sizeUncompressed: number;
export declare const lenOut: number;
+4 -4
View File
@@ -1,8 +1,8 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports.bytes = '';
exports.lenIn = 0;
module.exports.sizeCompressed = 0;
exports.lenOut = 0;
module.exports.sizeUncompressed = 0;
exports.bytes = '';
@@ -1,6 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
const bytes = require('../bytes');
const bytes = require('../bytes.js');
module.exports = bytes;
+3 -3
View File
@@ -1,8 +1,8 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export declare const bytes: string;
export declare const sizeCompressed: number;
export declare const lenIn: number;
export declare const sizeUncompressed: number;
export declare const lenOut: number;
+3 -3
View File
@@ -1,8 +1,8 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const bytes = '';
export const sizeCompressed = 0;
export const lenIn = 0;
export const sizeUncompressed = 0;
export const lenOut = 0;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
@@ -1,11 +1,11 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-wasm authors & contributors
// 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';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '6.2.2' };
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '7.2.1' };
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+10 -12
View File
@@ -1,14 +1,12 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "A wasm interface layer for use by @polkadot/util-crypto",
"engines": {
"node": ">=14.0.0"
"node": ">=16"
},
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/wasm-crypto",
"repository": {
"directory": "packages/wasm-crypto",
@@ -28,19 +26,19 @@
"./initWasmAsm.cjs"
],
"type": "module",
"version": "6.2.2",
"version": "7.2.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.6",
"@polkadot/wasm-bridge": "6.2.2",
"@polkadot/wasm-crypto-asmjs": "6.2.2",
"@polkadot/wasm-crypto-init": "6.2.2",
"@polkadot/wasm-crypto-wasm": "6.2.2",
"@polkadot/wasm-util": "6.2.2"
"@polkadot/wasm-bridge": "7.2.1",
"@polkadot/wasm-crypto-asmjs": "7.2.1",
"@polkadot/wasm-crypto-init": "7.2.1",
"@polkadot/wasm-crypto-wasm": "7.2.1",
"@polkadot/wasm-util": "7.2.1",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/util": "^9.7.1",
"@polkadot/x-randomvalues": "^9.7.1"
"@polkadot/util": "^12.1.2",
"@polkadot/x-randomvalues": "^12.1.2"
},
"peerDependencies": {
"@polkadot/util": "*",
+35 -35
View File
@@ -1,11 +1,11 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { WasmCryptoInstance } from '@polkadot/wasm-crypto-init/types';
import { bridge, initBridge } from './init';
import { bridge, initBridge } from './init.js';
export { packageInfo } from './packageInfo';
export { packageInfo } from './packageInfo.js';
export { bridge };
// Removes the first parameter (expected as WasmCryptoInstance) and leaves the
@@ -40,193 +40,193 @@ function withWasm <T, F extends (wasm: WasmCryptoInstance, ...params: never[]) =
};
}
export const bip39Generate = withWasm((wasm, words: 12 | 15 | 18 | 21 | 24): string => {
export const bip39Generate = /*#__PURE__*/ withWasm((wasm, words: 12 | 15 | 18 | 21 | 24): string => {
wasm.ext_bip39_generate(8, words);
return bridge.resultString();
});
export const bip39ToEntropy = withWasm((wasm, phrase: string): Uint8Array => {
export const bip39ToEntropy = /*#__PURE__*/ withWasm((wasm, phrase: string): Uint8Array => {
wasm.ext_bip39_to_entropy(8, ...bridge.allocString(phrase));
return bridge.resultU8a();
});
export const bip39ToMiniSecret = withWasm((wasm, phrase: string, password: string): Uint8Array => {
export const bip39ToMiniSecret = /*#__PURE__*/ withWasm((wasm, phrase: string, password: string): Uint8Array => {
wasm.ext_bip39_to_mini_secret(8, ...bridge.allocString(phrase), ...bridge.allocString(password));
return bridge.resultU8a();
});
export const bip39ToSeed = withWasm((wasm, phrase: string, password: string): Uint8Array => {
export const bip39ToSeed = /*#__PURE__*/ withWasm((wasm, phrase: string, password: string): Uint8Array => {
wasm.ext_bip39_to_seed(8, ...bridge.allocString(phrase), ...bridge.allocString(password));
return bridge.resultU8a();
});
export const bip39Validate = withWasm((wasm, phrase: string): boolean => {
export const bip39Validate = /*#__PURE__*/ withWasm((wasm, phrase: string): boolean => {
const ret = wasm.ext_bip39_validate(...bridge.allocString(phrase));
return ret !== 0;
});
export const ed25519KeypairFromSeed = withWasm((wasm, seed: Uint8Array): Uint8Array => {
export const ed25519KeypairFromSeed = /*#__PURE__*/ withWasm((wasm, seed: Uint8Array): Uint8Array => {
wasm.ext_ed_from_seed(8, ...bridge.allocU8a(seed));
return bridge.resultU8a();
});
export const ed25519Sign = withWasm((wasm, pubkey: Uint8Array, seckey: Uint8Array, message: Uint8Array): Uint8Array => {
export const ed25519Sign = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, seckey: Uint8Array, message: Uint8Array): Uint8Array => {
wasm.ext_ed_sign(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(seckey), ...bridge.allocU8a(message));
return bridge.resultU8a();
});
export const ed25519Verify = withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
export const ed25519Verify = /*#__PURE__*/ withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
const ret = wasm.ext_ed_verify(...bridge.allocU8a(signature), ...bridge.allocU8a(message), ...bridge.allocU8a(pubkey));
return ret !== 0;
});
export const secp256k1FromSeed = withWasm((wasm, seckey: Uint8Array): Uint8Array => {
export const secp256k1FromSeed = /*#__PURE__*/ withWasm((wasm, seckey: Uint8Array): Uint8Array => {
wasm.ext_secp_from_seed(8, ...bridge.allocU8a(seckey));
return bridge.resultU8a();
});
export const secp256k1Compress = withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
export const secp256k1Compress = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
wasm.ext_secp_pub_compress(8, ...bridge.allocU8a(pubkey));
return bridge.resultU8a();
});
export const secp256k1Expand = withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
export const secp256k1Expand = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
wasm.ext_secp_pub_expand(8, ...bridge.allocU8a(pubkey));
return bridge.resultU8a();
});
export const secp256k1Recover = withWasm((wasm, msgHash: Uint8Array, sig: Uint8Array, recovery: number): Uint8Array => {
export const secp256k1Recover = /*#__PURE__*/ withWasm((wasm, msgHash: Uint8Array, sig: Uint8Array, recovery: number): Uint8Array => {
wasm.ext_secp_recover(8, ...bridge.allocU8a(msgHash), ...bridge.allocU8a(sig), recovery);
return bridge.resultU8a();
});
export const secp256k1Sign = withWasm((wasm, msgHash: Uint8Array, seckey: Uint8Array): Uint8Array => {
export const secp256k1Sign = /*#__PURE__*/ withWasm((wasm, msgHash: Uint8Array, seckey: Uint8Array): Uint8Array => {
wasm.ext_secp_sign(8, ...bridge.allocU8a(msgHash), ...bridge.allocU8a(seckey));
return bridge.resultU8a();
});
export const sr25519DeriveKeypairHard = withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
export const sr25519DeriveKeypairHard = /*#__PURE__*/ withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
wasm.ext_sr_derive_keypair_hard(8, ...bridge.allocU8a(pair), ...bridge.allocU8a(cc));
return bridge.resultU8a();
});
export const sr25519DeriveKeypairSoft = withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
export const sr25519DeriveKeypairSoft = /*#__PURE__*/ withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
wasm.ext_sr_derive_keypair_soft(8, ...bridge.allocU8a(pair), ...bridge.allocU8a(cc));
return bridge.resultU8a();
});
export const sr25519DerivePublicSoft = withWasm((wasm, pubkey: Uint8Array, cc: Uint8Array): Uint8Array => {
export const sr25519DerivePublicSoft = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, cc: Uint8Array): Uint8Array => {
wasm.ext_sr_derive_public_soft(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(cc));
return bridge.resultU8a();
});
export const sr25519KeypairFromSeed = withWasm((wasm, seed: Uint8Array): Uint8Array => {
export const sr25519KeypairFromSeed = /*#__PURE__*/ withWasm((wasm, seed: Uint8Array): Uint8Array => {
wasm.ext_sr_from_seed(8, ...bridge.allocU8a(seed));
return bridge.resultU8a();
});
export const sr25519Sign = withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array, message: Uint8Array): Uint8Array => {
export const sr25519Sign = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array, message: Uint8Array): Uint8Array => {
wasm.ext_sr_sign(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(secret), ...bridge.allocU8a(message));
return bridge.resultU8a();
});
export const sr25519Verify = withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
export const sr25519Verify = /*#__PURE__*/ withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
const ret = wasm.ext_sr_verify(...bridge.allocU8a(signature), ...bridge.allocU8a(message), ...bridge.allocU8a(pubkey));
return ret !== 0;
});
export const sr25519Agree = withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array): Uint8Array => {
export const sr25519Agree = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array): Uint8Array => {
wasm.ext_sr_agree(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(secret));
return bridge.resultU8a();
});
export const vrfSign = withWasm((wasm, secret: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array): Uint8Array => {
export const vrfSign = /*#__PURE__*/ withWasm((wasm, secret: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array): Uint8Array => {
wasm.ext_vrf_sign(8, ...bridge.allocU8a(secret), ...bridge.allocU8a(context), ...bridge.allocU8a(message), ...bridge.allocU8a(extra));
return bridge.resultU8a();
});
export const vrfVerify = withWasm((wasm, pubkey: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array, outAndProof: Uint8Array): boolean => {
export const vrfVerify = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array, outAndProof: Uint8Array): boolean => {
const ret = wasm.ext_vrf_verify(...bridge.allocU8a(pubkey), ...bridge.allocU8a(context), ...bridge.allocU8a(message), ...bridge.allocU8a(extra), ...bridge.allocU8a(outAndProof));
return ret !== 0;
});
export const blake2b = withWasm((wasm, data: Uint8Array, key: Uint8Array, size: number): Uint8Array => {
export const blake2b = /*#__PURE__*/ withWasm((wasm, data: Uint8Array, key: Uint8Array, size: number): Uint8Array => {
wasm.ext_blake2b(8, ...bridge.allocU8a(data), ...bridge.allocU8a(key), size);
return bridge.resultU8a();
});
export const hmacSha256 = withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
export const hmacSha256 = /*#__PURE__*/ withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
wasm.ext_hmac_sha256(8, ...bridge.allocU8a(key), ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const hmacSha512 = withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
export const hmacSha512 = /*#__PURE__*/ withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
wasm.ext_hmac_sha512(8, ...bridge.allocU8a(key), ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const keccak256 = withWasm((wasm, data: Uint8Array): Uint8Array => {
export const keccak256 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_keccak256(8, ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const keccak512 = withWasm((wasm, data: Uint8Array): Uint8Array => {
export const keccak512 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_keccak512(8, ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const pbkdf2 = withWasm((wasm, data: Uint8Array, salt: Uint8Array, rounds: number): Uint8Array => {
export const pbkdf2 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array, salt: Uint8Array, rounds: number): Uint8Array => {
wasm.ext_pbkdf2(8, ...bridge.allocU8a(data), ...bridge.allocU8a(salt), rounds);
return bridge.resultU8a();
});
export const scrypt = withWasm((wasm, password: Uint8Array, salt: Uint8Array, log2n: number, r: number, p: number): Uint8Array => {
export const scrypt = /*#__PURE__*/ withWasm((wasm, password: Uint8Array, salt: Uint8Array, log2n: number, r: number, p: number): Uint8Array => {
wasm.ext_scrypt(8, ...bridge.allocU8a(password), ...bridge.allocU8a(salt), log2n, r, p);
return bridge.resultU8a();
});
export const sha256 = withWasm((wasm, data: Uint8Array): Uint8Array => {
export const sha256 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_sha256(8, ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const sha512 = withWasm((wasm, data: Uint8Array): Uint8Array => {
export const sha512 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_sha512(8, ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const twox = withWasm((wasm, data: Uint8Array, rounds: number) => {
export const twox = /*#__PURE__*/ withWasm((wasm, data: Uint8Array, rounds: number) => {
wasm.ext_twox(8, ...bridge.allocU8a(data), rounds);
return bridge.resultU8a();
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
+3 -3
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
import { detectPackage } from '@polkadot/util';
import others from './detectOther';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types';
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/none';
import { initBridge } from './init';
import { initBridge } from './init.js';
/**
* @name initWasm
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/asm';
import { initBridge } from './init';
import { initBridge } from './init.js';
/**
* @name initWasm
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/wasm';
import { initBridge } from './init';
import { initBridge } from './init.js';
/**
* @name initWasm
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/both';
import { initBridge } from './init';
import { initBridge } from './init.js';
/**
* @name initWasm
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Use `wee_alloc` as the global allocator.
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2017-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto', path: 'auto', type: 'auto', version: '6.2.2' };
export const packageInfo = { name: '@polkadot/wasm-crypto', path: 'auto', type: 'auto', version: '7.2.1' };
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
use bip39::{Mnemonic, MnemonicType, Language, Seed};
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
use std::convert::TryFrom;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
use blake2_rfc::blake2b::blake2b;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
use secp256k1::{ecdsa::{RecoverableSignature, RecoveryId}, Message, PublicKey, SecretKey, SECP256K1};
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
@@ -1,33 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const rootIncl = [
'@polkadot/wasm-bridge',
'@polkadot/wasm-crypto',
'@polkadot/wasm-crypto-init',
'@polkadot/wasm-crypto-asmjs',
'@polkadot/wasm-crypto-wasm',
'@polkadot/wasm-util'
];
const detcIncl = [
...rootIncl.map((p) => `${p}/initOnlyAsm`),
...rootIncl.map((p) => `${p}/cjs/asm`),
...rootIncl.map((p) => `${p}/cjs/packageInfo`)
];
require('override-require')(
(request) =>
rootIncl.some((p) => request.endsWith(p)) ||
detcIncl.some((p) => request.endsWith(p)),
(request) =>
rootIncl.some((p) => request.endsWith(p))
? rootIncl.find((p) => request.endsWith(p)) === '@polkadot/wasm-crypto-init'
? require('@polkadot/wasm-crypto-init/build/cjs/wasm')
: require(`${rootIncl.find((p) => request.endsWith(p))}/build/cjs`)
: require(`${detcIncl.find((p) => request.endsWith(p))
.replace('/initOnlyAsm', '/build/cjs/initOnlyAsm.js')
.replace('/cjs/asm', '/build/cjs/asm.js')
.replace('/cjs/packageInfo', '/build/cjs/packageInfo.js')
}`)
);
-63
View File
@@ -1,63 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const { assert, u8aToHex } = require('@polkadot/util');
function bip39Generate (wasm) {
const res = wasm.bip39Generate(21);
console.log('\tPHR', res);
assert(res.split(' ').length === 21, 'ERROR: Invalid bip39 Phase length');
}
function bip39GenerateSubsequent (wasm) {
const val1 = wasm.bip39Generate(24);
const val2 = wasm.bip39Generate(24);
console.log('\tVL1', val1);
console.log('\tVL2', val2);
assert(val1 !== val2, 'ERROR: Subsequent mnemonics are the same');
}
function bip39Validate (wasm) {
const res = wasm.bip39Validate(wasm.bip39Generate(12));
console.log('\tVAL', res);
assert(res, 'ERROR: Invalid bip39 validation');
}
function bip39ToEntropy (wasm) {
const res = u8aToHex(wasm.bip39ToEntropy('legal winner thank year wave sausage worth useful legal winner thank yellow'));
console.log('\tENT', res);
assert(res === '0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f', 'ERROR: Invalid bip39 entropy');
}
function bip39ToMiniSecret (wasm) {
const res = u8aToHex(wasm.bip39ToMiniSecret('legal winner thank year wave sausage worth useful legal winner thank yellow', 'Substrate'));
console.log('\tMIN', res);
assert(res === '0x4313249608fe8ac10fd5886c92c4579007272cb77c21551ee5b8d60b78041685', 'ERROR: Invalid bip39 mini secret');
}
function bip39ToSeed (wasm) {
const res = u8aToHex(wasm.bip39ToSeed('seed sock milk update focus rotate barely fade car face mechanic mercy', ''));
console.log('\tSEE', res);
assert(res === '0x3c121e20de068083b49c2315697fb59a2d9e8643c24e5ea7628132c58969a027', 'ERROR: Invalid bip39 mini secret');
}
module.exports = {
bip39Generate,
bip39GenerateSubsequent,
bip39ToEntropy,
bip39ToMiniSecret,
bip39ToSeed,
bip39Validate
};
+66
View File
@@ -0,0 +1,66 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, u8aToHex } from '@polkadot/util';
export function bip39Generate (wasm) {
it('generates a bip39 phrase', () => {
const res = wasm.bip39Generate(21);
// console.log('\tPHR', res);
assert(res.split(' ').length === 21, 'ERROR: Invalid bip39 Phase length');
});
}
export function bip39GenerateSubsequent (wasm) {
it('generates different subsequent mnemonics', () => {
const val1 = wasm.bip39Generate(24);
const val2 = wasm.bip39Generate(24);
// console.log('\tVL1', val1);
// console.log('\tVL2', val2);
assert(val1 !== val2, 'ERROR: Subsequent mnemonics are the same');
});
}
export function bip39Validate (wasm) {
it('validates a created mnemonic', () => {
const res = wasm.bip39Validate(wasm.bip39Generate(12));
// console.log('\tVAL', res);
assert(res, 'ERROR: Invalid bip39 validation');
});
}
export function bip39ToEntropy (wasm) {
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'));
// console.log('\tENT', res);
assert(res === '0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f', 'ERROR: Invalid bip39 entropy');
});
}
export function bip39ToMiniSecret (wasm) {
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'));
// console.log('\tMIN', res);
assert(res === '0x4313249608fe8ac10fd5886c92c4579007272cb77c21551ee5b8d60b78041685', 'ERROR: Invalid bip39 mini secret');
});
}
export function bip39ToSeed (wasm) {
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', ''));
// console.log('\tSEE', res);
assert(res === '0x3c121e20de068083b49c2315697fb59a2d9e8643c24e5ea7628132c58969a027', 'ERROR: Invalid bip39 mini secret');
});
}
-58
View File
@@ -1,58 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const crypto = require('crypto');
const { assert, hexToU8a, stringToU8a, u8aToHex } = require('@polkadot/util');
function extractKeys (pair) {
return [pair, pair.slice(32), pair.slice(0, 32)];
}
function randomPair (wasm) {
return extractKeys(wasm.ed25519KeypairFromSeed(crypto.randomBytes(32)));
}
function ed25519PairFromSeed (wasm) {
const [pair, pk, sk] = extractKeys(wasm.ed25519KeypairFromSeed(stringToU8a('12345678901234567890123456789012')));
console.log('\tSEC', u8aToHex(sk));
console.log('\tPUB', u8aToHex(pk));
assert(u8aToHex(pair) === '0x31323334353637383930313233343536373839303132333435363738393031322f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee', 'ERROR: pairFromSeed() does not match');
}
function ed25519SignAndVerify (wasm) {
const [, pk, sk] = randomPair(wasm);
const signature = wasm.ed25519Sign(pk, sk, stringToU8a('this is a message'));
const isValid = wasm.ed25519Verify(signature, stringToU8a('this is a message'), pk);
console.log('\tSIG', u8aToHex(signature));
console.log('\tRES', isValid);
assert(isValid, 'ERROR: Unable to verify signature');
}
function ed25519VerifyExisting (wasm) {
const isValid = wasm.ed25519Verify(hexToU8a('0x90588f3f512496f2dd40571d162e8182860081c74e2085316e7c4396918f07da412ee029978e4dd714057fe973bd9e7d645148bf7b66680d67c93227cde95202'), stringToU8a('this is a message'), hexToU8a('0x2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee'));
console.log('\tRES', isValid);
assert(isValid, 'ERROR: Unable to verify signature');
}
function ed25519Benchmark (wasm) {
const MESSAGE = stringToU8a('this is a message');
for (let i = 0; i < 256; i++) {
const [, pk, sk] = randomPair(wasm);
assert(wasm.ed25519Verify(wasm.ed25519Sign(pk, sk, MESSAGE), MESSAGE, pk), 'ERROR: Unable to verify signature');
}
}
module.exports = {
ed25519Benchmark,
ed25519PairFromSeed,
ed25519SignAndVerify,
ed25519VerifyExisting
};
+64
View File
@@ -0,0 +1,64 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import crypto from 'crypto';
import { assert, hexToU8a, stringToU8a, u8aToHex } from '@polkadot/util';
/** @internal */
function extractKeys (pair) {
return [pair, pair.slice(32), pair.slice(0, 32)];
}
/** @internal */
function randomPair (wasm) {
return extractKeys(wasm.ed25519KeypairFromSeed(crypto.randomBytes(32)));
}
export function ed25519PairFromSeed (wasm) {
it('creates a known pair from a known seed', () => {
const [pair, pk, sk] = extractKeys(wasm.ed25519KeypairFromSeed(stringToU8a('12345678901234567890123456789012')));
// console.log('\tSEC', u8aToHex(sk));
// console.log('\tPUB', u8aToHex(pk));
assert(u8aToHex(sk) === '0x3132333435363738393031323334353637383930313233343536373839303132');
assert(u8aToHex(pk) === '0x2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee');
assert(u8aToHex(pair) === '0x31323334353637383930313233343536373839303132333435363738393031322f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee', 'ERROR: pairFromSeed() does not match');
});
}
export function ed25519SignAndVerify (wasm) {
it('signs and verifies', () => {
const [, pk, sk] = randomPair(wasm);
const signature = wasm.ed25519Sign(pk, sk, stringToU8a('this is a message'));
const isValid = wasm.ed25519Verify(signature, stringToU8a('this is a message'), pk);
// console.log('\tSIG', u8aToHex(signature));
// console.log('\tRES', isValid);
assert(isValid, 'ERROR: Unable to verify signature');
});
}
export function ed25519VerifyExisting (wasm) {
it('verifies a known signature', () => {
const isValid = wasm.ed25519Verify(hexToU8a('0x90588f3f512496f2dd40571d162e8182860081c74e2085316e7c4396918f07da412ee029978e4dd714057fe973bd9e7d645148bf7b66680d67c93227cde95202'), stringToU8a('this is a message'), hexToU8a('0x2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee'));
// console.log('\tRES', isValid);
assert(isValid, 'ERROR: Unable to verify signature');
});
}
export function ed25519Benchmark (wasm) {
it('runs a verification benchamark', () => {
const MESSAGE = stringToU8a('this is a message');
for (let i = 0; i < 256; i++) {
const [, pk, sk] = randomPair(wasm);
assert(wasm.ed25519Verify(wasm.ed25519Sign(pk, sk, MESSAGE), MESSAGE, pk), 'ERROR: Unable to verify signature');
}
});
}
-99
View File
@@ -1,99 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const { assert, stringToU8a, u8aToHex } = require('@polkadot/util');
function blake2bHash (wasm) {
const hash = u8aToHex(wasm.blake2b(stringToU8a('abc'), new Uint8Array(), 64));
console.log('\tRES', hash);
assert(hash === '0xba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923', 'ERROR: blake2bHash does not match');
}
function hmacSha256 (wasm) {
const hash = u8aToHex(wasm.hmacSha256(stringToU8a('secret'), stringToU8a('some message')));
console.log('\tRES', hash);
assert(hash === '0xf28a70b41263840e5c059a0a733336e0957efba87902aa8cca11441d4b0c96d7', 'ERROR: hmacSha256 does not match');
}
function hmacSha512 (wasm) {
const hash = u8aToHex(wasm.hmacSha512(stringToU8a('secret'), stringToU8a('some message')));
console.log('\tRES', hash);
assert(hash === '0x295832e97ed77be75a9fa98029497e4a722c4b9a2f21b39d34f1befa931a39ec520fd24711d6f5c03501384ea66b83066a01a82c57a0460f8cd1f471fcce5841', 'ERROR: hmacSha512 does not match');
}
function keccak256 (wasm) {
const hash = u8aToHex(wasm.keccak256(stringToU8a('test value')));
console.log('\tRES', hash);
assert(hash === '0x2d07364b5c231c56ce63d49430e085ea3033c750688ba532b24029124c26ca5e', 'ERROR: keccak256 does not match');
}
function keccak512 (wasm) {
const hash = u8aToHex(wasm.keccak512(stringToU8a('test')));
console.log('\tRES', hash);
assert(hash === '0x1e2e9fc2002b002d75198b7503210c05a1baac4560916a3c6d93bcce3a50d7f00fd395bf1647b9abb8d1afcc9c76c289b0c9383ba386a956da4b38934417789e', 'ERROR: keccak512 does not match');
}
function pbkdf2Hash (wasm) {
const hash = u8aToHex(wasm.pbkdf2(stringToU8a('hello world'), stringToU8a('this is a salt'), 2048));
console.log('\tRES', hash);
assert(hash === '0x5fcbe04f05300a3ecc5c35d18ea0b78f3f6853d2ae5f3fca374f69a7d1f78b5def5c60dae1a568026c7492511e0c53521e8bb6e03a650e1263265fee92722270', 'ERROR: pbkdf2Hash does not match');
}
function scryptHash (wasm) {
const hash = u8aToHex(wasm.scrypt(stringToU8a('password'), stringToU8a('salt'), 14, 8, 1));
console.log('\tRES', hash);
assert(hash === '0x745731af4484f323968969eda289aeee005b5903ac561e64a5aca121797bf7734ef9fd58422e2e22183bcacba9ec87ba0c83b7a2e788f03ce0da06463433cda6', 'ERROR: scryptHash does not match');
}
function sha256Hash (wasm) {
const hash = u8aToHex(wasm.sha256(stringToU8a('hello world')));
console.log('\tRES', hash);
assert(hash === '0xb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9', 'ERROR: sha256Hash does not match');
}
function sha512Hash (wasm) {
const hash = u8aToHex(wasm.sha512(stringToU8a('hello world')));
console.log('\tRES', hash);
assert(hash === '0x309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f', 'ERROR: sha512Hash does not match');
}
function twoxHash (wasm) {
const hash64 = u8aToHex(wasm.twox(stringToU8a('abc'), 1));
const hash256 = u8aToHex(wasm.twox(stringToU8a('abc'), 4));
console.log('\t64 ', hash64);
console.log('\t256', hash256);
assert(hash64 === '0x990977adf52cbc44' && hash256 === '0x990977adf52cbc440889329981caa9bef7da5770b2b8a05303b75d95360dd62b', 'ERROR: twoxHash does not match');
}
module.exports = {
blake2bHash,
hmacSha256,
hmacSha512,
keccak256,
keccak512,
pbkdf2Hash,
scryptHash,
sha256Hash,
sha512Hash,
twoxHash
};
+106
View File
@@ -0,0 +1,106 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, stringToU8a, u8aToHex } from '@polkadot/util';
export function blake2bHash (wasm) {
it('creates a known blake2b hash', () => {
const hash = u8aToHex(wasm.blake2b(stringToU8a('abc'), new Uint8Array(), 64));
// console.log('\tRES', hash);
assert(hash === '0xba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923', 'ERROR: blake2bHash does not match');
});
}
export function hmacSha256 (wasm) {
it('creates a known hmacSha256', () => {
const hash = u8aToHex(wasm.hmacSha256(stringToU8a('secret'), stringToU8a('some message')));
// console.log('\tRES', hash);
assert(hash === '0xf28a70b41263840e5c059a0a733336e0957efba87902aa8cca11441d4b0c96d7', 'ERROR: hmacSha256 does not match');
});
}
export function hmacSha512 (wasm) {
it('creates a known hmacSha512', () => {
const hash = u8aToHex(wasm.hmacSha512(stringToU8a('secret'), stringToU8a('some message')));
// console.log('\tRES', hash);
assert(hash === '0x295832e97ed77be75a9fa98029497e4a722c4b9a2f21b39d34f1befa931a39ec520fd24711d6f5c03501384ea66b83066a01a82c57a0460f8cd1f471fcce5841', 'ERROR: hmacSha512 does not match');
});
}
export function keccak256 (wasm) {
it('creates a known keccak256 hash', () => {
const hash = u8aToHex(wasm.keccak256(stringToU8a('test value')));
// console.log('\tRES', hash);
assert(hash === '0x2d07364b5c231c56ce63d49430e085ea3033c750688ba532b24029124c26ca5e', 'ERROR: keccak256 does not match');
});
}
export function keccak512 (wasm) {
it('creates a known keccak512 hash', () => {
const hash = u8aToHex(wasm.keccak512(stringToU8a('test')));
// console.log('\tRES', hash);
assert(hash === '0x1e2e9fc2002b002d75198b7503210c05a1baac4560916a3c6d93bcce3a50d7f00fd395bf1647b9abb8d1afcc9c76c289b0c9383ba386a956da4b38934417789e', 'ERROR: keccak512 does not match');
});
}
export function pbkdf2Hash (wasm) {
it('creates a known pbkdf2 hash', () => {
const hash = u8aToHex(wasm.pbkdf2(stringToU8a('hello world'), stringToU8a('this is a salt'), 2048));
// console.log('\tRES', hash);
assert(hash === '0x5fcbe04f05300a3ecc5c35d18ea0b78f3f6853d2ae5f3fca374f69a7d1f78b5def5c60dae1a568026c7492511e0c53521e8bb6e03a650e1263265fee92722270', 'ERROR: pbkdf2Hash does not match');
});
}
export function scryptHash (wasm) {
it('creates a known scrypt hash', () => {
const hash = u8aToHex(wasm.scrypt(stringToU8a('password'), stringToU8a('salt'), 14, 8, 1));
// console.log('\tRES', hash);
assert(hash === '0x745731af4484f323968969eda289aeee005b5903ac561e64a5aca121797bf7734ef9fd58422e2e22183bcacba9ec87ba0c83b7a2e788f03ce0da06463433cda6', 'ERROR: scryptHash does not match');
});
}
export function sha256Hash (wasm) {
it('creates a known sha256 hash', () => {
const hash = u8aToHex(wasm.sha256(stringToU8a('hello world')));
// console.log('\tRES', hash);
assert(hash === '0xb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9', 'ERROR: sha256Hash does not match');
});
}
export function sha512Hash (wasm) {
it('creates a known sha512 hash', () => {
const hash = u8aToHex(wasm.sha512(stringToU8a('hello world')));
// console.log('\tRES', hash);
assert(hash === '0x309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f', 'ERROR: sha512Hash does not match');
});
}
export function twoxHash (wasm) {
it('creates a known twox hash', () => {
const hash64 = u8aToHex(wasm.twox(stringToU8a('abc'), 1));
const hash256 = u8aToHex(wasm.twox(stringToU8a('abc'), 4));
// console.log('\t64 ', hash64);
// console.log('\t256', hash256);
assert(hash64 === '0x990977adf52cbc44' && hash256 === '0x990977adf52cbc440889329981caa9bef7da5770b2b8a05303b75d95360dd62b', 'ERROR: twoxHash does not match');
});
}
-87
View File
@@ -1,87 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const { assert } = require('@polkadot/util');
const wasm = require('../../build');
const bip39 = require('./bip39.cjs');
const ed25519 = require('./ed25519.cjs');
const hashing = require('./hashing.cjs');
const secp256k1 = require('./secp256k1.cjs');
const sr25519 = require('./sr25519.cjs');
const vrf = require('./vrf.cjs');
const tests = {
// We place secp256k1 first, this allows the interaction with it in the
// hashing (specifically scrypt) test not be an issue (ASM.js only)
// https://github.com/polkadot-js/wasm/issues/307
...secp256k1,
...ed25519,
...sr25519,
...vrf,
...bip39,
...hashing
};
async function beforeAll (name) {
const result = await wasm.waitReady();
console.log(`*** waitReady()=${result} for ${wasm.bridge.type}`);
assert(name.toLowerCase() === wasm.bridge.type, `Incorrect environment laucnhed, expected ${name.toLowerCase()}, found ${wasm.bridge.type}`);
return result;
}
function runAll (name) {
const failed = [];
let count = 0;
Object.keys(tests).forEach((name) => {
const timerId = `\t${name}`;
count++;
try {
console.time(timerId);
console.log();
console.log(timerId);
tests[name](wasm);
console.timeEnd(timerId);
} catch (error) {
console.error();
console.error(error);
failed.push(name);
}
});
if (failed.length) {
throw new Error(`\n*** ${name}: FAILED: ${failed.length} of ${count}: ${failed.join(', ')}`);
}
}
function runUnassisted (name) {
console.log(`\n*** ${name}: Running tests`);
beforeAll(name)
.then(() => runAll(name))
.then(() => {
console.log(`\n*** ${name}: All passed`);
process.exit(0);
})
.catch((error) => {
console.error(error.message, '\n');
process.exit(-1);
});
}
module.exports = {
beforeAll,
runAll,
runUnassisted,
tests,
wasm
};
+106
View File
@@ -0,0 +1,106 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert } from '@polkadot/util';
import * as bip39 from './bip39.js';
import * as ed25519 from './ed25519.js';
import * as hashing from './hashing.js';
import * as secp256k1 from './secp256k1.js';
import * as sr25519 from './sr25519.js';
import * as vrf from './vrf.js';
export const tests = {
// We place secp256k1 first, this allows the interaction with it in the
// hashing (specifically scrypt) test not be an issue (ASM.js only)
// https://github.com/polkadot-js/wasm/issues/307
secp256k1,
// eslint-disable-next-line sort-keys
bip39,
ed25519,
hashing,
sr25519,
vrf
};
export async function initRun (name, wasm) {
const result = await wasm.waitReady();
console.log(`*** waitReady()=${result} for ${wasm.bridge.type}`);
assert(name.toLowerCase() === wasm.bridge.type, `Incorrect environment launched, expected ${name.toLowerCase()}, found ${wasm.bridge.type}`);
return result;
}
export function runAll (name, wasm) {
const failed = [];
let count = 0;
Object
.entries(tests)
.forEach(([describeName, tests]) => {
describe(describeName, () => {
Object
.entries(tests)
.forEach(([name, test]) => {
const timerId = `\t${name}`;
count++;
try {
console.time(timerId);
console.log();
// console.log(timerId);
test(wasm);
console.timeEnd(timerId);
} catch (error) {
console.error();
console.error(error);
failed.push(name);
}
});
});
});
if (failed.length) {
throw new Error(`\n*** ${name}: FAILED: ${failed.length} of ${count}: ${failed.join(', ')}`);
}
}
export function runUnassisted (type, wasm) {
console.log(`\n*** ${type}: Running tests`);
// for these we are pass-through describe and it handlers
globalThis.describe = (name, fn) => {
console.log('\n', name);
fn();
};
globalThis.it = (name, fn) => {
console.log(`\t${name}`);
fn();
};
console.time(type);
initRun(type, wasm)
.then(() => {
runAll(type, wasm);
console.log(`\n*** ${type}: All passed`);
console.timeEnd(type);
console.log();
process.exit(0);
})
.catch((error) => {
console.error(`\n*** ${type}: FAILED:`, error.message, '\n');
console.timeEnd(type);
console.log();
process.exit(-1);
});
}
@@ -1,82 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const { assert, hexToU8a, u8aToHex } = require('@polkadot/util');
function secp256k1Compress (wasm) {
const pubkey = '0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af';
const result = u8aToHex(wasm.secp256k1Compress(hexToU8a(pubkey)));
console.log('\tRES', result);
assert(result === '0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077', 'ERROR: secp256k1Compress does not match');
}
function secp256k1Expand (wasm) {
const pubkey = '0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077';
const result = u8aToHex(wasm.secp256k1Expand(hexToU8a(pubkey)));
console.log('\tRES', result);
assert(result === '0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af', 'ERROR: secp256k1Expand does not match');
}
function secp256k1FromSeed1 (wasm) {
const seckey = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae';
const result = u8aToHex(wasm.secp256k1FromSeed(hexToU8a(seckey)));
console.log('\tRES', result);
assert(result === '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae03fd8c74f795ced92064b86191cb2772b1e3a0947740aa0a5a6e379592471fd85b', 'ERROR: secp256k1FromSeed does not match');
}
function secp256k1FromSeed2 (wasm) {
// https://github.com/polkadot-js/wasm/issues/307
const seckey = new Uint8Array([
203, 109, 249, 222, 30, 252, 167, 163, 153, 138, 142,
173, 78, 2, 21, 157, 95, 169, 156, 62, 13, 79,
214, 67, 38, 103, 57, 11, 180, 114, 104, 84
]);
const expected = u8aToHex(new Uint8Array([
203, 109, 249, 222, 30, 252, 167, 163, 153, 138, 142,
173, 78, 2, 21, 157, 95, 169, 156, 62, 13, 79,
214, 67, 38, 103, 57, 11, 180, 114, 104, 84, 2,
10, 16, 145, 52, 31, 229, 102, 75, 250, 23, 130,
213, 224, 71, 121, 104, 144, 104, 201, 22, 176, 76,
179, 101, 236, 49, 83, 117, 86, 132, 217, 161
]));
const result = u8aToHex(wasm.secp256k1FromSeed(seckey));
console.log('\tRES', result);
assert(result === expected, 'ERROR: secp256k1FromSeed does not match');
}
function secp256k1Recover (wasm) {
const sig = '0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff';
const msg = '0xa30b64ce1eedf409c8afb801d72c05234e64849ea538c15dd3c8cf4ffcf166c9';
const result = u8aToHex(wasm.secp256k1Recover(hexToU8a(msg), hexToU8a(sig), 0));
console.log('\tRES', result);
assert(result === '0x028d13da15a02f3a70677339d51b14177ee9b49657662b35e56a9d9dee17db1d30', 'ERROR: secp256k1Recover does not match');
}
function secp256k1Sign (wasm) {
const sec = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae';
const msg = '0x68c731589a583d08b70861683b59ce3dd56284cb2f0da5b6cd83e6641dac3aab';
const result = u8aToHex(wasm.secp256k1Sign(hexToU8a(msg), hexToU8a(sec)));
console.log('\tRES', result);
assert(result === '0xdf92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba83b105adec9e9872647a7d8bb28855b45e22805aea3d097953cbb1391f671d13e01', 'ERROR: secp256k1Sign does not match');
}
module.exports = {
secp256k1Compress,
secp256k1Expand,
secp256k1FromSeed1,
secp256k1FromSeed2,
secp256k1Recover,
secp256k1Sign
};
@@ -0,0 +1,85 @@
// Copyright 2019-2023 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert, hexToU8a, u8aToHex } from '@polkadot/util';
export function secp256k1Compress (wasm) {
it('compresses a known publicKey', () => {
const pubkey = '0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af';
const result = u8aToHex(wasm.secp256k1Compress(hexToU8a(pubkey)));
// console.log('\tRES', result);
assert(result === '0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077', 'ERROR: secp256k1Compress does not match');
});
}
export function secp256k1Expand (wasm) {
it('expands a known compressed key', () => {
const pubkey = '0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077';
const result = u8aToHex(wasm.secp256k1Expand(hexToU8a(pubkey)));
// console.log('\tRES', result);
assert(result === '0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af', 'ERROR: secp256k1Expand does not match');
});
}
export function secp256k1FromSeed1 (wasm) {
it('creates a known pair from seed (1)', () => {
const seckey = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae';
const result = u8aToHex(wasm.secp256k1FromSeed(hexToU8a(seckey)));
// console.log('\tRES', result);
assert(result === '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae03fd8c74f795ced92064b86191cb2772b1e3a0947740aa0a5a6e379592471fd85b', 'ERROR: secp256k1FromSeed does not match');
});
}
export function secp256k1FromSeed2 (wasm) {
it('creates a known pair from seed (2)', () => {
// https://github.com/polkadot-js/wasm/issues/307
const seckey = new Uint8Array([
203, 109, 249, 222, 30, 252, 167, 163, 153, 138, 142,
173, 78, 2, 21, 157, 95, 169, 156, 62, 13, 79,
214, 67, 38, 103, 57, 11, 180, 114, 104, 84
]);
const expected = u8aToHex(new Uint8Array([
203, 109, 249, 222, 30, 252, 167, 163, 153, 138, 142,
173, 78, 2, 21, 157, 95, 169, 156, 62, 13, 79,
214, 67, 38, 103, 57, 11, 180, 114, 104, 84, 2,
10, 16, 145, 52, 31, 229, 102, 75, 250, 23, 130,
213, 224, 71, 121, 104, 144, 104, 201, 22, 176, 76,
179, 101, 236, 49, 83, 117, 86, 132, 217, 161
]));
const result = u8aToHex(wasm.secp256k1FromSeed(seckey));
// console.log('\tRES', result);
assert(result === expected, 'ERROR: secp256k1FromSeed does not match');
});
}
export function secp256k1Recover (wasm) {
it('recovers a publicKey from signature', () => {
const sig = '0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff';
const msg = '0xa30b64ce1eedf409c8afb801d72c05234e64849ea538c15dd3c8cf4ffcf166c9';
const result = u8aToHex(wasm.secp256k1Recover(hexToU8a(msg), hexToU8a(sig), 0));
// console.log('\tRES', result);
assert(result === '0x028d13da15a02f3a70677339d51b14177ee9b49657662b35e56a9d9dee17db1d30', 'ERROR: secp256k1Recover does not match');
});
}
export function secp256k1Sign (wasm) {
it('creates a known signature', () => {
const sec = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae';
const msg = '0x68c731589a583d08b70861683b59ce3dd56284cb2f0da5b6cd83e6641dac3aab';
const result = u8aToHex(wasm.secp256k1Sign(hexToU8a(msg), hexToU8a(sec)));
// console.log('\tRES', result);
assert(result === '0xdf92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba83b105adec9e9872647a7d8bb28855b45e22805aea3d097953cbb1391f671d13e01', 'ERROR: secp256k1Sign does not match');
});
}
-151
View File
@@ -1,151 +0,0 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const crypto = require('crypto');
const { assert, hexToU8a, stringToU8a, u8aToHex } = require('@polkadot/util');
function extractKeys (pair) {
return [pair, pair.slice(64), pair.slice(0, 64)];
}
function randomPair (wasm) {
return extractKeys(wasm.sr25519KeypairFromSeed(crypto.randomBytes(32)));
}
function sr25519PairFromSeed (wasm) {
const pair = wasm.sr25519KeypairFromSeed(stringToU8a('12345678901234567890123456789012'));
console.log('\tSEC', u8aToHex(pair.slice(0, 64)));
console.log('\tPUB', u8aToHex(pair.slice(64)));
assert(u8aToHex(pair) === '0xf0106660c3dda23f16daa9ac5b811b963077f5bc0af89f85804f0de8e424f050f98d66f39442506ff947fd911f18c7a7a5da639a63e8d3b4e233f74143d951c1741c08a06f41c596608f6774259bd9043304adfa5d3eea62760bd9be97634d63', 'ERROR: pairFromSeed() does not match');
}
function sr25519DevFromSeed (wasm) {
const pair = wasm.sr25519KeypairFromSeed(hexToU8a('0xfac7959dbfe72f052e5a0c3c8d6530f202b02fd8f9f5ca3580ec8deb7797479e'));
console.log('\tSEC', u8aToHex(pair.slice(0, 64)));
console.log('\tPUB', u8aToHex(pair.slice(64)));
assert(u8aToHex(pair) === '0x28b0ae221c6bb06856b287f60d7ea0d98552ea5a16db16956849aa371db3eb51fd190cce74df356432b410bd64682309d6dedb27c76845daf388557cbac3ca3446ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a', 'ERROR: devFromSeed() does not match');
}
function sr25519VerifyExisting (wasm) {
const PK = hexToU8a('0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d');
const MESSAGE = stringToU8a('I hereby verify that I control 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY');
const SIGNATURE = hexToU8a('0xb83881d3bd7302981ee1c504fe5b7b394682927131fc0846fd616bb40fa14d02640fd2aca785b4cb57904765c2e4e75f59a7dd30154c209964369912091f6981');
const isValid = wasm.sr25519Verify(SIGNATURE, MESSAGE, PK);
console.log('\tRES', isValid);
assert(isValid, 'ERROR: Unable to verify signature');
}
function sr25519SignDeterministic (wasm) {
const [, pk, sk] = randomPair(wasm);
const sig1 = u8aToHex(wasm.sr25519Sign(pk, sk, stringToU8a('this is a message')));
const sig2 = u8aToHex(wasm.sr25519Sign(pk, sk, stringToU8a('this is a message')));
console.log('\tSG1', sig1);
console.log('\tSG2', sig2);
assert(sig1 !== sig2, 'ERROR: Signatures are deterministic');
}
function sr25519SignAndVerify (wasm) {
const [, pk, sk] = randomPair(wasm);
const signature = wasm.sr25519Sign(pk, sk, stringToU8a('this is a message'));
const isValid = wasm.sr25519Verify(signature, stringToU8a('this is a message'), pk);
console.log('\tSIG', u8aToHex(signature));
console.log('\tRES', isValid);
assert(isValid, 'ERROR: Unable to verify signature');
}
function sr25519DeriveHard (wasm) {
const [pair] = randomPair(wasm);
const derived = wasm.sr25519DeriveKeypairHard(pair, hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000'));
console.log('\tSEC', u8aToHex(derived.slice(0, 64)));
console.log('\tPUB', u8aToHex(derived.slice(64)));
}
function sr25519DeriveHardKnown (wasm) {
const derived = wasm.sr25519DeriveKeypairHard(hexToU8a('0x28b0ae221c6bb06856b287f60d7ea0d98552ea5a16db16956849aa371db3eb51fd190cce74df356432b410bd64682309d6dedb27c76845daf388557cbac3ca3446ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x14416c6963650000000000000000000000000000000000000000000000000000'));
const publicKey = u8aToHex(derived.slice(64));
console.log('\tSEC', u8aToHex(derived.slice(0, 64)));
console.log('\tPUB', publicKey);
assert(publicKey === '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d', 'Unmatched resulting public keys');
}
function sr25519DeriveSoft (wasm) {
const [pair] = randomPair(wasm);
const derived = wasm.sr25519DeriveKeypairSoft(pair, hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000'));
console.log('\tSEC', u8aToHex(derived.slice(0, 64)));
console.log('\tPUB', u8aToHex(derived.slice(64)));
}
function sr25519DeriveSoftKnown (wasm) {
const derived = wasm.sr25519DeriveKeypairSoft(hexToU8a('0x28b0ae221c6bb06856b287f60d7ea0d98552ea5a16db16956849aa371db3eb51fd190cce74df356432b410bd64682309d6dedb27c76845daf388557cbac3ca3446ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000'));
const publicKey = u8aToHex(derived.slice(64));
console.log('\tSEC', u8aToHex(derived.slice(0, 64)));
console.log('\tPUB', publicKey);
assert(publicKey === '0x40b9675df90efa6069ff623b0fdfcf706cd47ca7452a5056c7ad58194d23440a', 'Unmatched resulting public keys');
}
function sr25519DeriveSoftPubkey (wasm) {
const derived = u8aToHex(wasm.sr25519DerivePublicSoft(hexToU8a('0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a'), hexToU8a('0x0c666f6f00000000000000000000000000000000000000000000000000000000')));
console.log('\tPUB', derived);
assert(derived === '0x40b9675df90efa6069ff623b0fdfcf706cd47ca7452a5056c7ad58194d23440a', 'Unmatched resulting public keys');
}
function sr25519KeyAgreement (wasm) {
const pair1 = wasm.sr25519KeypairFromSeed(hexToU8a('0x3b44c558f9a8f3dc9690d53088558c1ba2529b677e316c6054d1852595b004af'));
const pair2 = wasm.sr25519KeypairFromSeed(hexToU8a('0x923b80f79c6981fe756272128ec236eb510ae016dd20bdccbd77a9416b7ab94e'));
const [, pk1, sk1] = extractKeys(pair1);
const [, pk2, sk2] = extractKeys(pair2);
assert(u8aToHex(wasm.sr25519Agree(pk1, sk2)) === '0xfa7b90001b790fe42ff78b8cd86f6cf7a7c0a70b72f6b4c771b5d67536450222', 'Unmatched agreement keys');
assert(u8aToHex(wasm.sr25519Agree(pk2, sk1)) === '0xfa7b90001b790fe42ff78b8cd86f6cf7a7c0a70b72f6b4c771b5d67536450222', 'Unmatched agreement keys');
for (let i = 0; i < 256; i++) {
const [, pk1, sk1] = randomPair(wasm);
const [, pk2, sk2] = randomPair(wasm);
assert(u8aToHex(wasm.sr25519Agree(pk1, sk2)) === u8aToHex(wasm.sr25519Agree(pk2, sk1)), 'Unmatched agreement keys');
}
}
function sr25519Benchmark (wasm) {
const MESSAGE = stringToU8a('this is a message');
for (let i = 0; i < 256; i++) {
const [, pk, sk] = randomPair(wasm);
assert(wasm.sr25519Verify(wasm.sr25519Sign(pk, sk, MESSAGE), MESSAGE, pk), 'ERROR: Unable to verify signature');
}
}
module.exports = {
sr25519Benchmark,
sr25519DeriveHard,
sr25519DeriveHardKnown,
sr25519DeriveSoft,
sr25519DeriveSoftKnown,
sr25519DeriveSoftPubkey,
sr25519DevFromSeed,
sr25519KeyAgreement,
sr25519PairFromSeed,
sr25519SignAndVerify,
sr25519SignDeterministic,
sr25519VerifyExisting
};

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