@gibme/crypto-browser 7.0.2
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 +25 -0
- package/README.md +18 -0
- package/dist/Crypto.min.js +3 -0
- package/dist/Crypto.min.js.LICENSE.txt +15 -0
- package/dist/Crypto.min.js.map +1 -0
- package/dist/browser/src/index.d.ts +70 -0
- package/dist/browser/src/index.js +177 -0
- package/dist/browser/src/index.js.map +1 -0
- package/dist/browser/src/version.d.ts +1 -0
- package/dist/browser/src/version.js +6 -0
- package/dist/browser/src/version.js.map +1 -0
- package/dist/types/helpers.d.ts +43 -0
- package/dist/types/helpers.js +123 -0
- package/dist/types/helpers.js.map +1 -0
- package/dist/types/index.d.ts +806 -0
- package/dist/types/index.js +1518 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/types.d.ts +278 -0
- package/dist/types/types.js +59 -0
- package/dist/types/types.js.map +1 -0
- package/dist/types/uint64.d.ts +13 -0
- package/dist/types/uint64.js +70 -0
- package/dist/types/uint64.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,1518 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2020, Brandon Lehmann
|
|
3
|
+
//
|
|
4
|
+
// Redistribution and use in source and binary forms, with or without modification, are
|
|
5
|
+
// permitted provided that the following conditions are met:
|
|
6
|
+
//
|
|
7
|
+
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
8
|
+
// conditions and the following disclaimer.
|
|
9
|
+
//
|
|
10
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
11
|
+
// of conditions and the following disclaimer in the documentation and/or other
|
|
12
|
+
// materials provided with the distribution.
|
|
13
|
+
//
|
|
14
|
+
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
|
15
|
+
// used to endorse or promote products derived from this software without specific
|
|
16
|
+
// prior written permission.
|
|
17
|
+
//
|
|
18
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
19
|
+
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
20
|
+
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
21
|
+
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
23
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
24
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
25
|
+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
26
|
+
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
30
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
31
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
32
|
+
}
|
|
33
|
+
Object.defineProperty(o, k2, desc);
|
|
34
|
+
}) : (function(o, m, k, k2) {
|
|
35
|
+
if (k2 === undefined) k2 = k;
|
|
36
|
+
o[k2] = m[k];
|
|
37
|
+
}));
|
|
38
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
39
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.CryptoModule = void 0;
|
|
43
|
+
const types_1 = require("./types");
|
|
44
|
+
const helpers_1 = require("./helpers");
|
|
45
|
+
const uint64_1 = require("./uint64");
|
|
46
|
+
// import { Reader, Writer } from '@gibme/bytepack';
|
|
47
|
+
__exportStar(require("./types"), exports);
|
|
48
|
+
__exportStar(require("./helpers"), exports);
|
|
49
|
+
/**
|
|
50
|
+
* @ignore
|
|
51
|
+
*/
|
|
52
|
+
class CryptoModule {
|
|
53
|
+
/**
|
|
54
|
+
* We cannot create a new instance using this method as we need to await the
|
|
55
|
+
* loading of an underlying module, hence, we need to await the static
|
|
56
|
+
* init() method on this class to receive an instance of the class
|
|
57
|
+
*
|
|
58
|
+
* @protected
|
|
59
|
+
*/
|
|
60
|
+
// eslint-disable-next-line no-useless-constructor
|
|
61
|
+
constructor() { }
|
|
62
|
+
/**
|
|
63
|
+
* Gets the external library calls that replace our cryptographic method calls
|
|
64
|
+
*/
|
|
65
|
+
static get external_library() {
|
|
66
|
+
return this._external_library;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Sets external library calls that replace our cryptographic method calls
|
|
70
|
+
*
|
|
71
|
+
* @param config
|
|
72
|
+
*/
|
|
73
|
+
static set external_library(config) {
|
|
74
|
+
for (const key of Object.keys(config)) {
|
|
75
|
+
this._external_library[key] = config[key];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the underlying cryptographic library name
|
|
80
|
+
*/
|
|
81
|
+
static get library_name() {
|
|
82
|
+
return (0, helpers_1.LibraryTypeName)(this.runtime_configuration.type);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns the underlying cryptographic library type
|
|
86
|
+
*/
|
|
87
|
+
static get library_type() {
|
|
88
|
+
return this.runtime_configuration.type;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns if the underlying cryptographic library is of the
|
|
92
|
+
* Node.js C++ Addon type
|
|
93
|
+
*/
|
|
94
|
+
static get is_native() {
|
|
95
|
+
return this.runtime_configuration.type === types_1.LibraryType.NODE;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Sets external library calls that replace our cryptographic method calls
|
|
99
|
+
*
|
|
100
|
+
* @param config
|
|
101
|
+
*/
|
|
102
|
+
set external_library(config) {
|
|
103
|
+
CryptoModule.external_library = config;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Gets the external library calls that replace our cryptographic method calls
|
|
107
|
+
*/
|
|
108
|
+
get external_library() {
|
|
109
|
+
return CryptoModule.external_library;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns the underlying cryptographic library name
|
|
113
|
+
*/
|
|
114
|
+
get library_name() {
|
|
115
|
+
return CryptoModule.library_name;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns the underlying cryptographic library type
|
|
119
|
+
*/
|
|
120
|
+
get library_type() {
|
|
121
|
+
return CryptoModule.library_type;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns if the underlying cryptographic library is of the
|
|
125
|
+
* Node.js C++ Addon type
|
|
126
|
+
*/
|
|
127
|
+
get is_native() {
|
|
128
|
+
return CryptoModule.is_native;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Encodes an address into Base58
|
|
132
|
+
*
|
|
133
|
+
* @param prefix
|
|
134
|
+
* @param public_spend
|
|
135
|
+
* @param public_view
|
|
136
|
+
*/
|
|
137
|
+
async base58_address_encode(prefix, public_spend, public_view) {
|
|
138
|
+
if (public_view) {
|
|
139
|
+
return this.execute('base58_address_encode', {
|
|
140
|
+
prefix,
|
|
141
|
+
public_spend,
|
|
142
|
+
public_view
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return this.execute('base58_address_encode', {
|
|
146
|
+
prefix,
|
|
147
|
+
public_key: public_spend
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Encodes an address into CryptoNote Base58
|
|
152
|
+
*
|
|
153
|
+
* @param prefix
|
|
154
|
+
* @param public_spend
|
|
155
|
+
* @param public_view
|
|
156
|
+
*/
|
|
157
|
+
async cn_base58_address_encode(prefix, public_spend, public_view) {
|
|
158
|
+
if (public_view) {
|
|
159
|
+
return this.execute('cn_base58_address_encode', {
|
|
160
|
+
prefix,
|
|
161
|
+
public_spend,
|
|
162
|
+
public_view
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return this.execute('cn_base58_address_encode', {
|
|
166
|
+
prefix,
|
|
167
|
+
public_key: public_spend
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Decodes an address from Base58
|
|
172
|
+
*
|
|
173
|
+
* @param base58
|
|
174
|
+
*/
|
|
175
|
+
async base58_address_decode(base58) {
|
|
176
|
+
const result = await this.execute('base58_address_decode', base58);
|
|
177
|
+
if (result.public_view && uint64_1.uint256.from(result.public_view).value === BigInt(1)) {
|
|
178
|
+
delete result.public_view;
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Decodes an address from CryptoNote Base58
|
|
184
|
+
*
|
|
185
|
+
* @param base58
|
|
186
|
+
*/
|
|
187
|
+
async cn_base58_address_decode(base58) {
|
|
188
|
+
const result = await this.execute('cn_base58_address_decode', base58);
|
|
189
|
+
if (result.public_view && uint64_1.uint256.from(result.public_view).value === BigInt(1)) {
|
|
190
|
+
delete result.public_view;
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Generates a random entropy value
|
|
196
|
+
*
|
|
197
|
+
* @param entropy
|
|
198
|
+
* @param bits
|
|
199
|
+
* @param encode_timestamp
|
|
200
|
+
*/
|
|
201
|
+
async random_entropy(entropy, bits = 256, encode_timestamp = true) {
|
|
202
|
+
return await this.execute('random_entropy', {
|
|
203
|
+
entropy: entropy !== null && entropy !== void 0 ? entropy : '',
|
|
204
|
+
bits,
|
|
205
|
+
encode_timestamp
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Generates a random hash value
|
|
210
|
+
*/
|
|
211
|
+
async random_hash() {
|
|
212
|
+
return await this.execute('random_hash');
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Generates a list of random hashes
|
|
216
|
+
*
|
|
217
|
+
* @param count
|
|
218
|
+
*/
|
|
219
|
+
async random_hashes(count = 1) {
|
|
220
|
+
return await this.execute('random_hashes', count);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Generates a random ED25519 scalar value
|
|
224
|
+
*/
|
|
225
|
+
async random_scalar() {
|
|
226
|
+
return await this.execute('random_scalar');
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Generates a list of random ED25519 scalars
|
|
230
|
+
*
|
|
231
|
+
* @param count
|
|
232
|
+
*/
|
|
233
|
+
async random_scalars(count = 1) {
|
|
234
|
+
return await this.execute('random_scalars', count);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Generates a random ED25519 point value
|
|
238
|
+
*/
|
|
239
|
+
async random_point() {
|
|
240
|
+
return await this.execute('random_point');
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Generates a list of random ED25519 points
|
|
244
|
+
*
|
|
245
|
+
* @param count
|
|
246
|
+
*/
|
|
247
|
+
async random_points(count = 1) {
|
|
248
|
+
return await this.execute('random_points', count);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Hashes the input data using sha256 and returns the resulting hash value
|
|
252
|
+
*
|
|
253
|
+
* @param input
|
|
254
|
+
*/
|
|
255
|
+
async sha256(input) {
|
|
256
|
+
if (typeof input !== 'string') {
|
|
257
|
+
input = JSON.stringify(input);
|
|
258
|
+
}
|
|
259
|
+
return this.execute('sha256', input);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Hashes the input data using sha384 and returns the resulting hash value
|
|
263
|
+
*
|
|
264
|
+
* @param input
|
|
265
|
+
*/
|
|
266
|
+
async sha384(input) {
|
|
267
|
+
if (typeof input !== 'string') {
|
|
268
|
+
input = JSON.stringify(input);
|
|
269
|
+
}
|
|
270
|
+
return this.execute('sha384', input);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Hashes the input data using sha512 and returns the resulting hash value
|
|
274
|
+
*
|
|
275
|
+
* @param input
|
|
276
|
+
*/
|
|
277
|
+
async sha512(input) {
|
|
278
|
+
if (typeof input !== 'string') {
|
|
279
|
+
input = JSON.stringify(input);
|
|
280
|
+
}
|
|
281
|
+
return this.execute('sha512', input);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Hashes the input data using sha3 and returns the resulting hash value
|
|
285
|
+
*
|
|
286
|
+
* @param input
|
|
287
|
+
*/
|
|
288
|
+
async sha3(input) {
|
|
289
|
+
if (typeof input !== 'string') {
|
|
290
|
+
input = JSON.stringify(input);
|
|
291
|
+
}
|
|
292
|
+
return this.execute('sha3', input);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Hashes the input data using a simple SHA3 KDF function and returns
|
|
296
|
+
* the resulting hash value
|
|
297
|
+
*
|
|
298
|
+
* @param input
|
|
299
|
+
* @param iterations
|
|
300
|
+
*/
|
|
301
|
+
async sha3_slow(input, iterations = 0) {
|
|
302
|
+
return this.execute('sha3_slow', {
|
|
303
|
+
input,
|
|
304
|
+
iterations
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Hashes the input data using Blake2b and returns the resulting
|
|
309
|
+
* hash value
|
|
310
|
+
*
|
|
311
|
+
* @param input
|
|
312
|
+
*/
|
|
313
|
+
async blake2b(input) {
|
|
314
|
+
if (typeof input !== 'string') {
|
|
315
|
+
input = JSON.stringify(input);
|
|
316
|
+
}
|
|
317
|
+
return this.execute('blake2b', input);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Hashes the input data using Argon2i and returns the resulting hash value
|
|
321
|
+
*
|
|
322
|
+
* @param input
|
|
323
|
+
* @param iterations
|
|
324
|
+
* @param memory
|
|
325
|
+
* @param threads
|
|
326
|
+
*/
|
|
327
|
+
async argon2i(input, iterations = 1, memory = 256, threads = 1) {
|
|
328
|
+
if (typeof input !== 'string') {
|
|
329
|
+
input = JSON.stringify(input);
|
|
330
|
+
}
|
|
331
|
+
return this.execute('argon2i', {
|
|
332
|
+
input,
|
|
333
|
+
iterations,
|
|
334
|
+
memory,
|
|
335
|
+
threads
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Hashes the input data using Argon2d and returns the resulting hash value
|
|
340
|
+
*
|
|
341
|
+
* @param input
|
|
342
|
+
* @param iterations
|
|
343
|
+
* @param memory
|
|
344
|
+
* @param threads
|
|
345
|
+
*/
|
|
346
|
+
async argon2d(input, iterations = 1, memory = 256, threads = 1) {
|
|
347
|
+
if (typeof input !== 'string') {
|
|
348
|
+
input = JSON.stringify(input);
|
|
349
|
+
}
|
|
350
|
+
return this.execute('argon2d', {
|
|
351
|
+
input,
|
|
352
|
+
iterations,
|
|
353
|
+
memory,
|
|
354
|
+
threads
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Hashes the input data using Argon2id and returns the resulting hash value
|
|
359
|
+
*
|
|
360
|
+
* @param input
|
|
361
|
+
* @param iterations
|
|
362
|
+
* @param memory
|
|
363
|
+
* @param threads
|
|
364
|
+
*/
|
|
365
|
+
async argon2id(input, iterations = 1, memory = 256, threads = 1) {
|
|
366
|
+
if (typeof input !== 'string') {
|
|
367
|
+
input = JSON.stringify(input);
|
|
368
|
+
}
|
|
369
|
+
return this.execute('argon2id', {
|
|
370
|
+
input,
|
|
371
|
+
iterations,
|
|
372
|
+
memory,
|
|
373
|
+
threads
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Recovers entropy from a mnemonic phrase or a list of mnemonic phrase words
|
|
378
|
+
*
|
|
379
|
+
* @param mnenomic_phrase
|
|
380
|
+
* @param language
|
|
381
|
+
*/
|
|
382
|
+
async entropy_recover(mnenomic_phrase, language = types_1.Language.ENGLISH) {
|
|
383
|
+
if (Array.isArray(mnenomic_phrase)) {
|
|
384
|
+
mnenomic_phrase = mnenomic_phrase.join(' ');
|
|
385
|
+
}
|
|
386
|
+
return this.execute('entropy_recover', {
|
|
387
|
+
input: mnenomic_phrase,
|
|
388
|
+
language
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Generates a key derivation
|
|
393
|
+
*
|
|
394
|
+
* Note: D = (a * B) mod l
|
|
395
|
+
*
|
|
396
|
+
* @param public_key
|
|
397
|
+
* @param secret_key
|
|
398
|
+
*/
|
|
399
|
+
async generate_derivation(public_key, secret_key) {
|
|
400
|
+
return this.execute('generate_derivation', {
|
|
401
|
+
public_key,
|
|
402
|
+
secret_key
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Generates a key derivation scalar value
|
|
407
|
+
*
|
|
408
|
+
* Note: Ds = H(D || output_index) mod l
|
|
409
|
+
*
|
|
410
|
+
* @param derivation
|
|
411
|
+
* @param output_index
|
|
412
|
+
*/
|
|
413
|
+
async generate_derivation_scalar(derivation, output_index = 0) {
|
|
414
|
+
return this.execute('generate_derivation_scalar', {
|
|
415
|
+
derivation,
|
|
416
|
+
output_index
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Derives a public ephemeral from a derivation scalar and a public key
|
|
421
|
+
*
|
|
422
|
+
* Note: P = [(Ds * G) + B] mod l
|
|
423
|
+
*
|
|
424
|
+
* @param derivation_scalar
|
|
425
|
+
* @param public_key
|
|
426
|
+
*/
|
|
427
|
+
async derive_public_key(derivation_scalar, public_key) {
|
|
428
|
+
return this.execute('derive_public_key', {
|
|
429
|
+
derivation_scalar,
|
|
430
|
+
public_key
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Derives a secret ephemeral from a derivation scalar and a secret key
|
|
435
|
+
*
|
|
436
|
+
* Note: p = (Ds + b) mod l
|
|
437
|
+
*
|
|
438
|
+
* @param derivation_scalar
|
|
439
|
+
* @param secret_key
|
|
440
|
+
*/
|
|
441
|
+
async derive_secret_key(derivation_scalar, secret_key) {
|
|
442
|
+
return this.execute('derive_secret_key', {
|
|
443
|
+
derivation_scalar,
|
|
444
|
+
secret_key
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Generates a key image from the public and secret ephemeral
|
|
449
|
+
*
|
|
450
|
+
* @param public_ephemeral
|
|
451
|
+
* @param secret_ephemeral
|
|
452
|
+
*/
|
|
453
|
+
async generate_key_image(public_ephemeral, secret_ephemeral) {
|
|
454
|
+
return this.execute('generate_key_image', {
|
|
455
|
+
public_ephemeral,
|
|
456
|
+
secret_ephemeral
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Generates a V2 key image from the secret ephemeral
|
|
461
|
+
*
|
|
462
|
+
* @param secret_ephemeral
|
|
463
|
+
*/
|
|
464
|
+
async generate_key_image_v2(secret_ephemeral) {
|
|
465
|
+
return this.execute('generate_key_image_v2', secret_ephemeral);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Generates a secret & public key pair
|
|
469
|
+
*/
|
|
470
|
+
async generate_keys() {
|
|
471
|
+
return this.execute('generate_keys');
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Generates a list pf secret & public keys
|
|
475
|
+
*
|
|
476
|
+
* @param count
|
|
477
|
+
*/
|
|
478
|
+
async generate_keys_m(count = 1) {
|
|
479
|
+
return this.execute('generate_keys_m', count);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Much like derive_public_key() but calculates the public_key used from the public ephemeral
|
|
483
|
+
*
|
|
484
|
+
* Note: B = P - [H(D || output_index) mod l]
|
|
485
|
+
*
|
|
486
|
+
* @param derivation
|
|
487
|
+
* @param public_ephemeral
|
|
488
|
+
* @param output_index
|
|
489
|
+
*/
|
|
490
|
+
async underive_public_key(derivation, public_ephemeral, output_index = 0) {
|
|
491
|
+
return this.execute('underive_public_key', {
|
|
492
|
+
derivation,
|
|
493
|
+
output_index,
|
|
494
|
+
public_ephemeral
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Calculates the public key of the given secret key
|
|
499
|
+
*
|
|
500
|
+
* @param secret_key
|
|
501
|
+
*/
|
|
502
|
+
async secret_key_to_public_key(secret_key) {
|
|
503
|
+
return this.execute('secret_key_to_public_key', secret_key);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Calculates the secret scalar and public key for the provided ED25519 private key (aka seed)
|
|
507
|
+
*
|
|
508
|
+
* @param private_key
|
|
509
|
+
*/
|
|
510
|
+
async private_key_to_keys(private_key) {
|
|
511
|
+
return this.execute('private_key_to_keys', private_key);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Generates an ED25519 point by hashing the provided data and turning
|
|
515
|
+
* it into a point on the ED25519 curve
|
|
516
|
+
*
|
|
517
|
+
* @param input
|
|
518
|
+
*/
|
|
519
|
+
async hash_to_point(input) {
|
|
520
|
+
if (input instanceof Buffer) {
|
|
521
|
+
return this.execute('hash_to_point', input.toString('hex'));
|
|
522
|
+
}
|
|
523
|
+
else if (typeof input !== 'string') {
|
|
524
|
+
input = JSON.stringify(input);
|
|
525
|
+
}
|
|
526
|
+
return this.execute('hash_to_point', input);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Generates an ED25519 scalar by hashing the provided data and
|
|
530
|
+
* reducing it to an ED25519 scalar value
|
|
531
|
+
*
|
|
532
|
+
* @param input
|
|
533
|
+
*/
|
|
534
|
+
async hash_to_scalar(input) {
|
|
535
|
+
if (input instanceof Buffer) {
|
|
536
|
+
return this.execute('hash_to_scalar', input.toString('hex'));
|
|
537
|
+
}
|
|
538
|
+
else if (typeof input !== 'string') {
|
|
539
|
+
input = JSON.stringify(input);
|
|
540
|
+
}
|
|
541
|
+
return this.execute('hash_to_scalar', input);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Reduces the input value to an ED25519 scalar value
|
|
545
|
+
*
|
|
546
|
+
* @param input
|
|
547
|
+
*/
|
|
548
|
+
async scalar_reduce(input) {
|
|
549
|
+
if (input instanceof Buffer) {
|
|
550
|
+
return this.execute('scalar_reduce', input.subarray(0, 32).toString('hex'));
|
|
551
|
+
}
|
|
552
|
+
return this.execute('scalar_reduce', input);
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Calculates the depth of the Merkle tree based upon how many hashes
|
|
556
|
+
* the tree contains
|
|
557
|
+
*
|
|
558
|
+
* @param value
|
|
559
|
+
*/
|
|
560
|
+
async tree_depth(value) {
|
|
561
|
+
return this.execute('tree_depth', value);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Generates the root Merkle tree hash using the list of hashes
|
|
565
|
+
*
|
|
566
|
+
* @param hashes
|
|
567
|
+
*/
|
|
568
|
+
async root_hash(hashes) {
|
|
569
|
+
return this.execute('root_hash', { items: hashes });
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Generates a Merkle tree root hash value from the supplied input values
|
|
573
|
+
*
|
|
574
|
+
* @param branches
|
|
575
|
+
* @param leaf
|
|
576
|
+
* @param depth
|
|
577
|
+
* @param path
|
|
578
|
+
*/
|
|
579
|
+
async root_hash_from_branch(branches, leaf, depth = 0, path = 0) {
|
|
580
|
+
return this.execute('root_hash_from_branch', {
|
|
581
|
+
branches,
|
|
582
|
+
depth,
|
|
583
|
+
leaf,
|
|
584
|
+
path
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Generates Merkle tree branch from the list of hashes
|
|
589
|
+
*
|
|
590
|
+
* @param hashes
|
|
591
|
+
*/
|
|
592
|
+
async tree_branch(hashes) {
|
|
593
|
+
return this.execute('tree_branch', { items: hashes });
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Generates an ED25519 RFC8032 signature for the message using
|
|
597
|
+
* the secret key specified
|
|
598
|
+
* @param message
|
|
599
|
+
* @param secret_key
|
|
600
|
+
*/
|
|
601
|
+
async generate_rfc8032_signature(message, secret_key) {
|
|
602
|
+
return this.execute('generate_rfc8032_signature', {
|
|
603
|
+
message,
|
|
604
|
+
secret_key
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Checks an ED25519 RFC8032 signature to verify that it was created
|
|
609
|
+
* with the secret key of the public key specified
|
|
610
|
+
* @param message
|
|
611
|
+
* @param public_key
|
|
612
|
+
* @param signature
|
|
613
|
+
*/
|
|
614
|
+
async check_rfc8032_signature(message, public_key, signature) {
|
|
615
|
+
try {
|
|
616
|
+
await this.execute('check_rfc8032_signature', {
|
|
617
|
+
message,
|
|
618
|
+
public_key,
|
|
619
|
+
signature
|
|
620
|
+
});
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
catch (_a) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Generates a simple ED25519 signature for the message digest using
|
|
629
|
+
* the secret key specified
|
|
630
|
+
*
|
|
631
|
+
* @param message_digest
|
|
632
|
+
* @param secret_key
|
|
633
|
+
*/
|
|
634
|
+
async generate_signature(message_digest, secret_key) {
|
|
635
|
+
return this.execute('generate_signature', {
|
|
636
|
+
message_digest,
|
|
637
|
+
secret_key
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Prepares a signature for the message digest such that it
|
|
642
|
+
* can be completed in later stages of the signature construction
|
|
643
|
+
*
|
|
644
|
+
* @param message_digest
|
|
645
|
+
* @param public_key
|
|
646
|
+
*/
|
|
647
|
+
async prepare_signature(message_digest, public_key) {
|
|
648
|
+
return this.execute('prepare_signature', {
|
|
649
|
+
message_digest,
|
|
650
|
+
public_key
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Completes a previously prepared signature
|
|
655
|
+
*
|
|
656
|
+
* @param secret_key
|
|
657
|
+
* @param signature
|
|
658
|
+
*/
|
|
659
|
+
async complete_signature(secret_key, signature) {
|
|
660
|
+
return this.execute('complete_signature', {
|
|
661
|
+
secret_key,
|
|
662
|
+
signature
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Checks a simple ED25519 signature to verify that it was created
|
|
667
|
+
* with the secret key of the public key specified
|
|
668
|
+
*
|
|
669
|
+
* @param message_digest
|
|
670
|
+
* @param public_key
|
|
671
|
+
* @param signature
|
|
672
|
+
*/
|
|
673
|
+
async check_signature(message_digest, public_key, signature) {
|
|
674
|
+
try {
|
|
675
|
+
await this.execute('check_signature', {
|
|
676
|
+
message_digest,
|
|
677
|
+
public_key,
|
|
678
|
+
signature
|
|
679
|
+
});
|
|
680
|
+
return true;
|
|
681
|
+
}
|
|
682
|
+
catch (_a) {
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Generates a borromean ring signature for the message digest using
|
|
688
|
+
* the secret key specified and the list of all possible public key
|
|
689
|
+
* signing candidates
|
|
690
|
+
*
|
|
691
|
+
* @param message_digest
|
|
692
|
+
* @param secret_ephemeral
|
|
693
|
+
* @param public_keys
|
|
694
|
+
*/
|
|
695
|
+
async generate_borromean_signature(message_digest, secret_ephemeral, public_keys) {
|
|
696
|
+
return this.execute('generate_borromean_signature', {
|
|
697
|
+
message_digest,
|
|
698
|
+
secret_ephemeral,
|
|
699
|
+
public_keys
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Prepares a borromean ring signature for the message digest such
|
|
704
|
+
* that it can be completed in later stages of signature construction
|
|
705
|
+
*
|
|
706
|
+
* @param message_digest
|
|
707
|
+
* @param key_image
|
|
708
|
+
* @param public_keys
|
|
709
|
+
* @param real_output_index
|
|
710
|
+
*/
|
|
711
|
+
async prepare_borromean_signature(message_digest, key_image, public_keys, real_output_index) {
|
|
712
|
+
return this.execute('prepare_borromean_signature', {
|
|
713
|
+
message_digest,
|
|
714
|
+
key_image,
|
|
715
|
+
public_keys,
|
|
716
|
+
real_output_index
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Completes a previously prepared borromean ring signature
|
|
721
|
+
*
|
|
722
|
+
* @param secret_ephemeral
|
|
723
|
+
* @param real_output_index
|
|
724
|
+
* @param signature
|
|
725
|
+
*/
|
|
726
|
+
async complete_borromean_signature(secret_ephemeral, real_output_index, signature) {
|
|
727
|
+
return this.execute('complete_borromean_signature', {
|
|
728
|
+
secret_ephemeral,
|
|
729
|
+
real_output_index,
|
|
730
|
+
signature
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Checks a borromean ring signature to verify that it was created
|
|
735
|
+
* by one of the candidate public keys
|
|
736
|
+
*
|
|
737
|
+
* @param message_digest
|
|
738
|
+
* @param key_image
|
|
739
|
+
* @param public_keys
|
|
740
|
+
* @param signature
|
|
741
|
+
*/
|
|
742
|
+
async check_borromean_signature(message_digest, key_image, public_keys, signature) {
|
|
743
|
+
try {
|
|
744
|
+
await this.execute('check_borromean_signature', {
|
|
745
|
+
message_digest,
|
|
746
|
+
key_image,
|
|
747
|
+
public_keys,
|
|
748
|
+
signature
|
|
749
|
+
});
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
catch (_a) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Generates a CLSAG ring signature for the message digest using
|
|
758
|
+
* the secret key specified and the list of all possible public
|
|
759
|
+
* key signing candidates.
|
|
760
|
+
*
|
|
761
|
+
* Optionally, we also include proof that we have the real values
|
|
762
|
+
* of the values hidden within pedersen commitments
|
|
763
|
+
*
|
|
764
|
+
* @param message_digest
|
|
765
|
+
* @param secret_ephemeral
|
|
766
|
+
* @param public_keys
|
|
767
|
+
* @param input_blinding_factor
|
|
768
|
+
* @param public_commitments
|
|
769
|
+
* @param pseudo_blinding_factor
|
|
770
|
+
* @param pseudo_commitment
|
|
771
|
+
*/
|
|
772
|
+
async generate_clsag_signature(message_digest, secret_ephemeral, public_keys, input_blinding_factor, public_commitments, pseudo_blinding_factor, pseudo_commitment) {
|
|
773
|
+
const options = {
|
|
774
|
+
message_digest,
|
|
775
|
+
secret_ephemeral,
|
|
776
|
+
public_keys
|
|
777
|
+
};
|
|
778
|
+
if (input_blinding_factor) {
|
|
779
|
+
options.input_blinding_factor = input_blinding_factor;
|
|
780
|
+
}
|
|
781
|
+
if (public_commitments) {
|
|
782
|
+
options.public_commitments = public_commitments;
|
|
783
|
+
}
|
|
784
|
+
if (pseudo_blinding_factor) {
|
|
785
|
+
options.pseudo_blinding_factor = pseudo_blinding_factor;
|
|
786
|
+
}
|
|
787
|
+
if (pseudo_commitment) {
|
|
788
|
+
options.pseudo_commitment = pseudo_commitment;
|
|
789
|
+
}
|
|
790
|
+
return this.execute('generate_clsag_signature', options);
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Prepares a CLSAG ring signature for the message digest such
|
|
794
|
+
* that it can be completed in later stages of signature
|
|
795
|
+
* construction
|
|
796
|
+
*
|
|
797
|
+
* @param message_digest
|
|
798
|
+
* @param key_image
|
|
799
|
+
* @param public_keys
|
|
800
|
+
* @param real_output_index
|
|
801
|
+
* @param input_blinding_factor
|
|
802
|
+
* @param public_commitments
|
|
803
|
+
* @param pseudo_blinding_factor
|
|
804
|
+
* @param pseudo_commitment
|
|
805
|
+
*/
|
|
806
|
+
async prepare_clsag_signature(message_digest, key_image, public_keys, real_output_index, input_blinding_factor, public_commitments, pseudo_blinding_factor, pseudo_commitment) {
|
|
807
|
+
const options = {
|
|
808
|
+
message_digest,
|
|
809
|
+
key_image,
|
|
810
|
+
public_keys,
|
|
811
|
+
real_output_index
|
|
812
|
+
};
|
|
813
|
+
if (input_blinding_factor) {
|
|
814
|
+
options.input_blinding_factor = input_blinding_factor;
|
|
815
|
+
}
|
|
816
|
+
if (public_commitments) {
|
|
817
|
+
options.public_commitments = public_commitments;
|
|
818
|
+
}
|
|
819
|
+
if (pseudo_blinding_factor) {
|
|
820
|
+
options.pseudo_blinding_factor = pseudo_blinding_factor;
|
|
821
|
+
}
|
|
822
|
+
if (pseudo_commitment) {
|
|
823
|
+
options.pseudo_commitment = pseudo_commitment;
|
|
824
|
+
}
|
|
825
|
+
return this.execute('prepare_clsag_signature', options);
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Completes a previously prepared CLSAG ring signature
|
|
829
|
+
*
|
|
830
|
+
* @param secret_ephemeral
|
|
831
|
+
* @param real_output_index
|
|
832
|
+
* @param signature
|
|
833
|
+
* @param h
|
|
834
|
+
* @param mu_P
|
|
835
|
+
*/
|
|
836
|
+
async complete_clsag_signature(secret_ephemeral, real_output_index, signature, h, mu_P) {
|
|
837
|
+
return this.execute('complete_clsag_signature', {
|
|
838
|
+
secret_ephemeral,
|
|
839
|
+
real_output_index,
|
|
840
|
+
signature,
|
|
841
|
+
h,
|
|
842
|
+
mu_P
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Checks a CLSAG ring signature to verify that it was created
|
|
847
|
+
* by one of the candidate public keys.
|
|
848
|
+
*
|
|
849
|
+
* @param message_digest
|
|
850
|
+
* @param key_image
|
|
851
|
+
* @param public_keys
|
|
852
|
+
* @param signature
|
|
853
|
+
* @param commitments
|
|
854
|
+
*/
|
|
855
|
+
async check_clsag_signature(message_digest, key_image, public_keys, signature, commitments) {
|
|
856
|
+
try {
|
|
857
|
+
const options = {
|
|
858
|
+
message_digest,
|
|
859
|
+
key_image,
|
|
860
|
+
public_keys,
|
|
861
|
+
signature
|
|
862
|
+
};
|
|
863
|
+
if (commitments) {
|
|
864
|
+
options.commitments = commitments;
|
|
865
|
+
}
|
|
866
|
+
await this.execute('check_clsag_signature', options);
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
catch (_a) {
|
|
870
|
+
return false;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Generates a Triptych ring signature for the message digest using
|
|
875
|
+
* the secret key specified and the list of all possible public
|
|
876
|
+
* key signing candidates.
|
|
877
|
+
*
|
|
878
|
+
* Optionally, we also include proof that we have the real values
|
|
879
|
+
* of the values hidden within pedersen commitments
|
|
880
|
+
*
|
|
881
|
+
* @param message_digest
|
|
882
|
+
* @param secret_ephemeral
|
|
883
|
+
* @param public_keys
|
|
884
|
+
* @param input_blinding_factor
|
|
885
|
+
* @param public_commitments
|
|
886
|
+
* @param pseudo_blinding_factor
|
|
887
|
+
* @param pseudo_commitment
|
|
888
|
+
*/
|
|
889
|
+
async generate_triptych_signature(message_digest, secret_ephemeral, public_keys, input_blinding_factor, public_commitments, pseudo_blinding_factor, pseudo_commitment) {
|
|
890
|
+
const options = {
|
|
891
|
+
message_digest,
|
|
892
|
+
secret_ephemeral,
|
|
893
|
+
public_keys
|
|
894
|
+
};
|
|
895
|
+
if (input_blinding_factor) {
|
|
896
|
+
options.input_blinding_factor = input_blinding_factor;
|
|
897
|
+
}
|
|
898
|
+
if (public_commitments) {
|
|
899
|
+
options.public_commitments = public_commitments;
|
|
900
|
+
}
|
|
901
|
+
if (pseudo_blinding_factor) {
|
|
902
|
+
options.pseudo_blinding_factor = pseudo_blinding_factor;
|
|
903
|
+
}
|
|
904
|
+
if (pseudo_commitment) {
|
|
905
|
+
options.pseudo_commitment = pseudo_commitment;
|
|
906
|
+
}
|
|
907
|
+
return this.execute('generate_triptych_signature', options);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Prepares a Triptych ring signature for the message digest such
|
|
911
|
+
* that it can be completed in later stages of signature
|
|
912
|
+
* construction
|
|
913
|
+
*
|
|
914
|
+
* @param message_digest
|
|
915
|
+
* @param key_image
|
|
916
|
+
* @param public_keys
|
|
917
|
+
* @param real_output_index
|
|
918
|
+
* @param input_blinding_factor
|
|
919
|
+
* @param public_commitments
|
|
920
|
+
* @param pseudo_blinding_factor
|
|
921
|
+
* @param pseudo_commitment
|
|
922
|
+
*/
|
|
923
|
+
async prepare_triptych_signature(message_digest, key_image, public_keys, real_output_index, input_blinding_factor, public_commitments, pseudo_blinding_factor, pseudo_commitment) {
|
|
924
|
+
const options = {
|
|
925
|
+
message_digest,
|
|
926
|
+
key_image,
|
|
927
|
+
public_keys,
|
|
928
|
+
real_output_index
|
|
929
|
+
};
|
|
930
|
+
if (input_blinding_factor) {
|
|
931
|
+
options.input_blinding_factor = input_blinding_factor;
|
|
932
|
+
}
|
|
933
|
+
if (public_commitments) {
|
|
934
|
+
options.public_commitments = public_commitments;
|
|
935
|
+
}
|
|
936
|
+
if (pseudo_blinding_factor) {
|
|
937
|
+
options.pseudo_blinding_factor = pseudo_blinding_factor;
|
|
938
|
+
}
|
|
939
|
+
if (pseudo_commitment) {
|
|
940
|
+
options.pseudo_commitment = pseudo_commitment;
|
|
941
|
+
}
|
|
942
|
+
return this.execute('prepare_triptych_signature', options);
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Completes a previously prepared Triptych ring signature
|
|
946
|
+
*
|
|
947
|
+
* @param secret_ephemeral
|
|
948
|
+
* @param signature
|
|
949
|
+
* @param xpow
|
|
950
|
+
*/
|
|
951
|
+
async complete_triptych_signature(secret_ephemeral, signature, xpow) {
|
|
952
|
+
return this.execute('complete_triptych_signature', {
|
|
953
|
+
secret_ephemeral,
|
|
954
|
+
signature,
|
|
955
|
+
xpow
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Checks a Triptych ring signature to verify that it was created
|
|
960
|
+
* by one of the candidate public keys.
|
|
961
|
+
*
|
|
962
|
+
* @param message_digest
|
|
963
|
+
* @param key_image
|
|
964
|
+
* @param public_keys
|
|
965
|
+
* @param signature
|
|
966
|
+
* @param commitments
|
|
967
|
+
*/
|
|
968
|
+
async check_triptych_signature(message_digest, key_image, public_keys, signature, commitments) {
|
|
969
|
+
try {
|
|
970
|
+
const options = {
|
|
971
|
+
message_digest,
|
|
972
|
+
key_image,
|
|
973
|
+
public_keys,
|
|
974
|
+
signature
|
|
975
|
+
};
|
|
976
|
+
if (commitments) {
|
|
977
|
+
options.commitments = commitments;
|
|
978
|
+
}
|
|
979
|
+
await this.execute('check_triptych_signature', options);
|
|
980
|
+
return true;
|
|
981
|
+
}
|
|
982
|
+
catch (_a) {
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Generates a Bulletproof Zero-Knowledge proof of the amount(s) specified
|
|
988
|
+
*
|
|
989
|
+
* @param amounts
|
|
990
|
+
* @param blinding_factors
|
|
991
|
+
* @param N
|
|
992
|
+
*/
|
|
993
|
+
async generate_bulletproof(amounts, blinding_factors, N = 64) {
|
|
994
|
+
return this.execute('generate_bulletproof', {
|
|
995
|
+
amounts,
|
|
996
|
+
blinding_factors,
|
|
997
|
+
N
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Checks that a Bulletproof proof is valid
|
|
1002
|
+
*
|
|
1003
|
+
* @param proof
|
|
1004
|
+
* @param commitments
|
|
1005
|
+
* @param N
|
|
1006
|
+
*/
|
|
1007
|
+
async check_bulletproof(proof, commitments, N = 64) {
|
|
1008
|
+
try {
|
|
1009
|
+
if (Array.isArray(proof) && Array.isArray(commitments[0])) {
|
|
1010
|
+
await this.execute('check_bulletproof_batch', {
|
|
1011
|
+
proofs: proof,
|
|
1012
|
+
commitments,
|
|
1013
|
+
N
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
else {
|
|
1017
|
+
await this.execute('check_bulletproof', {
|
|
1018
|
+
proof,
|
|
1019
|
+
commitments,
|
|
1020
|
+
N
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
return true;
|
|
1024
|
+
}
|
|
1025
|
+
catch (_a) {
|
|
1026
|
+
return false;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Generates a Bulletproof+ Zero-Knowledge proof of the amount(s) specified
|
|
1031
|
+
*
|
|
1032
|
+
* @param amounts
|
|
1033
|
+
* @param blinding_factors
|
|
1034
|
+
* @param N
|
|
1035
|
+
*/
|
|
1036
|
+
async generate_bulletproof_plus(amounts, blinding_factors, N = 64) {
|
|
1037
|
+
return this.execute('generate_bulletproof', {
|
|
1038
|
+
amounts,
|
|
1039
|
+
blinding_factors,
|
|
1040
|
+
N
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Checks that a Bulletproof+ proof is valid
|
|
1045
|
+
*
|
|
1046
|
+
* @param proof
|
|
1047
|
+
* @param commitments
|
|
1048
|
+
* @param N
|
|
1049
|
+
*/
|
|
1050
|
+
async check_bulletproof_plus(proof, commitments, N = 64) {
|
|
1051
|
+
try {
|
|
1052
|
+
if (Array.isArray(proof) && Array.isArray(commitments[0])) {
|
|
1053
|
+
await this.execute('check_bulletproof_batch', {
|
|
1054
|
+
proofs: proof,
|
|
1055
|
+
commitments,
|
|
1056
|
+
N
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
await this.execute('check_bulletproof', {
|
|
1061
|
+
proof,
|
|
1062
|
+
commitments,
|
|
1063
|
+
N
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
return true;
|
|
1067
|
+
}
|
|
1068
|
+
catch (_a) {
|
|
1069
|
+
return false;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Verifies that the sum of output pedersen commitments plus a pedersen
|
|
1074
|
+
* commitment of the transaction fee are equal to the sum of pseudo
|
|
1075
|
+
* pedersen commitments
|
|
1076
|
+
*
|
|
1077
|
+
* @param pseudo_commitments
|
|
1078
|
+
* @param output_commitments
|
|
1079
|
+
* @param transaction_fee
|
|
1080
|
+
*/
|
|
1081
|
+
async check_commitments_parity(pseudo_commitments, output_commitments, transaction_fee) {
|
|
1082
|
+
try {
|
|
1083
|
+
await this.execute('check_commitments_parity', {
|
|
1084
|
+
pseudo_commitments,
|
|
1085
|
+
output_commitments,
|
|
1086
|
+
transaction_fee
|
|
1087
|
+
});
|
|
1088
|
+
return true;
|
|
1089
|
+
}
|
|
1090
|
+
catch (_a) {
|
|
1091
|
+
return false;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Generates the amount mask for the given deriviation scalar
|
|
1096
|
+
*
|
|
1097
|
+
* @param derivation_scalar
|
|
1098
|
+
*/
|
|
1099
|
+
async generate_amount_mask(derivation_scalar) {
|
|
1100
|
+
return this.execute('generate_amount_mask', derivation_scalar);
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Generates the commitment blinding factor for the given derivation scalar
|
|
1104
|
+
*
|
|
1105
|
+
* @param derivation_scalar
|
|
1106
|
+
*/
|
|
1107
|
+
async generate_commitment_blinding_factor(derivation_scalar) {
|
|
1108
|
+
return this.execute('generate_commitment_blinding_factor', derivation_scalar);
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Generates a pedersen commitment for the supplied blinding factor and amount
|
|
1112
|
+
*
|
|
1113
|
+
* Note: C = (y * G) + (a * H) mod l
|
|
1114
|
+
*
|
|
1115
|
+
* @param blinding_factor
|
|
1116
|
+
* @param amount
|
|
1117
|
+
*/
|
|
1118
|
+
async generate_pedersen_commitment(blinding_factor, amount) {
|
|
1119
|
+
return this.execute('generate_pedersen_commitment', {
|
|
1120
|
+
blinding_factor,
|
|
1121
|
+
amount
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Generates a list of random blinding factors and pseudo output commitments from
|
|
1126
|
+
* the list of input amounts and the output commitments while proving them to a zero-sum
|
|
1127
|
+
*
|
|
1128
|
+
* @param amounts
|
|
1129
|
+
* @param output_blinding_factors
|
|
1130
|
+
*/
|
|
1131
|
+
async generate_pseudo_commitments(amounts, output_blinding_factors) {
|
|
1132
|
+
return this.execute('generate_pseudo_commitments', {
|
|
1133
|
+
amounts,
|
|
1134
|
+
output_blinding_factors
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Toggles an amount from unmasked/masked to the inverse state of masked/unmasked using the
|
|
1139
|
+
* provided amount mask
|
|
1140
|
+
*
|
|
1141
|
+
* @param amount_mask
|
|
1142
|
+
* @param amount
|
|
1143
|
+
*/
|
|
1144
|
+
async toggle_masked_amount(amount_mask, amount) {
|
|
1145
|
+
if (typeof amount === 'number') {
|
|
1146
|
+
amount = BigInt(amount);
|
|
1147
|
+
}
|
|
1148
|
+
else if (typeof amount === 'string') {
|
|
1149
|
+
amount = uint64_1.uint256.from(amount).value;
|
|
1150
|
+
}
|
|
1151
|
+
const result = await this.execute('toggle_masked_amount', {
|
|
1152
|
+
amount_mask,
|
|
1153
|
+
amount: (0, uint64_1.uint256)(amount).toString()
|
|
1154
|
+
});
|
|
1155
|
+
return uint64_1.uint256.from(result).value;
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Generates proof of having the secret ephemerals specified by generating the
|
|
1159
|
+
* relevant public keys, key_images, and signature for each and encoding the
|
|
1160
|
+
* necessary information into a Base58 encoded string that can be provided
|
|
1161
|
+
* to a verified that already has the public ephemerals
|
|
1162
|
+
*
|
|
1163
|
+
* @param secret_ephemerals
|
|
1164
|
+
*/
|
|
1165
|
+
async generate_outputs_proof(secret_ephemerals) {
|
|
1166
|
+
return this.execute('generate_outputs_proof', { items: secret_ephemerals });
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Verifies the proof provides using the public ephemerals by decoding the Base58 proof,
|
|
1170
|
+
* extracting the key images, the signatures, and then verifying if those signatures
|
|
1171
|
+
* are all valid, in which case, the key images are returned
|
|
1172
|
+
*
|
|
1173
|
+
* @param public_ephemerals
|
|
1174
|
+
* @param proof
|
|
1175
|
+
*/
|
|
1176
|
+
async check_outputs_proof(public_ephemerals, proof) {
|
|
1177
|
+
return this.execute('check_outputs_proof', {
|
|
1178
|
+
public_ephemerals,
|
|
1179
|
+
proof
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Encodes the value specified into Base58
|
|
1184
|
+
*
|
|
1185
|
+
* @param value
|
|
1186
|
+
*/
|
|
1187
|
+
async base58_encode(value) {
|
|
1188
|
+
if (typeof value === 'string') {
|
|
1189
|
+
value = Buffer.from(value, (0, helpers_1.is_hex)(value) ? 'hex' : undefined);
|
|
1190
|
+
}
|
|
1191
|
+
return this.execute('base58_encode', value.toString('hex'));
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Encodes the value specified into Base58 and appends a checksum to the result
|
|
1195
|
+
*
|
|
1196
|
+
* @param value
|
|
1197
|
+
*/
|
|
1198
|
+
async base58_encode_check(value) {
|
|
1199
|
+
if (typeof value === 'string') {
|
|
1200
|
+
value = Buffer.from(value, (0, helpers_1.is_hex)(value) ? 'hex' : undefined);
|
|
1201
|
+
}
|
|
1202
|
+
return this.execute('base58_encode_check', value.toString('hex'));
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Decodes a Base58 encoded string
|
|
1206
|
+
*
|
|
1207
|
+
* @param base58
|
|
1208
|
+
*/
|
|
1209
|
+
async base58_decode(base58) {
|
|
1210
|
+
const result = await this.execute('base58_decode', base58);
|
|
1211
|
+
return Buffer.from(result, 'hex');
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Decodes a Base58 encoded string after verifying the checksum value included
|
|
1215
|
+
*
|
|
1216
|
+
* @param base58
|
|
1217
|
+
*/
|
|
1218
|
+
async base58_decode_check(base58) {
|
|
1219
|
+
const result = await this.execute('base58_decode_check', base58);
|
|
1220
|
+
return Buffer.from(result, 'hex');
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Encodes the specified value into CryptoNote Base58
|
|
1224
|
+
* @param value
|
|
1225
|
+
*/
|
|
1226
|
+
async cn_base58_encode(value) {
|
|
1227
|
+
if (typeof value === 'string') {
|
|
1228
|
+
value = Buffer.from(value, (0, helpers_1.is_hex)(value) ? 'hex' : undefined);
|
|
1229
|
+
}
|
|
1230
|
+
return this.execute('cn_base58_encode', value.toString('hex'));
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Encodes the value specified into CryptoNote Base58 and appends a checksum to the result
|
|
1234
|
+
*
|
|
1235
|
+
* @param value
|
|
1236
|
+
*/
|
|
1237
|
+
async cn_base58_encode_check(value) {
|
|
1238
|
+
if (typeof value === 'string') {
|
|
1239
|
+
value = Buffer.from(value, (0, helpers_1.is_hex)(value) ? 'hex' : undefined);
|
|
1240
|
+
}
|
|
1241
|
+
return this.execute('cn_base58_encode_check', value.toString('hex'));
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Decodes a CryptoNote Base58 string
|
|
1245
|
+
*
|
|
1246
|
+
* @param base58
|
|
1247
|
+
*/
|
|
1248
|
+
async cn_base58_decode(base58) {
|
|
1249
|
+
const result = await this.execute('cn_base58_decode', base58);
|
|
1250
|
+
return Buffer.from(result, 'hex');
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Decodes a CryptoNote Base58 encoded string after verifying the checkvalue value included
|
|
1254
|
+
*
|
|
1255
|
+
* @param base58
|
|
1256
|
+
*/
|
|
1257
|
+
async cn_base58_decode_check(base58) {
|
|
1258
|
+
const result = await this.execute('cn_base58_decode_check', base58);
|
|
1259
|
+
return Buffer.from(result, 'hex');
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Generates a pedersen commitment for a transaction fee
|
|
1263
|
+
*
|
|
1264
|
+
* @param amount
|
|
1265
|
+
*/
|
|
1266
|
+
async generate_transaction_fee_commitment(amount) {
|
|
1267
|
+
return this.generate_pedersen_commitment(''.padEnd(64, '0'), amount);
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Checks if the value provided is a valid ED25519 scalar
|
|
1271
|
+
*
|
|
1272
|
+
* @param value
|
|
1273
|
+
*/
|
|
1274
|
+
async check_scalar(value) {
|
|
1275
|
+
try {
|
|
1276
|
+
await this.execute('check_scalar', value);
|
|
1277
|
+
return true;
|
|
1278
|
+
}
|
|
1279
|
+
catch (_a) {
|
|
1280
|
+
return false;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Checks if the value provided is a valid ED25519 point
|
|
1285
|
+
* @param value
|
|
1286
|
+
*/
|
|
1287
|
+
async check_point(value) {
|
|
1288
|
+
try {
|
|
1289
|
+
await this.execute('check_point', value);
|
|
1290
|
+
return true;
|
|
1291
|
+
}
|
|
1292
|
+
catch (_a) {
|
|
1293
|
+
return false;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Encodes the supplied seed into a list of mnemonic words
|
|
1298
|
+
*
|
|
1299
|
+
* @param entropy
|
|
1300
|
+
* @param language
|
|
1301
|
+
*/
|
|
1302
|
+
async mnemonics_encode(entropy, language = types_1.Language.ENGLISH) {
|
|
1303
|
+
const result = await this.execute('mnemonics_encode', { entropy, language });
|
|
1304
|
+
return result.split(' ');
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Decodes a mnemonic phrase or list of mnenomic words into as seed value
|
|
1308
|
+
*
|
|
1309
|
+
* @param mnemonic
|
|
1310
|
+
* @param language
|
|
1311
|
+
*/
|
|
1312
|
+
async mnemonics_decode(mnemonic, language = types_1.Language.ENGLISH) {
|
|
1313
|
+
if (Array.isArray(mnemonic)) {
|
|
1314
|
+
mnemonic = mnemonic.join(' ');
|
|
1315
|
+
}
|
|
1316
|
+
return this.execute('mnemonics_decode', {
|
|
1317
|
+
input: mnemonic,
|
|
1318
|
+
language
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Returns the index number of the specified mnemonic word
|
|
1323
|
+
*
|
|
1324
|
+
* @param word
|
|
1325
|
+
* @param language
|
|
1326
|
+
*/
|
|
1327
|
+
async mnemonics_word_index(word, language = types_1.Language.ENGLISH) {
|
|
1328
|
+
return this.execute('mnemonics_word_index', {
|
|
1329
|
+
input: word,
|
|
1330
|
+
language
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Returns the list of mnemonic words
|
|
1335
|
+
*
|
|
1336
|
+
* @param language
|
|
1337
|
+
*/
|
|
1338
|
+
async word_list(language = types_1.Language.ENGLISH) {
|
|
1339
|
+
const result = await this.execute('word_list', {
|
|
1340
|
+
language
|
|
1341
|
+
});
|
|
1342
|
+
return result.split(' ');
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Returns the list of mnemonic words that have been trimmed to
|
|
1346
|
+
* the minimum number of characters per word
|
|
1347
|
+
*
|
|
1348
|
+
* @param language
|
|
1349
|
+
*/
|
|
1350
|
+
async word_list_trimmed(language = types_1.Language.ENGLISH) {
|
|
1351
|
+
const result = await this.execute('word_list_trimmed', {
|
|
1352
|
+
language
|
|
1353
|
+
});
|
|
1354
|
+
return result.split(' ');
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Calculates the exponent of 2^e that matches the target value
|
|
1358
|
+
*
|
|
1359
|
+
* @param value
|
|
1360
|
+
*/
|
|
1361
|
+
async calculate_base2_exponent(value) {
|
|
1362
|
+
return this.execute('calculate_base2_exponent', value);
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Encrypts the provides string using the supplied password into a hexadecimal encoded string
|
|
1366
|
+
*
|
|
1367
|
+
* @param input
|
|
1368
|
+
* @param password
|
|
1369
|
+
* @param iterations
|
|
1370
|
+
*/
|
|
1371
|
+
async aes_encrypt(input, password, iterations) {
|
|
1372
|
+
if (typeof input !== 'string') {
|
|
1373
|
+
input = JSON.stringify(input);
|
|
1374
|
+
}
|
|
1375
|
+
const options = {
|
|
1376
|
+
input: input,
|
|
1377
|
+
password
|
|
1378
|
+
};
|
|
1379
|
+
if (iterations) {
|
|
1380
|
+
options.iterations = iterations;
|
|
1381
|
+
}
|
|
1382
|
+
return this.execute('aes_encrypt', options);
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Decrypts the data from the provided hexidecimal encoded encrypted string using the supplied password
|
|
1386
|
+
*
|
|
1387
|
+
* @param input
|
|
1388
|
+
* @param password
|
|
1389
|
+
* @param iterations
|
|
1390
|
+
*/
|
|
1391
|
+
async aes_decrypt(input, password, iterations) {
|
|
1392
|
+
const options = {
|
|
1393
|
+
input,
|
|
1394
|
+
password
|
|
1395
|
+
};
|
|
1396
|
+
if (iterations) {
|
|
1397
|
+
options.iterations = iterations;
|
|
1398
|
+
}
|
|
1399
|
+
return this.execute('aes_decrypt', options);
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Returns a list of the supported languages
|
|
1403
|
+
*/
|
|
1404
|
+
async languages() {
|
|
1405
|
+
return this.execute('languages');
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Generates a BIP-39 seed from the provided entropy
|
|
1409
|
+
*
|
|
1410
|
+
* @param entropy
|
|
1411
|
+
* @param passphrase
|
|
1412
|
+
*/
|
|
1413
|
+
async generate_seed(entropy, passphrase = '') {
|
|
1414
|
+
return this.execute('generate_seed', {
|
|
1415
|
+
entropy,
|
|
1416
|
+
passphrase
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Generates a Hierarchical Deterministic Key Pair using the provided path
|
|
1421
|
+
*
|
|
1422
|
+
* @param seed
|
|
1423
|
+
* @param purpose
|
|
1424
|
+
* @param coin_type
|
|
1425
|
+
* @param account
|
|
1426
|
+
* @param change
|
|
1427
|
+
* @param address_index
|
|
1428
|
+
* @param hmac_key
|
|
1429
|
+
*/
|
|
1430
|
+
async generate_child_key(seed, purpose, coin_type, account, change, address_index, hmac_key = 'ed25519 seed') {
|
|
1431
|
+
const input = {
|
|
1432
|
+
seed,
|
|
1433
|
+
hmac_key
|
|
1434
|
+
};
|
|
1435
|
+
if (typeof purpose !== 'undefined')
|
|
1436
|
+
input.purpose = purpose;
|
|
1437
|
+
if (typeof coin_type !== 'undefined')
|
|
1438
|
+
input.coin_type = coin_type;
|
|
1439
|
+
if (typeof account !== 'undefined')
|
|
1440
|
+
input.account = account;
|
|
1441
|
+
if (typeof change !== 'undefined')
|
|
1442
|
+
input.change = change;
|
|
1443
|
+
if (typeof address_index !== 'undefined')
|
|
1444
|
+
input.address_index = address_index;
|
|
1445
|
+
return this.execute('generate_child_key', input);
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Generates a hardened Hierarchical Deterministic Key path
|
|
1449
|
+
*
|
|
1450
|
+
* @param purpose
|
|
1451
|
+
* @param coin_type
|
|
1452
|
+
* @param account
|
|
1453
|
+
* @param change
|
|
1454
|
+
* @param address_index
|
|
1455
|
+
*/
|
|
1456
|
+
make_path(purpose, coin_type, account, change, address_index) {
|
|
1457
|
+
let output = 'm';
|
|
1458
|
+
if (typeof purpose !== 'undefined') {
|
|
1459
|
+
output += `/${purpose}'`;
|
|
1460
|
+
if (typeof coin_type !== 'undefined') {
|
|
1461
|
+
output += `/${coin_type}'`;
|
|
1462
|
+
if (typeof account !== 'undefined') {
|
|
1463
|
+
output += `/${account}'`;
|
|
1464
|
+
if (typeof change !== 'undefined') {
|
|
1465
|
+
output += `/${change}'`;
|
|
1466
|
+
if (typeof address_index !== 'undefined') {
|
|
1467
|
+
output += `/${address_index}'`;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return output;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Executes the method call using the underlying library
|
|
1477
|
+
*
|
|
1478
|
+
* @param method
|
|
1479
|
+
* @param argument
|
|
1480
|
+
* @private
|
|
1481
|
+
*/
|
|
1482
|
+
async execute(method, argument) {
|
|
1483
|
+
var _a;
|
|
1484
|
+
const method_call = (() => {
|
|
1485
|
+
if (typeof this.external_library[method] !== 'undefined') {
|
|
1486
|
+
return this.external_library[method];
|
|
1487
|
+
}
|
|
1488
|
+
if (!CryptoModule.runtime_configuration.library) {
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
if (typeof CryptoModule.runtime_configuration.library[method] !== 'undefined') {
|
|
1492
|
+
return CryptoModule.runtime_configuration.library[method];
|
|
1493
|
+
}
|
|
1494
|
+
return undefined;
|
|
1495
|
+
})();
|
|
1496
|
+
if (!method_call) {
|
|
1497
|
+
throw new Error(`0x01: Method Not Found. ${method}(${argument ? JSON.stringify(argument) : ''})`);
|
|
1498
|
+
}
|
|
1499
|
+
let result;
|
|
1500
|
+
if (argument) {
|
|
1501
|
+
result = await method_call(JSON.stringify(argument));
|
|
1502
|
+
}
|
|
1503
|
+
else {
|
|
1504
|
+
result = await method_call();
|
|
1505
|
+
}
|
|
1506
|
+
const json = JSON.parse(result);
|
|
1507
|
+
if (json.error) {
|
|
1508
|
+
throw new Error((_a = json.error_message) !== null && _a !== void 0 ? _a : `0x04: An unknown error occurred: ${method}(${argument ? JSON.stringify(argument) : ''})`);
|
|
1509
|
+
}
|
|
1510
|
+
return json.result;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
exports.CryptoModule = CryptoModule;
|
|
1514
|
+
CryptoModule._external_library = {};
|
|
1515
|
+
CryptoModule.runtime_configuration = {
|
|
1516
|
+
type: types_1.LibraryType.UNKNOWN
|
|
1517
|
+
};
|
|
1518
|
+
//# sourceMappingURL=index.js.map
|