-
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
Showing
2 changed files
with
62 additions
and
0 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 |
---|---|---|
|
@@ -240,6 +240,37 @@ describe("torus utils sapphire devnet", function () { | |
}); | ||
}); | ||
|
||
it("should should fetch public address with keyType", async function () { | ||
const verifierDetails = { verifier: TORUS_TEST_VERIFIER, verifierId: "[email protected]" }; | ||
const nodeDetails = await TORUS_NODE_MANAGER.getNodeDetails(verifierDetails); | ||
const torusNodeEndpoints = nodeDetails.torusNodeSSSEndpoints; | ||
const result = await torus.getPublicAddress(torusNodeEndpoints, nodeDetails.torusNodePub, { ...verifierDetails, keyType: "ed25519" }); | ||
expect(result.finalKeyData.walletAddress).eql("HHmiJMCAwhyf9ZWNtj7FEKGXeeC2NjUjPobpDKm43yKs"); | ||
delete result.metadata.serverTimeOffset; | ||
expect(result).eql({ | ||
oAuthKeyData: { | ||
walletAddress: "49yLu8yLqpuCXchzjQSt1tpBz8AP2E9EzzP7a8QtxmTE", | ||
X: "5d39eba90fafbce150b33b9a60b41e1cfdf9e2640b55bf96b787173d74f8e415", | ||
Y: "099639b7da35c1f31a44da7399a29d7db8eaa9639582cf7ed80aa4f7216adf2e", | ||
}, | ||
finalKeyData: { | ||
walletAddress: "HHmiJMCAwhyf9ZWNtj7FEKGXeeC2NjUjPobpDKm43yKs", | ||
X: "575203523b34bcfa2c25c428871c421afd69dbcb7375833b52ef264aaa466a81", | ||
Y: "26f0b1f5740088c2ecf676081b8e2fe5254f1cbb693947ae391af13500d706f2", | ||
}, | ||
metadata: { | ||
pubNonce: { | ||
X: "71bf997547c1ac3f0babee87ebac055e8542863ebb1ba66e8092499eacbffd22", | ||
Y: "71a0a70c5ae06d7eeb45673d4081fdfc9f29c4acfbbb57bf52a33dd7630599b1", | ||
}, | ||
nonce: new BN("0", "hex"), | ||
typeOfUser: "v2", | ||
upgraded: false, | ||
}, | ||
nodesData: result.nodesData, | ||
}); | ||
}); | ||
|
||
it("should fetch public address of imported user", async function () { | ||
const verifierDetails = { verifier: TORUS_TEST_VERIFIER, verifierId: TORUS_IMPORT_EMAIL }; | ||
const nodeDetails = await TORUS_NODE_MANAGER.getNodeDetails(verifierDetails); | ||
|
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 |
---|---|---|
|
@@ -65,6 +65,37 @@ describe("torus utils ed25519 sapphire devnet", function () { | |
}); | ||
}); | ||
|
||
it("should should fetch public address with keyType", async function () { | ||
const verifierDetails = { verifier: TORUS_TEST_VERIFIER, verifierId: "[email protected]" }; | ||
const nodeDetails = await TORUS_NODE_MANAGER.getNodeDetails(verifierDetails); | ||
const torusNodeEndpoints = nodeDetails.torusNodeSSSEndpoints; | ||
const result = await torus.getPublicAddress(torusNodeEndpoints, nodeDetails.torusNodePub, { ...verifierDetails, keyType: "secp256k1" }); | ||
expect(result.finalKeyData.walletAddress).eql("0xc53Df7C3Eb4990CfB8f903e4240dBB3BBa715A96"); | ||
delete result.metadata.serverTimeOffset; | ||
expect(result).eql({ | ||
oAuthKeyData: { | ||
walletAddress: "0x27890B4B87E5a39CA0510B32B2b2621d7D1eF7c0", | ||
X: "d594a7c8368d37b2ca31b55be7db1b6a6bce9a3ddbcc573d5460bc7d630024e3", | ||
Y: "09416f76bdbb88307900f748f0edc1cc345a9ba78c98508c8e29236d98b1d043", | ||
}, | ||
finalKeyData: { | ||
walletAddress: "0xc53Df7C3Eb4990CfB8f903e4240dBB3BBa715A96", | ||
X: "c60e9fbdb820c2ea430769fce86e2fd56ac4a4e5137346d54a914d57c56cab22", | ||
Y: "02df3331a556d429baea94b0da05ec9438ea2ba9912af0fc4b76925531fc4629", | ||
}, | ||
metadata: { | ||
pubNonce: { | ||
X: "d3edb1a89af7db7a078e73cfdb59f9be82512e8121751934122f104b28b92074", | ||
Y: "2a2700c2934c0a0b5cdfaeeca5a4e279fc9d46c6b6837de6f2e2f15ad39c51a3", | ||
}, | ||
nonce: new BN("0", "hex"), | ||
typeOfUser: "v2", | ||
upgraded: false, | ||
}, | ||
nodesData: result.nodesData, | ||
}); | ||
}); | ||
|
||
it("should be able to import a key for a new user", async function () { | ||
const email = faker.internet.email(); | ||
const token = generateIdToken(email, "ES256"); | ||
|