Compare commits

..
336 Commits
Author SHA1 Message Date
github-actions[bot] 2927c37776 [CI Skip] release/stable 6.2.2
skip-checks: true
2022-07-04 05:57:19 +00:00
Jaco ac63788ecd 6.2.2 (#384) 2022-07-04 08:51:08 +03:00
github-actions[bot] 0a64c9d329 [CI Skip] bump/beta 6.2.2-2-x
skip-checks: true
2022-07-04 05:01:04 +00:00
Jaco 81c9f3aa33 Bump deps (#383) 2022-07-04 07:55:37 +03:00
github-actions[bot] 6fae33074a [CI Skip] bump/beta 6.2.2-1-x
skip-checks: true
2022-07-03 18:45:43 +00:00
Jaco 679b282061 Remove extra serialize/deseralize on ed pair creation (#382) 2022-07-03 21:40:11 +03:00
github-actions[bot] 396b4cb598 [CI Skip] bump/beta 6.2.2-0-x
skip-checks: true
2022-07-03 18:26:17 +00:00
Jaco 8b67b82047 ed25519 signing leaks (#381) 2022-07-03 21:20:41 +03:00
github-actions[bot] da7d771898 [CI Skip] release/stable 6.2.1
skip-checks: true
2022-07-01 14:26:19 +00:00
Jaco 42b5942886 6.2.1 (#380) 2022-07-01 17:20:16 +03:00
github-actions[bot] d848c42bd3 [CI Skip] bump/beta 6.1.6-5-x
skip-checks: true
2022-07-01 14:07:29 +00:00
Jaco e9d034928f Adjust WebAssembly.{Memory, ModuleImports} usage to cater for non-dom TS (#379)
* Adjust `WebAssembly.{Memory, ModuleImports}` usage to cater for non-dom TS

* Remove wbg getter (only internal access required)

* Additional peerDeps for wasm-crypto-init

* Bump @polkadot/dev

* Remove never cast & comment, imports are functions
2022-07-01 17:01:56 +03:00
github-actions[bot] 2f042819ac [CI Skip] bump/beta 6.1.6-4-x
skip-checks: true
2022-06-30 11:41:53 +00:00
Jaco 2177d2f2cc Bump dev deps (#378) 2022-06-30 14:36:28 +03:00
github-actions[bot] 4d974e4d7f [CI Skip] bump/beta 6.1.6-3-x
skip-checks: true
2022-06-25 06:14:51 +00:00
Jaco cb05a1782a Bump common (dev deps) (#377)
* Bump common (dev deps)

* Add missing peerDependencies

* CHANGELOG
2022-06-25 09:09:15 +03:00
github-actions[bot] 5f7cb7641a [CI Skip] bump/beta 6.1.6-2-x
skip-checks: true
2022-06-23 17:10:26 +00:00
Jaco ff62f24cd4 Bump dev (w/ deno build fix) (#376) 2022-06-23 20:04:42 +03:00
github-actions[bot] d45dfb7dd2 [CI Skip] bump/beta 6.1.6-1-x
skip-checks: true
2022-06-23 11:22:09 +00:00
Jaco 1d4de873cb Bump dev 2022-06-23 14:15:28 +03:00
github-actions[bot] edfc1f0610 [CI Skip] release/beta 6.1.6-0
skip-checks: true
2022-06-23 08:37:41 +00:00
Jaco a662a23d19 README updates (#375)
* README updates

* Bump polkadot deps
2022-06-23 11:31:01 +03:00
github-actions[bot] 7cff1c8736 [CI Skip] release/stable 6.1.5
skip-checks: true
2022-06-23 07:36:43 +00:00
Jaco 6bfdebcff5 6.1.5 (#374) 2022-06-23 10:31:14 +03:00
github-actions[bot] 5b3158cb15 [CI Skip] release/stable 6.1.4
skip-checks: true
2022-06-22 05:59:18 +00:00
Jaco baa3439646 6.1.4 (#373) 2022-06-22 08:54:08 +03:00
github-actions[bot] ac040bd62b [CI Skip] release/beta 6.1.4-0
skip-checks: true
2022-06-21 17:39:22 +00:00
Jaco e0a9e33623 Adjust cjs -> deno path rewrites (#372) 2022-06-21 20:33:07 +03:00
github-actions[bot] b29f959dda [CI Skip] release/stable 6.1.3
skip-checks: true
2022-06-21 16:09:09 +00:00
Jaco 7a5ec9d347 6.1.3 (#371) 2022-06-21 19:03:53 +03:00
github-actions[bot] 28ddad0549 [CI Skip] release/stable 6.1.2
skip-checks: true
2022-06-21 15:42:22 +00:00
Jaco 615746a323 6.1.2 (#370) 2022-06-21 18:36:19 +03:00
Jaco e49d5a3219 6.1.2 (#369) 2022-06-21 18:22:51 +03:00
github-actions[bot] a31f7cac0d [CI Skip] release/beta 6.1.2-15
skip-checks: true
2022-06-21 13:41:20 +00:00
Jaco 9b65fe6c86 CHANGELOG & additional comments (#368) 2022-06-21 16:35:45 +03:00
github-actions[bot] 3b5dcd41d9 [CI Skip] release/beta 6.1.2-14
skip-checks: true
2022-06-21 12:49:22 +00:00
Jaco f4db1385fc Bump dev (w/ stable deno publish) (#367) 2022-06-21 15:43:49 +03:00
github-actions[bot] 1b844254fe [CI Skip] release/beta 6.1.2-13
skip-checks: true
2022-06-21 05:26:46 +00:00
Jaco bf924e5da0 Adjust WebAssembly init (#365)
* Adjust WebAssembly init

* Adjust

* Re-add length check
2022-06-21 08:21:29 +03:00
github-actions[bot] da37be391e [CI Skip] release/beta 6.1.2-12
skip-checks: true
2022-06-21 04:54:13 +00:00
Jaco 2a44054387 Bump TS to 4.7.4 (#364) 2022-06-21 07:47:51 +03:00
github-actions[bot] 4c85c4d336 [CI Skip] release/beta 6.1.2-11
skip-checks: true
2022-06-18 10:33:32 +00:00
Jaco 03030ae93f Adjust assert inside withWasm (#363) 2022-06-18 13:26:50 +03:00
github-actions[bot] ed438e8877 [CI Skip] release/beta 6.1.2-10
skip-checks: true
2022-06-13 19:27:43 +00:00
Jaco e7700787b2 Bump dev (#362) 2022-06-13 22:22:41 +03:00
github-actions[bot] 6cccb7b9b0 [CI Skip] release/beta 6.1.2-9
skip-checks: true
2022-06-13 05:23:33 +00:00
Jaco f8678ed024 Bump dev deps (#361) 2022-06-13 08:18:37 +03:00
github-actions[bot] 9b48e3dd36 [CI Skip] release/beta 6.1.2-8
skip-checks: true
2022-06-12 08:20:04 +00:00
Jaco f5db698705 Update issue template (#360) 2022-06-12 11:15:01 +03:00
github-actions[bot] 2a24642220 [CI Skip] release/beta 6.1.2-7
skip-checks: true
2022-06-11 07:20:21 +00:00
Jaco 5cd8ea6926 Sprinkle in comments on the actual code (#359) 2022-06-11 10:15:03 +03:00
github-actions[bot] 633b33430a [CI Skip] release/beta 6.1.2-6
skip-checks: true
2022-06-11 05:27:28 +00:00
Jaco 341e57eeb5 Bump deps (w/ issue template) (#358)
* Bump deps (w/ issue template)

* Adjust

* Adjust
2022-06-11 08:22:18 +03:00
github-actions[bot] 2a9b79f086 [CI Skip] release/beta 6.1.2-5
skip-checks: true
2022-06-04 05:22:54 +00:00
Jaco fc5a7bf9ce Bump @polkadot/util (#357) 2022-06-04 08:17:13 +03:00
github-actions[bot] fbb57dc9ca [CI Skip] release/beta 6.1.2-4
skip-checks: true
2022-06-04 04:51:04 +00:00
Jaco 2358984605 Bump deps (#356) 2022-06-04 07:45:46 +03:00
github-actions[bot] 28ae0b8963 [CI Skip] release/beta 6.1.2-3
skip-checks: true
2022-05-30 07:32:00 +00:00
Jaco 4e316440b9 Bump TS (#355) 2022-05-30 10:26:43 +03:00
github-actions[bot] f9c65c8fb2 [CI Skip] release/beta 6.1.2-2
skip-checks: true
2022-05-29 08:57:09 +00:00
Jaco d3c5d1a617 Adjust eslint ignore (#354)
* Adjust eslint ignore

* Update .eslintrc.js
2022-05-29 11:50:17 +03:00
github-actions[bot] b57cdaef14 [CI Skip] release/beta 6.1.2-1
skip-checks: true
2022-05-29 08:37:22 +00:00
Jaco 1f2ad4ea36 Bump deps (#353) 2022-05-29 11:32:02 +03:00
github-actions[bot] 4c3537d869 [CI Skip] release/beta 6.1.2-0
skip-checks: true
2022-05-13 19:38:44 +00:00
Jaco 6f1ff9f276 Bump base common (#351) 2022-05-13 22:32:01 +03:00
github-actions[bot] 34ab9d3354 [CI Skip] release/stable 6.1.1
skip-checks: true
2022-05-13 19:06:27 +00:00
Jaco 635aeb1465 6.1.1 (#350)
* 6.1.1

* 13 May
2022-05-13 22:01:20 +03:00
github-actions[bot] adf9b57dd6 [CI Skip] release/beta 6.0.2-15
skip-checks: true
2022-05-13 05:32:41 +00:00
Jaco 669aa9f53b Explicit empty catch (#349) 2022-05-13 08:27:24 +03:00
github-actions[bot] 399d439aa7 [CI Skip] release/beta 6.0.2-14
skip-checks: true
2022-05-12 06:39:34 +00:00
Jaco 29ecaa46c2 Tidy up with some renames (#347)
* Tidy up with some renames

* Adjust
2022-05-12 09:33:42 +03:00
github-actions[bot] 614c88e6c3 [CI Skip] release/beta 6.0.2-13
skip-checks: true
2022-05-12 05:34:30 +00:00
Jaco 49ab036894 Split into common wasm-bridge package (#346)
* Split into common wasm-bridge package

* README

* Adjust rollup bundling

* Adjust

* Adjust

* Adjust, full re-usable

* Cleanup deps

* Restore initWasm exports from init*

* Split base64 & fflate into wasm-util

* sideEffects for wasm-util

* Dedupe types

* Additional

* Adjust

* Expose error on InitResult

* Bump deps

* CHANGELOG

* Re-usable rollup config
2022-05-12 08:29:21 +03:00
github-actions[bot] c552006b38 [CI Skip] release/beta 6.0.2-12
skip-checks: true
2022-05-11 10:17:58 +00:00
Jaco b01f35cde5 Add environment type check to tests (#344) 2022-05-11 13:10:44 +03:00
github-actions[bot] a85615f12b [CI Skip] release/beta 6.0.2-11
skip-checks: true
2022-05-11 09:59:55 +00:00
Jaco 04285faf55 Adjust wasm build process w/ wasm-crypto naming (#343) 2022-05-11 12:54:36 +03:00
github-actions[bot] 962b880fa6 [CI Skip] release/beta 6.0.2-10
skip-checks: true
2022-05-11 06:07:05 +00:00
Jaco e75ebd07a0 Restore older package names (#342)
* Restore older package names

* Fix headers

* Adjust imports & tupe exports
2022-05-11 09:01:12 +03:00
github-actions[bot] a601a8d034 [CI Skip] release/beta 6.0.2-9
skip-checks: true
2022-05-10 07:30:01 +00:00
Jaco 13826c371e Bump deps & adjust test output (#341) 2022-05-10 10:23:47 +03:00
github-actions[bot] 0355bb4769 [CI Skip] release/beta 6.0.2-8
skip-checks: true
2022-05-09 14:54:17 +00:00
Jaco 2e14af5693 Adjust WASM init process (w/ RN aliases) (#340)
* Adjust WASM init process (w/ RN aliases)

* Remove stray log

* Cleanup

* CHANGELOG

* yarn.lock
2022-05-09 17:48:45 +03:00
github-actions[bot] 135b99ee63 [CI Skip] release/beta 6.0.2-7
skip-checks: true
2022-04-30 05:49:12 +00:00
Jaco f4851dc4d8 Bump dev deps (#338) 2022-04-30 08:43:43 +03:00
github-actions[bot] 8f31b00608 [CI Skip] release/beta 6.0.2-6
skip-checks: true
2022-04-29 11:29:57 +00:00
Jaco 0ac2977788 Bump TS (#337) 2022-04-29 14:23:51 +03:00
github-actions[bot] ef30070360 [CI Skip] release/beta 6.0.2-5
skip-checks: true
2022-04-27 18:46:15 +00:00
Jaco 3b9ac03b70 Explicit versions for wasm-crypto-* (#336) 2022-04-27 21:41:03 +03:00
github-actions[bot] 84f2e0da77 [CI Skip] release/beta 6.0.2-4
skip-checks: true
2022-04-27 07:00:16 +00:00
Jaco b0a5eaf20e Bump @polkadot/dev (#335) 2022-04-27 09:53:40 +03:00
github-actions[bot] 1fec165bac [CI Skip] release/beta 6.0.2-3
skip-checks: true
2022-04-24 09:26:00 +00:00
Jaco 5838ac1e69 Bump @polkadot/dev (#334) 2022-04-24 12:20:11 +03:00
github-actions[bot] dfd83c2463 [CI Skip] release/beta 6.0.2-2
skip-checks: true
2022-04-19 14:04:50 +00:00
Jaco b25d8dfd4b Bump deps (#333) 2022-04-19 16:59:39 +03:00
github-actions[bot] 21ee330e9b [CI Skip] release/beta 6.0.2-1
skip-checks: true
2022-04-12 05:05:39 +00:00
Jaco 599f6300c0 Bump deps (#332) 2022-04-12 07:59:21 +03:00
github-actions[bot] 1916a4e10c [CI Skip] release/beta 6.0.2-0
skip-checks: true
2022-04-09 09:18:49 +00:00
Jaco 0fd619c4f7 Bump common (#331) 2022-04-09 12:13:11 +03:00
github-actions[bot] 54c600a676 [CI Skip] release/stable 6.0.1
skip-checks: true
2022-04-09 07:27:33 +00:00
Jaco 763cd473b4 6.0.1 (#330)
* 5.2.1

* 6.0.1

* CHANGELOG

* Bump dev
2022-04-09 10:22:29 +03:00
github-actions[bot] e435c1e7b8 [CI Skip] release/beta 5.1.2-4
skip-checks: true
2022-04-05 05:08:16 +00:00
Jaco 59bf7495b4 Bump dev deps (#328) 2022-04-05 08:03:29 +03:00
github-actions[bot] ec36f55ed8 [CI Skip] release/beta 5.1.2-3
skip-checks: true
2022-04-05 04:34:07 +00:00
Jaco 03f38cb07b Adjust test for updated dev (#327)
* Adjust test for updated dev

* Bump dev
2022-04-05 07:29:17 +03:00
github-actions[bot] 36719449c2 [CI Skip] release/beta 5.1.2-2
skip-checks: true
2022-04-04 08:44:43 +00:00
Jaco efb0c51648 Allow for CJS file locations under cjs/** root (#326) 2022-04-04 11:39:55 +03:00
github-actions[bot] 2faf907296 [CI Skip] release/beta 5.1.2-1
skip-checks: true
2022-04-04 06:31:16 +00:00
Jaco 33b77fed37 Update ed25519 secret key format return description (#325) 2022-04-04 09:25:39 +03:00
github-actions[bot] 8cc2a167e1 [CI Skip] release/beta 5.1.2-0
skip-checks: true
2022-03-28 05:45:28 +00:00
Jaco 09f33968b9 Bump dev deps (@polkadot/util) (#323) 2022-03-28 08:40:40 +03:00
github-actions[bot] 346720f384 [CI Skip] release/stable 5.1.1
skip-checks: true
2022-03-27 07:06:01 +00:00
Jaco aeade5636a 5.1.1 (#322) 2022-03-27 10:01:06 +03:00
github-actions[bot] 9f3c8f1f74 [CI Skip] release/beta 5.0.2-7
skip-checks: true
2022-03-27 06:29:19 +00:00
Jaco 3d1e48ec4b Bump TypeScript (#321) 2022-03-27 09:23:31 +03:00
github-actions[bot] cbffca3984 [CI Skip] release/beta 5.0.2-6
skip-checks: true
2022-03-26 20:05:39 +00:00
Jaco 9d6427d9da Bump dev deps (#320) 2022-03-26 18:10:18 +02:00
github-actions[bot] 368cb6806f [CI Skip] release/beta 5.0.2-5
skip-checks: true
2022-03-26 15:44:48 +00:00
Jaco 9795eaf31c Don't run auto-init, but set input (#319)
* Don't run auto-init, but set input

* Adjust
2022-03-26 17:39:57 +02:00
github-actions[bot] b4f7b0b177 [CI Skip] release/beta 5.0.2-4
skip-checks: true
2022-03-24 11:38:15 +00:00
Jaco 44048626cd Update secp256k1 library (#318)
* Update secp256k1 library

* Adjust

* compress/uncompress

* All of them?

* Test removal of lazy section hack

* Run tests sequentially

* build:mac target

* s/sepc256k1/secp256k1/

* CHANGELOG
2022-03-24 13:31:57 +02:00
github-actions[bot] 7fb8a1cb93 [CI Skip] release/beta 5.0.2-3
skip-checks: true
2022-03-23 13:26:55 +00:00
Jaco 2d544e7bc3 Check instantiate as function (#317)
* Check instantiate as function

* Rename wbg
2022-03-23 15:20:10 +02:00
github-actions[bot] 0f0a8131c5 [CI Skip] release/beta 5.0.2-2
skip-checks: true
2022-03-23 12:00:49 +00:00
Jaco f7e6acbf9c Add initNone (#316)
* Add initNone

* Add force to explicit call
2022-03-23 13:54:11 +02:00
github-actions[bot] eb445e79e2 [CI Skip] release/beta 5.0.2-1
skip-checks: true
2022-03-23 05:21:23 +00:00
Jaco ddee3dfd25 Bump dev (#314) 2022-03-23 07:15:15 +02:00
github-actions[bot] 8b7e6b90a1 [CI Skip] release/beta 5.0.2-0
skip-checks: true
2022-03-19 08:57:25 +00:00
Jaco dd571dd35f Update dev deps to latest util (#313) 2022-03-19 10:52:05 +02:00
Jaco c4e4414bbf FAQ link 2022-03-19 10:43:05 +02:00
github-actions[bot] 221b50e905 [CI Skip] release/stable 5.0.1
skip-checks: true
2022-03-19 07:42:08 +00:00
Jaco 42598dc36b 5.0.1 (#312) 2022-03-19 09:37:11 +02:00
github-actions[bot] ea9d986a48 [CI Skip] release/beta 4.6.2-6
skip-checks: true
2022-03-19 07:25:36 +00:00
Jaco 64b10dd4ad Deps & CHANGELOG (#311) 2022-03-19 09:20:33 +02:00
github-actions[bot] 729b46ee5f [CI Skip] release/beta 4.6.2-5
skip-checks: true
2022-03-19 07:08:10 +00:00
Jaco 0dfb491e9d Reproduction for secp256k1 asm.js failure (#310)
* Reproduction for secp256k1 asm.js failure

* Make test output more readable

* Additional test cleanups

* Bump build deps

* Adjust output sizing flags

* Bump wasm-bindgen

* secp256k1 HACK

* Update packages/wasm-crypto/src/bundle.ts

* Update packages/wasm-crypto/src/bundle.ts

* Update packages/wasm-crypto/test/all/index.cjs
2022-03-19 09:02:52 +02:00
github-actions[bot] 63585ff3a7 [CI Skip] release/beta 4.6.2-4
skip-checks: true
2022-03-18 12:46:20 +00:00
Jaco 698e62d70a Adjust init to allow for asm/wasm or combo (#309)
* Additional known secp256k1 test

* Fix test

* typo

* ... one more typo

* Adjust init to allow for asm/wasm or combo

* Cleanup export, no internal cjs

* Adjust sideEffects

* CHANGELOG
2022-03-18 14:40:59 +02:00
github-actions[bot] ab9ca9f49d [CI Skip] release/beta 4.6.2-3
skip-checks: true
2022-03-18 12:00:14 +00:00
Jaco 257080e1f9 Additional known secp256k1 test (#308)
* Additional known secp256k1 test

* Fix test

* typo

* ... one more typo
2022-03-18 13:54:52 +02:00
github-actions[bot] 068c83b9fb [CI Skip] release/beta 4.6.2-2
skip-checks: true
2022-03-17 05:42:55 +00:00
Jaco cb86c48bc4 Bump @polkadot/dev (#306)
* Bump @polkadot/dev

* trigger
2022-03-17 07:36:16 +02:00
github-actions[bot] f0ceed5454 [CI Skip] release/beta 4.6.2-1
skip-checks: true
2022-03-16 08:04:19 +00:00
Jaco f0e4b29d73 Bump dev deps (#305) 2022-03-16 09:58:59 +02:00
github-actions[bot] 4d23c75fa4 [CI Skip] release/beta 4.6.2-0
skip-checks: true
2022-03-12 10:12:21 +00:00
Jaco 0ae73cbad3 Bump common (#303) 2022-03-12 12:07:27 +02:00
github-actions[bot] 44b70b745a [CI Skip] release/stable 4.6.1
skip-checks: true
2022-03-12 07:52:01 +00:00
Jaco 3bf0e29d94 4.6.1 (#302) 2022-03-12 09:46:59 +02:00
github-actions[bot] 60759e7a1a [CI Skip] release/beta 4.5.2-52
skip-checks: true
2022-03-10 07:42:35 +00:00
Jaco 28f4457e0a Bump deps (& yarn 3.2.0) (#301) 2022-03-10 09:36:44 +02:00
github-actions[bot] aca9e2655b [CI Skip] release/beta 4.5.2-51
skip-checks: true
2022-03-07 08:12:11 +00:00
Jaco 567ebe69d0 Support bundlers where import.meta.url is undefined (#300) 2022-03-07 10:06:55 +02:00
github-actions[bot] 6c3b30fe53 [CI Skip] release/beta 4.5.2-50
skip-checks: true
2022-03-03 13:31:11 +00:00
Jaco e9b2ba93c4 Rename auto step (#299) 2022-03-03 15:25:52 +02:00
github-actions[bot] a9fa4ce1a5 [CI Skip] release/beta 4.5.2-49
skip-checks: true
2022-03-03 09:32:31 +00:00
Jaco 18e2ab6389 Remove checkout from auto-{approve, merge} actions (#298) 2022-03-03 11:27:28 +02:00
github-actions[bot] 917b654c63 [CI Skip] release/beta 4.5.2-48
skip-checks: true
2022-03-02 05:19:27 +00:00
Jaco c7a202525c Replace mergify with action (#297) 2022-03-02 05:14:25 +00:00
github-actions[bot] 4c80c9bd0f [CI Skip] release/beta 4.5.2-47
skip-checks: true
2022-03-01 10:23:23 +00:00
Jaco 480d8e2dc8 Bump TS (#296) 2022-03-01 10:18:28 +00:00
github-actions[bot] 73a4c5d37f [CI Skip] release/beta 4.5.2-46
skip-checks: true
2022-02-27 17:47:34 +00:00
Jaco b003749832 Approve action adjust (#295)
* Approve action adjust

* Only labelled
2022-02-27 17:41:20 +00:00
github-actions[bot] 0ef6797ce9 [CI Skip] release/beta 4.5.2-45
skip-checks: true
2022-02-23 10:40:29 +00:00
Jaco 0013bbc14d Skip job on non-local repo 2022-02-23 12:33:31 +02:00
github-actions[bot] 93c4f62b3d [CI Skip] release/beta 4.5.2-44
skip-checks: true
2022-02-23 10:07:10 +00:00
Jaco 0008428ae0 Use jacogr/action-approve (#292) 2022-02-23 12:00:24 +02:00
github-actions[bot] 49818a5aef [CI Skip] release/beta 4.5.2-43
skip-checks: true
2022-02-21 10:33:38 +00:00
Jaco 9acb068f26 Bump dev (#291) 2022-02-21 10:27:24 +00:00
github-actions[bot] 2e35918650 [CI Skip] release/beta 4.5.2-42
skip-checks: true
2022-02-15 18:25:23 +00:00
Jaco c6877b7207 Bump deps (#290) 2022-02-15 18:18:17 +00:00
github-actions[bot] af598af917 [CI Skip] release/beta 4.5.2-41
skip-checks: true
2022-02-15 07:51:47 +00:00
Jaco fd98695a1c Add mergify (#289) 2022-02-15 09:45:41 +02:00
github-actions[bot] 737c373706 [CI Skip] release/beta 4.5.2-40
skip-checks: true
2022-02-14 05:49:16 +00:00
Jaco 2fe9d88068 Bump common (#288) 2022-02-14 07:43:21 +02:00
github-actions[bot] 81f6e8b214 [CI Skip] release/beta 4.5.2-39
skip-checks: true
2022-02-13 08:36:51 +00:00
Jaco b484c66f9c Disable yarn scripts on CI (#287) 2022-02-13 10:31:21 +02:00
github-actions[bot] a30354dd22 [CI Skip] release/beta 4.5.2-38
skip-checks: true
2022-02-10 04:57:15 +00:00
Jaco 98ba005cbc Bump dev deps (#286) 2022-02-10 06:51:45 +02:00
github-actions[bot] 5ef4c0c3e3 [CI Skip] release/beta 4.5.2-37
skip-checks: true
2022-02-07 09:20:18 +00:00
Jaco 748cf146c2 Bump deps (#285) 2022-02-07 11:14:33 +02:00
github-actions[bot] 9d86641a09 [CI Skip] release/beta 4.5.2-36
skip-checks: true
2022-02-04 07:43:15 +00:00
Jaco 4940a58942 Bump dev & util (#284) 2022-02-04 09:37:50 +02:00
github-actions[bot] 56560d767b [CI Skip] release/beta 4.5.2-35
skip-checks: true
2022-01-22 12:03:33 +00:00
Jaco c024262479 Bump deps (#283) 2022-01-22 13:58:03 +02:00
github-actions[bot] 91616be8c1 [CI Skip] release/beta 4.5.2-34
skip-checks: true
2022-01-17 07:49:35 +00:00
Jaco 14bf2209c1 Remove unused *.json type definition (#282) 2022-01-17 09:43:01 +02:00
github-actions[bot] 26352dfb2c [CI Skip] release/beta 4.5.2-33
skip-checks: true
2022-01-17 06:30:44 +00:00
Jaco 56a5bc7f4e Bump common (util deps) (#281) 2022-01-17 08:24:40 +02:00
github-actions[bot] c5cca3da2d [CI Skip] release/beta 4.5.2-32
skip-checks: true
2022-01-14 10:24:27 +00:00
Jaco b8b72adc38 Manual format of tsconfig.build.json (#280) 2022-01-14 12:18:07 +02:00
github-actions[bot] e69571d469 [CI Skip] release/beta 4.5.2-31
skip-checks: true
2022-01-14 05:43:26 +00:00
Jaco 859bef5d24 Bump dependencies (#279) 2022-01-14 07:38:15 +02:00
github-actions[bot] 1b6ffdd728 [CI Skip] release/beta 4.5.2-30
skip-checks: true
2022-01-13 08:11:25 +00:00
Jaco cedfc3ddc2 Update .mailmap 2022-01-13 10:05:36 +02:00
github-actions[bot] 317d837c26 [CI Skip] release/beta 4.5.2-29
skip-checks: true
2022-01-12 13:49:01 +00:00
Jaco 10e42c4a5f Adjust .mailmap (#278) 2022-01-12 15:42:18 +02:00
github-actions[bot] ccd71cc6fe [CI Skip] release/beta 4.5.2-28
skip-checks: true
2022-01-12 08:22:57 +00:00
Jaco 4981ca3f50 Adjust with tsconfig.build.json inside packages (#277) 2022-01-12 10:17:26 +02:00
github-actions[bot] 20f9969b90 [CI Skip] release/beta 4.5.2-27
skip-checks: true
2022-01-11 10:26:22 +00:00
Jaco f34deb94be Bump dev (w/ babel updates) (#276)
* Bump dev (w/ babel updates)

* codeclimate.yml
2022-01-11 12:20:57 +02:00
github-actions[bot] b98d787dd9 [CI Skip] release/beta 4.5.2-26
skip-checks: true
2022-01-11 06:49:58 +00:00
Jaco fa8ab999d3 Add tsconfig.build.json (#275) 2022-01-11 08:43:55 +02:00
github-actions[bot] b9e7d5a2c1 [CI Skip] release/beta 4.5.2-25
skip-checks: true
2022-01-09 07:13:25 +00:00
Jaco 6b8634462d Bump dev & common (#273)
* Bump dev & common

* Adjust alias
2022-01-09 09:07:40 +02:00
github-actions[bot] f3706b4975 [CI Skip] release/beta 4.5.2-24
skip-checks: true
2022-01-05 09:29:15 +00:00
Jaco 66c70aba9a Adjust for new packageInfo (#272) 2022-01-05 11:23:46 +02:00
github-actions[bot] 2ee13d5063 [CI Skip] release/beta 4.5.2-23
skip-checks: true
2022-01-05 06:46:05 +00:00
Jaco b81eb9037d Bump dev (#270) 2022-01-05 08:40:00 +02:00
github-actions[bot] 2a261ab180 [CI Skip] release/beta 4.5.2-22
skip-checks: true
2022-01-04 17:13:37 +00:00
Jaco b3facfeafe Add git .mailmap (#269) 2022-01-04 19:07:16 +02:00
github-actions[bot] edbd81d6a6 [CI Skip] release/beta 4.5.2-21
skip-checks: true
2022-01-04 10:24:20 +00:00
Jaco c22c861534 fetch-depth 0 (#268) 2022-01-04 12:18:55 +02:00
github-actions[bot] b256423ee7 [CI Skip] release/beta 4.5.2-20
skip-checks: true
2022-01-04 09:58:45 +00:00
Jaco cda39039ea Bump dev (w/ CONTRIBUTORS & umd) (#267) 2022-01-04 11:52:12 +02:00
github-actions[bot] 64242926e2 [CI Skip] release/beta 4.5.2-19
skip-checks: true
2022-01-02 05:58:56 +00:00
Jaco a6357d8b23 Bump deps (#266) 2022-01-02 07:52:08 +02:00
github-actions[bot] 84387bc56d [CI Skip] release/beta 4.5.2-18
skip-checks: true
2022-01-01 16:39:41 +00:00
Jaco 3d1dee1164 2022 (#265)
* 2022

* Update scripts/rust-version.sh
2022-01-01 18:33:38 +02:00
github-actions[bot] b9c627d4c3 [CI Skip] release/beta 4.5.2-17
skip-checks: true
2022-01-01 08:10:22 +00:00
Jaco c588a37cc3 Bump dev (#264) 2022-01-01 10:03:47 +02:00
github-actions[bot] 372bfccb68 [CI Skip] release/beta 4.5.2-16
skip-checks: true
2022-01-01 07:36:23 +00:00
Jaco be4f3ce82c 2022 (#263)
* 2022

* Update scripts/rust-version.sh
2022-01-01 09:30:22 +02:00
github-actions[bot] d7ced7c0e4 [CI Skip] release/beta 4.5.2-15
skip-checks: true
2021-12-31 15:29:22 +00:00
Jaco 3454f0685c Introduce detectOther (#262) 2021-12-31 17:23:05 +02:00
github-actions[bot] 3810eff007 [CI Skip] release/beta 4.5.2-14
skip-checks: true
2021-12-31 09:49:19 +00:00
Jaco a03283fe32 Mock for __dirname (#261)
* Mock for __dirname

* undefined

* CHANGELOG
2021-12-31 11:43:30 +02:00
github-actions[bot] 96d016f0a4 [CI Skip] release/beta 4.5.2-13
skip-checks: true
2021-12-31 08:01:02 +00:00
Jaco 622e60990a Bump babel (#260) 2021-12-31 09:54:41 +02:00
github-actions[bot] 112fbaa97d [CI Skip] release/beta 4.5.2-12
skip-checks: true
2021-12-29 17:25:48 +00:00
Jaco 516cf8347c Additional ed25519 cleanups (#259)
* Adjust ed25519 internals (speed & size)

* Additional ed25519 cleanups
2021-12-29 19:19:41 +02:00
github-actions[bot] 9f0fff863f [CI Skip] release/beta 4.5.2-11
skip-checks: true
2021-12-29 16:15:16 +00:00
Jaco 44c77e5bf3 Adjust ed25519 internals (speed & size) (#258) 2021-12-29 18:08:56 +02:00
github-actions[bot] 1fa4de4276 [CI Skip] release/beta 4.5.2-10
skip-checks: true
2021-12-29 15:29:09 +00:00
Jaco 9f6aa8dd33 Wrapped verification test (#257)
* Wrapped verification test

* tabs
2021-12-29 17:22:34 +02:00
github-actions[bot] f5563c9ed3 [CI Skip] release/beta 4.5.2-9
skip-checks: true
2021-12-25 10:17:50 +00:00
Jaco 32245f5b61 Bump berry (#255) 2021-12-25 12:12:23 +02:00
github-actions[bot] edcd6ee44b [CI Skip] release/beta 4.5.2-8
skip-checks: true
2021-12-24 14:28:20 +00:00
Jaco 93fae330ae Bump deps (#254) 2021-12-24 16:22:00 +02:00
github-actions[bot] 2f13511810 [CI Skip] release/beta 4.5.2-7
skip-checks: true
2021-12-23 07:01:39 +00:00
Jaco 9d1b58917b Dev bump (w/ types key in export map) (#253) 2021-12-23 08:55:27 +02:00
github-actions[bot] 0eb06843f7 [CI Skip] release/beta 4.5.2-6
skip-checks: true
2021-12-22 06:39:49 +00:00
Jaco a977c8fc9f Bump deps (#252) 2021-12-22 08:33:43 +02:00
github-actions[bot] c33ccd1cf9 [CI Skip] release/beta 4.5.2-5
skip-checks: true
2021-12-20 09:55:54 +00:00
Jaco 55c3107e91 Bump dev (w/ output linting adjustments) (#251) 2021-12-20 11:48:59 +02:00
github-actions[bot] 387334854e [CI Skip] release/beta 4.5.2-4
skip-checks: true
2021-12-19 07:26:05 +00:00
Jaco 19a852bee3 Bump common deps (#250) 2021-12-19 09:19:52 +02:00
github-actions[bot] 4c06f8c69b [CI Skip] release/beta 4.5.2-3
skip-checks: true
2021-12-14 06:01:00 +00:00
Jaco 39deef5b8b tsconfig project references (#249)
* Use tsconfig references

* Working :)

* Ignore bytes outputs

* spacing

* Adjust

* tsconfig.eslint.json

* Upgrade

* Include scripts in linting
2021-12-14 07:54:31 +02:00
github-actions[bot] bc605481d2 [CI Skip] release/beta 4.5.2-2
skip-checks: true
2021-12-13 06:19:07 +00:00
Jaco 60dc2ce9c5 Add tsconfig.base (#248) 2021-12-13 08:13:04 +02:00
github-actions[bot] 7ba258f750 [CI Skip] release/beta 4.5.2-1
skip-checks: true
2021-12-12 09:32:17 +00:00
Jaco 4ec72cac9e Bump tsc (#247) 2021-12-12 11:26:31 +02:00
github-actions[bot] cd4ec3ece5 [CI Skip] release/beta 4.5.2-0
skip-checks: true
2021-12-09 11:12:31 +00:00
Jaco 30385b85e4 Align codeclimate.yml (#246) 2021-12-09 13:06:16 +02:00
github-actions[bot] 27bef46818 [CI Skip] release/stable 4.5.1
skip-checks: true
2021-12-03 11:48:36 +00:00
Jaco 2b4ed56dcb 4.5.1 (#245)
* 4.5.1

* Bump deps
2021-12-03 13:43:15 +02:00
github-actions[bot] e167eba7d8 [CI Skip] release/beta 4.4.2-9
skip-checks: true
2021-12-03 09:54:40 +00:00
Jaco 272050938f Local variable cleanups (#244)
* Local variable cleanups

* Fixup

* Revert res moves
2021-12-03 11:49:41 +02:00
github-actions[bot] 3ee381512b [CI Skip] release/beta 4.4.2-8
skip-checks: true
2021-12-03 07:11:06 +00:00
Jaco a2d5affb88 Adjust formatting (#243)
* Adjust formatting

* Remove all unwrap

* Err(_) => _
2021-12-03 09:05:43 +02:00
github-actions[bot] 2b759aab12 [CI Skip] release/beta 4.4.2-7
skip-checks: true
2021-12-03 04:54:44 +00:00
Jaco 223d7bf514 publicKey from slice in secp256k1 compress/expand (#242) 2021-12-03 06:48:02 +02:00
github-actions[bot] fa2eb4e214 [CI Skip] release/beta 4.4.2-6
skip-checks: true
2021-12-02 12:24:51 +00:00
Jaco 7689afb616 Add secp256k1 interfaces (#241)
* Add secp256k1 functions

* features for rand

* JS tests

* signing

* CHANGELOG

* Add secp256k1 seed
2021-12-02 14:19:33 +02:00
github-actions[bot] 10002e9ec5 [CI Skip] release/beta 4.4.2-5
skip-checks: true
2021-12-01 08:12:11 +00:00
Jaco b2a0af0df4 Adjust stale cron (#240) 2021-12-01 10:07:03 +02:00
github-actions[bot] 4966fd2837 [CI Skip] release/beta 4.4.2-4
skip-checks: true
2021-11-30 11:24:34 +00:00
Jaco 421d36d159 Simplify base64 bytes decoding (#239) 2021-11-30 13:19:24 +02:00
github-actions[bot] 74270adba7 [CI Skip] release/beta 4.4.2-3
skip-checks: true
2021-11-30 09:23:58 +00:00
Jaco 2b97759fa7 WASM function JS interface construction (#238) 2021-11-30 11:17:08 +02:00
github-actions[bot] b8b9784763 [CI Skip] release/beta 4.4.2-2
skip-checks: true
2021-11-28 07:17:05 +00:00
Jaco 8439d5c668 Bump common (#237) 2021-11-28 09:12:15 +02:00
Github Actions cb3a0f667a [CI Skip] release/beta 4.4.2-1
skip-checks: true
2021-11-24 14:57:49 +00:00
Jaco adf21a5fc2 Adjust stale schedule (#236) 2021-11-24 16:52:47 +02:00
Github Actions 4c28fadc07 [CI Skip] release/beta 4.4.2-0
skip-checks: true
2021-11-22 06:27:27 +00:00
Jaco 2849a05507 Bump dev & common (#235) 2021-11-22 08:22:24 +02:00
Github Actions 801ed235cf [CI Skip] release/stable 4.4.1
skip-checks: true
2021-11-22 05:03:50 +00:00
Jaco 98433c7399 4.4.1 (#234) 2021-11-22 06:58:30 +02:00
Github Actions b537dcf3f4 [CI Skip] release/beta 4.3.2-0
skip-checks: true
2021-11-21 05:54:49 +00:00
Jaco eaf8ecf2c1 Add hmacSha{256, 512} functions (#233)
* Add hmacSha{256, 512} functions

* type

* Adjust

* Apply suggestions from code review

* Update packages/wasm-crypto/src/rs/hashing.rs

* Update packages/wasm-crypto/src/rs/hashing.rs

* Update packages/wasm-crypto/src/rs/hashing.rs

* Fix Rust side

* naming for wasm interfaces

* Remove type

* Bump common
2021-11-21 07:49:53 +02:00
Github Actions 9f232459d9 [CI Skip] release/stable 4.3.1
skip-checks: true
2021-11-19 13:14:30 +00:00
Jaco b92661cfe0 4.3.1 (#232) 2021-11-19 15:08:46 +02:00
Github Actions 6ca4470752 [CI Skip] release/beta 4.2.2-17
skip-checks: true
2021-11-19 12:34:40 +00:00
Jaco 6cecb67edd keccak512 & sha256 (#231)
* keccak512 & sha256

* Update interface

* Correct test
2021-11-19 14:28:44 +02:00
Github Actions 91388ca10d [CI Skip] release/beta 4.2.2-16
skip-checks: true
2021-11-18 08:28:57 +00:00
Jaco 11e2acbdb5 Bump deps (#230) 2021-11-18 10:24:03 +02:00
Github Actions 4e3d1b631c [CI Skip] release/beta 4.2.2-15
skip-checks: true
2021-11-12 07:39:59 +00:00
Jaco 4f06de4844 Bump deps (#229) 2021-11-12 09:34:30 +02:00
Github Actions affb3c57e3 [CI Skip] release/beta 4.2.2-14
skip-checks: true
2021-11-07 10:44:51 +00:00
Jaco 39e762a419 Bump @polkadot deps (#227) 2021-11-07 12:38:53 +02:00
Github Actions fe966c8576 [CI Skip] release/beta 4.2.2-13
skip-checks: true
2021-11-06 11:42:08 +00:00
Jaco 12c90dfb53 Bump deps (#226) 2021-11-06 13:37:22 +02:00
Github Actions 03aabfd6d1 [CI Skip] release/beta 4.2.2-12
skip-checks: true
2021-11-03 12:50:00 +00:00
Jaco 49b3cf552b Bump dev (#225) 2021-11-03 14:45:06 +02:00
Github Actions 6300012c32 [CI Skip] release/beta 4.2.2-11
skip-checks: true
2021-10-26 07:25:50 +00:00
Jaco 9d0773c185 Bump dev (#224) 2021-10-26 10:20:33 +03:00
Github Actions 96bd2f466e [CI Skip] release/beta 4.2.2-10
skip-checks: true
2021-10-25 13:28:49 +00:00
Jaco c6151e1a7d Bump dev deps (#223) 2021-10-25 16:22:19 +03:00
Github Actions c0c6671bd0 [CI Skip] release/beta 4.2.2-9
skip-checks: true
2021-10-25 11:38:15 +00:00
Jaco 2b9d90ff49 Bump dev (#222) 2021-10-25 14:32:37 +03:00
Github Actions 2caa6fb41a [CI Skip] release/beta 4.2.2-8
skip-checks: true
2021-10-25 09:13:13 +00:00
Jaco df00473ae2 Adjust package.json consistency (#221)
* Adjust package.json consistency

* Bump deps
2021-10-25 12:08:38 +03:00
Github Actions 2acce9283f [CI Skip] release/beta 4.2.2-7
skip-checks: true
2021-10-25 08:52:12 +00:00
Zhongpeng Zhouandmsftenanceprovenance 7971624cf9 Update package.json to include the repository (#220)
* Update package.json to include the repository

Hi there!
This change adds the repository property to your package.json file(s). Having this available provides a number of benefits to security tooling. For example, it allows for greater trust by checking for signed commits, contributors to a release and validating history with the project. It also allows for comparison between the source code and the published artifact in order to detect attacks on authors during the publication process.
We validate that we're making a PR against the correct repository by comparing the metadata for the published artifact on [npmjs.com](www.npmjs.com) against the metadata in the package.json file in the repository.
This change is provided by a team at Microsoft -- we're happy to answer any questions you may have. (Members of this team include [@s-tuli](https://github.com/s-tuli), [@iarna](https://github.com/iarna), [@v-rr](https://github.com/v-rr), [@v-jiepeng](https://github.com/v-jiepeng), [@v-zhzhou](https://github.com/v-zhzhou) and [@v-gjy](https://github.com/v-gjy)). If you would prefer that we not make these sorts of PRs to projects you maintain, please just say. If you'd like to learn more about what we're doing here, we've prepared a document talking about both this project and some of our other activities around supply chain security here: [microsoft/Secure-Supply-Chain](https://github.com/microsoft/Secure-Supply-Chain)
This PR provides repository metadata for the following packages:
* @polkadot/wasm-crypto
* @polkadot/wasm-crypto-asmjs
* @polkadot/wasm-crypto-wasm

* update

* update

Co-authored-by: msftenanceprovenance <msftenanceprovenance@microsoft.com>
2021-10-25 11:45:36 +03:00
Github Actions e353fe7f2c [CI Skip] release/beta 4.2.2-6
skip-checks: true
2021-10-17 09:37:46 +00:00
Jaco e797e7a7e4 Bump dev (#219)
* Bump dev

* Bump
2021-10-17 12:32:50 +03:00
Github Actions cb91f766c7 [CI Skip] release/beta 4.2.2-5
skip-checks: true
2021-10-16 06:46:50 +00:00
Jaco c983de54f6 Bump deps (#218) 2021-10-16 09:40:31 +03:00
Github Actions 9d9b983694 [CI Skip] release/beta 4.2.2-4
skip-checks: true
2021-09-27 05:45:44 +00:00
Jaco 6db930d03d Bump deps (#217) 2021-09-27 07:39:52 +02:00
Github Actions 0233a868ab [CI Skip] release/beta 4.2.2-3
skip-checks: true
2021-09-20 08:39:48 +00:00
Jaco ed98d4820e Bump util (#216) 2021-09-20 10:33:18 +02:00
Github Actions 971d40ba18 [CI Skip] release/beta 4.2.2-2
skip-checks: true
2021-09-14 11:29:28 +00:00
Jaco f3e1e30838 Bump deps (#215) 2021-09-14 13:24:17 +02:00
Github Actions bff8604c8a [CI Skip] release/beta 4.2.2-1
skip-checks: true
2021-09-05 08:28:45 +00:00
Jaco 6cf4fc0989 Bump deps (#214) 2021-09-05 10:22:39 +02:00
Github Actions 308374c7da [CI Skip] release/beta 4.2.2-0
skip-checks: true
2021-09-01 16:49:58 +00:00
Jaco 06bb7ae090 Jest config cleanup (#213)
* Jest config cleanup

* Bump
2021-09-01 18:43:16 +02:00
Github Actions b236d50c3c [CI Skip] release/stable 4.2.1
skip-checks: true
2021-08-28 05:30:23 +00:00
Jaco e2ac301993 4.2.1 (#212) 2021-08-28 07:24:12 +02:00
Github Actions d6bdcaccd7 [CI Skip] release/beta 4.1.3-7
skip-checks: true
2021-08-26 07:36:51 +00:00
Jaco Greeff a7f0e68443 Bump deps 2021-08-26 10:31:04 +03:00
Github Actions dc24ab5804 [CI Skip] release/beta 4.1.3-6
skip-checks: true
2021-08-25 10:01:34 +00:00
Jaco d5512418d2 Use stable as nightly compiler (#192)
* Use stable as nightly compiler

* detect stable

* Apply suggestions from code review

* CHANGELOG

* De-dupe Rust version

* Adjust script location

* Script cleanups

* trigger

* Script location
2021-08-25 11:55:17 +02:00
Github Actions 7a8e570dfa [CI Skip] release/beta 4.1.3-5
skip-checks: true
2021-08-25 08:58:11 +00:00
Jaco 3794a30b4b Adjust JS tests (#211) 2021-08-25 10:53:04 +02:00
Github Actions 700acfe764 [CI Skip] release/beta 4.1.3-4
skip-checks: true
2021-08-24 11:07:21 +00:00
Shunfan ZhouandJaco 9b8d6e0b64 Support sr25519 agreement (#209)
* Support sr25519 ecdh agreement

* Align version of curve25519-dalek

Co-authored-by: Jaco <jacogr@gmail.com>

* Reduce code size

Co-authored-by: Jaco <jacogr@gmail.com>

* Add explicit tests on sr25519 key agreement

* Fix linting issues

* Fix sr25519 key_agreement test

Co-authored-by: Jaco <jacogr@gmail.com>
2021-08-24 13:00:54 +02:00
Github Actions 3575f57a2a [CI Skip] release/beta 4.1.3-3
skip-checks: true
2021-08-24 07:05:13 +00:00
Jaco 8838651405 Bump deps (#210) 2021-08-24 08:59:29 +02:00
Github Actions 6cb8f2254a [CI Skip] release/beta 4.1.3-2
skip-checks: true
2021-08-16 06:04:41 +00:00
Jaco 72c2a70a32 Bump deps (#208) 2021-08-16 07:58:49 +02:00
Github Actions 51b1d12aab [CI Skip] release/beta 4.1.3-1
skip-checks: true
2021-08-13 11:52:29 +00:00
Jaco Greeff 93159192bb berry 3.0.1 2021-08-13 14:46:26 +03:00
Github Actions d208694d05 [CI Skip] release/beta 4.1.3-0
skip-checks: true
2021-08-13 11:40:39 +00:00
Jaco e7cb8a4907 Bump deps (#207) 2021-08-13 13:35:19 +02:00
147 changed files with 7250 additions and 5041 deletions
+1
View File
@@ -0,0 +1 @@
6.2.2
+10 -3
View File
@@ -1,7 +1,14 @@
5
7
3.2.2
3.2.3
3.2.4
4.0.2
4.1.2
4.0.2
4.1.2
6.1.2
6.1.3
6.1.4
6.1.5
6.2.2
+15
View File
@@ -1,5 +1,20 @@
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"
+5 -12
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const base = require('@polkadot/dev/config/eslint.cjs');
@@ -6,21 +6,14 @@ const base = require('@polkadot/dev/config/eslint.cjs');
module.exports = {
...base,
ignorePatterns: [
'.eslintrc.js',
'.github/**',
'.vscode/**',
'.yarn/**',
'**/binaryen/*',
'**/build/*',
'**/coverage/*',
'**/node_modules/*',
'**/pkg/*',
'**/target/*'
...base.ignorePatterns,
'**/target/*',
'**/build-wasm/*'
],
parserOptions: {
...base.parserOptions,
project: [
'./tsconfig.json'
'./tsconfig.eslint.json'
]
}
};
+50
View File
@@ -0,0 +1,50 @@
<!--
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.
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 -->
- [ ] Bug report
- [ ] Feature request
- [ ] Support request (please bear the comments above in mind)
- [ ] 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 -->
* **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 -->
* **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 -->
- Version:
- Environment:
- [ ] Node.js
- [ ] Browser
- [ ] Other (limited support for other environments available)
- Language:
- [ ] JavaScript
- [ ] TypeScript
- [ ] Other
+16
View File
@@ -0,0 +1,16 @@
name: bot
on:
pull_request:
types: [labeled]
jobs:
approve:
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
with:
authors: jacogr
labels: -auto
token: ${{ secrets.GH_PAT_BOT }}
+16
View File
@@ -0,0 +1,16 @@
name: bot
on:
pull_request:
types: [labeled]
jobs:
merge:
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-merge@master
with:
checks: build,lint,test
labels: -auto
strategy: squash
token: ${{ secrets.GH_PAT_BOT }}
+3 -1
View File
@@ -2,11 +2,13 @@ name: 'Lock Threads'
on:
schedule:
- cron: '30 1/2 * * *'
- cron: '20 1/3 * * *'
jobs:
lock:
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: dessant/lock-threads@v2
with:
+2
View File
@@ -8,6 +8,8 @@ jobs:
step: ['lint', 'test', 'build']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/checkout@v2
- name: ${{ matrix.step }}
+7 -5
View File
@@ -12,16 +12,18 @@ jobs:
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 }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: build
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn install --immutable | grep -v 'YN0013'
./scripts/install-build-deps.sh
+2
View File
@@ -9,6 +9,8 @@ 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
+3 -1
View File
@@ -1,11 +1,13 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 2/2 * * *'
- cron: '35 1/3 * * *'
jobs:
stale:
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/stale@v3
with:
+5
View File
@@ -1,7 +1,11 @@
binaryen/
bindgen/
build/
build-cjs/
build-esm/
build-deno/
build-docs/
build-wasm/
bytes/
coverage/
docs/.vuepress/dist/
@@ -26,5 +30,6 @@ lerna-debug.log*
npm-debug.log*
package-lock.json
report.*.json
tsconfig.*buildinfo
yarn-debug.log*
yarn-error.log*
+3
View File
@@ -0,0 +1,3 @@
Jaco <jacogr@gmail.com>
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> <action@github.com>
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Github Actions <action@github.com>
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2021 @polkadot/dev authors & contributors
// Copyright 2017-2022 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/prettier.cjs');
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+785
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs
yarnPath: .yarn/releases/yarn-3.2.0.cjs
+137
View File
@@ -1,5 +1,142 @@
# CHANGELOG
## 6.2.2 Jul 4, 2022
Changes:
- Protect against potential low-level double-sign leak in dalek-ed25519 (Don't use provided input pubKey, see https://github.com/MystenLabs/ed25519-unsafe-libs)
## 6.2.1 Jul 1, 2022
Changes:
- Add missing `peerDependencies` to `wasm-crypto` (`bridge` requirement)
- Adjust `WebAssembly.{Memory, ModuleImports}` usage to cater for non-dom TS
## 6.1.5 Jun 23, 2022
Changes:
- Adjust build outputs for Deno targets
## 6.1.4 Jun 22, 2022
Changes:
- Adjust build outputs for Deno targets
## 6.1.3 Jun 21, 2022
Changes:
- Fix bundle publish (from dev bump)
## 6.1.2 Jun 21, 2022
Changes:
- Adjust assert usage in all internal non-test code
- Additional comments where missing
## 6.1.1 May 13, 2022
Changes:
- Adjust init, allow RN with default ASM.js-only fallback
- Split `wasm-{bridge, util}` packages for internal re-use
## 6.0.1 Apr 9, 2022
- **Breaking change** In this major version the commonjs outputs are moved to a sub-folder. Since the `export` map and `main` field in `package.json` does reflect this change, there should be no usage changes. However the packages here will all need to be on the same version for internal linkage.
Changes:
- Update ed25519 secret key format return description
- Output commonjs files under the `cjs/**` root
## 5.1.1 Mar 27, 2022
Changes:
- Swap from `libsecp256k1` to `secp256k1` (this aligns with the Substrate use)
- Adjust `wasm-crypto/init*` to also export `initWasm(): Promise<void>` (optional manual init)
- Allow for `wasm-crypto/initNone` with no defined Wasm or Asm interfaces
- Fix initialization on React Native with only ASM
## 5.0.1 Mar 19, 2022
- **Breaking change** For users of React Native, you are now required to add `import '@polkadot/wasm-crypto/initOnlyAsm'` at your project top-level to ensure that asm.js is initialized. (Or alternatively `import '@polkadot/wasm-crypto/initWasmAsm'` to future-proof when WASM does become available)
- **Breaking change** For users who used to map the `data` and `empty` of the internal `wasm-crypto-{wasm, asmjs}` packages in their bundlers, swap to one of the `@polkadot/wasm-crypto/init*` top-level imports to set the type of interfaces you would prefer. A full writeup of the rationale and other options can be found [in the FAQ](https://polkadot.js.org/docs/util-crypto/FAQ#i-dont-have-wasm-available-in-my-environment)
Changes:
- Add (optional) `@polkadot/wasm-crypto/init{OnlyAsm, OnlyWasm, WasmAsm}` to allow specific interface types
- Add work-around for lazy secp256k1 init in asm.js environments
- Optimize asm.js output size
- Use latest `wasm-bindgen`, `binaryen` & `wabt` packages in build
- Additional workaround for Vite bundling
## 4.6.1 Mar 12, 2022
Changes:
- Adjust ed25519 internals, consistency in code
- Ensure package path is available under ESM & CJS
- JS wrapped bytes interoperability test
- Adjust for bundlers where `import.meta.url` is undefined
## 4.5.1 Dec 3, 2021
Changes:
- Add `secp256k1{Compress, Expand, Recover, Sign}` functions
- Remove all occurences of `.unwrap()` (match everywhere)
- Adjust and optimize WASM function JS interface construction
- Simplify base64 bytes decoding on construction
## 4.4.1 Nov 22, 2021
Changes:
- Add `hmacSha256` & `hmacSha512` functions
## 4.3.1 Nov 19, 2021
Contributed:
- Updated package.json to include repo (Thanks to https://github.com/v-zhzhou)
Changes:
- Add `keccak512` function
- Add `sha256` function
## 4.2.1 Aug 28, 2021
Contributed:
- Add sr25519 agreement external (Thanks to https://github.com/shelvenzhou)
Changes:
- Adjust tests to align with JS coding standards
- Allow for optional build with Rust stable bootstrap
## 4.1.2 Jul 9, 2021
Changes:
+5
View File
@@ -0,0 +1,5 @@
450 Jaco 6.2.2 (#384)
1 Evgeny Fixed type (#121)
1 Shunfan Zhou Support sr25519 agreement (#209)
1 Steve Degosserie Expose Schnorrkel's VRF capabilities (#170)
1 Zhongpeng Zhou Update package.json to include the repository (#220)
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = require('@polkadot/dev/config/babel-config-cjs.cjs');
+7 -13
View File
@@ -1,19 +1,13 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const config = require('@polkadot/dev/config/jest.cjs');
module.exports = Object.assign({}, config, {
module.exports = {
...config,
moduleNameMapper: {
'@polkadot/wasm-crypto-asmjs(.*)$': '<rootDir>/packages/wasm-crypto-asmjs/build/$1',
'@polkadot/wasm-crypto-wasm(.*)$': '<rootDir>/packages/wasm-crypto-wasm/build/$1',
'@polkadot/wasm-crypto-(init|asmjs|wasm)(.*)$': '<rootDir>/packages/wasm-crypto-$1/build/$2',
// eslint-disable-next-line sort-keys
'@polkadot/wasm-crypto(.*)$': '<rootDir>/packages/wasm-crypto/src/$1'
},
modulePathIgnorePatterns: [
'<rootDir>/packages/wasm-crypto-asmjs/build',
'<rootDir>/packages/wasm-crypto-wasm/build',
'<rootDir>/packages/wasm-crypto/build'
],
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
});
'@polkadot/wasm-(bridge|crypto|util)(.*)$': '<rootDir>/packages/wasm-$1/build/$2'
}
};
+24 -15
View File
@@ -1,33 +1,42 @@
{
"repository": "https://github.com/polkadot-js/wasm",
"author": "Jaco Greeff <jacogr@gmail.com>",
"license": "Apache-2",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"homepage": "https://github.com/polkadot-js/wasm#readme",
"license": "Apache-2.0",
"packageManager": "yarn@3.2.0",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/polkadot-js/wasm.git"
},
"sideEffects": false,
"version": "6.2.2",
"workspaces": [
"packages/*"
],
"resolutions": {
"typescript": "^4.3.5"
},
"scripts": {
"build": "yarn build:wasm",
"build:js": "./scripts/build-js.sh",
"build:mac": "PATH=\"/opt/homebrew/opt/llvm/bin:$PATH\" CC=/opt/homebrew/opt/llvm/bin/clang AR=/opt/homebrew/opt/llvm/bin/llvm-ar yarn build",
"build:release": "polkadot-ci-ghact-build",
"build:rollup": "polkadot-exec-rollup --config",
"build:wasm": "./scripts/build.sh",
"lint": "polkadot-dev-run-lint",
"clean": "./scripts/clean.sh",
"lint": "polkadot-dev-run-lint",
"postinstall": "polkadot-dev-yarn-only",
"test": "yarn test:wasm:rust",
"test:wasm:js": "yarn test:wasm:js:jest && yarn test:wasm:js:node",
"test:wasm:js:jest": "polkadot-dev-run-test ./test/jest.spec.js",
"test:wasm:js:node": "cd packages/wasm-crypto && node ./test/wasm.cjs && node ./test/asm.cjs",
"test:wasm:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --nocapture"
"test": "yarn test:wasm-crypto:rust",
"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:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --test-threads=1 --nocapture"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@polkadot/dev": "^0.62.55",
"fflate": "^0.7.1",
"@babel/core": "^7.18.6",
"@polkadot/dev": "^0.67.50",
"fflate": "^0.7.3",
"override-require": "^1.1.1"
},
"version": "4.1.2"
"resolutions": {
"typescript": "^4.7.4"
}
}
+201
View File
@@ -0,0 +1,201 @@
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.
+3
View File
@@ -0,0 +1,3 @@
# @polkadot/wasm-bridge
A re-usable bridge between JS & WASM interfaces. It is used internally by `@polkadot/wasm-crypto`.
+36
View File
@@ -0,0 +1,36 @@
{
"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"
},
"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",
"type": "git",
"url": "https://github.com/polkadot-js/wasm.git"
},
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"type": "module",
"version": "6.2.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
"@polkadot/util": "^9.7.1",
"@polkadot/x-randomvalues": "^9.7.1"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/x-randomvalues": "*"
}
}
+213
View File
@@ -0,0 +1,213 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// A number of functions are "unsafe" and purposefully so - it is
// assumed that where the bridge is used, it is correctly wrapped
// in a safeguard (see withWasm in the wasm-crypto package) which
// 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 { stringToU8a, u8aToString } from '@polkadot/util';
import { Wbg } from './wbg';
/**
* @name Bridge
* @description
* Creates a bridge between the JS and WASM environments.
*
* For any bridge it is passed an function white is then called internally at the
* time of initialization. This affectively implements the layer between WASM and
* the native environment, providing all the plumbing needed for the Wbg classes.
*/
export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
#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>) {
this.#createWasm = createWasm;
this.#cachegetInt32 = null;
this.#cachegetUint8 = null;
this.#heap = new Array(32)
.fill(undefined)
.concat(undefined, null, true, false);
this.#heapNext = this.#heap.length;
this.#type = 'none';
this.#wasm = null;
this.#wasmError = null;
this.#wasmPromise = null;
this.#wbg = { ...new Wbg(this) };
}
/** @description Returns the init error */
get error (): string | null {
return this.#wasmError;
}
/** @description Returns the init type */
get type (): 'asm' | 'wasm' | 'none' {
return this.#type;
}
/** @description Returns the created wasm interface */
get wasm (): C | null {
return this.#wasm;
}
/** @description Performs the wasm initialization */
async init (createWasm?: InitFn<C>): Promise<C | null> {
if (!this.#wasmPromise || createWasm) {
this.#wasmPromise = (createWasm || this.#createWasm)(this.#wbg);
}
const { error, type, wasm } = await this.#wasmPromise;
this.#type = type;
this.#wasm = wasm;
this.#wasmError = error;
return this.#wasm;
}
/**
* @internal
* @description Gets an object from the heap
*/
getObject (idx: number): unknown {
return this.#heap[idx];
}
/**
* @internal
* @description Removes an object from the heap
*/
dropObject (idx: number) {
if (idx < 36) {
return;
}
this.#heap[idx] = this.#heapNext;
this.#heapNext = idx;
}
/**
* @internal
* @description Retrieves and removes an object to the heap
*/
takeObject (idx: number): unknown {
const ret = this.getObject(idx);
this.dropObject(idx);
return ret;
}
/**
* @internal
* @description Adds an object to the heap
*/
addObject (obj: unknown): number {
if (this.#heapNext === this.#heap.length) {
this.#heap.push(this.#heap.length + 1);
}
const idx = this.#heapNext;
this.#heapNext = this.#heap[idx] as number;
this.#heap[idx] = obj;
return idx;
}
/**
* @internal
* @description Retrieve an Int32 in the WASM interface
*/
getInt32 (): Int32Array {
if (this.#cachegetInt32 === null || this.#cachegetInt32.buffer !== this.#wasm!.memory.buffer) {
this.#cachegetInt32 = new Int32Array(this.#wasm!.memory.buffer);
}
return this.#cachegetInt32;
}
/**
* @internal
* @description Retrieve an Uint8Array in the WASM interface
*/
getUint8 (): Uint8Array {
if (this.#cachegetUint8 === null || this.#cachegetUint8.buffer !== this.#wasm!.memory.buffer) {
this.#cachegetUint8 = new Uint8Array(this.#wasm!.memory.buffer);
}
return this.#cachegetUint8;
}
/**
* @internal
* @description Retrieves an Uint8Array in the WASM interface
*/
getU8a (ptr: number, len: number): Uint8Array {
return this.getUint8().subarray(ptr / 1, ptr / 1 + len);
}
/**
* @internal
* @description Retrieves a string in the WASM interface
*/
getString (ptr: number, len: number): string {
return u8aToString(this.getU8a(ptr, len));
}
/**
* @internal
* @description Allocates an Uint8Array in the WASM interface
*/
allocU8a (arg: Uint8Array): [number, number] {
const ptr = this.#wasm!.__wbindgen_malloc(arg.length * 1);
this.getUint8().set(arg, ptr / 1);
return [ptr, arg.length];
}
/**
* @internal
* @description Allocates a string in the WASM interface
*/
allocString (arg: string): [number, number] {
return this.allocU8a(stringToU8a(arg));
}
/**
* @internal
* @description Retrieves an Uint8Array from the WASM interface
*/
resultU8a (): Uint8Array {
const r0 = this.getInt32()[8 / 4 + 0];
const r1 = this.getInt32()[8 / 4 + 1];
const ret = this.getU8a(r0, r1).slice();
this.#wasm!.__wbindgen_free(r0, r1 * 1);
return ret;
}
/**
* @internal
* @description Retrieve a string from the WASM interface
*/
resultString (): string {
return u8aToString(this.resultU8a());
}
}
+5
View File
@@ -0,0 +1,5 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bridge';
export * from './init';
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
+11
View File
@@ -0,0 +1,11 @@
// Copyright 2017-2022 @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';
detectPackage(packageInfo, null, others);
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
export * from './bundle';
+47
View File
@@ -0,0 +1,47 @@
// Copyright 2019-2022 @polkadot/wasm-bundle authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } from './types';
/**
* @name createWasmFn
* @description
* Create a WASM (or ASM.js) creator interface based on the supplied information.
*
* It will attempt to create a WASM interface first and if this fails or is not available in
* the environment, will fallback to attempting to create an ASM.js interface.
*/
export function createWasmFn <C extends WasmBaseInstance> (root: string, wasmBytes: null | Uint8Array, asmFn: null | ((wbg: WasmImports) => C)): InitFn<C> {
return async (wbg: WasmImports): InitPromise<C> => {
const result: InitResult<C> = {
error: null,
type: 'none',
wasm: null
};
try {
if (!wasmBytes || !wasmBytes.length) {
throw new Error('No WebAssembly provided for initialization');
} else if (typeof WebAssembly !== 'object' || typeof WebAssembly.instantiate !== 'function') {
throw new Error('WebAssembly is not available in your environment');
}
const source = await WebAssembly.instantiate(wasmBytes, { wbg });
result.wasm = source.instance.exports as unknown as C;
result.type = 'wasm';
} catch (error) {
// if we have a valid supplied asm.js, return that
if (typeof asmFn === 'function') {
result.wasm = asmFn(wbg);
result.type = 'asm';
} else {
result.error = `FATAL: Unable to initialize @polkadot/wasm-${root}:: ${(error as Error).message}`;
console.error(result.error);
}
}
return result;
};
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2022 @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' };
+47
View File
@@ -0,0 +1,47 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Use non-strong types instead of WasmImports which may not
// be available as part of the TS environment types (it needs dom)
export type WasmImports = Record<string, (...args: never[]) => unknown>;
// Use non-strong types instead of WebAssembly.Memory which may not
// be available as part of the TS environment types (it needs dom)
export type WasmMemory = { buffer: ArrayBuffer };
export declare interface InitResult<C extends WasmBaseInstance> {
error: string | null;
type: 'asm' | 'wasm' | 'none';
wasm: C | null;
}
export type InitPromise <C extends WasmBaseInstance> = Promise<InitResult<C>>;
export type InitFn <C extends WasmBaseInstance> = (wbg: WasmImports) => InitPromise<C>;
export interface BridgeBase<C extends WasmBaseInstance> extends InitResult<C> {
init (createWasm?: InitFn<C>): Promise<C | null>;
getObject (idx: number): unknown;
dropObject (idx: number): void;
takeObject (idx: number): unknown;
addObject (obj: unknown): number;
getInt32 (): Int32Array;
getUint8 (): Uint8Array;
getU8a (ptr: number, len: number): Uint8Array;
getString (ptr: number, len: number): string;
allocU8a (arg: Uint8Array): [number, number];
allocString (arg: string): [number, number];
resultU8a (): Uint8Array;
resultString (): string;
}
export interface WasmBaseInstance {
memory: WasmMemory;
// wbindgen functions (required and used internally)
__wbindgen_exn_store (a: number): void;
__wbindgen_free (a: number, b: number): void;
__wbindgen_malloc (a: number): number;
__wbindgen_realloc (a: number, b: number, c: number): number;
}
+84
View File
@@ -0,0 +1,84 @@
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { BridgeBase, WasmBaseInstance } from './types';
import { getRandomValues } from '@polkadot/x-randomvalues';
const DEFAULT_CRYPTO = { getRandomValues };
const DEFAULT_SELF = { crypto: DEFAULT_CRYPTO };
/**
* @name Wbg
* @description
* This defines the internal interfaces that wasm-bindgen used to communicate
* with the host layer. None of these functions are available to the user, rather
* they are called internally from the WASM code itself.
*
* The interfaces here are exposed in the imports on the created WASM interfaces.
*
* Internally the implementation does a thin layer into the supplied bridge.
*/
export class Wbg<C extends WasmBaseInstance> {
#bridge: BridgeBase<C>;
constructor (bridge: BridgeBase<C>) {
this.#bridge = bridge;
}
/** @internal */
abort = (): never => {
throw new Error('abort');
};
/** @internal */
__wbindgen_is_undefined = (idx: number): boolean => {
return this.#bridge.getObject(idx) === undefined;
};
/** @internal */
__wbindgen_throw = (ptr: number, len: number): boolean => {
throw new Error(this.#bridge.getString(ptr, len));
};
/** @internal */
__wbg_self_1b7a39e3a92c949c = (): number => {
return this.#bridge.addObject(DEFAULT_SELF);
};
/** @internal */
__wbg_require_604837428532a733 = (ptr: number, len: number): never => {
throw new Error(`Unable to require ${this.#bridge.getString(ptr, len)}`);
};
/** @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');
// getObject(idx).randomFillSync(getU8a(ptr, len));
};
/** @internal */
__wbindgen_object_drop_ref = (idx: number): void => {
this.#bridge.takeObject(idx);
};
}
+10
View File
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
]
}
+3
View File
@@ -0,0 +1,3 @@
## @polkadot/wasm-crypto-asmjs
Asm.js build outputs.
+22 -13
View File
@@ -1,22 +1,31 @@
{
"name": "@polkadot/wasm-crypto-asmjs",
"version": "4.1.2",
"type": "module",
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Asm.js content for wasm-crypto",
"browser": "empty.js",
"main": "empty.js",
"react-native": "data.js",
"sideEffects": false,
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-asmjs#readme",
"license": "Apache-2.0",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"homepage": "https://github.com/polkadot-js/wasm",
"maintainers": [],
"name": "@polkadot/wasm-crypto-asmjs",
"repository": {
"directory": "packages/wasm-crypto-asmjs",
"type": "git",
"url": "https://github.com/polkadot-js/wasm.git"
},
"sideEffects": false,
"type": "module",
"version": "6.2.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.14.6"
"@babel/runtime": "^7.18.6"
},
"devDependencies": {
"@polkadot/util": "^9.7.1"
},
"peerDependencies": {
"@polkadot/util": "*"
}
}
+5
View File
@@ -0,0 +1,5 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { asmJsInit } from './cjs/data.js';
export { packageInfo } from './packageInfo';
@@ -0,0 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
const data = require('../data');
module.exports = data;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export declare const asmJsInit: null;
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
const asmJsInit = null;
exports.asmJsInit = asmJsInit;
module.exports.asmJsInit = asmJsInit;
-6
View File
@@ -1,6 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { asmJsInit as _asmJsInit } from './cjs/data.js';
export const asmJsInit = _asmJsInit;
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export declare const asmJsInit: null;
@@ -1,4 +1,4 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const asmJsInit = null;
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
@@ -0,0 +1,11 @@
// Copyright 2017-2022 @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';
detectPackage(packageInfo, null, others);
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
export * from './bundle';
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
@@ -1,6 +1,6 @@
// Copyright 2017-2021 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2017-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated by @polkadot/dev, do not edit
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', version: '4.1.2' };
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '6.2.2' };
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": []
}
+3
View File
@@ -0,0 +1,3 @@
## @polkadot/wasm-crypto-init
Internal `@polkadot/wasm-crypto` initialization functions for Browser, Node & RN.
+41
View File
@@ -0,0 +1,41 @@
{
"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"
},
"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",
"type": "git",
"url": "https://github.com/polkadot-js/wasm.git"
},
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"type": "module",
"version": "6.2.2",
"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"
},
"devDependencies": {
"@polkadot/util": "^9.7.1",
"@polkadot/x-randomvalues": "^9.7.1"
},
"peerDependencies": {
"@polkadot/util": "*",
"@polkadot/x-randomvalues": "*"
}
}
+17
View File
@@ -0,0 +1,17 @@
// Copyright 2019-2022 @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 { createWasmFn } from '@polkadot/wasm-bridge';
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
export { packageInfo } from './packageInfo';
/**
* @name createWasm
* @description
* Creates an interface using only ASM.js
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', null, asmJsInit);
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2019-2022 @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 { createWasmFn } from '@polkadot/wasm-bridge';
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
export { packageInfo } from './packageInfo';
/**
* @name createWasm
* @description
* Creates an interface using WASM and a fallback ASM.js
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', wasmBytes, asmJsInit);
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './wasm';
@@ -0,0 +1,8 @@
// Copyright 2017-2022 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
export default [bridgeInfo, asmInfo, wasmInfo];
@@ -0,0 +1,11 @@
// Copyright 2017-2022 @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';
detectPackage(packageInfo, null, others);
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './wasm';
+16
View File
@@ -0,0 +1,16 @@
// Copyright 2019-2022 @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 { createWasmFn } from '@polkadot/wasm-bridge';
export { packageInfo } from './packageInfo';
/**
* @name createWasm
* @description
* Creates an interface using no WASM and no ASM.js
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', null, null);
@@ -0,0 +1,6 @@
// Copyright 2017-2022 @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' };
+75
View File
@@ -0,0 +1,75 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { WasmBaseInstance } from '@polkadot/wasm-bridge/types';
/* eslint-disable camelcase */
// wasm-pack build output (formatted) from pkg/wasm_bg.d.ts
export interface WasmCryptoInstance extends WasmBaseInstance {
// exposed functions
ext_bip39_generate(resLen: 8, words: number): void;
ext_bip39_to_entropy(resLen: 8, ptrPhrase: number, lenPhrase: number): void;
ext_bip39_to_mini_secret(resLen: 8, ptrPhrase: number, lenPhrase: number, ptrPass: number, lenPass: number): void;
ext_bip39_to_seed(resLen: 8, ptrPhrase: number, lenPhrase: number, ptrPass: number, lenPass: number): void;
ext_bip39_validate(ptrPhrase: number, lenPhrase: number): number;
ext_ed_from_seed(resLen: 8, ptrSeed: number, lenSeed: number): void;
ext_ed_sign(resLen: 8, ptrPub: number, lenPub: number, ptrSec: number, lenSec: number, ptrMsg: number, lenMsg: number): void;
ext_ed_verify(ptrSig: number, lenSig: number, ptrMsg: number, lenMsg: number, ptrPub: number, lenPub: number): number;
ext_blake2b(resLen: 8, ptrData: number, lenData: number, ptrKey: number, lenKey: number, size: number): void;
ext_hmac_sha256(resLen: 8, ptrKey: number, lenKey: number, ptrData: number, lenData: number): void;
ext_hmac_sha512(resLen: 8, ptrKey: number, lenKey: number, ptrData: number, lenData: number): void;
ext_keccak256(resLen: 8, ptrData: number, lenData: number): void;
ext_keccak512(resLen: 8, ptrData: number, lenData: number): void;
ext_pbkdf2(resLen: 8, ptrData: number, lenData: number, ptrSalt: number, lenSalt: number, rounds: number): void;
ext_scrypt(resLen: 8, ptrPass: number, lenPass: number, ptrSalt: number, lenSalt: number, log2n: number, r: number, p: number): void;
ext_sha256(resLen: 8, ptrData: number, lenData: number): void;
ext_sha512(resLen: 8, ptrData: number, lenData: number): void;
ext_twox(resLen: 8, ptrData: number, lenData: number, rounds: number): void;
ext_secp_from_seed(reslen: 8, ptrSec: number, lenSec: number): void;
ext_secp_pub_compress(resLen: 8, ptrPub: number, lenPub: number): void;
ext_secp_pub_expand(resLen: 8, ptrPub: number, lenPub: number): void;
ext_secp_recover(resLen: 8, ptrMsgHash: number, lenMsgHash: number, ptrSig: number, lenSig: number, recovery: number): void;
ext_secp_sign(resLen: 8, ptrMsgHash: number, lenMsgHash: number, ptrSec: number, lenSec: number): void;
ext_sr_derive_keypair_hard(resLen: 8, ptrPair: number, lenPair: number, ptrCc: number, lenCc: number): void;
ext_sr_derive_keypair_soft(resLen: 8, ptrPub: number, lenPub: number, ptrCc: number, lenCc: number): void;
ext_sr_derive_public_soft(resLen: 8, ptrPub: number, lenPub: number, ptrCc: number, lenCc: number): void;
ext_sr_from_seed(resLen: 8, ptrSeed: number, lenSeed: number): void;
ext_sr_sign(resLen: 8, ptrPub: number, lenPub: number, ptrSec: number, lenSec: number, ptrMsg: number, lenMsg: number): void;
ext_sr_verify(ptrSig: number, lenSig: number, ptrMsg: number, lenMsg: number, ptrPub: number, lenPub: number): number;
ext_sr_agree(resLen: 8, ptrPub: number, lenPub: number, ptrSec: number, lenSec: number): void;
ext_vrf_sign(resLen: 8, ptrSec: number, lenSec: number, ptrCtx: number, lenCtx: number, ptrMsg: number, lenMsg: number, ptrExtra: number, lenExtra: number): void;
ext_vrf_verify(ptrPub: number, lenPub: number, ptrCtx: number, lenCtx: number, ptrMsg: number, lenMsg: number, ptrExtra: number, lenExtra: number, ptrProof: number, lenProof: number): number;
}
+17
View File
@@ -0,0 +1,17 @@
// Copyright 2019-2022 @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 { createWasmFn } from '@polkadot/wasm-bridge';
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
export { packageInfo } from './packageInfo';
/**
* @name createWasm
* @description
* Creates an interface using only WASM
*/
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', wasmBytes, null);
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
{ "path": "../wasm-bridge/tsconfig.build.json" },
{ "path": "../wasm-crypto-asmjs/tsconfig.build.json" },
{ "path": "../wasm-crypto-wasm/tsconfig.build.json" }
]
}
+3
View File
@@ -0,0 +1,3 @@
## @polkadot/wasm-crypto-wasm
Wasm build outputs.
+23 -13
View File
@@ -1,22 +1,32 @@
{
"name": "@polkadot/wasm-crypto-wasm",
"version": "4.1.2",
"type": "module",
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"contributors": [],
"description": "Wasm content for wasm-crypto",
"browser": "data.js",
"main": "data.js",
"react-native": "data.js",
"sideEffects": false,
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-wasm#readme",
"license": "Apache-2.0",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"homepage": "https://github.com/polkadot-js/wasm",
"maintainers": [],
"name": "@polkadot/wasm-crypto-wasm",
"repository": {
"directory": "packages/wasm-crypto-wasm",
"type": "git",
"url": "https://github.com/polkadot-js/wasm.git"
},
"sideEffects": false,
"type": "module",
"version": "6.2.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.14.6"
"@babel/runtime": "^7.18.6",
"@polkadot/wasm-util": "6.2.2"
},
"devDependencies": {
"@polkadot/util": "^9.7.1"
},
"peerDependencies": {
"@polkadot/util": "*"
}
}
-86
View File
@@ -1,86 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// MIT License
//
// Copyright (c) 2014 Jameson Little
//
// https://github.com/beatgammit/base64-js/blob/88957c9943c7e2a0f03cdf73e71d579e433627d3/index.js
// This only contains the toByteArray function (no encoding)
//
// Only tweaks make here are some TS adjustments (we use strict null checks), the code is otherwise as-is with
// only the single required function provided
const CODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const lookup: string[] = [];
const revLookup: number[] = [];
for (let i = 0; i < CODE.length; ++i) {
lookup[i] = CODE[i];
revLookup[CODE.charCodeAt(i)] = i;
}
// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;
function getLens (b64: string): [number, number] {
const len = b64.length;
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4');
}
// Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
const validLen = b64.indexOf('=');
return validLen === -1
? [len, 0]
: [validLen, 4 - (validLen % 4)];
}
export function toByteArray (b64: string): Uint8Array {
const [validLen, placeHoldersLen] = getLens(b64);
const arr = new Uint8Array(((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen);
let curByte = 0;
let i;
let tmp;
// if there are placeholders, only get up to the last complete 4 chars
const len = placeHoldersLen > 0
? validLen - 4
: validLen;
for (i = 0; i < len; i += 4) {
tmp =
(revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) |
(revLookup[b64.charCodeAt(i + 2)] << 6) |
revLookup[b64.charCodeAt(i + 3)];
arr[curByte++] = (tmp >> 16) & 0xFF;
arr[curByte++] = (tmp >> 8) & 0xFF;
arr[curByte++] = tmp & 0xFF;
}
if (placeHoldersLen === 2) {
tmp =
(revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4);
arr[curByte++] = tmp & 0xFF;
} else if (placeHoldersLen === 1) {
tmp =
(revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2);
arr[curByte++] = (tmp >> 8) & 0xFF;
arr[curByte++] = tmp & 0xFF;
}
return arr;
}
+19
View File
@@ -0,0 +1,19 @@
// Copyright 2019-2022 @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';
export { packageInfo } from './packageInfo';
/**
* @name wasmBytes
* @description
* 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
* specific format and returned.
*/
export const wasmBytes = unzlibSync(base64Decode(bytes), new Uint8Array(sizeUncompressed));
-10
View File
@@ -1,10 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { bytes as _bytes, sizeCompressed as _sizeCompressed, sizeUncompressed as _sizeUncompressed } from './cjs/bytes';
export const bytes = _bytes;
export const sizeCompressed = _sizeCompressed;
export const sizeUncompressed = _sizeUncompressed;
+6 -4
View File
@@ -1,6 +1,8 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export declare const bytes = '';
export declare const sizeCompressed = 0;
export declare const sizeUncompressed = 0;
export declare const bytes: string;
export declare const sizeCompressed: number;
export declare const sizeUncompressed: number;
+4 -4
View File
@@ -1,8 +1,8 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
exports.bytes = '';
module.exports.bytes = '';
exports.sizeCompressed = 0;
module.exports.sizeCompressed = 0;
exports.sizeUncompressed = 0;
module.exports.sizeUncompressed = 0;
@@ -0,0 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
const bytes = require('../bytes');
module.exports = bytes;
-8
View File
@@ -1,8 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { toByteArray } from './base64';
import { bytes, sizeUncompressed } from './bytes';
import { unzlibSync } from './fflate';
export const wasmBytes = unzlibSync(toByteArray(bytes), new Uint8Array(sizeUncompressed));
+8
View File
@@ -0,0 +1,8 @@
// Copyright 2019-2022 @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 sizeUncompressed: number;
@@ -1,7 +1,7 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const bytes = null;
export const bytes = '';
export const sizeCompressed = 0;
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export default [];
@@ -0,0 +1,11 @@
// Copyright 2017-2022 @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';
detectPackage(packageInfo, null, others);
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
export * from './bundle';
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2021 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2017-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated by @polkadot/dev, do not edit
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', version: '4.1.2' };
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '6.2.2' };
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
{ "path": "../wasm-util/tsconfig.build.json" }
]
}
+89 -26
View File
@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "addr2line"
version = "0.13.0"
@@ -43,7 +45,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293"
dependencies = [
"addr2line",
"cfg-if",
"cfg-if 0.1.10",
"libc",
"miniz_oxide",
"object",
@@ -105,12 +107,24 @@ version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]]
name = "cc"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cloudabi"
version = "0.0.3"
@@ -230,9 +244,22 @@ version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
dependencies = [
"cfg-if",
"cfg-if 0.1.10",
"libc",
"wasi",
"wasi 0.9.0+wasi-snapshot-preview1",
"wasm-bindgen",
]
[[package]]
name = "getrandom"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [
"cfg-if 1.0.0",
"js-sys",
"libc",
"wasi 0.10.2+wasi-snapshot-preview1",
"wasm-bindgen",
]
@@ -271,6 +298,15 @@ dependencies = [
"digest",
]
[[package]]
name = "js-sys"
version = "0.3.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "keccak"
version = "0.1.0"
@@ -285,9 +321,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.74"
version = "0.2.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10"
checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
[[package]]
name = "lock_api"
@@ -304,7 +340,7 @@ version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if",
"cfg-if 0.1.10",
]
[[package]]
@@ -377,7 +413,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
dependencies = [
"cfg-if",
"cfg-if 0.1.10",
"cloudabi",
"libc",
"redox_syscall",
@@ -409,9 +445,9 @@ checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
[[package]]
name = "proc-macro2"
version = "1.0.19"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
"unicode-xid",
]
@@ -431,7 +467,7 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"getrandom 0.1.14",
"libc",
"rand_chacha",
"rand_core",
@@ -454,7 +490,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom",
"getrandom 0.1.14",
]
[[package]]
@@ -493,7 +529,7 @@ dependencies = [
"arrayref",
"arrayvec 0.5.1",
"curve25519-dalek",
"getrandom",
"getrandom 0.1.14",
"merlin",
"rand",
"rand_core",
@@ -521,6 +557,24 @@ dependencies = [
"sha2",
]
[[package]]
name = "secp256k1"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260"
dependencies = [
"secp256k1-sys",
]
[[package]]
name = "secp256k1-sys"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036"
dependencies = [
"cc",
]
[[package]]
name = "serde"
version = "1.0.114"
@@ -565,9 +619,9 @@ checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1"
[[package]]
name = "syn"
version = "1.0.38"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4"
checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54"
dependencies = [
"proc-macro2",
"quote",
@@ -653,13 +707,21 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm"
version = "0.0.0"
dependencies = [
"blake2-rfc",
"byteorder",
"curve25519-dalek",
"ed25519-dalek",
"getrandom 0.2.3",
"hex-literal",
"hmac",
"merlin",
@@ -667,6 +729,7 @@ dependencies = [
"rand",
"schnorrkel",
"scrypt",
"secp256k1",
"sha2",
"tiny-bip39",
"tiny-keccak",
@@ -677,19 +740,19 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
version = "0.2.65"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d"
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
dependencies = [
"cfg-if",
"cfg-if 1.0.0",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.65"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d"
checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
dependencies = [
"bumpalo",
"lazy_static",
@@ -702,9 +765,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.65"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e"
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -712,9 +775,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.65"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6"
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
dependencies = [
"proc-macro2",
"quote",
@@ -725,9 +788,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.65"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87"
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
[[package]]
name = "wee_alloc"
@@ -735,7 +798,7 @@ version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
dependencies = [
"cfg-if",
"cfg-if 0.1.10",
"libc",
"memory_units",
"winapi",
+6 -2
View File
@@ -9,6 +9,7 @@ license = "Apache-2.0"
name = "wasm"
publish = false
repository = "https://github.com/polkadot-js/wasm/"
resolver = "2"
version = "0.0.0"
[lib]
@@ -17,18 +18,21 @@ crate-type = ["cdylib"]
[dependencies]
blake2-rfc = "0.2.18"
byteorder = "1.3.1"
curve25519-dalek = { version = "2.1.0", default-features = false }
ed25519-dalek = { version = "1.0.0-pre.4", features = [] }
getrandom = { version="0.2.3", features = ["js"] }
hmac = "0.7.0"
# libsecp256k1 = "0.2.2"
secp256k1 = { version = "0.21.2", default-features = false, features = ["recovery", "global-context"] }
merlin = { version = "2.0", default-features = false }
pbkdf2 = { version = "0.3.0", default-features = false }
rand = { version="0.7.3", default-features = false, features = ["wasm-bindgen"] }
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"] }
scrypt = { version = "0.2", default-features = false }
sha2 = "0.8.1"
tiny-bip39 = { version = "0.7", default-features = false }
tiny-keccak = { version = "2.0.1", features = ["keccak"] }
twox-hash = "1.5.0"
wasm-bindgen = "=0.2.65"
wasm-bindgen = "=0.2.79"
wee_alloc = "0.4.3"
[dev-dependencies]
+11 -13
View File
@@ -11,21 +11,19 @@ Install the package (also requires `@polkadot/util` for `TextEncoder` polyfills
Use it -
```js
const { u8aToHex } = require('@polkadot/util');
const { bip39Generate, bip39ToSeed, waitReady } = require('@polkadot/wasm-crypto');
import { u8aToHex } from '@polkadot/util';
import { bip39Generate, bip39ToSeed, waitReady } from '@polkadot/wasm-crypto';
async function main () {
// first wait until the WASM has been loaded (async init)
await waitReady();
// first wait until the WASM has been loaded (async init)
await waitReady();
// generate phrase
const phrase = bip39Generate(12);
// generate phrase
const phrase = bip39Generate(12);
// get ed25519 seed from phrase
const seed = bip39ToSeed(phrase, '');
// get ed25519 seed from phrase
const seed = bip39ToSeed(phrase, '');
// display
console.log('phrase:', phrase);
console.log('seed:', u8aToHex(seed));
}
// display
console.log('phrase:', phrase);
console.log('seed:', u8aToHex(seed));
```
+35 -13
View File
@@ -1,24 +1,46 @@
{
"name": "@polkadot/wasm-crypto",
"version": "4.1.2",
"type": "module",
"author": "Jaco Greeff <jacogr@gmail.com>",
"main": "index.js",
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"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"
},
"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",
"type": "git",
"url": "https://github.com/polkadot-js/wasm.git"
},
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs",
"./initNone.js",
"./initNone.cjs",
"./initOnlyAsm.js",
"./initOnlyAsm.cjs",
"./initOnlyWasm.js",
"./initOnlyWasm.cjs",
"./initWasmAsm.js",
"./initWasmAsm.cjs"
],
"type": "module",
"version": "6.2.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/wasm-crypto-asmjs": "^4.1.2",
"@polkadot/wasm-crypto-wasm": "^4.1.2"
"@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"
},
"devDependencies": {
"@polkadot/util": "^6.11.1",
"@polkadot/x-randomvalues": "^6.11.1"
"@polkadot/util": "^9.7.1",
"@polkadot/x-randomvalues": "^9.7.1"
},
"peerDependencies": {
"@polkadot/util": "*",
-96
View File
@@ -1,96 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import type { AsmCreator, WasmCryptoInstance } from './types';
import { assert, stringToU8a, u8aToString } from '@polkadot/util';
let wasm: WasmCryptoInstance | null = null;
let cachegetInt32: Int32Array | null = null;
let cachegetUint8: Uint8Array | null = null;
export async function initWasm (wasmBytes: Uint8Array | null, asmFn: AsmCreator | null, wbg: Record<string, WebAssembly.ImportValue>): Promise<void> {
try {
assert(typeof WebAssembly !== 'undefined' && wasmBytes && wasmBytes.length, 'WebAssembly is not available in your environment');
const source = await WebAssembly.instantiate(wasmBytes, { wbg });
wasm = source.instance.exports as unknown as WasmCryptoInstance;
} catch (error) {
// if we have a valid supplied asm.js, return that
if (asmFn) {
wasm = asmFn(wbg);
} else {
console.error('FATAL: Unable to initialize @polkadot/wasm-crypto');
console.error(error);
wasm = null;
}
}
}
// FIXME We really would love to clean this up and have a sign like (wasm, ...params) => T
// Alas, TypeScript foo is not that great today, so we sadly have an extra closure here
export function withWasm <T, F extends (...params: never[]) => T> (fn: (wasm: WasmCryptoInstance) => F): F {
return ((...params: never[]): T => {
assert(wasm, 'The WASM interface has not been initialized. Ensure that you wait for the initialization Promise with waitReady() from @polkadot/wasm-crypto (or cryptoWaitReady() from @polkadot/util-crypto) before attempting to use WASM-only interfaces.');
return fn(wasm)(...params);
}) as unknown as F;
}
export function getWasm (): WasmCryptoInstance {
return wasm!;
}
export function getInt32 (): Int32Array {
if (cachegetInt32 === null || cachegetInt32.buffer !== wasm!.memory.buffer) {
cachegetInt32 = new Int32Array(wasm!.memory.buffer);
}
return cachegetInt32;
}
export function getUint8 (): Uint8Array {
if (cachegetUint8 === null || cachegetUint8.buffer !== wasm!.memory.buffer) {
cachegetUint8 = new Uint8Array(wasm!.memory.buffer);
}
return cachegetUint8;
}
export function getU8a (ptr: number, len: number): Uint8Array {
return getUint8().subarray(ptr / 1, ptr / 1 + len);
}
export function getString (ptr: number, len: number): string {
return u8aToString(getU8a(ptr, len));
}
export function allocU8a (arg: Uint8Array): [number, number] {
const ptr = wasm!.__wbindgen_malloc(arg.length * 1);
getUint8().set(arg, ptr / 1);
return [ptr, arg.length];
}
export function allocString (arg: string): [number, number] {
return allocU8a(stringToU8a(arg));
}
export function resultU8a (): Uint8Array {
const r0 = getInt32()[8 / 4 + 0];
const r1 = getInt32()[8 / 4 + 1];
const ret = getU8a(r0, r1).slice();
wasm!.__wbindgen_free(r0, r1 * 1);
return ret;
}
export function resultString (): string {
return u8aToString(resultU8a());
}
+175 -185
View File
@@ -1,257 +1,247 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
import type { WasmCryptoInstance } from '@polkadot/wasm-crypto-init/types';
import { allocString, allocU8a, getWasm, initWasm, resultString, resultU8a, withWasm } from './bridge';
import * as imports from './imports';
import { bridge, initBridge } from './init';
export { packageInfo } from './packageInfo';
export { bridge };
const wasmPromise = initWasm(wasmBytes, asmJsInit, imports).catch(() => null);
// Removes the first parameter (expected as WasmCryptoInstance) and leaves the
// rest of the parameters in-tack. This allows us to dynamically create a function
// return from the withWasm helper
type PopFirst<T extends unknown[]> =
T extends [WasmCryptoInstance, ...infer N]
? N
: [];
export const bip39Generate = withWasm((wasm) =>
(words: 12 | 15 | 18 | 21 | 24): string => {
wasm.ext_bip39_generate(8, words);
/**
* @internal
* @description
* This create an extenal interface function from the signature, all the while checking
* the actual bridge wasm interface to ensure it has been initialized.
*
* This means that we can call it
*
* withWasm(wasm: WasmCryptoInstance, a: number, b: string) => Uint8Array
*
* and in this case it will create an interface function with the signarure
*
* (a: number, b: string) => Uint8Array
*/
function withWasm <T, F extends (wasm: WasmCryptoInstance, ...params: never[]) => T> (fn: F): (...params: PopFirst<Parameters<F>>) => ReturnType<F> {
return (...params: PopFirst<Parameters<F>>): ReturnType<F> => {
if (!bridge.wasm) {
throw new Error('The WASM interface has not been initialized. Ensure that you wait for the initialization Promise with waitReady() from @polkadot/wasm-crypto (or cryptoWaitReady() from @polkadot/util-crypto) before attempting to use WASM-only interfaces.');
}
return resultString();
}
);
return fn(bridge.wasm, ...params) as ReturnType<F>;
};
}
export const bip39ToEntropy = withWasm((wasm) =>
(phrase: string): Uint8Array => {
const [ptr0, len0] = allocString(phrase);
export const bip39Generate = withWasm((wasm, words: 12 | 15 | 18 | 21 | 24): string => {
wasm.ext_bip39_generate(8, words);
wasm.ext_bip39_to_entropy(8, ptr0, len0);
return bridge.resultString();
});
return resultU8a();
}
);
export const bip39ToEntropy = withWasm((wasm, phrase: string): Uint8Array => {
wasm.ext_bip39_to_entropy(8, ...bridge.allocString(phrase));
export const bip39ToMiniSecret = withWasm((wasm) =>
(phrase: string, password: string): Uint8Array => {
const [ptr0, len0] = allocString(phrase);
const [ptr1, len1] = allocString(password);
return bridge.resultU8a();
});
wasm.ext_bip39_to_mini_secret(8, ptr0, len0, ptr1, len1);
export const bip39ToMiniSecret = withWasm((wasm, phrase: string, password: string): Uint8Array => {
wasm.ext_bip39_to_mini_secret(8, ...bridge.allocString(phrase), ...bridge.allocString(password));
return resultU8a();
}
);
return bridge.resultU8a();
});
export const bip39ToSeed = withWasm((wasm) =>
(phrase: string, password: string): Uint8Array => {
const [ptr0, len0] = allocString(phrase);
const [ptr1, len1] = allocString(password);
export const bip39ToSeed = withWasm((wasm, phrase: string, password: string): Uint8Array => {
wasm.ext_bip39_to_seed(8, ...bridge.allocString(phrase), ...bridge.allocString(password));
wasm.ext_bip39_to_seed(8, ptr0, len0, ptr1, len1);
return bridge.resultU8a();
});
return resultU8a();
}
);
export const bip39Validate = withWasm((wasm, phrase: string): boolean => {
const ret = wasm.ext_bip39_validate(...bridge.allocString(phrase));
export const bip39Validate = withWasm((wasm) =>
(phrase: string): boolean => {
const [ptr0, len0] = allocString(phrase);
const ret = wasm.ext_bip39_validate(ptr0, len0);
return ret !== 0;
});
return ret !== 0;
}
);
export const ed25519KeypairFromSeed = withWasm((wasm, seed: Uint8Array): Uint8Array => {
wasm.ext_ed_from_seed(8, ...bridge.allocU8a(seed));
export const ed25519KeypairFromSeed = withWasm((wasm) =>
(seed: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(seed);
return bridge.resultU8a();
});
wasm.ext_ed_from_seed(8, ptr0, len0);
export const ed25519Sign = withWasm((wasm, pubkey: Uint8Array, seckey: Uint8Array, message: Uint8Array): Uint8Array => {
wasm.ext_ed_sign(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(seckey), ...bridge.allocU8a(message));
return resultU8a();
}
);
return bridge.resultU8a();
});
export const ed25519Sign = withWasm((wasm) =>
(pubkey: Uint8Array, seckey: Uint8Array, message: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(pubkey);
const [ptr1, len1] = allocU8a(seckey);
const [ptr2, len2] = allocU8a(message);
export const ed25519Verify = withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
const ret = wasm.ext_ed_verify(...bridge.allocU8a(signature), ...bridge.allocU8a(message), ...bridge.allocU8a(pubkey));
wasm.ext_ed_sign(8, ptr0, len0, ptr1, len1, ptr2, len2);
return ret !== 0;
});
return resultU8a();
}
);
export const secp256k1FromSeed = withWasm((wasm, seckey: Uint8Array): Uint8Array => {
wasm.ext_secp_from_seed(8, ...bridge.allocU8a(seckey));
export const ed25519Verify = withWasm((wasm) =>
(signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
const [ptr0, len0] = allocU8a(signature);
const [ptr1, len1] = allocU8a(message);
const [ptr2, len2] = allocU8a(pubkey);
const ret = wasm.ext_ed_verify(ptr0, len0, ptr1, len1, ptr2, len2);
return bridge.resultU8a();
});
return ret !== 0;
}
);
export const secp256k1Compress = withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
wasm.ext_secp_pub_compress(8, ...bridge.allocU8a(pubkey));
export const sr25519DeriveKeypairHard = withWasm((wasm) =>
(pair: Uint8Array, cc: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(pair);
const [ptr1, len1] = allocU8a(cc);
return bridge.resultU8a();
});
wasm.ext_sr_derive_keypair_hard(8, ptr0, len0, ptr1, len1);
export const secp256k1Expand = withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
wasm.ext_secp_pub_expand(8, ...bridge.allocU8a(pubkey));
return resultU8a();
}
);
return bridge.resultU8a();
});
export const sr25519DeriveKeypairSoft = withWasm((wasm) =>
(pair: Uint8Array, cc: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(pair);
const [ptr1, len1] = allocU8a(cc);
export const secp256k1Recover = withWasm((wasm, msgHash: Uint8Array, sig: Uint8Array, recovery: number): Uint8Array => {
wasm.ext_secp_recover(8, ...bridge.allocU8a(msgHash), ...bridge.allocU8a(sig), recovery);
wasm.ext_sr_derive_keypair_soft(8, ptr0, len0, ptr1, len1);
return bridge.resultU8a();
});
return resultU8a();
}
);
export const secp256k1Sign = withWasm((wasm, msgHash: Uint8Array, seckey: Uint8Array): Uint8Array => {
wasm.ext_secp_sign(8, ...bridge.allocU8a(msgHash), ...bridge.allocU8a(seckey));
export const sr25519DerivePublicSoft = withWasm((wasm) =>
(pubkey: Uint8Array, cc: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(pubkey);
const [ptr1, len1] = allocU8a(cc);
return bridge.resultU8a();
});
wasm.ext_sr_derive_public_soft(8, ptr0, len0, ptr1, len1);
export const sr25519DeriveKeypairHard = withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
wasm.ext_sr_derive_keypair_hard(8, ...bridge.allocU8a(pair), ...bridge.allocU8a(cc));
return resultU8a();
}
);
return bridge.resultU8a();
});
export const sr25519KeypairFromSeed = withWasm((wasm) =>
(seed: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(seed);
export const sr25519DeriveKeypairSoft = withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
wasm.ext_sr_derive_keypair_soft(8, ...bridge.allocU8a(pair), ...bridge.allocU8a(cc));
wasm.ext_sr_from_seed(8, ptr0, len0);
return bridge.resultU8a();
});
return resultU8a();
}
);
export const sr25519DerivePublicSoft = withWasm((wasm, pubkey: Uint8Array, cc: Uint8Array): Uint8Array => {
wasm.ext_sr_derive_public_soft(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(cc));
export const sr25519Sign = withWasm((wasm) =>
(pubkey: Uint8Array, secret: Uint8Array, message: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(pubkey);
const [ptr1, len1] = allocU8a(secret);
const [ptr2, len2] = allocU8a(message);
return bridge.resultU8a();
});
wasm.ext_sr_sign(8, ptr0, len0, ptr1, len1, ptr2, len2);
export const sr25519KeypairFromSeed = withWasm((wasm, seed: Uint8Array): Uint8Array => {
wasm.ext_sr_from_seed(8, ...bridge.allocU8a(seed));
return resultU8a();
}
);
return bridge.resultU8a();
});
export const sr25519Verify = withWasm((wasm) =>
(signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
const [ptr0, len0] = allocU8a(signature);
const [ptr1, len1] = allocU8a(message);
const [ptr2, len2] = allocU8a(pubkey);
const ret = wasm.ext_sr_verify(ptr0, len0, ptr1, len1, ptr2, len2);
export const sr25519Sign = withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array, message: Uint8Array): Uint8Array => {
wasm.ext_sr_sign(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(secret), ...bridge.allocU8a(message));
return ret !== 0;
}
);
return bridge.resultU8a();
});
export const vrfSign = withWasm((wasm) =>
(secret: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(secret);
const [ptr1, len1] = allocU8a(context);
const [ptr2, len2] = allocU8a(message);
const [ptr3, len3] = allocU8a(extra);
export const sr25519Verify = withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
const ret = wasm.ext_sr_verify(...bridge.allocU8a(signature), ...bridge.allocU8a(message), ...bridge.allocU8a(pubkey));
wasm.ext_vrf_sign(8, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return ret !== 0;
});
return resultU8a();
}
);
export const sr25519Agree = withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array): Uint8Array => {
wasm.ext_sr_agree(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(secret));
export const vrfVerify = withWasm((wasm) =>
(pubkey: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array, outAndProof: Uint8Array): boolean => {
const [ptr0, len0] = allocU8a(pubkey);
const [ptr1, len1] = allocU8a(context);
const [ptr2, len2] = allocU8a(message);
const [ptr3, len3] = allocU8a(extra);
const [ptr4, len4] = allocU8a(outAndProof);
const ret = wasm.ext_vrf_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
return bridge.resultU8a();
});
return ret !== 0;
}
);
export const vrfSign = 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));
export const blake2b = withWasm((wasm) =>
(data: Uint8Array, key: Uint8Array, size: number): Uint8Array => {
const [ptr0, len0] = allocU8a(data);
const [ptr1, len1] = allocU8a(key);
return bridge.resultU8a();
});
wasm.ext_blake2b(8, ptr0, len0, ptr1, len1, size);
export const vrfVerify = 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 resultU8a();
}
);
return ret !== 0;
});
export const keccak256 = withWasm((wasm) =>
(data: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(data);
export const blake2b = withWasm((wasm, data: Uint8Array, key: Uint8Array, size: number): Uint8Array => {
wasm.ext_blake2b(8, ...bridge.allocU8a(data), ...bridge.allocU8a(key), size);
wasm.ext_keccak256(8, ptr0, len0);
return bridge.resultU8a();
});
return resultU8a();
}
);
export const hmacSha256 = withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
wasm.ext_hmac_sha256(8, ...bridge.allocU8a(key), ...bridge.allocU8a(data));
export const pbkdf2 = withWasm((wasm) =>
(data: Uint8Array, salt: Uint8Array, rounds: number): Uint8Array => {
const [ptr0, len0] = allocU8a(data);
const [ptr1, len1] = allocU8a(salt);
return bridge.resultU8a();
});
wasm.ext_pbkdf2(8, ptr0, len0, ptr1, len1, rounds);
export const hmacSha512 = withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
wasm.ext_hmac_sha512(8, ...bridge.allocU8a(key), ...bridge.allocU8a(data));
return resultU8a();
}
);
return bridge.resultU8a();
});
export const scrypt = withWasm((wasm) =>
(password: Uint8Array, salt: Uint8Array, log2n: number, r: number, p: number): Uint8Array => {
const [ptr0, len0] = allocU8a(password);
const [ptr1, len1] = allocU8a(salt);
export const keccak256 = withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_keccak256(8, ...bridge.allocU8a(data));
wasm.ext_scrypt(8, ptr0, len0, ptr1, len1, log2n, r, p);
return bridge.resultU8a();
});
return resultU8a();
}
);
export const keccak512 = withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_keccak512(8, ...bridge.allocU8a(data));
export const sha512 = withWasm((wasm) =>
(data: Uint8Array): Uint8Array => {
const [ptr0, len0] = allocU8a(data);
return bridge.resultU8a();
});
wasm.ext_sha512(8, ptr0, len0);
export const pbkdf2 = withWasm((wasm, data: Uint8Array, salt: Uint8Array, rounds: number): Uint8Array => {
wasm.ext_pbkdf2(8, ...bridge.allocU8a(data), ...bridge.allocU8a(salt), rounds);
return resultU8a();
}
);
return bridge.resultU8a();
});
export const twox = withWasm((wasm) =>
(data: Uint8Array, rounds: number) => {
const [ptr0, len0] = allocU8a(data);
export const scrypt = 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);
wasm.ext_twox(8, ptr0, len0, rounds);
return bridge.resultU8a();
});
return resultU8a();
}
);
export const sha256 = withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_sha256(8, ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const sha512 = withWasm((wasm, data: Uint8Array): Uint8Array => {
wasm.ext_sha512(8, ...bridge.allocU8a(data));
return bridge.resultU8a();
});
export const twox = withWasm((wasm, data: Uint8Array, rounds: number) => {
wasm.ext_twox(8, ...bridge.allocU8a(data), rounds);
return bridge.resultU8a();
});
export function isReady (): boolean {
return !!getWasm();
return !!bridge.wasm;
}
export function waitReady (): Promise<boolean> {
return wasmPromise.then(() => isReady());
export async function waitReady (): Promise<boolean> {
try {
const wasm = await initBridge();
return !!wasm;
} catch {
return false;
}
}
+10
View File
@@ -0,0 +1,10 @@
// Copyright 2017-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
import { packageInfo as initInfo } from '@polkadot/wasm-crypto-init/packageInfo';
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
import { packageInfo as utilInfo } from '@polkadot/wasm-util/packageInfo';
export default [bridgeInfo, asmInfo, initInfo, wasmInfo, utilInfo];
+6 -5
View File
@@ -1,10 +1,11 @@
// Copyright 2017-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2017-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
// Do not edit, auto-generated by @polkadot/dev
import { detectPackage } from '@polkadot/util';
import others from './detectOther';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [asmInfo, wasmInfo]);
detectPackage(packageInfo, null, others);
-90
View File
@@ -1,90 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable camelcase */
import { getRandomValues } from '@polkadot/x-randomvalues';
import { getString, getU8a } from './bridge';
const DEFAULT_CRYPTO = { getRandomValues };
const DEFAULT_SELF = { crypto: DEFAULT_CRYPTO };
const heap: Array<unknown> = new Array(32).fill(undefined).concat(undefined, null, true, false);
let heapNext = heap.length;
function getObject (idx: number): unknown {
return heap[idx];
}
function dropObject (idx: number) {
if (idx < 36) {
return;
}
heap[idx] = heapNext;
heapNext = idx;
}
function takeObject (idx: number): unknown {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function addObject (obj: unknown): number {
if (heapNext === heap.length) {
heap.push(heap.length + 1);
}
const idx = heapNext;
heapNext = heap[idx] as number;
heap[idx] = obj;
return idx;
}
export function __wbindgen_is_undefined (idx: number): boolean {
return getObject(idx) === undefined;
}
export function __wbg_self_1b7a39e3a92c949c (): number {
return addObject(DEFAULT_SELF);
}
export function __wbg_require_604837428532a733 (ptr: number, len: number): never {
throw new Error(`Unable to require ${getString(ptr, len)}`);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function __wbg_crypto_968f1772287e2df0 (_idx: number): number {
return addObject(DEFAULT_CRYPTO);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function __wbg_getRandomValues_a3d34b4fee3c2869 (_idx: number): number {
return addObject(DEFAULT_CRYPTO.getRandomValues);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function __wbg_getRandomValues_f5e14ab7ac8e995d (_arg0: number, ptr: number, len: number): void {
DEFAULT_CRYPTO.getRandomValues(getU8a(ptr, len));
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function __wbg_randomFillSync_d5bd2d655fdf256a (_idx: number, _ptr: number, _len: number): never {
throw new Error('randomFillsync is not available');
// getObject(idx).randomFillSync(getU8a(ptr, len));
}
export function __wbindgen_object_drop_ref (idx: number): void {
takeObject(idx);
}
export function abort (): never {
throw new Error('abort');
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
+25
View File
@@ -0,0 +1,25 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { InitFn } from '@polkadot/wasm-bridge/types';
import type { WasmCryptoInstance } from '@polkadot/wasm-crypto-init/types';
import { Bridge } from '@polkadot/wasm-bridge';
import { createWasm } from '@polkadot/wasm-crypto-init';
/**
* @name bridge
* @description
* The JS <-> WASM bridge that is in operation. For the specific package
* it is a global, i.e. all operations happens on this specific bridge
*/
export const bridge = new Bridge<WasmCryptoInstance>(createWasm);
/**
* @name initBridge
* @description
* Creates a new bridge interface with the (optional) initialization function
*/
export async function initBridge (createWasm?: InitFn<WasmCryptoInstance>): Promise<WasmCryptoInstance | null> {
return bridge.init(createWasm);
}
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/none';
import { initBridge } from './init';
/**
* @name initWasm
* @description
* For historic purposes and for tighter control on init, specifically performing
* a WASM initialization with no interface whatsoever (no WASM, no ASM.js)
*
* Generally should not be used unless you want explicit control over which
* interfaces are initialized.
*/
export async function initWasm (): Promise<void> {
await initBridge(createWasm);
}
initWasm().catch((): void => {
// cannot happen, initWasm doesn't throw
});
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/asm';
import { initBridge } from './init';
/**
* @name initWasm
* @description
* For historic purposes and for tighter control on init, specifically performing
* a WASM initialization with only ASM.js
*
* Generally should not be used unless you want explicit control over which
* interfaces are initialized.
*/
export async function initWasm (): Promise<void> {
await initBridge(createWasm);
}
initWasm().catch((): void => {
// cannot happen, initWasm doesn't throw
});
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/wasm';
import { initBridge } from './init';
/**
* @name initWasm
* @description
* For historic purposes and for tighter control on init, specifically performing
* a WASM initialization with only WASM (generally the default for most platforms)
*
* Generally should not be used unless you want explicit control over which
* interfaces are initialized.
*/
export async function initWasm (): Promise<void> {
await initBridge(createWasm);
}
initWasm().catch((): void => {
// cannot happen, initWasm doesn't throw
});
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createWasm } from '@polkadot/wasm-crypto-init/both';
import { initBridge } from './init';
/**
* @name initWasm
* @description
* For historic purposes and for tighter control on init, specifically performing
* a WASM initialization with ASM and an ASM.js fallback
*
* Generally should not be used unless you want explicit control over which
* interfaces are initialized.
*/
export async function initWasm (): Promise<void> {
await initBridge(createWasm);
}
initWasm().catch((): void => {
// cannot happen, initWasm doesn't throw
});
-11
View File
@@ -1,11 +0,0 @@
// Copyright 2017-2021 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Be able to import json in TS
// https://stackoverflow.com/questions/49996456/importing-json-file-in-typescript
declare module '*.json' {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const value: any;
export default value;
}

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