@dynamic-labs-wallet/node 0.0.201 → 0.0.203

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.
@@ -1 +1 @@
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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.BIP340=void 0;const _1=require("./index.cjs"),utils_1=require("@noble/hashes/utils"),common_1=require("./common.cjs");function getTweak(tweak){if("string"!=typeof tweak&&(tweak=(0,utils_1.bytesToHex)(tweak)),0!==tweak.length&&64!==tweak.length)throw new Error("Tweak must be 32 bytes long");return tweak}class BIP340{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new _1.BIP340InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).bip340GetExportID(secretShare)}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).bip340Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);if(!keygenResult.pubkey||!keygenResult.secret_share)throw new Error("Keygen failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(keygenResult.pubkey),secretShareHex=keygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}async sign(roomUuid,keygenResult,msg,derivationPath=new Uint32Array,tweak=new Uint8Array){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,signature=("string"!=typeof msg&&(msg=(0,utils_1.bytesToHex)(msg)),tweak=getTweak(tweak),await(await this.NATIVE).bip340Sign(roomUuid,this.URL,secretShare,msg,Array.from(derivationPath),tweak));return(0,utils_1.hexToBytes)(signature)}async refresh(roomUuid,keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,refreshedKeygenResult=await(await this.NATIVE).bip340Refresh(roomUuid,this.URL,secretShare);if(!refreshedKeygenResult.pubkey||!refreshedKeygenResult.secret_share)throw new Error("Keygen failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(refreshedKeygenResult.pubkey),secretShareHex=refreshedKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).bip340ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,resharedKeygenResult=await(await this.NATIVE).bip340ReshareRemainingParty(roomUuid,this.URL,newThreshold,secretShare,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}async deriveTweakPubkey(keygenResult,derivationPath=new Uint32Array,tweak=new Uint8Array){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,pubkey=await(await this.NATIVE).bip340DeriveTweakPubkey(secretShare,Array.from(derivationPath),getTweak(tweak));return(0,utils_1.hexToBytes)(pubkey)}async getXpub(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).bip340GetXpub(secretShare)}async deriveTweakPubkeyFromXpub(Xpub,derivationPath=new Uint32Array,tweak=new Uint8Array){const pubkey=await(await this.NATIVE).bip340DeriveTweakPubkeyFromXpub(Xpub,Array.from(derivationPath),getTweak(tweak));return(0,utils_1.hexToBytes)(pubkey)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).bip340ExportFullPrivateKey(roomUuid,this.URL,secretShare,toExportID)}async derivePrivateKeyFromXpriv(xpriv,derivationPath=new Uint32Array){return(await this.NATIVE).bip340DerivePrivateKeyFromXpriv(xpriv,Array.from(derivationPath))}async offlineExportFullPrivateKey(keygenResults){const secretShares=keygenResults.map(k=>{if("string"==typeof k)return k;if(k instanceof _1.BIP340KeygenResult)return k.secretShare;throw"UnknownType"});return(await this.NATIVE).bip340OfflineExportFullPrivateKey(secretShares)}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).bip340ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).bip340ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}}exports.BIP340=BIP340;
@@ -1 +1 @@
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
+ function sanitizeNumberOfParties(...numberOfParties){for(var n of numberOfParties)if(!Number.isInteger(n)||n<1||65535<n)throw new RangeError(`numberOfParties should be an integer in the range: 1..65_535, instead got: ${n} `)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.sanitizeNumberOfParties=sanitizeNumberOfParties;
@@ -1 +1 @@
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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.Ecdsa=void 0;const _1=require("./index.cjs"),common_1=require("./common.cjs");class Ecdsa{constructor(native,hostUrl){this.NATIVE=native,this.URL=hostUrl}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new _1.EcdsaInitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).ecdsaGetExportID(secretShare)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).ecdsaKeygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds),pubkey=new _1.EcdsaPublicKey(keygenResult.pubkey),secretShareHex=keygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}async sign(roomUuid,keygenResult,msgHash,derivationPath=new Uint32Array){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,expandedSignature=await(await this.NATIVE).ecdsaSign(roomUuid,this.URL,secretShare,msgHash.toHex(),Array.from(derivationPath));return _1.EcdsaSignature.fromBuffer(expandedSignature)}async refresh(roomUuid,keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,refreshedKeygenResult=await(await this.NATIVE).ecdsaRefresh(roomUuid,this.URL,secretShare),pubkey=new _1.EcdsaPublicKey(refreshedKeygenResult.pubkey),secretShareHex=refreshedKeygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).ecdsaReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds),pubkey=new _1.EcdsaPublicKey(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,resharedKeygenResult=await(await this.NATIVE).ecdsaReshareRemainingParty(roomUuid,this.URL,newThreshold,secretShare,keygenIds),pubkey=new _1.EcdsaPublicKey(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}async derivePubkey(keygenResult,derivationPath=new Uint32Array){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,pubkey=await(await this.NATIVE).ecdsaDerivePubkey(secretShare,Array.from(derivationPath));return new _1.EcdsaPublicKey(pubkey)}async getXpub(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).ecdsaGetXpub(secretShare)}async derivePubkeyFromXpub(Xpub,derivationPath=new Uint32Array){const pubkey=await(await this.NATIVE).ecdsaDerivePubkeyFromXpub(Xpub,Array.from(derivationPath));return new _1.EcdsaPublicKey(pubkey)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,exported=await(await this.NATIVE).ecdsaExportFullPrivateKey(roomUuid,this.URL,secretShare,toExportID);return exported||void 0}async derivePrivateKeyFromXpriv(xpriv,derivationPath=new Uint32Array){return(await this.NATIVE).ecdsaDerivePrivateKeyFromXpriv(xpriv,Array.from(derivationPath))}async offlineExportFullPrivateKey(keygenResults){const secretShares=keygenResults.map(k=>{if("string"==typeof k)return k;if(k instanceof _1.EcdsaKeygenResult)return k.secretShare;throw"UnknownType"});return(await this.NATIVE).ecdsaOfflineExportFullPrivateKey(secretShares)}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).ecdsaImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds),pubkey=new _1.EcdsaPublicKey(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).ecdsaImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds),pubkey=new _1.EcdsaPublicKey(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}getHostUrl(path){return path||this.URL}}exports.Ecdsa=Ecdsa;
@@ -1 +1 @@
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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.Ed25519=void 0;const _1=require("./index.cjs"),utils_1=require("@noble/hashes/utils"),common_1=require("./common.cjs");class Ed25519{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new _1.Ed25519InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).ed25519GetExportID(secretShare)}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).ed25519Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);if(!keygenResult.pubkey||!keygenResult.secret_share)throw new Error("Keygen failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(keygenResult.pubkey),secretShareHex=keygenResult.secret_share;return new _1.Ed25519KeygenResult(pubkey,secretShareHex)}async sign(roomUuid,keygenResult,msg,derivationPath=new Uint32Array){"string"!=typeof msg&&(msg=(0,utils_1.bytesToHex)(msg));const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,signature=await(await this.NATIVE).ed25519Sign(roomUuid,this.URL,secretShare,msg,Array.from(derivationPath));return(0,utils_1.hexToBytes)(signature)}async refresh(roomUuid,keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,refreshedKeygenResult=await(await this.NATIVE).ed25519Refresh(roomUuid,this.URL,secretShare);if(!refreshedKeygenResult.pubkey||!refreshedKeygenResult.secret_share)throw new Error("Keygen failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(refreshedKeygenResult.pubkey),secretShareHex=refreshedKeygenResult.secret_share;return new _1.Ed25519KeygenResult(pubkey,secretShareHex)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).ed25519ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.Ed25519KeygenResult(pubkey,secretShareHex)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,resharedKeygenResult=await(await this.NATIVE).ed25519ReshareRemainingParty(roomUuid,this.URL,newThreshold,secretShare,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.Ed25519KeygenResult(pubkey,secretShareHex)}async derivePubkey(keygenResult,derivationPath=new Uint32Array){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,pubkey=await(await this.NATIVE).ed25519DerivePubkey(secretShare,Array.from(derivationPath));return(0,utils_1.hexToBytes)(pubkey)}async getSpub(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).ed25519GetSpub(secretShare)}async derivePubkeyFromSpub(spub,derivation){const pubkey=await(await this.NATIVE).ed25519DerivePubkeyFromSpub(spub,Array.from(derivation));return(0,utils_1.hexToBytes)(pubkey)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,exported=await(await this.NATIVE).ed25519ExportFullPrivateKey(roomUuid,this.URL,secretShare,toExportID);return exported||void 0}async derivePrivateKeyFromSpriv(spriv,derivationPath=new Uint32Array){return(await this.NATIVE).ed25519DerivePrivateKeyFromSpriv(spriv,Array.from(derivationPath))}async offlineExportFullPrivateKey(keygenResults){const secretShares=keygenResults.map(k=>{if("string"==typeof k)return k;if(k instanceof _1.Ed25519KeygenResult)return k.secretShare;throw"UnknownType"});return(await this.NATIVE).ed25519OfflineExportFullPrivateKey(secretShares)}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).ed25519ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.Ed25519KeygenResult(pubkey,secretShareHex)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).ed25519ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.Ed25519KeygenResult(pubkey,secretShareHex)}}exports.Ed25519=Ed25519;
@@ -1 +1 @@
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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExportableEd25519=void 0;const _1=require("./index.cjs"),utils_1=require("@noble/hashes/utils"),common_1=require("./common.cjs");class ExportableEd25519{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new _1.ExportableEd25519InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).exportableEd25519GetExportID(secretShare)}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async sampleKey(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).exportableEd25519SampleKey(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);if(!keygenResult.pubkey||!keygenResult.secret_share)throw new Error("Key sampling failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(keygenResult.pubkey),secretShareHex=keygenResult.secret_share;return new _1.ExportableEd25519KeygenResult(pubkey,secretShareHex)}async receiveKey(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).exportableEd25519ReceiveKey(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);if(!keygenResult.pubkey||!keygenResult.secret_share)throw new Error("Key receive failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(keygenResult.pubkey),secretShareHex=keygenResult.secret_share;return new _1.ExportableEd25519KeygenResult(pubkey,secretShareHex)}async sign(roomUuid,keygenResult,msg){"string"!=typeof msg&&(msg=(0,utils_1.bytesToHex)(msg));const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,signature=await(await this.NATIVE).exportableEd25519Sign(roomUuid,this.URL,secretShare,msg);return(0,utils_1.hexToBytes)(signature)}async refresh(roomUuid,keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,refreshedKeygenResult=await(await this.NATIVE).exportableEd25519Refresh(roomUuid,this.URL,secretShare);if(!refreshedKeygenResult.pubkey||!refreshedKeygenResult.secret_share)throw new Error("Keygen failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(refreshedKeygenResult.pubkey),secretShareHex=refreshedKeygenResult.secret_share;return new _1.ExportableEd25519KeygenResult(pubkey,secretShareHex)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).exportableEd25519ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.ExportableEd25519KeygenResult(pubkey,secretShareHex)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,resharedKeygenResult=await(await this.NATIVE).exportableEd25519ReshareRemainingParty(roomUuid,this.URL,newThreshold,secretShare,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.ExportableEd25519KeygenResult(pubkey,secretShareHex)}async getPrivateKey(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).exportableEd25519GetPubkey(secretShare)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,exported=await(await this.NATIVE).exportableEd25519ExportFullPrivateKey(roomUuid,this.URL,secretShare,toExportID);return exported||void 0}async offlineExportFullPrivateKey(keygenResults){const secretShares=keygenResults.map(k=>{if("string"==typeof k)return k;if(k instanceof _1.ExportableEd25519KeygenResult)return k.secretShare;throw new Error("UnknownType")});return(await this.NATIVE).exportableEd25519OfflineExportFullPrivateKey(secretShares)}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).exportableEd25519ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.ExportableEd25519KeygenResult(pubkey,secretShareHex)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).exportableEd25519ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.ExportableEd25519KeygenResult(pubkey,secretShareHex)}async getPubkey(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).exportableEd25519GetPubkey(secretShare)}}exports.ExportableEd25519=ExportableEd25519;
@@ -1 +1 @@
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",{value:types_1.EcdsaInitKeygenResult}),Object.defineProperty(exports,"EcdsaKeygenResult",{value:types_1.EcdsaKeygenResult}),Object.defineProperty(exports,"EcdsaPublicKey",{value:types_1.EcdsaPublicKey}),Object.defineProperty(exports,"EcdsaSignature",{value:types_1.EcdsaSignature}),Object.defineProperty(exports,"Ed25519InitKeygenResult",{value:types_1.Ed25519InitKeygenResult}),Object.defineProperty(exports,"Ed25519KeygenResult",{value:types_1.Ed25519KeygenResult}),Object.defineProperty(exports,"ExportableEd25519InitKeygenResult",{value:types_1.ExportableEd25519InitKeygenResult}),Object.defineProperty(exports,"ExportableEd25519KeygenResult",{value:types_1.ExportableEd25519KeygenResult}),Object.defineProperty(exports,"Sr25519InitKeygenResult",{value:types_1.Sr25519InitKeygenResult}),Object.defineProperty(exports,"Sr25519KeygenResult",{value:types_1.Sr25519KeygenResult}),Object.defineProperty(exports,"BIP340InitKeygenResult",{value:types_1.BIP340InitKeygenResult}),Object.defineProperty(exports,"BIP340KeygenResult",{value:types_1.BIP340KeygenResult}),Object.defineProperty(exports,"MessageHash",{value:types_1.MessageHash}),require("./ecdsa")),ed25519_1=(Object.defineProperty(exports,"Ecdsa",{value:ecdsa_1.Ecdsa}),require("./ed25519")),ed25519_exportable_1=(Object.defineProperty(exports,"Ed25519",{value:ed25519_1.Ed25519}),require("./ed25519_exportable")),sr25519_1=(Object.defineProperty(exports,"ExportableEd25519",{value:ed25519_exportable_1.ExportableEd25519}),require("./sr25519")),bip340_1=(Object.defineProperty(exports,"Sr25519",{value:sr25519_1.Sr25519}),require("./bip340"));Object.defineProperty(exports,"BIP340",{value:bip340_1.BIP340});
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;const types_1=require("./types.cjs"),ecdsa_1=(Object.defineProperty(exports,"EcdsaInitKeygenResult",{value:types_1.EcdsaInitKeygenResult}),Object.defineProperty(exports,"EcdsaKeygenResult",{value:types_1.EcdsaKeygenResult}),Object.defineProperty(exports,"EcdsaPublicKey",{value:types_1.EcdsaPublicKey}),Object.defineProperty(exports,"EcdsaSignature",{value:types_1.EcdsaSignature}),Object.defineProperty(exports,"Ed25519InitKeygenResult",{value:types_1.Ed25519InitKeygenResult}),Object.defineProperty(exports,"Ed25519KeygenResult",{value:types_1.Ed25519KeygenResult}),Object.defineProperty(exports,"ExportableEd25519InitKeygenResult",{value:types_1.ExportableEd25519InitKeygenResult}),Object.defineProperty(exports,"ExportableEd25519KeygenResult",{value:types_1.ExportableEd25519KeygenResult}),Object.defineProperty(exports,"Sr25519InitKeygenResult",{value:types_1.Sr25519InitKeygenResult}),Object.defineProperty(exports,"Sr25519KeygenResult",{value:types_1.Sr25519KeygenResult}),Object.defineProperty(exports,"BIP340InitKeygenResult",{value:types_1.BIP340InitKeygenResult}),Object.defineProperty(exports,"BIP340KeygenResult",{value:types_1.BIP340KeygenResult}),Object.defineProperty(exports,"MessageHash",{value:types_1.MessageHash}),require("./ecdsa.cjs")),ed25519_1=(Object.defineProperty(exports,"Ecdsa",{value:ecdsa_1.Ecdsa}),require("./ed25519.cjs")),ed25519_exportable_1=(Object.defineProperty(exports,"Ed25519",{value:ed25519_1.Ed25519}),require("./ed25519_exportable.cjs")),sr25519_1=(Object.defineProperty(exports,"ExportableEd25519",{value:ed25519_exportable_1.ExportableEd25519}),require("./sr25519.cjs")),bip340_1=(Object.defineProperty(exports,"Sr25519",{value:sr25519_1.Sr25519}),require("./bip340.cjs"));Object.defineProperty(exports,"BIP340",{value:bip340_1.BIP340});
@@ -1 +1 @@
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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sr25519=void 0;const _1=require("./index.cjs"),utils_1=require("@noble/hashes/utils"),common_1=require("./common.cjs");class Sr25519{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new _1.Sr25519InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare;return(await this.NATIVE).sr25519GetExportID(secretShare)}async createRoom(numParties,apiKey){return(0,common_1.sanitizeNumberOfParties)(numParties),(await this.NATIVE).createRoom(this.URL,numParties,apiKey)}async keygen(roomUuid,numParties,threshold,keygenInit,keygenIds){if((0,common_1.sanitizeNumberOfParties)(numParties,threshold),keygenIds.length!==numParties-1)throw new Error(`keygenIds length must be exactly: ${numParties-1}, it is: `+keygenIds.length);const keygenResult=await(await this.NATIVE).sr25519Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);if(!keygenResult.pubkey||!keygenResult.secret_share)throw new Error("Keygen failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(keygenResult.pubkey),secretShareHex=keygenResult.secret_share;return new _1.Sr25519KeygenResult(pubkey,secretShareHex)}async sign(roomUuid,keygenResult,msg,derivationPath=[]){"string"!=typeof msg&&(msg=(0,utils_1.bytesToHex)(msg));const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,signature=await(await this.NATIVE).sr25519Sign(roomUuid,this.URL,secretShare,msg,Array.from(derivationPath));return(0,utils_1.hexToBytes)(signature)}async refresh(roomUuid,keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,refreshedKeygenResult=await(await this.NATIVE).sr25519Refresh(roomUuid,this.URL,secretShare);if(!refreshedKeygenResult.pubkey||!refreshedKeygenResult.secret_share)throw new Error("Keygen failed, no public key or secret share was returned.");const pubkey=(0,utils_1.hexToBytes)(refreshedKeygenResult.pubkey),secretShareHex=refreshedKeygenResult.secret_share;return new _1.Sr25519KeygenResult(pubkey,secretShareHex)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).sr25519ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.Sr25519KeygenResult(pubkey,secretShareHex)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,resharedKeygenResult=await(await this.NATIVE).sr25519ReshareRemainingParty(roomUuid,this.URL,newThreshold,secretShare,keygenIds),pubkey=(0,utils_1.hexToBytes)(resharedKeygenResult.pubkey),secretShareHex=resharedKeygenResult.secret_share;return new _1.Sr25519KeygenResult(pubkey,secretShareHex)}async derivePubkey(keygenResult,derivationPath=[]){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,derivedPubkey=await(await this.NATIVE).sr25519DerivePubkey(secretShare,Array.from(derivationPath));return(0,utils_1.hexToBytes)(derivedPubkey)}async getPubkey(keygenResult){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,pubKey=await(await this.NATIVE).sr25519GetPubkey(secretShare);return(0,utils_1.hexToBytes)(pubKey)}async derivePubkeyFromPubkey(pubkey,derivation){const derivedPubkey=await(await this.NATIVE).sr25519DerivePubkeyFromPubkey((0,utils_1.bytesToHex)(pubkey),Array.from(derivation));return(0,utils_1.hexToBytes)(derivedPubkey)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const secretShare="string"==typeof keygenResult?keygenResult:keygenResult.secretShare,exported=await(await this.NATIVE).sr25519ExportFullPrivateKey(roomUuid,this.URL,secretShare,toExportID);return exported||void 0}async derivePrivateKeyFromPrivateKey(privkey,isPrivateKeyRaw,derivationPath=[]){return(await this.NATIVE).sr25519DerivePrivateKeyFromPrivateKey(privkey,Array.from(derivationPath),isPrivateKeyRaw)}async offlineExportFullPrivateKey(keygenResults){const secretShares=keygenResults.map(k=>{if("string"==typeof k)return k;if(k instanceof _1.Sr25519KeygenResult)return k.secretShare;throw"UnknownType"});return(await this.NATIVE).sr25519OfflineExportFullPrivateKey(secretShares)}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).sr25519ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.Sr25519KeygenResult(pubkey,secretShareHex)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).sr25519ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.Sr25519KeygenResult(pubkey,secretShareHex)}}exports.Sr25519=Sr25519;
@@ -1 +1 @@
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;
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;const utils_1=require("@noble/hashes/utils"),sha3_1=require("@noble/hashes/sha3"),sha256_1=require("@noble/hashes/sha256");class MessageHash{constructor(bytes){if(this.bytes=new Uint8Array,"string"==typeof bytes){if(bytes.length!==2*MessageHash.LENGTH)throw new Error("Invalid length for MessageHash: "+bytes.length);this.bytes=(0,utils_1.hexToBytes)(bytes)}else{if(bytes.length!==MessageHash.LENGTH)throw new Error("Invalid length for MessageHash: "+bytes.length);this.bytes=bytes}}static sha256(message){return new MessageHash((0,sha256_1.sha256)(message))}static sha256d(message){return new MessageHash((0,sha256_1.sha256)((0,sha256_1.sha256)(message)))}static keccak256(message){return new MessageHash((0,sha3_1.keccak_256)(message))}toHex(){return(0,utils_1.bytesToHex)(this.bytes)}}exports.MessageHash=MessageHash,MessageHash.LENGTH=32;class EcdsaPublicKey{constructor(pubkey){if("string"==typeof pubkey&&(pubkey=(0,utils_1.hexToBytes)(pubkey)),pubkey.length===EcdsaPublicKey.LENGTH+1)this.pubkey=pubkey.slice(1);else{if(pubkey.length!==EcdsaPublicKey.LENGTH)throw new RangeError(`Invalid ${this.constructor.name} length, expected: ${EcdsaPublicKey.LENGTH} bytes, found: `+pubkey.length);this.pubkey=pubkey}}serializeUncompressed(){return new Uint8Array([4,...this.pubkey])}serializeCompressed(){const isOdd=1&this.pubkey[63];return new Uint8Array([2+isOdd,...this.pubkey.slice(0,32)])}pubKeyAsHex(){return(0,utils_1.bytesToHex)(this.serializeUncompressed())}}exports.EcdsaPublicKey=EcdsaPublicKey,EcdsaPublicKey.LENGTH=64;class EcdsaKeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}exports.EcdsaKeygenResult=EcdsaKeygenResult;class EcdsaInitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}exports.EcdsaInitKeygenResult=EcdsaInitKeygenResult;class Ed25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}exports.Ed25519KeygenResult=Ed25519KeygenResult;class Ed25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}exports.Ed25519InitKeygenResult=Ed25519InitKeygenResult;class Sr25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}exports.Sr25519KeygenResult=Sr25519KeygenResult;class ExportableEd25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}exports.ExportableEd25519KeygenResult=ExportableEd25519KeygenResult;class ExportableEd25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}exports.ExportableEd25519InitKeygenResult=ExportableEd25519InitKeygenResult;class Sr25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}exports.Sr25519InitKeygenResult=Sr25519InitKeygenResult;class EcdsaSignature{static fromBuffer(expandedSignature){"string"==typeof expandedSignature&&(expandedSignature=(0,utils_1.hexToBytes)(expandedSignature));const maxSize=2*EcdsaSignature.FIELD_SIZE+EcdsaSignature.MAX_DER_LEN+1,minSize=2*EcdsaSignature.FIELD_SIZE+EcdsaSignature.MIN_DER_LEN+1;if(expandedSignature.length<minSize||expandedSignature.length>maxSize)throw new RangeError(`Invalid ${this.constructor.name} length, expected between ${minSize}..${maxSize} bytes, found: `+expandedSignature.length);const r=expandedSignature.subarray(0,EcdsaSignature.FIELD_SIZE),s=expandedSignature.subarray(EcdsaSignature.FIELD_SIZE,2*EcdsaSignature.FIELD_SIZE),v=expandedSignature[2*EcdsaSignature.FIELD_SIZE],der=expandedSignature.subarray(2*EcdsaSignature.FIELD_SIZE+1);return new EcdsaSignature(r,s,v,der)}constructor(r,s,v,DERencoding){if(s.length!==EcdsaSignature.FIELD_SIZE)throw new RangeError(`Invalid 's' length, expected: ${EcdsaSignature.FIELD_SIZE} found: `+s.length);if(r.length!==EcdsaSignature.FIELD_SIZE)throw new RangeError(`Invalid 'r' length, expected: ${EcdsaSignature.FIELD_SIZE} found: `+r.length);if(!Number.isInteger(v)||v<27||30<v)throw new RangeError("Invalid 'v' value, expected 27/28/29/30 found: "+v);if(DERencoding.length<EcdsaSignature.MIN_DER_LEN||DERencoding.length>EcdsaSignature.MAX_DER_LEN)throw new RangeError(`Invalid DER encoding, expected length: ${EcdsaSignature.MIN_DER_LEN}..${EcdsaSignature.MAX_DER_LEN} found: `+DERencoding.length);this.r=r,this.s=s,this.v=v,this.der=DERencoding}}exports.EcdsaSignature=EcdsaSignature,EcdsaSignature.FIELD_SIZE=32,EcdsaSignature.MAX_DER_LEN=72,EcdsaSignature.MIN_DER_LEN=8;class BIP340KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}exports.BIP340KeygenResult=BIP340KeygenResult;class BIP340InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}exports.BIP340InitKeygenResult=BIP340InitKeygenResult;
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sr25519=exports.BIP340=exports.ExportableEd25519=exports.Ed25519=exports.Ecdsa=exports.BIP340InitKeygenResult=exports.BIP340KeygenResult=exports.Sr25519InitKeygenResult=exports.ExportableEd25519InitKeygenResult=exports.ExportableEd25519KeygenResult=exports.Ed25519InitKeygenResult=exports.EcdsaInitKeygenResult=exports.MessageHash=exports.Sr25519KeygenResult=exports.Ed25519KeygenResult=exports.EcdsaSignature=exports.EcdsaPublicKey=exports.EcdsaKeygenResult=void 0;let lib_mpc_internal_1=require("../core"),native_1=(Object.defineProperty(exports,"EcdsaInitKeygenResult",{value:lib_mpc_internal_1.EcdsaInitKeygenResult}),Object.defineProperty(exports,"EcdsaKeygenResult",{value:lib_mpc_internal_1.EcdsaKeygenResult}),Object.defineProperty(exports,"EcdsaPublicKey",{value:lib_mpc_internal_1.EcdsaPublicKey}),Object.defineProperty(exports,"EcdsaSignature",{value:lib_mpc_internal_1.EcdsaSignature}),Object.defineProperty(exports,"Ed25519InitKeygenResult",{value:lib_mpc_internal_1.Ed25519InitKeygenResult}),Object.defineProperty(exports,"Ed25519KeygenResult",{value:lib_mpc_internal_1.Ed25519KeygenResult}),Object.defineProperty(exports,"ExportableEd25519InitKeygenResult",{value:lib_mpc_internal_1.ExportableEd25519InitKeygenResult}),Object.defineProperty(exports,"ExportableEd25519KeygenResult",{value:lib_mpc_internal_1.ExportableEd25519KeygenResult}),Object.defineProperty(exports,"Sr25519InitKeygenResult",{value:lib_mpc_internal_1.Sr25519InitKeygenResult}),Object.defineProperty(exports,"Sr25519KeygenResult",{value:lib_mpc_internal_1.Sr25519KeygenResult}),Object.defineProperty(exports,"BIP340KeygenResult",{value:lib_mpc_internal_1.BIP340KeygenResult}),Object.defineProperty(exports,"BIP340InitKeygenResult",{value:lib_mpc_internal_1.BIP340InitKeygenResult}),Object.defineProperty(exports,"MessageHash",{value:lib_mpc_internal_1.MessageHash}),require("./native")),DEFAULT_RELAY_URL="relay.dynamicauth.com";class Ecdsa extends lib_mpc_internal_1.Ecdsa{constructor(e){super(Promise.resolve(native_1.NodeNativeSdk),e||DEFAULT_RELAY_URL)}}exports.Ecdsa=Ecdsa;class Ed25519 extends lib_mpc_internal_1.Ed25519{constructor(e){super(Promise.resolve(native_1.NodeNativeSdk),e||DEFAULT_RELAY_URL)}}exports.Ed25519=Ed25519;class ExportableEd25519 extends lib_mpc_internal_1.ExportableEd25519{constructor(e){super(Promise.resolve(native_1.NodeNativeSdk),e||DEFAULT_RELAY_URL)}}exports.ExportableEd25519=ExportableEd25519;class BIP340 extends lib_mpc_internal_1.BIP340{constructor(e){super(Promise.resolve(native_1.NodeNativeSdk),e||DEFAULT_RELAY_URL)}}exports.BIP340=BIP340;class Sr25519 extends lib_mpc_internal_1.Sr25519{constructor(e){super(Promise.resolve(native_1.NodeNativeSdk),e||DEFAULT_RELAY_URL)}}exports.Sr25519=Sr25519;
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sr25519=exports.BIP340=exports.ExportableEd25519=exports.Ed25519=exports.Ecdsa=exports.BIP340InitKeygenResult=exports.BIP340KeygenResult=exports.Sr25519InitKeygenResult=exports.ExportableEd25519InitKeygenResult=exports.ExportableEd25519KeygenResult=exports.Ed25519InitKeygenResult=exports.EcdsaInitKeygenResult=exports.MessageHash=exports.Sr25519KeygenResult=exports.Ed25519KeygenResult=exports.EcdsaSignature=exports.EcdsaPublicKey=exports.EcdsaKeygenResult=void 0;const lib_mpc_internal_1=require("../core/index.cjs"),native_1=(Object.defineProperty(exports,"EcdsaInitKeygenResult",{value:lib_mpc_internal_1.EcdsaInitKeygenResult}),Object.defineProperty(exports,"EcdsaKeygenResult",{value:lib_mpc_internal_1.EcdsaKeygenResult}),Object.defineProperty(exports,"EcdsaPublicKey",{value:lib_mpc_internal_1.EcdsaPublicKey}),Object.defineProperty(exports,"EcdsaSignature",{value:lib_mpc_internal_1.EcdsaSignature}),Object.defineProperty(exports,"Ed25519InitKeygenResult",{value:lib_mpc_internal_1.Ed25519InitKeygenResult}),Object.defineProperty(exports,"Ed25519KeygenResult",{value:lib_mpc_internal_1.Ed25519KeygenResult}),Object.defineProperty(exports,"ExportableEd25519InitKeygenResult",{value:lib_mpc_internal_1.ExportableEd25519InitKeygenResult}),Object.defineProperty(exports,"ExportableEd25519KeygenResult",{value:lib_mpc_internal_1.ExportableEd25519KeygenResult}),Object.defineProperty(exports,"Sr25519InitKeygenResult",{value:lib_mpc_internal_1.Sr25519InitKeygenResult}),Object.defineProperty(exports,"Sr25519KeygenResult",{value:lib_mpc_internal_1.Sr25519KeygenResult}),Object.defineProperty(exports,"BIP340KeygenResult",{value:lib_mpc_internal_1.BIP340KeygenResult}),Object.defineProperty(exports,"BIP340InitKeygenResult",{value:lib_mpc_internal_1.BIP340InitKeygenResult}),Object.defineProperty(exports,"MessageHash",{value:lib_mpc_internal_1.MessageHash}),require("./native.cjs")),DEFAULT_RELAY_URL="relay.dynamicauth.com";class Ecdsa extends lib_mpc_internal_1.Ecdsa{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}exports.Ecdsa=Ecdsa;class Ed25519 extends lib_mpc_internal_1.Ed25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}exports.Ed25519=Ed25519;class ExportableEd25519 extends lib_mpc_internal_1.ExportableEd25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}exports.ExportableEd25519=ExportableEd25519;class BIP340 extends lib_mpc_internal_1.BIP340{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}exports.BIP340=BIP340;class Sr25519 extends lib_mpc_internal_1.Sr25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}exports.Sr25519=Sr25519;
@@ -1,4 +1,4 @@
1
- import { EcdsaInitKeygenResult, Ecdsa as EcdsaInternal, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519InitKeygenResult, Ed25519 as Ed25519Internal, Ed25519KeygenResult, ExportableEd25519InitKeygenResult, ExportableEd25519 as ExportableEd25519Internal, ExportableEd25519KeygenResult, Sr25519InitKeygenResult, Sr25519 as Sr25519Internal, Sr25519KeygenResult, BIP340KeygenResult, BIP340InitKeygenResult, BIP340 as BIP340Internal, MessageHash } from '../core';
1
+ import { EcdsaInitKeygenResult, Ecdsa as EcdsaInternal, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519InitKeygenResult, Ed25519 as Ed25519Internal, Ed25519KeygenResult, ExportableEd25519InitKeygenResult, ExportableEd25519 as ExportableEd25519Internal, ExportableEd25519KeygenResult, Sr25519InitKeygenResult, Sr25519 as Sr25519Internal, Sr25519KeygenResult, BIP340KeygenResult, BIP340InitKeygenResult, BIP340 as BIP340Internal, MessageHash } from '../core/index.d.ts';
2
2
  export { EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519KeygenResult, Sr25519KeygenResult, MessageHash, EcdsaInitKeygenResult, Ed25519InitKeygenResult, ExportableEd25519KeygenResult, ExportableEd25519InitKeygenResult, Sr25519InitKeygenResult, BIP340KeygenResult, BIP340InitKeygenResult, };
