Namespace
Class
Methods
Constants
CIPHER | = | "aes-128-gcm" |
Attributes
[R] | content_path | |
[R] | env_key | |
[R] | key_path | |
[R] | raise_if_missing_key |
Class Public methods
generate_key()
Source:
# File activesupport/lib/active_support/encrypted_file.rb, line 25
def self.generate_key
SecureRandom.hex(ActiveSupport::MessageEncryptor.key_len(CIPHER))
end
new(content_path:, key_path:, env_key:, raise_if_missing_key:)
Source:
# File activesupport/lib/active_support/encrypted_file.rb, line 32
def initialize(content_path:, key_path:, env_key:, raise_if_missing_key:)
@content_path, @key_path = Pathname.new(content_path), Pathname.new(key_path)
@env_key, @raise_if_missing_key = env_key, raise_if_missing_key
end
Instance Public methods
change(&block)
Source:
# File activesupport/lib/active_support/encrypted_file.rb, line 54
def change(&block)
writing read, &block
end
key()
Source:
# File activesupport/lib/active_support/encrypted_file.rb, line 37
def key
read_env_key || read_key_file || handle_missing_key
end