instance method derive_key_from

Ruby on Rails 7.2.3

Since v7.0.10

Available in: v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

derive_key_from(password, length: key_length)

Derives a key from the given password. The key will have a size in bytes of :length (configured Cipher‘s length by default)

The generated key will be salted with the value of ActiveRecord::Encryption.key_derivation_salt

Parameters

password req
length key = key_length
Source
# File activerecord/lib/active_record/encryption/key_generator.rb, line 38
      def derive_key_from(password, length: key_length)
        ActiveSupport::KeyGenerator.new(password, hash_digest_class: hash_digest_class)
          .generate_key(key_derivation_salt, length)
      end

Defined in activerecord/lib/active_record/encryption/key_generator.rb line 38 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Encryption::KeyGenerator

Type at least 2 characters to search.

↑↓ navigate · open · esc close