Class: ActiveCipherStorage::Configuration
- Inherits:
-
Object
- Object
- ActiveCipherStorage::Configuration
- Defined in:
- lib/active_cipher_storage/configuration.rb
Constant Summary collapse
- ALGORITHMS =
Supported algorithm identifiers.
%w[aes-256-gcm].freeze
- DEFAULT_CHUNK_SIZE =
Bytes per plaintext chunk in streaming mode (default 5 MiB — matches the minimum S3 multipart part size, so each chunk maps to exactly one part).
5 * 1024 * 1024
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
Returns the value of attribute algorithm.
-
#chunk_size ⇒ Object
Returns the value of attribute chunk_size.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#provider ⇒ Object
Returns the value of attribute provider.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 |
# File 'lib/active_cipher_storage/configuration.rb', line 15 def initialize @algorithm = "aes-256-gcm" @chunk_size = DEFAULT_CHUNK_SIZE @provider = nil @logger = Logger.new($stdout, level: Logger::WARN) end |
Instance Attribute Details
#algorithm ⇒ Object
Returns the value of attribute algorithm.
13 14 15 |
# File 'lib/active_cipher_storage/configuration.rb', line 13 def algorithm @algorithm end |
#chunk_size ⇒ Object
Returns the value of attribute chunk_size.
13 14 15 |
# File 'lib/active_cipher_storage/configuration.rb', line 13 def chunk_size @chunk_size end |
#logger ⇒ Object
Returns the value of attribute logger.
13 14 15 |
# File 'lib/active_cipher_storage/configuration.rb', line 13 def logger @logger end |
#provider ⇒ Object
Returns the value of attribute provider.
12 13 14 |
# File 'lib/active_cipher_storage/configuration.rb', line 12 def provider @provider end |
Instance Method Details
#validate! ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_cipher_storage/configuration.rb', line 34 def validate! raise ProviderError, "No KMS provider configured. " \ "Set ActiveCipherStorage.configuration.provider." unless @provider unless ALGORITHMS.include?(@algorithm) raise ArgumentError, "Unsupported algorithm: #{@algorithm.inspect}. " \ "Supported: #{ALGORITHMS.join(', ')}" end raise ArgumentError, "chunk_size must be positive" unless @chunk_size.positive? end |