@recoillink/cli 0.0.0-stage → 45.0.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/LICENSE.md +193 -0
- package/README.md +149 -2
- package/bundle/154.index.js +462 -0
- package/bundle/230.index.js +569 -0
- package/bundle/25.index.js +9569 -0
- package/bundle/267.index.js +1386 -0
- package/bundle/308.index.js +5121 -0
- package/bundle/367.index.js +4 -0
- package/bundle/369.index.js +3443 -0
- package/bundle/529.index.js +3596 -0
- package/bundle/576.index.js +36 -0
- package/bundle/610.index.js +86 -0
- package/bundle/617.index.js +1612 -0
- package/bundle/628.index.js +152 -0
- package/bundle/633.index.js +86 -0
- package/bundle/697.index.js +410 -0
- package/bundle/7183ea1c1bf0a5da980d.js +214 -0
- package/bundle/748.index.js +672 -0
- package/bundle/78.index.js +372 -0
- package/bundle/841.index.js +2093 -0
- package/bundle/868.index.js +290 -0
- package/bundle/902.index.js +173 -0
- package/bundle/956.index.js +9901 -0
- package/bundle/aleo_wasm.wasm +0 -0
- package/bundle/aleo_wasm1.wasm +0 -0
- package/bundle/build/Release/bigint_buffer.node +0 -0
- package/bundle/file.js +12 -0
- package/bundle/index.js +4 -0
- package/bundle/package.json +3 -0
- package/bundle/worker-pipeline.js +38 -0
- package/bundle/worker.js +54 -0
- package/bundle/worker1.js +171 -0
- package/bundle/worker2.js +19834 -0
- package/bundle/worker3.js +19834 -0
- package/examples/aleo/core-config.yaml +19 -0
- package/examples/ccip/ccip-warp-route.yaml +26 -0
- package/examples/ccip/multi-chain-ccip-warp-route.yaml +81 -0
- package/examples/chain-config.yaml +42 -0
- package/examples/contract-artifacts.yaml +20 -0
- package/examples/core-config.yaml +19 -0
- package/examples/cosmosnative/core-config.yaml +20 -0
- package/examples/cosmosnative/warp-route-deployment.yaml +21 -0
- package/examples/crosschain/README.md +31 -0
- package/examples/crosschain/cosmosnative/core-config.yaml +69 -0
- package/examples/crosschain/ethereum/core-config.yaml +70 -0
- package/examples/crosschain/radix/core-config.yaml +96 -0
- package/examples/fork/file-transactions.yaml +5 -0
- package/examples/fork/timelock-testing.yaml +36 -0
- package/examples/fork/warp-route-update.yaml +100 -0
- package/examples/hooks.yaml +70 -0
- package/examples/ism-advanced.yaml +33 -0
- package/examples/ism.yaml +13 -0
- package/examples/radix/core-config.yaml +29 -0
- package/examples/sealevel/core-config-apply.yaml +7 -0
- package/examples/sealevel/core-config-composite-ism.yaml +21 -0
- package/examples/sealevel/core-config.yaml +12 -0
- package/examples/sealevel/igp-hook-config.yaml +13 -0
- package/examples/sealevel/warp-config-routing-message-id-multisig-ism.yaml +21 -0
- package/examples/starknet/core-config.yaml +20 -0
- package/examples/submit/strategy/file-strategy.yaml +8 -0
- package/examples/submit/strategy/gnosis-chain-strategy.yaml +10 -0
- package/examples/submit/strategy/gnosis-chain-tx-builder-strategy.yaml +6 -0
- package/examples/submit/strategy/gnosis-strategy-avalanche.yaml +4 -0
- package/examples/submit/strategy/gnosis-tx-builder-ica-strategy.yaml +20 -0
- package/examples/submit/strategy/ica-timelock-strategy.yaml +15 -0
- package/examples/submit/strategy/impersonated-account-strategy.yaml +4 -0
- package/examples/submit/strategy/json-rpc-chain-strategy.yaml +8 -0
- package/examples/submit/strategy/json-rpc-ica-strategy.yaml +13 -0
- package/examples/submit/strategy/json-rpc-strategy.yaml +3 -0
- package/examples/submit/strategy/json-rpc-timelock-strategy.yaml +17 -0
- package/examples/submit/strategy/starknet-json-rpc-chain-strategy.yaml +11 -0
- package/examples/submit/transactions/anvil-transactions.yaml +10 -0
- package/examples/submit/transactions/avalanche-transactions.json +8 -0
- package/examples/submit/transactions/sepolia-transactions.json +8 -0
- package/examples/tron-core-config.yaml +18 -0
- package/examples/warp-base.yaml +24 -0
- package/examples/warp-config-predicate-mainnet.yaml +14 -0
- package/examples/warp-deployed-predicate-mainnet.yaml +19 -0
- package/examples/warp-ethereum.yaml +19 -0
- package/examples/warp-route-deployment.yaml +21 -0
- package/package.json +117 -3
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
export const id = 78;
|
|
2
|
+
export const ids = [78];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 74078:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ signWithApiKey: () => (/* binding */ signWithApiKey)
|
|
11
|
+
/* harmony export */ });
|
|
12
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(76982);
|
|
13
|
+
/* harmony import */ var _utils_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(93880);
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const signWithApiKey = async (input) => {
|
|
18
|
+
const { content, publicKey, privateKey } = input;
|
|
19
|
+
const privateKeyObject = crypto__WEBPACK_IMPORTED_MODULE_0__.createPrivateKey({
|
|
20
|
+
// @ts-expect-error -- the key can be a JWK object since Node v15.12.0
|
|
21
|
+
// https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey
|
|
22
|
+
key: (0,_utils_mjs__WEBPACK_IMPORTED_MODULE_1__/* .convertTurnkeyApiKeyToJwk */ .S)({
|
|
23
|
+
uncompressedPrivateKeyHex: privateKey,
|
|
24
|
+
compressedPublicKeyHex: publicKey,
|
|
25
|
+
}),
|
|
26
|
+
format: "jwk",
|
|
27
|
+
});
|
|
28
|
+
const sign = crypto__WEBPACK_IMPORTED_MODULE_0__.createSign("SHA256");
|
|
29
|
+
sign.write(Buffer.from(content));
|
|
30
|
+
sign.end();
|
|
31
|
+
return sign.sign(privateKeyObject, "hex");
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=nodecrypto.mjs.map
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/***/ }),
|
|
39
|
+
|
|
40
|
+
/***/ 93880:
|
|
41
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// EXPORTS
|
|
45
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
+
S: () => (/* binding */ convertTurnkeyApiKeyToJwk)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@turnkey+api-key-stamper@0.5.0/node_modules/@turnkey/api-key-stamper/dist/tink/bytes.mjs
|
|
50
|
+
/**
|
|
51
|
+
* Code modified from https://github.com/google/tink/blob/6f74b99a2bfe6677e3670799116a57268fd067fa/javascript/subtle/bytes.ts
|
|
52
|
+
*
|
|
53
|
+
* @license
|
|
54
|
+
* Copyright 2020 Google LLC
|
|
55
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* Converts the hex string to a byte array.
|
|
59
|
+
*
|
|
60
|
+
* @param hex the input
|
|
61
|
+
* @return the byte array output
|
|
62
|
+
* @throws {!Error}
|
|
63
|
+
* @static
|
|
64
|
+
*/
|
|
65
|
+
function fromHex(hex) {
|
|
66
|
+
if (hex.length % 2 != 0) {
|
|
67
|
+
throw new Error("Hex string length must be multiple of 2");
|
|
68
|
+
}
|
|
69
|
+
const arr = new Uint8Array(hex.length / 2);
|
|
70
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
71
|
+
arr[i / 2] = parseInt(hex.substring(i, i + 2), 16);
|
|
72
|
+
}
|
|
73
|
+
return arr;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Converts a byte array to hex.
|
|
77
|
+
*
|
|
78
|
+
* @param bytes the byte array input
|
|
79
|
+
* @return hex the output
|
|
80
|
+
* @static
|
|
81
|
+
*/
|
|
82
|
+
function toHex(bytes) {
|
|
83
|
+
let result = "";
|
|
84
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
85
|
+
const hexByte = bytes[i].toString(16);
|
|
86
|
+
result += hexByte.length > 1 ? hexByte : "0" + hexByte;
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Base64 encode a byte array.
|
|
92
|
+
*
|
|
93
|
+
* @param bytes the byte array input
|
|
94
|
+
* @param opt_webSafe True indicates we should use the alternative
|
|
95
|
+
* alphabet, which does not require escaping for use in URLs.
|
|
96
|
+
* @return base64 output
|
|
97
|
+
* @static
|
|
98
|
+
*/
|
|
99
|
+
function toBase64(bytes, opt_webSafe) {
|
|
100
|
+
const encoded = btoa(
|
|
101
|
+
/* padding */
|
|
102
|
+
toByteString(bytes)).replace(/=/g, "");
|
|
103
|
+
{
|
|
104
|
+
return encoded.replace(/\+/g, "-").replace(/\//g, "_");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Turns a byte array into the string given by the concatenation of the
|
|
109
|
+
* characters to which the numbers correspond. Each byte is corresponding to a
|
|
110
|
+
* character. Does not support multi-byte characters.
|
|
111
|
+
*
|
|
112
|
+
* @param bytes Array of numbers representing
|
|
113
|
+
* characters.
|
|
114
|
+
* @return Stringification of the array.
|
|
115
|
+
*/
|
|
116
|
+
function toByteString(bytes) {
|
|
117
|
+
let str = "";
|
|
118
|
+
for (let i = 0; i < bytes.length; i += 1) {
|
|
119
|
+
str += String.fromCharCode(bytes[i]);
|
|
120
|
+
}
|
|
121
|
+
return str;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
//# sourceMappingURL=bytes.mjs.map
|
|
126
|
+
|
|
127
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@turnkey+api-key-stamper@0.5.0/node_modules/@turnkey/api-key-stamper/dist/tink/elliptic_curves.mjs
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Code modified from https://github.com/google/tink/blob/6f74b99a2bfe6677e3670799116a57268fd067fa/javascript/subtle/elliptic_curves.ts
|
|
132
|
+
* - The implementation of integerToByteArray has been modified to augment the resulting byte array to a certain length.
|
|
133
|
+
* - The implementation of PointDecode has been modified to decode both compressed and uncompressed points by checking for correct format
|
|
134
|
+
* - Method isP256CurvePoint added to check whether an uncompressed point is valid
|
|
135
|
+
*
|
|
136
|
+
* @license
|
|
137
|
+
* Copyright 2020 Google LLC
|
|
138
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* P-256 only
|
|
142
|
+
*/
|
|
143
|
+
function getModulus() {
|
|
144
|
+
// https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf (Appendix D).
|
|
145
|
+
return BigInt("115792089210356248762697446949407573530086143415290314195533631308" +
|
|
146
|
+
"867097853951");
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* P-256 only
|
|
150
|
+
*/
|
|
151
|
+
function getB() {
|
|
152
|
+
// https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf (Appendix D).
|
|
153
|
+
return BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b");
|
|
154
|
+
}
|
|
155
|
+
/** Converts byte array to bigint. */
|
|
156
|
+
function byteArrayToInteger(bytes) {
|
|
157
|
+
return BigInt("0x" + toHex(bytes));
|
|
158
|
+
}
|
|
159
|
+
/** Converts bigint to byte array. */
|
|
160
|
+
function integerToByteArray(i, length) {
|
|
161
|
+
const input = i.toString(16);
|
|
162
|
+
const numHexChars = length * 2;
|
|
163
|
+
let padding = "";
|
|
164
|
+
if (numHexChars < input.length) {
|
|
165
|
+
throw new Error(`cannot pack integer with ${input.length} hex chars into ${length} bytes`);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
padding = "0".repeat(numHexChars - input.length);
|
|
169
|
+
}
|
|
170
|
+
return fromHex(padding + input);
|
|
171
|
+
}
|
|
172
|
+
/** Returns true iff the ith bit (in lsb order) of n is set. */
|
|
173
|
+
function testBit(n, i) {
|
|
174
|
+
const m = BigInt(1) << BigInt(i);
|
|
175
|
+
return (n & m) !== BigInt(0);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Computes a modular exponent. Since JavaScript BigInt operations are not
|
|
179
|
+
* constant-time, information about the inputs could leak. Therefore, THIS
|
|
180
|
+
* METHOD SHOULD ONLY BE USED FOR POINT DECOMPRESSION.
|
|
181
|
+
*
|
|
182
|
+
* @param b base
|
|
183
|
+
* @param exp exponent
|
|
184
|
+
* @param p modulus
|
|
185
|
+
* @return b^exp modulo p
|
|
186
|
+
*/
|
|
187
|
+
function modPow(b, exp, p) {
|
|
188
|
+
if (exp === BigInt(0)) {
|
|
189
|
+
return BigInt(1);
|
|
190
|
+
}
|
|
191
|
+
let result = b;
|
|
192
|
+
const exponentBitString = exp.toString(2);
|
|
193
|
+
for (let i = 1; i < exponentBitString.length; ++i) {
|
|
194
|
+
result = (result * result) % p;
|
|
195
|
+
if (exponentBitString[i] === "1") {
|
|
196
|
+
result = (result * b) % p;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Computes a square root modulo an odd prime. Since timing and exceptions can
|
|
203
|
+
* leak information about the inputs, THIS METHOD SHOULD ONLY BE USED FOR
|
|
204
|
+
* POINT DECOMPRESSION.
|
|
205
|
+
*
|
|
206
|
+
* @param x square
|
|
207
|
+
* @param p prime modulus
|
|
208
|
+
* @return square root of x modulo p
|
|
209
|
+
*/
|
|
210
|
+
function modSqrt(x, p) {
|
|
211
|
+
if (p <= BigInt(0)) {
|
|
212
|
+
throw new Error("p must be positive");
|
|
213
|
+
}
|
|
214
|
+
const base = x % p;
|
|
215
|
+
// The currently supported NIST curves P-256, P-384, and P-521 all satisfy
|
|
216
|
+
// p % 4 == 3. However, although currently a no-op, the following check
|
|
217
|
+
// should be left in place in case other curves are supported in the future.
|
|
218
|
+
if (testBit(p, 0) && /* istanbul ignore next */ testBit(p, 1)) {
|
|
219
|
+
// Case p % 4 == 3 (applies to NIST curves P-256, P-384, and P-521)
|
|
220
|
+
// q = (p + 1) / 4
|
|
221
|
+
const q = (p + BigInt(1)) >> BigInt(2);
|
|
222
|
+
const squareRoot = modPow(base, q, p);
|
|
223
|
+
if ((squareRoot * squareRoot) % p !== base) {
|
|
224
|
+
throw new Error("could not find a modular square root");
|
|
225
|
+
}
|
|
226
|
+
return squareRoot;
|
|
227
|
+
}
|
|
228
|
+
// Skipping other elliptic curve types that require Cipolla's algorithm.
|
|
229
|
+
throw new Error("unsupported modulus value");
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Computes the y-coordinate of a point on an elliptic curve given its
|
|
233
|
+
* x-coordinate. Since timing and exceptions can leak information about the
|
|
234
|
+
* inputs, THIS METHOD SHOULD ONLY BE USED FOR POINT DECOMPRESSION.
|
|
235
|
+
*
|
|
236
|
+
* P-256 only
|
|
237
|
+
*
|
|
238
|
+
* @param x x-coordinate
|
|
239
|
+
* @param lsb least significant bit of the y-coordinate
|
|
240
|
+
* @return y-coordinate
|
|
241
|
+
*/
|
|
242
|
+
function getY(x, lsb) {
|
|
243
|
+
const p = getModulus();
|
|
244
|
+
const a = p - BigInt(3);
|
|
245
|
+
const b = getB();
|
|
246
|
+
const rhs = ((x * x + a) * x + b) % p;
|
|
247
|
+
let y = modSqrt(rhs, p);
|
|
248
|
+
if (lsb !== testBit(y, 0)) {
|
|
249
|
+
y = (p - y) % p;
|
|
250
|
+
}
|
|
251
|
+
return y;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
* Given x and y coordinates of a JWK, checks whether these are valid points on
|
|
256
|
+
* the P-256 elliptic curve.
|
|
257
|
+
*
|
|
258
|
+
* P-256 only
|
|
259
|
+
*
|
|
260
|
+
* @param x x-coordinate
|
|
261
|
+
* @param y y-coordinate
|
|
262
|
+
* @return boolean validity
|
|
263
|
+
*/
|
|
264
|
+
function isP256CurvePoint(x, y) {
|
|
265
|
+
const p = getModulus();
|
|
266
|
+
const a = p - BigInt(3);
|
|
267
|
+
const b = getB();
|
|
268
|
+
const rhs = ((x * x + a) * x + b) % p;
|
|
269
|
+
const lhs = y ** BigInt(2) % p;
|
|
270
|
+
return lhs === rhs;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Decodes a public key in _compressed_ OR _uncompressed_ format.
|
|
274
|
+
* Augmented to ensure that the x and y components are padded to fit 32 bytes.
|
|
275
|
+
*
|
|
276
|
+
* P-256 only
|
|
277
|
+
*/
|
|
278
|
+
function pointDecode(point) {
|
|
279
|
+
const fieldSize = fieldSizeInBytes();
|
|
280
|
+
const compressedLength = fieldSize + 1;
|
|
281
|
+
const uncompressedLength = 2 * fieldSize + 1;
|
|
282
|
+
if (point.length !== compressedLength &&
|
|
283
|
+
point.length !== uncompressedLength) {
|
|
284
|
+
throw new Error("Invalid length: point is not in compressed or uncompressed format");
|
|
285
|
+
}
|
|
286
|
+
// Decodes point if its length and first bit match the compressed format
|
|
287
|
+
if ((point[0] === 2 || point[0] === 3) && point.length == compressedLength) {
|
|
288
|
+
const lsb = point[0] === 3; // point[0] must be 2 (false) or 3 (true).
|
|
289
|
+
const x = byteArrayToInteger(point.subarray(1, point.length));
|
|
290
|
+
const p = getModulus();
|
|
291
|
+
if (x < BigInt(0) || x >= p) {
|
|
292
|
+
throw new Error("x is out of range");
|
|
293
|
+
}
|
|
294
|
+
const y = getY(x, lsb);
|
|
295
|
+
const result = {
|
|
296
|
+
kty: "EC",
|
|
297
|
+
crv: "P-256",
|
|
298
|
+
x: toBase64(integerToByteArray(x, 32)),
|
|
299
|
+
y: toBase64(integerToByteArray(y, 32)),
|
|
300
|
+
ext: true,
|
|
301
|
+
};
|
|
302
|
+
return result;
|
|
303
|
+
// Decodes point if its length and first bit match the uncompressed format
|
|
304
|
+
}
|
|
305
|
+
else if (point[0] === 4 && point.length == uncompressedLength) {
|
|
306
|
+
const x = byteArrayToInteger(point.subarray(1, fieldSize + 1));
|
|
307
|
+
const y = byteArrayToInteger(point.subarray(fieldSize + 1, 2 * fieldSize + 1));
|
|
308
|
+
const p = getModulus();
|
|
309
|
+
if (x < BigInt(0) ||
|
|
310
|
+
x >= p ||
|
|
311
|
+
y < BigInt(0) ||
|
|
312
|
+
y >= p ||
|
|
313
|
+
!isP256CurvePoint(x, y)) {
|
|
314
|
+
throw new Error("invalid uncompressed x and y coordinates");
|
|
315
|
+
}
|
|
316
|
+
const result = {
|
|
317
|
+
kty: "EC",
|
|
318
|
+
crv: "P-256",
|
|
319
|
+
x: toBase64(integerToByteArray(x, 32)),
|
|
320
|
+
y: toBase64(integerToByteArray(y, 32)),
|
|
321
|
+
ext: true,
|
|
322
|
+
};
|
|
323
|
+
return result;
|
|
324
|
+
}
|
|
325
|
+
throw new Error("invalid format");
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* P-256 only
|
|
329
|
+
*/
|
|
330
|
+
function fieldSizeInBytes() {
|
|
331
|
+
return 32;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
//# sourceMappingURL=elliptic_curves.mjs.map
|
|
336
|
+
|
|
337
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/@turnkey+encoding@0.6.0/node_modules/@turnkey/encoding/dist/index.mjs + 6 modules
|
|
338
|
+
var dist = __webpack_require__(56390);
|
|
339
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@turnkey+api-key-stamper@0.5.0/node_modules/@turnkey/api-key-stamper/dist/utils.mjs
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Converts a Turnkey API key pair into a JSON Web Key (JWK) format.
|
|
345
|
+
* This function accepts P-256 API keys only.
|
|
346
|
+
*
|
|
347
|
+
* @param {Object} input - The Turnkey API key components.
|
|
348
|
+
* @param {string} input.uncompressedPrivateKeyHex - Hexadecimal-encoded uncompressed private key (32-byte scalar).
|
|
349
|
+
* @param {string} input.compressedPublicKeyHex - Hexadecimal-encoded compressed public key (33 bytes).
|
|
350
|
+
* @returns {JsonWebKey} A JSON Web Key object representing the EC P-256 key.
|
|
351
|
+
*/
|
|
352
|
+
function convertTurnkeyApiKeyToJwk(input) {
|
|
353
|
+
const { uncompressedPrivateKeyHex, compressedPublicKeyHex } = input;
|
|
354
|
+
let jwk;
|
|
355
|
+
try {
|
|
356
|
+
jwk = pointDecode((0,dist/* uint8ArrayFromHexString */.Ks)(compressedPublicKeyHex));
|
|
357
|
+
}
|
|
358
|
+
catch (e) {
|
|
359
|
+
throw new Error(`unable to load API key: invalid public key. Did you switch your public and private key by accident? Is your public key a valid, compressed P-256 public key?`);
|
|
360
|
+
}
|
|
361
|
+
// Ensure that d is sufficiently padded
|
|
362
|
+
jwk.d = (0,dist/* hexStringToBase64url */.el)(uncompressedPrivateKeyHex, dist/* DEFAULT_JWK_MEMBER_BYTE_LENGTH */.Ev);
|
|
363
|
+
return jwk;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
//# sourceMappingURL=utils.mjs.map
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
/***/ })
|
|
371
|
+
|
|
372
|
+
};
|