ecash-lib 4.13.0-rc.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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/ffi/ecash_lib_wasm_bg_browser.js +22065 -2616
  3. package/dist/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
  4. package/dist/ffi/ecash_lib_wasm_bg_browser.wasm.d.ts +3 -3
  5. package/dist/ffi/ecash_lib_wasm_browser.d.ts +20 -20
  6. package/dist/ffi/ecash_lib_wasm_browser.js +84 -83
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/initWasm.js +3 -4
  12. package/dist/initWasm.js.map +1 -1
  13. package/package.json +51 -62
  14. package/src/ffi/ecash_lib_wasm_bg_browser.js +22065 -2616
  15. package/src/ffi/ecash_lib_wasm_bg_browser.wasm +0 -0
  16. package/src/ffi/ecash_lib_wasm_bg_browser.wasm.d.ts +3 -3
  17. package/src/ffi/ecash_lib_wasm_browser.d.ts +20 -20
  18. package/src/ffi/ecash_lib_wasm_browser.js +84 -83
  19. package/src/index.ts +2 -0
  20. package/src/initWasm.ts +3 -4
  21. package/dist/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
  22. package/dist/ffi/ecash_lib_wasm_bg_nodejs.wasm.d.ts +0 -40
  23. package/dist/ffi/ecash_lib_wasm_nodejs.d.ts +0 -180
  24. package/dist/ffi/ecash_lib_wasm_nodejs.js +0 -726
  25. package/dist/indexBrowser.d.ts +0 -3
  26. package/dist/indexBrowser.d.ts.map +0 -1
  27. package/dist/indexBrowser.js +0 -22
  28. package/dist/indexBrowser.js.map +0 -1
  29. package/dist/indexNodeJs.d.ts +0 -3
  30. package/dist/indexNodeJs.d.ts.map +0 -1
  31. package/dist/indexNodeJs.js +0 -22
  32. package/dist/indexNodeJs.js.map +0 -1
  33. package/dist/initBrowser.d.ts +0 -2
  34. package/dist/initBrowser.d.ts.map +0 -1
  35. package/dist/initBrowser.js +0 -7
  36. package/dist/initBrowser.js.map +0 -1
  37. package/dist/initNodeJs.d.ts +0 -2
  38. package/dist/initNodeJs.d.ts.map +0 -1
  39. package/dist/initNodeJs.js +0 -7
  40. package/dist/initNodeJs.js.map +0 -1
  41. package/dist/payment/p2shInputData.d.ts +0 -18
  42. package/dist/payment/p2shInputData.d.ts.map +0 -1
  43. package/dist/payment/p2shInputData.js +0 -88
  44. package/dist/payment/p2shInputData.js.map +0 -1
  45. package/src/ffi/ecash_lib_wasm_bg_nodejs.wasm +0 -0
  46. package/src/ffi/ecash_lib_wasm_bg_nodejs.wasm.d.ts +0 -40
  47. package/src/ffi/ecash_lib_wasm_nodejs.d.ts +0 -180
  48. package/src/ffi/ecash_lib_wasm_nodejs.js +0 -726
  49. package/src/indexBrowser.ts +0 -6
  50. package/src/indexNodeJs.ts +0 -6
  51. package/src/initBrowser.ts +0 -5
  52. package/src/initNodeJs.ts +0 -5
