rotp 2.1.2 → 3.0.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/CHANGELOG.md +4 -0
- data/README.md +3 -2
- data/lib/rotp/totp.rb +7 -2
- data/lib/rotp/version.rb +1 -1
- data/spec/lib/rotp/totp_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17c7287512c5437d21d34d9d0eae73f42cce0501
|
4
|
+
data.tar.gz: a2b8c0c4133681b23af7a30c34f9e6d0386e1f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc396f7711a415619afd44e5b2d1eba90dada73990a4531fb5bede1dc0d7c8c620e745be388e85ad34d290878a14e92e194ed9379ff0226964cac97070eada7c
|
7
|
+
data.tar.gz: 9ed66cff8f1b90b54252842131d1f2c046d87a1082381470b8ea0c7b2e3cda890039967b1b458d771ca3e5f4f7f5a3892fdaff6f408b8618ff357405e9727b31
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -39,6 +39,7 @@ Optionally, you can provide an issuer which will be used as a title in Google Au
|
|
39
39
|
|
40
40
|
```ruby
|
41
41
|
totp = ROTP::TOTP.new("base32secret3232", issuer: "My Service")
|
42
|
+
totp.provisioning_uri("alice@google.com")
|
42
43
|
```
|
43
44
|
|
44
45
|
### Counter based OTP's
|
@@ -68,8 +69,8 @@ Provisioning URI's generated by ROTP are compatible with the Google Authenticato
|
|
68
69
|
to be scanned with the in-built QR Code scanner.
|
69
70
|
|
70
71
|
```ruby
|
71
|
-
totp.provisioning_uri("alice@google.com") # => 'otpauth://totp/alice@google.com?secret=JBSWY3DPEHPK3PXP'
|
72
|
-
hotp.provisioning_uri("alice@google.com", 0) # => 'otpauth://hotp/alice@google.com?secret=JBSWY3DPEHPK3PXP&counter=0'
|
72
|
+
totp.provisioning_uri("alice@google.com") # => 'otpauth://totp/issuer:alice@google.com?secret=JBSWY3DPEHPK3PXP'
|
73
|
+
hotp.provisioning_uri("alice@google.com", 0) # => 'otpauth://hotp/issuer:alice@google.com?secret=JBSWY3DPEHPK3PXP&counter=0'
|
73
74
|
```
|
74
75
|
|
75
76
|
This can then be rendered as a QR Code which can then be scanned and added to the users
|
data/lib/rotp/totp.rb
CHANGED
@@ -51,9 +51,14 @@ module ROTP
|
|
51
51
|
# This can then be encoded in a QR Code and used
|
52
52
|
# to provision the Google Authenticator app
|
53
53
|
# @param [String] name of the account
|
54
|
-
# @return [String] provisioning
|
54
|
+
# @return [String] provisioning URI
|
55
55
|
def provisioning_uri(name)
|
56
|
-
|
56
|
+
# The format of this URI is documented at:
|
57
|
+
# https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
58
|
+
# For compatibility the issuer appears both before that account name and also in the
|
59
|
+
# query string.
|
60
|
+
issuer_string = issuer.nil? ? "" : "#{URI.encode(issuer)}:"
|
61
|
+
encode_params("otpauth://totp/#{issuer_string}#{URI.encode(name)}",
|
57
62
|
:secret => secret, :period => (interval==30 ? nil : interval), :issuer => issuer)
|
58
63
|
end
|
59
64
|
|
data/lib/rotp/version.rb
CHANGED
data/spec/lib/rotp/totp_spec.rb
CHANGED
@@ -101,7 +101,7 @@ RSpec.describe ROTP::TOTP do
|
|
101
101
|
let(:totp) { ROTP::TOTP.new 'JBSWY3DPEHPK3PXP', issuer: 'FooCo' }
|
102
102
|
|
103
103
|
it 'has the correct format' do
|
104
|
-
expect(uri).to match %r{\Aotpauth:\/\/totp
|
104
|
+
expect(uri).to match %r{\Aotpauth:\/\/totp/FooCo:.+}
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'includes the secret as parameter' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rotp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Percival
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard-rspec
|