Sha256: c1b09371d3df5197ebcbfde44bb78f49e5939b33c3a519e1d043f4e4064cf152

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 Bytes

Contents

require 'lockr/action/aes'
require 'lockr/pwdstore'

class ListAction < AesAction
  
  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
  
end 

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lockr-0.3.0 lib/lockr/action/list.rb
lockr-0.2.1 lib/lockr/action/list.rb
lockr-0.2.0 lib/lockr/action/list.rb