Otto v0.1.2 Otto.Cipher behaviour View Source
It is a behaviour for encryption/decryption modules. If you want to write your own cipher module, you should implement this behaviour.
Link to this section Summary
Functions
Generate a cipher key for your cipher config
Link to this section Types
Link to this type
ciphertext()
View Source
ciphertext()
View Source
ciphertext() :: binary()
ciphertext() :: binary()
Link to this type
iv()
View Source
iv()
View Source
iv() :: binary()
iv() :: binary()
Link to this type
key()
View Source
key()
View Source
key() :: binary()
key() :: binary()
Link to this type
plaintext()
View Source
plaintext()
View Source
plaintext() :: String.t()
plaintext() :: String.t()
Link to this section Functions
Link to this function
active_tag() View Source
Link to this function
config(tag \\ nil) View Source
Link to this function
decrypt(ciphertext, iv, tag) View Source
Link to this function
encrypt(plaintext, iv, tag \\ nil)
View Source
encrypt(plaintext, iv, tag \\ nil)
View Source
encrypt(plaintext(), iv(), String.t() | nil) :: {:ok, ciphertext()}
encrypt(plaintext(), iv(), String.t() | nil) :: {:ok, ciphertext()}
Link to this function
generate_iv() View Source
Link to this function
generate_key() View Source
Generate a cipher key for your cipher config.
Link to this section Callbacks
Link to this callback
decrypt(ciphertext, iv, key)
View Source
decrypt(ciphertext, iv, key)
View Source
decrypt(ciphertext(), iv(), key()) :: {:ok, plaintext()} | :error
decrypt(ciphertext(), iv(), key()) :: {:ok, plaintext()} | :error
Link to this callback
encrypt(plaintext, iv, key)
View Source
encrypt(plaintext, iv, key)
View Source
encrypt(plaintext(), iv(), key()) :: {:ok, ciphertext()} | :error
encrypt(plaintext(), iv(), key()) :: {:ok, ciphertext()} | :error