@dynamic-labs-wallet/btc-utils 1.0.107 → 1.0.109
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.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;
|
|
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 signBytes(roomUuid,keygenResult,message){const messageHex=(0,utils_1.bytesToHex)(message);return(await this.NATIVE).edBls12377SignMessageBytes(roomUuid,this.URL,getSecretShare(keygenResult),messageHex)}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;
|
|
@@ -9,6 +9,7 @@ export declare class EdBls12377 {
|
|
|
9
9
|
createRoom(numParties: number, apiKey: string): Promise<string>;
|
|
10
10
|
keygen(roomUuid: string, numParties: number, threshold: number, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
|
|
11
11
|
signRequest(roomUuid: string, keygenResult: EdBls12377KeygenResult | string, requestPayload: EdBls12377RequestSignPayload): Promise<EdBls12377SignedRequest>;
|
|
12
|
+
signBytes(roomUuid: string, keygenResult: EdBls12377KeygenResult | string, message: Uint8Array): Promise<string>;
|
|
12
13
|
refresh(roomUuid: string, keygenResult: EdBls12377KeygenResult | string): Promise<EdBls12377KeygenResult>;
|
|
13
14
|
reshareNewParty(roomUuid: string, oldThreshold: number, newThreshold: number, keygenInit: EdBls12377InitKeygenResult, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
|
|
14
15
|
reshareRemainingParty(roomUuid: string, newThreshold: number, keygenResult: EdBls12377KeygenResult | string, keygenIds: string[]): Promise<EdBls12377KeygenResult>;
|
|
@@ -1 +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
|
+
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 signBytes(roomUuid,keygenResult,message){const messageHex=(0,utils_1.bytesToHex)(message);return(await this.NATIVE).edBls12377SignMessageBytes(roomUuid,this.URL,getSecretShare(keygenResult),messageHex)}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};
|
|
@@ -141,6 +141,7 @@ export interface DynamicNativeSdkInterface {
|
|
|
141
141
|
edBls12377GetExportID(secretShare: string): Promise<string>;
|
|
142
142
|
edBls12377Keygen(roomUUID: string, hostUrl: string, numParties: number, threshold: number, keygenSecret: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
|
|
143
143
|
edBls12377signRequest(roomUUID: string, hostUrl: string, secretShare: string, requestPayload: string): Promise<string>;
|
|
144
|
+
edBls12377SignMessageBytes(roomUUID: string, hostUrl: string, secretShare: string, messageHex: string): Promise<string>;
|
|
144
145
|
edBls12377Refresh(roomUUID: string, hostUrl: string, secretShare: string): Promise<EdBls12377NativeKeygenResult>;
|
|
145
146
|
edBls12377ReshareNewParty(roomUUID: string, hostUrl: string, oldThreshold: number, newThreshold: number, keygenSecret: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
|
|
146
147
|
edBls12377ReshareRemainingParty(roomUUID: string, hostUrl: string, newThreshold: number, secretShare: string, keygenIDs: string[]): Promise<EdBls12377NativeKeygenResult>;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/btc-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@dynamic-labs-wallet/core": "1.0.
|
|
8
|
+
"@dynamic-labs-wallet/core": "1.0.109",
|
|
9
9
|
"bitcoinjs-lib": "^7.0.0",
|
|
10
10
|
"bip322-js": "^3.0.0",
|
|
11
11
|
"@noble/hashes": "1.7.1",
|