tfa 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a4ebff8bb56416e64852152dbcbfb0b9dd3d0fc
4
- data.tar.gz: cf0d9758601f1253a8bdd1e22edd65efea632c0d
3
+ metadata.gz: 31998f68b2ffd5161cc0349d47aa078b5d09d356
4
+ data.tar.gz: 08f0e8fcf9955ffe4b07073766d0108a2fcc2919
5
5
  SHA512:
6
- metadata.gz: a6c7d6ddcd7961d5fd040871525d46807ab44c8c1bf81f3ea73f246a7a24b7c5a49a16fcc95337f1278f65677058c83068e6b0d7d1765db348a865c0824c79e0
7
- data.tar.gz: a402ef2d8702b1793e98fb04a6e3b4a5f83fae2226e1776262e19b41f99c93370fdeaf6f49eb0a8d808e29b243813aa36847cb1bb321c3e8a4b28efd663ce2ef
6
+ metadata.gz: da32ced0dce6eb07611e48bc019c0fac3f729051cac8cb838d3437c6045cf0b46bab2ecb096957fcd0daa74e939d38049396e3f3575767cc2f34ca0ae93a81f1
7
+ data.tar.gz: 0d5b37925f8a2b3c67c4bb533d93d34468e85496e9c86b393e174b86ee27fd1fbef3dbf87c156bd39ee3ee40c435f13d3a65ec7b3a0ca03df651c15050f9db75
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
1
  --color
2
- --warnings
3
2
  --require spec_helper
data/README.md CHANGED
@@ -1,32 +1,60 @@
1
- # tfa
1
+ # two factor authentication
2
2
 
3
3
  [![Build Status](https://travis-ci.org/mokhan/tfa.svg?branch=v0.0.2)](https://travis-ci.org/mokhan/tfa)
4
+ [![Code Climate](https://codeclimate.com/github/mokhan/tfa.png)](https://codeclimate.com/github/mokhan/tfa)
5
+ [![Gitter chat](https://badges.gitter.im/mokhan/tfa.png)](https://gitter.im/mokhan/tfa)
4
6
 
5
- Create a one time password for your different environments.
7
+ This CLI helps to manage your one time passwords for different accounts/environments.
8
+ The goal of this tool is to help you generate one time passwords quickly
9
+ from the command line that you can pipe into your clipboard. This saves
10
+ you from having to pull out your phone and cracking open the Google
11
+ Authenticator app to generate a one time password.
6
12
 
13
+ In order to use this software you will need access to the secret
14
+ embedded in the provisioning uri used to set up your two factor
15
+ authentication account. This usually comes in the form of a QR Code
16
+ and might look like:
7
17
 
8
- ## Installation
18
+ ```ruby
19
+ 'otpauth://totp/alice@google.com?secret=JBSWY3DPEHPK3PXP'
20
+ ```
9
21
 
10
- Add this line to your application's Gemfile:
22
+ ## Installation
11
23
 
12
- gem 'tfa'
24
+ $ gem install tfa
13
25
 
14
- And then execute:
26
+ ## Usage
15
27
 
16
- $ bundle
28
+ To add a secret you can use the add command. The key you use can be
29
+ anything you choose. In the example below the key is development.
17
30
 
18
- Or install it yourself as:
31
+ ```shell
32
+ $ tfa add development <secret>
33
+ ```
19
34
 
20
- $ gem install tfa
35
+ To display the secret associated with a key:
21
36
 
22
- ## Usage
37
+ ```shell
38
+ $ tfa show development
39
+ ```
23
40
 
41
+ To generate a time based one time password for a specific key.
24
42
 
25
43
  ```shell
26
- $ tfa add
27
- $ tfa add develoment <secret>
28
- $ tfa show development
29
44
  $ tfa totp development
45
+ $ 260182
46
+ ```
47
+
48
+ You can also pipe it to your clipboard.
49
+
50
+ ```shell
51
+ $ tfa totp development | pbcopy
52
+ ```
53
+
54
+ or
55
+
56
+ ```shell
57
+ $ tfa totp development | xclip -selection clipboard
30
58
  ```
31
59
 
32
60
  ## Contributing
@@ -5,7 +5,7 @@ module TFA
5
5
  end
6
6
 
7
7
  def run(arguments)
8
- return password_for(secret_for(arguments.first)) if arguments.any?
8
+ return password_for(secret_for(arguments.first)) if valid?(arguments)
9
9
  all_passwords
10
10
  end
11
11
 
@@ -24,7 +24,11 @@ module TFA
24
24
  end
25
25
 
26
26
  def secret_for(key)
27
- @storage.secret_for(key)
27
+ @storage.secret_for(key)
28
+ end
29
+
30
+ def valid?(arguments)
31
+ arguments.any? && secret_for(arguments.first)
28
32
  end
29
33
  end
30
34
  end
data/lib/tfa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TFA
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -31,6 +31,12 @@ module TFA
31
31
  ])
32
32
  end
33
33
  end
34
+
35
+ context 'when the key is not known' do
36
+ it "returns with nothing" do
37
+ expect(subject.run(["blah"])).to be_empty
38
+ end
39
+ end
34
40
  end
35
41
  end
36
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rotp