Compare commits

..
124 Commits
Author SHA1 Message Date
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
95 changed files with 3774 additions and 2490 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
6
7
3.2.2
3.2.3
3.2.4
4.0.2
4.1.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/*',
'packages/bytes/*'
],
parserOptions: {
...base.parserOptions,
project: [
'./tsconfig.json'
'./tsconfig.eslint.json'
]
}
};
+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 }}
+2
View File
@@ -7,6 +7,8 @@ on:
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
+2
View File
@@ -6,6 +6,8 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/stale@v3
with:
+1
View File
@@ -26,5 +26,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
-631
View File
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.1.cjs
yarnPath: .yarn/releases/yarn-3.2.0.cjs
+24
View File
@@ -1,5 +1,29 @@
# CHANGELOG
## 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.
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:
+5
View File
@@ -0,0 +1,5 @@
384 Jaco 5.0.1 (#312)
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');
+5 -5
View File
@@ -1,13 +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-(asmjs|wasm)(.*)$': '<rootDir>/packages/wasm-crypto-$1/build/$2',
// eslint-disable-next-line sort-keys
'@polkadot/wasm-crypto(.*)$': '<rootDir>/packages/wasm-crypto/src/$1'
}
});
};
+8 -7
View File
@@ -2,20 +2,21 @@
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/wasm/issues",
"homepage": "https://github.com/polkadot-js/wasm#readme",
"license": "Apache-2",
"packageManager": "yarn@3.0.1",
"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": "4.5.1",
"version": "5.0.1",
"workspaces": [
"packages/*"
],
"scripts": {
"build": "yarn build:wasm",
"build:js": "./scripts/build-js.sh",
"build:release": "polkadot-ci-ghact-build",
"build:rollup": "polkadot-exec-rollup --config",
"build:wasm": "./scripts/build.sh",
@@ -29,12 +30,12 @@
"test:wasm:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --nocapture"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@polkadot/dev": "^0.63.35",
"fflate": "^0.7.1",
"@babel/core": "^7.17.8",
"@polkadot/dev": "^0.65.97",
"fflate": "^0.7.3",
"override-require": "^1.1.1"
},
"resolutions": {
"typescript": "^4.5.2"
"typescript": "^4.6.2"
}
}
+9 -5
View File
@@ -17,11 +17,15 @@
},
"sideEffects": false,
"type": "module",
"version": "4.5.1",
"browser": "empty.js",
"main": "empty.js",
"react-native": "data.js",
"version": "5.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.3"
"@babel/runtime": "^7.17.8"
},
"devDependencies": {
"@polkadot/util": "^8.5.1"
},
"peerDependencies": {
"@polkadot/util": "*"
}
}
@@ -1,6 +1,8 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-asmjs authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { asmJsInit as _asmJsInit } from './cjs/data.js';
export { packageInfo } from './packageInfo';
export const asmJsInit = _asmJsInit;
+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;
+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
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);
-4
View File
@@ -1,4 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-asmjs authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const asmJsInit = null;
+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';
@@ -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.5.1' };
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '5.0.1' };
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": []
}
+9 -5
View File
@@ -17,11 +17,15 @@
},
"sideEffects": false,
"type": "module",
"version": "4.5.1",
"browser": "data.js",
"main": "data.js",
"react-native": "data.js",
"version": "5.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.3"
"@babel/runtime": "^7.17.8"
},
"devDependencies": {
"@polkadot/util": "^8.5.1"
},
"peerDependencies": {
"@polkadot/util": "*"
}
}
+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
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
@@ -1,8 +1,10 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { base64Decode } from './base64';
import { bytes, sizeUncompressed } from './bytes';
import { unzlibSync } from './fflate';
export { packageInfo } from './packageInfo';
export const wasmBytes = unzlibSync(base64Decode(bytes), new Uint8Array(sizeUncompressed));
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// Copyright 2019-2022 @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';
+1 -1
View File
@@ -1,4 +1,4 @@
// 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 = '';
+1 -1
View File
@@ -1,4 +1,4 @@
// 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 = '';
@@ -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);
-8
View File
@@ -1,8 +0,0 @@
// Copyright 2019-2021 @polkadot/wasm-crypto-wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const bytes = null;
export const sizeCompressed = 0;
export const sizeUncompressed = 0;
+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
// MIT License
+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';
+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.5.1' };
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '5.0.1' };
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": []
}
+15 -15
View File
@@ -568,9 +568,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",
]
@@ -781,9 +781,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",
@@ -908,19 +908,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 0.1.10",
"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",
@@ -933,9 +933,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",
@@ -943,9 +943,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",
@@ -956,9 +956,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"
+1 -1
View File
@@ -32,7 +32,7 @@ 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]
+13 -7
View File
@@ -17,19 +17,25 @@
},
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
"./detectPackage.cjs",
"./initOnlyAsm.js",
"./initOnlyAsm.cjs",
"./initOnlyWasm.js",
"./initOnlyWasm.cjs",
"./initWasmAsm.js",
"./initWasmAsm.cjs"
],
"type": "module",
"version": "4.5.1",
"version": "5.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.3",
"@polkadot/wasm-crypto-asmjs": "^4.5.1",
"@polkadot/wasm-crypto-wasm": "^4.5.1"
"@babel/runtime": "^7.17.8",
"@polkadot/wasm-crypto-asmjs": "^5.0.1",
"@polkadot/wasm-crypto-wasm": "^5.0.1"
},
"devDependencies": {
"@polkadot/util": "^8.0.5",
"@polkadot/x-randomvalues": "^8.0.5"
"@polkadot/util": "^8.5.1",
"@polkadot/x-randomvalues": "^8.5.1"
},
"peerDependencies": {
"@polkadot/util": "*",
+27 -35
View File
@@ -1,9 +1,9 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @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 type { WasmCryptoInstance } from './types';
import { assert, stringToU8a, u8aToString } from '@polkadot/util';
@@ -12,56 +12,48 @@ type PopFirst<T extends unknown[]> =
? N
: [];
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;
}
}
interface Bridge {
cachegetInt32: Int32Array | null;
cachegetUint8: Uint8Array | null;
type: 'wasm' | 'asm';
wasm: WasmCryptoInstance | null;
wasmPromise: Promise<void> | null;
}
export const __bridge: Bridge = {
cachegetInt32: null,
cachegetUint8: null,
type: 'wasm',
wasm: null,
wasmPromise: null
};
export 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> => {
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.');
assert(__bridge.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 ReturnType<F>;
return fn(__bridge.wasm, ...params) as ReturnType<F>;
};
}
export function getWasm (): WasmCryptoInstance {
return wasm!;
return __bridge.wasm!;
}
export function getInt32 (): Int32Array {
if (cachegetInt32 === null || cachegetInt32.buffer !== wasm!.memory.buffer) {
cachegetInt32 = new Int32Array(wasm!.memory.buffer);
if (__bridge.cachegetInt32 === null || __bridge.cachegetInt32.buffer !== __bridge.wasm!.memory.buffer) {
__bridge.cachegetInt32 = new Int32Array(__bridge.wasm!.memory.buffer);
}
return cachegetInt32;
return __bridge.cachegetInt32;
}
export function getUint8 (): Uint8Array {
if (cachegetUint8 === null || cachegetUint8.buffer !== wasm!.memory.buffer) {
cachegetUint8 = new Uint8Array(wasm!.memory.buffer);
if (__bridge.cachegetUint8 === null || __bridge.cachegetUint8.buffer !== __bridge.wasm!.memory.buffer) {
__bridge.cachegetUint8 = new Uint8Array(__bridge.wasm!.memory.buffer);
}
return cachegetUint8;
return __bridge.cachegetUint8;
}
export function getU8a (ptr: number, len: number): Uint8Array {
@@ -73,7 +65,7 @@ export function getString (ptr: number, len: number): string {
}
export function allocU8a (arg: Uint8Array): [number, number] {
const ptr = wasm!.__wbindgen_malloc(arg.length * 1);
const ptr = __bridge.wasm!.__wbindgen_malloc(arg.length * 1);
getUint8().set(arg, ptr / 1);
@@ -89,7 +81,7 @@ export function resultU8a (): Uint8Array {
const r1 = getInt32()[8 / 4 + 1];
const ret = getU8a(r0, r1).slice();
wasm!.__wbindgen_free(r0, r1 * 1);
__bridge.wasm!.__wbindgen_free(r0, r1 * 1);
return ret;
}
+19 -9
View File
@@ -1,16 +1,11 @@
// 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 { allocString, allocU8a, getWasm, initWasm, resultString, resultU8a, withWasm } from './bridge';
import * as imports from './imports';
import { __bridge, allocString, allocU8a, getWasm, resultString, resultU8a, withWasm } from './bridge';
import { setWasmOnlyPromise } from './init';
export { packageInfo } from './packageInfo';
const wasmPromise = initWasm(wasmBytes, asmJsInit, imports).catch(() => null);
export const bip39Generate = withWasm((wasm, words: 12 | 15 | 18 | 21 | 24): string => {
wasm.ext_bip39_generate(8, words);
@@ -59,7 +54,18 @@ export const ed25519Verify = withWasm((wasm, signature: Uint8Array, message: Uin
return ret !== 0;
});
let secpLazyInit = false;
export const secp256k1FromSeed = withWasm((wasm, seckey: Uint8Array): Uint8Array => {
// HACK In an asm.js environment, the static initialization seems to trip up the
// first usage of the keypair generation
// https://github.com/polkadot-js/wasm/issues/307
if (!secpLazyInit && __bridge.type === 'asm') {
wasm.ext_secp_from_seed(8, ...allocU8a(seckey));
resultU8a();
}
secpLazyInit = true;
wasm.ext_secp_from_seed(8, ...allocU8a(seckey));
return resultU8a();
@@ -208,5 +214,9 @@ export function isReady (): boolean {
}
export function waitReady (): Promise<boolean> {
return wasmPromise.then(() => isReady());
return (
__bridge.wasmPromise || setWasmOnlyPromise()
)
.then(() => isReady())
.catch(() => false);
}
+7
View File
@@ -0,0 +1,7 @@
// Copyright 2017-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
export default [asmInfo, wasmInfo];
+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);
+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
/* eslint-disable camelcase */
+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';
+41
View File
@@ -0,0 +1,41 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AsmCreator, WasmCryptoInstance } from './types';
import { assert } from '@polkadot/util';
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
import { __bridge } from './bridge';
import * as imports from './imports';
async function createPromise (wasmBytes: Uint8Array | null, asmFn: AsmCreator | null): Promise<void> {
try {
assert(typeof WebAssembly !== 'undefined' && wasmBytes && wasmBytes.length, 'WebAssembly is not available in your environment');
const source = await WebAssembly.instantiate(wasmBytes, { wbg: imports });
__bridge.wasm = source.instance.exports as unknown as WasmCryptoInstance;
} catch (error) {
// if we have a valid supplied asm.js, return that
if (asmFn) {
__bridge.type = 'asm';
__bridge.wasm = asmFn(imports);
} else {
console.error('FATAL: Unable to initialize @polkadot/wasm-crypto');
console.error(error);
__bridge.wasm = null;
}
}
}
export function setPromise (wasmBytes: Uint8Array | null, asmFn: AsmCreator | null): Promise<void> {
__bridge.wasmPromise = createPromise(wasmBytes, asmFn);
return __bridge.wasmPromise;
}
export function setWasmOnlyPromise (): Promise<void> {
return setPromise(wasmBytes, null);
}
+8
View File
@@ -0,0 +1,8 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
import { setPromise } from './init';
setPromise(null, asmJsInit).catch(() => undefined);
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { setWasmOnlyPromise } from './init';
setWasmOnlyPromise().catch(() => undefined);
+9
View File
@@ -0,0 +1,9 @@
// 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 { setPromise } from './init';
setPromise(wasmBytes, asmJsInit).catch(() => undefined);
-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;
}
+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
// Use `wee_alloc` as the global allocator.
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2017-2022 @polkadot/wasm-crypto 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', version: '4.5.1' };
export const packageInfo = { name: '@polkadot/wasm-crypto', path: 'auto', type: 'auto', version: '5.0.1' };
+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
use bip39::{Mnemonic, MnemonicType, Language, Seed};
+15 -33
View File
@@ -1,18 +1,10 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
use std::convert::TryFrom;
use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signature, Signer as _, Verifier as _};
use wasm_bindgen::prelude::*;
/// Keypair helper function.
fn new_from_pair(pair: &[u8]) -> Keypair {
match Keypair::from_bytes(pair) {
Ok(p) => p,
_ => panic!("Provided pair is invalid.")
}
}
/// Keypair helper function
fn new_from_parts(pubkey: &[u8], seckey: &[u8]) -> Keypair {
let mut pair = vec![];
@@ -20,26 +12,9 @@ fn new_from_parts(pubkey: &[u8], seckey: &[u8]) -> Keypair {
pair.extend_from_slice(seckey);
pair.extend_from_slice(pubkey);
new_from_pair(&pair)
}
/// Keypair helper function.
fn new_from_seed(seed: &[u8]) -> Keypair {
match &SecretKey::from_bytes(seed) {
Ok(s) => {
let pubkey: PublicKey = s.into();
new_from_parts(pubkey.as_bytes(), seed)
},
_ => panic!("Invalid seed provided.")
}
}
/// PublicKey helper
fn new_public(pubkey: &[u8]) -> PublicKey {
match PublicKey::from_bytes(pubkey) {
match Keypair::from_bytes(&pair) {
Ok(p) => p,
_ => panic!("Provided public key is invalid.")
_ => panic!("Provided pair is invalid.")
}
}
@@ -51,9 +26,16 @@ fn new_public(pubkey: &[u8]) -> PublicKey {
/// followed by the public key (32) bytes.
#[wasm_bindgen]
pub fn ext_ed_from_seed(seed: &[u8]) -> Vec<u8> {
new_from_seed(seed)
.to_bytes()
.to_vec()
match &SecretKey::from_bytes(seed) {
Ok(s) => {
let pubkey: PublicKey = s.into();
new_from_parts(pubkey.as_bytes(), seed)
.to_bytes()
.to_vec()
},
_ => panic!("Invalid seed provided.")
}
}
/// Sign a message
@@ -81,8 +63,8 @@ pub fn ext_ed_sign(pubkey: &[u8], seckey: &[u8], message: &[u8]) -> Vec<u8> {
/// * pubkey: UIntArray with 32 element
#[wasm_bindgen]
pub fn ext_ed_verify(signature: &[u8], message: &[u8], pubkey: &[u8]) -> bool {
match Signature::try_from(signature) {
Ok(s) => new_public(pubkey)
match (Signature::try_from(signature), PublicKey::from_bytes(pubkey)) {
(Ok(s), Ok(k)) => k
.verify(message, &s)
.is_ok(),
_ => false
+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
use blake2_rfc::blake2b::blake2b;
+3 -3
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
use libsecp256k1::{Message, PublicKey, RecoveryId, SecretKey, Signature, recover, sign};
@@ -36,7 +36,7 @@ pub fn ext_secp_from_seed(seed: &[u8]) -> Vec<u8> {
res
},
_ => panic!("Incalid seed provided.")
_ => panic!("Invalid seed provided.")
}
}
@@ -114,7 +114,7 @@ pub mod tests {
#[test]
fn can_sign() {
// JS expectiation - doesn't match?
// JS expectation - doesn't match?
// let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba8c4efa521361678d9b8582744d77aa4b8d886d7380b7808a683174afad9c4700300");
let expected = hex!("df92f73d9f060cefacf187b5414491cb992998ace017fa48839b5cda3e264ba83b105adec9e9872647a7d8bb28855b45e22805aea3d097953cbb1391f671d13e01");
let seckey = hex!("4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae");
+21 -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
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
@@ -248,6 +248,26 @@ pub mod tests {
assert!(is_valid);
}
#[test]
fn can_verify_known_wrapped_message() {
let message = b"<Bytes>message to sign</Bytes>";
let public = hex!("f84d048da2ddae2d9d8fd6763f469566e8817a26114f39408de15547f6d47805");
let signature = hex!("48ce2c90e08651adfc8ecef84e916f6d1bb51ebebd16150ee12df247841a5437951ea0f9d632ca165e6ab391532e75e701be6a1caa88c8a6bcca3511f55b4183");
let is_valid = ext_sr_verify(&signature, message, &public);
assert!(is_valid);
}
#[test]
fn can_verify_known_wrapped_message_fail() {
let message = b"message to sign";
let public = hex!("f84d048da2ddae2d9d8fd6763f469566e8817a26114f39408de15547f6d47805");
let signature = hex!("48ce2c90e08651adfc8ecef84e916f6d1bb51ebebd16150ee12df247841a5437951ea0f9d632ca165e6ab391532e75e701be6a1caa88c8a6bcca3511f55b4183");
let is_valid = ext_sr_verify(&signature, message, &public);
assert!(!is_valid);
}
#[test]
fn soft_derives_pair() {
let cc = hex!("0c666f6f00000000000000000000000000000000000000000000000000000000"); // foo
+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
// Copyright 2019 Paritytech via https://github.com/paritytech/schnorrkel-js/
+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
/* eslint-disable camelcase */
+13 -5
View File
@@ -1,8 +1,12 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
const rootIncl = ['@polkadot/wasm-crypto-asmjs', '@polkadot/wasm-crypto-wasm'];
const detcIncl = rootIncl.map((p) => `${p}/packageInfo`);
const rootIncl = ['@polkadot/wasm-crypto', '@polkadot/wasm-crypto-asmjs', '@polkadot/wasm-crypto-wasm'];
const detcIncl = [
...rootIncl.map((p) => `${p}/initOnlyAsm.cjs`),
...rootIncl.map((p) => `${p}/initOnlyWasm.cjs`),
...rootIncl.map((p) => `${p}/packageInfo.cjs`)
];
require('override-require')(
(request) =>
@@ -10,6 +14,10 @@ require('override-require')(
detcIncl.some((p) => request.endsWith(p)),
(request) =>
rootIncl.some((p) => request.endsWith(p))
? require(`${rootIncl.find((p) => request.endsWith(p))}/build/data.cjs`)
: require(`${detcIncl.find((p) => request.endsWith(p)).replace('packageInfo', 'build/packageInfo.cjs')}`)
? require(`${rootIncl.find((p) => request.endsWith(p))}/build/index.cjs`)
: require(`${detcIncl.find((p) => request.endsWith(p))
.replace('initOnlyAsm.cjs', 'build/initOnlyAsm.cjs')
.replace('initOnlyWasm.cjs', 'build/initOnlyWasm.cjs')
.replace('packageInfo.cjs', 'build/packageInfo.cjs')
}`)
);
+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
const { assert, u8aToHex } = require('@polkadot/util');
+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
const crypto = require('crypto');
+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
const { assert, stringToU8a, u8aToHex } = require('@polkadot/util');
+22 -13
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 wasm = require('../../build/index.cjs');
@@ -10,19 +10,22 @@ const sr25519 = require('./sr25519.cjs');
const vrf = require('./vrf.cjs');
const tests = {
...bip39,
...ed25519,
...hashing,
// We place secp256k1 first, this allows the interaction with it in the
// hashing (specifically scrypt) test not be an issue (ASM.js only)
// https://github.com/polkadot-js/wasm/issues/307
...secp256k1,
...ed25519,
...sr25519,
...vrf
...vrf,
...bip39,
...hashing
};
function beforeAll () {
return wasm.waitReady();
}
function runAll () {
function runAll (name) {
const failed = [];
let count = 0;
@@ -38,23 +41,29 @@ function runAll () {
console.timeEnd(name);
} catch (error) {
console.error();
console.error(error);
failed.push(name);
}
});
if (failed.length) {
throw new Error(`Failed: ${failed.length} of ${count}: ${failed.concat(', ')}`);
throw new Error(`\n*** ${name}: FAILED: ${failed.length} of ${count}: ${failed.join(', ')}`);
}
}
function runUnassisted () {
beforeAll()
.then(() => runAll())
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
function runUnassisted (name) {
console.log(`\n*** ${name}: Running tests`);
beforeAll()
.then(() => runAll(name))
.then(() => {
console.log(`\n*** ${name}: All passed`);
process.exit(0);
})
.catch((error) => {
console.error(error.message, '\n');
process.exit(-1);
});
}
+26 -3
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 { assert, hexToU8a, u8aToHex } = require('@polkadot/util');
@@ -21,7 +21,7 @@ function secp256k1Expand (wasm) {
assert(result === '0x04b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb1307763fe926c273235fd979a134076d00fd1683cbd35868cb485d4a3a640e52184af', 'ERROR: secp256k1Expand does not match');
}
function secp256k1FromSeed (wasm) {
function secp256k1FromSeed1 (wasm) {
const seckey = '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae';
const result = u8aToHex(wasm.secp256k1FromSeed(hexToU8a(seckey)));
@@ -30,6 +30,28 @@ function secp256k1FromSeed (wasm) {
assert(result === '0x4380de832af797688026ce24f85204d508243f201650c1a134929e5458b7fbae03fd8c74f795ced92064b86191cb2772b1e3a0947740aa0a5a6e379592471fd85b', 'ERROR: secp256k1FromSeed does not match');
}
function secp256k1FromSeed2 (wasm) {
// https://github.com/polkadot-js/wasm/issues/307
const seckey = new Uint8Array([
203, 109, 249, 222, 30, 252, 167, 163, 153, 138, 142,
173, 78, 2, 21, 157, 95, 169, 156, 62, 13, 79,
214, 67, 38, 103, 57, 11, 180, 114, 104, 84
]);
const expected = u8aToHex(new Uint8Array([
203, 109, 249, 222, 30, 252, 167, 163, 153, 138, 142,
173, 78, 2, 21, 157, 95, 169, 156, 62, 13, 79,
214, 67, 38, 103, 57, 11, 180, 114, 104, 84, 2,
10, 16, 145, 52, 31, 229, 102, 75, 250, 23, 130,
213, 224, 71, 121, 104, 144, 104, 201, 22, 176, 76,
179, 101, 236, 49, 83, 117, 86, 132, 217, 161
]));
const result = u8aToHex(wasm.secp256k1FromSeed(seckey));
console.log('\tRES', result);
assert(result === expected, 'ERROR: secp256k1FromSeed does not match');
}
function secp256k1Recover (wasm) {
const sig = '0x7505f2880114da51b3f5d535f8687953c0ab9af4ab81e592eaebebf53b728d2b6dfd9b5bcd70fee412b1f31360e7c2774009305cb84fc50c1d0ff8034dfa5fff';
const msg = '0xa30b64ce1eedf409c8afb801d72c05234e64849ea538c15dd3c8cf4ffcf166c9';
@@ -53,7 +75,8 @@ function secp256k1Sign (wasm) {
module.exports = {
secp256k1Compress,
secp256k1Expand,
secp256k1FromSeed,
secp256k1FromSeed1,
secp256k1FromSeed2,
secp256k1Recover,
secp256k1Sign
};
+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
const crypto = require('crypto');
+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
const crypto = require('crypto');
+3 -4
View File
@@ -1,10 +1,9 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
global.WebAssembly = null;
require('./alias-imports.cjs');
require('@polkadot/wasm-crypto/initOnlyAsm.cjs');
const { runUnassisted } = require('./all/index.cjs');
runUnassisted();
runUnassisted('ASM');
+1 -3
View File
@@ -1,12 +1,10 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/**
* @jest-environment jsdom
*/
// override-require in jest.config.js
import { beforeAll, tests, wasm } from './all/index.cjs';
describe('wasm-crypto', () => {
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2019-2021 @polkadot/wasm-crypto authors & contributors
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
require('./alias-imports.cjs');
const { runUnassisted } = require('./all/index.cjs');
runUnassisted();
runUnassisted('WASM');
+12
View File
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"references": [
{ "path": "../wasm-crypto-asmjs/tsconfig.build.json" },
{ "path": "../wasm-crypto-wasm/tsconfig.build.json" }
]
}
+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 { createBundle } from '@polkadot/dev/config/rollup';
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2021 @polkadot/wasm authors & contributors
# Copyright 2019-2022 @polkadot/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
+5 -7
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2021 @polkadot/wasm authors & contributors
# Copyright 2019-2022 @polkadot/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
@@ -26,7 +26,7 @@ echo "*** Converting to WASM"
# optimise
echo "*** Optimising WASM output"
../binaryen/bin/wasm-opt $WSM -Os -o $OPT
../binaryen/bin/wasm-opt $WSM -Oz -o $OPT
# convert wasm to base64 structure
echo "*** Packing WASM into baseX"
@@ -34,14 +34,12 @@ node ../scripts/pack-wasm-base.cjs
# build asmjs version from the input (optimised) WASM
echo "*** Building asm.js version"
../binaryen/bin/wasm2js --output $ASM $OPT
../binaryen/bin/wasm2js -Oz --output $ASM $OPT
# cleanup the generated asm, converting to cjs
sed -i -e '/import {/d' $ASM
sed -i -e '/export var /d' $ASM
sed -i -e 's/{abort.*},memasmFunc/wbg, memasmFunc/g' $ASM
sed -i -e 's/var retasmFunc = /const asmJsInit = (wbg) => /' $ASM
echo "module.exports = { asmJsInit };" >> $ASM
sed -i -e '1,/var retasmFunc = /!d' $ASM
sed -i -e 's/var retasmFunc = .*/const asmJsInit = (wbg) => asmFunc(wbg);\n\nmodule.exports = { asmJsInit };/g' $ASM
# cleanups
rm -rf wasm-crypto-asmjs/build/cjs/*-e
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2021 @polkadot/wasm authors & contributors
# Copyright 2019-2022 @polkadot/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
+2 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2021 @polkadot/wasm authors & contributors
# Copyright 2019-2022 @polkadot/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
@@ -7,4 +7,4 @@ set -e
# cleanup old
echo "*** Cleaning old builds"
rm -rf packages/*/build packages/bytes
rm -rf build packages/*/build packages/bytes
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2021 @polkadot/wasm authors & contributors
# Copyright 2019-2022 @polkadot/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
+8 -7
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2021 @polkadot/wasm authors & contributors
# Copyright 2019-2022 @polkadot/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
@@ -7,16 +7,17 @@ set -e
source ./scripts/rust-version.sh
BINARYEN_REPO=https://github.com/WebAssembly/binaryen
BINARYEN_VER=version_97
BINARYEN_ZIP=
# NOTE If this is bumped, bump the version in Cargo.toml as well
BINDGEN_REPO=https://github.com/rustwasm/wasm-bindgen
BINDGEN_VER=0.2.65
BINDGEN_VER=0.2.79
BINDGEN_ZIP=
BINARYEN_REPO=https://github.com/WebAssembly/binaryen
BINARYEN_VER=version_105
BINARYEN_ZIP=
WABT_REPO=https://github.com/WebAssembly/wabt
WABT_VER=1.0.19
WABT_VER=1.0.27
WABT_ZIP=
unamestr=`uname`
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2019-2021 @polkadot/wasm authors & contributors
// Copyright 2019-2022 @polkadot/wasm authors & contributors
// SPDX-License-Identifier: Apache-2.0
const fflate = require('fflate/node');
@@ -12,7 +12,7 @@ const compressed = Buffer.from(fflate.zlibSync(data, { level: 9 }));
console.log(`*** Compressed WASM: ${formatNumber(data.length)} -> ${formatNumber(compressed.length)} (${(100 * compressed.length / data.length).toFixed(2)}%)`);
fs.writeFileSync(`./${W_NAME}/build/cjs/bytes.js`, `// Copyright 2019-2021 @polkadot/${W_NAME} authors & contributors
fs.writeFileSync(`./${W_NAME}/build/cjs/bytes.js`, `// Copyright 2019-2022 @polkadot/${W_NAME} authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Generated as part of the build, do not edit
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2021 @polkadot/wasm authors & contributors
# Copyright 2019-2022 @polkadot/wasm authors & contributors
# This software may be modified and distributed under the terms
# of the Apache-2.0 license. See the LICENSE file for details.
+14
View File
@@ -0,0 +1,14 @@
{
"extends": "@polkadot/dev/config/tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {
"@polkadot/wasm-crypto-asmjs/packageInfo": ["wasm-crypto-asmjs/src/packageInfo"],
"@polkadot/wasm-crypto-asmjs": ["wasm-crypto-asmjs/src"],
"@polkadot/wasm-crypto-wasm/packageInfo": ["wasm-crypto-wasm/src/packageInfo"],
"@polkadot/wasm-crypto-wasm": ["wasm-crypto-wasm/src"],
"@polkadot/wasm-crypto": ["wasm-crypto/src"]
},
"skipLibCheck": true
}
}
+11
View File
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"composite": true
},
"files": [],
"references": [
{ "path": "./packages/wasm-crypto/tsconfig.build.json" },
{ "path": "./packages/wasm-crypto-asmjs/tsconfig.build.json" },
{ "path": "./packages/wasm-crypto-wasm/tsconfig.build.json" }
]
}
+15
View File
@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./packages",
"composite": false
},
"include": [
"packages/**/src/**/*",
"packages/**/test/**/*",
"scripts/**/*"
],
"exclude": [
"**/node_modules/**/*"
]
}
+10 -19
View File
@@ -1,22 +1,13 @@
{
"extends": "@polkadot/dev/config/tsconfig.json",
"exclude": [
"build/**/*",
"**/build/**/*"
],
"extends": "./tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@polkadot/wasm-crypto-asmjs/packageInfo": [ "packages/wasm-crypto-asmjs/src/packageInfo" ],
"@polkadot/wasm-crypto-asmjs": [ "packages/wasm-crypto-asmjs/src/data" ],
"@polkadot/wasm-crypto-wasm/packageInfo": [ "packages/wasm-crypto-wasm/src/packageInfo" ],
"@polkadot/wasm-crypto-wasm": [ "packages/wasm-crypto-wasm/src/data" ],
"@polkadot/wasm-crypto": [ "packages/wasm-crypto/src" ]
},
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@polkadot/ts",
"./node_modules/@types"
]
}
"baseUrl": "./packages",
"composite": false
},
"include": [
"packages/**/src/**/*"
],
"exclude": [
"**/node_modules/**/*"
]
}
+1546 -1475
View File
File diff suppressed because it is too large Load Diff