Crates.io | signature-verifier |
lib.rs | signature-verifier |
version | 1.0.0 |
source | src |
created_at | 2024-04-02 11:25:05.468438 |
updated_at | 2024-04-02 11:25:05.468438 |
description | Convenience crate for verifying crypto-signed messages |
homepage | https://github.com/0xtmphey/signature-verifier |
repository | |
max_upload_size | |
id | 1193415 |
size | 13,816 |
This crate provide an easy way to verify Solana and Ethereum wallet-signed messages.
Add the crate to your Cargo.toml
and specify the needed features.
By default it doesn't include anything.
[dependencies]
signature-verifier = { version = "1.0.0", features = ["solana", "ethereum"]}
use signature_verifier::ethereum::EthereumVerifier;
// or
// use signature_verifier::solana::SolanaVerifier;
use signature_verifier::SignatureVerifier;
fn main() {
let message = "hello, world!";
let signature = "7c7240d970b40d0b7a7a798584fee5dbc3e64a7fd276eb068c9139e84bda6b57383276bf73f32ef7055969d0c896884350fc5e899a17904a5f728c5055d8c70d1b";
let account = "0x099dC008292EF1FEb96fBF67eA47fB71fde142C3";
let verification_result = EthereumVerifier::verify(signature, message, account);
match verification_result {
Ok(_) => println!("Signature is valid!"),
Err(e) => eprintln!("{}", e),
};
}