@ledgerhq/hw-app-str 6.29.0 → 7.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib-es/Str.js CHANGED
@@ -1,26 +1,37 @@
1
- import { splitPath, foreach, encodeEd25519PublicKey, verifyEd25519Signature, checkStellarBip32Path, hash, } from "./utils";
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import BIPPath from "bip32-path";
11
+ import { StellarHashSigningNotEnabledError, StellarDataParsingFailedError, StellarUserRefusedError, StellarDataTooLargeError, } from "./errors";
2
12
  const CLA = 0xe0;
13
+ const P1_FIRST = 0x00;
14
+ const P1_MORE = 0x80;
15
+ const P2_LAST = 0x00;
16
+ const P2_MORE = 0x80;
17
+ const P2_NON_CONFIRM = 0x00; // for getPublicKey
18
+ const P2_CONFIRM = 0x01; // for getPublicKey
3
19
  const INS_GET_PK = 0x02;
4
20
  const INS_SIGN_TX = 0x04;
5
21
  const INS_GET_CONF = 0x06;
6
- const INS_SIGN_TX_HASH = 0x08;
7
- const INS_KEEP_ALIVE = 0x10;
8
- const APDU_MAX_SIZE = 150;
9
- const P1_FIRST_APDU = 0x00;
10
- const P1_MORE_APDU = 0x80;
11
- const P2_LAST_APDU = 0x00;
12
- const P2_MORE_APDU = 0x80;
13
- const SW_OK = 0x9000;
14
- const SW_CANCEL = 0x6985;
15
- const SW_UNKNOWN_OP = 0x6c24;
16
- const SW_MULTI_OP = 0x6c25;
17
- const SW_NOT_ALLOWED = 0x6c66;
18
- const SW_UNSUPPORTED = 0x6d00;
19
- const SW_KEEP_ALIVE = 0x6e02;
20
- const TX_MAX_SIZE = 1540;
22
+ const INS_SIGN_HASH = 0x08;
23
+ const INS_SIGN_SOROBAN_AUTHORIZATION = 0x0a;
24
+ const APDU_MAX_PAYLOAD = 255;
25
+ const SW_DENY = 0x6985;
26
+ const SW_HASH_SIGNING_MODE_NOT_ENABLED = 0x6c66;
27
+ const SW_DATA_TOO_LARGE = 0xb004;
28
+ const SW_DATA_PARSING_FAIL = 0xb005;
21
29
  /**
22
30
  * Stellar API
23
31
  *
32
+ * @param transport a transport for sending commands to a device
33
+ * @param scrambleKey a scramble key
34
+ *
24
35
  * @example
25
36
  * import Str from "@ledgerhq/hw-app-str";
26
37
  * const str = new Str(transport)
@@ -28,198 +39,161 @@ const TX_MAX_SIZE = 1540;
28
39
  export default class Str {
29
40
  constructor(transport, scrambleKey = "l0v") {
30
41
  this.transport = transport;
31
- transport.decorateAppAPIMethods(this, ["getAppConfiguration", "getPublicKey", "signTransaction", "signHash"], scrambleKey);
42
+ transport.decorateAppAPIMethods(this, [
43
+ "getAppConfiguration",
44
+ "getPublicKey",
45
+ "signTransaction",
46
+ "signSorobanAuthorization",
47
+ "signHash",
48
+ ], scrambleKey);
32
49
  }
50
+ /**
51
+ * Get Stellar application configuration.
52
+ *
53
+ * @returns an object with the application configuration, including the version,
54
+ * whether hash signing is enabled, and the maximum data size in bytes that the device can sign.
55
+ * @example
56
+ * str.getAppConfiguration().then(o => o.version)
57
+ */
33
58
  getAppConfiguration() {
34
- return this.transport.send(CLA, INS_GET_CONF, 0x00, 0x00).then(response => {
35
- const multiOpsEnabled = response[0] === 0x01 || response[1] < 0x02;
36
- const version = "" + response[1] + "." + response[2] + "." + response[3];
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const resp = yield this.sendToDevice(INS_GET_CONF, Buffer.alloc(0));
61
+ const [hashSigningEnabled, major, minor, patch, maxDataSizeHi, maxDataSizeLo] = resp;
37
62
  return {
38
- version: version,
39
- multiOpsEnabled: multiOpsEnabled,
63
+ hashSigningEnabled: hashSigningEnabled === 0x01,
64
+ version: `${major}.${minor}.${patch}`,
65
+ maxDataSize: resp.length > 4 ? (maxDataSizeHi << 8) | maxDataSizeLo : undefined, // For compatibility with older app, let's remove this in the future
40
66
  };
41
67
  });
42
68
  }
