rotp 6.2.0 → 6.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rotp might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd976bfa6985075f5e2b76607256d0afbbdf88a82c38cd094d0eaffbb5bce4f2
4
- data.tar.gz: 70df660f1eca3dd9efc7baa1f53061ba9af1bbb49e4bb6ead507509f6e845d38
3
+ metadata.gz: 9ecb2247634bd68cca10dc441b74ee72ac9f5da864d87741458b1217504a998e
4
+ data.tar.gz: 966a044c680040ae627edd5bc12b0b2e7fb0f8e6c6b1bab2c869d505734cd267
5
5
  SHA512:
6
- metadata.gz: 7fb326cc887a1a5614c90c492ac43b72188f75caa90fcc50c3338d129abe2efe4f67af88d018c378379806f1bef0c1d0e40fc6c683f4427f40ad411326729022
7
- data.tar.gz: 4f913bf0693c1cead926bfe625e226fe8277323f93a552459447a792cd27b9189860ab26d3907baafff0e217430b04fb9e8b1829b0795e4c96e83062fac409fb
6
+ metadata.gz: 2d331d941f4a81957800ee7e9fc3b5c34f85bbcbc10b6eac0c27ea42948eeea0ee491f01d1eec999adf132281087abd616bd3f6e0dc60c684cc2999c3df3205e
7
+ data.tar.gz: efa2b84c25f7f74661dce4943808419cc46a2ff19157dc7f254ee56a329b097f01c4598aa0dd7dba4cba9cb0bbc81e53fed297b1abaf5309e7f46ee3809761e8
@@ -0,0 +1,19 @@
1
+ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ruby/.devcontainer/base.Dockerfile
2
+
3
+ # [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.1, 3.0, 2, 2.7, 3-bullseye, 3.1-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 3-buster, 3.1-buster, 3.0-buster, 2-buster, 2.7-buster
4
+ ARG VARIANT="3.1-bullseye"
5
+ FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
6
+
7
+ # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8
+ ARG NODE_VERSION="none"
9
+ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10
+
11
+ # [Optional] Uncomment this section to install additional OS packages.
12
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
13
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
14
+
15
+ # [Optional] Uncomment this line to install additional gems.
16
+ # RUN gem install <your-gem-names-here>
17
+
18
+ # [Optional] Uncomment this line to install global node packages.
19
+ # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
@@ -0,0 +1,37 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2
+ // https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ruby
3
+ {
4
+ "name": "Ruby",
5
+ "build": {
6
+ "dockerfile": "Dockerfile",
7
+ "args": {
8
+ // Update 'VARIANT' to pick a Ruby version: 3, 3.1, 3.0, 2, 2.7
9
+ // Append -bullseye or -buster to pin to an OS version.
10
+ // Use -bullseye variants on local on arm64/Apple Silicon.
11
+ "VARIANT": "3-bullseye",
12
+ // Options
13
+ "NODE_VERSION": "16"
14
+ }
15
+ },
16
+
17
+ // Configure tool-specific properties.
18
+ "customizations": {
19
+ // Configure properties specific to VS Code.
20
+ "vscode": {
21
+ // Add the IDs of extensions you want installed when the container is created.
22
+ "extensions": [
23
+ "rebornix.Ruby"
24
+ ]
25
+ }
26
+ },
27
+
28
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
29
+ // "forwardPorts": [],
30
+
31
+ // Use 'postCreateCommand' to run commands after the container is created.
32
+ // "postCreateCommand": "ruby --version",
33
+
34
+ // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
35
+ "remoteUser": "vscode"
36
+
37
+ }
@@ -0,0 +1,27 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ ruby-version: ['3.1', '3.0', '2.7', '2.3']
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - name: Set up Ruby ${{ matrix.ruby-version }}
21
+ uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ - name: Install dependencies
25
+ run: bundle install
26
+ - name: Run tests
27
+ run: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### Changelog
2
2
 
3
+ ### 6.2.1
4
+
5
+ - Removed old rdoc folder that was triggering a security warning due to an
6
+ old version of JQuery being included in the HTML docs. This has no impact
7
+ on the Ruby library.
8
+
3
9
  ### 6.2.0
4
10
 
5
11
  - Update to expand compatibility with Ruby 3. This was only a change to the
@@ -49,6 +55,11 @@
49
55
 
50
56
  - Simplify API
51
57
  - Remove support for Ruby < 2.0
58
+ - BREAKING CHANGE: Removed optional second argument (`padding`) from:
59
+ - `HOTP#at`
60
+ - `OTP#generate_otp`
61
+ - `TOTP#at`
62
+ - `TOTP#now` (first argument)
52
63
 
53
64
  #### 3.3.1
54
65
 
