Skip to content

feat(root): add key validation function #6064

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mohammadalfaiyazbitgo
Copy link
Contributor

Add utility function to validate that an encrypted key can be succesfully decrypted and is a valid key.

Ticket: WP-4242

TICKET: WP-4242

Add utility function to validate that an encrypted key
can be succesfully decrypted and is a valid key.

Ticket: WP-4242

TICKET: WP-4242
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo force-pushed the WP-4242/audit-key-method branch from 4d2cdd7 to 026a33b Compare May 1, 2025 22:25
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo requested a review from a team as a code owner May 1, 2025 22:25
@mohammadalfaiyazbitgo mohammadalfaiyazbitgo changed the title feat(sdk-api): add key validation function feat(root): add key validation function May 1, 2025
if (secret.length !== 128 && secret.length !== 192 && secret.length <= 192) {
return { isValid: false, message: 'Incorrect TSS keychain' };
}
} else if (multiSigType === 'onchain' && publicKey) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if publicKey isn't provided we should be returning isValid:false for multisig no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually we should throw an error, saying public key needs to be provided to validate multisig key

Copy link
Contributor Author

@mohammadalfaiyazbitgo mohammadalfaiyazbitgo May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if publicKey isn't provided we should be returning isValid:false for multisig no?

Actually the problem is that the encrypted prv on the key card doesn't have a public key for user/backup on multiSig Wallets. It just has BitGo's public key.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok if that's the case, we need to at least validate the private key somehow, i.e. length, format, etc... as it stands the code wont validate anything if there isnt a public key provided for multisig

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i understand though length could be tricky since private keys are probably stored encoded based on how the coin likes to encode its prv's . If we can instantiate a coin instance and that coin instance has some validate key function that would be nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants