security 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.
- data/Gemfile.lock +1 -1
- data/lib/security.rb +3 -1
- data/lib/security/keychain.rb +10 -10
- data/lib/security/password.rb +3 -7
- data/security-0.1.1.gem +0 -0
- metadata +8 -7
data/Gemfile.lock
CHANGED
data/lib/security.rb
CHANGED
data/lib/security/keychain.rb
CHANGED
@@ -9,19 +9,19 @@ module Security
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def info
|
12
|
-
system %{security show-keychain-info
|
12
|
+
system %{security show-keychain-info #{@filename.shellescape}}
|
13
13
|
end
|
14
14
|
|
15
15
|
def lock
|
16
|
-
system %{security lock-keychain
|
16
|
+
system %{security lock-keychain #{@filename.shellescape}}
|
17
17
|
end
|
18
18
|
|
19
19
|
def unlock(password)
|
20
|
-
system %{security unlock-keychain -p #{password}
|
20
|
+
system %{security unlock-keychain -p #{password.shellescape} #{@filename.shellescape}}
|
21
21
|
end
|
22
22
|
|
23
23
|
def delete
|
24
|
-
system %{security delete-keychain
|
24
|
+
system %{security delete-keychain #{@filename.shellescape}}
|
25
25
|
end
|
26
26
|
|
27
27
|
class << self
|
@@ -32,7 +32,7 @@ module Security
|
|
32
32
|
def list(domain = :user)
|
33
33
|
raise ArgumentError "Invalid domain #{domain}, expected one of: #{DOMAINS}" unless DOMAINS.include?(domain)
|
34
34
|
|
35
|
-
|
35
|
+
keychains_from_output(`security list-keychains -d #{domain}`)
|
36
36
|
end
|
37
37
|
|
38
38
|
def lock
|
@@ -40,21 +40,21 @@ module Security
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def unlock(password)
|
43
|
-
system %{security unlock-keychain -p #{password}}
|
43
|
+
system %{security unlock-keychain -p #{password.shellescape}}
|
44
44
|
end
|
45
45
|
|
46
46
|
def default_keychain
|
47
|
-
|
47
|
+
keychains_from_output(`security default-keychain`).first
|
48
48
|
end
|
49
49
|
|
50
50
|
def login_keychain
|
51
|
-
|
51
|
+
keychains_from_output(`security login-keychain`).first
|
52
52
|
end
|
53
53
|
|
54
54
|
private
|
55
55
|
|
56
|
-
def
|
57
|
-
|
56
|
+
def keychains_from_output(output)
|
57
|
+
output.split(/\n/).collect{|line| new(line.strip.gsub(/^\"|\"$/, ""))}
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
data/lib/security/password.rb
CHANGED
@@ -40,7 +40,7 @@ module Security
|
|
40
40
|
flags[:G] ||= options.delete(:value)
|
41
41
|
flags[:j] ||= options.delete(:comment)
|
42
42
|
|
43
|
-
flags.delete_if{|k,v| v.nil?}.collect{|k, v| "-#{k} #{v}".strip}.join(" ")
|
43
|
+
flags.delete_if{|k,v| v.nil?}.collect{|k, v| "-#{k} #{v.shellescape}".strip}.join(" ")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -56,9 +56,7 @@ module Security
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def find(options)
|
59
|
-
|
60
|
-
|
61
|
-
password_from_output(`security 2>&1 find-generic-password #{flags_for_options(options)}`)
|
59
|
+
password_from_output(`security 2>&1 find-generic-password -g #{flags_for_options(options)}`)
|
62
60
|
end
|
63
61
|
|
64
62
|
def delete(options)
|
@@ -85,9 +83,7 @@ module Security
|
|
85
83
|
end
|
86
84
|
|
87
85
|
def find(options)
|
88
|
-
|
89
|
-
|
90
|
-
password_from_output(`security 2>&1 find-internet-password #{flags_for_options(options)}`)
|
86
|
+
password_from_output(`security 2>&1 find-internet-password -g #{flags_for_options(options)}`)
|
91
87
|
end
|
92
88
|
|
93
89
|
def delete(options)
|
data/security-0.1.1.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: security
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-21 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70304035253220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.6.1
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70304035253220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70304035252680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.9.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70304035252680
|
36
36
|
description: Library for interacting with the Mac OS X Keychain
|
37
37
|
email: m@mattt.me
|
38
38
|
executables: []
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- ./Rakefile
|
50
50
|
- ./README.md
|
51
51
|
- ./security-0.1.0.gem
|
52
|
+
- ./security-0.1.1.gem
|
52
53
|
- ./security.gemspec
|
53
54
|
homepage: http://mattt.me
|
54
55
|
licenses: []
|
@@ -64,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
65
|
version: '0'
|
65
66
|
segments:
|
66
67
|
- 0
|
67
|
-
hash:
|
68
|
+
hash: -1161416136524147904
|
68
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
70
|
none: false
|
70
71
|
requirements:
|
@@ -73,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
74
|
version: '0'
|
74
75
|
segments:
|
75
76
|
- 0
|
76
|
-
hash:
|
77
|
+
hash: -1161416136524147904
|
77
78
|
requirements: []
|
78
79
|
rubyforge_project:
|
79
80
|
rubygems_version: 1.8.15
|