lib/lockr/action/list.rb in lockr-0.4.5 vs lib/lockr/action/list.rb in lockr-0.5.0

- old
+ new

@@ -1,21 +1,20 @@ -require 'lockr/action/aes' -require 'lockr/pwdstore' +require 'lockr/action/base' -class ListAction < AesAction +class ListAction < BaseAction def initialize( keyfile, vault) - pwd_directory = load_from_vault( vault) + super( keyfile, vault) + pwdlist = @pwdmgr.list() out = [] if keyfile.nil? - pwd_directory.each { |id,value| + pwdlist.each { |id,value| out << "Id: #{id}" } else - keyfilehash = FileUtils.calculate_sha512_hash( keyfile) - pwd_directory.each { |oid,value| - pwd_directory_id = YAML::load(decrypt( value[:enc], keyfilehash, value[:salt])) + pwdlist.each { |oid,site_directory| + pwd_directory_id = site_directory pwd_directory_id.each { |username, pwdstore| out << "Id: #{pwdstore.id} / Username: #{pwdstore.username}" } } end \ No newline at end of file