pub struct NeoSigner { /* private fields */ }Expand description
NEO ECDSA signer using NIST P-256 (secp256r1).
Implementations§
Source§impl NeoSigner
impl NeoSigner
Sourcepub fn script_hash(&self) -> [u8; 20]
pub fn script_hash(&self) -> [u8; 20]
Compute the NEO script hash from the compressed public key.
NEO N3 standard: HASH160(0x21 || compressed_pubkey || 0xAC)
where 0x21 = PUSH33 and 0xAC = CHECKSIG.
Source§impl NeoSigner
impl NeoSigner
Sourcepub fn to_wif(&self) -> Zeroizing<String>
pub fn to_wif(&self) -> Zeroizing<String>
Export the private key in WIF (Wallet Import Format).
Uses version byte 0x80 with compression flag 0x01. Result is a Base58Check-encoded string.
§Security
The returned String contains the private key — handle with care.
Sourcepub fn from_wif(wif: &str) -> Result<Self, SignerError>
pub fn from_wif(wif: &str) -> Result<Self, SignerError>
Import a private key from WIF (Wallet Import Format).
Accepts NEO WIF strings (version 0x80 with compression flag).
Trait Implementations§
Source§impl KeyPair for NeoSigner
impl KeyPair for NeoSigner
Source§fn generate() -> Result<Self, SignerError>
fn generate() -> Result<Self, SignerError>
Generate a new random key pair using OS entropy (CSPRNG).
Source§fn from_bytes(private_key: &[u8]) -> Result<Self, SignerError>
fn from_bytes(private_key: &[u8]) -> Result<Self, SignerError>
Reconstruct a key pair from raw private key bytes (32 bytes).
Source§fn private_key_bytes(&self) -> Zeroizing<Vec<u8>>
fn private_key_bytes(&self) -> Zeroizing<Vec<u8>>
Export the private key as auto-zeroizing bytes.
The returned
Zeroizing<Vec<u8>> will scrub the memory on drop.Source§impl Signer for NeoSigner
impl Signer for NeoSigner
Source§type Signature = NeoSignature
type Signature = NeoSignature
The signature type produced by this signer.
Source§type Error = SignerError
type Error = SignerError
The error type returned on failure.
Source§fn sign(&self, message: &[u8]) -> Result<NeoSignature, SignerError>
fn sign(&self, message: &[u8]) -> Result<NeoSignature, SignerError>
Sign a raw message. The implementation applies chain-specific hashing internally
(e.g., Keccak-256 for Ethereum, double-SHA-256 for Bitcoin).
Source§fn sign_prehashed(&self, digest: &[u8]) -> Result<NeoSignature, SignerError>
fn sign_prehashed(&self, digest: &[u8]) -> Result<NeoSignature, SignerError>
Sign a pre-hashed digest directly. The caller is responsible for applying
the correct hash function. Returns
InvalidHashLength if the digest
length doesn’t match the expected hash output size.Auto Trait Implementations§
impl Freeze for NeoSigner
impl RefUnwindSafe for NeoSigner
impl Send for NeoSigner
impl Sync for NeoSigner
impl Unpin for NeoSigner
impl UnsafeUnpin for NeoSigner
impl UnwindSafe for NeoSigner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more