Expand description
Universal cryptographic signer library supporting multiple signature schemes.
This crate provides a unified interface for cryptographic signing operations supporting secp256k1 (Ethereum), ed25519, and sr25519 (Substrate) signature schemes.
§Features
secp256k1- Enable Ethereum/secp256k1 ECDSA support (enabled by default)sr25519- Enable Substrate/sr25519 Schnorrkel support (enabled by default)ed25519- Enable Substrate-compatible ed25519 support (enabled by default)cli- Enable command-line interface toolscodec- Enable parity-scale-codec support for serializationkeyring- Keyring support with primary key managementgprimitives- Enable gprimitives integration (for ActorId conversions)alloy-primitives- Enable alloy-primitives integrationsp-core- Enable sp-core integration (Substrate compatibility)sp-runtime- Enable sp-runtime integration (Substrate compatibility)
§Examples
ⓘ
use gsigner::secp256k1;
// Create an in-memory signer
let signer = secp256k1::Signer::memory();
// Generate a new key
let public_key = signer.generate()?;
// Sign some data
let signature = signer.sign(public_key, b"hello world")?;Re-exports§
pub use keyring::KeyCodec;pub use keyring::Keyring;pub use keyring::KeyringScheme;pub use keyring::KeystoreEntry;pub use keyring::SubstrateKeystore;pub use address::Address;pub use address::FromActorIdError;pub use address::SubstrateAddress;pub use address::SubstrateCryptoScheme;pub use error::Result;pub use error::SignerError;pub use ext::Secp256k1Ext;pub use ext::SubstrateAddressExt;pub use ext::PairExt;pub use ext::PublicExt;pub use scheme::CryptoScheme;pub use scheme::KeystoreOps;pub use signer::Signer;pub use storage::FilesystemBackend;pub use storage::MemoryBackend;pub use storage::StorageBackend;pub use storage::StorageError;pub use storage::StorageResult;pub use schemes::secp256k1::ContractSignature;pub use schemes::secp256k1::Digest;pub use schemes::secp256k1::PrivateKey;pub use schemes::secp256k1::PublicKey;pub use schemes::secp256k1::Signature;pub use schemes::secp256k1::SignedData;pub use schemes::secp256k1::SignedMessage;pub use schemes::secp256k1::ToDigest;pub use schemes::secp256k1::VerifiedData;pub use schemes::ed25519::Ed25519;
Modules§
- address
- Address types for different cryptographic schemes.
- ed25519
- Ergonomic re-exports for the ed25519 scheme.
- error
- Error types for the gsigner library.
- ext
- Extension traits for sp_core key types.
- hash
- Lightweight hashing helpers shared across schemes.
- keyring
- Unified keyring manager supporting multiple cryptographic schemes.
- prelude
- Re-export commonly used types
- scheme
- Unified cryptographic scheme trait.
- schemes
- Cryptographic signature scheme implementations.
- secp256k1
- Ergonomic re-exports for the secp256k1 scheme.
- signer
- Unified signer API backed by the JSON keyring.
- sr25519
- Ergonomic re-exports for the sr25519 scheme.
- storage
- Storage backend trait and implementations for keyring persistence.
- utils
- Small utility helpers used across the crate.