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

decode verify fail #1

Closed
gith-u-b opened this issue Sep 5, 2022 · 6 comments
Closed

decode verify fail #1

gith-u-b opened this issue Sep 5, 2022 · 6 comments

Comments

@gith-u-b
Copy link

gith-u-b commented Sep 5, 2022

hi,

params:

{
    "message": "I'm verifying my DOT address",
    "address": "5HBwjWDWZTqRCv98pku9NwoSRo7euCowciut12tviPNAt7WK",
    "signature": "0xc02fd26ba216daa8cd285314a8059aa60744fd5cff1af606e14a9160c854a57c6b42abe0a986ae6b868703359c32c55069b819d23217f01ac513f8bc51482683"
}

use codes:

  server.post<{ Body: { message: string, signature: string, address: string } }>("/worker/dotSignatureVerify", async (request, reply) => {
    let {message, signature, address} = request.body

    await cryptoWaitReady();

    const isValid  = signatureVerify(stringToU8a(message), signature, address);

    return { isValid: isValid }
  });

image

is_valid is true, but use:

verify_result = SR25519.verify("5HBwjWDWZTqRCv98pku9NwoSRo7euCowciut12tviPNAt7WK", "I'm verifying my DOT address", "0xc02fd26ba216daa8cd285314a8059aa60744fd5cff1af606e14a9160c854a57c6b42abe0a
986ae6b868703359c32c55069b819d23217f01ac513f8bc51482683")

is false

use sign a message:
image

@gith-u-b
Copy link
Author

gith-u-b commented Sep 5, 2022

@xuxiaohu help🙏

@xuxiaohu
Copy link
Collaborator

xuxiaohu commented Sep 7, 2022

can you try SR25519.verify(Address.encode("5HBwjWDWZTqRCv98pku9NwoSRo7euCowciut12tviPNAt7WK"), "I'm verifying my DOT address", "0xc02fd26ba216daa8cd285314a8059aa60744fd5cff1af606e14a9160c854a57c6b42abe0a
986ae6b868703359c32c55069b819d23217f01ac513f8bc51482683")?

@gith-u-b
Copy link
Author

gith-u-b commented Sep 12, 2022

Address.encode

image

forget it, run this and exit directly。。

@xuxiaohu
Copy link
Collaborator

The issue is w3f/schnorrkel#77
and maybe the polkajs do some extra sign.
the https://gist.github.com/EclesioMeloJunior/bb1a65e22aa2a4e27263206b42e34c43 is simple answer.
and you can verify it by SR25519.verify(address, "" + message + "", sign)

@gith-u-b
Copy link
Author

gith-u-b commented Sep 13, 2022

The issue is w3f/schnorrkel#77 and maybe the polkajs do some extra sign. the https://gist.github.com/EclesioMeloJunior/bb1a65e22aa2a4e27263206b42e34c43 is simple answer. and you can verify it by SR25519.verify(address, "" + message + "", sign)

image

address = "5HBwjWDWZTqRCv98pku9NwoSRo7euCowciut12tviPNAt7WK"
message = "I'm verifying my DOT address"
sign = "0xc02fd26ba216daa8cd285314a8059aa60744fd5cff1af606e14a9160c854a57c6b42abe0a986ae6b868703359c32c55069b819d23217f01ac513f8bc51482683"
SR25519.verify(address, "" + message + "", sign)

I'm very sorry to bother you, the result is still false😢

@xuxiaohu
Copy link
Collaborator

xuxiaohu commented Sep 13, 2022

SR25519.verify(address, "<Bytes>" + message + "</Bytes>", sign)

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

2 participants