1pass 0.1.0 → 0.1.1
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/lib/1pass.rb +11 -2
- data/lib/1pass/version.rb +1 -1
- metadata +5 -5
data/lib/1pass.rb
CHANGED
@@ -2,6 +2,9 @@ require "1pass/version"
|
|
2
2
|
require "keychain"
|
3
3
|
|
4
4
|
class AgileKeychain
|
5
|
+
INVALID_PASSWORD = "Maybe you should try asking a human?"
|
6
|
+
INVALID_KEY = "Invalid key. Keys are case-sensitive."
|
7
|
+
|
5
8
|
def initialize(path=nil)
|
6
9
|
path = path || "#{ENV["HOME"]}/Library/Application Support/1Password/1Password.agilekeychain"
|
7
10
|
@keychain = Keychain.new(path)
|
@@ -12,9 +15,15 @@ class AgileKeychain
|
|
12
15
|
end
|
13
16
|
|
14
17
|
def load(master_password, key_name, field_name=nil)
|
15
|
-
@keychain.unlock(master_password)
|
18
|
+
inform_and_exit(INVALID_PASSWORD) unless @keychain.unlock(master_password)
|
16
19
|
key = @keychain.get(key_name)
|
17
|
-
|
20
|
+
inform_and_exit(INVALID_KEY) unless key
|
18
21
|
puts field_name ? key.find(field_name) : key.fields
|
19
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def inform_and_exit(message)
|
26
|
+
puts message
|
27
|
+
exit 1
|
28
|
+
end
|
20
29
|
end
|
data/lib/1pass/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.1
|
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-
|
12
|
+
date: 2013-08-17 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:
|
77
|
+
hash: 797335186741412980
|
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:
|
86
|
+
hash: 797335186741412980
|
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.
|
92
|
+
summary: 1pass-0.1.1
|
93
93
|
test_files: []
|