@toruslabs/torus.js
Advanced tools
Comparing version 6.4.0 to 7.0.0
@@ -388,2 +388,10 @@ /******/ (() => { // webpackBootstrap | ||
const external_web3_utils_namespaceObject = require("web3-utils"); | ||
;// CONCATENATED MODULE: ./src/enums.ts | ||
const SIGNER_MAP = { | ||
mainnet: "https://signer.tor.us", | ||
testnet: "https://signer.tor.us", | ||
cyan: "https://signer-polygon.tor.us", | ||
aqua: "https://signer-polygon.tor.us", | ||
celeste: "https://signer-polygon.tor.us" | ||
}; | ||
;// CONCATENATED MODULE: ./src/loglevel.ts | ||
@@ -554,3 +562,4 @@ | ||
signerHost, | ||
network | ||
network, | ||
clientId | ||
} = _ref; | ||
@@ -561,2 +570,4 @@ let nodeNum; | ||
nodeNum = Math.floor(Math.random() * endpoints.length); | ||
// nodeNum = endpoints.indexOf("https://torus-node.ens.domains/jrpc"); | ||
loglevel.info("keyassign", nodeNum, endpoints[nodeNum]); | ||
initialPoint = nodeNum; | ||
@@ -577,3 +588,4 @@ } else { | ||
pubKeyY: torusNodePubs[nodeNum].Y, | ||
network | ||
network, | ||
clientId | ||
} | ||
@@ -589,6 +601,6 @@ }, { | ||
} catch (error) { | ||
loglevel.error(error); | ||
loglevel.error(error.status, error.message, error, "key assign error"); | ||
const acceptedErrorMsgs = [ | ||
// Slow node | ||
"Timed out", | ||
"Timed out", "Failed to fetch", "cancelled", "NetworkError when attempting to fetch resource.", | ||
// Happens when the node is not reachable (dns issue etc) | ||
@@ -610,3 +622,4 @@ "TypeError: Failed to fetch", | ||
signerHost, | ||
network | ||
network, | ||
clientId | ||
}); | ||
@@ -636,14 +649,16 @@ throw new Error(`Sorry, the Torus Network that powers Web3Auth is currently very busy. | ||
// Implement threshold logic wrappers around public APIs | ||
// of Torus nodes to handle malicious node responses | ||
class Torus { | ||
constructor() { | ||
constructor(_ref) { | ||
let { | ||
enableOneKey = false, | ||
metadataHost = "https://metadata.tor.us", | ||
allowHost = "https://signer.tor.us/api/allow", | ||
signerHost = "https://signer.tor.us/api/sign", | ||
allowHost, | ||
signerHost, | ||
serverTimeOffset = 0, | ||
network = "mainnet" | ||
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
network, | ||
clientId | ||
} = _ref; | ||
defineProperty_default()(this, "metadataHost", void 0); | ||
@@ -655,10 +670,14 @@ defineProperty_default()(this, "allowHost", void 0); | ||
defineProperty_default()(this, "network", void 0); | ||
defineProperty_default()(this, "clientId", void 0); | ||
defineProperty_default()(this, "ec", void 0); | ||
if (!clientId) throw Error("Please provide a valid clientId in constructor"); | ||
if (!network) throw Error("Please provide a valid network in constructor"); | ||
this.ec = new external_elliptic_namespaceObject.ec("secp256k1"); | ||
this.metadataHost = metadataHost; | ||
this.allowHost = allowHost; | ||
this.enableOneKey = enableOneKey; | ||
this.serverTimeOffset = serverTimeOffset || 0; // ms | ||
this.signerHost = signerHost; | ||
this.network = network; | ||
this.clientId = clientId; | ||
this.allowHost = allowHost || `${SIGNER_MAP[network]}/api/allow`; | ||
this.signerHost = signerHost || `${SIGNER_MAP[network]}/api/sign`; | ||
} | ||
@@ -682,7 +701,7 @@ static enableLogging() { | ||
*/ | ||
async getUserTypeAndAddress(endpoints, torusNodePubs, _ref) { | ||
async getUserTypeAndAddress(endpoints, torusNodePubs, _ref2) { | ||
let { | ||
verifier, | ||
verifierId | ||
} = _ref; | ||
} = _ref2; | ||
let doesKeyAssign = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
@@ -712,3 +731,4 @@ const { | ||
signerHost: this.signerHost, | ||
network: this.network | ||
network: this.network, | ||
clientId: this.clientId | ||
}); | ||
@@ -785,3 +805,3 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); | ||
} | ||
async setCustomKey(_ref2) { | ||
async setCustomKey(_ref3) { | ||
let { | ||
@@ -792,3 +812,3 @@ privKeyHex, | ||
customKeyHex | ||
} = _ref2; | ||
} = _ref3; | ||
let torusKey; | ||
@@ -812,4 +832,5 @@ if (torusKeyHex) { | ||
verifier, | ||
verifier_id: verifierParams.verifier_id, | ||
network: this.network | ||
verifierId: verifierParams.verifier_id, | ||
network: this.network, | ||
clientId: this.clientId | ||
} | ||
@@ -1109,7 +1130,7 @@ }, { | ||
*/ | ||
async getPublicAddress(endpoints, torusNodePubs, _ref3) { | ||
async getPublicAddress(endpoints, torusNodePubs, _ref4) { | ||
let { | ||
verifier, | ||
verifierId | ||
} = _ref3; | ||
} = _ref4; | ||
let isExtended = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
@@ -1143,3 +1164,4 @@ loglevel.debug("> torus.js/getPublicAddress", { | ||
signerHost: this.signerHost, | ||
network: this.network | ||
network: this.network, | ||
clientId: this.clientId | ||
}); | ||
@@ -1146,0 +1168,0 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); |
@@ -81,2 +81,10 @@ /******/ (() => { // webpackBootstrap | ||
const external_web3_utils_namespaceObject = require("web3-utils"); | ||
;// CONCATENATED MODULE: ./src/enums.ts | ||
const SIGNER_MAP = { | ||
mainnet: "https://signer.tor.us", | ||
testnet: "https://signer.tor.us", | ||
cyan: "https://signer-polygon.tor.us", | ||
aqua: "https://signer-polygon.tor.us", | ||
celeste: "https://signer-polygon.tor.us" | ||
}; | ||
;// CONCATENATED MODULE: external "loglevel" | ||
@@ -250,3 +258,4 @@ const external_loglevel_namespaceObject = require("loglevel"); | ||
signerHost, | ||
network | ||
network, | ||
clientId | ||
} = _ref; | ||
@@ -257,2 +266,4 @@ let nodeNum; | ||
nodeNum = Math.floor(Math.random() * endpoints.length); | ||
// nodeNum = endpoints.indexOf("https://torus-node.ens.domains/jrpc"); | ||
loglevel.info("keyassign", nodeNum, endpoints[nodeNum]); | ||
initialPoint = nodeNum; | ||
@@ -273,3 +284,4 @@ } else { | ||
pubKeyY: torusNodePubs[nodeNum].Y, | ||
network | ||
network, | ||
clientId | ||
} | ||
@@ -285,6 +297,6 @@ }, { | ||
} catch (error) { | ||
loglevel.error(error); | ||
loglevel.error(error.status, error.message, error, "key assign error"); | ||
const acceptedErrorMsgs = [ | ||
// Slow node | ||
"Timed out", | ||
"Timed out", "Failed to fetch", "cancelled", "NetworkError when attempting to fetch resource.", | ||
// Happens when the node is not reachable (dns issue etc) | ||
@@ -306,3 +318,4 @@ "TypeError: Failed to fetch", | ||
signerHost, | ||
network | ||
network, | ||
clientId | ||
}); | ||
@@ -332,14 +345,16 @@ throw new Error(`Sorry, the Torus Network that powers Web3Auth is currently very busy. | ||
// Implement threshold logic wrappers around public APIs | ||
// of Torus nodes to handle malicious node responses | ||
class Torus { | ||
constructor() { | ||
constructor(_ref) { | ||
let { | ||
enableOneKey = false, | ||
metadataHost = "https://metadata.tor.us", | ||
allowHost = "https://signer.tor.us/api/allow", | ||
signerHost = "https://signer.tor.us/api/sign", | ||
allowHost, | ||
signerHost, | ||
serverTimeOffset = 0, | ||
network = "mainnet" | ||
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
network, | ||
clientId | ||
} = _ref; | ||
defineProperty_default()(this, "metadataHost", void 0); | ||
@@ -351,10 +366,14 @@ defineProperty_default()(this, "allowHost", void 0); | ||
defineProperty_default()(this, "network", void 0); | ||
defineProperty_default()(this, "clientId", void 0); | ||
defineProperty_default()(this, "ec", void 0); | ||
if (!clientId) throw Error("Please provide a valid clientId in constructor"); | ||
if (!network) throw Error("Please provide a valid network in constructor"); | ||
this.ec = new external_elliptic_namespaceObject.ec("secp256k1"); | ||
this.metadataHost = metadataHost; | ||
this.allowHost = allowHost; | ||
this.enableOneKey = enableOneKey; | ||
this.serverTimeOffset = serverTimeOffset || 0; // ms | ||
this.signerHost = signerHost; | ||
this.network = network; | ||
this.clientId = clientId; | ||
this.allowHost = allowHost || `${SIGNER_MAP[network]}/api/allow`; | ||
this.signerHost = signerHost || `${SIGNER_MAP[network]}/api/sign`; | ||
} | ||
@@ -378,7 +397,7 @@ static enableLogging() { | ||
*/ | ||
async getUserTypeAndAddress(endpoints, torusNodePubs, _ref) { | ||
async getUserTypeAndAddress(endpoints, torusNodePubs, _ref2) { | ||
let { | ||
verifier, | ||
verifierId | ||
} = _ref; | ||
} = _ref2; | ||
let doesKeyAssign = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
@@ -408,3 +427,4 @@ const { | ||
signerHost: this.signerHost, | ||
network: this.network | ||
network: this.network, | ||
clientId: this.clientId | ||
}); | ||
@@ -481,3 +501,3 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); | ||
} | ||
async setCustomKey(_ref2) { | ||
async setCustomKey(_ref3) { | ||
let { | ||
@@ -488,3 +508,3 @@ privKeyHex, | ||
customKeyHex | ||
} = _ref2; | ||
} = _ref3; | ||
let torusKey; | ||
@@ -508,4 +528,5 @@ if (torusKeyHex) { | ||
verifier, | ||
verifier_id: verifierParams.verifier_id, | ||
network: this.network | ||
verifierId: verifierParams.verifier_id, | ||
network: this.network, | ||
clientId: this.clientId | ||
} | ||
@@ -805,7 +826,7 @@ }, { | ||
*/ | ||
async getPublicAddress(endpoints, torusNodePubs, _ref3) { | ||
async getPublicAddress(endpoints, torusNodePubs, _ref4) { | ||
let { | ||
verifier, | ||
verifierId | ||
} = _ref3; | ||
} = _ref4; | ||
let isExtended = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
@@ -839,3 +860,4 @@ loglevel.debug("> torus.js/getPublicAddress", { | ||
signerHost: this.signerHost, | ||
network: this.network | ||
network: this.network, | ||
clientId: this.clientId | ||
}); | ||
@@ -842,0 +864,0 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); |
@@ -11,2 +11,10 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
const SIGNER_MAP = { | ||
mainnet: "https://signer.tor.us", | ||
testnet: "https://signer.tor.us", | ||
cyan: "https://signer-polygon.tor.us", | ||
aqua: "https://signer-polygon.tor.us", | ||
celeste: "https://signer-polygon.tor.us" | ||
}; | ||
const log = loglevel.getLogger("torus.js"); | ||
@@ -164,3 +172,4 @@ log.disableAll(); | ||
signerHost, | ||
network | ||
network, | ||
clientId | ||
} = _ref; | ||
@@ -171,2 +180,4 @@ let nodeNum; | ||
nodeNum = Math.floor(Math.random() * endpoints.length); | ||
// nodeNum = endpoints.indexOf("https://torus-node.ens.domains/jrpc"); | ||
log.info("keyassign", nodeNum, endpoints[nodeNum]); | ||
initialPoint = nodeNum; | ||
@@ -187,3 +198,4 @@ } else { | ||
pubKeyY: torusNodePubs[nodeNum].Y, | ||
network | ||
network, | ||
clientId | ||
} | ||
@@ -199,6 +211,6 @@ }, { | ||
} catch (error) { | ||
log.error(error); | ||
log.error(error.status, error.message, error, "key assign error"); | ||
const acceptedErrorMsgs = [ | ||
// Slow node | ||
"Timed out", | ||
"Timed out", "Failed to fetch", "cancelled", "NetworkError when attempting to fetch resource.", | ||
// Happens when the node is not reachable (dns issue etc) | ||
@@ -216,3 +228,4 @@ "TypeError: Failed to fetch", "TypeError: cancelled", "TypeError: NetworkError when attempting to fetch resource." // Firefox | ||
signerHost, | ||
network | ||
network, | ||
clientId | ||
}); | ||
@@ -234,11 +247,12 @@ throw new Error(`Sorry, the Torus Network that powers Web3Auth is currently very busy. | ||
class Torus { | ||
constructor() { | ||
constructor(_ref) { | ||
let { | ||
enableOneKey = false, | ||
metadataHost = "https://metadata.tor.us", | ||
allowHost = "https://signer.tor.us/api/allow", | ||
signerHost = "https://signer.tor.us/api/sign", | ||
allowHost, | ||
signerHost, | ||
serverTimeOffset = 0, | ||
network = "mainnet" | ||
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
network, | ||
clientId | ||
} = _ref; | ||
_defineProperty(this, "metadataHost", void 0); | ||
@@ -250,10 +264,14 @@ _defineProperty(this, "allowHost", void 0); | ||
_defineProperty(this, "network", void 0); | ||
_defineProperty(this, "clientId", void 0); | ||
_defineProperty(this, "ec", void 0); | ||
if (!clientId) throw Error("Please provide a valid clientId in constructor"); | ||
if (!network) throw Error("Please provide a valid network in constructor"); | ||
this.ec = new ec("secp256k1"); | ||
this.metadataHost = metadataHost; | ||
this.allowHost = allowHost; | ||
this.enableOneKey = enableOneKey; | ||
this.serverTimeOffset = serverTimeOffset || 0; // ms | ||
this.signerHost = signerHost; | ||
this.network = network; | ||
this.clientId = clientId; | ||
this.allowHost = allowHost || `${SIGNER_MAP[network]}/api/allow`; | ||
this.signerHost = signerHost || `${SIGNER_MAP[network]}/api/sign`; | ||
} | ||
@@ -276,7 +294,7 @@ static enableLogging() { | ||
*/ | ||
async getUserTypeAndAddress(endpoints, torusNodePubs, _ref) { | ||
async getUserTypeAndAddress(endpoints, torusNodePubs, _ref2) { | ||
let { | ||
verifier, | ||
verifierId | ||
} = _ref; | ||
} = _ref2; | ||
let doesKeyAssign = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
@@ -306,3 +324,4 @@ const { | ||
signerHost: this.signerHost, | ||
network: this.network | ||
network: this.network, | ||
clientId: this.clientId | ||
}); | ||
@@ -379,3 +398,3 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); | ||
} | ||
async setCustomKey(_ref2) { | ||
async setCustomKey(_ref3) { | ||
let { | ||
@@ -386,3 +405,3 @@ privKeyHex, | ||
customKeyHex | ||
} = _ref2; | ||
} = _ref3; | ||
let torusKey; | ||
@@ -406,4 +425,5 @@ if (torusKeyHex) { | ||
verifier, | ||
verifier_id: verifierParams.verifier_id, | ||
network: this.network | ||
verifierId: verifierParams.verifier_id, | ||
network: this.network, | ||
clientId: this.clientId | ||
} | ||
@@ -699,7 +719,7 @@ }, { | ||
*/ | ||
async getPublicAddress(endpoints, torusNodePubs, _ref3) { | ||
async getPublicAddress(endpoints, torusNodePubs, _ref4) { | ||
let { | ||
verifier, | ||
verifierId | ||
} = _ref3; | ||
} = _ref4; | ||
let isExtended = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
@@ -733,3 +753,4 @@ log.debug("> torus.js/getPublicAddress", { | ||
signerHost: this.signerHost, | ||
network: this.network | ||
network: this.network, | ||
clientId: this.clientId | ||
}); | ||
@@ -736,0 +757,0 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); |
@@ -36,3 +36,4 @@ import { Ecies } from "@toruslabs/eccrypto"; | ||
signerHost?: string; | ||
network?: string; | ||
network: string; | ||
clientId: string; | ||
} | ||
@@ -102,2 +103,3 @@ export interface TorusPublicKey extends INodePub { | ||
network: string; | ||
clientId: string; | ||
} | ||
@@ -104,0 +106,0 @@ export interface KeyAssignment { |
@@ -12,4 +12,5 @@ import type { INodePub } from "@toruslabs/fetch-node-details"; | ||
network: string; | ||
clientId: string; | ||
protected ec: EC; | ||
constructor({ enableOneKey, metadataHost, allowHost, signerHost, serverTimeOffset, network, }?: TorusCtorOptions); | ||
constructor({ enableOneKey, metadataHost, allowHost, signerHost, serverTimeOffset, network, clientId, }: TorusCtorOptions); | ||
static enableLogging(v?: boolean): void; | ||
@@ -16,0 +17,0 @@ static setAPIKey(apiKey: string): void; |
@@ -9,3 +9,3 @@ /// <reference types="node" /> | ||
export declare const waitKeyLookup: (endpoints: string[], verifier: string, verifierId: string, timeout: number) => Promise<KeyLookupResult>; | ||
export declare const keyAssign: ({ endpoints, torusNodePubs, lastPoint, firstPoint, verifier, verifierId, signerHost, network, }: KeyAssignInput) => Promise<void>; | ||
export declare const keyAssign: ({ endpoints, torusNodePubs, lastPoint, firstPoint, verifier, verifierId, signerHost, network, clientId, }: KeyAssignInput) => Promise<void>; | ||
export declare function keccak256(a: string | Buffer): string; |
{ | ||
"name": "@toruslabs/torus.js", | ||
"version": "6.4.0", | ||
"version": "7.0.0", | ||
"description": "Handle communication with torus nodes", | ||
@@ -27,3 +27,3 @@ "main": "dist/torusUtils.cjs.js", | ||
"dependencies": { | ||
"@toruslabs/eccrypto": "^2.0.0", | ||
"@toruslabs/eccrypto": "^2.1.1", | ||
"@toruslabs/http-helpers": "^3.3.0", | ||
@@ -35,3 +35,3 @@ "bn.js": "^5.2.1", | ||
"loglevel": "^1.8.1", | ||
"web3-utils": "^1.8.2" | ||
"web3-utils": "^1.9.0" | ||
}, | ||
@@ -46,2 +46,3 @@ "devDependencies": { | ||
"@types/elliptic": "^6.4.14", | ||
"@types/faker": "^5.5.3", | ||
"@types/json-stable-stringify": "^1.0.34", | ||
@@ -51,13 +52,12 @@ "@types/jsonwebtoken": "^9.0.1", | ||
"@types/mocha": "^10.0.1", | ||
"@types/faker": "^5.5.3", | ||
"@typescript-eslint/eslint-plugin": "^5.55.0", | ||
"@typescript-eslint/parser": "^5.55.0", | ||
"@typescript-eslint/eslint-plugin": "^5.58.0", | ||
"@typescript-eslint/parser": "^5.58.0", | ||
"chai": "^4.3.7", | ||
"cross-env": "^7.0.3", | ||
"dotenv": "^16.0.3", | ||
"eslint": "^8.36.0", | ||
"eslint": "^8.38.0", | ||
"eslint-plugin-chai-expect": "^3.0.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-mocha": "^10.1.0", | ||
"eslint-plugin-n": "^15.6.1", | ||
"eslint-plugin-n": "^15.7.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
@@ -70,7 +70,7 @@ "eslint-plugin-promise": "^6.1.1", | ||
"jsonwebtoken": "^9.0.0", | ||
"lint-staged": "^13.2.0", | ||
"lint-staged": "^13.2.1", | ||
"mocha": "^10.2.0", | ||
"node-fetch": "^3.3.1", | ||
"prettier": "^2.8.4", | ||
"rimraf": "^4.4.0", | ||
"prettier": "^2.8.7", | ||
"rimraf": "^5.0.0", | ||
"ts-node": "^10.9.1", | ||
@@ -77,0 +77,0 @@ "typescript": "^4.9.5", |
@@ -76,3 +76,3 @@ # Torus.js | ||
const fetchNodeDetails = new FetchNodeDetails() | ||
const torus = new TorusUtils({ network: 'mainnet' }) | ||
const torus = new TorusUtils({ network: 'mainnet', clientId: 'YOUR_CLIENT_ID' }) // get your Client ID from Web3Auth Dashboard | ||
const verifier = 'google' | ||
@@ -92,3 +92,3 @@ const verifierId = 'hello@tor.us' | ||
const fetchNodeDetails = new FetchNodeDetails() | ||
const torus = new TorusUtils({ network: 'mainnet' }) | ||
const torus = new TorusUtils({ network: 'mainnet', clientId: 'YOUR_CLIENT_ID' }) // get your Client ID from Web3Auth Dashboard | ||
const verifier = 'google' // any verifier | ||
@@ -95,0 +95,0 @@ const verifierId = 'hello@tor.us' // any verifier id |
@@ -30,3 +30,4 @@ import { Ecies } from "@toruslabs/eccrypto"; | ||
signerHost?: string; | ||
network?: string; | ||
network: string; | ||
clientId: string; | ||
} | ||
@@ -97,2 +98,3 @@ | ||
network: string; | ||
clientId: string; | ||
} | ||
@@ -99,0 +101,0 @@ |
@@ -9,2 +9,3 @@ import { decrypt, generatePrivate, getPublic } from "@toruslabs/eccrypto"; | ||
import { SIGNER_MAP } from "./enums"; | ||
import { | ||
@@ -42,2 +43,4 @@ CommitmentRequestResult, | ||
public clientId: string; | ||
protected ec: EC; | ||
@@ -48,14 +51,19 @@ | ||
metadataHost = "https://metadata.tor.us", | ||
allowHost = "https://signer.tor.us/api/allow", | ||
signerHost = "https://signer.tor.us/api/sign", | ||
allowHost, | ||
signerHost, | ||
serverTimeOffset = 0, | ||
network = "mainnet", | ||
}: TorusCtorOptions = {}) { | ||
network, | ||
clientId, | ||
}: TorusCtorOptions) { | ||
if (!clientId) throw Error("Please provide a valid clientId in constructor"); | ||
if (!network) throw Error("Please provide a valid network in constructor"); | ||
this.ec = new EC("secp256k1"); | ||
this.metadataHost = metadataHost; | ||
this.allowHost = allowHost; | ||
this.enableOneKey = enableOneKey; | ||
this.serverTimeOffset = serverTimeOffset || 0; // ms | ||
this.signerHost = signerHost; | ||
this.network = network; | ||
this.clientId = clientId; | ||
this.allowHost = allowHost || `${SIGNER_MAP[network]}/api/allow`; | ||
this.signerHost = signerHost || `${SIGNER_MAP[network]}/api/sign`; | ||
} | ||
@@ -110,2 +118,3 @@ | ||
network: this.network, | ||
clientId: this.clientId, | ||
}); | ||
@@ -198,4 +207,5 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); | ||
verifier, | ||
verifier_id: verifierParams.verifier_id, | ||
verifierId: verifierParams.verifier_id, | ||
network: this.network, | ||
clientId: this.clientId, | ||
}, | ||
@@ -521,2 +531,3 @@ }, | ||
network: this.network, | ||
clientId: this.clientId, | ||
}); | ||
@@ -523,0 +534,0 @@ const assignResult = await waitKeyLookup(endpoints, verifier, verifierId, 1000); |
@@ -96,2 +96,3 @@ import { generateJsonRPCObject, post } from "@toruslabs/http-helpers"; | ||
network, | ||
clientId, | ||
}: KeyAssignInput): Promise<void> => { | ||
@@ -102,2 +103,4 @@ let nodeNum: number; | ||
nodeNum = Math.floor(Math.random() * endpoints.length); | ||
// nodeNum = endpoints.indexOf("https://torus-node.ens.domains/jrpc"); | ||
log.info("keyassign", nodeNum, endpoints[nodeNum]); | ||
initialPoint = nodeNum; | ||
@@ -123,2 +126,3 @@ } else { | ||
network, | ||
clientId, | ||
}, | ||
@@ -138,6 +142,9 @@ }, | ||
} catch (error) { | ||
log.error(error); | ||
log.error(error.status, error.message, error, "key assign error"); | ||
const acceptedErrorMsgs = [ | ||
// Slow node | ||
"Timed out", | ||
"Failed to fetch", | ||
"cancelled", | ||
"NetworkError when attempting to fetch resource.", | ||
// Happens when the node is not reachable (dns issue etc) | ||
@@ -153,3 +160,13 @@ "TypeError: Failed to fetch", // All except iOS and Firefox | ||
) | ||
return keyAssign({ endpoints, torusNodePubs, lastPoint: nodeNum + 1, firstPoint: initialPoint, verifier, verifierId, signerHost, network }); | ||
return keyAssign({ | ||
endpoints, | ||
torusNodePubs, | ||
lastPoint: nodeNum + 1, | ||
firstPoint: initialPoint, | ||
verifier, | ||
verifierId, | ||
signerHost, | ||
network, | ||
clientId, | ||
}); | ||
throw new Error( | ||
@@ -156,0 +173,0 @@ `Sorry, the Torus Network that powers Web3Auth is currently very busy. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
4965897
28
36290
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
- Removedcall-bind-apply-helpers@1.0.2(transitive)
Updated@toruslabs/eccrypto@^2.1.1
Updatedweb3-utils@^1.9.0