Skip to content
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

bug: Cosmos signDirect signature validation fails #265

Open
amiryadid-fb opened this issue Aug 8, 2023 · 0 comments
Open

bug: Cosmos signDirect signature validation fails #265

amiryadid-fb opened this issue Aug 8, 2023 · 0 comments

Comments

@amiryadid-fb
Copy link

Summary:
When calling signDirect action after connecting to CosmosHub, the example fails to validate the signature returned due to checking the wrong field.

Description:
According to WalletConnect Cosmos RPC reference after signing the payload, the response should have a signature property containing both a pub_key property and an additional signature field which contains the actual signature string that should be validated.
When returning such response the example dApp tries to validate the signature returned and fails to do so, throwing a match is not a function error, which originates from cosmjs function fromBase64 used internally during the verification process.

image

From further inspection I believe this error is a result of trying to verify the initial signature field (containing the pub_key & signature object) instead of the actual signature string sent inside it (as match is a method on String type).

image

Steps to reproduce:

  1. When connecting, choose 'Cosmos Hub'
  2. Click cosmos_signDirect
  3. Sign the message in the wallet

Expected Result:
The signature will be verified with no errors thrown in the console.

Actual Result:
The verification fails instantly and a match is not a function error is thrown in the console tab

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

No branches or pull requests

1 participant