Class: ActiveRecord::Encryption::DerivedSecretKeyProvider
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
KeyProvider
|
|
Instance Chain:
self,
KeyProvider
|
|
Inherits: |
ActiveRecord::Encryption::KeyProvider
|
Defined in: | activerecord/lib/active_record/encryption/derived_secret_key_provider.rb |
Overview
A KeyProvider that derives keys from passwords.
Class Method Summary
- .new(passwords, key_generator: ActiveRecord::Encryption.key_generator) ⇒ DerivedSecretKeyProvider constructor
KeyProvider
- Inherited
Instance Method Summary
KeyProvider
- Inherited
#decryption_keys | Returns the list of decryption keys. |
#encryption_key | Returns the last key in the list as the active key to perform encryptions. |
#keys_grouped_by_id |
Constructor Details
.new(passwords, key_generator: ActiveRecord::Encryption.key_generator) ⇒ DerivedSecretKeyProvider
# File 'activerecord/lib/active_record/encryption/derived_secret_key_provider.rb', line 7
def initialize(passwords, key_generator: ActiveRecord::Encryption.key_generator) super(Array(passwords).collect { |password| derive_key_from(password, using: key_generator) }) end
Instance Method Details
#derive_key_from(password, using: key_generator) (private)
[ GitHub ]# File 'activerecord/lib/active_record/encryption/derived_secret_key_provider.rb', line 12
def derive_key_from(password, using: key_generator) secret = using.derive_key_from(password) ActiveRecord::Encryption::Key.new(secret) end