@pezkuwi/wasm-crypto 7.5.8 → 7.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/LICENSE +201 -0
  2. package/bundle-pezkuwi-wasm-crypto.js +777 -0
  3. package/bundle.d.ts +37 -0
  4. package/bundle.js +165 -0
  5. package/cjs/bundle.d.ts +37 -0
  6. package/cjs/bundle.js +171 -0
  7. package/cjs/index.js +5 -0
  8. package/cjs/init.js +21 -0
  9. package/cjs/initNone.js +20 -0
  10. package/cjs/initOnlyAsm.js +20 -0
  11. package/cjs/initOnlyWasm.js +20 -0
  12. package/cjs/initWasmAsm.js +20 -0
  13. package/cjs/package.json +3 -0
  14. package/cjs/packageDetect.js +10 -0
  15. package/cjs/packageInfo.js +4 -0
  16. package/index.d.ts +2 -0
  17. package/index.js +2 -0
  18. package/{src/init.ts → init.d.ts} +2 -11
  19. package/init.js +17 -0
  20. package/initNone.d.ts +10 -0
  21. package/{src/initNone.ts → initNone.js} +4 -10
  22. package/initOnlyAsm.d.ts +10 -0
  23. package/{src/initOnlyAsm.ts → initOnlyAsm.js} +4 -10
  24. package/initOnlyWasm.d.ts +10 -0
  25. package/{src/initOnlyWasm.ts → initOnlyWasm.js} +4 -10
  26. package/initWasmAsm.d.ts +10 -0
  27. package/{src/initWasmAsm.ts → initWasmAsm.js} +4 -10
  28. package/package.json +163 -17
  29. package/packageDetect.d.ts +1 -0
  30. package/{src/packageDetect.ts → packageDetect.js} +0 -8
  31. package/packageInfo.d.ts +6 -0
  32. package/packageInfo.js +1 -0
  33. package/Cargo.toml +0 -50
  34. package/Xargo.toml +0 -2
  35. package/build/bundle.d.ts +0 -37
  36. package/src/bundle.ts +0 -247
  37. package/src/index.ts +0 -6
  38. package/src/lib.rs +0 -24
  39. package/src/mod.ts +0 -4
  40. package/src/packageInfo.ts +0 -6
  41. package/src/rs/.editorconfig +0 -10
  42. package/src/rs/bip39.rs +0 -139
  43. package/src/rs/ed25519.rs +0 -142
  44. package/src/rs/hashing.rs +0 -322
  45. package/src/rs/secp256k1.rs +0 -150
  46. package/src/rs/sr25519.rs +0 -331
  47. package/src/rs/vrf.rs +0 -144
  48. package/test/all/bip39.js +0 -86
  49. package/test/all/ed25519.js +0 -84
  50. package/test/all/hashing.js +0 -138
  51. package/test/all/index.js +0 -126
  52. package/test/all/secp256k1.js +0 -105
  53. package/test/all/sr25519.js +0 -211
  54. package/test/all/vrf.js +0 -74
  55. package/test/asm.js +0 -10
  56. package/test/deno.ts +0 -37
  57. package/test/jest.spec.ts +0 -24
  58. package/test/loader-build.js +0 -39
  59. package/test/wasm.js +0 -8
  60. package/tsconfig.build.json +0 -19
  61. package/tsconfig.spec.json +0 -16
  62. /package/{build → cjs}/index.d.ts +0 -0
  63. /package/{build → cjs}/init.d.ts +0 -0
  64. /package/{build → cjs}/initNone.d.ts +0 -0
  65. /package/{build → cjs}/initOnlyAsm.d.ts +0 -0
  66. /package/{build → cjs}/initOnlyWasm.d.ts +0 -0
  67. /package/{build → cjs}/initWasmAsm.d.ts +0 -0
  68. /package/{build → cjs}/packageDetect.d.ts +0 -0
  69. /package/{build → cjs}/packageInfo.d.ts +0 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @name initWasm
3
+ * @description
4
+ * For historic purposes and for tighter control on init, specifically performing
5
+ * a WASM initialization with only ASM.js
6
+ *
7
+ * Generally should not be used unless you want explicit control over which
8
+ * interfaces are initialized.
9
+ */
10
+ export declare function initWasm(): Promise<void>;
@@ -1,10 +1,5 @@
1
- // Copyright 2019-2026 @pezkuwi/wasm-crypto authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { createWasm } from '@pezkuwi/wasm-crypto-init/asm';
5
-
6
2
  import { initBridge } from './init.js';
