7

I am trying to write a discord bot using rust/serenity to verify signature signed using polkadot.js app. I use schnorrkel crate, wrap the message in <Bytes>...</Bytes> and use the verify method to do this. Everything works as expected for sr25519 signatures. But if the user has generated an ed25519 keypair, this fails.

How can I verify ed25519 signatures? Can I figure out from the signature (or public key) if it has been generated by a ed25519 keypair? I tried with ed25519_dalek crate but could not make it work.

1 Answer 1

6

The JS side actually operates via WASM (if available, which is 99.99% of the cases). When using WASM it uses the same ed25519_dalek crate you pointed to.

Specifically here is the Rust/WASM code it uses for ed25519 verification.

(There are WASM and non-WASM tests on the JS libs to ensure that they do match, i.e. the WASM verification should align with a pure JS implementation as well)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.