@airgap/coinlib-core 0.13.45-beta.3 → 0.13.45-beta.5
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/actions/Action.js +83 -30
- package/actions/Action.js.map +1 -1
- package/actions/LinkedAction.js +82 -18
- package/actions/LinkedAction.js.map +1 -1
- package/actions/RepeatableAction.js +83 -20
- package/actions/RepeatableAction.js.map +1 -1
- package/actions/SimpleAction.js +74 -12
- package/actions/SimpleAction.js.map +1 -1
- package/actions/StateMachine.js +17 -16
- package/actions/StateMachine.js.map +1 -1
- package/data/KeyPair.d.ts +1 -0
- package/data/Lazy.js +64 -15
- package/data/Lazy.js.map +1 -1
- package/data/RPCBody.js +6 -3
- package/data/RPCBody.js.map +1 -1
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.d.ts +12 -12
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js +130 -88
- package/dependencies/src/@stablelib/binary-1.0.1/packages/binary/binary.js.map +1 -1
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.d.ts +3 -3
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js +61 -57
- package/dependencies/src/@stablelib/blake2b-1.0.1/packages/blake2b/blake2b.js.map +1 -1
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js +96 -96
- package/dependencies/src/@stablelib/ed25519-1.0.3/packages/ed25519/ed25519.js.map +1 -1
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js +2 -1
- package/dependencies/src/@stablelib/hash-1.0.1/packages/hash/hash.js.map +1 -1
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js +10 -8
- package/dependencies/src/@stablelib/int-1.0.1/packages/int/int.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js +28 -22
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/random.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js +10 -9
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/browser.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js +11 -10
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/node.js.map +1 -1
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js +8 -7
- package/dependencies/src/@stablelib/random-1.0.2/packages/random/source/system.js.map +1 -1
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.d.ts +3 -3
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js +63 -61
- package/dependencies/src/@stablelib/sha512/packages/sha512/sha512.js.map +1 -1
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.d.ts +4 -4
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js +63 -61
- package/dependencies/src/@stablelib/sha512-1.0.1/packages/sha512/sha512.js.map +1 -1
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.d.ts +1 -1
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js +3 -2
- package/dependencies/src/@stablelib/wipe-1.0.1/packages/wipe/wipe.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js +111 -111
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/codec.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js +15 -15
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/constants.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js +76 -47
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/decoder.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js +61 -46
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/encoder.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js +106 -61
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/error.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/interface.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.d.ts +6 -6
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js +100 -95
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/michelson/codec.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js +33 -33
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/codec-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js +9 -9
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/constants-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js +75 -46
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/decoder-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js +70 -45
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/encoder-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js +41 -41
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/proto14-kathmandu/michelson/codec-proto14.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js +4 -4
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/protocols.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.d.ts +2 -2
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js +63 -58
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/schema/operation.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js +33 -30
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/taquito-local-forging.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js +20 -18
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/uint8array-consumer.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.d.ts +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js +12 -5
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/utils.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js +13 -13
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-local-forging/src/validator.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/opkind.js.map +1 -1
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.d.ts +78 -78
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js +2 -2
- package/dependencies/src/@taquito/local-forging-15.0.1/packages/taquito-rpc/src/types.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.d.ts +45 -45
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js +76 -75
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/constants.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js +178 -115
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/errors.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.d.ts +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js +9 -6
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/format.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js +83 -78
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/taquito-utils.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js +36 -27
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/validators.js.map +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.d.ts +1 -1
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js +26 -25
- package/dependencies/src/@taquito/utils-15.0.1/packages/taquito-utils/src/verify-signature.js.map +1 -1
- package/dependencies/src/cosmjs/index.d.ts +230 -14
- package/dependencies/src/cosmjs/index.js +480 -373
- package/dependencies/src/cosmjs/index.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/index.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/index.js +19 -15
- package/dependencies/src/eciesjs-0.3.9/src/index.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js +28 -37
- package/dependencies/src/eciesjs-0.3.9/src/keys/PrivateKey.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js +30 -38
- package/dependencies/src/eciesjs-0.3.9/src/keys/PublicKey.js.map +1 -1
- package/dependencies/src/eciesjs-0.3.9/src/utils.d.ts +1 -0
- package/dependencies/src/eciesjs-0.3.9/src/utils.js +24 -33
- package/dependencies/src/eciesjs-0.3.9/src/utils.js.map +1 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js +34 -42
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-key.js.map +1 -1
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js +10 -6
- package/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/hd-wallet.js.map +1 -1
- package/errors/coinlib-error.d.ts +2 -1
- package/errors/coinlib-error.js +38 -16
- package/errors/coinlib-error.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.js +148 -89
- package/errors/index.js.map +1 -1
- package/index.js +19 -19
- package/index.js.map +1 -1
- package/interfaces/IAirGapSignedTransaction.d.ts +1 -1
- package/interfaces/IAirGapTransaction.js +3 -3
- package/interfaces/IAirGapTransaction.js.map +1 -1
- package/networks.js +9 -9
- package/networks.js.map +1 -1
- package/package.json +1 -1
- package/protocols/BlockExplorerProtocol.js +54 -7
- package/protocols/BlockExplorerProtocol.js.map +1 -1
- package/protocols/CryptoClient.js +78 -19
- package/protocols/CryptoClient.js.map +1 -1
- package/protocols/Ed25519CryptoClient.js +98 -30
- package/protocols/Ed25519CryptoClient.js.map +1 -1
- package/protocols/ICoinSubProtocol.js +1 -1
- package/protocols/ICoinSubProtocol.js.map +1 -1
- package/protocols/NonExtendedProtocol.js +29 -26
- package/protocols/NonExtendedProtocol.js.map +1 -1
- package/protocols/Secp256k1CryptoClient.js +73 -9
- package/protocols/Secp256k1CryptoClient.js.map +1 -1
- package/protocols/Sr25519CryptoClient.js +76 -12
- package/protocols/Sr25519CryptoClient.js.map +1 -1
- package/utils/AES.js +132 -81
- package/utils/AES.js.map +1 -1
- package/utils/ErrorWithData.js +23 -5
- package/utils/ErrorWithData.js.map +1 -1
- package/utils/Network.js +1 -1
- package/utils/Network.js.map +1 -1
- package/utils/ProtocolBlockExplorer.js +4 -3
- package/utils/ProtocolBlockExplorer.js.map +1 -1
- package/utils/ProtocolNetwork.js +16 -11
- package/utils/ProtocolNetwork.js.map +1 -1
- package/utils/ProtocolSymbols.d.ts +3 -1
- package/utils/ProtocolSymbols.js +8 -6
- package/utils/ProtocolSymbols.js.map +1 -1
- package/utils/array.js +15 -14
- package/utils/array.js.map +1 -1
- package/utils/assert.js +12 -8
- package/utils/assert.js.map +1 -1
- package/utils/base64Check.d.ts +1 -0
- package/utils/base64Check.js +15 -15
- package/utils/base64Check.js.map +1 -1
- package/utils/blake2b.js +14 -11
- package/utils/blake2b.js.map +1 -1
- package/utils/buffer.d.ts +1 -0
- package/utils/buffer.js +1 -1
- package/utils/buffer.js.map +1 -1
- package/utils/cache.js +87 -38
- package/utils/cache.js.map +1 -1
- package/utils/error.js +3 -2
- package/utils/error.js.map +1 -1
- package/utils/hex.d.ts +2 -1
- package/utils/hex.js +38 -31
- package/utils/hex.js.map +1 -1
- package/utils/interfaces.js +4 -3
- package/utils/interfaces.js.map +1 -1
- package/utils/object.js +7 -5
- package/utils/object.js.map +1 -1
- package/utils/padStart.js +2 -1
- package/utils/padStart.js.map +1 -1
- package/utils/remote-data/HttpRemoteData.js +107 -24
- package/utils/remote-data/HttpRemoteData.js.map +1 -1
- package/utils/remote-data/IpfsRemoteData.js +116 -32
- package/utils/remote-data/IpfsRemoteData.js.map +1 -1
- package/utils/remote-data/RemoteData.d.ts +1 -0
- package/utils/remote-data/RemoteData.js +4 -3
- package/utils/remote-data/RemoteData.js.map +1 -1
- package/utils/remote-data/RemoteDataFactory.d.ts +2 -2
- package/utils/remote-data/RemoteDataFactory.js +20 -13
- package/utils/remote-data/RemoteDataFactory.js.map +1 -1
- package/utils/remote-data/Sha256RemoteData.d.ts +1 -0
- package/utils/remote-data/Sha256RemoteData.js +117 -44
- package/utils/remote-data/Sha256RemoteData.js.map +1 -1
- package/utils/string.js +9 -8
- package/utils/string.js.map +1 -1
- package/utils/type.js +4 -3
- package/utils/type.js.map +1 -1
- package/utils/xxhash.d.ts +1 -0
- package/utils/xxhash.js +11 -9
- package/utils/xxhash.js.map +1 -1
- package/wallet/AirGapCoinWallet.js +183 -64
- package/wallet/AirGapCoinWallet.js.map +1 -1
- package/wallet/AirGapMarketWallet.js +201 -88
- package/wallet/AirGapMarketWallet.js.map +1 -1
- package/wallet/AirGapNFTWallet.js +165 -48
- package/wallet/AirGapNFTWallet.js.map +1 -1
- package/wallet/AirGapWallet.js +145 -58
- package/wallet/AirGapWallet.js.map +1 -1
|
@@ -1,39 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.Ed25519CryptoClient = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
55
|
+
var bytes_1 = require("@stablelib/bytes");
|
|
56
|
+
var blake2b_1 = require("@stablelib/blake2b");
|
|
57
|
+
var ed25519_1 = require("@stablelib/ed25519");
|
|
58
|
+
var nacl_1 = require("@stablelib/nacl");
|
|
59
|
+
var utf8_1 = require("@stablelib/utf8");
|
|
60
|
+
var hex_1 = require("../utils/hex");
|
|
61
|
+
var CryptoClient_1 = require("./CryptoClient");
|
|
11
62
|
function toHex(value) {
|
|
12
63
|
return Buffer.from(value).toString('hex');
|
|
13
64
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const state = new blake2b_1.BLAKE2b(24);
|
|
19
|
-
const nonce = state.update(keypair.publicKey, 32).update(kxOtherPublicKey, 32).digest();
|
|
20
|
-
const encryptedMessage = (0, nacl_1.box)(kxOtherPublicKey, keypair.secretKey, nonce, (0, hex_1.isHex)(payload) ? Buffer.from(payload, 'hex') : (0, utf8_1.encode)(payload));
|
|
21
|
-
return toHex((0, bytes_1.concat)(keypair.publicKey, encryptedMessage));
|
|
22
|
-
}
|
|
23
|
-
async decryptAsymmetric(encryptedPayload, keypair) {
|
|
24
|
-
const kxSelfPrivateKey = (0, ed25519_1.convertSecretKeyToX25519)(Buffer.from(keypair.privateKey, 'hex')); // Secret bytes to scalar bytes
|
|
25
|
-
const kxSelfPublicKey = (0, ed25519_1.convertPublicKeyToX25519)(Buffer.from(keypair.publicKey, 'hex')); // Secret bytes to scalar bytes
|
|
26
|
-
const encryptedPayloadBytes = Buffer.from(encryptedPayload, (0, hex_1.isHex)(encryptedPayload) ? 'hex' : 'utf-8');
|
|
27
|
-
const kxOtherPublicKey = encryptedPayloadBytes.slice(0, 32);
|
|
28
|
-
const ciphertext = encryptedPayloadBytes.slice(32);
|
|
29
|
-
const state = new blake2b_1.BLAKE2b(24);
|
|
30
|
-
const nonce = state.update(kxOtherPublicKey, 32).update(kxSelfPublicKey, 32).digest();
|
|
31
|
-
const decryptedMessage = (0, nacl_1.openBox)(kxOtherPublicKey, kxSelfPrivateKey, nonce, ciphertext);
|
|
32
|
-
if (decryptedMessage === null) {
|
|
33
|
-
throw new Error('Ed25519 decryption failed.');
|
|
34
|
-
}
|
|
35
|
-
return Buffer.from(decryptedMessage).toString();
|
|
65
|
+
var Ed25519CryptoClient = /** @class */ (function (_super) {
|
|
66
|
+
__extends(Ed25519CryptoClient, _super);
|
|
67
|
+
function Ed25519CryptoClient() {
|
|
68
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
36
69
|
}
|
|
37
|
-
|
|
70
|
+
Ed25519CryptoClient.prototype.encryptAsymmetric = function (payload, publicKey) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var kxOtherPublicKey, keypair, state, nonce, encryptedMessage;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
kxOtherPublicKey = (0, ed25519_1.convertPublicKeyToX25519)(Buffer.from(publicKey, 'hex'));
|
|
75
|
+
keypair = (0, nacl_1.generateKeyPair)();
|
|
76
|
+
state = new blake2b_1.BLAKE2b(24);
|
|
77
|
+
nonce = state.update(keypair.publicKey, 32).update(kxOtherPublicKey, 32).digest();
|
|
78
|
+
encryptedMessage = (0, nacl_1.box)(kxOtherPublicKey, keypair.secretKey, nonce, (0, hex_1.isHex)(payload) ? Buffer.from(payload, 'hex') : (0, utf8_1.encode)(payload));
|
|
79
|
+
return [2 /*return*/, toHex((0, bytes_1.concat)(keypair.publicKey, encryptedMessage))];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
Ed25519CryptoClient.prototype.decryptAsymmetric = function (encryptedPayload, keypair) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
+
var kxSelfPrivateKey, kxSelfPublicKey, encryptedPayloadBytes, kxOtherPublicKey, ciphertext, state, nonce, decryptedMessage;
|
|
86
|
+
return __generator(this, function (_a) {
|
|
87
|
+
kxSelfPrivateKey = (0, ed25519_1.convertSecretKeyToX25519)(Buffer.from(keypair.privateKey, 'hex')) // Secret bytes to scalar bytes
|
|
88
|
+
;
|
|
89
|
+
kxSelfPublicKey = (0, ed25519_1.convertPublicKeyToX25519)(Buffer.from(keypair.publicKey, 'hex')) // Secret bytes to scalar bytes
|
|
90
|
+
;
|
|
91
|
+
encryptedPayloadBytes = Buffer.from(encryptedPayload, (0, hex_1.isHex)(encryptedPayload) ? 'hex' : 'utf-8');
|
|
92
|
+
kxOtherPublicKey = encryptedPayloadBytes.slice(0, 32);
|
|
93
|
+
ciphertext = encryptedPayloadBytes.slice(32);
|
|
94
|
+
state = new blake2b_1.BLAKE2b(24);
|
|
95
|
+
nonce = state.update(kxOtherPublicKey, 32).update(kxSelfPublicKey, 32).digest();
|
|
96
|
+
decryptedMessage = (0, nacl_1.openBox)(kxOtherPublicKey, kxSelfPrivateKey, nonce, ciphertext);
|
|
97
|
+
if (decryptedMessage === null) {
|
|
98
|
+
throw new Error('Ed25519 decryption failed.');
|
|
99
|
+
}
|
|
100
|
+
return [2 /*return*/, Buffer.from(decryptedMessage).toString()];
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return Ed25519CryptoClient;
|
|
105
|
+
}(CryptoClient_1.CryptoClient));
|
|
38
106
|
exports.Ed25519CryptoClient = Ed25519CryptoClient;
|
|
39
107
|
//# sourceMappingURL=Ed25519CryptoClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ed25519CryptoClient.js","sourceRoot":"","sources":["../../src/protocols/Ed25519CryptoClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Ed25519CryptoClient.js","sourceRoot":"","sources":["../../src/protocols/Ed25519CryptoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAyC;AACzC,8CAA4C;AAC5C,8CAAgG;AAChG,wCAA+D;AAC/D,wCAAwC;AAExC,oCAAoC;AAEpC,+CAA6C;AAE7C,SAAS,KAAK,CAAC,KAAU;IACvB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC3C,CAAC;AAED;IAAkD,uCAAY;IAA9D;;IAqCA,CAAC;IApCc,+CAAiB,GAA9B,UAA+B,OAAe,EAAE,SAAiB;;;;gBACzD,gBAAgB,GAAe,IAAA,kCAAwB,EAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;gBAEtF,OAAO,GAAY,IAAA,sBAAe,GAAE,CAAA;gBACpC,KAAK,GAAY,IAAI,iBAAO,CAAC,EAAE,CAAC,CAAA;gBAChC,KAAK,GAAe,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAA;gBAE7F,gBAAgB,GAAe,IAAA,UAAG,EACtC,gBAAgB,EAChB,OAAO,CAAC,SAAS,EACjB,KAAK,EACL,IAAA,WAAK,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAA,aAAM,EAAC,OAAO,CAAC,CAC/D,CAAA;gBAED,sBAAO,KAAK,CAAC,IAAA,cAAM,EAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC,EAAA;;;KAC1D;IAEY,+CAAiB,GAA9B,UAA+B,gBAAwB,EAAE,OAAkD;;;;gBACnG,gBAAgB,GAAe,IAAA,kCAAwB,EAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,+BAA+B;gBAAhC,CAAA;gBAC/F,eAAe,GAAe,IAAA,kCAAwB,EAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,+BAA+B;gBAAhC,CAAA;gBAE7F,qBAAqB,GAAW,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAA,WAAK,EAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;gBACxG,gBAAgB,GAAW,qBAAqB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;gBAC7D,UAAU,GAAW,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;gBAEpD,KAAK,GAAY,IAAI,iBAAO,CAAC,EAAE,CAAC,CAAA;gBAChC,KAAK,GAAe,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAA;gBAE3F,gBAAgB,GAAsB,IAAA,cAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;gBAE1G,IAAI,gBAAgB,KAAK,IAAI,EAAE;oBAC7B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;iBAC9C;gBAED,sBAAO,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAA;;;KAChD;IACH,0BAAC;AAAD,CAAC,AArCD,CAAkD,2BAAY,GAqC7D;AArCqB,kDAAmB"}
|
|
@@ -5,5 +5,5 @@ var SubProtocolType;
|
|
|
5
5
|
(function (SubProtocolType) {
|
|
6
6
|
SubProtocolType["ACCOUNT"] = "account";
|
|
7
7
|
SubProtocolType["TOKEN"] = "token";
|
|
8
|
-
})(SubProtocolType
|
|
8
|
+
})(SubProtocolType = exports.SubProtocolType || (exports.SubProtocolType = {}));
|
|
9
9
|
//# sourceMappingURL=ICoinSubProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICoinSubProtocol.js","sourceRoot":"","sources":["../../src/protocols/ICoinSubProtocol.ts"],"names":[],"mappings":";;;AAEA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe
|
|
1
|
+
{"version":3,"file":"ICoinSubProtocol.js","sourceRoot":"","sources":["../../src/protocols/ICoinSubProtocol.ts"],"names":[],"mappings":";;;AAEA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B"}
|
|
@@ -1,46 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NonExtendedProtocol = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
throw Promise.reject('extended public key support not implemented');
|
|
4
|
+
var NonExtendedProtocol = /** @class */ (function () {
|
|
5
|
+
function NonExtendedProtocol() {
|
|
7
6
|
}
|
|
8
|
-
|
|
7
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
9
8
|
throw Promise.reject('extended public key support not implemented');
|
|
10
|
-
}
|
|
11
|
-
|
|
9
|
+
};
|
|
10
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromHexSecret = function (secret, derivationPath) {
|
|
11
|
+
throw Promise.reject('extended public key support not implemented');
|
|
12
|
+
};
|
|
13
|
+
NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
12
14
|
throw Promise.reject('extended private key support not implemented');
|
|
13
|
-
}
|
|
14
|
-
getExtendedPrivateKeyFromHexSecret(secret, derivationPath) {
|
|
15
|
+
};
|
|
16
|
+
NonExtendedProtocol.prototype.getExtendedPrivateKeyFromHexSecret = function (secret, derivationPath) {
|
|
15
17
|
throw Promise.reject('extended private key support not implemented');
|
|
16
|
-
}
|
|
17
|
-
getBalanceOfExtendedPublicKey(extendedPublicKey, offset) {
|
|
18
|
+
};
|
|
19
|
+
NonExtendedProtocol.prototype.getBalanceOfExtendedPublicKey = function (extendedPublicKey, offset) {
|
|
18
20
|
return Promise.reject('extended public balance not implemented');
|
|
19
|
-
}
|
|
20
|
-
signWithExtendedPrivateKey(extendedPrivateKey, transaction, childDerivationPath) {
|
|
21
|
+
};
|
|
22
|
+
NonExtendedProtocol.prototype.signWithExtendedPrivateKey = function (extendedPrivateKey, transaction, childDerivationPath) {
|
|
21
23
|
return Promise.reject('extended private key signing for not implemented');
|
|
22
|
-
}
|
|
23
|
-
getAddressFromExtendedPublicKey(extendedPublicKey, visibilityDerivationIndex, addressDerivationIndex) {
|
|
24
|
+
};
|
|
25
|
+
NonExtendedProtocol.prototype.getAddressFromExtendedPublicKey = function (extendedPublicKey, visibilityDerivationIndex, addressDerivationIndex) {
|
|
24
26
|
return Promise.resolve({
|
|
25
27
|
address: '',
|
|
26
28
|
cursor: { hasNext: false }
|
|
27
29
|
});
|
|
28
|
-
}
|
|
29
|
-
getAddressesFromExtendedPublicKey(extendedPublicKey, visibilityDerivationIndex, addressCount, offset) {
|
|
30
|
+
};
|
|
31
|
+
NonExtendedProtocol.prototype.getAddressesFromExtendedPublicKey = function (extendedPublicKey, visibilityDerivationIndex, addressCount, offset) {
|
|
30
32
|
return Promise.resolve([]);
|
|
31
|
-
}
|
|
32
|
-
estimateMaxTransactionValueFromExtendedPublicKey(extendedPublicKey, recipients, fee) {
|
|
33
|
+
};
|
|
34
|
+
NonExtendedProtocol.prototype.estimateMaxTransactionValueFromExtendedPublicKey = function (extendedPublicKey, recipients, fee) {
|
|
33
35
|
return Promise.reject('estimating max value using extended public key not implemented');
|
|
34
|
-
}
|
|
35
|
-
estimateFeeDefaultsFromExtendedPublicKey(publicKey, recipients, values, data) {
|
|
36
|
+
};
|
|
37
|
+
NonExtendedProtocol.prototype.estimateFeeDefaultsFromExtendedPublicKey = function (publicKey, recipients, values, data) {
|
|
36
38
|
return Promise.reject('estimating fee defaults using extended public key not implemented');
|
|
37
|
-
}
|
|
38
|
-
getTransactionsFromExtendedPublicKey(extendedPublicKey, limit, cursor) {
|
|
39
|
+
};
|
|
40
|
+
NonExtendedProtocol.prototype.getTransactionsFromExtendedPublicKey = function (extendedPublicKey, limit, cursor) {
|
|
39
41
|
return Promise.reject('fetching txs using extended public key not implemented');
|
|
40
|
-
}
|
|
41
|
-
prepareTransactionFromExtendedPublicKey(extendedPublicKey, offset, recipients, values, fee) {
|
|
42
|
+
};
|
|
43
|
+
NonExtendedProtocol.prototype.prepareTransactionFromExtendedPublicKey = function (extendedPublicKey, offset, recipients, values, fee) {
|
|
42
44
|
return Promise.reject('extended public key tx not implemented');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
+
};
|
|
46
|
+
return NonExtendedProtocol;
|
|
47
|
+
}());
|
|
45
48
|
exports.NonExtendedProtocol = NonExtendedProtocol;
|
|
46
49
|
//# sourceMappingURL=NonExtendedProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonExtendedProtocol.js","sourceRoot":"","sources":["../../src/protocols/NonExtendedProtocol.ts"],"names":[],"mappings":";;;AAKA,
|
|
1
|
+
{"version":3,"file":"NonExtendedProtocol.js","sourceRoot":"","sources":["../../src/protocols/NonExtendedProtocol.ts"],"names":[],"mappings":";;;AAKA;IAAA;IA2EA,CAAC;IA1EQ,8DAAgC,GAAvC,UAAwC,QAAgB,EAAE,cAAsB,EAAE,QAAiB;QACjG,MAAM,OAAO,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAA;IACrE,CAAC;IAEM,+DAAiC,GAAxC,UAAyC,MAAc,EAAE,cAAsB;QAC7E,MAAM,OAAO,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAA;IACrE,CAAC;IAEM,+DAAiC,GAAxC,UAAyC,QAAgB,EAAE,cAAsB,EAAE,QAAiB;QAClG,MAAM,OAAO,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAA;IACtE,CAAC;IAEM,gEAAkC,GAAzC,UAA0C,MAAc,EAAE,cAAsB;QAC9E,MAAM,OAAO,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAA;IACtE,CAAC;IAEM,2DAA6B,GAApC,UAAqC,iBAAyB,EAAE,MAAc;QAC5E,OAAO,OAAO,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAA;IAClE,CAAC;IAEM,wDAA0B,GAAjC,UAAkC,kBAA0B,EAAE,WAAgB,EAAE,mBAA2B;QACzG,OAAO,OAAO,CAAC,MAAM,CAAC,kDAAkD,CAAC,CAAA;IAC3E,CAAC;IAEM,6DAA+B,GAAtC,UACE,iBAAyB,EACzB,yBAAiC,EACjC,sBAA8B;QAE9B,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SAC3B,CAAC,CAAA;IACJ,CAAC;IAEM,+DAAiC,GAAxC,UACE,iBAAyB,EACzB,yBAAiC,EACjC,YAAoB,EACpB,MAAc;QAEd,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC5B,CAAC;IAEM,8EAAgD,GAAvD,UAAwD,iBAAyB,EAAE,UAAoB,EAAE,GAAW;QAClH,OAAO,OAAO,CAAC,MAAM,CAAC,gEAAgE,CAAC,CAAA;IACzF,CAAC;IAEM,sEAAwC,GAA/C,UACE,SAAiB,EACjB,UAAoB,EACpB,MAAgB,EAChB,IAAU;QAEV,OAAO,OAAO,CAAC,MAAM,CAAC,mEAAmE,CAAC,CAAA;IAC5F,CAAC;IAEM,kEAAoC,GAA3C,UACE,iBAAyB,EACzB,KAAa,EACb,MAAkC;QAElC,OAAO,OAAO,CAAC,MAAM,CAAC,wDAAwD,CAAC,CAAA;IACjF,CAAC;IAEM,qEAAuC,GAA9C,UACE,iBAAyB,EACzB,MAAc,EACd,UAAoB,EACpB,MAAgB,EAChB,GAAW;QAEX,OAAO,OAAO,CAAC,MAAM,CAAC,wCAAwC,CAAC,CAAA;IACjE,CAAC;IACH,0BAAC;AAAD,CAAC,AA3ED,IA2EC;AA3EqB,kDAAmB"}
|
|
@@ -1,15 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.Secp256k1CryptoClient = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
async decryptAsymmetric(encryptedPayload, keypair) {
|
|
11
|
-
return (0, index_1.decrypt)(keypair.privateKey, Buffer.from(encryptedPayload, 'hex')).toString();
|
|
55
|
+
var index_1 = require("../dependencies/src/eciesjs-0.3.9/src/index");
|
|
56
|
+
var CryptoClient_1 = require("./CryptoClient");
|
|
57
|
+
var Secp256k1CryptoClient = /** @class */ (function (_super) {
|
|
58
|
+
__extends(Secp256k1CryptoClient, _super);
|
|
59
|
+
function Secp256k1CryptoClient() {
|
|
60
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
12
61
|
}
|
|
13
|
-
|
|
62
|
+
Secp256k1CryptoClient.prototype.encryptAsymmetric = function (payload, publicKey) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
return [2 /*return*/, (0, index_1.encrypt)(publicKey, Buffer.from(payload)).toString('hex')];
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
Secp256k1CryptoClient.prototype.decryptAsymmetric = function (encryptedPayload, keypair) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
return [2 /*return*/, (0, index_1.decrypt)(keypair.privateKey, Buffer.from(encryptedPayload, 'hex')).toString()];
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
return Secp256k1CryptoClient;
|
|
77
|
+
}(CryptoClient_1.CryptoClient));
|
|
14
78
|
exports.Secp256k1CryptoClient = Secp256k1CryptoClient;
|
|
15
79
|
//# sourceMappingURL=Secp256k1CryptoClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Secp256k1CryptoClient.js","sourceRoot":"","sources":["../../src/protocols/Secp256k1CryptoClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Secp256k1CryptoClient.js","sourceRoot":"","sources":["../../src/protocols/Secp256k1CryptoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAA8E;AAE9E,+CAA6C;AAE7C;IAAoD,yCAAY;IAAhE;;IAQA,CAAC;IAPc,iDAAiB,GAA9B,UAA+B,OAAe,EAAE,SAAiB;;;gBAC/D,sBAAO,IAAA,eAAO,EAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA;;;KAChE;IAEY,iDAAiB,GAA9B,UAA+B,gBAAwB,EAAE,OAAkD;;;gBACzG,sBAAO,IAAA,eAAO,EAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAA;;;KACpF;IACH,4BAAC;AAAD,CAAC,AARD,CAAoD,2BAAY,GAQ/D;AARqB,sDAAqB"}
|
|
@@ -1,18 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.Sr25519CryptoClient = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
async decryptAsymmetric(encryptedPayload, keypair) {
|
|
13
|
-
// Currently not supported: https://github.com/polkadot-js/common/issues/633
|
|
14
|
-
throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, `decryptAsymmetric() not implemented.`);
|
|
55
|
+
var errors_1 = require("../errors");
|
|
56
|
+
var coinlib_error_1 = require("../errors/coinlib-error");
|
|
57
|
+
var CryptoClient_1 = require("./CryptoClient");
|
|
58
|
+
var Sr25519CryptoClient = /** @class */ (function (_super) {
|
|
59
|
+
__extends(Sr25519CryptoClient, _super);
|
|
60
|
+
function Sr25519CryptoClient() {
|
|
61
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
15
62
|
}
|
|
16
|
-
|
|
63
|
+
Sr25519CryptoClient.prototype.encryptAsymmetric = function (payload, publicKey) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
return __generator(this, function (_a) {
|
|
66
|
+
// Currently not supported: https://github.com/polkadot-js/common/issues/633
|
|
67
|
+
throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "encryptAsymmetric() not implemented.");
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
Sr25519CryptoClient.prototype.decryptAsymmetric = function (encryptedPayload, keypair) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
// Currently not supported: https://github.com/polkadot-js/common/issues/633
|
|
75
|
+
throw new errors_1.NotImplementedError(coinlib_error_1.Domain.UTILS, "decryptAsymmetric() not implemented.");
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
return Sr25519CryptoClient;
|
|
80
|
+
}(CryptoClient_1.CryptoClient));
|
|
17
81
|
exports.Sr25519CryptoClient = Sr25519CryptoClient;
|
|
18
82
|
//# sourceMappingURL=Sr25519CryptoClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sr25519CryptoClient.js","sourceRoot":"","sources":["../../src/protocols/Sr25519CryptoClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sr25519CryptoClient.js","sourceRoot":"","sources":["../../src/protocols/Sr25519CryptoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA+C;AAC/C,yDAAgD;AAChD,+CAA6C;AAE7C;IAAkD,uCAAY;IAA9D;;IAUA,CAAC;IATc,+CAAiB,GAA9B,UAA+B,OAAe,EAAE,SAAiB;;;gBAC/D,4EAA4E;gBAC5E,MAAM,IAAI,4BAAmB,CAAC,sBAAM,CAAC,KAAK,EAAE,sCAAsC,CAAC,CAAA;;;KACpF;IAEY,+CAAiB,GAA9B,UAA+B,gBAAwB,EAAE,OAAkD;;;gBACzG,4EAA4E;gBAC5E,MAAM,IAAI,4BAAmB,CAAC,sBAAM,CAAC,KAAK,EAAE,sCAAsC,CAAC,CAAA;;;KACpF;IACH,0BAAC;AAAD,CAAC,AAVD,CAAkD,2BAAY,GAU7D;AAVqB,kDAAmB"}
|