Class: LastPass::Vault
- Inherits:
-
Object
- Object
- LastPass::Vault
- Defined in:
- lib/lastpass/vault.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
readonly
Returns the value of attribute accounts.
Class Method Summary collapse
-
.fetch_blob(username, password, multifactor_password = nil) ⇒ Object
Just fetches the blob, could be used to store it locally.
-
.open(blob, username, password) ⇒ Object
Creates a vault from a blob object.
-
.open_local(blob_filename, username, password) ⇒ Object
Creates a vault from a locally stored blob.
-
.open_remote(username, password, multifactor_password = nil) ⇒ Object
Fetches a blob from the server and creates a vault.
Instance Method Summary collapse
-
#initialize(blob, encryption_key) ⇒ Vault
constructor
This more of an internal method, use one of the static constructors instead.
Constructor Details
#initialize(blob, encryption_key) ⇒ Vault
This more of an internal method, use one of the static constructors instead
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/lastpass/vault.rb', line 29 def initialize blob, encryption_key @accounts = [] key = encryption_key rsa_private_key = nil Parser.extract_chunks(blob).each do |i| case i.id when "ACCT" # TODO: Put shared folder name as group in the account account = Parser.parse_ACCT i, key if account @accounts << account end when "PRIK" rsa_private_key = Parser.parse_PRIK i, encryption_key when "SHAR" # After SHAR chunk all the folliwing accounts are enrypted with a new key key = Parser.parse_SHAR(i, encryption_key, rsa_private_key)[:encryption_key] end end end |
Instance Attribute Details
#accounts ⇒ Object (readonly)
Returns the value of attribute accounts.
6 7 8 |
# File 'lib/lastpass/vault.rb', line 6 def accounts @accounts end |
Class Method Details
.fetch_blob(username, password, multifactor_password = nil) ⇒ Object
Just fetches the blob, could be used to store it locally
24 25 26 |
# File 'lib/lastpass/vault.rb', line 24 def self.fetch_blob username, password, multifactor_password = nil Fetcher.fetch Fetcher.login username, password, multifactor_password end |
.open(blob, username, password) ⇒ Object
Creates a vault from a blob object
19 20 21 |
# File 'lib/lastpass/vault.rb', line 19 def self.open blob, username, password new blob, blob.encryption_key(username, password) end |
.open_local(blob_filename, username, password) ⇒ Object
Creates a vault from a locally stored blob
14 15 16 |
# File 'lib/lastpass/vault.rb', line 14 def self.open_local blob_filename, username, password # TODO: read the blob here end |
.open_remote(username, password, multifactor_password = nil) ⇒ Object
Fetches a blob from the server and creates a vault
9 10 11 |
# File 'lib/lastpass/vault.rb', line 9 def self.open_remote username, password, multifactor_password = nil open Vault.fetch_blob(username, password, multifactor_password), username, password end |