Class: Chamber::KeyPair
- Inherits:
-
Object
- Object
- Chamber::KeyPair
- Defined in:
- lib/chamber/key_pair.rb
Instance Attribute Summary collapse
-
#key_file_path ⇒ Object
Returns the value of attribute key_file_path.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#passphrase ⇒ Object
Returns the value of attribute passphrase.
Instance Method Summary collapse
- #encrypted_private_key_filename ⇒ Object
- #encrypted_private_key_filepath ⇒ Object
- #encrypted_private_key_passphrase_filepath ⇒ Object
- #encrypted_private_key_pem ⇒ Object
-
#initialize(key_file_path:, namespace: nil, passphrase: ::SecureRandom.uuid) ⇒ KeyPair
constructor
A new instance of KeyPair.
- #public_key_filename ⇒ Object
- #public_key_filepath ⇒ Object
- #public_key_pem ⇒ Object
- #unencrypted_private_key_filename ⇒ Object
- #unencrypted_private_key_filepath ⇒ Object
- #unencrypted_private_key_pem ⇒ Object
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_path ⇒ Object
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 |
#namespace ⇒ Object
Returns the value of attribute namespace.
8 9 10 |
# File 'lib/chamber/key_pair.rb', line 8 def namespace @namespace end |
#passphrase ⇒ Object
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_filename ⇒ Object
46 47 48 |
# File 'lib/chamber/key_pair.rb', line 46 def encrypted_private_key_filename "#{base_key_filename}.enc" end |
#encrypted_private_key_filepath ⇒ Object
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_filepath ⇒ Object
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_pem ⇒ Object
34 35 36 |
# File 'lib/chamber/key_pair.rb', line 34 def encrypted_private_key_pem encrypted_private_key end |
#public_key_filename ⇒ Object
54 55 56 |
# File 'lib/chamber/key_pair.rb', line 54 def public_key_filename "#{base_key_filename}.pub.pem" end |
#public_key_filepath ⇒ Object
30 31 32 |
# File 'lib/chamber/key_pair.rb', line 30 def public_key_filepath key_file_path + public_key_filename end |
#public_key_pem ⇒ Object
42 43 44 |
# File 'lib/chamber/key_pair.rb', line 42 def public_key_pem public_key.to_pem end |
#unencrypted_private_key_filename ⇒ Object
50 51 52 |
# File 'lib/chamber/key_pair.rb', line 50 def unencrypted_private_key_filename "#{base_key_filename}.pem" end |
#unencrypted_private_key_filepath ⇒ Object
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_pem ⇒ Object
38 39 40 |
# File 'lib/chamber/key_pair.rb', line 38 def unencrypted_private_key_pem unencrypted_private_key.to_pem end |