rotp 5.1.0 → 6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21758aaaffd88bc9b2042b13f269b8ea16e93aa870a02f8538d688d2290dfe6d
4
- data.tar.gz: 57e7983b8321fcf43982436b9ebc0aaad1ed5248e8a3359a6fefeafdf139527d
3
+ metadata.gz: c56412a3603b43a3371e26cfb7d9314b2469e99558ea7f58a86b3c51f7e30055
4
+ data.tar.gz: 1923418367d2df594d64fb3b5810aad696a78a93ff89e4a19b655dcc4c98cff3
5
5
  SHA512:
6
- metadata.gz: 58d61e11ce0ef3a2f6fc7e0e8ca577f2e93dc4c8f5bb2b880a5cb5428beccfca09723871b4d3b256d20f3c8f7246cb5b6128af9bd63ca38a039e50e10ec60314
7
- data.tar.gz: 2f47df80e1d3f4f84005183f9963f589e64a6cb1a2d35dc1cf15bb33cce707de2cf048f5569c7c778f93dbad63f619e16c530cdafdcb092bc3025fbd44e994ff
6
+ metadata.gz: ede75377c7c88538f4c6dc1dbe623f5ad099382a59f38245a35cde7a20f3fd17b38178ffcb0db960d7a923432dc8fe1c8eef760c58d0dcd57cb6709971fcb0e1
7
+ data.tar.gz: 4bda95ccda7e78c4bb33fe57e9d79e0eda0654074e5b8b6461e9e59f25dd23bb8554e6f003f5375a1e857f126e41c6829e818c9f6bab288f583c204ed6444f49
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  before_install: gem install bundler -v '<2'
3
3
  rvm:
4
+ - 2.7
4
5
  - 2.6
5
6
  - 2.5
6
- - 2.0
7
+ - 2.3
7
8
  script:
8
9
  - bundle exec rspec
@@ -1,5 +1,13 @@
1
1
  ### Changelog
2
2
 
3
+ ### 6.0.0
4
+
5
+ - Dropping support for Ruby <2.3 (Major version bump)
6
+ - Fix issue when using --enable-frozen-string-literal Ruby option #95 (jeremyevans)
7
+ - URI Encoding fix #94 (ksuh90)
8
+ - Update gems (rake, addressable)
9
+ - Update Travis tests to include Ruby 2.7
10
+
3
11
  ### 5.1.0
4
12
 
5
13
  - Create `random_base32` to perform `random` to avoid breaking changes
@@ -0,0 +1,10 @@
1
+ FROM ruby:2.3
2
+
3
+ RUN mkdir -p /usr/src/app
4
+ WORKDIR /usr/src/app
5
+
6
+ COPY Gemfile /usr/src/app/
7
+ COPY . /usr/src/app
8
+ RUN bundle install
9
+
10
+ CMD ["bundle", "exec", "rspec"]
@@ -1,4 +1,4 @@
1
- FROM ruby:2.0
1
+ FROM ruby:2.7
2
2
 
3
3
  RUN mkdir -p /usr/src/app
4
4
  WORKDIR /usr/src/app
