utxo-lib 1.0.7 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,461 @@
1
+ "use strict";
2
+ /*! musig-js - MIT License (c) 2022 Brandon Black */
3
+ // https://github.com/ElementsProject/secp256k1-zkp/blob/master/doc/musig-spec.mediawiki
4
+ // Roughly based on the secp256k1-zkp implementation
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MuSigFactory = void 0;
7
+ const TAGS = {
8
+ challenge: 'BIP0340/challenge',
9
+ keyagg_list: 'KeyAgg list',
10
+ keyagg_coef: 'KeyAgg coefficient',
11
+ musig_aux: 'MuSig/aux',
12
+ musig_nonce: 'MuSig/nonce',
13
+ musig_deterministic_nonce: 'MuSig/deterministic/nonce',
14
+ musig_noncecoef: 'MuSig/noncecoef',
15
+ };
16
+ /**
17
+ * Compares two 32-byte Uint8Arrays in byte order.
18
+ * @returns < 0, 0, > 0 if a is < b, === b or > b respectively
19
+ */
20
+ function compare32b(a, b) {
21
+ if (a.length !== 32 || b.length !== 32)
22
+ throw new Error('Invalid array');
23
+ const aD = new DataView(a.buffer, a.byteOffset, a.length);
24
+ const bD = new DataView(b.buffer, b.byteOffset, b.length);
25
+ for (let i = 0; i < 8; i++) {
26
+ const cmp = aD.getUint32(i * 4) - bD.getUint32(i * 4);
27
+ if (cmp !== 0)
28
+ return cmp;
29
+ }
30
+ return 0;
31
+ }
32
+ /**
33
+ * Compares two 33-byte Uint8Arrays in byte order.
34
+ * @returns < 0, 0, > 0 if a is < b, === b or > b respectively
35
+ */
36
+ function compare33b(a, b) {
37
+ if (a.length !== 33 || b.length !== 33)
38
+ throw new Error('Invalid array');
39
+ const cmp = a[0] - b[0];
40
+ if (cmp !== 0)
41
+ return cmp;
42
+ return compare32b(a.subarray(1), b.subarray(1));
43
+ }
44
+ const makeSessionId = typeof self === 'object' && (self.crypto || self.msCrypto)
45
+ ? () => (self.crypto || self.msCrypto).getRandomValues(new Uint8Array(32)) // Browsers
46
+ : () => require('crypto').randomBytes(32); // Node
47
+ const _keyAggCache = new WeakMap();
48
+ // Caches coefficients associated with an array of public keys
49
+ const _coefCache = new WeakMap();
50
+ // Caches secret nonces. We do this internally to help users ensure that they
51
+ // do not reuse a secret nonce.
52
+ const _nonceCache = new WeakMap();
53
+ // Caches signing sessions. We do this internally to help users ensure that
54
+ // these session values were generated on the signer, and are not accepted from
55
+ // an untrusted third party.
56
+ const _sessionCache = new WeakMap();
57
+ function MuSigFactory(ecc) {
58
+ const CPOINT_INF = new Uint8Array(33);
59
+ const SCALAR_0 = new Uint8Array(32);
60
+ const SCALAR_1 = new Uint8Array(32);
61
+ SCALAR_1[31] = 1;
62
+ const SCALAR_MINUS_1 = ecc.scalarNegate(SCALAR_1);
63
+ function keyAggCoeff(publicKeys, publicKey) {
64
+ let coefCache = _coefCache.get(publicKeys);
65
+ if (coefCache === undefined) {
66
+ coefCache = new Map();
67
+ _coefCache.set(publicKeys, coefCache);
68
+ }
69
+ let coefficient = coefCache.get(publicKey);
70
+ if (coefficient)
71
+ return coefficient;
72
+ coefficient = SCALAR_1;
73
+ let secondPublicKey;
74
+ let publicKeyHash;
75
+ let keyAggCache = _keyAggCache.get(publicKeys);
76
+ if (keyAggCache === undefined) {
77
+ // Index of the first occurrence of the second unique public key.
78
+ const pkIdx2 = publicKeys.findIndex((pk) => compare33b(pk, publicKeys[0]) !== 0);
79
+ secondPublicKey = publicKeys[pkIdx2]; // undefined if pkIdx2 === -1
80
+ publicKeyHash = ecc.taggedHash(TAGS.keyagg_list, ...publicKeys);
81
+ keyAggCache = { publicKeyHash, secondPublicKey };
82
+ _keyAggCache.set(publicKeys, keyAggCache);
83
+ }
84
+ else {
85
+ ({ publicKeyHash, secondPublicKey } = keyAggCache);
86
+ }
87
+ if (secondPublicKey === undefined || compare33b(publicKey, secondPublicKey) !== 0)
88
+ coefficient = ecc.taggedHash(TAGS.keyagg_coef, publicKeyHash, publicKey);
89
+ coefCache.set(publicKey, coefficient);
90
+ return coefficient;
91
+ }
92
+ function addTweak(ctx, t) {
93
+ const tweak = 'tweak' in t ? t : { tweak: t };
94
+ if (!ecc.isScalar(tweak.tweak))
95
+ throw new TypeError('Expected tweak to be a valid scalar with curve order');
96
+ let { gacc, tacc } = ctx;
97
+ let aggPublicKey = ctx.aggPublicKey;
98
+ if (!ecc.hasEvenY(aggPublicKey) && tweak.xOnly) {
99
+ // g = -1
100
+ gacc = ecc.scalarNegate(gacc); // g * gacc mod n
101
+ tacc = ecc.scalarNegate(tacc); // g * tacc mod n
102
+ aggPublicKey = ecc.pointNegate(aggPublicKey); // g * Q
103
+ }
104
+ aggPublicKey = ecc.pointAddTweak(aggPublicKey, tweak.tweak, false); // g * Q + t * G
105
+ if (aggPublicKey === null)
106
+ throw new Error('Unexpected point at infinity during tweaking');
107
+ tacc = ecc.scalarAdd(tweak.tweak, tacc); // t + g * tacc mod n
108
+ return { aggPublicKey, gacc, tacc };
109
+ }
110
+ function keyAgg(publicKeys, ...tweaks) {
111
+ checkArgs({ publicKeys });
112
+ const multipliedPublicKeys = publicKeys.map((publicKey) => {
113
+ const coefficient = keyAggCoeff(publicKeys, publicKey);
114
+ let multipliedPublicKey;
115
+ if (compare32b(coefficient, SCALAR_1) === 0) {
116
+ multipliedPublicKey = publicKey;
117
+ }
118
+ else {
119
+ multipliedPublicKey = ecc.pointMultiplyUnsafe(publicKey, coefficient, false);
120
+ }
121
+ if (multipliedPublicKey === null)
122
+ throw new Error('Point at infinity during aggregation');
123
+ return multipliedPublicKey;
124
+ });
125
+ const aggPublicKey = multipliedPublicKeys.reduce((a, b) => {
126
+ const next = ecc.pointAdd(a, b, false);
127
+ if (next === null)
128
+ throw new Error('Point at infinity during aggregation');
129
+ return next;
130
+ });
131
+ return tweaks.reduce((ctx, tweak) => addTweak(ctx, tweak), {
132
+ aggPublicKey,
133
+ gacc: SCALAR_1,
134
+ tacc: SCALAR_0,
135
+ });
136
+ }
137
+ function getSessionValues(sessionKey) {
138
+ const sessionValues = _sessionCache.get(sessionKey);
139
+ if (!sessionValues)
140
+ throw new Error('Invalid session key, please call `startSigningSession`');
141
+ return sessionValues;
142
+ }
143
+ function nonceAgg(publicNonces) {
144
+ checkArgs({ publicNonces });
145
+ const aggNonces = [
146
+ publicNonces[0].subarray(0, 33),
147
+ publicNonces[0].subarray(33),
148
+ ];
149
+ for (let i = 1; i < publicNonces.length; i++) {
150
+ if (aggNonces[0] !== null)
151
+ aggNonces[0] = ecc.pointAdd(aggNonces[0], publicNonces[i].subarray(0, 33), false);
152
+ if (aggNonces[1] !== null)
153
+ aggNonces[1] = ecc.pointAdd(aggNonces[1], publicNonces[i].subarray(33), false);
154
+ }
155
+ const aggNonce = new Uint8Array(66);
156
+ if (aggNonces[0] !== null)
157
+ aggNonce.set(ecc.pointCompress(aggNonces[0]), 0);
158
+ if (aggNonces[1] !== null)
159
+ aggNonce.set(ecc.pointCompress(aggNonces[1]), 33);
160
+ return aggNonce;
161
+ }
162
+ function startSigningSessionInner(aggNonce, msg, publicKeys, ctx) {
163
+ const pubKeyX = ecc.pointX(ctx.aggPublicKey);
164
+ const coefficient = ecc.taggedHash(TAGS.musig_noncecoef, aggNonce, pubKeyX, msg);
165
+ const aggNonces = [aggNonce.subarray(0, 33), aggNonce.subarray(33)];
166
+ // This is kinda ugly, but crypto.pointAdd doesn't work on 0-coded infinity
167
+ let r = null;
168
+ if (compare33b(aggNonces[1], CPOINT_INF) !== 0 && compare33b(aggNonces[0], CPOINT_INF) !== 0) {
169
+ r = ecc.pointMultiplyAndAddUnsafe(aggNonces[1], coefficient, aggNonces[0], false);
170
+ }
171
+ else if (compare33b(aggNonces[0], CPOINT_INF) !== 0) {
172
+ r = ecc.pointCompress(aggNonces[0], false);
173
+ }
174
+ else if (compare33b(aggNonces[1], CPOINT_INF) !== 0) {
175
+ r = ecc.pointMultiplyUnsafe(aggNonces[1], coefficient, false);
176
+ }
177
+ if (r === null)
178
+ r = ecc.getPublicKey(SCALAR_1, false);
179
+ if (r === null)
180
+ throw new Error('Failed to get G');
181
+ const challenge = ecc.scalarMod(ecc.taggedHash(TAGS.challenge, ecc.pointX(r), pubKeyX, msg));
182
+ const key = { publicKey: ctx.aggPublicKey, aggNonce, msg };
183
+ _sessionCache.set(key, { ...ctx, coefficient, challenge, finalNonce: r, publicKeys });
184
+ return key;
185
+ }
186
+ function partialVerifyInner({ sig, publicKey, publicNonces, sessionKey, }) {
187
+ const { msg } = sessionKey;
188
+ const { aggPublicKey, gacc, challenge, coefficient, finalNonce, publicKeys } = getSessionValues(sessionKey);
189
+ const rePrime = ecc.pointMultiplyAndAddUnsafe(publicNonces[1], coefficient, publicNonces[0], false);
190
+ if (rePrime === null)
191
+ throw new Error('Unexpected public nonce at infinity');
192
+ const re = ecc.hasEvenY(finalNonce) ? rePrime : ecc.pointNegate(rePrime);
193
+ const a = keyAggCoeff(publicKeys, publicKey);
194
+ const g = ecc.hasEvenY(aggPublicKey) ? gacc : ecc.scalarNegate(gacc);
195
+ const ea = ecc.scalarMultiply(challenge, a);
196
+ const eag = ecc.scalarMultiply(ea, g);
197
+ const ver = ecc.pointMultiplyAndAddUnsafe(publicKey, eag, re, true);
198
+ if (ver === null)
199
+ throw new Error('Unexpected verification point at infinity');
200
+ const sG = ecc.getPublicKey(sig, true);
201
+ if (sG === null)
202
+ throw new Error('Unexpected signature point at infinity');
203
+ return compare33b(ver, sG) === 0;
204
+ }
205
+ function partialSignInner({ secretKey, publicKey, secretNonces, sessionKey, }) {
206
+ const { msg } = sessionKey;
207
+ const { aggPublicKey, gacc, challenge, coefficient, finalNonce, publicKeys } = getSessionValues(sessionKey);
208
+ const [k1, k2] = secretNonces.map((k) => (ecc.hasEvenY(finalNonce) ? k : ecc.scalarNegate(k)));
209
+ const a = keyAggCoeff(publicKeys, publicKey);
210
+ const g = ecc.hasEvenY(aggPublicKey) ? gacc : ecc.scalarNegate(gacc);
211
+ const d = ecc.scalarMultiply(g, secretKey);
212
+ const bk2 = ecc.scalarMultiply(coefficient, k2);
213
+ const k1bk2 = ecc.scalarAdd(k1, bk2);
214
+ const ea = ecc.scalarMultiply(challenge, a);
215
+ const ead = ecc.scalarMultiply(ea, d);
216
+ const sig = ecc.scalarAdd(k1bk2, ead);
217
+ return sig;
218
+ }
219
+ function partialSign({ secretKey, publicNonce, sessionKey, verify = true, }) {
220
+ checkArgs({ publicNonce, secretKey });
221
+ const secretNonce = _nonceCache.get(publicNonce);
222
+ if (secretNonce === undefined)
223
+ throw new Error('No secret nonce found for specified public nonce');
224
+ _nonceCache.delete(publicNonce);
225
+ const publicKey = ecc.getPublicKey(secretKey, true);
226
+ if (publicKey === null)
227
+ throw new Error('Invalid secret key, no corresponding public key');
228
+ if (compare33b(publicKey, secretNonce.subarray(64)) !== 0)
229
+ throw new Error('Secret nonce pubkey mismatch');
230
+ const secretNonces = [
231
+ secretNonce.subarray(0, 32),
232
+ secretNonce.subarray(32, 64),
233
+ ];
234
+ const sig = partialSignInner({
235
+ secretKey,
236
+ publicKey,
237
+ secretNonces,
238
+ sessionKey,
239
+ });
240
+ if (verify) {
241
+ const publicNonces = [
242
+ publicNonce.subarray(0, 33),
243
+ publicNonce.subarray(33),
244
+ ];
245
+ const valid = partialVerifyInner({
246
+ sig,
247
+ publicKey,
248
+ publicNonces,
249
+ sessionKey,
250
+ });
251
+ if (!valid)
252
+ throw new Error('Partial signature failed verification');
253
+ }
254
+ return sig;
255
+ }
256
+ function deterministicSign({ secretKey, aggOtherNonce, publicKeys, tweaks = [], msg, rand, verify = true, nonceOnly = false, }) {
257
+ // No need to check msg, its max size is larger than JS typed array limit
258
+ checkArgs({ rand, secretKey, aggOtherNonce });
259
+ const publicKey = ecc.getPublicKey(secretKey, true);
260
+ if (publicKey === null)
261
+ throw new Error('Secret key has no corresponding public key');
262
+ let secretKeyPrime;
263
+ if (rand !== undefined) {
264
+ secretKeyPrime = ecc.taggedHash(TAGS.musig_aux, rand);
265
+ for (let i = 0; i < 32; i++) {
266
+ secretKeyPrime[i] = secretKeyPrime[i] ^ secretKey[i];
267
+ }
268
+ }
269
+ else {
270
+ secretKeyPrime = secretKey;
271
+ }
272
+ const ctx = keyAgg(publicKeys, ...tweaks);
273
+ const aggPublicKey = ecc.pointX(ctx.aggPublicKey);
274
+ const mLength = new Uint8Array(8);
275
+ new DataView(mLength.buffer).setBigUint64(0, BigInt(msg.length));
276
+ const secretNonce = new Uint8Array(97);
277
+ const publicNonce = new Uint8Array(66);
278
+ for (let i = 0; i < 2; i++) {
279
+ const kH = ecc.taggedHash(TAGS.musig_deterministic_nonce, ...[secretKeyPrime, aggOtherNonce, aggPublicKey, mLength, msg, Uint8Array.of(i)]);
280
+ const k = ecc.scalarMod(kH);
281
+ if (compare32b(SCALAR_0, k) === 0)
282
+ throw new Error('0 secret nonce');
283
+ const pub = ecc.getPublicKey(k, true);
284
+ if (pub === null)
285
+ throw new Error('Secret nonce has no corresponding public nonce');
286
+ secretNonce.set(k, i * 32);
287
+ publicNonce.set(pub, i * 33);
288
+ }
289
+ secretNonce.set(publicKey, 64);
290
+ if (nonceOnly)
291
+ return { publicNonce };
292
+ _nonceCache.set(publicNonce, secretNonce);
293
+ const aggNonce = nonceAgg([aggOtherNonce, publicNonce]);
294
+ const sessionKey = startSigningSessionInner(aggNonce, msg, publicKeys, ctx);
295
+ const sig = partialSign({
296
+ secretKey,
297
+ publicNonce,
298
+ sessionKey,
299
+ verify,
300
+ });
301
+ return { sig, sessionKey, publicNonce };
302
+ }
303
+ // TODO: Improve arg checking now that we have startSigningSession
304
+ const pubKeyArgs = ['publicKey', 'publicKeys'];
305
+ const scalarArgs = ['tweak', 'sig', 'sigs', 'tacc', 'gacc'];
306
+ const otherArgs32b = ['xOnlyPublicKey', 'rand', 'sessionId'];
307
+ const args32b = ['secretKey', ...scalarArgs, ...otherArgs32b];
308
+ const pubNonceArgs = [
309
+ 'publicNonce',
310
+ 'publicNonces',
311
+ 'aggNonce',
312
+ 'aggOtherNonce',
313
+ 'finalNonce',
314
+ ];
315
+ const otherArgs = ['aggPublicKey', 'secretNonce'];
316
+ const argLengths = new Map();
317
+ args32b.forEach((a) => argLengths.set(a, 32));
318
+ pubKeyArgs.forEach((a) => argLengths.set(a, 33));
319
+ pubNonceArgs.forEach((a) => argLengths.set(a, 66));
320
+ argLengths.set('secretNonce', 97);
321
+ argLengths.set('aggPublicKey', 65);
322
+ const scalarNames = new Set();
323
+ scalarArgs.forEach((n) => scalarNames.add(n));
324
+ function checkArgs(args) {
325
+ for (let [name, values] of Object.entries(args)) {
326
+ if (values === undefined)
327
+ continue;
328
+ values = Array.isArray(values) ? values : [values];
329
+ if (values.length === 0)
330
+ throw new TypeError(`0-length ${name}s not supported`);
331
+ for (const value of values) {
332
+ if (argLengths.get(name) !== value.length)
333
+ throw new TypeError(`Invalid ${name} length (${value.length})`);
334
+ if (name === 'secretKey') {
335
+ if (!ecc.isSecret(value))
336
+ throw new TypeError(`Invalid secretKey`);
337
+ }
338
+ else if (name === 'secretNonce') {
339
+ for (let i = 0; i < 64; i += 32)
340
+ if (!ecc.isSecret(value.subarray(i, i + 32)))
341
+ throw new TypeError(`Invalid secretNonce`);
342
+ }
343
+ else if (scalarNames.has(name)) {
344
+ for (let i = 0; i < value.length; i += 32)
345
+ if (!ecc.isScalar(value.subarray(i, i + 32)))
346
+ throw new TypeError(`Invalid ${name}`);
347
+ }
348
+ // No need for a public key x-to-curve check. They're liftX'd for use any way.
349
+ }
350
+ }
351
+ }
352
+ return {
353
+ getXOnlyPubkey: (ctx) => {
354
+ if ('aggPublicKey' in ctx)
355
+ return ecc.pointX(ctx.aggPublicKey);
356
+ return ecc.pointX(getSessionValues(ctx).aggPublicKey);
357
+ },
358
+ getPlainPubkey: (ctx) => {
359
+ if ('aggPublicKey' in ctx)
360
+ return ecc.pointCompress(ctx.aggPublicKey);
361
+ return ecc.pointCompress(getSessionValues(ctx).aggPublicKey);
362
+ },
363
+ keySort: (publicKeys) => {
364
+ checkArgs({ publicKeys });
365
+ // do not modify the original array
366
+ return [...publicKeys].sort((a, b) => compare33b(a, b));
367
+ },
368
+ keyAgg,
369
+ addTweaks: (ctx, ...tweaks) => {
370
+ checkArgs(ctx);
371
+ return tweaks.reduce((c, tweak) => addTweak(c, tweak), ctx);
372
+ },
373
+ nonceGen: ({ sessionId = makeSessionId(), secretKey, publicKey, xOnlyPublicKey, msg, extraInput, }) => {
374
+ if (extraInput !== undefined && extraInput.length > Math.pow(2, 32) - 1)
375
+ throw new TypeError('extraInput is limited to 2^32-1 bytes');
376
+ // No need to check msg, its max size is larger than JS typed array limit
377
+ checkArgs({ sessionId, secretKey, publicKey, xOnlyPublicKey });
378
+ let rand;
379
+ if (secretKey !== undefined) {
380
+ rand = ecc.taggedHash(TAGS.musig_aux, sessionId);
381
+ for (let i = 0; i < 32; i++) {
382
+ rand[i] = rand[i] ^ secretKey[i];
383
+ }
384
+ }
385
+ else {
386
+ rand = sessionId;
387
+ }
388
+ if (xOnlyPublicKey === undefined)
389
+ xOnlyPublicKey = new Uint8Array();
390
+ const mPrefixed = [Uint8Array.of(0)];
391
+ if (msg !== undefined) {
392
+ mPrefixed[0][0] = 1;
393
+ mPrefixed.push(new Uint8Array(8));
394
+ new DataView(mPrefixed[1].buffer).setBigUint64(0, BigInt(msg.length));
395
+ mPrefixed.push(msg);
396
+ }
397
+ if (extraInput === undefined)
398
+ extraInput = new Uint8Array();
399
+ const eLength = new Uint8Array(4);
400
+ new DataView(eLength.buffer).setUint32(0, extraInput.length);
401
+ const secretNonce = new Uint8Array(97);
402
+ const publicNonce = new Uint8Array(66);
403
+ for (let i = 0; i < 2; i++) {
404
+ const kH = ecc.taggedHash(TAGS.musig_nonce, rand, Uint8Array.of(publicKey.length), publicKey, Uint8Array.of(xOnlyPublicKey.length), xOnlyPublicKey, ...mPrefixed, eLength, extraInput, Uint8Array.of(i));
405
+ const k = ecc.scalarMod(kH);
406
+ if (compare32b(SCALAR_0, k) === 0)
407
+ throw new Error('0 secret nonce');
408
+ const pub = ecc.getPublicKey(k, true);
409
+ if (pub === null)
410
+ throw new Error('Secret nonce has no corresponding public nonce');
411
+ secretNonce.set(k, i * 32);
412
+ publicNonce.set(pub, i * 33);
413
+ }
414
+ secretNonce.set(publicKey, 64);
415
+ _nonceCache.set(publicNonce, secretNonce);
416
+ return publicNonce;
417
+ },
418
+ addExternalNonce: (publicNonce, secretNonce) => {
419
+ checkArgs({ publicNonce, secretNonce });
420
+ _nonceCache.set(publicNonce, secretNonce);
421
+ },
422
+ deterministicNonceGen: (args) => deterministicSign({ ...args, nonceOnly: true }),
423
+ deterministicSign,
424
+ nonceAgg,
425
+ startSigningSession: (aggNonce, msg, publicKeys, ...tweaks) => {
426
+ checkArgs({ aggNonce });
427
+ const ctx = keyAgg(publicKeys, ...tweaks);
428
+ return startSigningSessionInner(aggNonce, msg, publicKeys, ctx);
429
+ },
430
+ partialSign,
431
+ partialVerify: ({ sig, publicKey, publicNonce, sessionKey, }) => {
432
+ checkArgs({ sig, publicKey, publicNonce });
433
+ const publicNonces = [
434
+ publicNonce.subarray(0, 33),
435
+ publicNonce.subarray(33),
436
+ ];
437
+ const valid = partialVerifyInner({
438
+ sig,
439
+ publicKey,
440
+ publicNonces,
441
+ sessionKey,
442
+ });
443
+ return valid;
444
+ },
445
+ signAgg: (sigs, sessionKey) => {
446
+ checkArgs({ sigs });
447
+ const { aggPublicKey, tacc, challenge, finalNonce } = getSessionValues(sessionKey);
448
+ let sPart = ecc.scalarMultiply(challenge, tacc);
449
+ if (!ecc.hasEvenY(aggPublicKey)) {
450
+ sPart = ecc.scalarNegate(sPart);
451
+ }
452
+ const aggS = sigs.reduce((a, b) => ecc.scalarAdd(a, b), sPart);
453
+ const sig = new Uint8Array(64);
454
+ sig.set(ecc.pointX(finalNonce), 0);
455
+ sig.set(aggS, 32);
456
+ return sig;
457
+ },
458
+ };
459
+ }
460
+ exports.MuSigFactory = MuSigFactory;
461
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVzaWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI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ICAgfSxcbiAgfTtcbn1cbiJdfQ==
@@ -1,6 +1,6 @@
1
1
  import { ECPairAPI, ECPairInterface } from 'ecpair';
