Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6c704eca8 | ||
|
|
c7053fa112 | ||
|
|
d76ab093a8 | ||
|
|
4a54a37ae1 | ||
|
|
0eb433f3c2 | ||
|
|
278ecc7210 | ||
|
|
03fe7dcb1d | ||
|
|
d99abde915 | ||
|
|
06502e8fe8 | ||
|
|
f3004fdb31 | ||
|
|
f5834e684f | ||
|
|
d7a1060824 | ||
|
|
c6f8748878 | ||
|
|
24a46c7262 | ||
|
|
78a282bda3 | ||
|
|
1713dccba3 | ||
|
|
0a22251212 | ||
|
|
540d46717b | ||
|
|
e5112e690d | ||
|
|
2f8c91fc15 | ||
|
|
6d552f1ced | ||
|
|
afa992b40b | ||
|
|
401c6e5763 | ||
|
|
76d051b16e | ||
|
|
5b69d5aadc | ||
|
|
780323538a | ||
|
|
042d653852 | ||
|
|
da47390fa4 | ||
|
|
488abd68bb | ||
|
|
d926ee63f4 | ||
|
|
6777f8ef5e | ||
|
|
1001083009 | ||
|
|
898b067081 | ||
|
|
acc07b9345 | ||
|
|
bc572b16d5 | ||
|
|
91d2530ea8 | ||
|
|
e679298d8d | ||
|
|
949ad77dab | ||
|
|
24ce35ae43 | ||
|
|
9e22f34720 | ||
|
|
2b867b2e91 | ||
|
|
230593ee17 | ||
|
|
60a3b8916c | ||
|
|
1f20fdf377 | ||
|
|
64dcd40bee | ||
|
|
f3948b90f7 | ||
|
|
83da578b60 | ||
|
|
407ec8e1a1 | ||
|
|
aa30920183 | ||
|
|
35d56606bd | ||
|
|
4083abb1dd | ||
|
|
c6cb3a9226 | ||
|
|
04d46701b1 | ||
|
|
61f4c5eb7d | ||
|
|
d0e99aebef | ||
|
|
dc752685d7 | ||
|
|
9bf3c1be07 | ||
|
|
32bd2172aa | ||
|
|
1f58821cd4 | ||
|
|
8352373fdd | ||
|
|
610fcee9cd | ||
|
|
b086928d01 | ||
|
|
8b3bd58e79 | ||
|
|
e6fd1e20a5 | ||
|
|
22075f8262 | ||
|
|
c8805a09dd | ||
|
|
758066b4ea | ||
|
|
da7c71c32f | ||
|
|
cb38c6f1c5 | ||
|
|
39d5b3bcce | ||
|
|
41c7af32c9 | ||
|
|
68d698502d | ||
|
|
3d4a87af6a | ||
|
|
77b1e338cf | ||
|
|
3af17400ba | ||
|
|
e16029776f | ||
|
|
61624a627b | ||
|
|
c964570806 | ||
|
|
f32846d41b | ||
|
|
705b08765b | ||
|
|
4f6771e758 | ||
|
|
731dee91e4 | ||
|
|
b82e28ad4e | ||
|
|
6d5b3f5404 | ||
|
|
1f643dd705 | ||
|
|
af9491f7fd | ||
|
|
7377da8e7e | ||
|
|
32fa12c3fa | ||
|
|
6aabb2f869 | ||
|
|
0edb0289a9 | ||
|
|
004996d772 | ||
|
|
7611fd1788 | ||
|
|
e4f85e2358 | ||
|
|
6c5e7deaa5 | ||
|
|
1f024c1da0 | ||
|
|
26b6cf843a | ||
|
|
8e54efe4a5 | ||
|
|
daecf47197 | ||
|
|
6f5ed67aad | ||
|
|
8556566c1d | ||
|
|
e28a5ffd4b | ||
|
|
7f3ca3159d | ||
|
|
3a3214e602 | ||
|
|
319f33bec1 | ||
|
|
a8f5189252 | ||
|
|
ee26a6ef98 | ||
|
|
71291442bb | ||
|
|
f26f855942 | ||
|
|
3a06871f82 | ||
|
|
279da24ca1 | ||
|
|
af81a69ba6 | ||
|
|
0b39c9d2f1 | ||
|
|
7d2de26fdb | ||
|
|
fc370eedb2 | ||
|
|
792baf352c | ||
|
|
a79d6ded77 | ||
|
|
51b45133d9 | ||
|
|
b3c934d602 | ||
|
|
25cd084f30 | ||
|
|
9df575ad7b | ||
|
|
0175ac56a7 | ||
|
|
e589fba3b1 | ||
|
|
570c46e889 | ||
|
|
4d002c7563 | ||
|
|
6aeaa69a8b | ||
|
|
4565f85077 | ||
|
|
0d0dcbf005 | ||
|
|
7e38ff8faf | ||
|
|
5640651945 | ||
|
|
657ac95ad9 | ||
|
|
23441ec34d | ||
|
|
b7768c369c | ||
|
|
646eabf516 | ||
|
|
ac36b68a5e | ||
|
|
390edd8b6d | ||
|
|
083eba1d8f | ||
|
|
0a70cc7cfb | ||
|
|
034f625118 | ||
|
|
919c4aa7d4 | ||
|
|
85350b15d2 | ||
|
|
fcc48bf20a | ||
|
|
c408836bc6 | ||
|
|
194d1a6cd4 | ||
|
|
fbb7d77f06 | ||
|
|
1536cd9b48 | ||
|
|
695ccae218 | ||
|
|
bd8d729765 | ||
|
|
2453c8728b | ||
|
|
f39f0d72f2 | ||
|
|
89739683f5 | ||
|
|
7f0c60b4f0 | ||
|
|
6ee5b6da86 | ||
|
|
68575449f1 | ||
|
|
ea7035a484 | ||
|
|
cbb7cd94f7 | ||
|
|
d0af71031f | ||
|
|
929401b8b6 | ||
|
|
778879b1c1 | ||
|
|
cadb0d9123 | ||
|
|
4e505bbe29 | ||
|
|
72cbdf6eaa | ||
|
|
a032cbce6e | ||
|
|
12a5b0da0f | ||
|
|
f1129ddcbb | ||
|
|
7d2a29d231 | ||
|
|
c5550ad559 | ||
|
|
d1fd2a74a4 | ||
|
|
f1d678132a | ||
|
|
784422a129 | ||
|
|
0a6b25fbdd | ||
|
|
6bc249181b | ||
|
|
a47fb3bff9 | ||
|
|
d21c3fc639 | ||
|
|
7da2f705dc | ||
|
|
69278851bc | ||
|
|
41dbf12257 | ||
|
|
7a8ce5ea3a | ||
|
|
7d24e46947 | ||
|
|
2bd507af55 | ||
|
|
7232fd88b5 | ||
|
|
dbfd08942a | ||
|
|
5d7a167d19 | ||
|
|
b5478b52b4 | ||
|
|
66f4af6dda | ||
|
|
74344c862c | ||
|
|
783476fd8d | ||
|
|
0a7af910e1 | ||
|
|
478cd6ffcf | ||
|
|
df61ff95ca | ||
|
|
9137bd9848 | ||
|
|
3479d7f63b | ||
|
|
a718bcbb0c | ||
|
|
ec1958dfde | ||
|
|
a1f6452a7d | ||
|
|
13e8c6af1d | ||
|
|
56f98e67a1 | ||
|
|
5023c02a73 | ||
|
|
3b286e6034 | ||
|
|
bccb16f691 | ||
|
|
aeae6c137e | ||
|
|
2a2bd06284 | ||
|
|
1310dca729 | ||
|
|
34f2b544f0 | ||
|
|
dde2f92445 | ||
|
|
b9ad508d27 | ||
|
|
ca7e44c25a | ||
|
|
a0de0ac427 | ||
|
|
2893343bf2 | ||
|
|
8b70740a18 | ||
|
|
5e54136fff | ||
|
|
35b4c38be4 | ||
|
|
e1b24a61c6 | ||
|
|
a71d353fff | ||
|
|
218d2b9217 | ||
|
|
0429de0429 | ||
|
|
5f18253ba8 | ||
|
|
b17de3422a | ||
|
|
935f92dd5b | ||
|
|
ea79adf45d | ||
|
|
e71807c2a3 | ||
|
|
04365b87a5 | ||
|
|
f5856d091b | ||
|
|
45554b753f | ||
|
|
5967b48515 | ||
|
|
2d85a62bb7 | ||
|
|
39ca57f059 | ||
|
|
5a08739f24 | ||
|
|
fe09bc21ed | ||
|
|
8706cdb9c2 | ||
|
|
498a58d95a | ||
|
|
2501f771a7 | ||
|
|
55aef41eee | ||
|
|
e14c249ae2 | ||
|
|
561abdbf0d | ||
|
|
964432c184 | ||
|
|
4944d228cd | ||
|
|
de4a6c69fe | ||
|
|
f3ffb229ff | ||
|
|
3910ad5241 | ||
|
|
e8cc388f3a | ||
|
|
888a5d00ed | ||
|
|
dcd5533149 | ||
|
|
f3a5b7e373 | ||
|
|
6f06fe6b2a | ||
|
|
ac96179904 | ||
|
|
c37f707b15 | ||
|
|
80f40a500c | ||
|
|
445863a940 | ||
|
|
30a8ab0d8c | ||
|
|
4a239f5ed5 | ||
|
|
3db8d49d11 | ||
|
|
9885b65cf0 | ||
|
|
5c867e0cd4 | ||
|
|
00b79f4f9f | ||
|
|
0f82e9c5d8 | ||
|
|
007fc9923a | ||
|
|
ccfe31d9b5 | ||
|
|
f921359f64 | ||
|
|
4463395dfe | ||
|
|
f4080e5754 | ||
|
|
c6bb302f9c | ||
|
|
6d7ace4291 | ||
|
|
53a62bec02 | ||
|
|
263caf3238 | ||
|
|
6e0d56e955 | ||
|
|
cf9d894556 | ||
|
|
1c1a10f14b | ||
|
|
7d3ce85684 | ||
|
|
5fd16cda08 | ||
|
|
87fc9d9ee1 | ||
|
|
bf1a4b7b7f | ||
|
|
4c10357c41 | ||
|
|
4ceb620462 | ||
|
|
97ef0b0dd6 | ||
|
|
a27a5ccf3c | ||
|
|
8e47fb20a1 | ||
|
|
a014aea1b4 | ||
|
|
18cb000218 | ||
|
|
0cb6566bab | ||
|
|
9ae9de4ac9 | ||
|
|
04ac7dd00d | ||
|
|
5a4a2fde71 | ||
|
|
71237d7df7 | ||
|
|
424b3fe653 | ||
|
|
7b56956fdd | ||
|
|
a991236fa3 | ||
|
|
168e862e3a | ||
|
|
1dfc6660ba | ||
|
|
21b47e7924 | ||
|
|
d6ce0d1bf8 | ||
|
|
c5cd242033 | ||
|
|
73d21079a4 | ||
|
|
e0edfa3cec | ||
|
|
674b3c7c12 | ||
|
|
16ecd2b8c2 | ||
|
|
ee575c2589 | ||
|
|
57c6b454f6 | ||
|
|
e66f1830b0 | ||
|
|
ea93565e11 | ||
|
|
8eabfef781 | ||
|
|
9bb9e8d241 | ||
|
|
6da8edae2c | ||
|
|
eae8054c0e | ||
|
|
fd7f9caca9 | ||
|
|
e12cffa958 | ||
|
|
7519e48482 | ||
|
|
24780d5723 | ||
|
|
06d74925ec | ||
|
|
6144148bc3 | ||
|
|
39d8fd81e0 | ||
|
|
a90ccb9718 | ||
|
|
2a28c02965 | ||
|
|
b032b2baf0 | ||
|
|
e111622377 | ||
|
|
21a5e14552 | ||
|
|
71d23d0d34 | ||
|
|
650320a18b | ||
|
|
e0172f3a7d | ||
|
|
8db05486c0 | ||
|
|
22328a1368 | ||
|
|
7dd2cf97e6 | ||
|
|
2191a78e19 | ||
|
|
856d97740e | ||
|
|
b80f22abae | ||
|
|
9dfc893309 | ||
|
|
1087c5b1cf | ||
|
|
781632d134 | ||
|
|
1e149c5844 | ||
|
|
8ba4a5afb3 | ||
|
|
5ec9f9f52e | ||
|
|
1a343bc065 | ||
|
|
3eff5e7a18 | ||
|
|
ed5f749d38 | ||
|
|
ab02a865b0 | ||
|
|
16fb3fe24c | ||
|
|
0378fba23c | ||
|
|
429eff7c2e | ||
|
|
068343a2cb | ||
|
|
5f91e4da6e | ||
|
|
d73f3598e4 | ||
|
|
a8e512a3d3 | ||
|
|
e35ceda7db | ||
|
|
2fc192f2d4 | ||
|
|
7c1c54a413 | ||
|
|
b2bf04e475 | ||
|
|
f0d95d63ad | ||
|
|
c2aba270ff | ||
|
|
59a2ba5135 | ||
|
|
77b3674d01 | ||
|
|
34779964ce | ||
|
|
a9aa786332 | ||
|
|
cd86d0bf35 | ||
|
|
6ce3e3d67c | ||
|
|
af4ed8a1db | ||
|
|
57248e7ce4 | ||
|
|
fe91118385 | ||
|
|
b36cd04348 | ||
|
|
8ae4176af6 | ||
|
|
775b64f1bd | ||
|
|
66ebae8c62 | ||
|
|
c925bcf8d9 | ||
|
|
beb995d507 | ||
|
|
1523a53e10 | ||
|
|
188f7d3edc | ||
|
|
6da14ce25b | ||
|
|
9cacf07fe3 | ||
|
|
d0258cb3f3 | ||
|
|
b5ae0089d1 | ||
|
|
e07bd1eb00 | ||
|
|
6d79a71d93 | ||
|
|
c3289ca919 | ||
|
|
b7648e5883 | ||
|
|
03b487ae81 | ||
|
|
b1350bd8b4 | ||
|
|
1516d23ea4 | ||
|
|
9abaae980f | ||
|
|
370a529668 | ||
|
|
b7486f4f3b | ||
|
|
ff4a877ef9 | ||
|
|
e0f741db37 | ||
|
|
3107861322 | ||
|
|
7eff345003 | ||
|
|
00f7da2136 | ||
|
|
150a143163 | ||
|
|
f31ec881ef | ||
|
|
0b838d2055 | ||
|
|
b68aefe64d | ||
|
|
9340c296ee | ||
|
|
132ed20d18 | ||
|
|
2927c37776 | ||
|
|
ac63788ecd | ||
|
|
0a64c9d329 | ||
|
|
81c9f3aa33 | ||
|
|
6fae33074a | ||
|
|
679b282061 | ||
|
|
396b4cb598 | ||
|
|
8b67b82047 | ||
|
|
da7d771898 | ||
|
|
42b5942886 | ||
|
|
d848c42bd3 | ||
|
|
e9d034928f | ||
|
|
2f042819ac | ||
|
|
2177d2f2cc | ||
|
|
4d974e4d7f | ||
|
|
cb05a1782a | ||
|
|
5f7cb7641a | ||
|
|
ff62f24cd4 | ||
|
|
d45dfb7dd2 | ||
|
|
1d4de873cb | ||
|
|
edfc1f0610 | ||
|
|
a662a23d19 | ||
|
|
7cff1c8736 | ||
|
|
6bfdebcff5 | ||
|
|
5b3158cb15 | ||
|
|
baa3439646 | ||
|
|
ac040bd62b | ||
|
|
e0a9e33623 | ||
|
|
b29f959dda | ||
|
|
7a5ec9d347 | ||
|
|
28ddad0549 | ||
|
|
615746a323 | ||
|
|
e49d5a3219 | ||
|
|
a31f7cac0d | ||
|
|
9b65fe6c86 | ||
|
|
3b5dcd41d9 | ||
|
|
f4db1385fc | ||
|
|
1b844254fe | ||
|
|
bf924e5da0 | ||
|
|
da37be391e | ||
|
|
2a44054387 | ||
|
|
4c85c4d336 | ||
|
|
03030ae93f | ||
|
|
ed438e8877 | ||
|
|
e7700787b2 | ||
|
|
6cccb7b9b0 | ||
|
|
f8678ed024 | ||
|
|
9b48e3dd36 | ||
|
|
f5db698705 | ||
|
|
2a24642220 | ||
|
|
5cd8ea6926 | ||
|
|
633b33430a | ||
|
|
341e57eeb5 | ||
|
|
2a9b79f086 | ||
|
|
fc5a7bf9ce | ||
|
|
fbb57dc9ca | ||
|
|
2358984605 | ||
|
|
28ae0b8963 | ||
|
|
4e316440b9 | ||
|
|
f9c65c8fb2 | ||
|
|
d3c5d1a617 | ||
|
|
b57cdaef14 | ||
|
|
1f2ad4ea36 | ||
|
|
4c3537d869 | ||
|
|
6f1ff9f276 |
@@ -1,8 +0,0 @@
|
||||
7
|
||||
|
||||
3.2.2
|
||||
3.2.3
|
||||
3.2.4
|
||||
|
||||
4.0.2
|
||||
4.1.2
|
||||
@@ -1,20 +0,0 @@
|
||||
checks:
|
||||
argument-count:
|
||||
config:
|
||||
threshold: 5
|
||||
method-complexity:
|
||||
config:
|
||||
threshold: 7
|
||||
method-count:
|
||||
config:
|
||||
threshold: 25
|
||||
method-lines:
|
||||
config:
|
||||
threshold: 30
|
||||
|
||||
exclude_patterns:
|
||||
- "**/*.spec.js"
|
||||
- "**/*.spec.ts"
|
||||
- "docs/**/*.js"
|
||||
- "**/test/**/*.js"
|
||||
- "packages/wasm-crypto-wasm/src/fflate.ts"
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const base = require('@polkadot/dev/config/eslint.cjs');
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
ignorePatterns: [
|
||||
...base.ignorePatterns,
|
||||
'**/target/*',
|
||||
'packages/bytes/*'
|
||||
],
|
||||
parserOptions: {
|
||||
...base.parserOptions,
|
||||
project: [
|
||||
'./tsconfig.eslint.json'
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
<!--
|
||||
|
||||
For general support, howto, coding and bundling questions, please
|
||||
use the Substrate & Polkadot StackExchange at
|
||||
|
||||
https://substrate.stackexchange.com/
|
||||
|
||||
and get other ecosystem developers involved. This issues in this
|
||||
repository are meant for the tracking of feature requests and bug
|
||||
reports.
|
||||
|
||||
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 ...**
|
||||
|
||||
<!---
|
||||
|
||||
REQUIRED:
|
||||
|
||||
Classify the type of report your are submitting
|
||||
|
||||
-->
|
||||
|
||||
- [ ] Bug report
|
||||
- [ ] Feature request
|
||||
- [ ] Support request
|
||||
- [ ] Other
|
||||
|
||||
|
||||
* **What is the current behavior and expected behavior?**
|
||||
|
||||
<!---
|
||||
|
||||
REQUIRED:
|
||||
|
||||
If you're describing a bug, tell us what should happen. If you're
|
||||
suggesting a change/improvement, tell us how it should work.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
* **What is the motivation for changing the behavior?**
|
||||
|
||||
<!---
|
||||
|
||||
OPTIONAL:
|
||||
|
||||
Suggest a motivation for the request or ideas how to implement the
|
||||
addition or change
|
||||
|
||||
-->
|
||||
|
||||
|
||||
* **Please tell us about your environment:**
|
||||
|
||||
<!---
|
||||
|
||||
REQUIRED:
|
||||
|
||||
Include as many relevant details about the environment in which you
|
||||
experienced the issue. Also ensure that you have tested against the
|
||||
latest stable releases if you believe this to be a bug
|
||||
|
||||
-->
|
||||
|
||||
- Version:
|
||||
- Environment:
|
||||
|
||||
- [ ] Node.js
|
||||
- [ ] Browser
|
||||
- [ ] Other (limited support for other environments)
|
||||
|
||||
- Language:
|
||||
|
||||
- [ ] JavaScript
|
||||
- [ ] TypeScript (include tsc --version)
|
||||
- [ ] Other
|
||||
@@ -9,8 +9,8 @@ jobs:
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: jacogr/action-approve@master
|
||||
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
|
||||
with:
|
||||
authors: jacogr
|
||||
authors: jacogr, TarikGul, valentinfernandez1
|
||||
labels: -auto
|
||||
token: ${{ secrets.GH_PAT_BOT }}
|
||||
|
||||
@@ -8,9 +8,9 @@ jobs:
|
||||
merge:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: jacogr/action-merge@master
|
||||
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
|
||||
with:
|
||||
checks: build,lint,test
|
||||
checks: pr (build),pr (lint),pr (test)
|
||||
labels: -auto
|
||||
strategy: squash
|
||||
token: ${{ secrets.GH_PAT_BOT }}
|
||||
|
||||
@@ -10,16 +10,16 @@ jobs:
|
||||
env:
|
||||
YARN_ENABLE_SCRIPTS: false
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2
|
||||
- uses: dessant/lock-threads@c1b35aecc5cdb1a34539d14196df55838bb2f836
|
||||
with:
|
||||
github-token: ${{ secrets.GH_PAT_BOT }}
|
||||
issue-lock-inactive-days: '7'
|
||||
issue-lock-comment: >
|
||||
issue-inactive-days: '7'
|
||||
issue-comment: >
|
||||
This thread has been automatically locked since there has not been
|
||||
any recent activity after it was closed. Please open a new issue
|
||||
if you think you have a related problem or query.
|
||||
pr-lock-inactive-days: '2'
|
||||
pr-lock-comment: >
|
||||
pr-inactive-days: '2'
|
||||
pr-comment: >
|
||||
This pull request has been automatically locked since there
|
||||
has not been any recent activity after it was closed.
|
||||
Please open a new issue for related bugs.
|
||||
|
||||
@@ -3,17 +3,28 @@ on: [pull_request]
|
||||
|
||||
jobs:
|
||||
pr:
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
step: ['lint', 'test', 'build']
|
||||
name: ${{ matrix.step }}
|
||||
step: ['lint', 'test', 'build', 'deno']
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
YARN_ENABLE_SCRIPTS: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- uses: denoland/setup-deno@v1
|
||||
with:
|
||||
deno-version: v1.42.x
|
||||
- name: ${{ matrix.step }}
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
run: |
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
./scripts/install-build-deps.sh
|
||||
yarn install --immutable
|
||||
if [ "${{ matrix.step }}" != "lint" ]; then
|
||||
./scripts/install-build-deps.sh
|
||||
fi
|
||||
yarn polkadot-dev-deno-map
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
@@ -10,21 +10,27 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
step: ['build:release']
|
||||
name: ${{ matrix.step }}
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
YARN_ENABLE_SCRIPTS: false
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
|
||||
GH_PAT: ${{ secrets.GH_PAT_BOT }}
|
||||
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
token: ${{ secrets.GH_PAT_BOT }}
|
||||
ref: ${{ github.ref }}
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
- name: Set Execute Permissions
|
||||
run: chmod +x ./scripts/*
|
||||
- name: Run Install Build Deps
|
||||
run: bash ./scripts/install-build-deps.sh
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
./scripts/install-build-deps.sh
|
||||
yarn install --immutable
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
name: Semgrep
|
||||
on:
|
||||
pull_request: {}
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
check:
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
YARN_ENABLE_SCRIPTS: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: returntocorp/semgrep-action@v1
|
||||
with:
|
||||
auditOn: push
|
||||
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
|
||||
publishDeployment: 1395
|
||||
@@ -1,19 +0,0 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '35 1/3 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
YARN_ENABLE_SCRIPTS: false
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GH_PAT_BOT }}
|
||||
stale-issue-message: 'This issue has been open for 21 days with no activity and is not labelled as an enhancement. It will be closed in 7 days.'
|
||||
stale-issue-label: 'stale'
|
||||
exempt-issue-labels: '-size-l,-size-m,-size-s,-size-xl,-size-xs,[bug]'
|
||||
days-before-stale: 21
|
||||
days-before-close: 7
|
||||
+3
-5
@@ -1,18 +1,16 @@
|
||||
binaryen/
|
||||
bindgen/
|
||||
build/
|
||||
build-cjs/
|
||||
build-esm/
|
||||
build-docs/
|
||||
build-wasm/
|
||||
build-*/
|
||||
bytes/
|
||||
coverage/
|
||||
docs/.vuepress/dist/
|
||||
node_modules/
|
||||
pkg/
|
||||
target/
|
||||
tmp/
|
||||
wabt/
|
||||
/import_map.json
|
||||
/mod.ts
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2022 @polkadot/dev authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports = require('@polkadot/dev/config/prettier.cjs');
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"eslint.enable": true,
|
||||
"eslint.experimental.useFlatConfig": true
|
||||
}
|
||||
Vendored
-363
File diff suppressed because one or more lines are too long
-550
File diff suppressed because one or more lines are too long
Vendored
-785
File diff suppressed because one or more lines are too long
+934
File diff suppressed because one or more lines are too long
+9
-7
@@ -1,13 +1,15 @@
|
||||
compressionLevel: mixed
|
||||
|
||||
enableGlobalCache: false
|
||||
|
||||
enableImmutableInstalls: false
|
||||
|
||||
enableProgressBars: false
|
||||
|
||||
logFilters:
|
||||
- code: YN0013
|
||||
level: discard
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
||||
spec: "@yarnpkg/plugin-version"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.2.0.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.6.0.cjs
|
||||
|
||||
+181
@@ -1,5 +1,186 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 7.5.2 Nov 10, 2025
|
||||
|
||||
Changes:
|
||||
|
||||
- Fix/Revert asm build ([#599](https://github.com/polkadot-js/wasm/pull/599))
|
||||
- Bump @polkadot dependencies ([#601](https://github.com/polkadot-js/wasm/pull/601))
|
||||
|
||||
|
||||
## 7.5.1 aug 25, 2025
|
||||
|
||||
Changes:
|
||||
|
||||
- Bump yarn to 4.5.1 ([#573](https://github.com/polkadot-js/wasm/pull/573))
|
||||
- Update comments and labels from 2024 to 2025 ([#574](https://github.com/polkadot-js/wasm/pull/574))
|
||||
- Bump yarn to 4.6.0 ([#575](https://github.com/polkadot-js/wasm/pull/575))
|
||||
- Set execute for build script in CI ([#576](https://github.com/polkadot-js/wasm/pull/576))
|
||||
- Set permissions on all scripts ([#577](https://github.com/polkadot-js/wasm/pull/577))
|
||||
- Bump dev to 0.83.2 ([#578](https://github.com/polkadot-js/wasm/pull/578))
|
||||
- chore: added check in ext_secp_recover for signature normalization ([#579](https://github.com/polkadot-js/wasm/pull/579))
|
||||
- chore: Improve CI ([#580](https://github.com/polkadot-js/wasm/pull/580))
|
||||
- Revert CI improvements and wasm-bindgen version ([#583](https://github.com/polkadot-js/wasm/pull/583))
|
||||
- Added validation checks in PBKDF2 and Scrypt hashing functions ([#584](https://github.com/polkadot-js/wasm/pull/584))
|
||||
- Rollback wasm-bindgen version change ([#586](https://github.com/polkadot-js/wasm/pull/586))
|
||||
- Fix rust version to 1.84 ([#587](https://github.com/polkadot-js/wasm/pull/587))
|
||||
- Default to installed rust version ([#588](https://github.com/polkadot-js/wasm/pull/588))
|
||||
- Default to nightly rust version ([#589](https://github.com/polkadot-js/wasm/pull/589))
|
||||
- Ci Fix ([#590](https://github.com/polkadot-js/wasm/pull/590))
|
||||
- Read lock file ([#591](https://github.com/polkadot-js/wasm/pull/591))
|
||||
- Setup nightly as default ([#592](https://github.com/polkadot-js/wasm/pull/592))
|
||||
- Tweak install-build-deps.sh script ([#593](https://github.com/polkadot-js/wasm/pull/593))
|
||||
- Remove ASM build ([#594](https://github.com/polkadot-js/wasm/pull/594))
|
||||
- Bump @polkadot deps ([#595](https://github.com/polkadot-js/wasm/pull/595))
|
||||
|
||||
|
||||
## 7.4.1 Oct 20, 2024
|
||||
|
||||
- Bump dev deps to 0.81.2
|
||||
- Bump TS
|
||||
- Ensure CJS is exported correctly
|
||||
- Bump yarn
|
||||
- Add missing sideEffect declarations
|
||||
- Set Deno build in CI to 1.42.x
|
||||
|
||||
|
||||
## 7.3.2 Dec 6, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Apply fixes for OOB array access
|
||||
|
||||
|
||||
## 7.3.1 Nov 17, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Drop support for Node 16 (EOL 11 Sep 2023)
|
||||
|
||||
|
||||
## 7.2.2 Aug 17, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust cjs exports for consistency
|
||||
- Adjust usage of `?.` as per (latest) linting rules
|
||||
|
||||
|
||||
## 7.2.1 May 13, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust `cjs/bytes.js` generation to follow `export.<var> = ...` form
|
||||
- Add `module` to `package.json` export map (ESM-only)
|
||||
|
||||
|
||||
## 7.1.2 Apr 28, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Apply `readonly` specifiers to private class fields where applicable
|
||||
- Adjust compilation output for `__internal__` class fields
|
||||
|
||||
|
||||
## 7.1.1 Apr 22, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Add `wasm-util` as dependency where `x-randomvalues` is a peer
|
||||
- Drop support for Node 14 (EOL 30 Apr 2023)
|
||||
|
||||
|
||||
## 7.0.3 Mar 11, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Use consistent `.js` imports in source files (TS moduleResolution)
|
||||
|
||||
|
||||
## 7.0.2 Mar 4, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Update to latest `@polkadot/dev` (w/ tsc jsx detection output changes)
|
||||
|
||||
|
||||
## 7.0.1 Mar 4, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Swap TS -> JS compiler to use tsc (from babel)
|
||||
- Adjust all tests to use `node:test` runner (ESM & CJS variants)
|
||||
|
||||
|
||||
## 6.4.1 Dec 3, 2022
|
||||
|
||||
Changes:
|
||||
|
||||
- Add `/*#__PURE__*/` annotations for specific `export const something = someFunction(...)`
|
||||
|
||||
|
||||
## 6.3.1 Jul 21, 2022
|
||||
|
||||
Changes:
|
||||
|
||||
- Optimize packed WASM base64 decoding loop
|
||||
- Adjust test environment (no duplication)
|
||||
- Adjust CI check steps, align with other org repos
|
||||
- Remove unneeded `import_map.in.json` for Deno tests
|
||||
|
||||
|
||||
## 6.2.3 Jul 7, 2022
|
||||
|
||||
Changes:
|
||||
|
||||
- Optimize WASM init with pre-allocated buffers
|
||||
- Additional platform-specific tests
|
||||
|
||||
|
||||
## 6.2.2 Jul 4, 2022
|
||||
|
||||
Changes:
|
||||
|
||||
- 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:
|
||||
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
417 Jaco 6.1.1 (#350)
|
||||
618 Jaco 2024 (#559)
|
||||
19 Tarik Gul Bump dev to 0.83.2 (#578)
|
||||
12 Valentin Fernandez 7.5.1 (#596)
|
||||
6 rajk93 7.5.2 (#602)
|
||||
1 Evgeny Fixed type (#121)
|
||||
1 Shunfan Zhou Support sr25519 agreement (#209)
|
||||
1 Steve Degosserie Expose Schnorrkel's VRF capabilities (#170)
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
[](https://polkadot.js.org)
|
||||

|
||||
[](https://www.npmjs.com/package/@polkadot/wasm-crypto)
|
||||
[](https://www.npmjs.com/package/@polkadot/wasm-crypto)
|
||||
[](https://codeclimate.com/github/polkadot-js/wasm/maintainability)
|
||||
|
||||
# @polkadot/wasm
|
||||
|
||||
Various WASM wrappers around Rust crates
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports = require('@polkadot/dev/config/babel-config-cjs.cjs');
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import baseConfig from '@polkadot/dev/config/eslint';
|
||||
|
||||
export default [
|
||||
...baseConfig,
|
||||
{
|
||||
ignores: [
|
||||
'mod.ts'
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"imports": {
|
||||
"https://esm.sh/v90/@types/bn.js@~5.2/index.d.ts": "https://esm.sh/v90/@types/bn.js@5.1.0/index.d.ts"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const config = require('@polkadot/dev/config/jest.cjs');
|
||||
|
||||
module.exports = {
|
||||
...config,
|
||||
moduleNameMapper: {
|
||||
'@polkadot/wasm-crypto-(init|asmjs|wasm)(.*)$': '<rootDir>/packages/wasm-crypto-$1/build/$2',
|
||||
// eslint-disable-next-line sort-keys
|
||||
'@polkadot/wasm-(bridge|crypto|util)(.*)$': '<rootDir>/packages/wasm-$1/build/$2'
|
||||
}
|
||||
};
|
||||
+22
-10
@@ -1,42 +1,54 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/wasm/issues",
|
||||
"engines": {
|
||||
"node": ">=18.14"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/wasm#readme",
|
||||
"license": "Apache-2.0",
|
||||
"packageManager": "yarn@3.2.0",
|
||||
"packageManager": "yarn@4.6.0",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"version": "6.1.1",
|
||||
"type": "module",
|
||||
"version": "7.5.2",
|
||||
"versions": {
|
||||
"git": "7.5.2",
|
||||
"npm": "7.5.2"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"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",
|
||||
"clean": "./scripts/clean.sh",
|
||||
"deno": "yarn deno:build && yarn deno:check",
|
||||
"deno:build": "WITH_DENO=1 yarn build",
|
||||
"deno:check": "deno check --import-map=import_map.json mod.ts",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
"test": "yarn test:wasm-crypto:rust",
|
||||
"test:js": "yarn test:wasm-crypto:js",
|
||||
"test:wasm-crypto:deno": "deno test --allow-read --import-map=import_map.json packages/wasm-crypto/test/deno.ts",
|
||||
"test:wasm-crypto:js": "yarn test:wasm-crypto:js:jest && yarn test:wasm-crypto:js:node",
|
||||
"test:wasm-crypto:js:jest": "polkadot-dev-run-test ./test/jest.spec.js",
|
||||
"test:wasm-crypto:js:node": "cd packages/wasm-crypto && node ./test/wasm.cjs && node ./test/asm.cjs",
|
||||
"test:wasm-crypto:js:jest": "polkadot-dev-run-test --env node --loader ./packages/wasm-crypto/test/loader-build.js",
|
||||
"test:wasm-crypto:js:node": "node --no-warnings --loader ./packages/wasm-crypto/test/loader-build.js ./packages/wasm-crypto/test/wasm.js && node --no-warnings --loader ./packages/wasm-crypto/test/loader-build.js ./packages/wasm-crypto/test/asm.js",
|
||||
"test:wasm-crypto:rust": "cd packages/wasm-crypto && RUST_BACKTRACE=full cargo test --release -- --test-threads=1 --nocapture"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.10",
|
||||
"@polkadot/dev": "^0.66.21",
|
||||
"fflate": "^0.7.3",
|
||||
"override-require": "^1.1.1"
|
||||
"@polkadot/dev": "^0.83.3",
|
||||
"@polkadot/util": "^13.5.7",
|
||||
"@types/node": "^20.16.1",
|
||||
"fflate": "^0.8.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"typescript": "^4.6.4"
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1 +1,3 @@
|
||||
# @polkadot/wasm-bridge
|
||||
|
||||
A re-usable bridge between JS & WASM interfaces. It is used internally by `@polkadot/wasm-crypto`.
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/wasm/issues",
|
||||
"contributors": [],
|
||||
"description": "A bridge layer between JS and Wasm",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=18"
|
||||
},
|
||||
"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",
|
||||
@@ -16,18 +14,19 @@
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "6.1.1",
|
||||
"version": "7.5.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.17.9"
|
||||
"@polkadot/wasm-util": "7.5.2",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^9.1.1",
|
||||
"@polkadot/x-randomvalues": "^9.1.1"
|
||||
"@polkadot/util": "^13.5.7",
|
||||
"@polkadot/x-randomvalues": "^13.5.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*",
|
||||
|
||||
@@ -1,24 +1,38 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// A number of functions are "unsafe" and purposefully so - it is
|
||||
// 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 } from './types';
|
||||
import type { BridgeBase, InitFn, InitPromise, WasmBaseInstance, WasmImports } from './types.js';
|
||||
|
||||
import { stringToU8a, u8aToString } from '@polkadot/util';
|
||||
|
||||
import { Wbg } from './wbg';
|
||||
import { Wbg } from './wbg.js';
|
||||
|
||||
/**
|
||||
* @name Bridge
|
||||
* @description
|
||||
* Creates a bridge between the JS and WASM environments.
|
||||
*
|
||||
* For any bridge it is passed an function which is then called internally at the
|
||||
* time of initialization. This affectively implements the layer between WASM and
|
||||
* the native environment, providing all the plumbing needed for the Wbg classes.
|
||||
*/
|
||||
export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
readonly #createWasm: InitFn<C>;
|
||||
readonly #heap: unknown[];
|
||||
readonly #wbg: WasmImports;
|
||||
|
||||
#cachegetInt32: Int32Array | null;
|
||||
#cachegetUint8: Uint8Array | null;
|
||||
#createWasm: InitFn<C>;
|
||||
#heap: unknown[];
|
||||
#heapNext: number;
|
||||
#wasm: C | null;
|
||||
#wasmError: string | null;
|
||||
#wasmPromise: InitPromise<C> | null;
|
||||
#wbg: WebAssembly.ModuleImports;
|
||||
#type: 'asm' | 'wasm' | 'none';
|
||||
|
||||
constructor (createWasm: InitFn<C>) {
|
||||
@@ -36,22 +50,22 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
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;
|
||||
}
|
||||
|
||||
get wbg (): WebAssembly.ModuleImports {
|
||||
return this.#wbg;
|
||||
}
|
||||
|
||||
/** @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);
|
||||
@@ -66,10 +80,18 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
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;
|
||||
@@ -79,6 +101,10 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
this.#heapNext = idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @description Retrieves and removes an object to the heap
|
||||
*/
|
||||
takeObject (idx: number): unknown {
|
||||
const ret = this.getObject(idx);
|
||||
|
||||
@@ -87,6 +113,10 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
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);
|
||||
@@ -100,6 +130,10 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
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);
|
||||
@@ -108,6 +142,10 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
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);
|
||||
@@ -116,14 +154,26 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
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);
|
||||
|
||||
@@ -132,10 +182,18 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
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];
|
||||
@@ -146,6 +204,10 @@ export class Bridge<C extends WasmBaseInstance> implements BridgeBase<C> {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @description Retrieve a string from the WASM interface
|
||||
*/
|
||||
resultString (): string {
|
||||
return u8aToString(this.resultU8a());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './bridge';
|
||||
export * from './init';
|
||||
export * from './wbg';
|
||||
export * from './bridge.js';
|
||||
export * from './init.js';
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export default [];
|
||||
@@ -1,11 +0,0 @@
|
||||
// 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);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle';
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-bundle authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn, InitPromise, InitResult, WasmBaseInstance } from './types';
|
||||
import type { InitFn, InitPromise, InitResult, WasmBaseInstance, WasmImports } from './types.js';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
export function createWasmFn <C extends WasmBaseInstance> (root: string, wasmBytes: null | Uint8Array, asmFn: null | ((wbg: WebAssembly.ModuleImports) => C)): InitFn<C> {
|
||||
return async (wbg: WebAssembly.ModuleImports): InitPromise<C> => {
|
||||
/**
|
||||
* @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: 'crypto', wasmBytes: null | Uint8Array, asmFn: null | ((wbg: WasmImports) => C)): InitFn<C> {
|
||||
return async (wbg: WasmImports): InitPromise<C> => {
|
||||
const result: InitResult<C> = {
|
||||
error: null,
|
||||
type: 'none',
|
||||
@@ -14,7 +20,11 @@ export function createWasmFn <C extends WasmBaseInstance> (root: string, wasmByt
|
||||
};
|
||||
|
||||
try {
|
||||
assert(typeof WebAssembly === 'object' && typeof WebAssembly.instantiate === 'function' && wasmBytes && wasmBytes.length, 'WebAssembly is not available in your environment');
|
||||
if (!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 });
|
||||
|
||||
@@ -22,7 +32,7 @@ export function createWasmFn <C extends WasmBaseInstance> (root: string, wasmByt
|
||||
result.type = 'wasm';
|
||||
} catch (error) {
|
||||
// if we have a valid supplied asm.js, return that
|
||||
if (asmFn) {
|
||||
if (typeof asmFn === 'function') {
|
||||
result.wasm = asmFn(wbg);
|
||||
result.type = 'asm';
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './index.js';
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, []);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2022 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '6.1.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-bridge', path: 'auto', type: 'auto', version: '7.5.2' };
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
// 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 interface WasmMemory { buffer: ArrayBuffer }
|
||||
|
||||
export declare interface InitResult<C extends WasmBaseInstance> {
|
||||
error: string | null;
|
||||
@@ -11,11 +17,9 @@ export declare interface InitResult<C extends WasmBaseInstance> {
|
||||
|
||||
export type InitPromise <C extends WasmBaseInstance> = Promise<InitResult<C>>;
|
||||
|
||||
export type InitFn <C extends WasmBaseInstance> = (wbg: WebAssembly.ModuleImports) => InitPromise<C>;
|
||||
export type InitFn <C extends WasmBaseInstance> = (wbg: WasmImports) => InitPromise<C>;
|
||||
|
||||
export interface BridgeBase<C extends WasmBaseInstance> extends InitResult<C> {
|
||||
wbg: WebAssembly.ModuleImports;
|
||||
|
||||
init (createWasm?: InitFn<C>): Promise<C | null>;
|
||||
getObject (idx: number): unknown;
|
||||
dropObject (idx: number): void;
|
||||
@@ -31,13 +35,13 @@ export interface BridgeBase<C extends WasmBaseInstance> extends InitResult<C> {
|
||||
resultString (): string;
|
||||
}
|
||||
|
||||
export interface WasmBaseInstance {
|
||||
memory: WebAssembly.Memory;
|
||||
|
||||
// wbindgen functions (required and used internally)
|
||||
|
||||
export interface WasmBindGen {
|
||||
__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;
|
||||
}
|
||||
|
||||
export interface WasmBaseInstance extends WasmBindGen {
|
||||
memory: WasmMemory;
|
||||
}
|
||||
|
||||
@@ -1,67 +1,80 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-bridge authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-bridge authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BridgeBase, WasmBaseInstance } from './types';
|
||||
import type { BridgeBase, WasmBaseInstance } from './types.js';
|
||||
|
||||
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>;
|
||||
readonly #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)}`);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
/** @internal */
|
||||
__wbg_crypto_968f1772287e2df0 = (_idx: number): number => {
|
||||
return this.#bridge.addObject(DEFAULT_CRYPTO);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
/** @internal */
|
||||
__wbg_getRandomValues_a3d34b4fee3c2869 = (_idx: number): number => {
|
||||
return this.#bridge.addObject(DEFAULT_CRYPTO.getRandomValues);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
/** @internal */
|
||||
__wbg_getRandomValues_f5e14ab7ac8e995d = (_arg0: number, ptr: number, len: number): void => {
|
||||
DEFAULT_CRYPTO.getRandomValues(this.#bridge.getU8a(ptr, len));
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
/** @internal */
|
||||
__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);
|
||||
};
|
||||
}
|
||||
|
||||
export function initWbg <C extends WasmBaseInstance> (bridge: BridgeBase<C>): Wbg<C> {
|
||||
return new Wbg(bridge);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"references": [
|
||||
]
|
||||
"exclude": [
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
## @polkadot/wasm-crypto-asmjs
|
||||
|
||||
Asm.js build outputs.
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/wasm/issues",
|
||||
"contributors": [],
|
||||
"description": "Asm.js content for wasm-crypto",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=18"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-asmjs#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/wasm-crypto-asmjs",
|
||||
"repository": {
|
||||
"directory": "packages/wasm-crypto-asmjs",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"sideEffects": [
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "6.1.1",
|
||||
"version": "7.5.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.17.9"
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^9.1.1"
|
||||
"@polkadot/util": "^13.5.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { asmJsInit } from './cjs/data.js';
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const data = require('../data');
|
||||
const data = require('../data.js');
|
||||
|
||||
module.exports = data;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const asmJsInit: null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const asmJsInit = null;
|
||||
|
||||
module.exports.asmJsInit = asmJsInit;
|
||||
exports.asmJsInit = asmJsInit;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const asmJsInit: null;
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export const asmJsInit = null;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export default [];
|
||||
@@ -1,11 +0,0 @@
|
||||
// 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);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle';
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './index.js';
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, []);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2022 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-asmjs authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '6.1.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-asmjs', path: 'auto', type: 'auto', version: '7.5.2' };
|
||||
|
||||
@@ -5,5 +5,8 @@
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"exclude": [
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
## @polkadot/wasm-crypto-init
|
||||
|
||||
Internal `@polkadot/wasm-crypto` initialization functions for Browser, Node & RN.
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/wasm/issues",
|
||||
"contributors": [],
|
||||
"description": "Init handlers for wasm-crypto",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=18"
|
||||
},
|
||||
"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",
|
||||
@@ -16,24 +14,27 @@
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "6.1.1",
|
||||
"version": "7.5.2",
|
||||
"browser": "wasm.js",
|
||||
"main": "wasm.js",
|
||||
"react-native": "asm.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.17.9",
|
||||
"@polkadot/wasm-bridge": "6.1.1",
|
||||
"@polkadot/wasm-crypto-asmjs": "6.1.1",
|
||||
"@polkadot/wasm-crypto-wasm": "6.1.1"
|
||||
"@polkadot/wasm-bridge": "7.5.2",
|
||||
"@polkadot/wasm-crypto-asmjs": "7.5.2",
|
||||
"@polkadot/wasm-crypto-wasm": "7.5.2",
|
||||
"@polkadot/wasm-util": "7.5.2",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^9.1.1"
|
||||
"@polkadot/util": "^13.5.7",
|
||||
"@polkadot/x-randomvalues": "^13.5.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*"
|
||||
"@polkadot/util": "*",
|
||||
"@polkadot/x-randomvalues": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
import type { WasmCryptoInstance } from './types';
|
||||
import type { WasmCryptoInstance } from './types.js';
|
||||
|
||||
import { createWasmFn } from '@polkadot/wasm-bridge';
|
||||
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', null, asmJsInit);
|
||||
/**
|
||||
* @name createWasm
|
||||
* @description
|
||||
* Creates an interface using only ASM.js
|
||||
*/
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', null, asmJsInit);
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
import type { WasmCryptoInstance } from './types';
|
||||
import type { WasmCryptoInstance } from './types.js';
|
||||
|
||||
import { createWasmFn } from '@polkadot/wasm-bridge';
|
||||
import { asmJsInit } from '@polkadot/wasm-crypto-asmjs';
|
||||
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', wasmBytes, asmJsInit);
|
||||
/**
|
||||
* @name createWasm
|
||||
* @description
|
||||
* Creates an interface using WASM and a fallback ASM.js
|
||||
*/
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', wasmBytes, asmJsInit);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './wasm';
|
||||
export * from './wasm.js';
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// 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];
|
||||
@@ -1,11 +0,0 @@
|
||||
// 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);
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './wasm.js';
|
||||
@@ -1,11 +1,16 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
import type { WasmCryptoInstance } from './types';
|
||||
import type { WasmCryptoInstance } from './types.js';
|
||||
|
||||
import { createWasmFn } from '@polkadot/wasm-bridge';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', null, null);
|
||||
/**
|
||||
* @name createWasm
|
||||
* @description
|
||||
* Creates an interface using no WASM and no ASM.js
|
||||
*/
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', null, null);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
import { packageInfo as bridgeInfo } from '@polkadot/wasm-bridge/packageInfo';
|
||||
import { packageInfo as asmInfo } from '@polkadot/wasm-crypto-asmjs/packageInfo';
|
||||
import { packageInfo as wasmInfo } from '@polkadot/wasm-crypto-wasm/packageInfo';
|
||||
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, [asmInfo, bridgeInfo, wasmInfo]);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2022 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '6.1.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-init', path: 'auto', type: 'auto', version: '7.5.2' };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { WasmBaseInstance } from '@polkadot/wasm-bridge/types';
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-init authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-init authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
import type { WasmCryptoInstance } from './types';
|
||||
import type { WasmCryptoInstance } from './types.js';
|
||||
|
||||
import { createWasmFn } from '@polkadot/wasm-bridge';
|
||||
import { wasmBytes } from '@polkadot/wasm-crypto-wasm';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = createWasmFn('crypto', wasmBytes, null);
|
||||
/**
|
||||
* @name createWasm
|
||||
* @description
|
||||
* Creates an interface using only WASM
|
||||
*/
|
||||
export const createWasm: InitFn<WasmCryptoInstance> = /*#__PURE__*/ createWasmFn('crypto', wasmBytes, null);
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"exclude": [
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../wasm-bridge/tsconfig.build.json" },
|
||||
{ "path": "../wasm-crypto-asmjs/tsconfig.build.json" },
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
## @polkadot/wasm-crypto-wasm
|
||||
|
||||
Wasm build outputs.
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/wasm/issues",
|
||||
"contributors": [],
|
||||
"description": "Wasm content for wasm-crypto",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=18"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/wasm/tree/master/packages/wasm-crypto-wasm#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/wasm-crypto-wasm",
|
||||
"repository": {
|
||||
"directory": "packages/wasm-crypto-wasm",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"sideEffects": [
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "6.1.1",
|
||||
"version": "7.5.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.17.9",
|
||||
"@polkadot/wasm-util": "6.1.1"
|
||||
"@polkadot/wasm-util": "7.5.2",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^9.1.1"
|
||||
"@polkadot/util": "^13.5.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*"
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { base64Decode, unzlibSync } from '@polkadot/wasm-util';
|
||||
|
||||
import { bytes, sizeUncompressed } from './cjs/bytes';
|
||||
import { bytes, lenIn, lenOut } from './cjs/bytes.js';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export const wasmBytes = unzlibSync(base64Decode(bytes), new Uint8Array(sizeUncompressed));
|
||||
/**
|
||||
* @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 from this
|
||||
* specific format and returned.
|
||||
*/
|
||||
export const wasmBytes = /*#__PURE__*/ unzlibSync(base64Decode(bytes, new Uint8Array(lenIn)), new Uint8Array(lenOut));
|
||||
|
||||
+6
-4
@@ -1,6 +1,8 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const bytes = '';
|
||||
export declare const sizeCompressed = 0;
|
||||
export declare const sizeUncompressed = 0;
|
||||
export declare const bytes: string;
|
||||
|
||||
export declare const lenIn: number;
|
||||
|
||||
export declare const lenOut: number;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports.bytes = '';
|
||||
exports.lenIn = 0;
|
||||
|
||||
module.exports.sizeCompressed = 0;
|
||||
exports.lenOut = 0;
|
||||
|
||||
module.exports.sizeUncompressed = 0;
|
||||
exports.bytes = '';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const bytes = require('../bytes');
|
||||
const bytes = require('../bytes.js');
|
||||
|
||||
module.exports = bytes;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export declare const bytes: string;
|
||||
|
||||
export declare const lenIn: number;
|
||||
|
||||
export declare const lenOut: number;
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export const bytes = '';
|
||||
|
||||
export const lenIn = 0;
|
||||
|
||||
export const lenOut = 0;
|
||||
@@ -1,4 +0,0 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export default [];
|
||||
@@ -1,11 +0,0 @@
|
||||
// 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);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle';
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './index.js';
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// (packageInfo imports will be kept as-is, user-editable)
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo.js';
|
||||
|
||||
detectPackage(packageInfo, null, []);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2022 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// Copyright 2017-2025 @polkadot/wasm-crypto-wasm authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '6.1.1' };
|
||||
export const packageInfo = { name: '@polkadot/wasm-crypto-wasm', path: 'auto', type: 'auto', version: '7.5.2' };
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"exclude": [
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../wasm-util/tsconfig.build.json" }
|
||||
]
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -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));
|
||||
```
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[dependencies]
|
||||
std = { default-features = false, features = ["panic_immediate_abort"] }
|
||||
std = { default-features = false, features = ["panic_immediate_abort"] }
|
||||
@@ -1,14 +1,12 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/wasm/issues",
|
||||
"contributors": [],
|
||||
"description": "A wasm interface layer for use by @polkadot/util-crypto",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=18"
|
||||
},
|
||||
"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",
|
||||
@@ -16,8 +14,6 @@
|
||||
"url": "https://github.com/polkadot-js/wasm.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs",
|
||||
"./initNone.js",
|
||||
"./initNone.cjs",
|
||||
"./initOnlyAsm.js",
|
||||
@@ -25,23 +21,27 @@
|
||||
"./initOnlyWasm.js",
|
||||
"./initOnlyWasm.cjs",
|
||||
"./initWasmAsm.js",
|
||||
"./initWasmAsm.cjs"
|
||||
"./initWasmAsm.cjs",
|
||||
"./packageDetect.js",
|
||||
"./packageDetect.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "6.1.1",
|
||||
"version": "7.5.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.17.9",
|
||||
"@polkadot/wasm-bridge": "6.1.1",
|
||||
"@polkadot/wasm-crypto-asmjs": "6.1.1",
|
||||
"@polkadot/wasm-crypto-init": "6.1.1",
|
||||
"@polkadot/wasm-crypto-wasm": "6.1.1",
|
||||
"@polkadot/wasm-util": "6.1.1"
|
||||
"@polkadot/wasm-bridge": "7.5.2",
|
||||
"@polkadot/wasm-crypto-asmjs": "7.5.2",
|
||||
"@polkadot/wasm-crypto-init": "7.5.2",
|
||||
"@polkadot/wasm-crypto-wasm": "7.5.2",
|
||||
"@polkadot/wasm-util": "7.5.2",
|
||||
"tslib": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "^9.1.1"
|
||||
"@polkadot/util": "^13.5.7",
|
||||
"@polkadot/x-randomvalues": "^13.5.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "*"
|
||||
"@polkadot/util": "*",
|
||||
"@polkadot/x-randomvalues": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,215 +1,232 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { WasmCryptoInstance } from '@polkadot/wasm-crypto-init/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
import { bridge, initBridge } from './init.js';
|
||||
|
||||
import { bridge, initBridge } from './init';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export { bridge };
|
||||
|
||||
// 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
|
||||
: [];
|
||||
|
||||
/**
|
||||
* @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> => {
|
||||
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.');
|
||||
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 fn(bridge.wasm, ...params) as ReturnType<F>;
|
||||
};
|
||||
}
|
||||
|
||||
export const bip39Generate = withWasm((wasm, words: 12 | 15 | 18 | 21 | 24): string => {
|
||||
export const bip39Generate = /*#__PURE__*/ withWasm((wasm, words: 12 | 15 | 18 | 21 | 24): string => {
|
||||
wasm.ext_bip39_generate(8, words);
|
||||
|
||||
return bridge.resultString();
|
||||
});
|
||||
|
||||
export const bip39ToEntropy = withWasm((wasm, phrase: string): Uint8Array => {
|
||||
export const bip39ToEntropy = /*#__PURE__*/ withWasm((wasm, phrase: string): Uint8Array => {
|
||||
wasm.ext_bip39_to_entropy(8, ...bridge.allocString(phrase));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const bip39ToMiniSecret = withWasm((wasm, phrase: string, password: string): Uint8Array => {
|
||||
export const bip39ToMiniSecret = /*#__PURE__*/ withWasm((wasm, phrase: string, password: string): Uint8Array => {
|
||||
wasm.ext_bip39_to_mini_secret(8, ...bridge.allocString(phrase), ...bridge.allocString(password));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const bip39ToSeed = withWasm((wasm, phrase: string, password: string): Uint8Array => {
|
||||
export const bip39ToSeed = /*#__PURE__*/ withWasm((wasm, phrase: string, password: string): Uint8Array => {
|
||||
wasm.ext_bip39_to_seed(8, ...bridge.allocString(phrase), ...bridge.allocString(password));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const bip39Validate = withWasm((wasm, phrase: string): boolean => {
|
||||
export const bip39Validate = /*#__PURE__*/ withWasm((wasm, phrase: string): boolean => {
|
||||
const ret = wasm.ext_bip39_validate(...bridge.allocString(phrase));
|
||||
|
||||
return ret !== 0;
|
||||
});
|
||||
|
||||
export const ed25519KeypairFromSeed = withWasm((wasm, seed: Uint8Array): Uint8Array => {
|
||||
export const ed25519KeypairFromSeed = /*#__PURE__*/ withWasm((wasm, seed: Uint8Array): Uint8Array => {
|
||||
wasm.ext_ed_from_seed(8, ...bridge.allocU8a(seed));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const ed25519Sign = withWasm((wasm, pubkey: Uint8Array, seckey: Uint8Array, message: Uint8Array): Uint8Array => {
|
||||
export const ed25519Sign = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, seckey: Uint8Array, message: Uint8Array): Uint8Array => {
|
||||
wasm.ext_ed_sign(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(seckey), ...bridge.allocU8a(message));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const ed25519Verify = withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
|
||||
export const ed25519Verify = /*#__PURE__*/ withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
|
||||
const ret = wasm.ext_ed_verify(...bridge.allocU8a(signature), ...bridge.allocU8a(message), ...bridge.allocU8a(pubkey));
|
||||
|
||||
return ret !== 0;
|
||||
});
|
||||
|
||||
export const secp256k1FromSeed = withWasm((wasm, seckey: Uint8Array): Uint8Array => {
|
||||
export const secp256k1FromSeed = /*#__PURE__*/ withWasm((wasm, seckey: Uint8Array): Uint8Array => {
|
||||
wasm.ext_secp_from_seed(8, ...bridge.allocU8a(seckey));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const secp256k1Compress = withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
|
||||
export const secp256k1Compress = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
|
||||
wasm.ext_secp_pub_compress(8, ...bridge.allocU8a(pubkey));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const secp256k1Expand = withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
|
||||
export const secp256k1Expand = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array): Uint8Array => {
|
||||
wasm.ext_secp_pub_expand(8, ...bridge.allocU8a(pubkey));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const secp256k1Recover = withWasm((wasm, msgHash: Uint8Array, sig: Uint8Array, recovery: number): Uint8Array => {
|
||||
export const secp256k1Recover = /*#__PURE__*/ withWasm((wasm, msgHash: Uint8Array, sig: Uint8Array, recovery: number): Uint8Array => {
|
||||
wasm.ext_secp_recover(8, ...bridge.allocU8a(msgHash), ...bridge.allocU8a(sig), recovery);
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const secp256k1Sign = withWasm((wasm, msgHash: Uint8Array, seckey: Uint8Array): Uint8Array => {
|
||||
export const secp256k1Sign = /*#__PURE__*/ withWasm((wasm, msgHash: Uint8Array, seckey: Uint8Array): Uint8Array => {
|
||||
wasm.ext_secp_sign(8, ...bridge.allocU8a(msgHash), ...bridge.allocU8a(seckey));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sr25519DeriveKeypairHard = withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
|
||||
export const sr25519DeriveKeypairHard = /*#__PURE__*/ withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sr_derive_keypair_hard(8, ...bridge.allocU8a(pair), ...bridge.allocU8a(cc));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sr25519DeriveKeypairSoft = withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
|
||||
export const sr25519DeriveKeypairSoft = /*#__PURE__*/ withWasm((wasm, pair: Uint8Array, cc: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sr_derive_keypair_soft(8, ...bridge.allocU8a(pair), ...bridge.allocU8a(cc));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sr25519DerivePublicSoft = withWasm((wasm, pubkey: Uint8Array, cc: Uint8Array): Uint8Array => {
|
||||
export const sr25519DerivePublicSoft = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, cc: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sr_derive_public_soft(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(cc));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sr25519KeypairFromSeed = withWasm((wasm, seed: Uint8Array): Uint8Array => {
|
||||
export const sr25519KeypairFromSeed = /*#__PURE__*/ withWasm((wasm, seed: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sr_from_seed(8, ...bridge.allocU8a(seed));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sr25519Sign = withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array, message: Uint8Array): Uint8Array => {
|
||||
export const sr25519Sign = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array, message: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sr_sign(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(secret), ...bridge.allocU8a(message));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sr25519Verify = withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
|
||||
export const sr25519Verify = /*#__PURE__*/ withWasm((wasm, signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array): boolean => {
|
||||
const ret = wasm.ext_sr_verify(...bridge.allocU8a(signature), ...bridge.allocU8a(message), ...bridge.allocU8a(pubkey));
|
||||
|
||||
return ret !== 0;
|
||||
});
|
||||
|
||||
export const sr25519Agree = withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array): Uint8Array => {
|
||||
export const sr25519Agree = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, secret: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sr_agree(8, ...bridge.allocU8a(pubkey), ...bridge.allocU8a(secret));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const vrfSign = withWasm((wasm, secret: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array): Uint8Array => {
|
||||
export const vrfSign = /*#__PURE__*/ withWasm((wasm, secret: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array): Uint8Array => {
|
||||
wasm.ext_vrf_sign(8, ...bridge.allocU8a(secret), ...bridge.allocU8a(context), ...bridge.allocU8a(message), ...bridge.allocU8a(extra));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const vrfVerify = withWasm((wasm, pubkey: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array, outAndProof: Uint8Array): boolean => {
|
||||
export const vrfVerify = /*#__PURE__*/ withWasm((wasm, pubkey: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array, outAndProof: Uint8Array): boolean => {
|
||||
const ret = wasm.ext_vrf_verify(...bridge.allocU8a(pubkey), ...bridge.allocU8a(context), ...bridge.allocU8a(message), ...bridge.allocU8a(extra), ...bridge.allocU8a(outAndProof));
|
||||
|
||||
return ret !== 0;
|
||||
});
|
||||
|
||||
export const blake2b = withWasm((wasm, data: Uint8Array, key: Uint8Array, size: number): Uint8Array => {
|
||||
export const blake2b = /*#__PURE__*/ withWasm((wasm, data: Uint8Array, key: Uint8Array, size: number): Uint8Array => {
|
||||
wasm.ext_blake2b(8, ...bridge.allocU8a(data), ...bridge.allocU8a(key), size);
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const hmacSha256 = withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
|
||||
export const hmacSha256 = /*#__PURE__*/ withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
|
||||
wasm.ext_hmac_sha256(8, ...bridge.allocU8a(key), ...bridge.allocU8a(data));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const hmacSha512 = withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
|
||||
export const hmacSha512 = /*#__PURE__*/ withWasm((wasm, key: Uint8Array, data: Uint8Array): Uint8Array => {
|
||||
wasm.ext_hmac_sha512(8, ...bridge.allocU8a(key), ...bridge.allocU8a(data));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const keccak256 = withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
export const keccak256 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
wasm.ext_keccak256(8, ...bridge.allocU8a(data));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const keccak512 = withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
export const keccak512 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
wasm.ext_keccak512(8, ...bridge.allocU8a(data));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const pbkdf2 = withWasm((wasm, data: Uint8Array, salt: Uint8Array, rounds: number): Uint8Array => {
|
||||
export const pbkdf2 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array, salt: Uint8Array, rounds: number): Uint8Array => {
|
||||
wasm.ext_pbkdf2(8, ...bridge.allocU8a(data), ...bridge.allocU8a(salt), rounds);
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const scrypt = withWasm((wasm, password: Uint8Array, salt: Uint8Array, log2n: number, r: number, p: number): Uint8Array => {
|
||||
export const scrypt = /*#__PURE__*/ withWasm((wasm, password: Uint8Array, salt: Uint8Array, log2n: number, r: number, p: number): Uint8Array => {
|
||||
wasm.ext_scrypt(8, ...bridge.allocU8a(password), ...bridge.allocU8a(salt), log2n, r, p);
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sha256 = withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
export const sha256 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sha256(8, ...bridge.allocU8a(data));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const sha512 = withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
export const sha512 = /*#__PURE__*/ withWasm((wasm, data: Uint8Array): Uint8Array => {
|
||||
wasm.ext_sha512(8, ...bridge.allocU8a(data));
|
||||
|
||||
return bridge.resultU8a();
|
||||
});
|
||||
|
||||
export const twox = withWasm((wasm, data: Uint8Array, rounds: number) => {
|
||||
export const twox = /*#__PURE__*/ withWasm((wasm, data: Uint8Array, rounds: number) => {
|
||||
wasm.ext_twox(8, ...bridge.allocU8a(data), rounds);
|
||||
|
||||
return bridge.resultU8a();
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import others from './detectOther';
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, null, others);
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage';
|
||||
import './packageDetect.js';
|
||||
|
||||
export * from './bundle';
|
||||
export * from './bundle.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InitFn } from '@polkadot/wasm-bridge/types';
|
||||
@@ -7,8 +7,19 @@ 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);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/none';
|
||||
|
||||
import { initBridge } from './init';
|
||||
import { initBridge } from './init.js';
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/asm';
|
||||
|
||||
import { initBridge } from './init';
|
||||
import { initBridge } from './init.js';
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/wasm';
|
||||
|
||||
import { initBridge } from './init';
|
||||
import { initBridge } from './init.js';
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { createWasm } from '@polkadot/wasm-crypto-init/both';
|
||||
|
||||
import { initBridge } from './init';
|
||||
import { initBridge } from './init.js';
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2022 @polkadot/wasm-crypto authors & contributors
|
||||
// Copyright 2019-2025 @polkadot/wasm-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Use `wee_alloc` as the global allocator.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user