hex logo Hex
Packages Pricing Docs
Log In
Packages Pricing Docs Log In
Packages

cloak

0.2.0
1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.3 1.0.2 1.0.1 1.0.0 1.0.0-alpha.0 0.9.2 0.9.1 0.9.0 0.8.0 0.7.0 0.7.0-alpha.2 0.7.0-alpha.1 0.6.2 0.6.1 0.6.0 0.5.0 0.4.0 0.3.3 0.3.2 0.3.1 0.2.2 0.2.1 0.2.0 0.1.0 0.1.0-pre

Elixir encryption library

HexDocs

Current section

Files

Jump to
Readme
30 Versions
2 Dependencies
9 Dependants
Files
Activity
Readme 30 Versions 2 Dependencies 9 Dependants Files Activity
cloak lib ecto encrypted_integer_field.ex
Raw

17 files

  • lib
    • cloak
      • ciphers
        • aes_ctr.ex
        • behaviour.ex
      • config.ex
      • model.ex
    • ecto
      • encrypted_binary_field.ex
      • encrypted_field.ex
      • encrypted_float_field.ex
      • encrypted_integer_field.ex
      • encrypted_map_field.ex
      • sha_256_field.ex
    • mix
      • tasks
        • cloak.migrate.ex
    • cloak.ex
  • CHANGELOG.md
  • LICENSE
  • README.md
  • SIGNED.md
  • mix.exs

Package files

  • CHANGELOG.md
  • lib/cloak.ex
  • lib/cloak/ciphers/aes_ctr.ex
  • lib/cloak/ciphers/behaviour.ex
  • lib/cloak/config.ex
  • lib/cloak/model.ex
  • lib/ecto/encrypted_binary_field.ex
  • lib/ecto/encrypted_field.ex
  • lib/ecto/encrypted_float_field.ex
  • lib/ecto/encrypted_integer_field.ex
  • lib/ecto/encrypted_map_field.ex
  • lib/ecto/sha_256_field.ex
  • lib/mix/tasks/cloak.migrate.ex
  • LICENSE
  • mix.exs
  • README.md
  • SIGNED.md

lib/ecto/encrypted_integer_field.ex

defmodule Cloak.EncryptedIntegerField do
@moduledoc """
An `Ecto.Type` to encrypt integer fields.
## Usage
You should create the field with type `:binary`. Values will be converted
back to integers on decryption.
schema "table" do
field :field_name, Cloak.EncryptedIntegerField
end
"""
use Cloak.EncryptedField
def after_decrypt(value), do: String.to_integer(value)
end
hex logo Hex
About Blog Sponsors Status Advisories
Documentation FAQ Specifications Report Client Issue Report General Issue Report Security Issue Contact Support
Code of Conduct Terms of Service Privacy Policy Copyright Policy Dispute Policy

Copyright 2015. Six Colors AB.

Powered by the Erlang VM and the Elixir Programming Language

Search filters

Type any of these into the search box. They can be combined with free text which searches package names and descriptions.

Operator Description Example
name: Match package name. Supports * wildcards and repo/package form name:phx* or name:hexpm/phoenix
description: Full-text search of package descriptions description:auth
depends: Packages depending on a given package. Supports repo:package form depends:ecto or depends:hexpm:ecto
build_tool: Filter by build tool build_tool:mix
updated_after: Packages updated after an ISO8601 datetime updated_after:2025-01-01T00:00:00Z
extra: Match custom metadata (key,value). Nested keys are separated by commas extra:license,MIT

Wrap values in double quotes to include spaces, e.g. name:"my package".