@toruslabs/torus.js
Advanced tools
Comparing version 13.0.0-alpha.4 to 13.0.0-alpha.5
import { Ecies } from "@toruslabs/eccrypto"; | ||
import { ec as EC } from "elliptic"; | ||
import { EciesHex, KeyType, LegacyVerifierLookupResponse, VerifierLookupResponse } from "../interfaces"; | ||
import { EciesHex, KeyType, VerifierLookupResponse } from "../interfaces"; | ||
export declare const ed25519Curve: EC; | ||
@@ -8,3 +8,2 @@ export declare const secp256k1Curve: EC; | ||
export declare const normalizeKeysResult: (result: VerifierLookupResponse) => Pick<VerifierLookupResponse, "keys" | "is_new_key">; | ||
export declare const normalizeLegacyKeysResult: (result: LegacyVerifierLookupResponse) => Pick<LegacyVerifierLookupResponse, "keys">; | ||
export declare const kCombinations: (s: number | number[], k: number) => number[][]; | ||
@@ -11,0 +10,0 @@ export declare const thresholdSame: <T>(arr: T[], t: number) => T | undefined; |
@@ -9,2 +9,3 @@ /// <reference types="node" /> | ||
export declare function decryptNodeData(eciesData: EciesHex, ciphertextHex: string, privKey: Buffer): Promise<Buffer>; | ||
export declare function decryptNodeDataWithPadding(eciesData: EciesHex, ciphertextHex: string, privKey: Buffer): Promise<Buffer>; | ||
export declare function generateMetadataParams(ecCurve: ec, serverTimeOffset: number, message: string, privateKey: BN): MetadataParams; | ||
@@ -11,0 +12,0 @@ export declare function getMetadata(legacyMetadataHost: string, data: Omit<MetadataParams, "set_data" | "signature">, options?: RequestInit): Promise<BN>; |
import { INodePub, TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
import { ec } from "elliptic"; | ||
import { ImportedShare, KeyAssignInput, KeyLookupResult, KeyType, LegacyKeyLookupResult, TorusKey, VerifierParams } from "../interfaces"; | ||
import { ImportedShare, KeyLookupResult, KeyType, TorusKey, VerifierParams } from "../interfaces"; | ||
export declare const GetPubKeyOrKeyAssign: (params: { | ||
@@ -32,4 +32,1 @@ endpoints: string[]; | ||
}): Promise<TorusKey>; | ||
export declare const legacyKeyLookup: (endpoints: string[], verifier: string, verifierId: string, keyType: KeyType) => Promise<LegacyKeyLookupResult>; | ||
export declare const legacyKeyAssign: ({ endpoints, torusNodePubs, lastPoint, firstPoint, verifier, verifierId, signerHost, network, clientId, keyType, }: KeyAssignInput) => Promise<void>; | ||
export declare const legacyWaitKeyLookup: (endpoints: string[], verifier: string, verifierId: string, keyType: KeyType, timeout: number) => Promise<LegacyKeyLookupResult>; |
@@ -1,2 +0,2 @@ | ||
import type { INodePub, TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
import type { TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
import { Ecies } from "@toruslabs/eccrypto"; | ||
@@ -91,7 +91,2 @@ import BN from "bn.js"; | ||
} | ||
export interface LegacyKeyLookupResult { | ||
keyResult: Pick<LegacyVerifierLookupResponse, "keys" | "server_time_offset">; | ||
errorResult: JRPCResponse<LegacyVerifierLookupResponse>["error"]; | ||
serverTimeOffset: number; | ||
} | ||
export interface KeyLookupResult { | ||
@@ -104,19 +99,2 @@ keyResult: Pick<VerifierLookupResponse, "keys" | "is_new_key">; | ||
} | ||
export interface SignerResponse { | ||
"torus-timestamp": string; | ||
"torus-nonce": string; | ||
"torus-signature": string; | ||
} | ||
export interface KeyAssignInput { | ||
endpoints: string[]; | ||
torusNodePubs: INodePub[]; | ||
lastPoint?: number; | ||
firstPoint?: number; | ||
verifier: string; | ||
verifierId: string; | ||
signerHost: string; | ||
network: string; | ||
clientId: string; | ||
keyType: KeyType; | ||
} | ||
export type EciesHex = { | ||
@@ -127,21 +105,11 @@ [key in keyof Ecies]: string; | ||
}; | ||
export interface LegacyKeyAssignment { | ||
Index: string; | ||
PublicKey: { | ||
X: string; | ||
Y: string; | ||
}; | ||
Threshold: string; | ||
Verifiers: Record<string, string>; | ||
Share: string; | ||
Metadata: { | ||
[key in keyof Ecies]: string; | ||
}; | ||
export interface ExtendedPublicKey { | ||
X: string; | ||
Y: string; | ||
SignerX: string; | ||
SignerY: string; | ||
} | ||
export interface KeyAssignment { | ||
index: KeyIndex; | ||
public_key: { | ||
X: string; | ||
Y: string; | ||
}; | ||
public_key: ExtendedPublicKey; | ||
threshold: string; | ||
@@ -153,6 +121,2 @@ node_index: string; | ||
} | ||
export interface LegacyShareRequestResult { | ||
keys: LegacyKeyAssignment[]; | ||
server_time_offset?: string; | ||
} | ||
export interface ShareRequestResult { | ||
@@ -222,2 +186,7 @@ keys: KeyAssignment[]; | ||
}; | ||
postboxKeyData: { | ||
X: string; | ||
Y: string; | ||
privKey: string; | ||
}; | ||
sessionData: { | ||
@@ -224,0 +193,0 @@ sessionTokenData: SessionToken[]; |
@@ -12,7 +12,5 @@ import { INodePub, TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
enableOneKey: boolean; | ||
private signerHost; | ||
private legacyMetadataHost; | ||
private keyType; | ||
constructor({ enableOneKey, clientId, network, serverTimeOffset, allowHost, legacyMetadataHost, keyType, }: TorusCtorOptions); | ||
get isLegacyNetwork(): boolean; | ||
static enableLogging(v?: boolean): void; | ||
@@ -35,3 +33,3 @@ static setAPIKey(apiKey: string): void; | ||
*/ | ||
getUserTypeAndAddress(endpoints: string[], torusNodePubs: INodePub[], { verifier, verifierId, extendedVerifierId }: { | ||
getUserTypeAndAddress(endpoints: string[], { verifier, verifierId, extendedVerifierId }: { | ||
verifier: string; | ||
@@ -41,4 +39,2 @@ verifierId: string; | ||
}): Promise<TorusPublicKey>; | ||
private legacyRetrieveShares; | ||
private getLegacyPublicAddress; | ||
private getNewPublicAddress; | ||
@@ -45,0 +41,0 @@ private formatLegacyPublicKeyData; |
{ | ||
"name": "@toruslabs/torus.js", | ||
"version": "13.0.0-alpha.4", | ||
"version": "13.0.0-alpha.5", | ||
"description": "Handle communication with torus nodes", | ||
@@ -26,5 +26,5 @@ "main": "dist/torusUtils.cjs.js", | ||
"dependencies": { | ||
"@toruslabs/constants": "^13.2.0", | ||
"@toruslabs/constants": "^13.4.0", | ||
"@toruslabs/eccrypto": "^4.0.0", | ||
"@toruslabs/http-helpers": "^6.1.0", | ||
"@toruslabs/http-helpers": "^6.1.1", | ||
"bn.js": "^5.2.1", | ||
@@ -39,8 +39,8 @@ "elliptic": "^6.5.5", | ||
"@babel/register": "^7.23.7", | ||
"@babel/runtime": "^7.24.0", | ||
"@babel/runtime": "^7.24.5", | ||
"@toruslabs/config": "^2.0.2", | ||
"@toruslabs/eslint-config-typescript": "^3.2.0", | ||
"@toruslabs/fetch-node-details": "^13.2.0", | ||
"@toruslabs/torus-scripts": "^5.3.0", | ||
"@types/chai": "^4.3.12", | ||
"@toruslabs/fetch-node-details": "^13.4.0", | ||
"@toruslabs/torus-scripts": "^5.3.1", | ||
"@types/chai": "^4.3.16", | ||
"@types/elliptic": "^6.4.18", | ||
@@ -60,3 +60,3 @@ "@types/faker": "^5.5.3", | ||
"lint-staged": "^15.2.2", | ||
"mocha": "^10.3.0", | ||
"mocha": "^10.4.0", | ||
"prettier": "^3.2.5", | ||
@@ -66,3 +66,3 @@ "rimraf": "^5.0.5", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.2" | ||
"typescript": "^5.4.5" | ||
}, | ||
@@ -69,0 +69,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
432975
4357