Tango.Types.EncryptedBinary (tango v0.1.2)

Copy Markdown View Source

Custom Ecto type for encrypting binary data using Tango.Vault.

This type automatically encrypts data when storing to database and decrypts when loading from database. Used for sensitive OAuth tokens and credentials.

Summary

Functions

Encrypts a plaintext string for database storage.

Dumps plaintext data by encrypting it for database storage.

Loads encrypted data from database and decrypts it.

Returns the underlying database type.

Functions

cast(closure)

Encrypts a plaintext string for database storage.

Examples

iex> Tango.Types.EncryptedBinary.cast("sensitive_token")
{:ok, "sensitive_token"}

iex> Tango.Types.EncryptedBinary.cast(nil)
{:ok, nil}

dump(value)

Dumps plaintext data by encrypting it for database storage.

load(value)

Loads encrypted data from database and decrypts it.

type()

Returns the underlying database type.