@@ -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
- import './initWasm.js';
2
- //# sourceMappingURL=initBrowser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initBrowser.d.ts","sourceRoot":"","sources":["../src/initBrowser.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,CAAC"}
@@ -1,7 +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
- Object.defineProperty(exports, "__esModule", { value: true });
6
- require("./initWasm.js");
7
- //# sourceMappingURL=initBrowser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initBrowser.js","sourceRoot":"","sources":["../src/initBrowser.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;AAEtE,yBAAuB"}
@@ -1,2 +0,0 @@
1
- import './initWasm.js';
2
- //# sourceMappingURL=initNodeJs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initNodeJs.d.ts","sourceRoot":"","sources":["../src/initNodeJs.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,CAAC"}
@@ -1,7 +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
- Object.defineProperty(exports, "__esModule", { value: true });
6
- require("./initWasm.js");
7
- //# 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,yBAAuB"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Parse scriptSig from a P2SH input that uses the P2SH_INPUT_DATA redeem script format:
3
- * Redeem script: pushBytes(data) OP_DROP OP_CHECKSIG
4
- * scriptSig = <sig> <pubkey> <redeemScript>
5
- *
6
- * @param scriptSig - The scriptSig bytes from the spending input
7
- * @returns The sender's P2PKH address, or undefined if the scriptSig doesn't match the expected format
8
- */
9
- export declare function getP2shInputDataSenderAddress(scriptSig: Uint8Array, prefix?: string): string | undefined;
10
- /**
11
- * Parse scriptSig from a P2SH input that uses the P2SH_INPUT_DATA redeem script format
12
- * and return the data push from the redeem script.
13
- *
14
- * @param scriptSig - The scriptSig bytes from the spending input
15
- * @returns The data bytes from the redeem script, or undefined if the format doesn't match
16
- */
17
- export declare function getP2shInputDataData(scriptSig: Uint8Array): Uint8Array | undefined;
18
- //# sourceMappingURL=p2shInputData.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"p2shInputData.d.ts","sourceRoot":"","sources":["../../src/payment/p2shInputData.ts"],"names":[],"mappings":"AASA;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CACzC,SAAS,EAAE,UAAU,EACrB,MAAM,SAAU,GACjB,MAAM,GAAG,SAAS,CA2BpB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAkClF"}
@@ -1,88 +0,0 @@
1
- "use strict";
2
- // Copyright (c) 2026 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
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getP2shInputDataSenderAddress = getP2shInputDataSenderAddress;
7
- exports.getP2shInputDataData = getP2shInputDataData;
8
- const bytes_js_1 = require("../io/bytes.js");
9
- const op_js_1 = require("../op.js");
10
- const hash_js_1 = require("../hash.js");
11
- const address_js_1 = require("../address/address.js");
12
- /**
13
- * Parse scriptSig from a P2SH input that uses the P2SH_INPUT_DATA redeem script format:
14
- * Redeem script: pushBytes(data) OP_DROP OP_CHECKSIG
15
- * scriptSig = <sig> <pubkey> <redeemScript>
16
- *
17
- * @param scriptSig - The scriptSig bytes from the spending input
18
- * @returns The sender's P2PKH address, or undefined if the scriptSig doesn't match the expected format
19
- */
20
- function getP2shInputDataSenderAddress(scriptSig, prefix = 'ecash') {
21
- const pushes = [];
22
- const bytes = new bytes_js_1.Bytes(scriptSig);
23
- while (bytes.data.length - bytes.idx > 0) {
24
- try {
25
- const op = (0, op_js_1.readOp)(bytes);
26
- if ((0, op_js_1.isPushOp)(op)) {
27
- pushes.push(op.data);
28
- }
29
- }
30
- catch {
31
- return undefined;
32
- }
33
- }
34
- // scriptSig = <sig> <pubkey> <redeemScript> - we need the pubkey (second-to-last)
35
- if (pushes.length < 2) {
36
- return undefined;
37
- }
38
- const pubkey = pushes[pushes.length - 2];
39
- // Pubkey is typically 33 bytes (compressed) or 65 bytes (uncompressed)
40
- if (pubkey.length !== 33 && pubkey.length !== 65) {
41
- return undefined;
42
- }
43
- const pkh = (0, hash_js_1.shaRmd160)(pubkey);
44
- return address_js_1.Address.p2pkh(pkh, prefix).toString();
45
- }
46
- /**
47
- * Parse scriptSig from a P2SH input that uses the P2SH_INPUT_DATA redeem script format
48
- * and return the data push from the redeem script.
49
- *
50
- * @param scriptSig - The scriptSig bytes from the spending input
51
- * @returns The data bytes from the redeem script, or undefined if the format doesn't match
52
- */
53
- function getP2shInputDataData(scriptSig) {
54
- const pushes = [];
55
- const bytes = new bytes_js_1.Bytes(scriptSig);
56
- while (bytes.data.length - bytes.idx > 0) {
57
- try {
58
- const op = (0, op_js_1.readOp)(bytes);
59
- if ((0, op_js_1.isPushOp)(op)) {
60
- pushes.push(op.data);
61
- }
62
- }
63
- catch {
64
- return undefined;
65
- }
66
- }
67
- // scriptSig = <sig> <pubkey> <redeemScript> - redeem script is last push
68
- if (pushes.length < 1) {
69
- return undefined;
70
- }
71
- const redeemScript = pushes[pushes.length - 1];
72
- // Redeem script: pushBytes(data) OP_DROP OP_CHECKSIG - first op is the data push
73
- const redeemBytes = new bytes_js_1.Bytes(redeemScript);
74
- if (redeemBytes.data.length - redeemBytes.idx < 1) {
75
- return undefined;
76
- }
77
- try {
78
- const firstOp = (0, op_js_1.readOp)(redeemBytes);
79
- if (!(0, op_js_1.isPushOp)(firstOp)) {
80
- return undefined;
81
- }
82
- return firstOp.data;
83
- }
84
- catch {
85
- return undefined;
86
- }
87
- }
88
- //# sourceMappingURL=p2shInputData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"p2shInputData.js","sourceRoot":"","sources":["../../src/payment/p2shInputData.ts"],"names":[],"mappings":"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"}
@@ -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 sha512h_new(): number;
17
- export function sha512h_update(a: number, b: number, c: number): void;
18
- export function sha512h_finalize(a: number, b: number): void;
19
- export function sha512h_clone(a: number): number;
20
- export function sha256h_new(): number;
21
- export function sha256h_update(a: number, b: number, c: number): void;
22
- export function sha256h_finalize(a: number, b: number): void;
23
- export function sha256h_clone(a: number): number;
24
- export function __wbg_sha256h_free(a: number): void;
25
- export function sha512(a: number, b: number, c: number): void;
26
- export function sha256d(a: number, b: number, c: number): void;
27
- export function sha256(a: number, b: number, c: number): void;
28
- export function shaRmd160(a: number, b: number, c: number): void;
29
- 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;
30
- export function publicKeyCryptoAlgoSupported(a: number, b: number, c: number, d: number, e: number): void;
31
- export function ecash_secp256k1_context_create(a: number): number;
32
- export function ecash_secp256k1_context_destroy(a: number): void;
33
- export function secp256k1_default_illegal_callback_fn(a: number, b: number): void;
34
- export function secp256k1_default_error_callback_fn(a: number, b: number): void;
35
- export function ring_core_0_17_14__bn_mul_mont(a: number, b: number, c: number, d: number, e: number, f: number): void;
36
- export function __wbg_sha512h_free(a: 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
- * Calculate SHA512(data).
5
- * @param {Uint8Array} data
6
- * @returns {Uint8Array}
7
- */
8
- export function sha512(data: Uint8Array): Uint8Array;
9
- /**
10
- * Calculate SHA256(SHA256(data)).
11
- * @param {Uint8Array} data
12
- * @returns {Uint8Array}
13
- */
14
- export function sha256d(data: Uint8Array): Uint8Array;
15
- /**
16
- * Calculate SHA256(data).
17
- * @param {Uint8Array} data
18
- * @returns {Uint8Array}
19
- */
20
- export function sha256(data: Uint8Array): Uint8Array;
21
- /**
22
- * Calculate RIPEMD160(SHA256(data)), commonly used as address hash.
23
- * @param {Uint8Array} data
24
- * @returns {Uint8Array}
25
- */
26
- export function shaRmd160(data: Uint8Array): Uint8Array;
27
- /**
28
- * Verify a signature for the given cryptographic algorithm.
29
- * Intended to be used in X509 certificate verification.
30
- * Throw an exception if the algorithm is not supported.
31
- * @param {string} algo_oid
32
- * @param {string | undefined} params
33
- * @param {Uint8Array} sig
34
- * @param {Uint8Array} msg
35
- * @param {Uint8Array} pk
36
- */
37
- export function publicKeyCryptoVerify(algo_oid: string, params: string | undefined, sig: Uint8Array, msg: Uint8Array, pk: Uint8Array): void;
38
- /**
39
- * Throw an exception if the given algo is not supported, otherwise do nothing.
40
- * @param {string} algo_oid
41
- * @param {string | undefined} [params]
42
- */
43
- export function publicKeyCryptoAlgoSupported(algo_oid: string, params?: string): void;
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
- }