SIWX signature verifier for Solana (solana:*) wallets.
Verifies the Ed25519 signature over the Sign-In-With-Solana message text
through OTP's :crypto — no extra dependencies. The signature and the
address are the Base58 encodings Solana wallets produce: a 64-byte
signature and a 32-byte public key.
Summary
Functions
Verifies a Base58 Ed25519 signature over message for a Base58 address.
Functions
@spec verify_signature(String.t(), String.t(), String.t()) :: {:ok, boolean()} | {:error, :malformed_signature | :invalid_address | :invalid_arguments}
Verifies a Base58 Ed25519 signature over message for a Base58 address.
Returns {:ok, true} when the signature verifies under the public key the
address encodes, {:ok, false} when it does not, and
{:error, :malformed_signature} / {:error, :invalid_address} when the
Base58 encodings or byte lengths are wrong.
Examples
iex> X402.Extensions.SIWX.Verifier.Ed25519.verify_signature("hello", "not base58 0", "AKnL4NNf3DGWZJS6cPknBuEGnVsV4A4m5tgebLHaRSZ9")
{:error, :malformed_signature}
iex> X402.Extensions.SIWX.Verifier.Ed25519.verify_signature("hello", "1111", "too-short")
{:error, :invalid_address}