Skip to content

Commit eeb9e66

Browse files
fix tests
1 parent 5a96dee commit eeb9e66

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/helpers/nodeUtils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,11 @@ export async function retrieveOrImportShare(params: {
456456

457457
const promiseArrRequest = [];
458458

459-
// if dkg is not used, we need to get existing key or import new shares from client
460-
const getExistingKeyOrImportNewShares = !useDkg;
459+
// if dkg is not used and may be its not a existing key,
460+
// we need to get existing key or import new shares from client
461+
const getExistingKeyOrImportNewShares = !useDkg && !isExistingKey;
461462
if (overrideExistingKey) {
463+
// import new key flow
462464
isImportingShares = true;
463465
const proxyEndpointNum = getProxyCoordinatorEndpointIndex(endpoints, verifier, verifierParams.verifier_id);
464466
const items: Record<string, unknown>[] = [];
@@ -503,6 +505,7 @@ export async function retrieveOrImportShare(params: {
503505
).catch((err) => log.error("share req", err));
504506
promiseArrRequest.push(p);
505507
} else if (getExistingKeyOrImportNewShares) {
508+
// no dkg login and registration flow
506509
const proxyEndpointNum = getProxyCoordinatorEndpointIndex(endpoints, verifier, verifierParams.verifier_id);
507510
const items: Record<string, unknown>[] = [];
508511
for (let i = 0; i < endpoints.length; i += 1) {
@@ -547,6 +550,7 @@ export async function retrieveOrImportShare(params: {
547550
).catch((err) => log.error("share req", err));
548551
promiseArrRequest.push(p);
549552
} else {
553+
// dkg login and registration flow
550554
for (let i = 0; i < endpoints.length; i += 1) {
551555
const p = post<JRPCResponse<ShareRequestResult>>(
552556
endpoints[i],

test/onekey.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ describe("torus onekey", function () {
177177
expect(publicAddress.oAuthKeyData.walletAddress).to.not.equal(null);
178178
});
179179

180-
it("should be able to key assign via login", async function () {
180+
it.only("should be able to key assign via login", async function () {
181181
const email = faker.internet.email();
182182
const token = generateIdToken(email, "ES256");
183183
const verifierDetails = { verifier: TORUS_TEST_VERIFIER, verifierId: email };

test/sapphire_devnet.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ describe("torus utils sapphire devnet", function () {
381381
token,
382382
nodeDetails.torusNodePub,
383383
{},
384-
true,
384+
false,
385385
false
386386
)
387387
);

0 commit comments

Comments
 (0)