@toruslabs/torus.js
Advanced tools
Comparing version 12.2.0 to 13.0.0-alpha.1
export declare const JRPC_METHODS: { | ||
GET_OR_SET_KEY: string; | ||
COMMITMENT_REQUEST: string; | ||
IMPORT_SHARE: string; | ||
IMPORT_SHARES: string; | ||
GET_SHARE_OR_KEY_ASSIGN: string; | ||
}; |
import { Ecies } from "@toruslabs/eccrypto"; | ||
import { EciesHex, LegacyVerifierLookupResponse, VerifierLookupResponse } from "../interfaces"; | ||
import { ec as EC } from "elliptic"; | ||
import { EciesHex, KeyType, LegacyVerifierLookupResponse, VerifierLookupResponse } from "../interfaces"; | ||
export declare const ed25519Curve: EC; | ||
export declare const secp256k1Curve: EC; | ||
export declare const getKeyCurve: (keyType: KeyType) => EC; | ||
export declare const normalizeKeysResult: (result: VerifierLookupResponse) => Pick<VerifierLookupResponse, "keys" | "is_new_key">; | ||
@@ -9,2 +13,3 @@ export declare const normalizeLegacyKeysResult: (result: LegacyVerifierLookupResponse) => Pick<LegacyVerifierLookupResponse, "keys">; | ||
export declare function encParamsHexToBuf(eciesData: Omit<EciesHex, "ciphertext">): Omit<Ecies, "ciphertext">; | ||
export declare function getProxyCoordinatorEndpointIndex(endpoints: string[], verifier: string, verifierId: string): number; | ||
export declare function calculateMedian(arr: number[]): number; |
/// <reference types="node" /> | ||
import { INodePub } from "@toruslabs/constants"; | ||
import BN from "bn.js"; | ||
import { ec } from "elliptic"; | ||
import { curve, ec as EC } from "elliptic"; | ||
import { ImportedShare, KeyType, PrivateKeyData } from "../interfaces"; | ||
export declare function keccak256(a: Buffer): string; | ||
export declare const generatePrivateKey: (ecCurve: EC, buf: typeof Buffer) => Buffer; | ||
export declare function stripHexPrefix(str: string): string; | ||
export declare function toChecksumAddress(hexAddress: string): string; | ||
export declare function generateAddressFromPrivKey(ecCurve: ec, privateKey: BN): string; | ||
export declare function generateAddressFromPubKey(ecCurve: ec, publicKeyX: BN, publicKeyY: BN): string; | ||
export declare function getPostboxKeyFrom1OutOf1(ecCurve: ec, privKey: string, nonce: string): string; | ||
/** Convenience method that creates public key and other stuff. RFC8032 5.1.5 */ | ||
export declare function getEd25519ExtendedPublicKey(keyHex: BN): { | ||
scalar: BN; | ||
point: curve.base.BasePoint; | ||
}; | ||
export declare const getSecpKeyFromEd25519: (ed25519Scalar: BN) => { | ||
scalar: BN; | ||
point: curve.base.BasePoint; | ||
}; | ||
export declare function encodeEd25519Point(point: curve.base.BasePoint): Buffer; | ||
export declare const generateEd25519KeyData: (ed25519Seed: BN) => Promise<PrivateKeyData>; | ||
export declare const generateSecp256k1KeyData: (scalar: BN) => Promise<PrivateKeyData>; | ||
export declare function generateAddressFromPrivKey(keyType: KeyType, privateKey: BN): string; | ||
export declare function generateAddressFromPubKey(keyType: KeyType, publicKeyX: BN, publicKeyY: BN): string; | ||
export declare function getPostboxKeyFrom1OutOf1(ecCurve: EC, privKey: string, nonce: string): string; | ||
export declare function derivePubKey(ecCurve: EC, sk: BN): curve.base.BasePoint; | ||
export declare const encryptionEC: EC; | ||
export declare const generateShares: (ecCurve: EC, keyType: KeyType, serverTimeOffset: number, nodeIndexes: number[], nodePubkeys: INodePub[], privKey: BN) => Promise<ImportedShare[]>; |
/// <reference types="node" /> | ||
import BN from "bn.js"; | ||
import { ec } from "elliptic"; | ||
import { EciesHex, GetOrSetNonceResult, MetadataParams } from "../interfaces"; | ||
import { EciesHex, GetOrSetNonceResult, KeyType, MetadataParams, NonceMetadataParams } from "../interfaces"; | ||
export declare function convertMetadataToNonce(params: { | ||
@@ -13,1 +13,3 @@ message?: string; | ||
export declare function getNonce(legacyMetadataHost: string, ecCurve: ec, serverTimeOffset: number, X: string, Y: string, privKey?: BN): Promise<GetOrSetNonceResult>; | ||
export declare function generateNonceMetadataParams(serverTimeOffset: number, operation: string, privateKey: BN, keyType: KeyType, nonce?: BN, seed?: string): NonceMetadataParams; | ||
export declare const decryptSeedData: (seedBase64: string, finalUserKey: BN) => Promise<Buffer>; |
@@ -1,4 +0,4 @@ | ||
import { TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
import { INodePub, TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
import { ec } from "elliptic"; | ||
import { ImportedShare, KeyAssignInput, KeyLookupResult, LegacyKeyLookupResult, TorusKey, VerifierParams } from "../interfaces"; | ||
import { ImportedShare, KeyAssignInput, KeyLookupResult, KeyType, LegacyKeyLookupResult, TorusKey, VerifierParams } from "../interfaces"; | ||
export declare const GetPubKeyOrKeyAssign: (params: { | ||
@@ -9,2 +9,3 @@ endpoints: string[]; | ||
verifierId: string; | ||
keyType: KeyType; | ||
extendedVerifierId?: string; | ||
@@ -17,2 +18,3 @@ }) => Promise<KeyLookupResult>; | ||
ecCurve: ec; | ||
keyType: KeyType; | ||
allowHost: string; | ||
@@ -22,10 +24,14 @@ network: string; | ||
endpoints: string[]; | ||
indexes: number[]; | ||
verifier: string; | ||
verifierParams: VerifierParams; | ||
idToken: string; | ||
importedShares?: ImportedShare[]; | ||
useDkg: boolean; | ||
overrideExistingKey: boolean; | ||
nodePubkeys: INodePub[]; | ||
newImportedShares?: ImportedShare[]; | ||
extraParams: Record<string, unknown>; | ||
}): Promise<TorusKey>; | ||
export declare const legacyKeyLookup: (endpoints: string[], verifier: string, verifierId: string) => Promise<LegacyKeyLookupResult>; | ||
export declare const legacyKeyAssign: ({ endpoints, torusNodePubs, lastPoint, firstPoint, verifier, verifierId, signerHost, network, clientId, }: KeyAssignInput) => Promise<void>; | ||
export declare const legacyWaitKeyLookup: (endpoints: string[], verifier: string, verifierId: string, timeout: number) => Promise<LegacyKeyLookupResult>; | ||
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>; |
import type { INodePub, TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
import { Ecies } from "@toruslabs/eccrypto"; | ||
import BN from "bn.js"; | ||
import { curve } from "elliptic"; | ||
export interface KeyIndex { | ||
@@ -13,2 +14,3 @@ index: string; | ||
nonce?: string; | ||
seed?: string; | ||
pubNonce: { | ||
@@ -24,7 +26,10 @@ x: string; | ||
nonce?: string; | ||
seed?: string; | ||
}; | ||
export type GetOrSetNonceResult = v2NonceResultType | v1NonceResultType; | ||
export type KeyType = "secp256k1" | "ed25519"; | ||
export interface SetNonceData { | ||
operation: string; | ||
data: string; | ||
seed?: string; | ||
timestamp: string; | ||
@@ -38,2 +43,4 @@ } | ||
signature: string; | ||
key_type?: KeyType; | ||
seed?: string; | ||
} | ||
@@ -43,2 +50,3 @@ export interface TorusCtorOptions { | ||
network: TORUS_NETWORK_TYPE; | ||
keyType?: KeyType; | ||
enableOneKey?: boolean; | ||
@@ -75,2 +83,3 @@ serverTimeOffset?: number; | ||
nodeindex: string; | ||
pub_key_x: string; | ||
} | ||
@@ -114,2 +123,3 @@ export interface JRPCResponse<T> { | ||
clientId: string; | ||
keyType: KeyType; | ||
} | ||
@@ -162,6 +172,10 @@ export type EciesHex = { | ||
export interface ImportedShare { | ||
pub_key_x: string; | ||
pub_key_y: string; | ||
oauth_pub_key_x: string; | ||
oauth_pub_key_y: string; | ||
final_user_point: curve.base.BasePoint; | ||
signing_pub_key_x: string; | ||
signing_pub_key_y: string; | ||
encrypted_share: string; | ||
encrypted_share_metadata: EciesHex; | ||
encrypted_seed?: string; | ||
node_index: number; | ||
@@ -181,3 +195,3 @@ key_type: string; | ||
finalKeyData: { | ||
evmAddress: string; | ||
walletAddress: string; | ||
X: string; | ||
@@ -187,3 +201,3 @@ Y: string; | ||
oAuthKeyData: { | ||
evmAddress: string; | ||
walletAddress: string; | ||
X: string; | ||
@@ -234,2 +248,3 @@ Y: string; | ||
pub_key_Y: string; | ||
key_type?: KeyType; | ||
set_data: { | ||
@@ -241,1 +256,17 @@ data: "getNonce" | "getOrSetNonce" | string; | ||
} | ||
export interface PrivateKeyData { | ||
oAuthKeyScalar: BN; | ||
oAuthPubX: BN; | ||
oAuthPubY: BN; | ||
SigningPubX: BN; | ||
SigningPubY: BN; | ||
metadataNonce: BN; | ||
encryptedSeed?: string; | ||
finalUserPubKeyPoint: curve.base.BasePoint; | ||
metadataSigningKey?: BN; | ||
} | ||
export interface EncryptedSeed { | ||
enc_text: string; | ||
public_key?: string; | ||
metadata: EciesHex; | ||
} |
@@ -14,3 +14,4 @@ import { INodePub, TORUS_NETWORK_TYPE } from "@toruslabs/constants"; | ||
private legacyMetadataHost; | ||
constructor({ enableOneKey, clientId, network, serverTimeOffset, allowHost, legacyMetadataHost }: TorusCtorOptions); | ||
private keyType; | ||
constructor({ enableOneKey, clientId, network, serverTimeOffset, allowHost, legacyMetadataHost, keyType, }: TorusCtorOptions); | ||
get isLegacyNetwork(): boolean; | ||
@@ -23,3 +24,3 @@ static enableLogging(v?: boolean): void; | ||
static getPostboxKey(torusKey: TorusKey): string; | ||
retrieveShares(endpoints: string[], indexes: number[], verifier: string, verifierParams: VerifierParams, idToken: string, extraParams?: Record<string, unknown>): Promise<TorusKey>; | ||
retrieveShares(endpoints: string[], indexes: number[], verifier: string, verifierParams: VerifierParams, idToken: string, nodePubkeys: INodePub[], extraParams?: Record<string, unknown>, useDkg?: boolean): Promise<TorusKey>; | ||
getPublicAddress(endpoints: string[], torusNodePubs: INodePub[], { verifier, verifierId, extendedVerifierId }: { | ||
@@ -42,3 +43,2 @@ verifier: string; | ||
private getLegacyPublicAddress; | ||
private generateNonceMetadataParams; | ||
private getNewPublicAddress; | ||
@@ -45,0 +45,0 @@ private formatLegacyPublicKeyData; |
{ | ||
"name": "@toruslabs/torus.js", | ||
"version": "12.2.0", | ||
"version": "13.0.0-alpha.1", | ||
"description": "Handle communication with torus nodes", | ||
@@ -31,2 +31,3 @@ "main": "dist/torusUtils.cjs.js", | ||
"elliptic": "^6.5.5", | ||
"bs58": "^5.0.0", | ||
"ethereum-cryptography": "^2.1.3", | ||
@@ -33,0 +34,0 @@ "json-stable-stringify": "^1.1.1", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
478259
5228
10
1
2
+ Addedbs58@^5.0.0
+ Addedbase-x@4.0.0(transitive)
+ Addedbs58@5.0.0(transitive)