diff --git a/src/helpers/nodeUtils.ts b/src/helpers/nodeUtils.ts index 2535810..55876c2 100644 --- a/src/helpers/nodeUtils.ts +++ b/src/helpers/nodeUtils.ts @@ -511,9 +511,9 @@ export async function retrieveOrImportShare(params: { if (enableOneKey) { nonceResult = await getNonce(legacyMetadataHost, ecCurve, serverTimeOffset, oAuthPubkeyX, oAuthPubkeyY, oAuthKey); metadataNonce = new BN(nonceResult.nonce || "0", 16); - pubNonce = { X: (nonceResult as v2NonceResultType).pubNonce.x, Y: (nonceResult as v2NonceResultType).pubNonce.y }; typeOfUser = nonceResult.typeOfUser; if (typeOfUser === "v2") { + pubNonce = { X: (nonceResult as v2NonceResultType).pubNonce.x, Y: (nonceResult as v2NonceResultType).pubNonce.y }; finalPubKey = ecCurve .keyFromPublic({ x: oAuthPubkeyX, y: oAuthPubkeyY }) .getPublic() diff --git a/src/torus.ts b/src/torus.ts index 363ee1b..944a953 100644 --- a/src/torus.ts +++ b/src/torus.ts @@ -457,7 +457,7 @@ class Torus { const nonceResult = await getNonce(this.legacyMetadataHost, this.ec, this.serverTimeOffset, oAuthKeyX, oAuthKeyY, oAuthKey); metadataNonce = new BN(nonceResult.nonce || "0", 16); typeOfUser = nonceResult.typeOfUser; - if (nonceResult.typeOfUser === "v2") { + if (typeOfUser === "v2") { finalPubKey = this.ec .keyFromPublic({ x: oAuthKeyX, y: oAuthKeyY }) .getPublic() @@ -744,7 +744,7 @@ class Torus { finalPubKey = this.ec .keyFromPublic({ x: X, y: Y }) .getPublic() - .add(this.ec.keyFromPrivate(nonce.toString(16)).getPublic()); + .add(this.ec.keyFromPrivate(nonce.toString(16, 64), "hex").getPublic()); } if (!oAuthPubKey) {