awsborn 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/awsborn/keychain.rb +12 -8
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.6
1
+ 0.3.7
@@ -16,19 +16,23 @@ module Awsborn
16
16
  @unlocked = false
17
17
  end
18
18
 
19
- def note (name)
19
+ def get (name)
20
20
  unlock
21
- hex_dump = find_generic_password(name)
22
- text = decode_hex(hex_dump)
23
- text = string_content(text) if multi_encoded?(text)
21
+ password_line = find_generic_password(name)
22
+ if password_line.match(/^password: 0x/)
23
+ hex_dump = password_line[/password: 0x(\S+)/, 1]
24
+ text = decode_hex(hex_dump)
25
+ text = string_content(text) if multi_encoded?(text)
26
+ elsif password_line.match(/^password: "/)
27
+ text = password_line[/password: "(.+)"/, 1]
28
+ else
29
+ raise "Note '#{name}' not found in #{@keychain}"
30
+ end
24
31
  text
25
32
  end
26
33
 
27
34
  def find_generic_password (name)
28
- dump = `security -q find-generic-password -s "#{name}" -g "#{@keychain}" 2>&1 1>/dev/null`
29
- hex_dump = dump[/password: 0x(\S+)/, 1]
30
- raise "Note '#{name}' not found in #{@keychain}" unless hex_dump
31
- hex_dump
35
+ `security -q find-generic-password -s "#{name}" -g "#{@keychain}" 2>&1 1>/dev/null`
32
36
  end
33
37
 
34
38
  def decode_hex (hex_dump)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 7
9
+ version: 0.3.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Vrensk