Class: Chamber::KeyPair

Inherits:
Object
  • Object
show all
Defined in:
lib/chamber/key_pair.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ KeyPair

Returns a new instance of KeyPair.



12
13
14
15
16
# File 'lib/chamber/key_pair.rb', line 12

def initialize(options = {})
  self.namespace     = options[:namespace]
  self.passphrase    = options.fetch(:passphrase, SecureRandom.uuid)
  self.key_file_path = Pathname.new(options.fetch(:key_file_path))
end

Instance Attribute Details

#key_file_pathObject

Returns the value of attribute key_file_path.



8
9
10
# File 'lib/chamber/key_pair.rb', line 8

def key_file_path
  @key_file_path
end

#namespaceObject

Returns the value of attribute namespace.



8
9
10
# File 'lib/chamber/key_pair.rb', line 8

def namespace
  @namespace
end

#passphraseObject

Returns the value of attribute passphrase.



8
9
10
# File 'lib/chamber/key_pair.rb', line 8

def passphrase
  @passphrase
end

Instance Method Details

#encrypted_private_key_filenameObject



42
43
44
# File 'lib/chamber/key_pair.rb', line 42

def encrypted_private_key_filename
  "#{base_key_filename}.enc"
end

#encrypted_private_key_filepathObject



18
19
20
# File 'lib/chamber/key_pair.rb', line 18

def encrypted_private_key_filepath
  key_file_path + encrypted_private_key_filename
end

#encrypted_private_key_pemObject



30
31
32
# File 'lib/chamber/key_pair.rb', line 30

def encrypted_private_key_pem
  encrypted_private_key
end

#public_key_filenameObject



50
51
52
# File 'lib/chamber/key_pair.rb', line 50

def public_key_filename
  "#{base_key_filename}.pub.pem"
end

#public_key_filepathObject



26
27
28
# File 'lib/chamber/key_pair.rb', line 26

def public_key_filepath
  key_file_path + public_key_filename
end

#public_key_pemObject



38
39
40
# File 'lib/chamber/key_pair.rb', line 38

def public_key_pem
  public_key.to_pem
end

#unencrypted_private_key_filenameObject



46
47
48
# File 'lib/chamber/key_pair.rb', line 46

def unencrypted_private_key_filename
  "#{base_key_filename}.pem"
end

#unencrypted_private_key_filepathObject



22
23
24
# File 'lib/chamber/key_pair.rb', line 22

def unencrypted_private_key_filepath
  key_file_path + unencrypted_private_key_filename
end

#unencrypted_private_key_pemObject



34
35
36
# File 'lib/chamber/key_pair.rb', line 34

def unencrypted_private_key_pem
  unencrypted_private_key.to_pem
end