@dfns/blockchain-integration
Advanced tools
Comparing version 1.1.1 to 2.1.1
@@ -1,2 +0,2 @@ | ||
export { SigningGroup, createSigningGroup } from "./signing-group"; | ||
export { SigningGroup, createSigningGroup } from './SigningGroup'; | ||
export { SigningGroupNotInitializedError } from './SigningGroupNotInitializedError'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SigningGroupNotInitializedError = exports.createSigningGroup = exports.SigningGroup = void 0; | ||
var signing_group_1 = require("./signing-group"); | ||
Object.defineProperty(exports, "SigningGroup", { enumerable: true, get: function () { return signing_group_1.SigningGroup; } }); | ||
Object.defineProperty(exports, "createSigningGroup", { enumerable: true, get: function () { return signing_group_1.createSigningGroup; } }); | ||
var SigningGroup_1 = require("./SigningGroup"); | ||
Object.defineProperty(exports, "SigningGroup", { enumerable: true, get: function () { return SigningGroup_1.SigningGroup; } }); | ||
Object.defineProperty(exports, "createSigningGroup", { enumerable: true, get: function () { return SigningGroup_1.createSigningGroup; } }); | ||
var SigningGroupNotInitializedError_1 = require("./SigningGroupNotInitializedError"); | ||
Object.defineProperty(exports, "SigningGroupNotInitializedError", { enumerable: true, get: function () { return SigningGroupNotInitializedError_1.SigningGroupNotInitializedError; } }); |
/// <reference types="node" /> | ||
export declare class SigningGroup { | ||
#private; | ||
static create(groupId: string): Promise<SigningGroup>; | ||
constructor(groupId: string); | ||
@@ -5,0 +6,0 @@ init(): Promise<void>; |
@@ -23,3 +23,8 @@ "use strict"; | ||
const SigningGroupNotInitializedError_1 = require("./SigningGroupNotInitializedError"); | ||
const API_URL = process.env.SIGNING_API_URL || "http://api.xkey.ninja:8000/"; | ||
const DEFAULT_SIGNING_GROUP_API_URL = 'http://api.xkey.ninja:8000/'; | ||
let API_URL = process.env.SIGNING_API_URL; | ||
if (!API_URL) { | ||
console.warn(`SigningGroup: SIGNING_API_URL is not initialized, using default: ${DEFAULT_SIGNING_GROUP_API_URL}`); | ||
API_URL = DEFAULT_SIGNING_GROUP_API_URL; | ||
} | ||
class SigningGroup { | ||
@@ -34,2 +39,7 @@ constructor(groupId) { | ||
} | ||
static async create(groupId) { | ||
const signingGroup = new SigningGroup(groupId); | ||
await signingGroup.init(); | ||
return signingGroup; | ||
} | ||
async init() { | ||
@@ -55,3 +65,3 @@ __classPrivateFieldSet(this, _publicKeyAsHex, await this.getPublicKeyAsync(true)); | ||
headers: { | ||
Accept: "application/json", | ||
Accept: 'application/json', | ||
}, | ||
@@ -61,3 +71,3 @@ }); | ||
if (asHex) { | ||
return Buffer.from(key, "hex"); | ||
return Buffer.from(key, 'hex'); | ||
} | ||
@@ -69,9 +79,9 @@ else { | ||
async sign(hash) { | ||
const message = hash.toString("hex"); | ||
const message = hash.toString('hex'); | ||
const res = await node_fetch_1.default(`${API_URL}/sign/${__classPrivateFieldGet(this, _groupId)}`, { | ||
method: "POST", | ||
method: 'POST', | ||
body: JSON.stringify({ message }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
Accept: "application/json", | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json', | ||
}, | ||
@@ -86,7 +96,7 @@ }); | ||
const res = await node_fetch_1.default(`${API_URL}/start`, { | ||
method: "POST", | ||
body: JSON.stringify({ parties: "" + n, threshold: "" + t }), | ||
method: 'POST', | ||
body: JSON.stringify({ parties: '' + n, threshold: '' + t }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
Accept: "application/json", | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json', | ||
}, | ||
@@ -99,6 +109,6 @@ }); | ||
while (!key) { | ||
console.info("[int-kit] Sleeping..."); | ||
console.info('[int-kit] Sleeping...'); | ||
await sleep(2000); | ||
key = await signer.getPublicKeyAsync(false); | ||
console.info("[int-kit] KEY: ", key); | ||
console.info('[int-kit] KEY: ', key); | ||
} | ||
@@ -105,0 +115,0 @@ return group_id; |
{ | ||
"name": "@dfns/blockchain-integration", | ||
"version": "1.1.1", | ||
"description": "Blockchain integration Kit for DFNS", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"node_modules/**/*", | ||
"lib/**/*" | ||
], | ||
"scripts": { | ||
"clean": "rimraf ./dist", | ||
"build": "tsc", | ||
"test": "jest spec", | ||
"cleanBuild": "npm run clean && npm run build" | ||
}, | ||
"author": "", | ||
"license": "SEE LICENSE IN XKEY_LICENSE", | ||
"dependencies": { | ||
"lambda-router": "^2.10.0", | ||
"node-fetch": "^2.6.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node-fetch": "^2.5.10", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.4" | ||
} | ||
"name": "@dfns/blockchain-integration", | ||
"version": "2.1.1", | ||
"description": "Blockchain integration Kit for DFNS", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"node_modules/**/*", | ||
"lib/**/*" | ||
], | ||
"scripts": { | ||
"clean": "rimraf ./dist", | ||
"build": "tsc", | ||
"test": "jest spec", | ||
"cleanBuild": "npm run clean && npm run build" | ||
}, | ||
"author": "", | ||
"license": "SEE LICENSE IN XKEY_LICENSE", | ||
"dependencies": { | ||
"lambda-router": "^2.10.0", | ||
"node-fetch": "^2.6.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node-fetch": "^2.5.10", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.4" | ||
} | ||
} |
17476
22
401
3