Class: Cloak::Entry
- Inherits:
-
Object
- Object
- Cloak::Entry
- Defined in:
- lib/cloak/entry.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Description.
-
#password ⇒ Object
Password in clear.
Instance Method Summary collapse
- #decrypt(key) ⇒ Object
- #encrypt(password_data, key) ⇒ Object
-
#initialize(description = nil) ⇒ Entry
constructor
Initialise with secret.
Constructor Details
#initialize(description = nil) ⇒ Entry
Initialise with secret
14 15 16 17 |
# File 'lib/cloak/entry.rb', line 14 def initialize(description = nil) @password = nil @description = description or raise 'Please enter a description of your entry' end |
Instance Attribute Details
#description ⇒ Object
Description
10 11 12 |
# File 'lib/cloak/entry.rb', line 10 def description @description end |
#password ⇒ Object
Password in clear
6 7 8 |
# File 'lib/cloak/entry.rb', line 6 def password @password end |
Instance Method Details
#decrypt(key) ⇒ Object
25 26 27 28 |
# File 'lib/cloak/entry.rb', line 25 def decrypt(key) blowfish = Crypt::Blowfish.new(key) blowfish.decrypt_string(@password) end |
#encrypt(password_data, key) ⇒ Object
19 20 21 22 23 |
# File 'lib/cloak/entry.rb', line 19 def encrypt(password_data, key) blowfish = Crypt::Blowfish.new(key) @password = blowfish.encrypt_string(password_data) @password.force_encoding("BINARY") end |