Class: ListAction
- Inherits:
-
AesAction
- Object
- BaseAction
- AesAction
- ListAction
- Defined in:
- lib/lockr/action/list.rb
Instance Method Summary collapse
-
#initialize(keyfile, vault) ⇒ ListAction
constructor
A new instance of ListAction.
Methods included from Aes
#decrypt, #derive_key_iv, #encrypt
Methods inherited from BaseAction
#calculate_hash, #load_from_vault, #rotate_vault, #save_to_vault
Constructor Details
#initialize(keyfile, vault) ⇒ ListAction
Returns a new instance of ListAction.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lockr/action/list.rb', line 6 def initialize( keyfile, vault) pwd_directory = load_from_vault( vault) out = [] if keyfile.nil? pwd_directory.each { |id,value| out << "Id: #{id}" } else keyfilehash = calculate_hash( keyfile) pwd_directory.each { |oid,value| pwd_directory_id = YAML::load(decrypt( value[:enc], keyfilehash, value[:salt])) pwd_directory_id.each { |username, pwdstore| out << "Id: #{pwdstore.id} / Username: #{pwdstore.username}" } } end out.sort! out.each{ |e| puts e } end |