7
-
8
3
  /**
9
4
  * @name initWasm
10
5
  * @description
@@ -14,10 +9,9 @@ import { initBridge } from './init.js';
14
9
  * Generally should not be used unless you want explicit control over which
15
10
  * interfaces are initialized.
16
11
  */
17
- export async function initWasm (): Promise<void> {
18
- await initBridge(createWasm);
12
+ export async function initWasm() {
13
+ await initBridge(createWasm);
19
14
  }
20
-
21
- initWasm().catch((): void => {
22
- // cannot happen, initWasm doesn't throw
15
+ initWasm().catch(() => {
16
+ // cannot happen, initWasm doesn't throw
23
17
  });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @name initWasm
3
+ * @description
4
+ * For historic purposes and for tighter control on init, specifically performing
5
+ * a WASM initialization with only WASM (generally the default for most platforms)
6
+ *
7
+ * Generally should not be used unless you want explicit control over which
8
+ * interfaces are initialized.
9
+ */
10
+ export declare function initWasm(): Promise<void>;
@@ -1,10 +1,5 @@
1
- // Copyright 2019-2026 @pezkuwi/wasm-crypto authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { createWasm } from '@pezkuwi/wasm-crypto-init/wasm';
5
-
6
2
  import { initBridge } from './init.js';
7
-
8
3
  /**
9
4
  * @name initWasm
10
5
  * @description
@@ -14,10 +9,9 @@ import { initBridge } from './init.js';
14
9
  * Generally should not be used unless you want explicit control over which
15
10
  * interfaces are initialized.
16
11
  */
17
- export async function initWasm (): Promise<void> {
18
- await initBridge(createWasm);
12
+ export async function initWasm() {
13
+ await initBridge(createWasm);
19
14
  }
20
-
21
- initWasm().catch((): void => {
22
- // cannot happen, initWasm doesn't throw
15
+ initWasm().catch(() => {
16
+ // cannot happen, initWasm doesn't throw
23
17
  });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @name initWasm
3
+ * @description
4
+ * For historic purposes and for tighter control on init, specifically performing
5
+ * a WASM initialization with ASM and an ASM.js fallback
6
+ *
7
+ * Generally should not be used unless you want explicit control over which
8
+ * interfaces are initialized.
9
+ */
10
+ export declare function initWasm(): Promise<void>;
@@ -1,10 +1,5 @@
1
- // Copyright 2019-2026 @pezkuwi/wasm-crypto authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { createWasm } from '@pezkuwi/wasm-crypto-init/both';
5
-
6
2
  import { initBridge } from './init.js';
7
-
8
3
  /**
9
4
  * @name initWasm
10
5
  * @description
@@ -14,10 +9,9 @@ import { initBridge } from './init.js';
14
9
  * Generally should not be used unless you want explicit control over which
15
10
  * interfaces are initialized.
16
11
  */
17
- export async function initWasm (): Promise<void> {
18
- await initBridge(createWasm);
12
+ export async function initWasm() {
13
+ await initBridge(createWasm);
19
14
  }
20
-
21
- initWasm().catch((): void => {
22
- // cannot happen, initWasm doesn't throw
15
+ initWasm().catch(() => {
16
+ // cannot happen, initWasm doesn't throw
23
17
  });
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "author": "Jaco Greeff <jacogr@gmail.com>",
2
+ "author": "PezkuwiChain <dev@pezkuwichain.io>",
3
3
  "bugs": "https://github.com/pezkuwichain/pezkuwi-wasm/issues",
4
4
  "description": "A wasm interface layer for use by @pezkuwi/util-crypto",
5
5
  "engines": {
@@ -15,31 +15,177 @@
15
15
  },
16
16
  "sideEffects": [
17
17
  "./initNone.js",
18
- "./initNone.cjs",
18
+ "./cjs/initNone.js",
19
19
  "./initOnlyAsm.js",
20
- "./initOnlyAsm.cjs",
20
+ "./cjs/initOnlyAsm.js",
21
21
  "./initOnlyWasm.js",
22
- "./initOnlyWasm.cjs",
22
+ "./cjs/initOnlyWasm.js",
23
23
  "./initWasmAsm.js",
24
- "./initWasmAsm.cjs",
24
+ "./cjs/initWasmAsm.js",
25
25
  "./packageDetect.js",
26
- "./packageDetect.cjs"
26
+ "./cjs/packageDetect.js"
27
27
  ],
28
28
  "type": "module",
29
- "version": "7.5.8",
30
- "main": "index.js",
29
+ "version": "7.5.10",
30
+ "main": "./cjs/index.js",
31
+ "module": "./index.js",
32
+ "types": "./index.d.ts",
33
+ "exports": {
34
+ "./cjs/package.json": "./cjs/package.json",
35
+ "./cjs/*": "./cjs/*.js",
36
+ ".": {
37
+ "module": {
38
+ "types": "./index.d.ts",
39
+ "default": "./index.js"
40
+ },
41
+ "require": {
42
+ "types": "./cjs/index.d.ts",
43
+ "default": "./cjs/index.js"
44
+ },
45
+ "default": {
46
+ "types": "./index.d.ts",
47
+ "default": "./index.js"
48
+ }
49
+ },
50
+ "./bundle": {
51
+ "module": {
52
+ "types": "./bundle.d.ts",
53
+ "default": "./bundle.js"
54
+ },
55
+ "require": {
56
+ "types": "./cjs/bundle.d.ts",
57
+ "default": "./cjs/bundle.js"
58
+ },
59
+ "default": {
60
+ "types": "./bundle.d.ts",
61
+ "default": "./bundle.js"
62
+ }
63
+ },
64
+ "./init": {
65
+ "module": {
66
+ "types": "./init.d.ts",
67
+ "default": "./init.js"
68
+ },
69
+ "require": {
70
+ "types": "./cjs/init.d.ts",
71
+ "default": "./cjs/init.js"
72
+ },
73
+ "default": {
74
+ "types": "./init.d.ts",
75
+ "default": "./init.js"
76
+ }
77
+ },
78
+ "./initNone": {
79
+ "module": {
80
+ "types": "./initNone.d.ts",
81
+ "default": "./initNone.js"
82
+ },
83
+ "require": {
84
+ "types": "./cjs/initNone.d.ts",
85
+ "default": "./cjs/initNone.js"
86
+ },
87
+ "default": {
88
+ "types": "./initNone.d.ts",
89
+ "default": "./initNone.js"
90
+ }
91
+ },
92
+ "./initOnlyAsm": {
93
+ "module": {
94
+ "types": "./initOnlyAsm.d.ts",
95
+ "default": "./initOnlyAsm.js"
96
+ },
97
+ "require": {
98
+ "types": "./cjs/initOnlyAsm.d.ts",
99
+ "default": "./cjs/initOnlyAsm.js"
100
+ },
101
+ "default": {
102
+ "types": "./initOnlyAsm.d.ts",
103
+ "default": "./initOnlyAsm.js"
104
+ }
105
+ },
106
+ "./initOnlyWasm": {
107
+ "module": {
108
+ "types": "./initOnlyWasm.d.ts",
109
+ "default": "./initOnlyWasm.js"
110
+ },
111
+ "require": {
112
+ "types": "./cjs/initOnlyWasm.d.ts",
113
+ "default": "./cjs/initOnlyWasm.js"
114
+ },
115
+ "default": {
116
+ "types": "./initOnlyWasm.d.ts",
117
+ "default": "./initOnlyWasm.js"
118
+ }
119
+ },
120
+ "./initWasmAsm": {
121
+ "module": {
122
+ "types": "./initWasmAsm.d.ts",
123
+ "default": "./initWasmAsm.js"
124
+ },
125
+ "require": {
126
+ "types": "./cjs/initWasmAsm.d.ts",
127
+ "default": "./cjs/initWasmAsm.js"
128
+ },
129
+ "default": {
130
+ "types": "./initWasmAsm.d.ts",
131
+ "default": "./initWasmAsm.js"
132
+ }
133
+ },
134
+ "./package.json": {
135
+ "require": "./cjs/package.json",
136
+ "default": "./package.json"
137
+ },
138
+ "./packageDetect": {
139
+ "module": {
140
+ "types": "./packageDetect.d.ts",
141
+ "default": "./packageDetect.js"
142
+ },
143
+ "require": {
144
+ "types": "./cjs/packageDetect.d.ts",
145
+ "default": "./cjs/packageDetect.js"
146
+ },
147
+ "default": {
148
+ "types": "./packageDetect.d.ts",
149
+ "default": "./packageDetect.js"
150
+ }
151
+ },
152
+ "./packageInfo.js": {
153
+ "module": {
154
+ "types": "./packageInfo.d.ts",
155
+ "default": "./packageInfo.js"
156
+ },
157
+ "require": {
158
+ "types": "./cjs/packageInfo.d.ts",
159
+ "default": "./cjs/packageInfo.js"
160
+ },
161
+ "default": {
162
+ "types": "./packageInfo.d.ts",
163
+ "default": "./packageInfo.js"
164
+ }
165
+ },
166
+ "./packageInfo": {
167
+ "module": {
168
+ "types": "./packageInfo.d.ts",
169
+ "default": "./packageInfo.js"
170
+ },
171
+ "require": {
172
+ "types": "./cjs/packageInfo.d.ts",
173
+ "default": "./cjs/packageInfo.js"
174
+ },
175
+ "default": {
176
+ "types": "./packageInfo.d.ts",
177
+ "default": "./packageInfo.js"
178
+ }
179
+ }
180
+ },
31
181
  "dependencies": {
32
- "@pezkuwi/wasm-bridge": "7.5.8",
33
- "@pezkuwi/wasm-crypto-asmjs": "7.5.8",
34
- "@pezkuwi/wasm-crypto-init": "7.5.8",
35
- "@pezkuwi/wasm-crypto-wasm": "7.5.8",
36
- "@pezkuwi/wasm-util": "7.5.8",
182
+ "@pezkuwi/wasm-bridge": "7.5.10",
183
+ "@pezkuwi/wasm-crypto-asmjs": "7.5.10",
184
+ "@pezkuwi/wasm-crypto-init": "7.5.10",
185
+ "@pezkuwi/wasm-crypto-wasm": "7.5.10",
186
+ "@pezkuwi/wasm-util": "7.5.10",
37
187
  "tslib": "^2.7.0"
38
188
  },
39
- "devDependencies": {
40
- "@pezkuwi/util": "^14.0.1",
41
- "@pezkuwi/x-randomvalues": "^14.0.1"
42
- },
43
189
  "peerDependencies": {
44
190
  "@pezkuwi/util": "*",
45
191
  "@pezkuwi/x-randomvalues": "*"
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,8 @@
1
- // Copyright 2017-2026 @pezkuwi/wasm-crypto authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @pezkuwi/dev
5
- // (packageInfo imports will be kept as-is, user-editable)
6
-
7
1
  import { detectPackage } from '@pezkuwi/util';
8
2
  import { packageInfo as bridgeInfo } from '@pezkuwi/wasm-bridge/packageInfo';
9
3
  import { packageInfo as asmInfo } from '@pezkuwi/wasm-crypto-asmjs/packageInfo';
10
4
  import { packageInfo as initInfo } from '@pezkuwi/wasm-crypto-init/packageInfo';
11
5
  import { packageInfo as wasmInfo } from '@pezkuwi/wasm-crypto-wasm/packageInfo';
12
6
  import { packageInfo as utilInfo } from '@pezkuwi/wasm-util/packageInfo';
13
-
14
7
  import { packageInfo } from './packageInfo.js';
15
-
16
8
  detectPackage(packageInfo, null, [asmInfo, bridgeInfo, initInfo, utilInfo, wasmInfo]);
@@ -0,0 +1,6 @@
1
+ export declare const packageInfo: {
2
+ name: string;
3
+ path: string;
4
+ type: string;
5
+ version: string;
6
+ };
package/packageInfo.js ADDED
@@ -0,0 +1 @@
1
+ export const packageInfo = { name: '@pezkuwi/wasm-crypto', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '7.5.10' };
package/Cargo.toml DELETED
@@ -1,50 +0,0 @@
1
- # name & version is only used internally, doesn't need to be adjusted. In the case of
2
- # name keep it consistent at "wasm" since the scripts (for re-use purposes) expect that
3
-
4
- [package]
5
- authors = ["Jaco Greeff <jacogr@gmail.com>"]
6
- description = "WASM bindings to Rust crypto libraries."
7
- edition = "2018"
8
- license = "Apache-2.0"
9
- name = "wasm"
10
- publish = false
11
- repository = "https://github.com/pezkuwichain/pezkuwi-wasm/"
12
- resolver = "2"
13
- version = "0.0.0"
14
-
15
- [lib]
16
- crate-type = ["cdylib"]
17
-
18
- [dependencies]
19
- blake2-rfc = "0.2.18"
20
- byteorder = "1.3.1"
21
- curve25519-dalek = { version = "2.1.0", default-features = false }
22
- ed25519-dalek = { version = "1.0.0-pre.4", features = [] }
23
- getrandom = { version="0.2.3", features = ["js"] }
24
- hmac = "0.7.0"
25
- secp256k1 = { version = "0.21.2", default-features = false, features = ["recovery", "global-context"] }
26
- merlin = { version = "2.0", default-features = false }
27
- pbkdf2 = { version = "0.3.0", default-features = false }
28
- rand = { version="0.7.3", default-features = false, features = ["wasm-bindgen"] }
29
- schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"] }
30
- scrypt = { version = "0.2", default-features = false }
31
- sha2 = "0.8.1"
32
- tiny-bip39 = { version = "0.7", default-features = false }
33
- tiny-keccak = { version = "2.0.1", features = ["keccak"] }
34
- twox-hash = "1.5.0"
35
- wasm-bindgen = "=0.2.90"
36
- wee_alloc = "0.4.3"
37
-
38
- [dev-dependencies]
39
- hex-literal = "0.2.0"
40
- rand = { version = "0.7.3", features = ["wasm-bindgen"] }
41
-
42
- [profile.release]
43
- codegen-units = 1
44
- debug = false
45
- debug-assertions = false
46
- incremental = false
47
- lto = true
48
- opt-level = "z"
49
- panic = "abort"
50
- rpath = false
package/Xargo.toml DELETED
@@ -1,2 +0,0 @@
1
- [dependencies]
2
- std = { default-features = false, features = ["panic_immediate_abort"] }
package/build/bundle.d.ts DELETED
@@ -1,37 +0,0 @@
1
- import { bridge } from './init.js';
2
- export { packageInfo } from './packageInfo.js';
3
- export { bridge };
4
- export declare const bip39Generate: (words: 12 | 15 | 18 | 21 | 24) => string;
5
- export declare const bip39ToEntropy: (phrase: string) => Uint8Array;
6
- export declare const bip39ToMiniSecret: (phrase: string, password: string) => Uint8Array;
7
- export declare const bip39ToSeed: (phrase: string, password: string) => Uint8Array;
8
- export declare const bip39Validate: (phrase: string) => boolean;
9
- export declare const ed25519KeypairFromSeed: (seed: Uint8Array) => Uint8Array;
10
- export declare const ed25519Sign: (pubkey: Uint8Array, seckey: Uint8Array, message: Uint8Array) => Uint8Array;
11
- export declare const ed25519Verify: (signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array) => boolean;
12
- export declare const secp256k1FromSeed: (seckey: Uint8Array) => Uint8Array;
13
- export declare const secp256k1Compress: (pubkey: Uint8Array) => Uint8Array;
14
- export declare const secp256k1Expand: (pubkey: Uint8Array) => Uint8Array;
15
- export declare const secp256k1Recover: (msgHash: Uint8Array, sig: Uint8Array, recovery: number) => Uint8Array;
16
- export declare const secp256k1Sign: (msgHash: Uint8Array, seckey: Uint8Array) => Uint8Array;
17
- export declare const sr25519DeriveKeypairHard: (pair: Uint8Array, cc: Uint8Array) => Uint8Array;
18
- export declare const sr25519DeriveKeypairSoft: (pair: Uint8Array, cc: Uint8Array) => Uint8Array;
19
- export declare const sr25519DerivePublicSoft: (pubkey: Uint8Array, cc: Uint8Array) => Uint8Array;
20
- export declare const sr25519KeypairFromSeed: (seed: Uint8Array) => Uint8Array;
21
- export declare const sr25519Sign: (pubkey: Uint8Array, secret: Uint8Array, message: Uint8Array) => Uint8Array;
22
- export declare const sr25519Verify: (signature: Uint8Array, message: Uint8Array, pubkey: Uint8Array) => boolean;
23
- export declare const sr25519Agree: (pubkey: Uint8Array, secret: Uint8Array) => Uint8Array;
24
- export declare const vrfSign: (secret: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array) => Uint8Array;
25
- export declare const vrfVerify: (pubkey: Uint8Array, context: Uint8Array, message: Uint8Array, extra: Uint8Array, outAndProof: Uint8Array) => boolean;
26
- export declare const blake2b: (data: Uint8Array, key: Uint8Array, size: number) => Uint8Array;
27
- export declare const hmacSha256: (key: Uint8Array, data: Uint8Array) => Uint8Array;
28
- export declare const hmacSha512: (key: Uint8Array, data: Uint8Array) => Uint8Array;
29
- export declare const keccak256: (data: Uint8Array) => Uint8Array;
30
- export declare const keccak512: (data: Uint8Array) => Uint8Array;
31
- export declare const pbkdf2: (data: Uint8Array, salt: Uint8Array, rounds: number) => Uint8Array;
32
- export declare const scrypt: (password: Uint8Array, salt: Uint8Array, log2n: number, r: number, p: number) => Uint8Array;
33
- export declare const sha256: (data: Uint8Array) => Uint8Array;
34
- export declare const sha512: (data: Uint8Array) => Uint8Array;
35
- export declare const twox: (data: Uint8Array, rounds: number) => Uint8Array;
36
- export declare function isReady(): boolean;
37
- export declare function waitReady(): Promise<boolean>;