Skip to main content

SolanaSigner

Struct SolanaSigner 

Source
pub struct SolanaSigner { /* private fields */ }
Expand description

Solana Ed25519 signer.

Implementations§

Source§

impl SolanaSigner

Source

pub fn address(&self) -> String

Return the Solana address as a Base58-encoded string.

Solana addresses are simply the Base58 encoding of the 32-byte Ed25519 public key.

Source

pub fn public_key_bytes_32(&self) -> [u8; 32]

Return the 32-byte public key as a fixed-size array.

Source§

impl SolanaSigner

Source

pub fn scalar_bytes(&self) -> Zeroizing<Vec<u8>>

Export the clamped Ed25519 scalar (first 32 bytes of SHA-512(seed), clamped).

⚠️ Advanced use only — for MPC, threshold signing, or key derivation. The scalar is the actual private scalar used in Ed25519 signing.

Trait Implementations§

Source§

impl Drop for SolanaSigner

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl KeyPair for SolanaSigner

Source§

fn from_keypair_bytes(keypair: &[u8]) -> Result<Self, SignerError>

Import from Solana’s 64-byte keypair format (seed ∥ pubkey). Validates that the derived public key matches bytes[32..64] using constant-time comparison to prevent timing side-channels.

Source§

fn keypair_bytes(&self) -> Zeroizing<Vec<u8>>

Export as Solana’s 64-byte keypair (seed ∥ pubkey).

Source§

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>

Reconstruct a key pair from raw private key bytes (32 bytes).
Source§

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 SolanaSigner

Source§

fn sign_prehashed(&self, digest: &[u8]) -> Result<SolanaSignature, SignerError>

§⚠️ Not Actually Pre-Hashed

Ed25519 hashes internally per RFC 8032. This method is identical to sign() — the digest parameter is treated as a raw message, not a pre-computed hash. Passing a SHA-256 digest here will sign the digest bytes as a message, NOT use them as a pre-computed hash.

Provided for trait consistency only.

Source§

type Signature = SolanaSignature

The signature type produced by this signer.
Source§

type Error = SignerError

The error type returned on failure.
Source§

fn sign(&self, message: &[u8]) -> Result<SolanaSignature, 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 public_key_bytes(&self) -> Vec<u8>

Return the public key as bytes (compressed format where applicable). Read more
Source§

fn public_key_bytes_uncompressed(&self) -> Vec<u8>

Return the public key in uncompressed format. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.