data/README.md CHANGED
@@ -1,11 +1,24 @@
1
+ ## Webauthn and the future of 2FA
2
+
3
+ Although this library will continue to be maintained, if you're implementing a 2FA solution today, you should take a look at [Webauthn](https://webauthn.guide/). It doesn't involve shared secrets and it's supported by most modern browsers and operating systems.
4
+
5
+ ### Ruby resources for Webauthn
6
+
7
+ - [Multi-Factor Authentication for Rails With WebAuthn and Devise](https://www.honeybadger.io/blog/multi-factor-2fa-authentication-rails-webauthn-devise/)
8
+ - [Webauthn Ruby Gem](https://github.com/cedarcode/webauthn-ruby)
9
+ - [Rails demo app with Webauthn](https://github.com/cedarcode/webauthn-rails-demo-app)
10
+
11
+ ----
12
+
1
13
  # The Ruby One Time Password Library
2
14
 
3
- [![Build Status](https://travis-ci.org/mdp/rotp.svg?branch=master)](https://travis-ci.org/mdp/rotp)
15
+ [![Build Status](https://github.com/mdp/rotp/actions/workflows/test.yaml/badge.svg)](https://github.com/mdp/rotp/actions/workflows/test.yaml)
4
16
  [![Gem Version](https://badge.fury.io/rb/rotp.svg)](https://rubygems.org/gems/rotp)
5
17
  [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](https://www.rubydoc.info/github/mdp/rotp/master)
6
18
  [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/mdp/rotp/blob/master/LICENSE)
7
19
 
8
- A ruby library for generating and validating one time passwords (HOTP & TOTP) according to [RFC 4226](http://tools.ietf.org/html/rfc4226) and [RFC 6238](http://tools.ietf.org/html/rfc6238).
20
+
21
+ A ruby library for generating and validating one time passwords (HOTP & TOTP) according to [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226) and [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238).
9
22
 
10
23
  ROTP is compatible with [Google Authenticator](https://github.com/google/google-authenticator) available for [Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2) and [iPhone](https://itunes.apple.com/en/app/google-authenticator/id388497605) and any other TOTP based implementations.
11
24
 
@@ -14,7 +27,7 @@ Many websites use this for [multi-factor authentication](https://www.youtube.com
14
27
  ## Dependencies
15
28
 
16
29
  * OpenSSL
17
- * Ruby 2.0 or higher
30
+ * Ruby 2.3 or higher
18
31
 
19
32
  ## Breaking changes
20
33
 
@@ -32,7 +45,7 @@ Many websites use this for [multi-factor authentication](https://www.youtube.com
32
45
  ### Breaking changes in >= 4.0
33
46
 
34
47
  - Simplified API
35
- - `verify` now takes options for `drift` and `after`
48
+ - `verify` now takes options for `drift` and `after`,`padding` is no longer an option
36
49
  - `verify` returns a timestamp if true, nil if false
37
50
  - Dropping support for Ruby < 2.0
38
51
  - Docs for 3.x can be found [here](https://github.com/mdp/rotp/tree/v3.x)
data/lib/rotp/otp.rb CHANGED
@@ -18,7 +18,6 @@ module ROTP
18
18
  end
19
19
 
20
20
  # @param [Integer] input the number used seed the HMAC
21
- # @option padded [Boolean] (false) Output the otp as a 0 padded string
22
21
  # Usually either the counter, or the computed integer
23
22
  # based on the Unix timestamp
24
23
  def generate_otp(input)
data/lib/rotp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ROTP
2
- VERSION = '6.2.0'.freeze
2
+ VERSION = '6.2.1'.freeze
3
3
  end
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: 6.2.0
4
+ version: 6.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Percival
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-30 00:00:00.000000000 Z
11
+ date: 2022-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -74,13 +74,13 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".devcontainer/Dockerfile"
78
+ - ".devcontainer/devcontainer.json"
77
79
  - ".dockerignore"
80
+ - ".github/workflows/test.yaml"
78
81
  - ".gitignore"
79
- - ".travis.yml"
80
82
  - CHANGELOG.md
81
83
  - Dockerfile-2.3
82
- - Dockerfile-2.5
83
- - Dockerfile-2.6
84
84
  - Dockerfile-2.7
85
85
  - Dockerfile-3.0-rc
86
86
  - Gemfile
@@ -88,24 +88,6 @@ files:
88
88
  - LICENSE
89
89
  - README.md
90
90
  - bin/rotp
91
- - doc/ROTP/HOTP.html
92
- - doc/ROTP/OTP.html
93
- - doc/ROTP/TOTP.html
94
- - doc/Rotp.html
95
- - doc/_index.html
96
- - doc/class_list.html
97
- - doc/css/common.css
98
- - doc/css/full_list.css
99
- - doc/css/style.css
100
- - doc/file.README.html
101
- - doc/file_list.html
102
- - doc/frames.html
103
- - doc/index.html
104
- - doc/js/app.js
105
- - doc/js/full_list.js
106
- - doc/js/jquery.js
107
- - doc/method_list.html
108
- - doc/top-level-namespace.html
109
91
  - docker-compose.yml
110
92
  - lib/rotp.rb
111
93
  - lib/rotp/arguments.rb
@@ -143,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
125
  - !ruby/object:Gem::Version
144
126
  version: '0'
145
127
  requirements: []
146
- rubygems_version: 3.1.2
128
+ rubygems_version: 3.3.7
147
129
  signing_key:
148
130
  specification_version: 4
149
131
  summary: A Ruby library for generating and verifying one time passwords
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- before_install: gem install bundler -v '<2'
3
- rvm:
4
- - 2.7
5
- - 2.6
6
- - 2.5
7
- - 2.3
8
- script:
9
- - bundle exec rspec
data/Dockerfile-2.5 DELETED
@@ -1,10 +0,0 @@
1
- FROM ruby:2.5
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"]
data/Dockerfile-2.6 DELETED
@@ -1,11 +0,0 @@
1
- FROM ruby:2.6
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"]
11
-
data/doc/ROTP/HOTP.html DELETED
@@ -1,308 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta name="Content-Type" content="text/html; charset=utf-8" />
6
- <title>Class: ROTP::HOTP</title>
7
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
-
10
- <script type="text/javascript" charset="utf-8">
11
- relpath = '..';
12
- if (relpath != '') relpath += '/';
13
- </script>
14
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
-
17
- </head>
18
- <body>
19
- <script type="text/javascript" charset="utf-8">
20
- if (window.top.frames.main) document.body.className = 'frames';
21
- </script>
22
-
23
- <div id="header">
24
- <div id="menu">
25
-
26
- <a href="../_index.html">Index (H)</a> &raquo;
27
- <span class='title'><span class='object_link'><a href="../ROTP.html" title="ROTP (module)">ROTP</a></span></span>
28
- &raquo;
29
- <span class="title">HOTP</span>
30
-
31
-
32
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
- </div>
34
-
35
- <div id="search">
36
- <a id="class_list_link" href="#">Class List</a>
37
- <a id="method_list_link" href="#">Method List</a>
38
- <a id ="file_list_link" href="#">File List</a>
39
- </div>
40
-
41
- <div class="clear"></div>
42
- </div>
43
-
44
- <iframe id="search_frame"></iframe>
45
-
46
- <div id="content"><h1>Class: ROTP::HOTP
47
-
48
-
49
-
50
- </h1>
51
-
52
- <dl class="box">
53
-
54
- <dt class="r1">Inherits:</dt>
55
- <dd class="r1">
56
- <span class="inheritName"><span class='object_link'><a href="OTP.html" title="ROTP::OTP (class)">OTP</a></span></span>
57
-
58
- <ul class="fullTree">
59
- <li>Object</li>
60
-
61
- <li class="next"><span class='object_link'><a href="OTP.html" title="ROTP::OTP (class)">OTP</a></span></li>
62
-
63
- <li class="next">ROTP::HOTP</li>
64
-
65
- </ul>
66
- <a href="#" class="inheritanceTree">show all</a>
67
-
68
- </dd>
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
- <dt class="r2 last">Defined in:</dt>
79
- <dd class="r2 last">lib/rotp/hotp.rb</dd>
80
-
81
- </dl>
82
- <div class="clear"></div>
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
- <h2>
93
- Instance Method Summary
94
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
95
- </h2>
96
-
97
- <ul class="summary">
98
-
99
- <li class="public ">
100
- <span class="summary_signature">
101
-
102
- <a href="#at-instance_method" title="#at (instance method)">- (Object) <strong>at</strong>(count) </a>
103
-
104
-
105
-
106
- </span>
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
- <span class="summary_desc"><div class='inline'></div></span>
116
-
117
- </li>
118
-
119
-
120
- <li class="public ">
121
- <span class="summary_signature">
122
-
123
- <a href="#provisioning_uri-instance_method" title="#provisioning_uri (instance method)">- (String) <strong>provisioning_uri</strong>(name, start_count = 0) </a>
124
-
125
-
126
-
127
- </span>
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
- <span class="summary_desc"><div class='inline'><p>
137
- Returns the provisioning URI for the OTP This can then be encoded in a QR
138
- Code and used to provision the Google Authenticator app.
139
- </p>
140
- </div></span>
141
-
142
- </li>
143
-
144
-
145
- </ul>
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
- <h3 class="inherited">Methods inherited from <span class='object_link'><a href="OTP.html" title="ROTP::OTP (class)">OTP</a></span></h3>
157
- <p class="inherited"><span class='object_link'><a href="OTP.html#byte_secret-instance_method" title="ROTP::OTP#byte_secret (method)">#byte_secret</a></span>, <span class='object_link'><a href="OTP.html#generate_otp-instance_method" title="ROTP::OTP#generate_otp (method)">#generate_otp</a></span>, <span class='object_link'><a href="OTP.html#initialize-instance_method" title="ROTP::OTP#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="OTP.html#int_to_bytestring-instance_method" title="ROTP::OTP#int_to_bytestring (method)">#int_to_bytestring</a></span></p>
158
- <div id="constructor_details" class="method_details_list">
159
- <h2>Constructor Details</h2>
160
-
161
- <p class="notice">This class inherits a constructor from <span class='object_link'><a href="OTP.html#initialize-instance_method" title="ROTP::OTP#initialize (method)">ROTP::OTP</a></span></p>
162
-
163
- </div>
164
-
165
-
166
- <div id="instance_method_details" class="method_details_list">
167
- <h2>Instance Method Details</h2>
168
-
169
-
170
- <div class="method_details first">
171
- <p class="signature first" id="at-instance_method">
172
-
173
- - (<tt>Object</tt>) <strong>at</strong>(count)
174
-
175
-
176
-
177
- </p><table class="source_code">
178
- <tr>
179
- <td>
180
- <pre class="lines">
181
-
182
-
183
- 3
184
- 4
185
- 5</pre>
186
- </td>
187
- <td>
188
- <pre class="code"><span class="info file"># File 'lib/rotp/hotp.rb', line 3</span>
189
-
190
- <span class='def def kw'>def</span> <span class='at identifier id'>at</span><span class='lparen token'>(</span><span class='count identifier id'>count</span><span class='rparen token'>)</span>
191
- <span class='generate_otp identifier id'>generate_otp</span><span class='lparen token'>(</span><span class='count identifier id'>count</span><span class='rparen token'>)</span>
192
- <span class='end end kw'>end</span>
193
- </pre>
194
- </td>
195
- </tr>
196
- </table>
197
- </div>
198
-
199
- <div class="method_details ">
200
- <p class="signature " id="provisioning_uri-instance_method">
201
-
202
- - (<tt>String</tt>) <strong>provisioning_uri</strong>(name, start_count = 0)
203
-
204
-
205
-
206
- </p><div class="docstring">
207
- <div class="discussion">
208
- <p>
209
- Returns the provisioning URI for the OTP This can then be encoded in a QR
210
- Code and used to provision the Google Authenticator app
211
- </p>
212
-
213
-
214
- </div>
215
- </div>
216
- <div class="tags">
217
- <h3>Parameters:</h3>
218
- <ul class="param">
219
-
220
- <li>
221
-
222
- <span class='type'>(<tt>String</tt>)</span>
223
-
224
-
225
- <span class='name'>name</span>
226
-
227
-
228
-
229
- &mdash;
230
- <div class='inline'><p>
231
- of the account
232
- </p>
233
- </div>
234
-
235
- </li>
236
-
237
- <li>
238
-
239
- <span class='type'>(<tt>Integer</tt>)</span>
240
-
241
-
242
- <span class='name'>initial</span>
243
-
244
-
245
-
246
- &mdash;
247
- <div class='inline'><p>
248
- counter value, defaults to 0
249
- </p>
250
- </div>
251
-
252
- </li>
253
-
254
- </ul>
255
- <h3>Returns:</h3>
256
- <ul class="return">
257
-
258
- <li>
259
-
260
- <span class='type'>(<tt>String</tt>)</span>
261
-
262
-
263
-
264
-
265
- &mdash;
266
- <div class='inline'><p>
267
- provisioning uri
268
- </p>
269
- </div>
270
-
271
- </li>
272
-
273
- </ul>
274
-
275
- </div><table class="source_code">
276
- <tr>
277
- <td>
278
- <pre class="lines">
279
-
280
-
281
- 13
282
- 14
283
- 15</pre>
284
- </td>
285
- <td>
286
- <pre class="code"><span class="info file"># File 'lib/rotp/hotp.rb', line 13</span>
287
-
288
- <span class='def def kw'>def</span> <span class='provisioning_uri identifier id'>provisioning_uri</span><span class='lparen token'>(</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='start_count identifier id'>start_count</span><span class='assign token'>=</span><span class='integer val'>0</span><span class='rparen token'>)</span>
289
- <span class='dstring node'>&quot;otpauth://hotp/#{URI.encode(name)}?secret=#{secret}&amp;counter=#{start_count}&quot;</span>
290
- <span class='end end kw'>end</span>
291
- </pre>
292
- </td>
293
- </tr>
294
- </table>
295
- </div>
296
-
297
- </div>
298
-
299
- </div>
300
-
301
- <div id="footer">
302
- Generated on Sun Feb 13 12:31:41 2011 by
303
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
304
- 0.6.4 (ruby-1.8.7).
305
- </div>
306
-
307
- </body>
308
- </html>