Skip to content

Commit

Permalink
fix retrieve shares for test tss verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu committed Apr 23, 2024
1 parent a911948 commit 5fd555d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/helpers/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export async function retrieveOrImportShare(params: {
temppuby: pubKeyY,
verifieridentifier: verifier,
verifier_id: verifierParams.verifier_id,
extended_verifier_id: verifierParams.extended_verifier_id,
is_import_key_flow: true,
}),
null,
Expand Down
21 changes: 21 additions & 0 deletions test/sapphire_devnet_ed25519.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,27 @@ describe("torus utils ed25519 sapphire devnet", function () {
expect(result.metadata.typeOfUser).to.equal("v2");
expect(result.metadata.nonce).to.eql(new BN("0"));
expect(result.metadata.upgraded).to.equal(true);
const token2 = generateIdToken(email, "ES256");

const result2 = await torus.retrieveShares(
torusNodeEndpoints,
nodeDetails.torusIndexes,
TORUS_TEST_VERIFIER,
{ extended_verifier_id: tssVerifierId, verifier_id: email },
token2,
nodeDetails.torusNodePub
);
expect(result.finalKeyData.privKey).to.equal(result2.finalKeyData.privKey);
expect(result.oAuthKeyData.walletAddress).to.equal(result2.finalKeyData.walletAddress);
expect(result2.metadata.typeOfUser).to.equal(result.metadata.typeOfUser);
expect(result2.metadata.upgraded).to.equal(result.metadata.upgraded);

const result3 = await torus.getPublicAddress(torusNodeEndpoints, nodeDetails.torusNodePub, {
verifier: TORUS_TEST_VERIFIER,
verifierId: email,
extendedVerifierId: tssVerifierId,
});
expect(result3.oAuthKeyData.walletAddress).to.equal(result2.finalKeyData.walletAddress);
});

it("should fetch public address when verifierID hash enabled", async function () {
Expand Down

0 comments on commit 5fd555d

Please sign in to comment.