Sha256: 2e1412f7b7d2c25a1c01500cebc84ecd0027640989ed8bc9702e2cbcbf5ada43

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

module AttrKeyring
  require "active_record"
  require "openssl"

  require "attr_keyring/version"
  require "attr_keyring/active_record"
  require "attr_keyring/keyring"
  require "attr_keyring/key"
  require "attr_keyring/encryptor/aes"
  require "attr_keyring/encryptor/aes_128_cbc"
  require "attr_keyring/encryptor/aes_256_cbc"

  UnknownKey = Class.new(StandardError)
  InvalidSecret = Class.new(StandardError)

  def self.included(target)
    target.class_eval do
      extend AttrKeyring::ActiveRecord::ClassMethods
      include AttrKeyring::ActiveRecord::InstanceMethods

      cattr_accessor :keyring, default: Keyring.new({})
      cattr_accessor :keyring_column_name, default: "keyring_id"
      cattr_accessor :keyring_attrs, default: []

      before_save :migrate_to_latest_encryption_key
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attr_keyring-0.2.0 lib/attr_keyring.rb