43
69
  /**
44
- * get Stellar public key for a given BIP 32 path.
70
+ * Get Stellar raw public key for a given BIP 32 path.
71
+ *
45
72
  * @param path a path in BIP 32 format
46
- * @option boolValidate optionally enable key pair validation
47
- * @option boolDisplay optionally enable or not the display
48
- * @return an object with the publicKey (using XLM public key format) and
49
- * the raw ed25519 public key.
73
+ * @param display if true, the device will ask the user to confirm the address on the device, if false, it will return the raw public key directly
74
+ * @return an object with the raw ed25519 public key.
75
+ * If you want to convert it to string, you can use {@link https://stellar.github.io/js-stellar-base/StrKey.html#.encodeEd25519PublicKey StrKey.encodeEd25519PublicKey}
50
76
  * @example
51
- * str.getPublicKey("44'/148'/0'").then(o => o.publicKey)
77
+ * str.getPublicKey("44'/148'/0'").then(o => o.rawPublicKey)
52
78
  */
53
- getPublicKey(path, boolValidate, boolDisplay) {
54
- checkStellarBip32Path(path);
55
- const apdus = [];
56
- let response;
57
- const pathElts = splitPath(path);
58
- const buffer = Buffer.alloc(1 + pathElts.length * 4);
59
- buffer[0] = pathElts.length;
60
- pathElts.forEach((element, index) => {
61
- buffer.writeUInt32BE(element, 1 + 4 * index);
62
- });
63
- const verifyMsg = Buffer.from("via lumina", "ascii");
64
- apdus.push(Buffer.concat([buffer, verifyMsg]));
65
- let keepAlive = false;
66
- return foreach(apdus, data => this.transport
67
- .send(CLA, keepAlive ? INS_KEEP_ALIVE : INS_GET_PK, boolValidate ? 0x01 : 0x00, boolDisplay ? 0x01 : 0x00, data, [SW_OK, SW_KEEP_ALIVE])
68
- .then(apduResponse => {
69
- const status = Buffer.from(apduResponse.slice(apduResponse.length - 2)).readUInt16BE(0);
70
- if (status === SW_KEEP_ALIVE) {
71
- keepAlive = true;
72
- apdus.push(Buffer.alloc(0));
79
+ getPublicKey(path_1) {
80
+ return __awaiter(this, arguments, void 0, function* (path, display = false) {
81
+ const pathBuffer = pathToBuffer(path);
82
+ const p2 = display ? P2_CONFIRM : P2_NON_CONFIRM;
83
+ try {
84
+ const data = yield this.transport.send(CLA, INS_GET_PK, P1_FIRST, p2, pathBuffer);
85
+ return { rawPublicKey: data.slice(0, -2) };
73
86
  }
74
- response = apduResponse;
75
- })).then(() => {
76
- // response = Buffer.from(response, 'hex');
77
- let offset = 0;
78
- const rawPublicKey = response.slice(offset, offset + 32);
79
- offset += 32;
80
- const publicKey = encodeEd25519PublicKey(rawPublicKey);
81
- if (boolValidate) {
82
- const signature = response.slice(offset, offset + 64);
83
- if (!verifyEd25519Signature(verifyMsg, signature, rawPublicKey)) {
84
- throw new Error("Bad signature. Keypair is invalid. Please report this.");
85
- }
87
+ catch (e) {
88
+ throw remapErrors(e);
86
89
  }
87
- return {
88
- publicKey: publicKey,
89
- raw: rawPublicKey,
90
- };
91
90
  });
92
91
  }
93
92
  /**
94
- * sign a Stellar transaction.
93
+ * Sign a Stellar transaction.
94
+ *
95
95
  * @param path a path in BIP 32 format
96
- * @param transaction signature base of the transaction to sign
97
- * @return an object with the signature and the status
96
+ * @param transaction {@link https://stellar.github.io/js-stellar-base/Transaction.html#signatureBase signature base} of the transaction to sign
97
+ * @return an object with the signature
98
98
  * @example
99
99
  * str.signTransaction("44'/148'/0'", signatureBase).then(o => o.signature)
100
100
  */
101
101
  signTransaction(path, transaction) {
102
- checkStellarBip32Path(path);
103
- if (transaction.length > TX_MAX_SIZE) {
104
- throw new Error("Transaction too large: max = " + TX_MAX_SIZE + "; actual = " + transaction.length);
105
- }
106
- const apdus = [];
107
- let response;
108
- const pathElts = splitPath(path);
109
- const bufferSize = 1 + pathElts.length * 4;
110
- const buffer = Buffer.alloc(bufferSize);
111
- buffer[0] = pathElts.length;
112
- pathElts.forEach(function (element, index) {
113
- buffer.writeUInt32BE(element, 1 + 4 * index);
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ const pathBuffer = pathToBuffer(path);
104
+ const payload = Buffer.concat([pathBuffer, transaction]);
105
+ const resp = yield this.sendToDevice(INS_SIGN_TX, payload);
106
+ return { signature: resp };
114
107
  });
115
- let chunkSize = APDU_MAX_SIZE - bufferSize;
116
- if (transaction.length <= chunkSize) {
117
- // it fits in a single apdu
118
- apdus.push(Buffer.concat([buffer, transaction]));
119
- }
120
- else {
121
- // we need to send multiple apdus to transmit the entire transaction
122
- let chunk = Buffer.alloc(chunkSize);
123
- let offset = 0;
124
- transaction.copy(chunk, 0, offset, chunkSize);
125
- apdus.push(Buffer.concat([buffer, chunk]));
126
- offset += chunkSize;
127
- while (offset < transaction.length) {
128
- const remaining = transaction.length - offset;
129
- chunkSize = remaining < APDU_MAX_SIZE ? remaining : APDU_MAX_SIZE;
130
- chunk = Buffer.alloc(chunkSize);
131
- transaction.copy(chunk, 0, offset, offset + chunkSize);
132
- offset += chunkSize;
133
- apdus.push(chunk);
134
- }
135
- }
136
- let keepAlive = false;
137
- return foreach(apdus, (data, i) => this.transport
138
- .send(CLA, keepAlive ? INS_KEEP_ALIVE : INS_SIGN_TX, i === 0 ? P1_FIRST_APDU : P1_MORE_APDU, i === apdus.length - 1 ? P2_LAST_APDU : P2_MORE_APDU, data, [SW_OK, SW_CANCEL, SW_UNKNOWN_OP, SW_MULTI_OP, SW_KEEP_ALIVE])
139
- .then(apduResponse => {
140
- const status = Buffer.from(apduResponse.slice(apduResponse.length - 2)).readUInt16BE(0);
141
- if (status === SW_KEEP_ALIVE) {
142
- keepAlive = true;
143
- apdus.push(Buffer.alloc(0));
144
- }
145
- response = apduResponse;
146
- })).then(() => {
147
- const status = Buffer.from(response.slice(response.length - 2)).readUInt16BE(0);
148
- if (status === SW_OK) {
149
- const signature = Buffer.from(response.slice(0, response.length - 2));
150
- return {
151
- signature: signature,
152
- };
153
- }
154
- else if (status === SW_UNKNOWN_OP) {
155
- // pre-v2 app version: fall back on hash signing
156
- return this.signHash_private(path, hash(transaction));
157
- }
158
- else if (status === SW_MULTI_OP) {
159
- // multi-operation transaction: attempt hash signing
160
- return this.signHash_private(path, hash(transaction));
161
- }
162
- else {
163
- throw new Error("Transaction approval request was rejected");
164
- }
108
+ }
109
+ /**
110
+ * Sign a Stellar Soroban authorization.
111
+ *
112
+ * @param path a path in BIP 32 format
113
+ * @param hashIdPreimage the {@link https://github.com/stellar/stellar-xdr/blob/1a04392432dacc0092caaeae22a600ea1af3c6a5/Stellar-transaction.x#L702-L709 Soroban authorization hashIdPreimage} to sign
114
+ * @return an object with the signature
115
+ * @example
116
+ * str.signSorobanAuthorization("44'/148'/0'", hashIdPreimage).then(o => o.signature)
117
+ */
118
+ signSorobanAuthorization(path, hashIdPreimage) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const pathBuffer = pathToBuffer(path);
121
+ const payload = Buffer.concat([pathBuffer, hashIdPreimage]);
122
+ const resp = yield this.sendToDevice(INS_SIGN_SOROBAN_AUTHORIZATION, payload);
123
+ return { signature: resp };
165
124
  });
166
125
  }
167
126
  /**
168
- * sign a Stellar transaction hash.
127
+ * Sign a hash.
128
+ *
169
129
  * @param path a path in BIP 32 format
170
- * @param hash hash of the transaction to sign
130
+ * @param hash the hash to sign
171
131
  * @return an object with the signature
172
132
  * @example
173
133
  * str.signHash("44'/148'/0'", hash).then(o => o.signature)
174
134
  */
175
135
  signHash(path, hash) {
176
- checkStellarBip32Path(path);
177
- return this.signHash_private(path, hash);
178
- }
179
- signHash_private(path, hash) {
180
- const apdus = [];
181
- let response;
182
- const pathElts = splitPath(path);
183
- const buffer = Buffer.alloc(1 + pathElts.length * 4);
184
- buffer[0] = pathElts.length;
185
- pathElts.forEach(function (element, index) {
186
- buffer.writeUInt32BE(element, 1 + 4 * index);
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ const pathBuffer = pathToBuffer(path);
138
+ const payload = Buffer.concat([pathBuffer, hash]);
139
+ const resp = yield this.sendToDevice(INS_SIGN_HASH, payload);
140
+ return { signature: resp };
187
141
  });
188
- apdus.push(Buffer.concat([buffer, hash]));
189
- let keepAlive = false;
190
- return foreach(apdus, data => this.transport
191
- .send(CLA, keepAlive ? INS_KEEP_ALIVE : INS_SIGN_TX_HASH, 0x00, 0x00, data, [
192
- SW_OK,
193
- SW_CANCEL,
194
- SW_NOT_ALLOWED,
195
- SW_UNSUPPORTED,
196
- SW_KEEP_ALIVE,
197
- ])
198
- .then(apduResponse => {
199
- const status = Buffer.from(apduResponse.slice(apduResponse.length - 2)).readUInt16BE(0);
200
- if (status === SW_KEEP_ALIVE) {
201
- keepAlive = true;
202
- apdus.push(Buffer.alloc(0));
203
- }
204
- response = apduResponse;
205
- })).then(() => {
206
- const status = Buffer.from(response.slice(response.length - 2)).readUInt16BE(0);
207
- if (status === SW_OK) {
208
- const signature = Buffer.from(response.slice(0, response.length - 2));
209
- return {
210
- signature: signature,
211
- };
212
- }
213
- else if (status === SW_CANCEL) {
214
- throw new Error("Transaction approval request was rejected");
215
- }
216
- else if (status === SW_UNSUPPORTED) {
217
- throw new Error("Hash signing is not supported");
218
- }
219
- else {
220
- throw new Error("Hash signing not allowed. Have you enabled it in the app settings?");
142
+ }
143
+ sendToDevice(instruction, payload) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ let response = Buffer.alloc(0);
146
+ let remaining = payload.length;
147
+ // eslint-disable-next-line no-constant-condition
148
+ while (true) {
149
+ const chunkSize = remaining > APDU_MAX_PAYLOAD ? APDU_MAX_PAYLOAD : remaining;
150
+ const p1 = remaining === payload.length ? P1_FIRST : P1_MORE;
151
+ const p2 = remaining - chunkSize === 0 ? P2_LAST : P2_MORE;
152
+ const chunk = payload.slice(payload.length - remaining, payload.length - remaining + chunkSize);
153
+ response = yield this.transport.send(CLA, instruction, p1, p2, chunk).catch(e => {
154
+ throw remapErrors(e);
155
+ });
156
+ remaining -= chunkSize;
157
+ if (remaining === 0) {
158
+ break;
159
+ }
221
160
  }
161
+ return response.slice(0, -2);
222
162
  });
223
163
  }
224
164
  }
165
+ const remapErrors = e => {
166
+ if (e) {
167
+ switch (e.statusCode) {
168
+ case SW_DENY:
169
+ return new StellarUserRefusedError("User refused the request", undefined, { cause: e });
170
+ case SW_DATA_PARSING_FAIL:
171
+ return new StellarDataParsingFailedError("Unable to parse the provided data", undefined, {
172
+ cause: e,
173
+ });
174
+ case SW_HASH_SIGNING_MODE_NOT_ENABLED:
175
+ return new StellarHashSigningNotEnabledError("Hash signing not allowed. Have you enabled it in the app settings?", undefined, { cause: e });
176
+ case SW_DATA_TOO_LARGE:
177
+ return new StellarDataTooLargeError("The provided data is too large for the device to process", undefined, { cause: e });
178
+ }
179
+ }
180
+ return e;
181
+ };
182
+ const pathToBuffer = (originalPath) => {
183
+ const path = originalPath
184
+ .split("/")
185
+ .map(value => (value.endsWith("'") || value.endsWith("h") ? value : `${value}'`))
186
+ .join("/");
187
+ const pathNums = BIPPath.fromString(path).toPathArray();
188
+ return serializePath(pathNums);
189
+ };
190
+ const serializePath = (path) => {
191
+ const buf = Buffer.alloc(1 + path.length * 4);
192
+ buf.writeUInt8(path.length, 0);
193
+ for (const [i, num] of path.entries()) {
194
+ buf.writeUInt32BE(num, 1 + i * 4);
195
+ }
196
+ return buf;
197
+ };
198
+ export * from "./errors";
225
199
  //# sourceMappingURL=Str.js.map
package/lib-es/Str.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Str.js","sourceRoot":"","sources":["../src/Str.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,SAAS,EACT,OAAO,EACP,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,IAAI,GACL,MAAM,SAAS,CAAC;AACjB,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,YAAY,GA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AQ,GAAa,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAClE,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAAc,EAAE,EAAE;IACvC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9C,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACtC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Error thrown when hash signing is not enabled on the device.
3
+ */
4
+ export declare const StellarHashSigningNotEnabledError: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
5
+ [key: string]: unknown;
6
+ }>;
7
+ /**
8
+ * Error thrown when data parsing fails.
9
+ *
10
+ * For example, when parsing the transaction fails, this error is thrown.
11
+ */
12
+ export declare const StellarDataParsingFailedError: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
13
+ [key: string]: unknown;
14
+ }>;
15
+ /**
16
+ * Error thrown when the user refuses the request on the device.
17
+ */
18
+ export declare const StellarUserRefusedError: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
19
+ [key: string]: unknown;
20
+ }>;
21
+ /**
22
+ * Error thrown when the data is too large to be processed by the device.
23
+ */
24
+ export declare const StellarDataTooLargeError: import("@ledgerhq/errors/lib/helpers").LedgerErrorConstructor<{
25
+ [key: string]: unknown;
26
+ }>;
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,iCAAiC;;EAE7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;EAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;EAAoD,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,wBAAwB;;EAAqD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { createCustomErrorClass } from "@ledgerhq/errors";
2
+ /**
3
+ * Error thrown when hash signing is not enabled on the device.
4
+ */
5
+ export const StellarHashSigningNotEnabledError = createCustomErrorClass("StellarHashSigningNotEnabledError");
6
+ /**
7
+ * Error thrown when data parsing fails.
8
+ *
9
+ * For example, when parsing the transaction fails, this error is thrown.
10
+ */
11
+ export const StellarDataParsingFailedError = createCustomErrorClass("StellarDataParsingFailedError");
12
+ /**
13
+ * Error thrown when the user refuses the request on the device.
14
+ */
15
+ export const StellarUserRefusedError = createCustomErrorClass("StellarUserRefusedError");
16
+ /**
17
+ * Error thrown when the data is too large to be processed by the device.
18
+ */
19
+ export const StellarDataTooLargeError = createCustomErrorClass("StellarDataTooLargeError");
20
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,sBAAsB,CACrE,mCAAmC,CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,sBAAsB,CACjE,+BAA+B,CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC,yBAAyB,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC,0BAA0B,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/hw-app-str",
3
- "version": "6.29.0",
3
+ "version": "7.0.0-next.0",
4
4
  "description": "Ledger Hardware Wallet Stellar Application API",
5
5
  "keywords": [
6
6
  "Ledger",
@@ -27,10 +27,9 @@
27
27
  "types": "lib/Str.d.ts",
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "base32.js": "^0.1.0",
31
- "sha.js": "^2.3.6",
32
- "tweetnacl": "^1.0.3",
33
- "@ledgerhq/hw-transport": "^6.31.0"
30
+ "bip32-path": "^0.4.2",
31
+ "@ledgerhq/hw-transport": "^6.31.0",
32
+ "@ledgerhq/errors": "^6.17.0"
34
33
  },
35
34
  "devDependencies": {
36
35
  "@types/jest": "^29.5.10",
@@ -49,6 +48,7 @@
49
48
  "build": "tsc && tsc -m ES6 --outDir lib-es",
50
49
  "prewatch": "pnpm build",
51
50
  "watch": "tsc --watch",
51
+ "doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
52
52
  "lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
53
53
  "lint:fix": "pnpm lint --fix",
54
54
  "test": "jest",