Class: Keychain
- Inherits:
-
Object
- Object
- Keychain
- Defined in:
- lib/keychain.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#encryption_key ⇒ Object
readonly
Returns the value of attribute encryption_key.
Instance Method Summary collapse
- #get(name) ⇒ Object
-
#initialize(path) ⇒ Keychain
constructor
A new instance of Keychain.
- #unlock(password) ⇒ Object
Constructor Details
#initialize(path) ⇒ Keychain
Returns a new instance of Keychain.
9 10 11 12 13 |
# File 'lib/keychain.rb', line 9 def initialize(path) @path = path load_encryption_keys load_contents end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/keychain.rb', line 7 def content @content end |
#encryption_key ⇒ Object (readonly)
Returns the value of attribute encryption_key.
7 8 9 |
# File 'lib/keychain.rb', line 7 def encryption_key @encryption_key end |
Instance Method Details
#get(name) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/keychain.rb', line 19 def get(name) item = @content.find(name) return unless item key = Key.new load_file(item.uuid + ".1password") key.decrypt(@encryption_key) end |
#unlock(password) ⇒ Object
15 16 17 |
# File 'lib/keychain.rb', line 15 def unlock(password) @unlocked = @encryption_key.unlock(password) end |