Ed25519Error

public enum Ed25519Error : Error, Sendable

Errors that can occur during Ed25519 cryptographic operations.

These errors indicate issues with key material, signatures, or cryptographic operations related to Ed25519 keypairs used in Stellar.

  • Cryptographic random seed generation failed.

    Thrown when the system’s secure random number generator fails to produce the required entropy for seed generation. This is a critical error that should be rare in normal circumstances.

    Declaration

    Swift

    case seedGenerationFailed
  • The provided seed string (S-address) is invalid or malformed.

    Thrown when a secret seed string is decoded into a seed and it is not a well formed strkey encoded ed25519 secret seed. This occurs when:

    • The string is not 56 characters long, the length a 32 byte seed is encoded in
    • The string is not canonical base32
    • The string carries a version byte other than the ed25519 secret seed one
    • The CRC-16 checksum does not match the body it covers

    Declaration

    Swift

    case invalidSeed
  • The seed byte array has an incorrect length.

    Seeds must be exactly 32 bytes. This error is thrown when attempting to create a Seed from a byte array of any other length.

    Declaration

    Swift

    case invalidSeedLength
  • The scalar value has an incorrect length.

    Ed25519 scalars must be exactly 32 bytes.

    Declaration

    Swift

    case invalidScalarLength
  • The provided public key string (G-address) is invalid or malformed.

    Thrown when an account id is decoded into a public key and it is not a well formed strkey encoded ed25519 public key. This occurs when:

    • The string is not 56 characters long, the length a 32 byte key is encoded in
    • The string is not canonical base32
    • The string carries a version byte other than the ed25519 public key one
    • The CRC-16 checksum does not match the body it covers

    Declaration

    Swift

    case invalidPublicKey
  • The public key byte array has an incorrect length.

    Public keys must be exactly 32 bytes. This error is thrown when attempting to create a PublicKey from a byte array of any other length.

    Declaration

    Swift

    case invalidPublicKeyLength
  • The provided private key is invalid.

    This indicates that the private key material is malformed or unusable.

    Declaration

    Swift

    case invalidPrivateKey
  • The private key byte array has an incorrect length.

    Private keys must be exactly 64 bytes (32 bytes secret scalar + 32 bytes public key). This error is thrown when attempting to create a PrivateKey from a byte array of any other length.

    Declaration

    Swift

    case invalidPrivateKeyLength
  • The signature byte array has an incorrect length.

    Ed25519 signatures must be exactly 64 bytes. This error is thrown when attempting to verify a signature that doesn’t match the expected length.

    Declaration

    Swift

    case invalidSignatureLength
  • The keypair does not contain a private key and cannot sign.

    Thrown when attempting to sign a message with a public-key-only keypair. Create the keypair from a secret seed or generate a new keypair to sign.

    Declaration

    Swift

    case missingPrivateKey