Sha256: 8d299c3990ec8891fa3795f7b5c43be52ef989cbbe9683f582a1075233ebdf2e

Contents?: true

Size: 775 Bytes

Versions: 84

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module Encryption
    # A key is a container for a given +secret+
    #
    # Optionally, it can include +public_tags+. These tags are meant to be stored
    # in clean (public) and can be used, for example, to include information that
    # references the key for a future retrieval operation.
    class Key
      attr_reader :secret, :public_tags

      def initialize(secret)
        @secret = secret
        @public_tags = Properties.new
      end

      def self.derive_from(password)
        secret = ActiveRecord::Encryption.key_generator.derive_key_from(password)
        ActiveRecord::Encryption::Key.new(secret)
      end

      def id
        Digest::SHA1.hexdigest(secret).first(4)
      end
    end
  end
end

Version data entries

84 entries across 81 versions & 9 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.8.7/lib/active_record/encryption/key.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.4/lib/active_record/encryption/key.rb
activerecord-8.0.1 lib/active_record/encryption/key.rb
activerecord-8.0.0.1 lib/active_record/encryption/key.rb
activerecord-7.2.2.1 lib/active_record/encryption/key.rb
activerecord-7.1.5.1 lib/active_record/encryption/key.rb
activerecord-7.0.8.7 lib/active_record/encryption/key.rb
activerecord-8.0.0 lib/active_record/encryption/key.rb
activerecord-7.2.2 lib/active_record/encryption/key.rb
activerecord-7.1.5 lib/active_record/encryption/key.rb
activerecord-8.0.0.rc2 lib/active_record/encryption/key.rb
activerecord-7.2.1.2 lib/active_record/encryption/key.rb
activerecord-7.1.4.2 lib/active_record/encryption/key.rb
activerecord-7.0.8.6 lib/active_record/encryption/key.rb
activerecord-8.0.0.rc1 lib/active_record/encryption/key.rb
activerecord-7.2.1.1 lib/active_record/encryption/key.rb
activerecord-7.1.4.1 lib/active_record/encryption/key.rb
activerecord-7.0.8.5 lib/active_record/encryption/key.rb
activerecord-8.0.0.beta1 lib/active_record/encryption/key.rb
omg-activerecord-8.0.0.alpha9 lib/active_record/encryption/key.rb