2
2
  import { BIP32API, BIP32Interface } from 'bip32';
3
- import { MuSig } from '@brandonblack/musig/lib';
3
+ import { MuSig } from './musig';
4
4
  declare const ecc: {
5
5
  isPoint: (p: Uint8Array) => boolean;
6
6
  isPrivate: (d: Uint8Array) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"noble_ecc.d.ts","sourceRoot":"","sources":["../../src/noble_ecc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAiB,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAgB,cAAc,EAAE,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,KAAK,EAAgB,MAAM,yBAAyB,CAAC;AAqC9D,QAAA,MAAM,GAAG;iBACM,UAAU,KAAG,OAAO;mBAClB,UAAU,KAAG,OAAO;sBACjB,UAAU,KAAG,OAAO;4BAEd,UAAU,SAAS,UAAU,KAAG;QAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,WAAW,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI;0BAOnF,UAAU,uCAAyB,UAAU,GAAG,IAAI;uBAGvD,UAAU,uCAAyB,UAAU;uBAI7C,UAAU,SAAS,UAAU,uCAAyB,UAAU,GAAG,IAAI;kBAG5E,UAAU,KAAK,UAAU,uCAAyB,UAAU,GAAG,IAAI;wBAO7D,UAAU,SAAS,UAAU,uCAAyB,UAAU,GAAG,IAAI;oBAG3E,UAAU,SAAS,UAAU,KAAG,UAAU,GAAG,IAAI;uBAS9C,UAAU,KAAG,UAAU;cAEhC,UAAU,KAAK,UAAU,iCAAmB,UAAU;qBAI/C,UAAU,KAAK,UAAU,MAAK,UAAU,KAA4B,UAAU;gBAInF,UAAU,KAAK,UAAU,aAAa,UAAU,mCAAqB,OAAO;uBAIrE,UAAU,KAAK,UAAU,aAAa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