@dfns/blockchain-integration
Advanced tools
Comparing version 2.4.4 to 2.5.0
@@ -0,2 +1,7 @@ | ||
import { ApiClient } from '../api-client/api-client'; | ||
export { SigningGroup } from "./SigningGroup"; | ||
export { SigningGroupNotInitializedError } from "./SigningGroupNotInitializedError"; | ||
export declare function createSigningGroup(t: number, n: number, apiClient: ApiClient, groupId?: string): Promise<{ | ||
groupId: string; | ||
walletId: string; | ||
}>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SigningGroupNotInitializedError = exports.SigningGroup = void 0; | ||
exports.createSigningGroup = exports.SigningGroupNotInitializedError = exports.SigningGroup = void 0; | ||
var SigningGroup_1 = require("./SigningGroup"); | ||
@@ -8,1 +8,8 @@ Object.defineProperty(exports, "SigningGroup", { enumerable: true, get: function () { return SigningGroup_1.SigningGroup; } }); | ||
Object.defineProperty(exports, "SigningGroupNotInitializedError", { enumerable: true, get: function () { return SigningGroupNotInitializedError_1.SigningGroupNotInitializedError; } }); | ||
async function createSigningGroup(t, n, apiClient, groupId = 'one') { | ||
const { data: { id: walletId } } = await apiClient.post(`groups/${groupId}/keygen`, { | ||
body: { parties: n.toString(), threshold: t.toString() }, | ||
}); | ||
return { groupId, walletId }; | ||
} | ||
exports.createSigningGroup = createSigningGroup; |
@@ -11,3 +11,3 @@ /// <reference types="node" /> | ||
getPublicKeyAsync(asHex: boolean): Promise<Buffer>; | ||
sign(hash: Buffer): Promise<any>; | ||
sign(message: Buffer): Promise<any>; | ||
} |
@@ -61,4 +61,4 @@ "use strict"; | ||
} | ||
async sign(hash) { | ||
const message = hash.toString("hex"); | ||
async sign(message) { | ||
// do not convert to string as JSON.stringify() converts it one more time | ||
const { data } = await __classPrivateFieldGet(this, _SigningGroup_api, "f").post(`groups/${__classPrivateFieldGet(this, _SigningGroup_groupId, "f")}/sign/${__classPrivateFieldGet(this, _SigningGroup_walletId, "f")}`, { | ||
@@ -65,0 +65,0 @@ body: { message }, |
{ | ||
"name": "@dfns/blockchain-integration", | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"description": "Blockchain integration Kit for DFNS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
19482
414