X402.Signer backed by a raw Ed25519 private key held in memory.
Signs Solana transaction message bytes through OTP's :crypto (EdDSA on
the ed25519 curve) — no extra dependencies. new/1 accepts:
- a raw 32-byte Ed25519 seed
- a 64-byte Solana keypair (
seed <> public_key, thesolana-keygenformat) — the embedded public key is checked against the derived one - the Base64 or Base58 encoding of either
The struct redacts the private key when inspected, but the key still lives in process memory — prefer an external signer implementation (KMS, hardware wallet) for production payers holding significant funds.
Examples
{:ok, signer} = X402.Signer.SolanaKey.new(:crypto.strong_rand_bytes(32))
{:ok, address} = X402.Signer.SolanaKey.address(signer)
Summary
Functions
Returns the Base58 Solana address derived from the private key.
Builds a signer from an Ed25519 seed or Solana keypair.
Signs message with the local Ed25519 key.
Types
Functions
Returns the Base58 Solana address derived from the private key.
Builds a signer from an Ed25519 seed or Solana keypair.
Returns {:error, :invalid_private_key} for malformed keys and for
64-byte keypairs whose public half does not match the seed.
Examples
iex> {:ok, signer} = X402.Signer.SolanaKey.new(:binary.copy(<<1>>, 32))
iex> signer.address
"AKnL4NNf3DGWZJS6cPknBuEGnVsV4A4m5tgebLHaRSZ9"
iex> X402.Signer.SolanaKey.new("not a key")
{:error, :invalid_private_key}
@spec sign_ed25519(t(), binary()) :: {:ok, X402.Signer.ed25519_signature()}
Signs message with the local Ed25519 key.
Ed25519 signing is deterministic (RFC 8032), so the same key and message always produce the same 64-byte signature.