Sha256: b5a216bd2be81a61ccb0237b1c372caed9f92829536201b4ca5b8431404a5ed0

Contents?: true

Size: 938 Bytes

Versions: 5

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

require 'pathname'
require 'chamber/keys/base'

module  Chamber
module  Keys
class   Encryption < Chamber::Keys::Base
  NAMESPACE_PATTERN = /
                        \A          # Beginning of Filename
                        \.chamber   # Initial Chamber Prefix
                        \.          # Pre-Namespace Dot
                        (\w+)       # Namespace
                        \.pub\.pem  # Extension
                        \z          # End of Filename
                      /x

  private

  def environment_variable_from_filename(filename)
    [
      'CHAMBER',
      namespace_from_filename(filename),
      'PUBLIC_KEY',
    ].
      compact.
      join('_')
  end

  def generate_key_filenames
    namespaces.map do |namespace|
      rootpath + ".chamber.#{namespace}.pub.pem"
    end
  end

  def default_key_file_path
    Pathname.new(rootpath + '.chamber.pub.pem')
  end
end
end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chamber-2.12.3 lib/chamber/keys/encryption.rb
chamber-2.12.2 lib/chamber/keys/encryption.rb
chamber-2.12.1 lib/chamber/keys/encryption.rb
chamber-2.12.0 lib/chamber/keys/encryption.rb
chamber-2.11.0 lib/chamber/keys/encryption.rb