Class: RPass::VaultProvider
- Inherits:
-
Object
- Object
- RPass::VaultProvider
- Defined in:
- lib/rpass/vault_provider.rb
Instance Attribute Summary collapse
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
- #cli ⇒ Object
- #get_password ⇒ Object
- #get_second_factor ⇒ Object
- #get_username ⇒ Object
-
#initialize(storage) ⇒ VaultProvider
constructor
A new instance of VaultProvider.
- #username ⇒ Object
- #vault ⇒ Object
Constructor Details
#initialize(storage) ⇒ VaultProvider
Returns a new instance of VaultProvider.
14 15 16 |
# File 'lib/rpass/vault_provider.rb', line 14 def initialize(storage) @storage = storage end |
Instance Attribute Details
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
12 13 14 |
# File 'lib/rpass/vault_provider.rb', line 12 def storage @storage end |
Instance Method Details
#cli ⇒ Object
38 39 40 |
# File 'lib/rpass/vault_provider.rb', line 38 def cli @cli ||= HighLine.new end |
#get_password ⇒ Object
26 27 28 |
# File 'lib/rpass/vault_provider.rb', line 26 def get_password cli.ask("Enter your password: "){ |q| q.echo = false }.strip end |
#get_second_factor ⇒ Object
30 31 32 |
# File 'lib/rpass/vault_provider.rb', line 30 def get_second_factor cli.ask("Enter your second factor: ").strip end |
#get_username ⇒ Object
34 35 36 |
# File 'lib/rpass/vault_provider.rb', line 34 def get_username cli.ask("Enter your username: ").strip end |
#username ⇒ Object
22 23 24 |
# File 'lib/rpass/vault_provider.rb', line 22 def username storage["username"] ||= get_username end |
#vault ⇒ Object
18 19 20 |
# File 'lib/rpass/vault_provider.rb', line 18 def vault LastPass::Vault.open_remote(username, get_password, get_second_factor) end |