Decibel.DecryptionError exception (decibel v1.0.1)

Copy Markdown View Source

Raised when a peer message cannot be decrypted or processed safely.

The :reason field is the stable machine-readable failure contract:

  • :truncated means a required public-key field or authentication tag was incomplete.
  • :authentication_failed means AEAD verification rejected the ciphertext.
  • :invalid_public_key means the peer supplied a public key rejected by the selected DH function.

All reasons use the message "Decryption failed" so backend details and peer data are not exposed.

If the failure occurs during the handshake phase, the :remote_keys field contains any remote public keys processed before the failure. Failed operations leave the session state and cipher nonce unchanged.

Summary

Types

The reason a peer message could not be processed.

t()

Types

reason()

@type reason() :: :truncated | :authentication_failed | :invalid_public_key

The reason a peer message could not be processed.

t()

@type t() :: %Decibel.DecryptionError{
  __exception__: true,
  message: String.t(),
  reason: reason(),
  remote_keys: [] | [re: binary() | nil, rs: binary() | nil]
}