1pass 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module OnePass
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -12,15 +12,15 @@ class EncryptionKey
12
12
  end
13
13
 
14
14
  def get(identifier)
15
- @items.select {|ek| ek.identifier == identifier}.first
15
+ @items.select {|ek| ek.identifier == identifier || ek.level == identifier}.first
16
16
  end
17
17
  end
18
18
 
19
19
  class EncryptionKeyItem
20
- attr_reader :identifier, :decrypted_master_key
20
+ attr_reader :identifier, :level, :decrypted_master_key
21
21
 
22
22
  def initialize(hash_)
23
- @identifier, @data, @validation, @iterations = hash_.values_at("identifier", "data", "validation", "iterations")
23
+ @identifier, @data, @validation, @iterations, @level = hash_.values_at("identifier", "data", "validation", "iterations", "level")
24
24
  end
25
25
 
26
26
  def unlock(password)
data/lib/key.rb CHANGED
@@ -7,14 +7,16 @@ class Key
7
7
  end
8
8
 
9
9
  def initialize(hash_)
10
- @key_id, @encrypted, @type_name = hash_.values_at("keyID", "encrypted", "typeName")
10
+ @key_id, @encrypted, @type_name, @security_level = hash_.values_at("keyID", "encrypted", "typeName", "securityLevel")
11
+ @type = types[@type_name] || Password
11
12
  end
12
13
 
13
14
  def decrypt(encryption_key)
14
- decrypted_master_key = encryption_key.get(@key_id).decrypted_master_key
15
+ encryption_key_item = encryption_key.get(@key_id) || encryption_key.get(@security_level)
16
+ decrypted_master_key = encryption_key_item.decrypted_master_key
15
17
  return unless decrypted_master_key
16
- decrypted_content = JSON.parse Decrypt.decrypt_ssl(decrypted_master_key, @encrypted)
17
- types[@type_name].new decrypted_content
18
+ decrypted_content = JSON.parse Decrypt.decrypt_ssl(decrypted_master_key, @encrypted)
19
+ @type.new decrypted_content
18
20
  end
19
21
  end
20
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 1pass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-17 00:00:00.000000000 Z
12
+ date: 2013-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  segments:
76
76
  - 0
77
- hash: 797335186741412980
77
+ hash: 3607015952039489117
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  none: false
80
80
  requirements:
@@ -83,11 +83,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  segments:
85
85
  - 0
86
- hash: 797335186741412980
86
+ hash: 3607015952039489117
87
87
  requirements: []
88
88
  rubyforge_project:
89
89
  rubygems_version: 1.8.25
90
90
  signing_key:
91
91
  specification_version: 3
92
- summary: 1pass-0.1.1
92
+ summary: 1pass-0.1.2
93
93
  test_files: []