3
3
  export declare class Ecdsa extends EcdsaInternal {
4
4
  constructor(hostUrl?: string);
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.NodeNativeSdk=void 0;let target=currentTarget();function currentTarget(){switch(process.platform){case"darwin":switch(process.arch){case"x64":return"macos_x86_64";case"arm64":return"macos_arm64";default:throw new Error("Neon: unsupported macOS\\darwin architecture: "+process.arch)}case"linux":switch(process.arch){case"x64":return"linux_x86_64";case"arm64":return"linux_arm64";default:throw new Error("Neon: unsupported linux architecture: "+process.arch)}default:throw new Error(`Neon: unsupported system: ${process.platform}, only {darwin/linux} are supported}`)}}exports.NodeNativeSdk=require(`./native/libmpc_executor_${target}_nodejs.node`);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.NodeNativeSdk=void 0;const target=currentTarget();function currentTarget(){switch(process.platform){case"darwin":switch(process.arch){case"x64":return"macos_x86_64";case"arm64":return"macos_arm64";default:throw new Error("Neon: unsupported macOS\\darwin architecture: "+process.arch)}case"linux":switch(process.arch){case"x64":return"linux_x86_64";case"arm64":return"linux_arm64";default:throw new Error("Neon: unsupported linux architecture: "+process.arch)}default:throw new Error(`Neon: unsupported system: ${process.platform}, only {darwin/linux} are supported}`)}}exports.NodeNativeSdk=require(`./native/libmpc_executor_${target}_nodejs.node`);
@@ -1,2 +1,2 @@
1
- import { DynamicNativeSdkInterface } from '../core';
1
+ import { DynamicNativeSdkInterface } from '../core/index.d.ts';
2
2
  export declare const NodeNativeSdk: DynamicNativeSdkInterface;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node",
3
- "version": "0.0.201",
3
+ "version": "0.0.203",
4
4
  "license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/core": "0.0.201",
7
+ "@dynamic-labs-wallet/core": "0.0.203",
8
8
  "@dynamic-labs-wallet/forward-mpc-client": "0.1.3",
9
9
  "@dynamic-labs/logger": "^4.25.3",
10
10
  "@dynamic-labs/sdk-api-core": "^0.0.801",