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(key_file_path:, namespace: nil, passphrase: ::SecureRandom.uuid) ⇒ KeyPair

Returns a new instance of KeyPair.



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

def initialize(key_file_path:, namespace: nil, passphrase: ::SecureRandom.uuid)
  self.namespace     = namespace
  self.passphrase    = passphrase
  self.key_file_path = Pathname.new(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



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

def encrypted_private_key_filename
  "#{base_key_filename}.enc"
end

#encrypted_private_key_filepathObject



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

def encrypted_private_key_filepath
  key_file_path + encrypted_private_key_filename
end

#encrypted_private_key_passphrase_filepathObject



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

def encrypted_private_key_passphrase_filepath
  key_file_path + "#{encrypted_private_key_filename}.pass"
end

#encrypted_private_key_pemObject



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

def encrypted_private_key_pem
  encrypted_private_key
end

#public_key_filenameObject



54
55
56
# File 'lib/chamber/key_pair.rb', line 54

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

#public_key_filepathObject



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

def public_key_filepath
  key_file_path + public_key_filename
end

#public_key_pemObject



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

def public_key_pem
  public_key.to_pem
end

#unencrypted_private_key_filenameObject



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

def unencrypted_private_key_filename
  "#{base_key_filename}.pem"
end

#unencrypted_private_key_filepathObject



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

def unencrypted_private_key_filepath
  key_file_path + unencrypted_private_key_filename
end

#unencrypted_private_key_pemObject



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

def unencrypted_private_key_pem
  unencrypted_private_key.to_pem
end