Sha256: 7a8decf5a1f8a8a8aab2c9fe11fc4b14c4fa83bd95c05d6dc73bddb1b25e6a36

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

module EnMail
  class Key
    # @!attribute [r] sign_key
    #   @return [String] the signing key content
    #
    attr_reader :sign_key

    # @!attribute passphrase
    #   @return [String] the signing key passphrase
    #
    attr_reader :passphrase

    # @!attribute [r] encrypt_key
    #   @return [String] the encryping key content
    #
    attr_reader :encrypt_key

    # @!attribute [r] certificate
    #   @return [String] the certificate content
    #
    attr_reader :certificate

    # Initialize a key model with the basic attributes, this expects us
    # to provided the key/certificate as string and when we actually use
    # it then the configured adapter will use it as necessary.
    #
    # @param :sign_key [String] the signing key content
    # @param :passphrase [String] the passphrase for encrypted key
    # @param :encrypt_key [String] the encryping key content
    # @param :certificate [String] the signing certificate content
    #
    # @return [EnMail::Key] - the EnMail::Key model
    #
    def initialize(attributes)
      @sign_key = attributes.fetch(:sign_key, "")
      @passphrase = attributes.fetch(:passphrase, "")
      @encrypt_key = attributes.fetch(:encrypt_key, "")
      @certificate = attributes.fetch(:certificate, "")
    end

    # Set the passphrase value
    #
    # This allow us to set the passphrase after initialization, so if the
    # user prefere then they can pass the passphrase during the siging /
    # encrypting steps and we can set that one when necessary
    #
    # @param passphrase [String] the passphrase for encrypted key
    #
    def passphrase=(passphrase)
      @passphrase = passphrase
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enmail-0.1.0 lib/enmail/key.rb