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.
Files changed (43) hide show
  1. package/README.md +5 -0
  2. package/dist/ffi/ecash_lib_wasm_bg_browser.js +22074 -22085
  3. package/dist/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/initWasm.d.ts +2 -0
  9. package/dist/initWasm.d.ts.map +1 -0
  10. package/dist/{initBrowser.js → initWasm.js} +7 -1
  11. package/dist/initWasm.js.map +1 -0
  12. package/package.json +51 -49
  13. package/src/ffi/ecash_lib_wasm_bg_browser.js +22074 -22085
  14. package/src/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
  15. package/src/index.ts +2 -0
  16. package/src/{initBrowser.ts → initWasm.ts} +6 -0
  17. package/.nycrc +0 -4
  18. package/dist/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
  19. package/dist/ffi/ecash_lib_wasm_bg_nodejs.wasm.d.ts +0 -40
  20. package/dist/ffi/ecash_lib_wasm_nodejs.d.ts +0 -180
  21. package/dist/ffi/ecash_lib_wasm_nodejs.js +0 -727
  22. package/dist/indexBrowser.d.ts +0 -3
  23. package/dist/indexBrowser.d.ts.map +0 -1
  24. package/dist/indexBrowser.js +0 -22
  25. package/dist/indexBrowser.js.map +0 -1
  26. package/dist/indexNodeJs.d.ts +0 -3
  27. package/dist/indexNodeJs.d.ts.map +0 -1
  28. package/dist/indexNodeJs.js +0 -22
  29. package/dist/indexNodeJs.js.map +0 -1
  30. package/dist/initBrowser.d.ts +0 -2
  31. package/dist/initBrowser.d.ts.map +0 -1
  32. package/dist/initBrowser.js.map +0 -1
  33. package/dist/initNodeJs.d.ts +0 -2
  34. package/dist/initNodeJs.d.ts.map +0 -1
  35. package/dist/initNodeJs.js +0 -56
  36. package/dist/initNodeJs.js.map +0 -1
  37. package/src/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
  38. package/src/ffi/ecash_lib_wasm_bg_nodejs.wasm.d.ts +0 -40
  39. package/src/ffi/ecash_lib_wasm_nodejs.d.ts +0 -180
  40. package/src/ffi/ecash_lib_wasm_nodejs.js +0 -727
  41. package/src/indexBrowser.ts +0 -6
  42. package/src/indexNodeJs.ts +0 -6
  43. package/src/initNodeJs.ts +0 -22
@@ -1,3 +0,0 @@
1
- export * from './index.js';
2
- export * from './initBrowser.js';
3
- //# sourceMappingURL=indexBrowser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexBrowser.d.ts","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // Copyright (c) 2024 The Bitcoin developers
3
- // Distributed under the MIT software license, see the accompanying
4
- // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- __exportStar(require("./index.js"), exports);
21
- __exportStar(require("./initBrowser.js"), exports);
22
- //# sourceMappingURL=indexBrowser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexBrowser.js","sourceRoot":"","sources":["../src/indexBrowser.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;;;;;;;;;;;;;;AAEtE,6CAA2B;AAC3B,mDAAiC"}
@@ -1,3 +0,0 @@
1
- export * from './index.js';
2
- export * from './initNodeJs.js';
3
- //# sourceMappingURL=indexNodeJs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexNodeJs.d.ts","sourceRoot":"","sources":["../src/indexNodeJs.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // Copyright (c) 2024 The Bitcoin developers
3
- // Distributed under the MIT software license, see the accompanying
4
- // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- __exportStar(require("./index.js"), exports);
21
- __exportStar(require("./initNodeJs.js"), exports);
22
- //# sourceMappingURL=indexNodeJs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexNodeJs.js","sourceRoot":"","sources":["../src/indexNodeJs.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;;;;;;;;;;;;;;AAEtE,6CAA2B;AAC3B,kDAAgC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=initBrowser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initBrowser.d.ts","sourceRoot":"","sources":["../src/initBrowser.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"initBrowser.js","sourceRoot":"","sources":["../src/initBrowser.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtE,qEAAuD;AACvD,qFAA2E;AAC3E,qCAAoC;AACpC,uCAAwC;AACxC,6DAAgD;AAEhD,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,oDAAqB,CAAC,EAAE,CAAC,CAAC,EAAE,CAC7D,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAClB,CAAC;AACF,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAEtB,IAAA,iBAAQ,EAAC,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;AACxB,IAAA,qBAAW,EAAC;IACR,MAAM,EAAE,GAAG,CAAC,MAAM;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO;IACpB,SAAS,EAAE,GAAG,CAAC,SAAS;IACxB,MAAM,EAAE,GAAG,CAAC,MAAM;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO;IACpB,OAAO,EAAE,GAAG,CAAC,OAAO;CACvB,CAAC,CAAC;AACH,IAAA,6BAAQ,EAAC;IACL,aAAa,EAAE,GAAG,CAAC,4BAA4B;IAC/C,MAAM,EAAE,GAAG,CAAC,qBAAqB;CACpC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=initNodeJs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initNodeJs.d.ts","sourceRoot":"","sources":["../src/initNodeJs.ts"],"names":[],"mappings":""}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- // Copyright (c) 2024 The Bitcoin developers
3
- // Distributed under the MIT software license, see the accompanying
4
- // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const ffi = __importStar(require("./ffi/ecash_lib_wasm_nodejs.js"));
40
- const ecc_js_1 = require("./ecc.js");
41
- const hash_js_1 = require("./hash.js");
42
- const publicKeyCrypto_js_1 = require("./publicKeyCrypto.js");
43
- (0, ecc_js_1.__setEcc)(new ffi.Ecc());
44
- (0, hash_js_1.__setHashes)({
45
- sha256: ffi.sha256,
46
- sha256d: ffi.sha256d,
47
- shaRmd160: ffi.shaRmd160,
48
- sha512: ffi.sha512,
49
- Sha256H: ffi.Sha256H,
50
- Sha512H: ffi.Sha512H,
51
- });
52
- (0, publicKeyCrypto_js_1.__setPkc)({
53
- algoSupported: ffi.publicKeyCryptoAlgoSupported,
54
- verify: ffi.publicKeyCryptoVerify,
55
- });
56
- //# sourceMappingURL=initNodeJs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initNodeJs.js","sourceRoot":"","sources":["../src/initNodeJs.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtE,oEAAsD;AACtD,qCAAoC;AACpC,uCAAwC;AACxC,6DAAgD;AAEhD,IAAA,iBAAQ,EAAC,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;AACxB,IAAA,qBAAW,EAAC;IACR,MAAM,EAAE,GAAG,CAAC,MAAM;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO;IACpB,SAAS,EAAE,GAAG,CAAC,SAAS;IACxB,MAAM,EAAE,GAAG,CAAC,MAAM;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO;IACpB,OAAO,EAAE,GAAG,CAAC,OAAO;CACvB,CAAC,CAAC;AACH,IAAA,6BAAQ,EAAC;IACL,aAAa,EAAE,GAAG,CAAC,4BAA4B;IAC/C,MAAM,EAAE,GAAG,CAAC,qBAAqB;CACpC,CAAC,CAAC"}
@@ -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
- }