quantum-coin-js-sdk 2.0.1 → 2.1.1
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 +13 -0
- package/index.d.ts +9 -0
- package/index.js +37 -4
- package/package.json +12 -4
- package/wasmBase64.js +3 -2
- package/.gitignore +0 -4
- package/.idea/.name +0 -1
- package/.idea/modules.xml +0 -8
- package/.idea/quantum-coin-js-sdk.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.vs/ProjectSettings.json +0 -3
- package/.vs/VSWorkspaceState.json +0 -8
- package/.vs/quantum-coin-js-sdk/FileContentIndex/a9d6de82-cfc3-4c22-ac38-06d706ff3673.vsidx +0 -0
- package/.vs/quantum-coin-js-sdk/FileContentIndex/fdc816df-1898-4153-99f2-c69ef4c2283b.vsidx +0 -0
- package/.vs/quantum-coin-js-sdk/config/applicationhost.config +0 -1011
- package/.vs/quantum-coin-js-sdk/v17/.wsuo +0 -0
- package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.backup.json +0 -39
- package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.json +0 -57
- package/.vs/slnx.sqlite +0 -0
- package/example/README.md +0 -14
- package/example/conversion-example.js +0 -19
- package/example/example-create-contract.js +0 -396
- package/example/example-encode-decode-rlp.js +0 -225
- package/example/example-event-pack-unpack.js +0 -391
- package/example/example-misc.js +0 -96
- package/example/example-token-pack-unpack.js +0 -960
- package/example/example-wallet-version4.js +0 -34
- package/example/example-wallet.js +0 -39
- package/example/example.js +0 -115
- package/example/node_modules/.bin/sdkgen +0 -16
- package/example/node_modules/.bin/sdkgen.cmd +0 -17
- package/example/node_modules/.bin/sdkgen.ps1 +0 -28
- package/example/node_modules/.package-lock.json +0 -51
- package/example/node_modules/quantumcoin/.github/workflows/publish-npmjs.yaml +0 -22
- package/example/node_modules/quantumcoin/LICENSE +0 -21
- package/example/node_modules/quantumcoin/README-SDK.md +0 -828
- package/example/node_modules/quantumcoin/README.md +0 -197
- package/example/node_modules/quantumcoin/config.d.ts +0 -50
- package/example/node_modules/quantumcoin/config.js +0 -123
- package/example/node_modules/quantumcoin/examples/AllSolidityTypes.sol +0 -184
- package/example/node_modules/quantumcoin/examples/SimpleIERC20.sol +0 -74
- package/example/node_modules/quantumcoin/examples/events.js +0 -41
- package/example/node_modules/quantumcoin/examples/events.ts +0 -35
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.js +0 -100
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.ts +0 -77
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.js +0 -100
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.ts +0 -77
- package/example/node_modules/quantumcoin/examples/example.js +0 -67
- package/example/node_modules/quantumcoin/examples/example.ts +0 -56
- package/example/node_modules/quantumcoin/examples/offline-signing.js +0 -77
- package/example/node_modules/quantumcoin/examples/offline-signing.ts +0 -65
- package/example/node_modules/quantumcoin/examples/package-lock.json +0 -596
- package/example/node_modules/quantumcoin/examples/package.json +0 -32
- package/example/node_modules/quantumcoin/examples/read-operations.js +0 -32
- package/example/node_modules/quantumcoin/examples/read-operations.ts +0 -31
- package/example/node_modules/quantumcoin/examples/sdk-generator-erc20.inline.json +0 -251
- package/example/node_modules/quantumcoin/examples/solidity-types.ts +0 -43
- package/example/node_modules/quantumcoin/examples/wallet-offline.js +0 -36
- package/example/node_modules/quantumcoin/examples/wallet-offline.ts +0 -26
- package/example/node_modules/quantumcoin/generate-sdk.js +0 -1846
- package/example/node_modules/quantumcoin/index.js +0 -12
- package/example/node_modules/quantumcoin/package.json +0 -95
- package/example/node_modules/quantumcoin/scripts/copy-declarations.js +0 -31
- package/example/node_modules/quantumcoin/scripts/run-all-one-by-one.js +0 -151
- package/example/node_modules/quantumcoin/src/abi/fragments.d.ts +0 -42
- package/example/node_modules/quantumcoin/src/abi/fragments.js +0 -63
- package/example/node_modules/quantumcoin/src/abi/index.d.ts +0 -13
- package/example/node_modules/quantumcoin/src/abi/index.js +0 -9
- package/example/node_modules/quantumcoin/src/abi/interface.d.ts +0 -128
- package/example/node_modules/quantumcoin/src/abi/interface.js +0 -605
- package/example/node_modules/quantumcoin/src/abi/js-abi-coder.d.ts +0 -8
- package/example/node_modules/quantumcoin/src/abi/js-abi-coder.js +0 -538
- package/example/node_modules/quantumcoin/src/constants.d.ts +0 -61
- package/example/node_modules/quantumcoin/src/constants.js +0 -94
- package/example/node_modules/quantumcoin/src/contract/contract-factory.d.ts +0 -28
- package/example/node_modules/quantumcoin/src/contract/contract-factory.js +0 -111
- package/example/node_modules/quantumcoin/src/contract/contract.d.ts +0 -113
- package/example/node_modules/quantumcoin/src/contract/contract.js +0 -408
- package/example/node_modules/quantumcoin/src/contract/index.d.ts +0 -9
- package/example/node_modules/quantumcoin/src/contract/index.js +0 -9
- package/example/node_modules/quantumcoin/src/errors/index.d.ts +0 -92
- package/example/node_modules/quantumcoin/src/errors/index.js +0 -200
- package/example/node_modules/quantumcoin/src/generator/index.d.ts +0 -81
- package/example/node_modules/quantumcoin/src/generator/index.js +0 -1571
- package/example/node_modules/quantumcoin/src/index.d.ts +0 -122
- package/example/node_modules/quantumcoin/src/index.js +0 -41
- package/example/node_modules/quantumcoin/src/internal/hex.d.ts +0 -68
- package/example/node_modules/quantumcoin/src/internal/hex.js +0 -180
- package/example/node_modules/quantumcoin/src/providers/extra-providers.d.ts +0 -139
- package/example/node_modules/quantumcoin/src/providers/extra-providers.js +0 -614
- package/example/node_modules/quantumcoin/src/providers/index.d.ts +0 -17
- package/example/node_modules/quantumcoin/src/providers/index.js +0 -10
- package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.d.ts +0 -12
- package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.js +0 -89
- package/example/node_modules/quantumcoin/src/providers/provider.d.ts +0 -206
- package/example/node_modules/quantumcoin/src/providers/provider.js +0 -524
- package/example/node_modules/quantumcoin/src/types/index.d.ts +0 -214
- package/example/node_modules/quantumcoin/src/types/index.js +0 -9
- package/example/node_modules/quantumcoin/src/utils/address.d.ts +0 -58
- package/example/node_modules/quantumcoin/src/utils/address.js +0 -144
- package/example/node_modules/quantumcoin/src/utils/encoding.d.ts +0 -120
- package/example/node_modules/quantumcoin/src/utils/encoding.js +0 -306
- package/example/node_modules/quantumcoin/src/utils/fixednumber.d.ts +0 -57
- package/example/node_modules/quantumcoin/src/utils/fixednumber.js +0 -366
- package/example/node_modules/quantumcoin/src/utils/hashing.d.ts +0 -76
- package/example/node_modules/quantumcoin/src/utils/hashing.js +0 -298
- package/example/node_modules/quantumcoin/src/utils/index.d.ts +0 -63
- package/example/node_modules/quantumcoin/src/utils/index.js +0 -14
- package/example/node_modules/quantumcoin/src/utils/result.d.ts +0 -57
- package/example/node_modules/quantumcoin/src/utils/result.js +0 -128
- package/example/node_modules/quantumcoin/src/utils/rlp.d.ts +0 -12
- package/example/node_modules/quantumcoin/src/utils/rlp.js +0 -215
- package/example/node_modules/quantumcoin/src/utils/units.d.ts +0 -29
- package/example/node_modules/quantumcoin/src/utils/units.js +0 -107
- package/example/node_modules/quantumcoin/src/wallet/index.d.ts +0 -10
- package/example/node_modules/quantumcoin/src/wallet/index.js +0 -8
- package/example/node_modules/quantumcoin/src/wallet/wallet.d.ts +0 -192
- package/example/node_modules/quantumcoin/src/wallet/wallet.js +0 -713
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.js +0 -207
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.ts +0 -191
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.fixtures.js +0 -231
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +0 -387
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +0 -350
- package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.js +0 -165
- package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.ts +0 -160
- package/example/node_modules/quantumcoin/test/e2e/helpers.js +0 -59
- package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.js +0 -141
- package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.ts +0 -128
- package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.js +0 -168
- package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +0 -141
- package/example/node_modules/quantumcoin/test/e2e/transactional.test.js +0 -245
- package/example/node_modules/quantumcoin/test/e2e/transactional.test.ts +0 -208
- package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.js +0 -407
- package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.ts +0 -337
- package/example/node_modules/quantumcoin/test/fixtures/ConstructorParam.sol +0 -23
- package/example/node_modules/quantumcoin/test/fixtures/MultiContracts.sol +0 -37
- package/example/node_modules/quantumcoin/test/fixtures/SimpleStorage.sol +0 -18
- package/example/node_modules/quantumcoin/test/fixtures/StakingContract.abi.json +0 -1
- package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.js +0 -49
- package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.ts +0 -44
- package/example/node_modules/quantumcoin/test/integration/provider.test.js +0 -88
- package/example/node_modules/quantumcoin/test/integration/provider.test.ts +0 -85
- package/example/node_modules/quantumcoin/test/integration/ws-provider.test.js +0 -41
- package/example/node_modules/quantumcoin/test/integration/ws-provider.test.ts +0 -38
- package/example/node_modules/quantumcoin/test/security/abi-decoder-bounds.test.js +0 -122
- package/example/node_modules/quantumcoin/test/security/contract-overrides.test.js +0 -112
- package/example/node_modules/quantumcoin/test/security/generator-injection.test.js +0 -195
- package/example/node_modules/quantumcoin/test/security/malformed-input.test.js +0 -330
- package/example/node_modules/quantumcoin/test/security/malformed-input.test.ts +0 -35
- package/example/node_modules/quantumcoin/test/security/rpc-numeric-bounds.test.js +0 -81
- package/example/node_modules/quantumcoin/test/security/rpc-trust.test.js +0 -202
- package/example/node_modules/quantumcoin/test/unit/_encrypted-output.txt +0 -6
- package/example/node_modules/quantumcoin/test/unit/_log-encrypted-jsons.js +0 -45
- package/example/node_modules/quantumcoin/test/unit/_write-keystore-fixture.js +0 -16
- package/example/node_modules/quantumcoin/test/unit/abi-interface.test.js +0 -110
- package/example/node_modules/quantumcoin/test/unit/abi-interface.test.ts +0 -109
- package/example/node_modules/quantumcoin/test/unit/address-wallet.test.js +0 -923
- package/example/node_modules/quantumcoin/test/unit/address-wallet.test.ts +0 -877
- package/example/node_modules/quantumcoin/test/unit/browser-provider.test.js +0 -85
- package/example/node_modules/quantumcoin/test/unit/browser-provider.test.ts +0 -79
- package/example/node_modules/quantumcoin/test/unit/contract.test.js +0 -85
- package/example/node_modules/quantumcoin/test/unit/contract.test.ts +0 -83
- package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.js +0 -127
- package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.ts +0 -91
- package/example/node_modules/quantumcoin/test/unit/errors.test.js +0 -77
- package/example/node_modules/quantumcoin/test/unit/errors.test.ts +0 -76
- package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.js +0 -55
- package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.ts +0 -54
- package/example/node_modules/quantumcoin/test/unit/fixednumber.test.js +0 -656
- package/example/node_modules/quantumcoin/test/unit/fixednumber.test.ts +0 -660
- package/example/node_modules/quantumcoin/test/unit/fixtures/encrypted-keystores-48-32-36.js +0 -9
- package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.js +0 -42
- package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.ts +0 -41
- package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.js +0 -113
- package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.ts +0 -110
- package/example/node_modules/quantumcoin/test/unit/generator.test.js +0 -149
- package/example/node_modules/quantumcoin/test/unit/generator.test.ts +0 -148
- package/example/node_modules/quantumcoin/test/unit/hashing.test.js +0 -64
- package/example/node_modules/quantumcoin/test/unit/hashing.test.ts +0 -63
- package/example/node_modules/quantumcoin/test/unit/init.test.js +0 -39
- package/example/node_modules/quantumcoin/test/unit/init.test.ts +0 -38
- package/example/node_modules/quantumcoin/test/unit/interface.test.js +0 -56
- package/example/node_modules/quantumcoin/test/unit/interface.test.ts +0 -54
- package/example/node_modules/quantumcoin/test/unit/internal-hex.test.js +0 -81
- package/example/node_modules/quantumcoin/test/unit/internal-hex.test.ts +0 -80
- package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.js +0 -98
- package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.ts +0 -64
- package/example/node_modules/quantumcoin/test/unit/providers.test.js +0 -252
- package/example/node_modules/quantumcoin/test/unit/providers.test.ts +0 -251
- package/example/node_modules/quantumcoin/test/unit/result.test.js +0 -80
- package/example/node_modules/quantumcoin/test/unit/result.test.ts +0 -79
- package/example/node_modules/quantumcoin/test/unit/solidity-types.test.js +0 -49
- package/example/node_modules/quantumcoin/test/unit/solidity-types.test.ts +0 -39
- package/example/node_modules/quantumcoin/test/unit/utils.test.js +0 -57
- package/example/node_modules/quantumcoin/test/unit/utils.test.ts +0 -56
- package/example/node_modules/quantumcoin/test/verbose-logger.js +0 -74
- package/example/node_modules/quantumcoin/tsconfig.build.json +0 -14
- package/example/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +0 -22
- package/example/node_modules/seed-words/BUILD.md +0 -7
- package/example/node_modules/seed-words/LICENSE +0 -121
- package/example/node_modules/seed-words/README.md +0 -67
- package/example/node_modules/seed-words/dist/seedwords.d.ts +0 -39
- package/example/node_modules/seed-words/package.json +0 -27
- package/example/node_modules/seed-words/seedwords.js +0 -315
- package/example/node_modules/seed-words/seedwords.txt +0 -65536
- package/example/node_modules/seed-words/tsconfig.json +0 -21
- package/example/package-lock.json +0 -60
- package/example/package.json +0 -15
- package/scripts/build-browser-tests.js +0 -29
- package/scripts/build-wasm.js +0 -85
- package/tests/browser/bundle.js +0 -97643
- package/tests/browser/entry.js +0 -57
- package/tests/browser/harness.html +0 -20
- package/tests/browser/run-browser.js +0 -50
- package/tests/encrypted-32.json +0 -1
- package/tests/encrypted-36.json +0 -1
- package/tests/encrypted-48.json +0 -1
- package/tests/generate-verify-vectors.js +0 -88
- package/tests/get-gas-price.test.js +0 -59
- package/tests/hashing.test.js +0 -34
- package/tests/non-transactional.preinit.test.js +0 -33
- package/tests/non-transactional.test.js +0 -1318
- package/tests/sign-raw-keytype5-context-null.test.js +0 -105
- package/tests/sign-raw-transaction.test.js +0 -194
- package/tests/sign-verify.test.js +0 -308
- package/tests/specs/assert.js +0 -74
- package/tests/specs/crypto.spec.js +0 -104
- package/tests/specs/hex.js +0 -31
- package/tests/specs/preinit.spec.js +0 -19
- package/tests/specs/sign.spec.js +0 -90
- package/tests/specs/wallet.spec.js +0 -98
- package/tests/transactional.rpc.test.js +0 -102
- package/tests/verify-vectors.json +0 -95035
package/README.md
CHANGED
|
@@ -99,6 +99,7 @@ The SDK runs in modern browsers as well as Node.js (Node 16+ / a browser with We
|
|
|
99
99
|
* [~scryptDeriveKey(secret, salt, N, r, p, dkLen)](#module_quantum-coin-js-sdk..scryptDeriveKey) ⇒ <code>Array.<number></code>
|
|
100
100
|
* [~sha256(data)](#module_quantum-coin-js-sdk..sha256) ⇒ <code>Array.<number></code>
|
|
101
101
|
* [~sha512(data)](#module_quantum-coin-js-sdk..sha512) ⇒ <code>Array.<number></code>
|
|
102
|
+
* [~keccak256(data)](#module_quantum-coin-js-sdk..keccak256) ⇒ <code>Array.<number></code>
|
|
102
103
|
* [~ripemd160(data)](#module_quantum-coin-js-sdk..ripemd160) ⇒ <code>Array.<number></code>
|
|
103
104
|
* [~computeHmac(algorithm, key, data)](#module_quantum-coin-js-sdk..computeHmac) ⇒ <code>Array.<number></code>
|
|
104
105
|
* [~pbkdf2(password, salt, iterations, keylen, algorithm)](#module_quantum-coin-js-sdk..pbkdf2) ⇒ <code>Array.<number></code>
|
|
@@ -847,6 +848,18 @@ The sha512 function computes the SHA-512 digest of the input.
|
|
|
847
848
|
| --- | --- | --- |
|
|
848
849
|
| data | <code>string</code> \| <code>Uint8Array</code> \| <code>Array.<number></code> | The data to hash (string -> UTF-8 bytes). |
|
|
849
850
|
|
|
851
|
+
<a name="module_quantum-coin-js-sdk..keccak256"></a>
|
|
852
|
+
|
|
853
|
+
### quantum-coin-js-sdk~keccak256(data) ⇒ <code>Array.<number></code>
|
|
854
|
+
The keccak256 function computes the Keccak-256 digest of the input. This is the Ethereum-style Keccak-256 (legacy padding), not SHA3-256.
|
|
855
|
+
|
|
856
|
+
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
857
|
+
**Returns**: <code>Array.<number></code> - - The 32-byte digest as a byte array. Returns -1000 before initialize(), or null on invalid input.
|
|
858
|
+
|
|
859
|
+
| Param | Type | Description |
|
|
860
|
+
| --- | --- | --- |
|
|
861
|
+
| data | <code>string</code> \| <code>Uint8Array</code> \| <code>Array.<number></code> | The data to hash (string -> UTF-8 bytes). |
|
|
862
|
+
|
|
850
863
|
<a name="module_quantum-coin-js-sdk..ripemd160"></a>
|
|
851
864
|
|
|
852
865
|
### quantum-coin-js-sdk~ripemd160(data) ⇒ <code>Array.<number></code>
|
package/index.d.ts
CHANGED
|
@@ -233,6 +233,15 @@ export function sha256(data: string | Uint8Array | number[]): number[];
|
|
|
233
233
|
* @return {number[]} - The 64-byte digest as a byte array. Returns null on invalid input.
|
|
234
234
|
*/
|
|
235
235
|
export function sha512(data: string | Uint8Array | number[]): number[];
|
|
236
|
+
/**
|
|
237
|
+
* The keccak256 function computes the Keccak-256 digest of the input.
|
|
238
|
+
* This is the Ethereum-style Keccak-256 (legacy padding), not SHA3-256.
|
|
239
|
+
*
|
|
240
|
+
* @function keccak256
|
|
241
|
+
* @param {string|Uint8Array|number[]} data - The data to hash (string -> UTF-8 bytes).
|
|
242
|
+
* @return {number[]} - The 32-byte digest as a byte array. Returns null on invalid input.
|
|
243
|
+
*/
|
|
244
|
+
export function keccak256(data: string | Uint8Array | number[]): number[];
|
|
236
245
|
/**
|
|
237
246
|
* The ripemd160 function computes the RIPEMD-160 digest of the input.
|
|
238
247
|
*
|
package/index.js
CHANGED
|
@@ -65,7 +65,7 @@ const SCRYPT_SUPPORTED_P = 1;
|
|
|
65
65
|
const SCRYPT_SUPPORTED_DKLEN = 32;
|
|
66
66
|
const INVALID_KEY_TYPE = -1001;
|
|
67
67
|
const CIRCL_CRYPTO_FAILURE = -1002;
|
|
68
|
-
const EXPECTED_WASM_SHA256 = "
|
|
68
|
+
const EXPECTED_WASM_SHA256 = "e2d721ae6dd7c1b855623a54050892892c1161ef9d49c76f77d106d37ec0b555";
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* @class
|
|
@@ -330,6 +330,26 @@ function getGlobalObject() {
|
|
|
330
330
|
return (typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this);
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
function base64ToBytesFast(b64) {
|
|
334
|
+
if (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {
|
|
335
|
+
return new Uint8Array(Buffer.from(b64, 'base64'));
|
|
336
|
+
}
|
|
337
|
+
if (typeof Uint8Array.fromBase64 === 'function') {
|
|
338
|
+
return Uint8Array.fromBase64(b64);
|
|
339
|
+
}
|
|
340
|
+
const bin = atob(b64);
|
|
341
|
+
const bytes = new Uint8Array(bin.length);
|
|
342
|
+
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
|
343
|
+
return bytes;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
async function gunzipToUint8Array(compressed) {
|
|
347
|
+
const ds = new DecompressionStream('gzip');
|
|
348
|
+
const stream = new Response(compressed).body.pipeThrough(ds);
|
|
349
|
+
const buf = await new Response(stream).arrayBuffer();
|
|
350
|
+
return new Uint8Array(buf);
|
|
351
|
+
}
|
|
352
|
+
|
|
333
353
|
async function InitAccountsWebAssembly() {
|
|
334
354
|
const GoCtor = getGlobalObject().Go;
|
|
335
355
|
if (typeof GoCtor !== 'function') {
|
|
@@ -339,11 +359,11 @@ async function InitAccountsWebAssembly() {
|
|
|
339
359
|
let mod, inst;
|
|
340
360
|
var base64wasm = wasmBase64.getBase64Wasm();
|
|
341
361
|
|
|
342
|
-
const
|
|
343
|
-
if (
|
|
362
|
+
const compressed = base64ToBytesFast(base64wasm);
|
|
363
|
+
if (compressed === null || compressed === undefined || compressed.length === 0) {
|
|
344
364
|
throw new Error("Error parsing base64");
|
|
345
365
|
}
|
|
346
|
-
const wasmBytes =
|
|
366
|
+
const wasmBytes = await gunzipToUint8Array(compressed);
|
|
347
367
|
|
|
348
368
|
// Platform-agnostic integrity check via the Web Crypto API (available in
|
|
349
369
|
// browsers and Node 16+ as globalThis.crypto.subtle). Runs before the WASM
|
|
@@ -1741,6 +1761,18 @@ function sha512(data) {
|
|
|
1741
1761
|
return _digest((b64) => Sha512(b64), data);
|
|
1742
1762
|
}
|
|
1743
1763
|
|
|
1764
|
+
/**
|
|
1765
|
+
* The keccak256 function computes the Keccak-256 digest of the input.
|
|
1766
|
+
* This is the Ethereum-style Keccak-256 (legacy padding), not SHA3-256.
|
|
1767
|
+
*
|
|
1768
|
+
* @function keccak256
|
|
1769
|
+
* @param {string|Uint8Array|number[]} data - The data to hash (string -> UTF-8 bytes).
|
|
1770
|
+
* @return {number[]} - The 32-byte digest as a byte array. Returns -1000 before initialize(), or null on invalid input.
|
|
1771
|
+
*/
|
|
1772
|
+
function keccak256(data) {
|
|
1773
|
+
return _digest((b64) => Keccak256(b64), data);
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1744
1776
|
/**
|
|
1745
1777
|
* The ripemd160 function computes the RIPEMD-160 digest of the input.
|
|
1746
1778
|
*
|
|
@@ -2303,6 +2335,7 @@ module.exports = {
|
|
|
2303
2335
|
scryptDeriveKey,
|
|
2304
2336
|
sha256,
|
|
2305
2337
|
sha512,
|
|
2338
|
+
keccak256,
|
|
2306
2339
|
ripemd160,
|
|
2307
2340
|
computeHmac,
|
|
2308
2341
|
pbkdf2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quantum-coin-js-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Quantum Coin - Q SDK in JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,14 +8,22 @@
|
|
|
8
8
|
"test:browser": "node scripts/build-browser-tests.js && node tests/browser/run-browser.js",
|
|
9
9
|
"test:all": "npm test && npm run test:browser",
|
|
10
10
|
"build": "npx -p typescript tsc index.js --declaration --allowJs --emitDeclarationOnly",
|
|
11
|
-
"build:wasm": "node scripts/build-wasm.js"
|
|
11
|
+
"build:wasm": "node scripts/build-wasm.js --local",
|
|
12
|
+
"build:wasm:file": "node scripts/build-wasm.js --base64-file",
|
|
13
|
+
"build:wasm:url": "node scripts/build-wasm.js --base64-url"
|
|
12
14
|
},
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
15
17
|
"url": "git+https://github.com/quantumcoinproject/quantum-coin-js-sdk.git"
|
|
16
18
|
},
|
|
17
19
|
"files": [
|
|
18
|
-
"
|
|
20
|
+
"index.js",
|
|
21
|
+
"index.d.ts",
|
|
22
|
+
"wasm_exec.js",
|
|
23
|
+
"wasm_exec.d.ts",
|
|
24
|
+
"wasmBase64.js",
|
|
25
|
+
"wasmBase64.d.ts",
|
|
26
|
+
"LICENSE-wasm_exec.js.txt"
|
|
19
27
|
],
|
|
20
28
|
"keywords": [
|
|
21
29
|
"pqc",
|
|
@@ -32,7 +40,7 @@
|
|
|
32
40
|
},
|
|
33
41
|
"homepage": "https://github.com/quantumcoinproject/quantum-coin-js-sdk#readme",
|
|
34
42
|
"dependencies": {
|
|
35
|
-
"seed-words": "1.
|
|
43
|
+
"seed-words": "1.1.1"
|
|
36
44
|
},
|
|
37
45
|
"devDependencies": {
|
|
38
46
|
"@playwright/test": "^1.61.1",
|