ecash-lib 4.12.0 → 4.13.0
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.
- package/README.md +5 -0
- package/dist/ffi/ecash_lib_wasm_bg_browser.js +22074 -22085
- package/dist/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/initWasm.d.ts +2 -0
- package/dist/initWasm.d.ts.map +1 -0
- package/dist/{initBrowser.js → initWasm.js} +7 -1
- package/dist/initWasm.js.map +1 -0
- package/package.json +51 -49
- package/src/ffi/ecash_lib_wasm_bg_browser.js +22074 -22085
- package/src/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
- package/src/index.ts +2 -0
- package/src/{initBrowser.ts → initWasm.ts} +6 -0
- package/.nycrc +0 -4
- package/dist/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
- package/dist/ffi/ecash_lib_wasm_bg_nodejs.wasm.d.ts +0 -40
- package/dist/ffi/ecash_lib_wasm_nodejs.d.ts +0 -180
- package/dist/ffi/ecash_lib_wasm_nodejs.js +0 -727
- package/dist/indexBrowser.d.ts +0 -3
- package/dist/indexBrowser.d.ts.map +0 -1
- package/dist/indexBrowser.js +0 -22
- package/dist/indexBrowser.js.map +0 -1
- package/dist/indexNodeJs.d.ts +0 -3
- package/dist/indexNodeJs.d.ts.map +0 -1
- package/dist/indexNodeJs.js +0 -22
- package/dist/indexNodeJs.js.map +0 -1
- package/dist/initBrowser.d.ts +0 -2
- package/dist/initBrowser.d.ts.map +0 -1
- package/dist/initBrowser.js.map +0 -1
- package/dist/initNodeJs.d.ts +0 -2
- package/dist/initNodeJs.d.ts.map +0 -1
- package/dist/initNodeJs.js +0 -56
- package/dist/initNodeJs.js.map +0 -1
- package/src/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
- package/src/ffi/ecash_lib_wasm_bg_nodejs.wasm.d.ts +0 -40
- package/src/ffi/ecash_lib_wasm_nodejs.d.ts +0 -180
- package/src/ffi/ecash_lib_wasm_nodejs.js +0 -727
- package/src/indexBrowser.ts +0 -6
- package/src/indexNodeJs.ts +0 -6
- package/src/initNodeJs.ts +0 -22
|
Binary file
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,12 @@ import { __setEcc } from './ecc.js';
|
|
|
8
8
|
import { __setHashes } from './hash.js';
|
|
9
9
|
import { __setPkc } from './publicKeyCrypto.js';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Initialize WASM from an embedded base64 payload at import time.
|
|
13
|
+
*
|
|
14
|
+
* Works in Node.js, browsers, and bundlers (e.g. Next.js) without a separate
|
|
15
|
+
* `.wasm` file or `fs.readFileSync` at import time.
|
|
16
|
+
*/
|
|
11
17
|
const wasmRaw = Uint8Array.from(atob(ECASH_LIB_WASM_BASE64), c =>
|
|
12
18
|
c.charCodeAt(0),
|
|
13
19
|
);
|
package/.nycrc
DELETED
|
Binary file
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function ecc_new(): number;
|
|
5
|
-
export function ecc_derivePubkey(a: number, b: number, c: number, d: number): void;
|
|
6
|
-
export function ecc_ecdsaSign(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
7
|
-
export function ecc_ecdsaVerify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): void;
|
|
8
|
-
export function ecc_schnorrSign(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
9
|
-
export function ecc_schnorrVerify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): void;
|
|
10
|
-
export function ecc_isValidSeckey(a: number, b: number, c: number): number;
|
|
11
|
-
export function ecc_seckeyAdd(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
12
|
-
export function ecc_pubkeyAdd(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
13
|
-
export function ecc_signRecoverable(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
14
|
-
export function ecc_recoverSig(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
15
|
-
export function __wbg_ecc_free(a: number): void;
|
|
16
|
-
export function publicKeyCryptoVerify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number): void;
|
|
17
|
-
export function publicKeyCryptoAlgoSupported(a: number, b: number, c: number, d: number, e: number): void;
|
|
18
|
-
export function sha512h_new(): number;
|
|
19
|
-
export function sha512h_update(a: number, b: number, c: number): void;
|
|
20
|
-
export function sha512h_finalize(a: number, b: number): void;
|
|
21
|
-
export function sha512h_clone(a: number): number;
|
|
22
|
-
export function __wbg_sha512h_free(a: number): void;
|
|
23
|
-
export function sha256h_new(): number;
|
|
24
|
-
export function sha256h_update(a: number, b: number, c: number): void;
|
|
25
|
-
export function sha256h_finalize(a: number, b: number): void;
|
|
26
|
-
export function sha256h_clone(a: number): number;
|
|
27
|
-
export function __wbg_sha256h_free(a: number): void;
|
|
28
|
-
export function sha512(a: number, b: number, c: number): void;
|
|
29
|
-
export function sha256d(a: number, b: number, c: number): void;
|
|
30
|
-
export function sha256(a: number, b: number, c: number): void;
|
|
31
|
-
export function shaRmd160(a: number, b: number, c: number): void;
|
|
32
|
-
export function ecash_secp256k1_context_create(a: number): number;
|
|
33
|
-
export function ecash_secp256k1_context_destroy(a: number): void;
|
|
34
|
-
export function secp256k1_default_illegal_callback_fn(a: number, b: number): void;
|
|
35
|
-
export function secp256k1_default_error_callback_fn(a: number, b: number): void;
|
|
36
|
-
export function ring_core_0_17_14__bn_mul_mont(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
37
|
-
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
38
|
-
export function __wbindgen_export_0(a: number, b: number): number;
|
|
39
|
-
export function __wbindgen_export_1(a: number, b: number, c: number): void;
|
|
40
|
-
export function __wbindgen_export_2(a: number, b: number, c: number, d: number): number;
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Verify a signature for the given cryptographic algorithm.
|
|
5
|
-
* Intended to be used in X509 certificate verification.
|
|
6
|
-
* Throw an exception if the algorithm is not supported.
|
|
7
|
-
* @param {string} algo_oid
|
|
8
|
-
* @param {string | undefined} params
|
|
9
|
-
* @param {Uint8Array} sig
|
|
10
|
-
* @param {Uint8Array} msg
|
|
11
|
-
* @param {Uint8Array} pk
|
|
12
|
-
*/
|
|
13
|
-
export function publicKeyCryptoVerify(algo_oid: string, params: string | undefined, sig: Uint8Array, msg: Uint8Array, pk: Uint8Array): void;
|
|
14
|
-
/**
|
|
15
|
-
* Throw an exception if the given algo is not supported, otherwise do nothing.
|
|
16
|
-
* @param {string} algo_oid
|
|
17
|
-
* @param {string | undefined} [params]
|
|
18
|
-
*/
|
|
19
|
-
export function publicKeyCryptoAlgoSupported(algo_oid: string, params?: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* Calculate SHA512(data).
|
|
22
|
-
* @param {Uint8Array} data
|
|
23
|
-
* @returns {Uint8Array}
|
|
24
|
-
*/
|
|
25
|
-
export function sha512(data: Uint8Array): Uint8Array;
|
|
26
|
-
/**
|
|
27
|
-
* Calculate SHA256(SHA256(data)).
|
|
28
|
-
* @param {Uint8Array} data
|
|
29
|
-
* @returns {Uint8Array}
|
|
30
|
-
*/
|
|
31
|
-
export function sha256d(data: Uint8Array): Uint8Array;
|
|
32
|
-
/**
|
|
33
|
-
* Calculate SHA256(data).
|
|
34
|
-
* @param {Uint8Array} data
|
|
35
|
-
* @returns {Uint8Array}
|
|
36
|
-
*/
|
|
37
|
-
export function sha256(data: Uint8Array): Uint8Array;
|
|
38
|
-
/**
|
|
39
|
-
* Calculate RIPEMD160(SHA256(data)), commonly used as address hash.
|
|
40
|
-
* @param {Uint8Array} data
|
|
41
|
-
* @returns {Uint8Array}
|
|
42
|
-
*/
|
|
43
|
-
export function shaRmd160(data: Uint8Array): Uint8Array;
|
|
44
|
-
/**
|
|
45
|
-
* ECC signatures with libsecp256k1.
|
|
46
|
-
*/
|
|
47
|
-
export class Ecc {
|
|
48
|
-
free(): void;
|
|
49
|
-
/**
|
|
50
|
-
* Create a new Ecc instance.
|
|
51
|
-
*/
|
|
52
|
-
constructor();
|
|
53
|
-
/**
|
|
54
|
-
* Derive a public key from secret key.
|
|
55
|
-
* @param {Uint8Array} seckey
|
|
56
|
-
* @returns {Uint8Array}
|
|
57
|
-
*/
|
|
58
|
-
derivePubkey(seckey: Uint8Array): Uint8Array;
|
|
59
|
-
/**
|
|
60
|
-
* Sign an ECDSA signature.
|
|
61
|
-
* @param {Uint8Array} seckey
|
|
62
|
-
* @param {Uint8Array} msg
|
|
63
|
-
* @returns {Uint8Array}
|
|
64
|
-
*/
|
|
65
|
-
ecdsaSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
66
|
-
/**
|
|
67
|
-
* Verify an ECDSA signature.
|
|
68
|
-
* @param {Uint8Array} sig
|
|
69
|
-
* @param {Uint8Array} msg
|
|
70
|
-
* @param {Uint8Array} pk
|
|
71
|
-
*/
|
|
72
|
-
ecdsaVerify(sig: Uint8Array, msg: Uint8Array, pk: Uint8Array): void;
|
|
73
|
-
/**
|
|
74
|
-
* Sign a Schnorr signature.
|
|
75
|
-
* @param {Uint8Array} seckey
|
|
76
|
-
* @param {Uint8Array} msg
|
|
77
|
-
* @returns {Uint8Array}
|
|
78
|
-
*/
|
|
79
|
-
schnorrSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
80
|
-
/**
|
|
81
|
-
* Verify a Schnorr signature.
|
|
82
|
-
* @param {Uint8Array} sig
|
|
83
|
-
* @param {Uint8Array} msg
|
|
84
|
-
* @param {Uint8Array} pk
|
|
85
|
-
*/
|
|
86
|
-
schnorrVerify(sig: Uint8Array, msg: Uint8Array, pk: Uint8Array): void;
|
|
87
|
-
/**
|
|
88
|
-
* Return whether the given secret key is valid, i.e. whether is of correct
|
|
89
|
-
* length (32 bytes) and is on the curve.
|
|
90
|
-
* @param {Uint8Array} seckey
|
|
91
|
-
* @returns {boolean}
|
|
92
|
-
*/
|
|
93
|
-
isValidSeckey(seckey: Uint8Array): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Add a scalar to a secret key.
|
|
96
|
-
* @param {Uint8Array} a
|
|
97
|
-
* @param {Uint8Array} b
|
|
98
|
-
* @returns {Uint8Array}
|
|
99
|
-
*/
|
|
100
|
-
seckeyAdd(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
101
|
-
/**
|
|
102
|
-
* Add a scalar to a public key (adding G*b).
|
|
103
|
-
* @param {Uint8Array} a
|
|
104
|
-
* @param {Uint8Array} b
|
|
105
|
-
* @returns {Uint8Array}
|
|
106
|
-
*/
|
|
107
|
-
pubkeyAdd(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
108
|
-
/**
|
|
109
|
-
* Create a compact ECDSA signature (65 bytes), which allows reconstructing
|
|
110
|
-
* the used public key.
|
|
111
|
-
* The format is one header byte, followed by two times 32 bytes for the
|
|
112
|
-
* serialized r and s values.
|
|
113
|
-
* The header byte: 0x1B = first key with even y,
|
|
114
|
-
* 0x1C = first key with odd y,
|
|
115
|
-
* 0x1D = second key with even y,
|
|
116
|
-
* 0x1E = second key with odd y,
|
|
117
|
-
* add 0x04 for compressed keys.
|
|
118
|
-
* @param {Uint8Array} seckey
|
|
119
|
-
* @param {Uint8Array} msg
|
|
120
|
-
* @returns {Uint8Array}
|
|
121
|
-
*/
|
|
122
|
-
signRecoverable(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
123
|
-
/**
|
|
124
|
-
* Recover the public key of a signature signed by signRecoverable.
|
|
125
|
-
* @param {Uint8Array} sig
|
|
126
|
-
* @param {Uint8Array} msg
|
|
127
|
-
* @returns {Uint8Array}
|
|
128
|
-
*/
|
|
129
|
-
recoverSig(sig: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Instance to calculate SHA256 in a streaming fashion
|
|
133
|
-
*/
|
|
134
|
-
export class Sha256H {
|
|
135
|
-
free(): void;
|
|
136
|
-
/**
|
|
137
|
-
* Create new hasher instance
|
|
138
|
-
*/
|
|
139
|
-
constructor();
|
|
140
|
-
/**
|
|
141
|
-
* Feed bytes into the hasher
|
|
142
|
-
* @param {Uint8Array} data
|
|
143
|
-
*/
|
|
144
|
-
update(data: Uint8Array): void;
|
|
145
|
-
/**
|
|
146
|
-
* Finalize the hash and return the result
|
|
147
|
-
* @returns {Uint8Array}
|
|
148
|
-
*/
|
|
149
|
-
finalize(): Uint8Array;
|
|
150
|
-
/**
|
|
151
|
-
* Clone the hasher
|
|
152
|
-
* @returns {Sha256H}
|
|
153
|
-
*/
|
|
154
|
-
clone(): Sha256H;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Instance to calculate SHA512 in a streaming fashion
|
|
158
|
-
*/
|
|
159
|
-
export class Sha512H {
|
|
160
|
-
free(): void;
|
|
161
|
-
/**
|
|
162
|
-
* Create new hasher instance
|
|
163
|
-
*/
|
|
164
|
-
constructor();
|
|
165
|
-
/**
|
|
166
|
-
* Feed bytes into the hasher
|
|
167
|
-
* @param {Uint8Array} data
|
|
168
|
-
*/
|
|
169
|
-
update(data: Uint8Array): void;
|
|
170
|
-
/**
|
|
171
|
-
* Finalize the hash and return the result
|
|
172
|
-
* @returns {Uint8Array}
|
|
173
|
-
*/
|
|
174
|
-
finalize(): Uint8Array;
|
|
175
|
-
/**
|
|
176
|
-
* Clone the hasher
|
|
177
|
-
* @returns {Sha512H}
|
|
178
|
-
*/
|
|
179
|
-
clone(): Sha512H;
|
|
180
|
-
}
|