-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes related to metadata backends #117
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,10 +477,6 @@ class Torus { | |
|
||
const oAuthKeyAddress = generateAddressFromPrivKey(this.ec, oAuthKey); | ||
|
||
// deriving address from pub key coz pubkey is always available | ||
// but finalPrivKey won't be available for v2 user upgraded to 2/n | ||
const finalEvmAddress = generateAddressFromPubKey(this.ec, finalPubKey.getX(), finalPubKey.getY()); | ||
log.debug("> torus.js/retrieveShares", { finalEvmAddress }); | ||
let finalPrivKey = ""; // it is empty for v2 user upgraded to 2/n | ||
if (typeOfUser === "v1" || (typeOfUser === "v2" && metadataNonce.gt(new BN(0)))) { | ||
const privateKeyWithNonce = oAuthKey.add(metadataNonce).umod(this.ec.curve.n); | ||
|
@@ -493,6 +489,15 @@ class Torus { | |
} else if (typeOfUser === "v2") { | ||
isUpgraded = metadataNonce.eq(new BN("0")); | ||
} | ||
|
||
// deriving address from pub key coz pubkey is always available | ||
// but finalPrivKey won't be available for v2 user upgraded to 2/n | ||
let finalEvmAddress = ""; | ||
if (finalPubKey) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in wht scenario finalPubKey won't be available ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the bug scenario where metadata doesn't come There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should throw when metadata is missing right? |
||
finalEvmAddress = generateAddressFromPubKey(this.ec, finalPubKey.getX(), finalPubKey.getY()); | ||
log.debug("> torus.js/retrieveShares", { finalEvmAddress }); | ||
} | ||
|
||
return { | ||
finalKeyData: { | ||
evmAddress: finalEvmAddress, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should update backend isn't it? Coz there might still be 0's in front which can get lost on the network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't update backend due to legacy reasons.
0's don't get lost because we always transmit strings across network