@dynamic-labs-wallet/node 0.0.329 → 0.0.330

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;const _1=require("./index.cjs"),utils_1=require("@noble/hashes/utils"),common_1=require("./common.cjs");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=(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).bip340ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}}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");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=(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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 new Error("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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).bip340ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}}exports.BIP340=BIP340;
@@ -1 +1 @@
1
- import*as _1 from"./index.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";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=(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).bip340ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}}export{BIP340};
1
+ import*as _1 from"./index.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";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=(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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),(0,common_1.getHex32Bytes)(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 new Error("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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).bip340ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),pubkey=(0,utils_1.hexToBytes)(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.BIP340KeygenResult(pubkey,secretShareHex)}}export{BIP340};
@@ -1 +1 @@
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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).ecdsaImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),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
+ 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 new Error("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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).ecdsaImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),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
- import*as _1 from"./index.js";import*as common_1 from"./common.js";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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).ecdsaImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),pubkey=new _1.EcdsaPublicKey(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}getHostUrl(path){return path||this.URL}}export{Ecdsa};
1
+ import*as _1 from"./index.js";import*as common_1 from"./common.js";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 new Error("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,chaincode=new Uint8Array){const importKeygenResult=await(await this.NATIVE).ecdsaImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,(0,common_1.getHex32Bytes)(chaincode)),pubkey=new _1.EcdsaPublicKey(importKeygenResult.pubkey),secretShareHex=importKeygenResult.secret_share;return new _1.EcdsaKeygenResult(pubkey,secretShareHex)}getHostUrl(path){return path||this.URL}}export{Ecdsa};
@@ -1 +1 @@
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
+ 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 new Error("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
- import*as _1 from"./index.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";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)}}export{Ed25519};
1
+ import*as _1 from"./index.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";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 new Error("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)}}export{Ed25519};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.EdBls12377=void 0;const utils_1=require("@noble/hashes/utils"),types_1=require("./types.cjs"),common_1=require("./common.cjs");class EdBls12377{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new types_1.EdBls12377InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){return(await this.NATIVE).edBls12377GetExportID(getSecretShare(keygenResult))}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).edBls12377Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(keygenResult.compute_key,keygenResult.address,keygenResult.secret_share)}async signRequest(roomUuid,keygenResult,requestPayload){const requestPayloadJson=serializeRequestPayload(requestPayload),signedRequestJson=await(await this.NATIVE).edBls12377signRequest(roomUuid,this.URL,getSecretShare(keygenResult),requestPayloadJson);return deserializeSignedRequest(signedRequestJson)}async refresh(roomUuid,keygenResult){const refreshedKeygenResult=await(await this.NATIVE).edBls12377Refresh(roomUuid,this.URL,getSecretShare(keygenResult));return new types_1.EdBls12377KeygenResult(refreshedKeygenResult.compute_key,refreshedKeygenResult.address,refreshedKeygenResult.secret_share)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareRemainingParty(roomUuid,this.URL,newThreshold,getSecretShare(keygenResult),keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportFullPrivateKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async exportViewKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportViewKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async offlineExportFullPrivateKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportFullPrivateKey(serializeKeygenResults(keygenResults))}async offlineExportViewKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportViewKey(serializeKeygenResults(keygenResults))}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}}function getSecretShare(keygenResult){return"string"==typeof keygenResult?keygenResult:keygenResult.secretShare}function serializeKeygenResults(keygenResults){return keygenResults.map(result=>"string"==typeof result?result:result.secretShare)}function serializeRequestPayload(requestPayload){const serializedPayload={function_id:(0,utils_1.bytesToHex)(requestPayload.function_id),is_root:requestPayload.is_root,program_checksum:requestPayload.program_checksum?(0,utils_1.bytesToHex)(requestPayload.program_checksum):null,inputs:requestPayload.inputs.map(input=>"record"===input.type?{type:"record",h:(0,utils_1.bytesToHex)(input.h),tag:(0,utils_1.bytesToHex)(input.tag)}:{type:input.type,index:(0,utils_1.bytesToHex)(input.index),fields:input.fields.map(utils_1.bytesToHex)})};return JSON.stringify(serializedPayload)}function deserializeSignedRequest(signedRequestJson){let parsed;try{parsed=JSON.parse(signedRequestJson)}catch(_a){throw new Error("Invalid signed request JSON returned from native bindings.")}if(!parsed||"object"!=typeof parsed||Array.isArray(parsed))throw new Error("Invalid signed request JSON returned from native bindings.");const signedRequest=parsed;return{signer:deserializeBytes(signedRequest.signer,"signer"),signature:deserializeBytes(signedRequest.signature,"signature"),tvk:deserializeBytes(signedRequest.tvk,"tvk"),gammas:deserializeBytesArray(signedRequest.gammas,"gammas")}}function deserializeBytes(value,fieldName){if("string"!=typeof value)throw new TypeError(fieldName+" must be a hex string in the native response.");return(0,utils_1.hexToBytes)(value)}function deserializeBytesArray(value,fieldName){if(Array.isArray(value))return value.map((item,index)=>deserializeBytes(item,fieldName+`[${index}]`));throw new TypeError(fieldName+" must be an array in the native response.")}exports.EdBls12377=EdBls12377;
@@ -0,0 +1,21 @@
1
+ import type { DynamicNativeSdkInterface } from './native';
2
+ import { EdBls12377InitKeygenResult, EdBls12377KeygenResult, type EdBls12377RequestSignPayload, type EdBls12377SignedRequest } from './types';
3
+ export declare class EdBls12377 {
4
+ protected readonly NATIVE: Promise<DynamicNativeSdkInterface>;
5
+ protected readonly URL: string;
6
+ protected constructor(native: Promise<DynamicNativeSdkInterface>, url: string);
7
+ initKeygen(): Promise<EdBls12377InitKeygenResult>;
8
+ exportID(keygenResult: EdBls12377KeygenResult | string): Promise<string>;
9
+ createRoom(numParties: number, apiKey: string): Promise<string>;
10
+ keygen(roomUuid: string, numParties: number, threshold: number, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
11
+ signRequest(roomUuid: string, keygenResult: EdBls12377KeygenResult | string, requestPayload: EdBls12377RequestSignPayload): Promise<EdBls12377SignedRequest>;
12
+ refresh(roomUuid: string, keygenResult: EdBls12377KeygenResult | string): Promise<EdBls12377KeygenResult>;
13
+ reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
14
+ reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: EdBls12377KeygenResult | string, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
15
+ exportFullPrivateKey(roomUuid: string, keygenResult: EdBls12377KeygenResult | string, toExportID: string): Promise<string | undefined>;
16
+ exportViewKey(roomUuid: string, keygenResult: EdBls12377KeygenResult | string, toExportID: string): Promise<string | undefined>;
17
+ offlineExportFullPrivateKey(keygenResults: EdBls12377KeygenResult[] | string[]): Promise<string>;
18
+ offlineExportViewKey(keygenResults: EdBls12377KeygenResult[] | string[]): Promise<string>;
19
+ importPrivateKeyRecipient(roomUuid: string, threshold: number, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
20
+ importPrivateKeyImporter(roomUuid: string, threshold: number, privateKey: string, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[], isPrivateKeyRaw?: boolean): Promise<EdBls12377KeygenResult>;
21
+ }
@@ -0,0 +1 @@
1
+ import*as types_1 from"./types.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";class EdBls12377{constructor(native,url){this.NATIVE=native,this.URL=url}async initKeygen(){const keygenInitKeypair=await(await this.NATIVE).initKeygen();return new types_1.EdBls12377InitKeygenResult(keygenInitKeypair.pubkey,keygenInitKeypair.keypair)}async exportID(keygenResult){return(await this.NATIVE).edBls12377GetExportID(getSecretShare(keygenResult))}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).edBls12377Keygen(roomUuid,this.URL,numParties,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(keygenResult.compute_key,keygenResult.address,keygenResult.secret_share)}async signRequest(roomUuid,keygenResult,requestPayload){const requestPayloadJson=serializeRequestPayload(requestPayload),signedRequestJson=await(await this.NATIVE).edBls12377signRequest(roomUuid,this.URL,getSecretShare(keygenResult),requestPayloadJson);return deserializeSignedRequest(signedRequestJson)}async refresh(roomUuid,keygenResult){const refreshedKeygenResult=await(await this.NATIVE).edBls12377Refresh(roomUuid,this.URL,getSecretShare(keygenResult));return new types_1.EdBls12377KeygenResult(refreshedKeygenResult.compute_key,refreshedKeygenResult.address,refreshedKeygenResult.secret_share)}async reshareNewParty(roomUuid,oldThreshold,newThreshold,keygenInit,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareNewParty(roomUuid,this.URL,oldThreshold,newThreshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async reshareRemainingParty(roomUuid,newThreshold,keygenResult,keygenIds){const resharedKeygenResult=await(await this.NATIVE).edBls12377ReshareRemainingParty(roomUuid,this.URL,newThreshold,getSecretShare(keygenResult),keygenIds);return new types_1.EdBls12377KeygenResult(resharedKeygenResult.compute_key,resharedKeygenResult.address,resharedKeygenResult.secret_share)}async exportFullPrivateKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportFullPrivateKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async exportViewKey(roomUuid,keygenResult,toExportID){const exported=await(await this.NATIVE).edBls12377ExportViewKey(roomUuid,this.URL,getSecretShare(keygenResult),toExportID);return exported||void 0}async offlineExportFullPrivateKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportFullPrivateKey(serializeKeygenResults(keygenResults))}async offlineExportViewKey(keygenResults){return(await this.NATIVE).edBls12377OfflineExportViewKey(serializeKeygenResults(keygenResults))}async importPrivateKeyRecipient(roomUuid,threshold,keygenInit,keygenIds){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyRecipient(roomUuid,this.URL,threshold,keygenInit.keygenSecret,keygenIds);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}async importPrivateKeyImporter(roomUuid,threshold,privateKey,keygenInit,keygenIds,isPrivateKeyRaw=!1){const importKeygenResult=await(await this.NATIVE).edBls12377ImportPrivateKeyImporter(roomUuid,this.URL,threshold,privateKey,keygenInit.keygenSecret,keygenIds,isPrivateKeyRaw);return new types_1.EdBls12377KeygenResult(importKeygenResult.compute_key,importKeygenResult.address,importKeygenResult.secret_share)}}function getSecretShare(keygenResult){return"string"==typeof keygenResult?keygenResult:keygenResult.secretShare}function serializeKeygenResults(keygenResults){return keygenResults.map(result=>"string"==typeof result?result:result.secretShare)}function serializeRequestPayload(requestPayload){const serializedPayload={function_id:(0,utils_1.bytesToHex)(requestPayload.function_id),is_root:requestPayload.is_root,program_checksum:requestPayload.program_checksum?(0,utils_1.bytesToHex)(requestPayload.program_checksum):null,inputs:requestPayload.inputs.map(input=>"record"===input.type?{type:"record",h:(0,utils_1.bytesToHex)(input.h),tag:(0,utils_1.bytesToHex)(input.tag)}:{type:input.type,index:(0,utils_1.bytesToHex)(input.index),fields:input.fields.map(utils_1.bytesToHex)})};return JSON.stringify(serializedPayload)}function deserializeSignedRequest(signedRequestJson){let parsed;try{parsed=JSON.parse(signedRequestJson)}catch(_a){throw new Error("Invalid signed request JSON returned from native bindings.")}if(!parsed||"object"!=typeof parsed||Array.isArray(parsed))throw new Error("Invalid signed request JSON returned from native bindings.");const signedRequest=parsed;return{signer:deserializeBytes(signedRequest.signer,"signer"),signature:deserializeBytes(signedRequest.signature,"signature"),tvk:deserializeBytes(signedRequest.tvk,"tvk"),gammas:deserializeBytesArray(signedRequest.gammas,"gammas")}}function deserializeBytes(value,fieldName){if("string"!=typeof value)throw new TypeError(fieldName+" must be a hex string in the native response.");return(0,utils_1.hexToBytes)(value)}function deserializeBytesArray(value,fieldName){if(Array.isArray(value))return value.map((item,index)=>deserializeBytes(item,fieldName+`[${index}]`));throw new TypeError(fieldName+" must be an array in the native response.")}export{EdBls12377};
@@ -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;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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.EdBls12377=exports.BIP340=exports.Sr25519=exports.ExportableEd25519=exports.Ed25519=exports.Ecdsa=exports.MessageHash=exports.EdBls12377KeygenResult=exports.EdBls12377InitKeygenResult=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,"EdBls12377InitKeygenResult",{value:types_1.EdBls12377InitKeygenResult}),Object.defineProperty(exports,"EdBls12377KeygenResult",{value:types_1.EdBls12377KeygenResult}),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")),ed_bls12_377_1=(Object.defineProperty(exports,"BIP340",{value:bip340_1.BIP340}),require("./ed_bls12_377.cjs"));Object.defineProperty(exports,"EdBls12377",{value:ed_bls12_377_1.EdBls12377});
@@ -1,8 +1,9 @@
1
- import { EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519InitKeygenResult, Ed25519KeygenResult, ExportableEd25519InitKeygenResult, ExportableEd25519KeygenResult, Sr25519InitKeygenResult, Sr25519KeygenResult, BIP340InitKeygenResult, BIP340KeygenResult, MessageHash } from './types';
1
+ import { EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519InitKeygenResult, Ed25519KeygenResult, ExportableEd25519InitKeygenResult, ExportableEd25519KeygenResult, Sr25519InitKeygenResult, Sr25519KeygenResult, BIP340InitKeygenResult, BIP340KeygenResult, EdBls12377InitKeygenResult, EdBls12377KeygenResult, EdBls12377FieldElement, EdBls12377GroupElement, EdBls12377RequestInput, EdBls12377RequestSignPayload, EdBls12377SignedRequest, MessageHash } from './types';
2
2
  import { Ecdsa } from './ecdsa';
3
3
  import { Ed25519 } from './ed25519';
4
4
  import { ExportableEd25519 } from './ed25519_exportable';
5
5
  import { Sr25519 } from './sr25519';
6
6
  import { BIP340 } from './bip340';
7
+ import { EdBls12377 } from './ed_bls12_377';
7
8
  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, };
9
+ export { DynamicNativeSdkInterface, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519InitKeygenResult, Ed25519KeygenResult, ExportableEd25519InitKeygenResult, ExportableEd25519KeygenResult, Sr25519InitKeygenResult, Sr25519KeygenResult, BIP340InitKeygenResult, BIP340KeygenResult, EdBls12377InitKeygenResult, EdBls12377KeygenResult, EdBls12377FieldElement, EdBls12377GroupElement, EdBls12377RequestInput, EdBls12377RequestSignPayload, EdBls12377SignedRequest, MessageHash, Ecdsa, Ed25519, ExportableEd25519, Sr25519, BIP340, EdBls12377, };
@@ -1 +1 @@
1
- import*as types_1 from"./types.js";import*as ecdsa_1 from"./ecdsa.js";import*as ed25519_1 from"./ed25519.js";import*as ed25519_exportable_1 from"./ed25519_exportable.js";import*as sr25519_1 from"./sr25519.js";import*as bip340_1 from"./bip340.js";const EcdsaInitKeygenResult=types_1.EcdsaInitKeygenResult,EcdsaKeygenResult=types_1.EcdsaKeygenResult,EcdsaPublicKey=types_1.EcdsaPublicKey,EcdsaSignature=types_1.EcdsaSignature,Ed25519InitKeygenResult=types_1.Ed25519InitKeygenResult,Ed25519KeygenResult=types_1.Ed25519KeygenResult,ExportableEd25519InitKeygenResult=types_1.ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult=types_1.ExportableEd25519KeygenResult,Sr25519InitKeygenResult=types_1.Sr25519InitKeygenResult,Sr25519KeygenResult=types_1.Sr25519KeygenResult,BIP340InitKeygenResult=types_1.BIP340InitKeygenResult,BIP340KeygenResult=types_1.BIP340KeygenResult,MessageHash=types_1.MessageHash,Ecdsa=ecdsa_1.Ecdsa,Ed25519=ed25519_1.Ed25519,ExportableEd25519=ed25519_exportable_1.ExportableEd25519,Sr25519=sr25519_1.Sr25519,BIP340=bip340_1.BIP340;export{EcdsaInitKeygenResult,EcdsaKeygenResult,EcdsaPublicKey,EcdsaSignature,Ed25519InitKeygenResult,Ed25519KeygenResult,ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult,Sr25519InitKeygenResult,Sr25519KeygenResult,BIP340InitKeygenResult,BIP340KeygenResult,MessageHash,Ecdsa,Ed25519,ExportableEd25519,Sr25519,BIP340};
1
+ import*as types_1 from"./types.js";import*as ecdsa_1 from"./ecdsa.js";import*as ed25519_1 from"./ed25519.js";import*as ed25519_exportable_1 from"./ed25519_exportable.js";import*as sr25519_1 from"./sr25519.js";import*as bip340_1 from"./bip340.js";import*as ed_bls12_377_1 from"./ed_bls12_377.js";const EcdsaInitKeygenResult=types_1.EcdsaInitKeygenResult,EcdsaKeygenResult=types_1.EcdsaKeygenResult,EcdsaPublicKey=types_1.EcdsaPublicKey,EcdsaSignature=types_1.EcdsaSignature,Ed25519InitKeygenResult=types_1.Ed25519InitKeygenResult,Ed25519KeygenResult=types_1.Ed25519KeygenResult,ExportableEd25519InitKeygenResult=types_1.ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult=types_1.ExportableEd25519KeygenResult,Sr25519InitKeygenResult=types_1.Sr25519InitKeygenResult,Sr25519KeygenResult=types_1.Sr25519KeygenResult,BIP340InitKeygenResult=types_1.BIP340InitKeygenResult,BIP340KeygenResult=types_1.BIP340KeygenResult,EdBls12377InitKeygenResult=types_1.EdBls12377InitKeygenResult,EdBls12377KeygenResult=types_1.EdBls12377KeygenResult,MessageHash=types_1.MessageHash,Ecdsa=ecdsa_1.Ecdsa,Ed25519=ed25519_1.Ed25519,ExportableEd25519=ed25519_exportable_1.ExportableEd25519,Sr25519=sr25519_1.Sr25519,BIP340=bip340_1.BIP340,EdBls12377=ed_bls12_377_1.EdBls12377;export{EcdsaInitKeygenResult,EcdsaKeygenResult,EcdsaPublicKey,EcdsaSignature,Ed25519InitKeygenResult,Ed25519KeygenResult,ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult,Sr25519InitKeygenResult,Sr25519KeygenResult,BIP340InitKeygenResult,BIP340KeygenResult,EdBls12377InitKeygenResult,EdBls12377KeygenResult,MessageHash,Ecdsa,Ed25519,ExportableEd25519,Sr25519,BIP340,EdBls12377};
@@ -1,3 +1,8 @@
1
+ export interface EdBls12377NativeKeygenResult {
2
+ compute_key: string;
3
+ address: string;
4
+ secret_share: string;
5
+ }
1
6
  export interface DynamicNativeSdkInterface {
2
7
  initKeygen(): Promise<{
3
8
  pubkey: string;
@@ -133,6 +138,18 @@ export interface DynamicNativeSdkInterface {
133
138
  pubkey: string;
134
139
  secret_share: string;
135
140
  }>;
141
+ edBls12377GetExportID(secretShare: string): Promise<string>;
142
+ edBls12377Keygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
143
+ edBls12377signRequest(roomUUID: string, hostUrl: string, secretShare: string, requestPayload: string): Promise<string>;
144
+ edBls12377Refresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<EdBls12377NativeKeygenResult>;
145
+ edBls12377ReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
146
+ edBls12377ReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
147
+ edBls12377ExportFullPrivateKey(roomUUID: string, hostUrl: string, secretShare: string, toExportID: string): Promise<undefined | string>;
148
+ edBls12377ExportViewKey(roomUUID: string, hostUrl: string, secretShare: string, toExportID: string): Promise<undefined | string>;
149
+ edBls12377OfflineExportFullPrivateKey(keygenResults: string[]): Promise<string>;
150
+ edBls12377OfflineExportViewKey(keygenResults: string[]): Promise<string>;
151
+ edBls12377ImportPrivateKeyRecipient(roomUUID: string, hostUrl: string, threshold: number, secretShare: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
152
+ edBls12377ImportPrivateKeyImporter(roomUUID: string, hostUrl: string, threshold: number, privateKey: string, secretShare: string, keygenIDs: string[], isPrivateKeyRaw: boolean): Promise<EdBls12377NativeKeygenResult>;
136
153
  sr25519GetExportID(secretShare: string): Promise<string>;
137
154
  sr25519Keygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<{
138
155
  pubkey: string;
@@ -1 +1 @@
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
+ 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 new Error("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
- import*as _1 from"./index.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";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)}}export{Sr25519};
1
+ import*as _1 from"./index.js";import*as common_1 from"./common.js";import*as utils_1 from"@noble/hashes/utils";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 new Error("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)}}export{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;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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.EdBls12377InitKeygenResult=exports.EdBls12377KeygenResult=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;class EdBls12377KeygenResult{constructor(computeKey,address,secretShare){this.computeKey=computeKey,this.address=address,this.secretShare=secretShare}}exports.EdBls12377KeygenResult=EdBls12377KeygenResult;class EdBls12377InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}exports.EdBls12377InitKeygenResult=EdBls12377InitKeygenResult;
@@ -76,3 +76,39 @@ export declare class BIP340InitKeygenResult {
76
76
  keygenSecret: string;
77
77
  constructor(keygenId: string, keygenSecret: string);
78
78
  }
79
+ export type EdBls12377FieldElement = Uint8Array;
80
+ export type EdBls12377GroupElement = Uint8Array;
81
+ export interface EdBls12377SimpleRequestInput {
82
+ type: 'constant' | 'public' | 'private' | 'external_record';
83
+ index: EdBls12377FieldElement;
84
+ fields: EdBls12377FieldElement[];
85
+ }
86
+ export interface EdBls12377RecordRequestInput {
87
+ type: 'record';
88
+ h: EdBls12377GroupElement;
89
+ tag: EdBls12377FieldElement;
90
+ }
91
+ export type EdBls12377RequestInput = EdBls12377SimpleRequestInput | EdBls12377RecordRequestInput;
92
+ export interface EdBls12377RequestSignPayload {
93
+ function_id: EdBls12377FieldElement;
94
+ is_root: boolean;
95
+ program_checksum: EdBls12377FieldElement | null;
96
+ inputs: EdBls12377RequestInput[];
97
+ }
98
+ export interface EdBls12377SignedRequest {
99
+ signer: Uint8Array;
100
+ signature: Uint8Array;
101
+ tvk: EdBls12377FieldElement;
102
+ gammas: EdBls12377GroupElement[];
103
+ }
104
+ export declare class EdBls12377KeygenResult {
105
+ computeKey: string;
106
+ address: string;
107
+ secretShare: string;
108
+ constructor(computeKey: string, address: string, secretShare: string);
109
+ }
110
+ export declare class EdBls12377InitKeygenResult {
111
+ keygenId: string;
112
+ keygenSecret: string;
113
+ constructor(keygenId: string, keygenSecret: string);
114
+ }
@@ -1 +1 @@
1
- import*as utils_1 from"@noble/hashes/utils";import*as sha3_1 from"@noble/hashes/sha3";import*as sha256_1 from"@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)}}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())}}EcdsaPublicKey.LENGTH=64;class EcdsaKeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class EcdsaInitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}class Ed25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class Ed25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}class Sr25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class ExportableEd25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class ExportableEd25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}class Sr25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}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}}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}}class BIP340InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}export{MessageHash,EcdsaPublicKey,EcdsaKeygenResult,EcdsaInitKeygenResult,Ed25519KeygenResult,Ed25519InitKeygenResult,Sr25519KeygenResult,ExportableEd25519KeygenResult,ExportableEd25519InitKeygenResult,Sr25519InitKeygenResult,EcdsaSignature,BIP340KeygenResult,BIP340InitKeygenResult};
1
+ import*as utils_1 from"@noble/hashes/utils";import*as sha3_1 from"@noble/hashes/sha3";import*as sha256_1 from"@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)}}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())}}EcdsaPublicKey.LENGTH=64;class EcdsaKeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class EcdsaInitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}class Ed25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class Ed25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}class Sr25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class ExportableEd25519KeygenResult{constructor(pubkey,secretShare){this.pubkey=pubkey,this.secretShare=secretShare}}class ExportableEd25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}class Sr25519InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}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}}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}}class BIP340InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}class EdBls12377KeygenResult{constructor(computeKey,address,secretShare){this.computeKey=computeKey,this.address=address,this.secretShare=secretShare}}class EdBls12377InitKeygenResult{constructor(keygenId,keygenSecret){this.keygenId=keygenId,this.keygenSecret=keygenSecret}}export{MessageHash,EcdsaPublicKey,EcdsaKeygenResult,EcdsaInitKeygenResult,Ed25519KeygenResult,Ed25519InitKeygenResult,Sr25519KeygenResult,ExportableEd25519KeygenResult,ExportableEd25519InitKeygenResult,Sr25519InitKeygenResult,EcdsaSignature,BIP340KeygenResult,BIP340InitKeygenResult,EdBls12377KeygenResult,EdBls12377InitKeygenResult};
@@ -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;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
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sr25519=exports.EdBls12377=exports.BIP340=exports.ExportableEd25519=exports.Ed25519=exports.Ecdsa=exports.EdBls12377KeygenResult=exports.EdBls12377InitKeygenResult=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,"EdBls12377InitKeygenResult",{value:lib_mpc_internal_1.EdBls12377InitKeygenResult}),Object.defineProperty(exports,"EdBls12377KeygenResult",{value:lib_mpc_internal_1.EdBls12377KeygenResult}),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 EdBls12377 extends lib_mpc_internal_1.EdBls12377{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}exports.EdBls12377=EdBls12377;class Sr25519 extends lib_mpc_internal_1.Sr25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}exports.Sr25519=Sr25519;
@@ -1,5 +1,5 @@
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
- export { EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519KeygenResult, Sr25519KeygenResult, MessageHash, EcdsaInitKeygenResult, Ed25519InitKeygenResult, ExportableEd25519KeygenResult, ExportableEd25519InitKeygenResult, Sr25519InitKeygenResult, BIP340KeygenResult, BIP340InitKeygenResult, };
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, EdBls12377 as EdBls12377Internal, EdBls12377InitKeygenResult, EdBls12377KeygenResult, EdBls12377FieldElement, EdBls12377GroupElement, EdBls12377RequestInput, EdBls12377RequestSignPayload, EdBls12377SignedRequest, MessageHash } from '../core/index.d.ts';
2
+ export { EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519KeygenResult, Sr25519KeygenResult, MessageHash, EcdsaInitKeygenResult, Ed25519InitKeygenResult, ExportableEd25519KeygenResult, ExportableEd25519InitKeygenResult, Sr25519InitKeygenResult, BIP340KeygenResult, BIP340InitKeygenResult, EdBls12377InitKeygenResult, EdBls12377KeygenResult, EdBls12377FieldElement, EdBls12377GroupElement, EdBls12377RequestInput, EdBls12377RequestSignPayload, EdBls12377SignedRequest, };
3
3
  export declare class Ecdsa extends EcdsaInternal {
4
4
  constructor(hostUrl?: string);
5
5
  }
@@ -12,6 +12,9 @@ export declare class ExportableEd25519 extends ExportableEd25519Internal {
12
12
  export declare class BIP340 extends BIP340Internal {
13
13
  constructor(hostUrl?: string);
14
14
  }
15
+ export declare class EdBls12377 extends EdBls12377Internal {
16
+ constructor(hostUrl?: string);
17
+ }
15
18
  export declare class Sr25519 extends Sr25519Internal {
16
19
  constructor(hostUrl?: string);
17
20
  }
@@ -1 +1 @@
1
- import*as native_1 from"./native.js";import*as lib_mpc_internal_1 from"../core/index.cjs";const EcdsaInitKeygenResult=lib_mpc_internal_1.EcdsaInitKeygenResult,EcdsaKeygenResult=lib_mpc_internal_1.EcdsaKeygenResult,EcdsaPublicKey=lib_mpc_internal_1.EcdsaPublicKey,EcdsaSignature=lib_mpc_internal_1.EcdsaSignature,Ed25519InitKeygenResult=lib_mpc_internal_1.Ed25519InitKeygenResult,Ed25519KeygenResult=lib_mpc_internal_1.Ed25519KeygenResult,ExportableEd25519InitKeygenResult=lib_mpc_internal_1.ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult=lib_mpc_internal_1.ExportableEd25519KeygenResult,Sr25519InitKeygenResult=lib_mpc_internal_1.Sr25519InitKeygenResult,Sr25519KeygenResult=lib_mpc_internal_1.Sr25519KeygenResult,BIP340KeygenResult=lib_mpc_internal_1.BIP340KeygenResult,BIP340InitKeygenResult=lib_mpc_internal_1.BIP340InitKeygenResult,MessageHash=lib_mpc_internal_1.MessageHash,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)}}class Ed25519 extends lib_mpc_internal_1.Ed25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}class ExportableEd25519 extends lib_mpc_internal_1.ExportableEd25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}class BIP340 extends lib_mpc_internal_1.BIP340{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}class Sr25519 extends lib_mpc_internal_1.Sr25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}export{EcdsaInitKeygenResult,EcdsaKeygenResult,EcdsaPublicKey,EcdsaSignature,Ed25519InitKeygenResult,Ed25519KeygenResult,ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult,Sr25519InitKeygenResult,Sr25519KeygenResult,BIP340KeygenResult,BIP340InitKeygenResult,MessageHash,Ecdsa,Ed25519,ExportableEd25519,BIP340,Sr25519};
1
+ import*as native_1 from"./native.js";import*as lib_mpc_internal_1 from"../core/index.cjs";const EcdsaInitKeygenResult=lib_mpc_internal_1.EcdsaInitKeygenResult,EcdsaKeygenResult=lib_mpc_internal_1.EcdsaKeygenResult,EcdsaPublicKey=lib_mpc_internal_1.EcdsaPublicKey,EcdsaSignature=lib_mpc_internal_1.EcdsaSignature,Ed25519InitKeygenResult=lib_mpc_internal_1.Ed25519InitKeygenResult,Ed25519KeygenResult=lib_mpc_internal_1.Ed25519KeygenResult,ExportableEd25519InitKeygenResult=lib_mpc_internal_1.ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult=lib_mpc_internal_1.ExportableEd25519KeygenResult,Sr25519InitKeygenResult=lib_mpc_internal_1.Sr25519InitKeygenResult,Sr25519KeygenResult=lib_mpc_internal_1.Sr25519KeygenResult,BIP340KeygenResult=lib_mpc_internal_1.BIP340KeygenResult,BIP340InitKeygenResult=lib_mpc_internal_1.BIP340InitKeygenResult,EdBls12377InitKeygenResult=lib_mpc_internal_1.EdBls12377InitKeygenResult,EdBls12377KeygenResult=lib_mpc_internal_1.EdBls12377KeygenResult,MessageHash=lib_mpc_internal_1.MessageHash,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)}}class Ed25519 extends lib_mpc_internal_1.Ed25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}class ExportableEd25519 extends lib_mpc_internal_1.ExportableEd25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}class BIP340 extends lib_mpc_internal_1.BIP340{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}class EdBls12377 extends lib_mpc_internal_1.EdBls12377{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}class Sr25519 extends lib_mpc_internal_1.Sr25519{constructor(hostUrl){super(Promise.resolve(native_1.NodeNativeSdk),hostUrl||DEFAULT_RELAY_URL)}}export{EcdsaInitKeygenResult,EcdsaKeygenResult,EcdsaPublicKey,EcdsaSignature,Ed25519InitKeygenResult,Ed25519KeygenResult,ExportableEd25519InitKeygenResult,ExportableEd25519KeygenResult,Sr25519InitKeygenResult,Sr25519KeygenResult,BIP340KeygenResult,BIP340InitKeygenResult,EdBls12377InitKeygenResult,EdBls12377KeygenResult,MessageHash,Ecdsa,Ed25519,ExportableEd25519,BIP340,EdBls12377,Sr25519};
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node",
3
- "version": "0.0.329",
3
+ "version": "0.0.330",
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.329",
7
+ "@dynamic-labs-wallet/core": "0.0.330",
8
8
  "@dynamic-labs-wallet/forward-mpc-client": "0.7.0",
9
9
  "@dynamic-labs/logger": "^4.45.2",
10
- "@dynamic-labs/sdk-api-core": "^0.0.900",
10
+ "@dynamic-labs/sdk-api-core": "^0.0.964",
11
11
  "uuid": "11.1.0",
12
12
  "@noble/hashes": "1.7.1"
13
13
  },