Skip to content

Convenience crate for verifying crypto-signed messages

License

Notifications You must be signed in to change notification settings

0xtmphey/signature-verifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crates.io Version Crates.io Total Downloads GitHub Actions Workflow Status

signature-verifier

This crate provide an easy way to verify Solana and Ethereum wallet-signed messages.

Installation

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"]}

Usage

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),
    };
}

About

Convenience crate for verifying crypto-signed messages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages