-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac68bd5
commit 35cb4ae
Showing
10 changed files
with
32 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ This library handles these checks and allows you to query the Torus network easi | |
|
||
### Bundling | ||
|
||
This module is distributed in 4 formats | ||
This module is distributed in 3 formats | ||
|
||
- `esm` build `dist/torusUtils.esm.js` in es6 format | ||
- `commonjs` build `dist/torusUtils.cjs.js` in es5 format | ||
|
@@ -67,10 +67,10 @@ Add [`@toruslabs/torus.js`](https://www.npmjs.com/package/@toruslabs/torus.js) t | |
Needs to be used in conjuction with [`@toruslabs/fetch-node-details`](https://www.npmjs.com/package/@toruslabs/fetch-node-details) | ||
|
||
```ts | ||
import FetchNodeDetails from "@toruslabs/fetch-node-details"; | ||
import { NodeDetailManager } from "@toruslabs/fetch-node-details"; | ||
import TorusUtils from "@toruslabs/torus.js"; | ||
|
||
const fetchNodeDetails = new FetchNodeDetails(); | ||
const fetchNodeDetails = new NodeDetailManager(); | ||
const torus = new TorusUtils({ network: "mainnet", clientId: "YOUR_CLIENT_ID" }); // get your Client ID from Web3Auth Dashboard | ||
const verifier = "google"; | ||
const verifierId = "[email protected]"; | ||
|
@@ -82,8 +82,8 @@ const keyData = await torus.retrieveShares(torusNodeEndpoints, torusIndexes, ver | |
``` | ||
|
||
```js | ||
const FetchNodeDetails = require("@toruslabs/fetch-node-details").default; | ||
const TorusUtils = require("@toruslabs/torus.js").default; | ||
const { NodeDetailManager: FetchNodeDetails } = require("@toruslabs/fetch-node-details"); | ||
const { Torus: TorusUtils } = require("@toruslabs/torus.js"); | ||
|
||
const fetchNodeDetails = new FetchNodeDetails(); | ||
const torus = new TorusUtils({ network: "mainnet", clientId: "YOUR_CLIENT_ID" }); // get your Client ID from Web3Auth Dashboard | ||
|
@@ -103,21 +103,6 @@ fetchNodeDetails | |
.then((keyData) => console.log(keyData)); | ||
``` | ||
|
||
```js | ||
// For Node.js | ||
const FetchNodeDetails = require("@toruslabs/fetch-node-details/dist/fetchNodeDetails-node.js").default; | ||
const TorusUtils = require("@toruslabs/torus.js/dist/torusUtils-node.js").default; | ||
|
||
const fetchNodeDetails = new FetchNodeDetails(); | ||
const torus = new TorusUtils({ network: "mainnet" }); | ||
const verifier = "google"; // any verifier | ||
const verifierId = "[email protected]"; // any verifier id | ||
fetchNodeDetails | ||
.getNodeDetails() | ||
.then(({ torusNodeEndpoints, torusNodePub }) => torus.getPublicAddress(torusNodeEndpoints, torusNodePub, { verifier, verifierId })) | ||
.then((publicAddress) => console.log(publicAddress)); | ||
``` | ||
|
||
## Requirements | ||
|
||
- This package requires a peer dependency of `@babel/runtime` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { TORUS_LEGACY_NETWORK } from "@toruslabs/constants"; | ||
import FetchNodeDetails from "@toruslabs/fetch-node-details"; | ||
import { NodeDetailManager } from "@toruslabs/fetch-node-details"; | ||
import BN from "bn.js"; | ||
import { expect } from "chai"; | ||
import faker from "faker"; | ||
|
@@ -8,7 +8,7 @@ import { keccak256, TorusPublicKey } from "../src"; | |
import TorusUtils from "../src/torus"; | ||
import { generateIdToken } from "./helpers"; | ||
|
||
const TORUS_NODE_MANAGER = new FetchNodeDetails({ | ||
const TORUS_NODE_MANAGER = new NodeDetailManager({ | ||
network: TORUS_LEGACY_NETWORK.TESTNET, | ||
}); | ||
const TORUS_TEST_EMAIL = "[email protected]"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants"; | ||
import { generatePrivate } from "@toruslabs/eccrypto"; | ||
import NodeManager from "@toruslabs/fetch-node-details"; | ||
import { NodeDetailManager } from "@toruslabs/fetch-node-details"; | ||
import BN from "bn.js"; | ||
import { expect } from "chai"; | ||
import faker from "faker"; | ||
|
@@ -17,15 +17,15 @@ const TORUS_EXTENDED_VERIFIER_EMAIL = "[email protected]"; | |
|
||
describe("torus utils sapphire mainnet", function () { | ||
let torus: TorusUtils; | ||
let TORUS_NODE_MANAGER: NodeManager; | ||
let TORUS_NODE_MANAGER: NodeDetailManager; | ||
|
||
beforeEach("one time execution before all tests", async function () { | ||
torus = new TorusUtils({ | ||
network: TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET, | ||
clientId: "YOUR_CLIENT_ID", | ||
enableOneKey: true, | ||
}); | ||
TORUS_NODE_MANAGER = new NodeManager({ network: TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET }); | ||
TORUS_NODE_MANAGER = new NodeDetailManager({ network: TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET }); | ||
}); | ||
|
||
it("should fetch public address", async function () { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters