@airgap/stellar 0.13.41-beta.0 → 0.13.41-beta.11
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/package.json +6 -6
- package/v1/data/StellarAddress.d.ts +1 -2
- package/v1/data/StellarAddress.js +6 -9
- package/v1/data/StellarAddress.js.map +1 -1
- package/v1/index.d.ts +4 -3
- package/v1/index.js +3 -1
- package/v1/index.js.map +1 -1
- package/v1/module/StellarAssets.d.ts +3 -0
- package/v1/module/StellarAssets.js +47 -0
- package/v1/module/StellarAssets.js.map +1 -0
- package/v1/module/StellarModule.d.ts +5 -8
- package/v1/module/StellarModule.js +27 -10
- package/v1/module/StellarModule.js.map +1 -1
- package/v1/protocol/StellarProtocol.d.ts +27 -4
- package/v1/protocol/StellarProtocol.js +595 -150
- package/v1/protocol/StellarProtocol.js.map +1 -1
- package/v1/protocol/stellarAssets/StellarAsset.d.ts +18 -0
- package/v1/protocol/stellarAssets/StellarAsset.js +497 -0
- package/v1/protocol/stellarAssets/StellarAsset.js.map +1 -0
- package/v1/serializer/v3/serializer-companion.js +18 -8
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +0 -1
- package/v1/serializer/v3/validators/validators.js.map +1 -1
- package/v1/types/protocol.d.ts +35 -0
- package/v1/types/protocol.js +19 -0
- package/v1/types/protocol.js.map +1 -1
- package/v1/protocol/StellarCryptoClient.d.ts +0 -8
- package/v1/protocol/StellarCryptoClient.js +0 -104
- package/v1/protocol/StellarCryptoClient.js.map +0 -1
|
@@ -54,12 +54,22 @@ var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
|
54
54
|
{
|
|
55
55
|
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
56
56
|
schema: { schema: stellarTransactionSignRequestSchema },
|
|
57
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.
|
|
57
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.STELLAR
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
61
61
|
schema: { schema: stellarTransactionSignResponseSchema },
|
|
62
|
-
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.
|
|
62
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.STELLAR
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
66
|
+
schema: { schema: stellarTransactionSignRequestSchema },
|
|
67
|
+
protocolIdentifier: coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
71
|
+
schema: { schema: stellarTransactionSignResponseSchema },
|
|
72
|
+
protocolIdentifier: coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET
|
|
63
73
|
}
|
|
64
74
|
];
|
|
65
75
|
this.stellarTransactionValidator = new transaction_validator_1.StellarTransactionValidator();
|
|
@@ -71,7 +81,7 @@ var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
|
71
81
|
StellarV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
72
82
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
83
|
return __generator(this, function (_a) {
|
|
74
|
-
if (identifier === coinlib_core_1.MainProtocolSymbols.
|
|
84
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
75
85
|
return [2 /*return*/, (0, transaction_converter_1.stellarUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
|
|
76
86
|
}
|
|
77
87
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
@@ -81,7 +91,7 @@ var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
|
81
91
|
StellarV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
82
92
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
93
|
return __generator(this, function (_a) {
|
|
84
|
-
if (identifier === coinlib_core_1.MainProtocolSymbols.
|
|
94
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
85
95
|
return [2 /*return*/, (0, transaction_converter_1.stellarTransactionSignRequestToUnsigned)(transactionSignRequest)];
|
|
86
96
|
}
|
|
87
97
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
@@ -94,7 +104,7 @@ var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
|
94
104
|
return __generator(this, function (_b) {
|
|
95
105
|
switch (_b.label) {
|
|
96
106
|
case 0:
|
|
97
|
-
if (!(identifier === coinlib_core_1.MainProtocolSymbols.
|
|
107
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET)) return [3 /*break*/, 4];
|
|
98
108
|
_b.label = 1;
|
|
99
109
|
case 1:
|
|
100
110
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -113,7 +123,7 @@ var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
|
113
123
|
StellarV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
114
124
|
return __awaiter(this, void 0, void 0, function () {
|
|
115
125
|
return __generator(this, function (_a) {
|
|
116
|
-
if (identifier === coinlib_core_1.MainProtocolSymbols.
|
|
126
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
117
127
|
return [2 /*return*/, (0, transaction_converter_1.stellarSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
118
128
|
}
|
|
119
129
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
@@ -123,7 +133,7 @@ var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
|
123
133
|
StellarV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
124
134
|
return __awaiter(this, void 0, void 0, function () {
|
|
125
135
|
return __generator(this, function (_a) {
|
|
126
|
-
if (identifier === coinlib_core_1.MainProtocolSymbols.
|
|
136
|
+
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET) {
|
|
127
137
|
return [2 /*return*/, (0, transaction_converter_1.stellarTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
128
138
|
}
|
|
129
139
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.STELLAR, "Protocol ".concat(identifier, " not supported"));
|
|
@@ -136,7 +146,7 @@ var StellarV3SerializerCompanion = /** @class */ (function () {
|
|
|
136
146
|
return __generator(this, function (_b) {
|
|
137
147
|
switch (_b.label) {
|
|
138
148
|
case 0:
|
|
139
|
-
if (!(identifier === coinlib_core_1.MainProtocolSymbols.
|
|
149
|
+
if (!(identifier === coinlib_core_1.MainProtocolSymbols.STELLAR || coinlib_core_1.SubProtocolSymbols.STELLAR_ASSET)) return [3 /*break*/, 4];
|
|
140
150
|
_b.label = 1;
|
|
141
151
|
case 1:
|
|
142
152
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA8F;AAC9F,
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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AAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;KACnF;IAEY,kEAA2B,GAAxC,UACE,UAAkB,EAClB,uBAAgD;;;gBAEhD,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,EAAE;oBAClF,sBAAO,IAAA,8DAAsC,EAAC,uBAAuB,CAAC,EAAA;iBACvE;gBAED,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;KACnF;IAEY,sEAA+B,GAA5C,UAA6C,UAAkB,EAAE,uBAAgD;;;;;;6BAC3G,CAAA,UAAU,KAAK,kCAAmB,CAAC,OAAO,IAAI,iCAAkB,CAAC,aAAa,CAAA,EAA9E,wBAA8E;;;;wBAE9E,qBAAM,IAAI,CAAC,2BAA2B,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,EAAA;;wBAAzF,SAAyF,CAAA;wBACzF,sBAAO,IAAI,EAAA;;;wBAEX,sBAAO,KAAK,EAAA;4BAIhB,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,OAAO,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;;;;KACnF;IACH,mCAAC;AAAD,CAAC,AAzGD,IAyGC;AAzGY,oEAA4B"}
|
|
@@ -45,7 +45,6 @@ exports.stellarValidators = {
|
|
|
45
45
|
if (value === null || typeof value === 'undefined') {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
|
-
// You can customize for testnet if needed
|
|
49
48
|
if (value !== stellar_sdk_1.Networks.PUBLIC) {
|
|
50
49
|
return 'is not a valid Stellar mainnet network ID';
|
|
51
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2E;AAC3E,qEAAyE;AACzE,iDAAiD;AAEpC,QAAA,iBAAiB,GAAG;IAC/B,kBAAkB,EAAE,UAAC,KAAc;QACjC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAClD,OAAO,IAAI,CAAA;SACZ;QAED,
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2E;AAC3E,qEAAyE;AACzE,iDAAiD;AAEpC,QAAA,iBAAiB,GAAG;IAC/B,kBAAkB,EAAE,UAAC,KAAc;QACjC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;YAClD,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,KAAK,KAAK,sBAAQ,CAAC,MAAM,EAAE;YAC7B,OAAO,2CAA2C,CAAA;SACnD;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,gBAAgB,EAAE,UAAC,WAAoB;QACrC,IAAI,WAAW,KAAK,IAAI,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;YAC9D,OAAO,IAAI,CAAA;SACZ;QAED,IAAI;YACF,IAAM,GAAG,GAAG,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAE,WAAuC,CAAC,WAAW,CAAA;YAChH,gCAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,sBAAQ,CAAC,MAAM,CAAC,CAAA;YAChD,OAAO,IAAI,CAAA;SACZ;QAAC,WAAM;YACN,OAAO,wCAAwC,CAAA;SAChD;IACH,CAAC;IAED,gBAAgB,EAAE,UAAC,OAAgB;QACjC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,oBAAM,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE;YAC3E,OAAO,gCAAgC,CAAA;SACxC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,qBAAqB,EAAE,UAAO,OAAe;;;;;;oBAEnC,QAAQ,GAAG,IAAA,uCAAqB,GAAE,CAAA;oBACxC,qBAAM,QAAQ,CAAC,2BAA2B,CAAC,IAAA,yBAAY,EAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,EAAA;;oBAA/E,SAA+E,CAAA;oBAC/E,sBAAO,IAAI,EAAA;;;oBAEX,sBAAO,0CAA0C,EAAA;;;;SAEpD;CACF,CAAA"}
|
package/v1/types/protocol.d.ts
CHANGED
|
@@ -5,3 +5,38 @@ export interface StellarProtocolNetwork extends ProtocolNetwork {
|
|
|
5
5
|
export interface StellarProtocolOptions {
|
|
6
6
|
network: StellarProtocolNetwork;
|
|
7
7
|
}
|
|
8
|
+
export declare type StellarAssetUnit = StellarAssetMetadata['assetCode'];
|
|
9
|
+
export interface StellarAssetMetadata {
|
|
10
|
+
name: string;
|
|
11
|
+
assetCode: string;
|
|
12
|
+
marketSymbol: string;
|
|
13
|
+
issuer: string;
|
|
14
|
+
decimals: number;
|
|
15
|
+
identifier: string;
|
|
16
|
+
}
|
|
17
|
+
export interface StellarSigner {
|
|
18
|
+
weight: number;
|
|
19
|
+
key: string;
|
|
20
|
+
type: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StellarThresholds {
|
|
23
|
+
low_threshold: number;
|
|
24
|
+
med_threshold: number;
|
|
25
|
+
high_threshold: number;
|
|
26
|
+
}
|
|
27
|
+
export declare enum StellarAssetType {
|
|
28
|
+
NATIVE = "native",
|
|
29
|
+
ASSET = "asset",
|
|
30
|
+
XLM = "XLM"
|
|
31
|
+
}
|
|
32
|
+
export declare enum StellarTransactionType {
|
|
33
|
+
PAYMENT = "payment",
|
|
34
|
+
CREATE_ACCOUNT = "createAccount",
|
|
35
|
+
PATH_PAYMENT_RECIEVE = "pathPaymentStrictReceive",
|
|
36
|
+
PATH_PAYMENT_SEND = "pathPaymentStrictSend",
|
|
37
|
+
CHANGE_TRUST = "changeTrust",
|
|
38
|
+
INOKE_HOST_FUNCTION = "invokeHostFunction",
|
|
39
|
+
LIQUIDITY_POOL_DEPOSIT = "liquidityPoolDeposit",
|
|
40
|
+
LIQUIDITY_POOL_WITHDRAW = "liquidityPoolWithdraw",
|
|
41
|
+
SET_OPTIONS = "setOptions"
|
|
42
|
+
}
|
package/v1/types/protocol.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StellarTransactionType = exports.StellarAssetType = void 0;
|
|
4
|
+
var StellarAssetType;
|
|
5
|
+
(function (StellarAssetType) {
|
|
6
|
+
StellarAssetType["NATIVE"] = "native";
|
|
7
|
+
StellarAssetType["ASSET"] = "asset";
|
|
8
|
+
StellarAssetType["XLM"] = "XLM";
|
|
9
|
+
})(StellarAssetType = exports.StellarAssetType || (exports.StellarAssetType = {}));
|
|
10
|
+
var StellarTransactionType;
|
|
11
|
+
(function (StellarTransactionType) {
|
|
12
|
+
StellarTransactionType["PAYMENT"] = "payment";
|
|
13
|
+
StellarTransactionType["CREATE_ACCOUNT"] = "createAccount";
|
|
14
|
+
StellarTransactionType["PATH_PAYMENT_RECIEVE"] = "pathPaymentStrictReceive";
|
|
15
|
+
StellarTransactionType["PATH_PAYMENT_SEND"] = "pathPaymentStrictSend";
|
|
16
|
+
StellarTransactionType["CHANGE_TRUST"] = "changeTrust";
|
|
17
|
+
StellarTransactionType["INOKE_HOST_FUNCTION"] = "invokeHostFunction";
|
|
18
|
+
StellarTransactionType["LIQUIDITY_POOL_DEPOSIT"] = "liquidityPoolDeposit";
|
|
19
|
+
StellarTransactionType["LIQUIDITY_POOL_WITHDRAW"] = "liquidityPoolWithdraw";
|
|
20
|
+
StellarTransactionType["SET_OPTIONS"] = "setOptions";
|
|
21
|
+
})(StellarTransactionType = exports.StellarTransactionType || (exports.StellarTransactionType = {}));
|
|
3
22
|
//# sourceMappingURL=protocol.js.map
|
package/v1/types/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/v1/types/protocol.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/v1/types/protocol.ts"],"names":[],"mappings":";;;AAiCA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,mCAAe,CAAA;IACf,+BAAW,CAAA;AACb,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,6CAAmB,CAAA;IACnB,0DAAgC,CAAA;IAChC,2EAAiD,CAAA;IACjD,qEAA2C,CAAA;IAC3C,sDAA4B,CAAA;IAC5B,oEAA0C,CAAA;IAC1C,yEAA+C,CAAA;IAC/C,2EAAiD,CAAA;IACjD,oDAA0B,CAAA;AAC5B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Ed25519CryptoClient } from '@airgap/coinlib-core/protocols/Ed25519CryptoClient';
|
|
2
|
-
export declare class StellarCryptoClient extends Ed25519CryptoClient {
|
|
3
|
-
constructor();
|
|
4
|
-
signMessage(message: string, keypair: {
|
|
5
|
-
privateKey: string;
|
|
6
|
-
}): Promise<string>;
|
|
7
|
-
verifyMessage(message: string, signature: string, publicKey: string): Promise<boolean>;
|
|
8
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
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
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.StellarCryptoClient = void 0;
|
|
55
|
-
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
56
|
-
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
57
|
-
var Ed25519CryptoClient_1 = require("@airgap/coinlib-core/protocols/Ed25519CryptoClient");
|
|
58
|
-
var stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
59
|
-
var MESSAGE_PREFIX = 'Stellar Signed Message:\n';
|
|
60
|
-
var MAX_MESSAGE_LENGTH = 0xfd;
|
|
61
|
-
var prepareSignedMessage = function (message) {
|
|
62
|
-
var prefix = Buffer.from(MESSAGE_PREFIX, 'utf8');
|
|
63
|
-
var content = Buffer.from(message, 'utf8');
|
|
64
|
-
if (content.length >= MAX_MESSAGE_LENGTH) {
|
|
65
|
-
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.STELLAR, 'Message exceeds maximum length');
|
|
66
|
-
}
|
|
67
|
-
return Buffer.concat([Buffer.from([prefix.length]), prefix, Buffer.from([content.length]), content]);
|
|
68
|
-
};
|
|
69
|
-
var StellarCryptoClient = /** @class */ (function (_super) {
|
|
70
|
-
__extends(StellarCryptoClient, _super);
|
|
71
|
-
function StellarCryptoClient() {
|
|
72
|
-
return _super.call(this) || this;
|
|
73
|
-
}
|
|
74
|
-
StellarCryptoClient.prototype.signMessage = function (message, keypair) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
-
var preparedMessage, kp, signature;
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
preparedMessage = prepareSignedMessage(message);
|
|
79
|
-
if (!stellar_sdk_1.StrKey.isValidEd25519SecretSeed(keypair.privateKey)) {
|
|
80
|
-
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.STELLAR, 'Invalid Stellar secret key format');
|
|
81
|
-
}
|
|
82
|
-
kp = stellar_sdk_1.Keypair.fromSecret(keypair.privateKey);
|
|
83
|
-
signature = kp.sign(preparedMessage);
|
|
84
|
-
return [2 /*return*/, Buffer.from(signature).toString('hex')];
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
StellarCryptoClient.prototype.verifyMessage = function (message, signature, publicKey) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
-
var preparedMessage, kp;
|
|
91
|
-
return __generator(this, function (_a) {
|
|
92
|
-
preparedMessage = prepareSignedMessage(message);
|
|
93
|
-
if (!stellar_sdk_1.StrKey.isValidEd25519PublicKey(publicKey)) {
|
|
94
|
-
return [2 /*return*/, false];
|
|
95
|
-
}
|
|
96
|
-
kp = stellar_sdk_1.Keypair.fromPublicKey(publicKey);
|
|
97
|
-
return [2 /*return*/, kp.verify(preparedMessage, Buffer.from(signature, 'hex'))];
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
return StellarCryptoClient;
|
|
102
|
-
}(Ed25519CryptoClient_1.Ed25519CryptoClient));
|
|
103
|
-
exports.StellarCryptoClient = StellarCryptoClient;
|
|
104
|
-
//# sourceMappingURL=StellarCryptoClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StellarCryptoClient.js","sourceRoot":"","sources":["../../../src/v1/protocol/StellarCryptoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA+D;AAC/D,2EAAkE;AAClE,0FAAwF;AACxF,oDAAsD;AAEtD,IAAM,cAAc,GAAG,2BAA2B,CAAA;AAClD,IAAM,kBAAkB,GAAG,IAAI,CAAA;AAE/B,IAAM,oBAAoB,GAAG,UAAC,OAAe;IAC3C,IAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IAClD,IAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAE5C,IAAI,OAAO,CAAC,MAAM,IAAI,kBAAkB,EAAE;QACxC,MAAM,IAAI,0BAAiB,CAAC,sBAAM,CAAC,OAAO,EAAE,gCAAgC,CAAC,CAAA;KAC9E;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;AACtG,CAAC,CAAA;AAED;IAAyC,uCAAmB;IAC1D;eACE,iBAAO;IACT,CAAC;IAEY,yCAAW,GAAxB,UAAyB,OAAe,EAAE,OAA+B;;;;gBACjE,eAAe,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAA;gB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