Method: ActiveRecord::Encryption::KeyProvider#encryption_key

Defined in:
activerecord/lib/active_record/encryption/key_provider.rb

#encryption_keyObject

Returns the last key in the list as the active key to perform encryptions

When ActiveRecord::Encryption.config.store_key_references is true, the key will include a public tag referencing the key itself. That key will be stored in the public headers of the encrypted message



20
21
22
23
24
25
26
# File 'activerecord/lib/active_record/encryption/key_provider.rb', line 20

def encryption_key
  @encryption_key ||= @keys.last.tap do |key|
    key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references
  end

  @encryption_key
end