yubikey-neo 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +11 -2
- data/README.md +18 -12
- data/exe/yubioath +5 -0
- data/lib/yubikey/neo.rb +35 -2
- data/lib/yubikey/neo/cli/yubioath.rb +46 -0
- data/yubikey-neo.gemspec +5 -1
- metadata +49 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba2f21f06e2f187e444f99745dd07ff719b01395
|
4
|
+
data.tar.gz: 141b118b2e4a375b825d50428eb71b50bc63db81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a3ff5a05f7bf57fc7620b9fbf25f7395fd79961aeb498b1ed88dfac0f85cf3aee23f03f748b2328304f0517a8fe3463ff183830d3d1dbbb76e84d66b229f421
|
7
|
+
data.tar.gz: 81f51f22060aca6e541b06e1505a26025029ae10a6aebc15388c9ae25b8a42a763f19ca38db0bc0c17dc62da3706e7f8a4200e19d9052ebb2eb6fc7be4d7aeb5
|
data/.rubocop_todo.yml
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on 2015-
|
2
|
+
# on 2015-09-25 21:29:57 +0200 using RuboCop version 0.32.1.
|
3
3
|
# The point is for the user to remove these configuration records
|
4
4
|
# one by one as the offenses are removed from the code base.
|
5
5
|
# Note that changes in the inspected code, or installation of new
|
6
6
|
# versions of RuboCop, may require this file to be generated again.
|
7
7
|
|
8
|
-
# Offense count:
|
8
|
+
# Offense count: 1
|
9
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
10
|
+
Style/ClassAndModuleChildren:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# Offense count: 3
|
9
14
|
Style/Documentation:
|
10
15
|
Enabled: false
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
Style/ModuleFunction:
|
19
|
+
Enabled: false
|
data/README.md
CHANGED
@@ -6,23 +6,30 @@ TODO: Delete this and the text above, and describe your gem
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'yubikey-neo'
|
9
|
+
```
|
10
|
+
$ gem install yubikey-neo
|
13
11
|
```
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
$ bundle
|
13
|
+
## Usage
|
18
14
|
|
19
|
-
|
15
|
+
```
|
16
|
+
$ yubioath add GitHub
|
17
|
+
Secret: rzpagcujxo
|
18
|
+
Token: 629283
|
20
19
|
|
21
|
-
|
20
|
+
$ yubioath add Heroku
|
21
|
+
Secret: ofljhedpyb
|
22
|
+
Token: 993874
|
22
23
|
|
23
|
-
|
24
|
+
$ yubioath list
|
25
|
+
GitHub: 629283
|
26
|
+
Heroku: 993874
|
27
|
+
```
|
24
28
|
|
25
|
-
|
29
|
+
```
|
30
|
+
$ yubioath token GitHub
|
31
|
+
629283
|
32
|
+
```
|
26
33
|
|
27
34
|
## Development
|
28
35
|
|
@@ -34,7 +41,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
34
41
|
|
35
42
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yubikey-neo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
43
|
|
37
|
-
|
38
44
|
## License
|
39
45
|
|
40
46
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/exe/yubioath
ADDED
data/lib/yubikey/neo.rb
CHANGED
@@ -1,5 +1,38 @@
|
|
1
|
+
require 'smartcard'
|
2
|
+
require 'yubioath'
|
3
|
+
|
1
4
|
module Yubikey
|
2
|
-
|
3
|
-
|
5
|
+
class Neo
|
6
|
+
def initialize(name: 'Yubico Yubikey NEO OTP+CCID')
|
7
|
+
@name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def yubioath
|
11
|
+
tap do |neo|
|
12
|
+
yield YubiOATH.new(neo)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def tap
|
17
|
+
Context.tap do |context|
|
18
|
+
begin
|
19
|
+
card = context.card(@name, :shared)
|
20
|
+
yield card
|
21
|
+
ensure
|
22
|
+
card.disconnect unless card.nil?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
module Context
|
28
|
+
extend self
|
29
|
+
|
30
|
+
def tap
|
31
|
+
context = Smartcard::PCSC::Context.new
|
32
|
+
yield context
|
33
|
+
ensure
|
34
|
+
context.release
|
35
|
+
end
|
36
|
+
end
|
4
37
|
end
|
5
38
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'yubikey/neo'
|
2
|
+
require 'thor'
|
3
|
+
|
4
|
+
class Yubikey::Neo
|
5
|
+
module CLI
|
6
|
+
class YubiOATH < Thor
|
7
|
+
desc 'add NAME', 'Add a token'
|
8
|
+
def add(name)
|
9
|
+
neo.yubioath do |yubioath|
|
10
|
+
yubioath.put(name: name, secret: ask('Secret:'))
|
11
|
+
print "Token: "
|
12
|
+
puts yubioath.calculate(name: name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'delete NAME', 'Delete a token'
|
17
|
+
def delete(name)
|
18
|
+
neo.yubioath do |yubioath|
|
19
|
+
yubioath.delete(name: name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'list', 'List all tokens'
|
24
|
+
def list
|
25
|
+
neo.yubioath do |yubioath|
|
26
|
+
yubioath.calculate_all(timestamp: Time.now).map do |name, token|
|
27
|
+
puts "#{name}: #{token}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'token NAME', 'Retrieve a token'
|
33
|
+
def token(name)
|
34
|
+
neo.yubioath do |yubioath|
|
35
|
+
puts yubioath.calculate(name: name, timestamp: Time.now)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def neo
|
42
|
+
@neo ||= Yubikey::Neo.new
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/yubikey-neo.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'yubikey-neo'
|
7
|
-
spec.version = '0.0
|
7
|
+
spec.version = '0.1.0'
|
8
8
|
spec.authors = ['James Ottaway']
|
9
9
|
spec.email = ['rubygems@james.ottaway.io']
|
10
10
|
spec.summary = 'Securely manage your 2FA tokens using your Yubikey NEO'
|
@@ -15,4 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.bindir = 'exe'
|
16
16
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
spec.add_dependency 'smartcard', '~> 0.5.6'
|
20
|
+
spec.add_dependency 'yubioath', '~> 1.1'
|
21
|
+
spec.add_dependency 'thor', '~> 0.19.1'
|
18
22
|
end
|
metadata
CHANGED
@@ -1,19 +1,62 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yubikey-neo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Ottaway
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
12
|
-
dependencies:
|
11
|
+
date: 2015-09-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: smartcard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.5.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.5.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yubioath
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
13
55
|
description:
|
14
56
|
email:
|
15
57
|
- rubygems@james.ottaway.io
|
16
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- yubioath
|
17
60
|
extensions: []
|
18
61
|
extra_rdoc_files: []
|
19
62
|
files:
|
@@ -29,7 +72,9 @@ files:
|
|
29
72
|
- Rakefile
|
30
73
|
- bin/console
|
31
74
|
- bin/setup
|
75
|
+
- exe/yubioath
|
32
76
|
- lib/yubikey/neo.rb
|
77
|
+
- lib/yubikey/neo/cli/yubioath.rb
|
33
78
|
- yubikey-neo.gemspec
|
34
79
|
homepage: https://github.com/jamesottaway/yubikey-neo
|
35
80
|
licenses:
|