data/README.md CHANGED
@@ -18,12 +18,16 @@ Many websites use this for [multi-factor authentication](https://www.youtube.com
18
18
 
19
19
  ## Breaking changes
20
20
 
21
+ ### Breaking changes in >= 6.0
22
+
23
+ - Dropping support for Ruby <2.3
24
+
21
25
  ### Breaking changes in >= 5.0
22
26
 
23
27
  - `ROTP::Base32.random_base32` is now `ROTP::Base32.random` and the argument
24
28
  has changed from secret string length to byte length to allow for more
25
- precision
26
- - Cleaned up the Base32 implementation to better match Google Authenticator's version
29
+ precision. There is an alias to allow for `random_base32` for the time being.
30
+ - Cleaned up the Base32 implementation to match Google Authenticator's version.
27
31
 
28
32
  ### Breaking changes in >= 4.0
29
33
 
@@ -66,8 +70,8 @@ hotp.at(1) # => "595254"
66
70
  hotp.at(1401) # => "259769"
67
71
 
68
72
  # OTP verified with a counter
69
- hotp.verify("316439", 1401) # => 1401
70
- hotp.verify("316439", 1402) # => nil
73
+ hotp.verify("259769", 1401) # => 1401
74
+ hotp.verify("259769", 1402) # => nil
71
75
  ```
72
76
 
73
77
  ### Preventing reuse of Time based OTP's
@@ -78,7 +82,7 @@ the interval window (default 30 seconds)
78
82
  The following is an example of this in action:
79
83
 
80
84
  ```ruby
81
- User.find(someUserID)
85
+ user = User.find(someUserID)
82
86
  totp = ROTP::TOTP.new(user.otp_secret)
83
87
  totp.now # => "492039"
84
88
 
@@ -129,7 +133,7 @@ Google Authenticator.
129
133
 
130
134
  ```ruby
131
135
  totp = ROTP::TOTP.new("base32secret3232", issuer: "My Service")
132
- totp.provisioning_uri("alice@google.com") # => 'otpauth://totp/My%20Service:alice@google.com?secret=base32secret3232&issuer=My+Service'
136
+ totp.provisioning_uri("alice@google.com") # => 'otpauth://totp/My%20Service:alice@google.com?secret=base32secret3232&issuer=My%20Service'
133
137
 
134
138
  hotp = ROTP::HOTP.new("base32secret3232", issuer: "My Service")
135
139
  hotp.provisioning_uri("alice@google.com", 0) # => 'otpauth://hotp/alice@google.com?secret=base32secret3232&counter=0'
@@ -28,7 +28,7 @@ module ROTP
28
28
 
29
29
  def encode(b)
30
30
  data = b.unpack('c*')
31
- out = ''
31
+ out = String.new
32
32
  buffer = data[0]
33
33
  idx = 1
34
34
  bits_left = 8
@@ -62,7 +62,7 @@ module ROTP
62
62
  params = {
63
63
  secret: secret,
64
64
  period: interval == 30 ? nil : interval,
65
- issuer: issuer,
65
+ issuer: Addressable::URI.encode(issuer),
66
66
  digits: digits == DEFAULT_DIGITS ? nil : digits,
67
67
  algorithm: digest.casecmp('SHA1').zero? ? nil : digest.upcase
68
68
  }
@@ -1,3 +1,3 @@
1
1
  module ROTP
2
- VERSION = '5.1.0'.freeze
2
+ VERSION = '6.0.0'.freeze
3
3
  end
@@ -4,6 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.name = 'rotp'
5
5
  s.version = ROTP::VERSION
6
6
  s.platform = Gem::Platform::RUBY
7
+ s.required_ruby_version = '~> 2.3'
7
8
  s.license = 'MIT'
8
9
  s.authors = ['Mark Percival']
9
10
  s.email = ['mark@markpercival.us']
@@ -11,16 +12,14 @@ Gem::Specification.new do |s|
11
12
  s.summary = 'A Ruby library for generating and verifying one time passwords'
12
13
  s.description = 'Works for both HOTP and TOTP, and includes QR Code provisioning'
13
14
 
14
- s.rubyforge_project = 'rotp'
15
-
16
15
  s.files = `git ls-files`.split("\n")
17
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
17
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
18
  s.require_paths = ['lib']
20
19
 
21
- s.add_runtime_dependency 'addressable', '~> 2.5'
20
+ s.add_runtime_dependency 'addressable', '~> 2.7'
22
21
 
23
- s.add_development_dependency 'rake', '~> 10.5'
22
+ s.add_development_dependency "rake", "~> 13.0"
24
23
  s.add_development_dependency 'rspec', '~> 3.5'
25
24
  s.add_development_dependency 'simplecov', '~> 0.12'
26
25
  s.add_development_dependency 'timecop', '~> 0.8'
@@ -262,6 +262,14 @@ RSpec.describe ROTP::TOTP do
262
262
  it 'includes the issuer as parameter' do
263
263
  expect(params['issuer'].first).to eq 'FooCo'
264
264
  end
265
+
266
+ context 'with spaces in issuer' do
267
+ let(:totp) { ROTP::TOTP.new 'JBSWY3DPEHPK3PXP', issuer: 'Foo Co' }
268
+
269
+ it 'includes the uri encoded issuer as parameter' do
270
+ expect(params['issuer'].first).to eq 'Foo%20Co'
271
+ end
272
+ end
265
273
  end
266
274
 
267
275
  context 'with custom interval' 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: 5.1.0
4
+ version: 6.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: 2019-06-27 00:00:00.000000000 Z
11
+ date: 2020-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.5'
19
+ version: '2.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.5'
26
+ version: '2.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.5'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.5'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -92,9 +92,10 @@ files:
92
92
  - ".gitignore"
93
93
  - ".travis.yml"
94
94
  - CHANGELOG.md
95
- - Dockerfile-2.0
95
+ - Dockerfile-2.3
96
96
  - Dockerfile-2.5
97
97
  - Dockerfile-2.6
98
+ - Dockerfile-2.7
98
99
  - Gemfile
99
100
  - Guardfile
100
101
  - LICENSE
@@ -144,17 +145,16 @@ require_paths:
144
145
  - lib
145
146
  required_ruby_version: !ruby/object:Gem::Requirement
146
147
  requirements:
147
- - - ">="
148
+ - - "~>"
148
149
  - !ruby/object:Gem::Version
149
- version: '0'
150
+ version: '2.3'
150
151
  required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  requirements:
152
153
  - - ">="
153
154
  - !ruby/object:Gem::Version
154
155
  version: '0'
155
156
  requirements: []
156
- rubyforge_project: rotp
157
- rubygems_version: 2.7.6
157
+ rubygems_version: 3.0.3
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: A Ruby library for generating and verifying one time passwords