@dynamic-labs-wallet/browser-wallet-client 0.0.84 → 0.0.85

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/index.cjs.js CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  var messageTransport = require('@dynamic-labs/message-transport');
4
4
  var logger$1 = require('@dynamic-labs/logger');
5
- var core$1 = require('@dynamic-labs-wallet/core');
6
- var core = require('./internal/core');
5
+ var core = require('@dynamic-labs-wallet/core');
7
6
 
8
7
  const setupMessageTransportBridge = (messageTransport$1, iframe, iframeOrigin)=>{
9
8
  if (!(iframe == null ? void 0 : iframe.contentWindow)) {
@@ -309,7 +308,7 @@ class DynamicWalletClient {
309
308
  chainName: this.chainName
310
309
  });
311
310
  }
312
- async getWallet({ accountAddress, walletOperation = core$1.WalletOperation.NO_OPERATION, signedSessionId }) {
311
+ async getWallet({ accountAddress, walletOperation = core.WalletOperation.NO_OPERATION, signedSessionId }) {
313
312
  await this.initializeMessageTransport();
314
313
  if (!this.iframeMessageHandler) {
315
314
  throw new Error('Iframe message handler not initialized');
@@ -333,7 +332,7 @@ class DynamicWalletClient {
333
332
  signedSessionId
334
333
  });
335
334
  }
336
- async requiresPasswordForOperation({ accountAddress, walletOperation = core$1.WalletOperation.REACH_THRESHOLD }) {
335
+ async requiresPasswordForOperation({ accountAddress, walletOperation = core.WalletOperation.REACH_THRESHOLD }) {
337
336
  await this.initializeMessageTransport();
338
337
  if (!this.iframeMessageHandler) {
339
338
  throw new Error('Iframe message handler not initialized');
@@ -469,7 +468,7 @@ class DynamicWalletClient {
469
468
  signedSessionId
470
469
  });
471
470
  }
472
- async verifyPassword({ accountAddress, password, walletOperation = core$1.WalletOperation.NO_OPERATION, signedSessionId }) {
471
+ async verifyPassword({ accountAddress, password, walletOperation = core.WalletOperation.NO_OPERATION, signedSessionId }) {
473
472
  await this.initializeMessageTransport();
474
473
  if (!this.iframeMessageHandler) {
475
474
  throw new Error('Iframe message handler not initialized');
@@ -518,7 +517,9 @@ class DynamicWalletClient {
518
517
  signedSessionId
519
518
  });
520
519
  }
521
- async offlineExportPrivateKey({ keyShares, derivationPath }) {
520
+ /**
521
+ * keyShares is stringified list of EcdsaKeygenResult[] and Ed25519KeygenResult[]
522
+ */ async offlineExportPrivateKey({ keyShares, derivationPath }) {
522
523
  await this.initializeMessageTransport();
523
524
  if (!this.iframeMessageHandler) {
524
525
  throw new Error('Iframe message handler not initialized');
@@ -564,8 +565,8 @@ class DynamicWalletClient {
564
565
  this.baseApiUrl = baseApiUrl;
565
566
  this.baseMPCRelayApiUrl = baseMPCRelayApiUrl;
566
567
  this.chainName = chainName;
567
- const environment = core$1.getEnvironmentFromUrl(baseApiUrl);
568
- this.iframeDomain = core$1.IFRAME_DOMAIN_MAP[environment];
568
+ const environment = core.getEnvironmentFromUrl(baseApiUrl);
569
+ this.iframeDomain = core.IFRAME_DOMAIN_MAP[environment];
569
570
  // Generate unique instanceId when client is created
570
571
  this.instanceId = crypto.randomUUID();
571
572
  this.debug = Boolean(debug);
@@ -580,34 +581,18 @@ DynamicWalletClient.iframeInstanceCount = 0;
580
581
 
581
582
  Object.defineProperty(exports, "MPC_RELAY_PREPROD_API_URL", {
582
583
  enumerable: true,
583
- get: function () { return core$1.MPC_RELAY_PREPROD_API_URL; }
584
+ get: function () { return core.MPC_RELAY_PREPROD_API_URL; }
584
585
  });
585
586
  Object.defineProperty(exports, "MPC_RELAY_PROD_API_URL", {
586
587
  enumerable: true,
587
- get: function () { return core$1.MPC_RELAY_PROD_API_URL; }
588
+ get: function () { return core.MPC_RELAY_PROD_API_URL; }
588
589
  });
589
590
  Object.defineProperty(exports, "ThresholdSignatureScheme", {
590
591
  enumerable: true,
591
- get: function () { return core$1.ThresholdSignatureScheme; }
592
+ get: function () { return core.ThresholdSignatureScheme; }
592
593
  });
593
594
  Object.defineProperty(exports, "WalletOperation", {
594
595
  enumerable: true,
595
- get: function () { return core$1.WalletOperation; }
596
- });
597
- Object.defineProperty(exports, "BIP340KeygenResult", {
598
- enumerable: true,
599
- get: function () { return core.BIP340KeygenResult; }
600
- });
601
- Object.defineProperty(exports, "EcdsaKeygenResult", {
602
- enumerable: true,
603
- get: function () { return core.EcdsaKeygenResult; }
604
- });
605
- Object.defineProperty(exports, "EcdsaSignature", {
606
- enumerable: true,
607
- get: function () { return core.EcdsaSignature; }
608
- });
609
- Object.defineProperty(exports, "Ed25519KeygenResult", {
610
- enumerable: true,
611
- get: function () { return core.Ed25519KeygenResult; }
596
+ get: function () { return core.WalletOperation; }
612
597
  });
613
598
  exports.DynamicWalletClient = DynamicWalletClient;
package/index.esm.js CHANGED
@@ -2,7 +2,6 @@ import { parseMessageTransportData, createRequestChannel, applyDefaultMessageOri
2
2
  import { Logger } from '@dynamic-labs/logger';
3
3
  import { WalletOperation, getEnvironmentFromUrl, IFRAME_DOMAIN_MAP } from '@dynamic-labs-wallet/core';
4
4
  export { MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, ThresholdSignatureScheme, WalletOperation } from '@dynamic-labs-wallet/core';
5
- export { BIP340KeygenResult, EcdsaKeygenResult, EcdsaSignature, Ed25519KeygenResult } from './internal/core';
6
5
 
7
6
  const setupMessageTransportBridge = (messageTransport, iframe, iframeOrigin)=>{
8
7
  if (!(iframe == null ? void 0 : iframe.contentWindow)) {
@@ -517,7 +516,9 @@ class DynamicWalletClient {
517
516
  signedSessionId
518
517
  });
519
518
  }
520
- async offlineExportPrivateKey({ keyShares, derivationPath }) {
519
+ /**
520
+ * keyShares is stringified list of EcdsaKeygenResult[] and Ed25519KeygenResult[]
521
+ */ async offlineExportPrivateKey({ keyShares, derivationPath }) {
521
522
  await this.initializeMessageTransport();
522
523
  if (!this.iframeMessageHandler) {
523
524
  throw new Error('Iframe message handler not initialized');
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/browser-wallet-client",
3
- "version": "0.0.84",
3
+ "version": "0.0.85",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@dynamic-labs-wallet/core": "0.0.84",
6
+ "@dynamic-labs-wallet/core": "0.0.85",
7
7
  "@dynamic-labs/message-transport": "^4.9.9",
8
- "@dynamic-labs/logger": "^4.9.9",
9
- "@noble/hashes": "1.7.1"
8
+ "@dynamic-labs/logger": "^4.9.9"
10
9
  },
11
10
  "nx": {
12
11
  "sourceRoot": "packages/browser-wallet-client/src",
@@ -2,7 +2,6 @@ import { type MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-tr
2
2
  import { iframeMessageHandler } from '../services/iframeMessageHandler';
3
3
  import type { GetWalletResponse, CreateWalletAccountResponse, RequiresPasswordForOperationRequest, SignMessageRequest, IsPasswordEncryptedRequest, BackupKeySharesToGoogleDriveRequest, VerifyPasswordRequest, UpdatePasswordRequest, ImportPrivateKeyRequest, ExportClientKeysharesRequest, OfflineExportPrivateKeyResponse, SignRawMessageRequest, CreateWalletAccountRequest, SignTransactionRequest, RefreshWalletAccountSharesRequest, ReshareRequest } from '@dynamic-labs-wallet/core';
4
4
  import { WalletOperation } from '@dynamic-labs-wallet/core';
5
- import type { EcdsaKeygenResult, Ed25519KeygenResult } from '../../../internal/core';
6
5
  export declare class DynamicWalletClient {
7
6
  protected chainName: string;
8
7
  protected logger: import("@dynamic-labs/logger").Logger;
@@ -111,8 +110,11 @@ export declare class DynamicWalletClient {
111
110
  updatePassword({ accountAddress, existingPassword, newPassword, signedSessionId, }: Omit<UpdatePasswordRequest, 'chainName'>): Promise<void>;
112
111
  importPrivateKey({ privateKey, thresholdSignatureScheme, }: Omit<ImportPrivateKeyRequest, 'chainName'>): Promise<CreateWalletAccountResponse>;
113
112
  exportClientKeyshares({ accountAddress, password, signedSessionId, }: Omit<ExportClientKeysharesRequest, 'chainName'>): Promise<void>;
113
+ /**
114
+ * keyShares is stringified list of EcdsaKeygenResult[] and Ed25519KeygenResult[]
115
+ */
114
116
  offlineExportPrivateKey({ keyShares, derivationPath, }: {
115
- keyShares: (EcdsaKeygenResult | Ed25519KeygenResult)[];
117
+ keyShares: string[];
116
118
  derivationPath?: string;
117
119
  }): Promise<OfflineExportPrivateKeyResponse>;
118
120
  cleanup(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,mCAAmC,EACnC,kBAAkB,EAClB,0BAA0B,EAC1B,mCAAmC,EACnC,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,4BAA4B,EAC5B,+BAA+B,EAC/B,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,iCAAiC,EACjC,cAAc,EACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE7E,qBAAa,mBAAmB;IAC9B,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,MAAM,wCAAU;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IACnC,aAAa,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,gBAAgB,EAAE,iCAAiC,GAAG,IAAI,CAAQ;IAC5E,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IACnE,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA8B;IAC9D,SAAS,CA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EACd,gBAAgB,EAChB,QAAQ,EACR,eAAe,GAChB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,WAAW,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBX,cAAc,CAAC,EACnB,cAAc,EACd,QAAQ,EACR,eAA8C,EAC9C,eAAe,GAChB,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAerD,cAAc,CAAC,EACnB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,GAChB,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAerD,gBAAgB,CAAC,EACrB,UAAU,EACV,wBAAwB,GACzB,EAAE,IAAI,CACL,uBAAuB,EACvB,WAAW,CACZ,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAalC,qBAAqB,CAAC,EAC1B,cAAc,EACd,QAAQ,EACR,eAAe,GAChB,EAAE,IAAI,CAAC,4BAA4B,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAclE;;OAEG;IACG,uBAAuB,CAAC,EAC5B,SAAS,EACT,cAAc,GACf,EAAE;QACD,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAqB/B,OAAO;CAqBrB"}
package/src/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './client';
2
- export { EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, EcdsaSignature, } from '../../internal/core';
3
2
  export { ThresholdSignatureScheme, WalletOperation, MPC_RELAY_PROD_API_URL, MPC_RELAY_PREPROD_API_URL, } from '@dynamic-labs-wallet/core';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC"}
@@ -1,22 +0,0 @@
1
- import { BIP340InitKeygenResult, BIP340KeygenResult, DynamicNativeSdkInterface } from '.';
2
- export declare class BIP340 {
3
- protected readonly NATIVE: Promise<DynamicNativeSdkInterface>;
4
- protected readonly URL: string;
5
- protected constructor(native: Promise<DynamicNativeSdkInterface>, url: string);
6
- initKeygen(): Promise<BIP340InitKeygenResult>;
7
- exportID(keygenResult: BIP340KeygenResult | string): Promise<string>;
8
- createRoom(numParties: number, apiKey: string): Promise<string>;
9
- keygen(roomUuid: string, numParties: number, threshold: number, keygenInit: BIP340InitKeygenResult, keygenIds: string[]): Promise<BIP340KeygenResult>;
10
- sign(roomUuid: string, keygenResult: BIP340KeygenResult | string, msg: Uint8Array | string, derivationPath?: Uint32Array, tweak?: Uint8Array | string): Promise<Uint8Array>;
11
- refresh(roomUuid: string, keygenResult: BIP340KeygenResult | string): Promise<BIP340KeygenResult>;
12
- reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: BIP340InitKeygenResult, keygenIds: string[]): Promise<BIP340KeygenResult>;
13
- reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: BIP340KeygenResult | string, keygenIds: string[]): Promise<BIP340KeygenResult>;
14
- deriveTweakPubkey(keygenResult: BIP340KeygenResult | string, derivationPath?: Uint32Array, tweak?: Uint8Array | string): Promise<Uint8Array>;
15
- getXpub(keygenResult: BIP340KeygenResult | string): Promise<string>;
16
- deriveTweakPubkeyFromXpub(Xpub: string, derivationPath?: Uint32Array, tweak?: Uint8Array | string): Promise<Uint8Array>;
17
- exportFullPrivateKey(roomUuid: string, keygenResult: BIP340KeygenResult | string, toExportID: string): Promise<string | undefined>;
18
- derivePrivateKeyFromXpriv(xpriv: string, derivationPath?: Uint32Array): Promise<string>;
19
- offlineExportFullPrivateKey(keygenResults: BIP340KeygenResult[] | string[]): Promise<string>;
20
- importPrivateKeyRecipient(roomUuid: string, threshold: number, keygenInit: BIP340InitKeygenResult, keygenIds: string[]): Promise<BIP340KeygenResult>;
21
- importPrivateKeyImporter(roomUuid: string, threshold: number, privateKey: string, keygenInit: BIP340InitKeygenResult, keygenIds: string[]): Promise<BIP340KeygenResult>;
22
- }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.BIP340=void 0;let _1=require("."),utils_1=require("@noble/hashes/utils"),common_1=require("./common");function getTweak(e){if(0!==(e="string"!=typeof e?(0,utils_1.bytesToHex)(e):e).length&&64!==e.length)throw new Error("Tweak must be 32 bytes long");return e}class BIP340{constructor(e,t){this.NATIVE=e,this.URL=t}async initKeygen(){var e=await(await this.NATIVE).initKeygen();return new _1.BIP340InitKeygenResult(e.pubkey,e.keypair)}async exportID(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).bip340GetExportID(e)}async createRoom(e,t){return(0,common_1.sanitizeNumberOfParties)(e),(await this.NATIVE).createRoom(this.URL,e,t)}async keygen(e,t,r,i,a){if((0,common_1.sanitizeNumberOfParties)(t,r),a.length!==t-1)throw new Error(`keygenIds length must be exactly: ${t-1}, it is: `+a.length);e=await(await this.NATIVE).bip340Keygen(e,this.URL,t,r,i.keygenSecret,a);if(e.pubkey&&e.secret_share)return t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share,new _1.BIP340KeygenResult(t,r);throw new Error("Keygen failed, no public key or secret share was returned.")}async sign(e,t,r,i=new Uint32Array,a=new Uint8Array){t="string"==typeof t?t:t.secretShare,"string"!=typeof r&&(r=(0,utils_1.bytesToHex)(r)),a=getTweak(a),e=await(await this.NATIVE).bip340Sign(e,this.URL,t,r,Array.from(i),a);return(0,utils_1.hexToBytes)(e)}async refresh(e,t){var t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).bip340Refresh(e,this.URL,t);if(e.pubkey&&e.secret_share)return t=(0,utils_1.hexToBytes)(e.pubkey),e=e.secret_share,new _1.BIP340KeygenResult(t,e);throw new Error("Keygen failed, no public key or secret share was returned.")}async reshareNewParty(e,t,r,i,a){e=await(await this.NATIVE).bip340ReshareNewParty(e,this.URL,t,r,i.keygenSecret,a),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.BIP340KeygenResult(t,r)}async reshareRemainingParty(e,t,r,i){r="string"==typeof r?r:r.secretShare,e=await(await this.NATIVE).bip340ReshareRemainingParty(e,this.URL,t,r,i),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.BIP340KeygenResult(t,r)}async deriveTweakPubkey(e,t=new Uint32Array,r=new Uint8Array){e="string"==typeof e?e:e.secretShare,e=await(await this.NATIVE).bip340DeriveTweakPubkey(e,Array.from(t),getTweak(r));return(0,utils_1.hexToBytes)(e)}async getXpub(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).bip340GetXpub(e)}async deriveTweakPubkeyFromXpub(e,t=new Uint32Array,r=new Uint8Array){e=await(await this.NATIVE).bip340DeriveTweakPubkeyFromXpub(e,Array.from(t),getTweak(r));return(0,utils_1.hexToBytes)(e)}async exportFullPrivateKey(e,t,r){t="string"==typeof t?t:t.secretShare;return(await this.NATIVE).bip340ExportFullPrivateKey(e,this.URL,t,r)}async derivePrivateKeyFromXpriv(e,t=new Uint32Array){return(await this.NATIVE).bip340DerivePrivateKeyFromXpriv(e,Array.from(t))}async offlineExportFullPrivateKey(e){e=e.map(e=>{if("string"==typeof e)return e;if(e instanceof _1.BIP340KeygenResult)return e.secretShare;throw"UnknownType"});return(await this.NATIVE).bip340OfflineExportFullPrivateKey(e)}async importPrivateKeyRecipient(e,t,r,i){e=await(await this.NATIVE).bip340ImportPrivateKeyRecipient(e,this.URL,t,r.keygenSecret,i),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.BIP340KeygenResult(t,r)}async importPrivateKeyImporter(e,t,r,i,a){e=await(await this.NATIVE).bip340ImportPrivateKeyImporter(e,this.URL,t,r,i.keygenSecret,a),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.BIP340KeygenResult(t,r)}}exports.BIP340=BIP340;
@@ -1 +0,0 @@
1
- export declare function sanitizeNumberOfParties(...numberOfParties: number[]): void;
@@ -1 +0,0 @@
1
- function sanitizeNumberOfParties(...e){for(var r of e)if(!Number.isInteger(r)||r<1||65535<r)throw new RangeError(`numberOfParties should be an integer in the range: 1..65_535, instead got: ${r} `)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.sanitizeNumberOfParties=sanitizeNumberOfParties;
@@ -1,23 +0,0 @@
1
- import { EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, MessageHash, DynamicNativeSdkInterface } from './';
2
- export declare class Ecdsa {
3
- protected readonly NATIVE: Promise<DynamicNativeSdkInterface>;
4
- protected readonly URL: string;
5
- protected constructor(native: Promise<DynamicNativeSdkInterface>, hostUrl: string);
6
- createRoom(numParties: number, apiKey: string): Promise<string>;
7
- initKeygen(): Promise<EcdsaInitKeygenResult>;
8
- exportID(keygenResult: EcdsaKeygenResult | string): Promise<string>;
9
- keygen(roomUuid: string, numParties: number, threshold: number, keygenInit: EcdsaInitKeygenResult, keygenIds: string[]): Promise<EcdsaKeygenResult>;
10
- sign(roomUuid: string, keygenResult: EcdsaKeygenResult | string, msgHash: MessageHash, derivationPath?: Uint32Array): Promise<EcdsaSignature>;
11
- refresh(roomUuid: string, keygenResult: EcdsaKeygenResult | string): Promise<EcdsaKeygenResult>;
12
- reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: EcdsaInitKeygenResult, keygenIds: string[]): Promise<EcdsaKeygenResult>;
13
- reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: EcdsaKeygenResult | string, keygenIds: string[]): Promise<EcdsaKeygenResult>;
14
- derivePubkey(keygenResult: EcdsaKeygenResult | string, derivationPath?: Uint32Array): Promise<EcdsaPublicKey>;
15
- getXpub(keygenResult: EcdsaKeygenResult | string): Promise<string>;
16
- derivePubkeyFromXpub(Xpub: string, derivationPath?: Uint32Array): Promise<EcdsaPublicKey>;
17
- exportFullPrivateKey(roomUuid: string, keygenResult: EcdsaKeygenResult | string, toExportID: string): Promise<string | undefined>;
18
- derivePrivateKeyFromXpriv(xpriv: string, derivationPath?: Uint32Array): Promise<string>;
19
- offlineExportFullPrivateKey(keygenResults: EcdsaKeygenResult[] | string[]): Promise<string>;
20
- importPrivateKeyRecipient(roomUuid: string, threshold: number, keygenInit: EcdsaInitKeygenResult, keygenIds: string[]): Promise<EcdsaKeygenResult>;
21
- importPrivateKeyImporter(roomUuid: string, threshold: number, privateKey: string, keygenInit: EcdsaInitKeygenResult, keygenIds: string[]): Promise<EcdsaKeygenResult>;
22
- protected getHostUrl(path?: string): string;
23
- }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.Ecdsa=void 0;let _1=require("./"),common_1=require("./common");class Ecdsa{constructor(e,t){this.NATIVE=e,this.URL=t}async createRoom(e,t){return(0,common_1.sanitizeNumberOfParties)(e),(await this.NATIVE).createRoom(this.URL,e,t)}async initKeygen(){var e=await(await this.NATIVE).initKeygen();return new _1.EcdsaInitKeygenResult(e.pubkey,e.keypair)}async exportID(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).ecdsaGetExportID(e)}async keygen(e,t,r,a,s){if((0,common_1.sanitizeNumberOfParties)(t,r),s.length!==t-1)throw new Error(`keygenIds length must be exactly: ${t-1}, it is: `+s.length);e=await(await this.NATIVE).ecdsaKeygen(e,this.URL,t,r,a.keygenSecret,s),t=new _1.EcdsaPublicKey(e.pubkey),r=e.secret_share;return new _1.EcdsaKeygenResult(t,r)}async sign(e,t,r,a=new Uint32Array){t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).ecdsaSign(e,this.URL,t,r.toHex(),Array.from(a));return _1.EcdsaSignature.fromBuffer(e)}async refresh(e,t){t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).ecdsaRefresh(e,this.URL,t),t=new _1.EcdsaPublicKey(e.pubkey),e=e.secret_share;return new _1.EcdsaKeygenResult(t,e)}async reshareNewParty(e,t,r,a,s){e=await(await this.NATIVE).ecdsaReshareNewParty(e,this.URL,t,r,a.keygenSecret,s),t=new _1.EcdsaPublicKey(e.pubkey),r=e.secret_share;return new _1.EcdsaKeygenResult(t,r)}async reshareRemainingParty(e,t,r,a){r="string"==typeof r?r:r.secretShare,e=await(await this.NATIVE).ecdsaReshareRemainingParty(e,this.URL,t,r,a),t=new _1.EcdsaPublicKey(e.pubkey),r=e.secret_share;return new _1.EcdsaKeygenResult(t,r)}async derivePubkey(e,t=new Uint32Array){e="string"==typeof e?e:e.secretShare,e=await(await this.NATIVE).ecdsaDerivePubkey(e,Array.from(t));return new _1.EcdsaPublicKey(e)}async getXpub(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).ecdsaGetXpub(e)}async derivePubkeyFromXpub(e,t=new Uint32Array){e=await(await this.NATIVE).ecdsaDerivePubkeyFromXpub(e,Array.from(t));return new _1.EcdsaPublicKey(e)}async exportFullPrivateKey(e,t,r){t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).ecdsaExportFullPrivateKey(e,this.URL,t,r);return e||void 0}async derivePrivateKeyFromXpriv(e,t=new Uint32Array){return(await this.NATIVE).ecdsaDerivePrivateKeyFromXpriv(e,Array.from(t))}async offlineExportFullPrivateKey(e){e=e.map(e=>{if("string"==typeof e)return e;if(e instanceof _1.EcdsaKeygenResult)return e.secretShare;throw"UnknownType"});return(await this.NATIVE).ecdsaOfflineExportFullPrivateKey(e)}async importPrivateKeyRecipient(e,t,r,a){e=await(await this.NATIVE).ecdsaImportPrivateKeyRecipient(e,this.URL,t,r.keygenSecret,a),t=new _1.EcdsaPublicKey(e.pubkey),r=e.secret_share;return new _1.EcdsaKeygenResult(t,r)}async importPrivateKeyImporter(e,t,r,a,s){e=await(await this.NATIVE).ecdsaImportPrivateKeyImporter(e,this.URL,t,r,a.keygenSecret,s),t=new _1.EcdsaPublicKey(e.pubkey),r=e.secret_share;return new _1.EcdsaKeygenResult(t,r)}getHostUrl(e){return e||this.URL}}exports.Ecdsa=Ecdsa;
@@ -1,22 +0,0 @@
1
- import { Ed25519InitKeygenResult, Ed25519KeygenResult, DynamicNativeSdkInterface } from './';
2
- export declare class Ed25519 {
3
- protected readonly NATIVE: Promise<DynamicNativeSdkInterface>;
4
- protected readonly URL: string;
5
- protected constructor(native: Promise<DynamicNativeSdkInterface>, url: string);
6
- initKeygen(): Promise<Ed25519InitKeygenResult>;
7
- exportID(keygenResult: Ed25519KeygenResult | string): Promise<string>;
8
- createRoom(numParties: number, apiKey: string): Promise<string>;
9
- keygen(roomUuid: string, numParties: number, threshold: number, keygenInit: Ed25519InitKeygenResult, keygenIds: string[]): Promise<Ed25519KeygenResult>;
10
- sign(roomUuid: string, keygenResult: Ed25519KeygenResult | string, msg: Uint8Array | string, derivationPath?: Uint32Array): Promise<Uint8Array>;
11
- refresh(roomUuid: string, keygenResult: Ed25519KeygenResult | string): Promise<Ed25519KeygenResult>;
12
- reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: Ed25519InitKeygenResult, keygenIds: string[]): Promise<Ed25519KeygenResult>;
13
- reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: Ed25519KeygenResult | string, keygenIds: string[]): Promise<Ed25519KeygenResult>;
14
- derivePubkey(keygenResult: Ed25519KeygenResult | string, derivationPath?: Uint32Array): Promise<Uint8Array>;
15
- getSpub(keygenResult: Ed25519KeygenResult | string): Promise<string>;
16
- derivePubkeyFromSpub(spub: string, derivation: Uint32Array): Promise<Uint8Array>;
17
- exportFullPrivateKey(roomUuid: string, keygenResult: Ed25519KeygenResult | string, toExportID: string): Promise<string | undefined>;
18
- derivePrivateKeyFromSpriv(spriv: string, derivationPath?: Uint32Array): Promise<string>;
19
- offlineExportFullPrivateKey(keygenResults: Ed25519KeygenResult[] | string[]): Promise<string>;
20
- importPrivateKeyRecipient(roomUuid: string, threshold: number, keygenInit: Ed25519InitKeygenResult, keygenIds: string[]): Promise<Ed25519KeygenResult>;
21
- importPrivateKeyImporter(roomUuid: string, threshold: number, privateKey: string, keygenInit: Ed25519InitKeygenResult, keygenIds: string[], isPrivateKeyRaw?: boolean): Promise<Ed25519KeygenResult>;
22
- }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.Ed25519=void 0;let _1=require("./"),utils_1=require("@noble/hashes/utils"),common_1=require("./common");class Ed25519{constructor(e,t){this.NATIVE=e,this.URL=t}async initKeygen(){var e=await(await this.NATIVE).initKeygen();return new _1.Ed25519InitKeygenResult(e.pubkey,e.keypair)}async exportID(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).ed25519GetExportID(e)}async createRoom(e,t){return(0,common_1.sanitizeNumberOfParties)(e),(await this.NATIVE).createRoom(this.URL,e,t)}async keygen(e,t,r,i,s){if((0,common_1.sanitizeNumberOfParties)(t,r),s.length!==t-1)throw new Error(`keygenIds length must be exactly: ${t-1}, it is: `+s.length);e=await(await this.NATIVE).ed25519Keygen(e,this.URL,t,r,i.keygenSecret,s);if(e.pubkey&&e.secret_share)return t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share,new _1.Ed25519KeygenResult(t,r);throw new Error("Keygen failed, no public key or secret share was returned.")}async sign(e,t,r,i=new Uint32Array){"string"!=typeof r&&(r=(0,utils_1.bytesToHex)(r));t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).ed25519Sign(e,this.URL,t,r,Array.from(i));return(0,utils_1.hexToBytes)(e)}async refresh(e,t){var t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).ed25519Refresh(e,this.URL,t);if(e.pubkey&&e.secret_share)return t=(0,utils_1.hexToBytes)(e.pubkey),e=e.secret_share,new _1.Ed25519KeygenResult(t,e);throw new Error("Keygen failed, no public key or secret share was returned.")}async reshareNewParty(e,t,r,i,s){e=await(await this.NATIVE).ed25519ReshareNewParty(e,this.URL,t,r,i.keygenSecret,s),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.Ed25519KeygenResult(t,r)}async reshareRemainingParty(e,t,r,i){r="string"==typeof r?r:r.secretShare,e=await(await this.NATIVE).ed25519ReshareRemainingParty(e,this.URL,t,r,i),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.Ed25519KeygenResult(t,r)}async derivePubkey(e,t=new Uint32Array){e="string"==typeof e?e:e.secretShare,e=await(await this.NATIVE).ed25519DerivePubkey(e,Array.from(t));return(0,utils_1.hexToBytes)(e)}async getSpub(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).ed25519GetSpub(e)}async derivePubkeyFromSpub(e,t){e=await(await this.NATIVE).ed25519DerivePubkeyFromSpub(e,Array.from(t));return(0,utils_1.hexToBytes)(e)}async exportFullPrivateKey(e,t,r){t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).ed25519ExportFullPrivateKey(e,this.URL,t,r);return e||void 0}async derivePrivateKeyFromSpriv(e,t=new Uint32Array){return(await this.NATIVE).ed25519DerivePrivateKeyFromSpriv(e,Array.from(t))}async offlineExportFullPrivateKey(e){e=e.map(e=>{if("string"==typeof e)return e;if(e instanceof _1.Ed25519KeygenResult)return e.secretShare;throw"UnknownType"});return(await this.NATIVE).ed25519OfflineExportFullPrivateKey(e)}async importPrivateKeyRecipient(e,t,r,i){e=await(await this.NATIVE).ed25519ImportPrivateKeyRecipient(e,this.URL,t,r.keygenSecret,i),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.Ed25519KeygenResult(t,r)}async importPrivateKeyImporter(e,t,r,i,s,a=!1){e=await(await this.NATIVE).ed25519ImportPrivateKeyImporter(e,this.URL,t,r,i.keygenSecret,s,a),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.Ed25519KeygenResult(t,r)}}exports.Ed25519=Ed25519;
@@ -1,21 +0,0 @@
1
- import { ExportableEd25519InitKeygenResult, ExportableEd25519KeygenResult, DynamicNativeSdkInterface } from './';
2
- export declare class ExportableEd25519 {
3
- protected readonly NATIVE: Promise<DynamicNativeSdkInterface>;
4
- protected readonly URL: string;
5
- protected constructor(native: Promise<DynamicNativeSdkInterface>, url: string);
6
- initKeygen(): Promise<ExportableEd25519InitKeygenResult>;
7
- exportID(keygenResult: ExportableEd25519KeygenResult | string): Promise<string>;
8
- createRoom(numParties: number, apiKey: string): Promise<string>;
9
- sampleKey(roomUuid: string, numParties: number, threshold: number, keygenInit: ExportableEd25519InitKeygenResult, keygenIds: string[]): Promise<ExportableEd25519KeygenResult>;
10
- receiveKey(roomUuid: string, numParties: number, threshold: number, keygenInit: ExportableEd25519InitKeygenResult, keygenIds: string[]): Promise<ExportableEd25519KeygenResult>;
11
- sign(roomUuid: string, keygenResult: ExportableEd25519KeygenResult | string, msg: Uint8Array | string): Promise<Uint8Array>;
12
- refresh(roomUuid: string, keygenResult: ExportableEd25519KeygenResult | string): Promise<ExportableEd25519KeygenResult>;
13
- reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: ExportableEd25519InitKeygenResult, keygenIds: string[]): Promise<ExportableEd25519KeygenResult>;
14
- reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: ExportableEd25519KeygenResult | string, keygenIds: string[]): Promise<ExportableEd25519KeygenResult>;
15
- getPrivateKey(keygenResult: ExportableEd25519KeygenResult | string): Promise<string>;
16
- exportFullPrivateKey(roomUuid: string, keygenResult: ExportableEd25519KeygenResult | string, toExportID: string): Promise<string | undefined>;
17
- offlineExportFullPrivateKey(keygenResults: ExportableEd25519KeygenResult[] | string[]): Promise<string>;
18
- importPrivateKeyRecipient(roomUuid: string, threshold: number, keygenInit: ExportableEd25519InitKeygenResult, keygenIds: string[]): Promise<ExportableEd25519KeygenResult>;
19
- importPrivateKeyImporter(roomUuid: string, threshold: number, privateKey: string, keygenInit: ExportableEd25519InitKeygenResult, keygenIds: string[]): Promise<ExportableEd25519KeygenResult>;
20
- getPubkey(keygenResult: ExportableEd25519KeygenResult | string): Promise<string>;
21
- }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExportableEd25519=void 0;let _1=require("./"),utils_1=require("@noble/hashes/utils"),common_1=require("./common");class ExportableEd25519{constructor(e,t){this.NATIVE=e,this.URL=t}async initKeygen(){var e=await(await this.NATIVE).initKeygen();return new _1.ExportableEd25519InitKeygenResult(e.pubkey,e.keypair)}async exportID(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).exportableEd25519GetExportID(e)}async createRoom(e,t){return(0,common_1.sanitizeNumberOfParties)(e),(await this.NATIVE).createRoom(this.URL,e,t)}async sampleKey(e,t,r,a,s){if((0,common_1.sanitizeNumberOfParties)(t,r),s.length!==t-1)throw new Error(`keygenIds length must be exactly: ${t-1}, it is: `+s.length);e=await(await this.NATIVE).exportableEd25519SampleKey(e,this.URL,t,r,a.keygenSecret,s);if(e.pubkey&&e.secret_share)return t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share,new _1.ExportableEd25519KeygenResult(t,r);throw new Error("Key sampling failed, no public key or secret share was returned.")}async receiveKey(e,t,r,a,s){if((0,common_1.sanitizeNumberOfParties)(t,r),s.length!==t-1)throw new Error(`keygenIds length must be exactly: ${t-1}, it is: `+s.length);e=await(await this.NATIVE).exportableEd25519ReceiveKey(e,this.URL,t,r,a.keygenSecret,s);if(e.pubkey&&e.secret_share)return t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share,new _1.ExportableEd25519KeygenResult(t,r);throw new Error("Key receive failed, no public key or secret share was returned.")}async sign(e,t,r){"string"!=typeof r&&(r=(0,utils_1.bytesToHex)(r));t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).exportableEd25519Sign(e,this.URL,t,r);return(0,utils_1.hexToBytes)(e)}async refresh(e,t){var t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).exportableEd25519Refresh(e,this.URL,t);if(e.pubkey&&e.secret_share)return t=(0,utils_1.hexToBytes)(e.pubkey),e=e.secret_share,new _1.ExportableEd25519KeygenResult(t,e);throw new Error("Keygen failed, no public key or secret share was returned.")}async reshareNewParty(e,t,r,a,s){e=await(await this.NATIVE).exportableEd25519ReshareNewParty(e,this.URL,t,r,a.keygenSecret,s),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.ExportableEd25519KeygenResult(t,r)}async reshareRemainingParty(e,t,r,a){r="string"==typeof r?r:r.secretShare,e=await(await this.NATIVE).exportableEd25519ReshareRemainingParty(e,this.URL,t,r,a),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.ExportableEd25519KeygenResult(t,r)}async getPrivateKey(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).exportableEd25519GetPubkey(e)}async exportFullPrivateKey(e,t,r){t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).exportableEd25519ExportFullPrivateKey(e,this.URL,t,r);return e||void 0}async offlineExportFullPrivateKey(e){e=e.map(e=>{if("string"==typeof e)return e;if(e instanceof _1.ExportableEd25519KeygenResult)return e.secretShare;throw new Error("UnknownType")});return(await this.NATIVE).exportableEd25519OfflineExportFullPrivateKey(e)}async importPrivateKeyRecipient(e,t,r,a){e=await(await this.NATIVE).exportableEd25519ImportPrivateKeyRecipient(e,this.URL,t,r.keygenSecret,a),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.ExportableEd25519KeygenResult(t,r)}async importPrivateKeyImporter(e,t,r,a,s){e=await(await this.NATIVE).exportableEd25519ImportPrivateKeyImporter(e,this.URL,t,r,a.keygenSecret,s),t=(0,utils_1.hexToBytes)(e.pubkey),r=e.secret_share;return new _1.ExportableEd25519KeygenResult(t,r)}async getPubkey(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).exportableEd25519GetPubkey(e)}}exports.ExportableEd25519=ExportableEd25519;
@@ -1,8 +0,0 @@
1
- import { EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519InitKeygenResult, Ed25519KeygenResult, ExportableEd25519InitKeygenResult, ExportableEd25519KeygenResult, Sr25519InitKeygenResult, Sr25519KeygenResult, BIP340InitKeygenResult, BIP340KeygenResult, MessageHash } from './types';
2
- import { Ecdsa } from './ecdsa';
3
- import { Ed25519 } from './ed25519';
4
- import { ExportableEd25519 } from './ed25519_exportable';
5
- import { Sr25519 } from './sr25519';
6
- import { BIP340 } from './bip340';
7
- import { DynamicNativeSdkInterface } from './native';
8
- export { DynamicNativeSdkInterface, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519InitKeygenResult, Ed25519KeygenResult, ExportableEd25519InitKeygenResult, ExportableEd25519KeygenResult, Sr25519InitKeygenResult, Sr25519KeygenResult, BIP340InitKeygenResult, BIP340KeygenResult, MessageHash, Ecdsa, Ed25519, ExportableEd25519, Sr25519, BIP340, };
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.BIP340=exports.Sr25519=exports.ExportableEd25519=exports.Ed25519=exports.Ecdsa=exports.MessageHash=exports.BIP340KeygenResult=exports.BIP340InitKeygenResult=exports.Sr25519KeygenResult=exports.Sr25519InitKeygenResult=exports.ExportableEd25519KeygenResult=exports.ExportableEd25519InitKeygenResult=exports.Ed25519KeygenResult=exports.Ed25519InitKeygenResult=exports.EcdsaSignature=exports.EcdsaPublicKey=exports.EcdsaKeygenResult=exports.EcdsaInitKeygenResult=void 0;let types_1=require("./types"),ecdsa_1=(Object.defineProperty(exports,"EcdsaInitKeygenResult",{enumerable:!0,get:function(){return types_1.EcdsaInitKeygenResult}}),Object.defineProperty(exports,"EcdsaKeygenResult",{enumerable:!0,get:function(){return types_1.EcdsaKeygenResult}}),Object.defineProperty(exports,"EcdsaPublicKey",{enumerable:!0,get:function(){return types_1.EcdsaPublicKey}}),Object.defineProperty(exports,"EcdsaSignature",{enumerable:!0,get:function(){return types_1.EcdsaSignature}}),Object.defineProperty(exports,"Ed25519InitKeygenResult",{enumerable:!0,get:function(){return types_1.Ed25519InitKeygenResult}}),Object.defineProperty(exports,"Ed25519KeygenResult",{enumerable:!0,get:function(){return types_1.Ed25519KeygenResult}}),Object.defineProperty(exports,"ExportableEd25519InitKeygenResult",{enumerable:!0,get:function(){return types_1.ExportableEd25519InitKeygenResult}}),Object.defineProperty(exports,"ExportableEd25519KeygenResult",{enumerable:!0,get:function(){return types_1.ExportableEd25519KeygenResult}}),Object.defineProperty(exports,"Sr25519InitKeygenResult",{enumerable:!0,get:function(){return types_1.Sr25519InitKeygenResult}}),Object.defineProperty(exports,"Sr25519KeygenResult",{enumerable:!0,get:function(){return types_1.Sr25519KeygenResult}}),Object.defineProperty(exports,"BIP340InitKeygenResult",{enumerable:!0,get:function(){return types_1.BIP340InitKeygenResult}}),Object.defineProperty(exports,"BIP340KeygenResult",{enumerable:!0,get:function(){return types_1.BIP340KeygenResult}}),Object.defineProperty(exports,"MessageHash",{enumerable:!0,get:function(){return types_1.MessageHash}}),require("./ecdsa")),ed25519_1=(Object.defineProperty(exports,"Ecdsa",{enumerable:!0,get:function(){return ecdsa_1.Ecdsa}}),require("./ed25519")),ed25519_exportable_1=(Object.defineProperty(exports,"Ed25519",{enumerable:!0,get:function(){return ed25519_1.Ed25519}}),require("./ed25519_exportable")),sr25519_1=(Object.defineProperty(exports,"ExportableEd25519",{enumerable:!0,get:function(){return ed25519_exportable_1.ExportableEd25519}}),require("./sr25519")),bip340_1=(Object.defineProperty(exports,"Sr25519",{enumerable:!0,get:function(){return sr25519_1.Sr25519}}),require("./bip340"));Object.defineProperty(exports,"BIP340",{enumerable:!0,get:function(){return bip340_1.BIP340}});
@@ -1,168 +0,0 @@
1
- export interface DynamicNativeSdkInterface {
2
- initKeygen(): Promise<{
3
- pubkey: string;
4
- keypair: string;
5
- }>;
6
- createRoom(hostUrl: string, numParties: number, apiKey: string): Promise<string>;
7
- ecdsaGetExportID(secretShare: string): Promise<string>;
8
- ecdsaKeygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
9
- pubkey: string;
10
- secret_share: string;
11
- }>;
12
- ecdsaSign(roomUUID: string, hostUrl: string, secretShare: string, msgHex: string, derivationPath: number[]): Promise<string>;
13
- ecdsaRefresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<{
14
- pubkey: string;
15
- secret_share: string;
16
- }>;
17
- ecdsaReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
18
- pubkey: string;
19
- secret_share: string;
20
- }>;
21
- ecdsaReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<{
22
- pubkey: string;
23
- secret_share: string;
24
- }>;
25
- ecdsaDerivePubkey(secretShare: string, derive: number[]): Promise<string>;
26
- ecdsaGetXpub(secretShare: string): Promise<string>;
27
- ecdsaDerivePubkeyFromXpub(xpub: string, derivation: number[]): Promise<string>;
28
- ecdsaExportFullPrivateKey(roomUUID: string, hostUrl: string, secretShare: string, toExportID: string): Promise<undefined | string>;
29
- ecdsaDerivePrivateKeyFromXpriv(xpriv: string, derive: number[]): Promise<string>;
30
- ecdsaOfflineExportFullPrivateKey(keygenResults: string[]): Promise<string>;
31
- ecdsaImportPrivateKeyRecipient(roomUUID: string, hostUrl: string, threshold: number, secretShare: string, keygenIDs: string[]): Promise<{
32
- pubkey: string;
33
- secret_share: string;
34
- }>;
35
- ecdsaImportPrivateKeyImporter(roomUUID: string, hostUrl: string, threshold: number, privateKey: string, secretShare: string, keygenIDs: string[]): Promise<{
36
- pubkey: string;
37
- secret_share: string;
38
- }>;
39
- ed25519GetExportID(secretShare: string): Promise<string>;
40
- ed25519Keygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
41
- pubkey: string;
42
- secret_share: string;
43
- }>;
44
- ed25519Sign(roomUUID: string, hostUrl: string, secretShare: string, msgHex: string, derivationPath: number[]): Promise<string>;
45
- ed25519Refresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<{
46
- pubkey: string;
47
- secret_share: string;
48
- }>;
49
- ed25519ReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
50
- pubkey: string;
51
- secret_share: string;
52
- }>;
53
- ed25519ReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<{
54
- pubkey: string;
55
- secret_share: string;
56
- }>;
57
- ed25519DerivePubkey(secretShare: string, derive: number[]): Promise<string>;
58
- ed25519GetSpub(secretShare: string): Promise<string>;
59
- ed25519DerivePubkeyFromSpub(spub: string, derivation: number[]): Promise<string>;
60
- ed25519ExportFullPrivateKey(roomUUID: string, hostUrl: string, secretShare: string, toExportID: string): Promise<undefined | string>;
61
- ed25519DerivePrivateKeyFromSpriv(spriv: string, derive: number[]): Promise<string>;
62
- ed25519OfflineExportFullPrivateKey(keygenResults: string[]): Promise<string>;
63
- ed25519ImportPrivateKeyRecipient(roomUUID: string, hostUrl: string, threshold: number, secretShare: string, keygenIDs: string[]): Promise<{
64
- pubkey: string;
65
- secret_share: string;
66
- }>;
67
- ed25519ImportPrivateKeyImporter(roomUUID: string, hostUrl: string, threshold: number, privateKey: string, secretShare: string, keygenIDs: string[], isPrivateKeyRaw: boolean): Promise<{
68
- pubkey: string;
69
- secret_share: string;
70
- }>;
71
- exportableEd25519GetExportID(secretShare: string): Promise<string>;
72
- exportableEd25519SampleKey(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
73
- pubkey: string;
74
- secret_share: string;
75
- }>;
76
- exportableEd25519ReceiveKey(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
77
- pubkey: string;
78
- secret_share: string;
79
- }>;
80
- exportableEd25519Sign(roomUUID: string, hostUrl: string, secretShare: string, msgHex: string): Promise<string>;
81
- exportableEd25519Refresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<{
82
- pubkey: string;
83
- secret_share: string;
84
- }>;
85
- exportableEd25519ReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
86
- pubkey: string;
87
- secret_share: string;
88
- }>;
89
- exportableEd25519ReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<{
90
- pubkey: string;
91
- secret_share: string;
92
- }>;
93
- exportableEd25519GetPubkey(secretShare: string): Promise<string>;
94
- exportableEd25519ExportFullPrivateKey(roomUUID: string, hostUrl: string, secretShare: string, toExportID: string): Promise<undefined | string>;
95
- exportableEd25519OfflineExportFullPrivateKey(keygenResults: string[]): Promise<string>;
96
- exportableEd25519ImportPrivateKeyRecipient(roomUUID: string, hostUrl: string, threshold: number, secretShare: string, keygenIDs: string[]): Promise<{
97
- pubkey: string;
98
- secret_share: string;
99
- }>;
100
- exportableEd25519ImportPrivateKeyImporter(roomUUID: string, hostUrl: string, threshold: number, privateKey: string, secretShare: string, keygenIDs: string[]): Promise<{
101
- pubkey: string;
102
- secret_share: string;
103
- }>;
104
- bip340GetExportID(secretShare: string): Promise<string>;
105
- bip340Keygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
106
- pubkey: string;
107
- secret_share: string;
108
- }>;
109
- bip340Sign(roomUUID: string, hostUrl: string, secretShare: string, msgHex: string, derivationPath: number[], tweak: string): Promise<string>;
110
- bip340Refresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<{
111
- pubkey: string;
112
- secret_share: string;
113
- }>;
114
- bip340ReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
115
- pubkey: string;
116
- secret_share: string;
117
- }>;
118
- bip340ReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<{
119
- pubkey: string;
120
- secret_share: string;
121
- }>;
122
- bip340DeriveTweakPubkey(secretShare: string, derive: number[], tweak: string): Promise<string>;
123
- bip340GetXpub(secretShare: string): Promise<string>;
124
- bip340DeriveTweakPubkeyFromXpub(xpub: string, derivation: number[], optTweak: string): Promise<string>;
125
- bip340ExportFullPrivateKey(roomUUID: string, hostUrl: string, secretShare: string, toExportID: string): Promise<undefined | string>;
126
- bip340DerivePrivateKeyFromXpriv(xpriv: string, derive: number[]): Promise<string>;
127
- bip340OfflineExportFullPrivateKey(keygenResults: string[]): Promise<string>;
128
- bip340ImportPrivateKeyRecipient(roomUUID: string, hostUrl: string, threshold: number, secretShare: string, keygenIDs: string[]): Promise<{
129
- pubkey: string;
130
- secret_share: string;
131
- }>;
132
- bip340ImportPrivateKeyImporter(roomUUID: string, hostUrl: string, threshold: number, privateKey: string, secretShare: string, keygenIDs: string[]): Promise<{
133
- pubkey: string;
134
- secret_share: string;
135
- }>;
136
- sr25519GetExportID(secretShare: string): Promise<string>;
137
- sr25519Keygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
138
- pubkey: string;
139
- secret_share: string;
140
- }>;
141
- sr25519Sign(roomUUID: string, hostUrl: string, secretShare: string, msgHex: string, derivationPath: string[]): Promise<string>;
142
- sr25519Refresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<{
143
- pubkey: string;
144
- secret_share: string;
145
- }>;
146
- sr25519ReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
147
- pubkey: string;
148
- secret_share: string;
149
- }>;
150
- sr25519ReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<{
151
- pubkey: string;
152
- secret_share: string;
153
- }>;
154
- sr25519DerivePubkey(secretShare: string, derivationPath: string[]): Promise<string>;
155
- sr25519GetPubkey(secretShare: string): Promise<string>;
156
- sr25519DerivePubkeyFromPubkey(pubkey: string, derivation: string[]): Promise<string>;
157
- sr25519ExportFullPrivateKey(roomUUID: string, hostUrl: string, secretShare: string, toExportID: string): Promise<undefined | string>;
158
- sr25519DerivePrivateKeyFromPrivateKey(privkey: string, derive: string[], isPrivateKeyRaw: boolean): Promise<string>;
159
- sr25519OfflineExportFullPrivateKey(keygenResults: string[]): Promise<string>;
160
- sr25519ImportPrivateKeyRecipient(roomUUID: string, hostUrl: string, threshold: number, secretShare: string, keygenIDs: string[]): Promise<{
161
- pubkey: string;
162
- secret_share: string;
163
- }>;
164
- sr25519ImportPrivateKeyImporter(roomUUID: string, hostUrl: string, threshold: number, privateKey: string, secretShare: string, keygenIDs: string[], isPrivateKeyRaw: boolean): Promise<{
165
- pubkey: string;
166
- secret_share: string;
167
- }>;
168
- }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0});
@@ -1,22 +0,0 @@
1
- import { Sr25519InitKeygenResult, Sr25519KeygenResult, DynamicNativeSdkInterface } from './';
2
- export declare class Sr25519 {
3
- protected readonly NATIVE: Promise<DynamicNativeSdkInterface>;
4
- protected readonly URL: string;
5
- protected constructor(native: Promise<DynamicNativeSdkInterface>, url: string);
6
- initKeygen(): Promise<Sr25519InitKeygenResult>;
7
- exportID(keygenResult: Sr25519KeygenResult | string): Promise<string>;
8
- createRoom(numParties: number, apiKey: string): Promise<string>;
9
- keygen(roomUuid: string, numParties: number, threshold: number, keygenInit: Sr25519InitKeygenResult, keygenIds: string[]): Promise<Sr25519KeygenResult>;
10
- sign(roomUuid: string, keygenResult: Sr25519KeygenResult | string, msg: Uint8Array | string, derivationPath?: string[]): Promise<Uint8Array>;
11
- refresh(roomUuid: string, keygenResult: Sr25519KeygenResult | string): Promise<Sr25519KeygenResult>;
12
- reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: Sr25519InitKeygenResult, keygenIds: string[]): Promise<Sr25519KeygenResult>;
13
- reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: Sr25519KeygenResult | string, keygenIds: string[]): Promise<Sr25519KeygenResult>;
14
- derivePubkey(keygenResult: Sr25519KeygenResult | string, derivationPath?: string[]): Promise<Uint8Array>;
15
- getPubkey(keygenResult: Sr25519KeygenResult | string): Promise<Uint8Array>;
16
- derivePubkeyFromPubkey(pubkey: Uint8Array, derivation: string[]): Promise<Uint8Array>;
17
- exportFullPrivateKey(roomUuid: string, keygenResult: Sr25519KeygenResult | string, toExportID: string): Promise<string | undefined>;
18
- derivePrivateKeyFromPrivateKey(privkey: string, isPrivateKeyRaw: boolean, derivationPath?: string[]): Promise<string>;
19
- offlineExportFullPrivateKey(keygenResults: Sr25519KeygenResult[] | string[]): Promise<string>;
20
- importPrivateKeyRecipient(roomUuid: string, threshold: number, keygenInit: Sr25519InitKeygenResult, keygenIds: string[]): Promise<Sr25519KeygenResult>;
21
- importPrivateKeyImporter(roomUuid: string, threshold: number, privateKey: string, keygenInit: Sr25519InitKeygenResult, keygenIds: string[], isPrivateKeyRaw?: boolean): Promise<Sr25519KeygenResult>;
22
- }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sr25519=void 0;let _1=require("./"),utils_1=require("@noble/hashes/utils"),common_1=require("./common");class Sr25519{constructor(e,r){this.NATIVE=e,this.URL=r}async initKeygen(){var e=await(await this.NATIVE).initKeygen();return new _1.Sr25519InitKeygenResult(e.pubkey,e.keypair)}async exportID(e){e="string"==typeof e?e:e.secretShare;return(await this.NATIVE).sr25519GetExportID(e)}async createRoom(e,r){return(0,common_1.sanitizeNumberOfParties)(e),(await this.NATIVE).createRoom(this.URL,e,r)}async keygen(e,r,t,s,i){if((0,common_1.sanitizeNumberOfParties)(r,t),i.length!==r-1)throw new Error(`keygenIds length must be exactly: ${r-1}, it is: `+i.length);e=await(await this.NATIVE).sr25519Keygen(e,this.URL,r,t,s.keygenSecret,i);if(e.pubkey&&e.secret_share)return r=(0,utils_1.hexToBytes)(e.pubkey),t=e.secret_share,new _1.Sr25519KeygenResult(r,t);throw new Error("Keygen failed, no public key or secret share was returned.")}async sign(e,r,t,s=[]){"string"!=typeof t&&(t=(0,utils_1.bytesToHex)(t));r="string"==typeof r?r:r.secretShare,e=await(await this.NATIVE).sr25519Sign(e,this.URL,r,t,Array.from(s));return(0,utils_1.hexToBytes)(e)}async refresh(e,r){var r="string"==typeof r?r:r.secretShare,e=await(await this.NATIVE).sr25519Refresh(e,this.URL,r);if(e.pubkey&&e.secret_share)return r=(0,utils_1.hexToBytes)(e.pubkey),e=e.secret_share,new _1.Sr25519KeygenResult(r,e);throw new Error("Keygen failed, no public key or secret share was returned.")}async reshareNewParty(e,r,t,s,i){e=await(await this.NATIVE).sr25519ReshareNewParty(e,this.URL,r,t,s.keygenSecret,i),r=(0,utils_1.hexToBytes)(e.pubkey),t=e.secret_share;return new _1.Sr25519KeygenResult(r,t)}async reshareRemainingParty(e,r,t,s){t="string"==typeof t?t:t.secretShare,e=await(await this.NATIVE).sr25519ReshareRemainingParty(e,this.URL,r,t,s),r=(0,utils_1.hexToBytes)(e.pubkey),t=e.secret_share;return new _1.Sr25519KeygenResult(r,t)}async derivePubkey(e,r=[]){e="string"==typeof e?e:e.secretShare,e=await(await this.NATIVE).sr25519DerivePubkey(e,Array.from(r));return(0,utils_1.hexToBytes)(e)}async getPubkey(e){e="string"==typeof e?e:e.secretShare,e=await(await this.NATIVE).sr25519GetPubkey(e);return(0,utils_1.hexToBytes)(e)}async derivePubkeyFromPubkey(e,r){e=await(await this.NATIVE).sr25519DerivePubkeyFromPubkey((0,utils_1.bytesToHex)(e),Array.from(r));return(0,utils_1.hexToBytes)(e)}async exportFullPrivateKey(e,r,t){r="string"==typeof r?r:r.secretShare,e=await(await this.NATIVE).sr25519ExportFullPrivateKey(e,this.URL,r,t);return e||void 0}async derivePrivateKeyFromPrivateKey(e,r,t=[]){return(await this.NATIVE).sr25519DerivePrivateKeyFromPrivateKey(e,Array.from(t),r)}async offlineExportFullPrivateKey(e){e=e.map(e=>{if("string"==typeof e)return e;if(e instanceof _1.Sr25519KeygenResult)return e.secretShare;throw"UnknownType"});return(await this.NATIVE).sr25519OfflineExportFullPrivateKey(e)}async importPrivateKeyRecipient(e,r,t,s){e=await(await this.NATIVE).sr25519ImportPrivateKeyRecipient(e,this.URL,r,t.keygenSecret,s),r=(0,utils_1.hexToBytes)(e.pubkey),t=e.secret_share;return new _1.Sr25519KeygenResult(r,t)}async importPrivateKeyImporter(e,r,t,s,i,a=!1){e=await(await this.NATIVE).sr25519ImportPrivateKeyImporter(e,this.URL,r,t,s.keygenSecret,i,a),r=(0,utils_1.hexToBytes)(e.pubkey),t=e.secret_share;return new _1.Sr25519KeygenResult(r,t)}}exports.Sr25519=Sr25519;
@@ -1,78 +0,0 @@
1
- export declare class MessageHash {
2
- static readonly LENGTH = 32;
3
- readonly bytes: Uint8Array;
4
- constructor(bytes: Uint8Array | string);
5
- static sha256(message: Uint8Array | string): MessageHash;
6
- static sha256d(message: Uint8Array | string): MessageHash;
7
- static keccak256(message: Uint8Array | string): MessageHash;
8
- toHex(): string;
9
- }
10
- export declare class EcdsaPublicKey {
11
- private static readonly LENGTH;
12
- private readonly pubkey;
13
- constructor(pubkey: Uint8Array | string);
14
- serializeUncompressed(): Uint8Array;
15
- serializeCompressed(): Uint8Array;
16
- pubKeyAsHex(): string;
17
- }
18
- export declare class EcdsaKeygenResult {
19
- pubkey: EcdsaPublicKey;
20
- secretShare: string;
21
- constructor(pubkey: EcdsaPublicKey, secretShare: string);
22
- }
23
- export declare class EcdsaInitKeygenResult {
24
- keygenId: string;
25
- keygenSecret: string;
26
- constructor(keygenId: string, keygenSecret: string);
27
- }
28
- export declare class Ed25519KeygenResult {
29
- pubkey: Uint8Array;
30
- secretShare: string;
31
- constructor(pubkey: Uint8Array, secretShare: string);
32
- }
33
- export declare class Ed25519InitKeygenResult {
34
- keygenId: string;
35
- keygenSecret: string;
36
- constructor(keygenId: string, keygenSecret: string);
37
- }
38
- export declare class Sr25519KeygenResult {
39
- pubkey: Uint8Array;
40
- secretShare: string;
41
- constructor(pubkey: Uint8Array, secretShare: string);
42
- }
43
- export declare class ExportableEd25519KeygenResult {
44
- pubkey: Uint8Array;
45
- secretShare: string;
46
- constructor(pubkey: Uint8Array, secretShare: string);
47
- }
48
- export declare class ExportableEd25519InitKeygenResult {
49
- keygenId: string;
50
- keygenSecret: string;
51
- constructor(keygenId: string, keygenSecret: string);
52
- }
53
- export declare class Sr25519InitKeygenResult {
54
- keygenId: string;
55
- keygenSecret: string;
56
- constructor(keygenId: string, keygenSecret: string);
57
- }
58
- export declare class EcdsaSignature {
59
- private static readonly FIELD_SIZE;
60
- private static readonly MAX_DER_LEN;
61
- private static readonly MIN_DER_LEN;
62
- readonly r: Uint8Array;
63
- readonly s: Uint8Array;
64
- readonly v: number;
65
- readonly der: Uint8Array;
66
- static fromBuffer(expandedSignature: Uint8Array | string): EcdsaSignature;
67
- constructor(r: Uint8Array, s: Uint8Array, v: number, DERencoding: Uint8Array);
68
- }
69
- export declare class BIP340KeygenResult {
70
- pubkey: Uint8Array;
71
- secretShare: string;
72
- constructor(pubkey: Uint8Array, secretShare: string);
73
- }
74
- export declare class BIP340InitKeygenResult {
75
- keygenId: string;
76
- keygenSecret: string;
77
- constructor(keygenId: string, keygenSecret: string);
78
- }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.BIP340InitKeygenResult=exports.BIP340KeygenResult=exports.EcdsaSignature=exports.Sr25519InitKeygenResult=exports.ExportableEd25519InitKeygenResult=exports.ExportableEd25519KeygenResult=exports.Sr25519KeygenResult=exports.Ed25519InitKeygenResult=exports.Ed25519KeygenResult=exports.EcdsaInitKeygenResult=exports.EcdsaKeygenResult=exports.EcdsaPublicKey=exports.MessageHash=void 0;let utils_1=require("@noble/hashes/utils"),sha3_1=require("@noble/hashes/sha3"),sha256_1=require("@noble/hashes/sha256");class MessageHash{constructor(e){if(this.bytes=new Uint8Array,"string"==typeof e){if(e.length!==2*MessageHash.LENGTH)throw new Error("Invalid length for MessageHash: "+e.length);this.bytes=(0,utils_1.hexToBytes)(e)}else{if(e.length!==MessageHash.LENGTH)throw new Error("Invalid length for MessageHash: "+e.length);this.bytes=e}}static sha256(e){return new MessageHash((0,sha256_1.sha256)(e))}static sha256d(e){return new MessageHash((0,sha256_1.sha256)((0,sha256_1.sha256)(e)))}static keccak256(e){return new MessageHash((0,sha3_1.keccak_256)(e))}toHex(){return(0,utils_1.bytesToHex)(this.bytes)}}(exports.MessageHash=MessageHash).LENGTH=32;class EcdsaPublicKey{constructor(e){if((e="string"==typeof e?(0,utils_1.hexToBytes)(e):e).length===EcdsaPublicKey.LENGTH+1)this.pubkey=e.slice(1);else{if(e.length!==EcdsaPublicKey.LENGTH)throw new RangeError(`Invalid ${this.constructor.name} length, expected: ${EcdsaPublicKey.LENGTH} bytes, found: `+e.length);this.pubkey=e}}serializeUncompressed(){return new Uint8Array([4,...this.pubkey])}serializeCompressed(){var e=1&this.pubkey[63];return new Uint8Array([2+e,...this.pubkey.slice(0,32)])}pubKeyAsHex(){return(0,utils_1.bytesToHex)(this.serializeUncompressed())}}(exports.EcdsaPublicKey=EcdsaPublicKey).LENGTH=64;class EcdsaKeygenResult{constructor(e,s){this.pubkey=e,this.secretShare=s}}exports.EcdsaKeygenResult=EcdsaKeygenResult;class EcdsaInitKeygenResult{constructor(e,s){this.keygenId=e,this.keygenSecret=s}}exports.EcdsaInitKeygenResult=EcdsaInitKeygenResult;class Ed25519KeygenResult{constructor(e,s){this.pubkey=e,this.secretShare=s}}exports.Ed25519KeygenResult=Ed25519KeygenResult;class Ed25519InitKeygenResult{constructor(e,s){this.keygenId=e,this.keygenSecret=s}}exports.Ed25519InitKeygenResult=Ed25519InitKeygenResult;class Sr25519KeygenResult{constructor(e,s){this.pubkey=e,this.secretShare=s}}exports.Sr25519KeygenResult=Sr25519KeygenResult;class ExportableEd25519KeygenResult{constructor(e,s){this.pubkey=e,this.secretShare=s}}exports.ExportableEd25519KeygenResult=ExportableEd25519KeygenResult;class ExportableEd25519InitKeygenResult{constructor(e,s){this.keygenId=e,this.keygenSecret=s}}exports.ExportableEd25519InitKeygenResult=ExportableEd25519InitKeygenResult;class Sr25519InitKeygenResult{constructor(e,s){this.keygenId=e,this.keygenSecret=s}}exports.Sr25519InitKeygenResult=Sr25519InitKeygenResult;class EcdsaSignature{static fromBuffer(e){"string"==typeof e&&(e=(0,utils_1.hexToBytes)(e));var s=2*EcdsaSignature.FIELD_SIZE+EcdsaSignature.MAX_DER_LEN+1,t=2*EcdsaSignature.FIELD_SIZE+EcdsaSignature.MIN_DER_LEN+1;if(e.length<t||e.length>s)throw new RangeError(`Invalid ${this.constructor.name} length, expected between ${t}..${s} bytes, found: `+e.length);var t=e.subarray(0,EcdsaSignature.FIELD_SIZE),s=e.subarray(EcdsaSignature.FIELD_SIZE,2*EcdsaSignature.FIELD_SIZE),r=e[2*EcdsaSignature.FIELD_SIZE],e=e.subarray(2*EcdsaSignature.FIELD_SIZE+1);return new EcdsaSignature(t,s,r,e)}constructor(e,s,t,r){if(s.length!==EcdsaSignature.FIELD_SIZE)throw new RangeError(`Invalid 's' length, expected: ${EcdsaSignature.FIELD_SIZE} found: `+s.length);if(e.length!==EcdsaSignature.FIELD_SIZE)throw new RangeError(`Invalid 'r' length, expected: ${EcdsaSignature.FIELD_SIZE} found: `+e.length);if(!Number.isInteger(t)||t<27||30<t)throw new RangeError("Invalid 'v' value, expected 27/28/29/30 found: "+t);if(r.length<EcdsaSignature.MIN_DER_LEN||r.length>EcdsaSignature.MAX_DER_LEN)throw new RangeError(`Invalid DER encoding, expected length: ${EcdsaSignature.MIN_DER_LEN}..${EcdsaSignature.MAX_DER_LEN} found: `+r.length);this.r=e,this.s=s,this.v=t,this.der=r}}(exports.EcdsaSignature=EcdsaSignature).FIELD_SIZE=32,EcdsaSignature.MAX_DER_LEN=72,EcdsaSignature.MIN_DER_LEN=8;class BIP340KeygenResult{constructor(e,s){this.pubkey=e,this.secretShare=s}}exports.BIP340KeygenResult=BIP340KeygenResult;class BIP340InitKeygenResult{constructor(e,s){this.keygenId=e,this.keygenSecret=s}}exports.BIP340InitKeygenResult=BIP340InitKeygenResult;