signature-verifier

Crates.iosignature-verifier
lib.rssignature-verifier
version1.0.0
sourcesrc
created_at2024-04-02 11:25:05.468438
updated_at2024-04-02 11:25:05.468438
descriptionConvenience crate for verifying crypto-signed messages
homepagehttps://github.com/0xtmphey/signature-verifier
repository
max_upload_size
id1193415
size13,816
Tim Plotnikov (0xtmphey)

documentation

README

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

Commit count: 0

cargo fmt