rotp 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/README.markdown +41 -0
- data/doc/ROTP/HOTP.html +308 -0
- data/doc/ROTP/OTP.html +593 -0
- data/doc/ROTP/TOTP.html +493 -0
- data/doc/Rotp.html +179 -0
- data/doc/_index.html +144 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +310 -0
- data/doc/file.README.html +89 -0
- data/doc/file_list.html +38 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +89 -0
- data/doc/js/app.js +203 -0
- data/doc/js/full_list.js +149 -0
- data/doc/js/jquery.js +154 -0
- data/doc/method_list.html +155 -0
- data/doc/top-level-namespace.html +88 -0
- data/lib/rotp.rb +10 -1
- data/lib/rotp/hotp.rb +14 -0
- data/lib/rotp/otp.rb +25 -5
- data/lib/rotp/totp.rb +20 -5
- data/lib/rotp/version.rb +2 -2
- data/rotp.gemspec +2 -2
- data/spec/base_spec.rb +19 -0
- metadata +25 -5
data/doc/ROTP/TOTP.html
ADDED
@@ -0,0 +1,493 @@
|
|
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::TOTP</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 (T)</a> »
|
27
|
+
<span class='title'><span class='object_link'><a href="../ROTP.html" title="ROTP (module)">ROTP</a></span></span>
|
28
|
+
»
|
29
|
+
<span class="title">TOTP</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::TOTP
|
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::TOTP</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/totp.rb</dd>
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
91
|
+
<ul class="summary">
|
92
|
+
|
93
|
+
<li class="public ">
|
94
|
+
<span class="summary_signature">
|
95
|
+
|
96
|
+
<a href="#interval-instance_method" title="#interval (instance method)">- (Object) <strong>interval</strong> </a>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
</span>
|
101
|
+
|
102
|
+
|
103
|
+
<span class="note title readonly">readonly</span>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<span class="summary_desc"><div class='inline'><p>
|
113
|
+
Returns the value of attribute interval.
|
114
|
+
</p>
|
115
|
+
</div></span>
|
116
|
+
|
117
|
+
</li>
|
118
|
+
|
119
|
+
|
120
|
+
</ul>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<h2>
|
125
|
+
Instance Method Summary
|
126
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
127
|
+
</h2>
|
128
|
+
|
129
|
+
<ul class="summary">
|
130
|
+
|
131
|
+
<li class="public ">
|
132
|
+
<span class="summary_signature">
|
133
|
+
|
134
|
+
<a href="#at-instance_method" title="#at (instance method)">- (Object) <strong>at</strong>(time) </a>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
148
|
+
|
149
|
+
</li>
|
150
|
+
|
151
|
+
|
152
|
+
<li class="public ">
|
153
|
+
<span class="summary_signature">
|
154
|
+
|
155
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (TOTP) <strong>initialize</strong>(s, options = {}) </a>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
</span>
|
160
|
+
|
161
|
+
<span class="note title constructor">constructor</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<span class="summary_desc"><div class='inline'><p>
|
171
|
+
A new instance of TOTP.
|
172
|
+
</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#now-instance_method" title="#now (instance method)">- (Object) <strong>now</strong> </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
195
|
+
|
196
|
+
</li>
|
197
|
+
|
198
|
+
|
199
|
+
<li class="public ">
|
200
|
+
<span class="summary_signature">
|
201
|
+
|
202
|
+
<a href="#provisioning_uri-instance_method" title="#provisioning_uri (instance method)">- (String) <strong>provisioning_uri</strong>(name) </a>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'><p>
|
216
|
+
Returns the provisioning URI for the OTP This can then be encoded in a QR
|
217
|
+
Code and used to provision the Google Authenticator app.
|
218
|
+
</p>
|
219
|
+
</div></span>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
|
224
|
+
</ul>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="OTP.html" title="ROTP::OTP (class)">OTP</a></span></h3>
|
236
|
+
<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#int_to_bytestring-instance_method" title="ROTP::OTP#int_to_bytestring (method)">#int_to_bytestring</a></span></p>
|
237
|
+
<div id="constructor_details" class="method_details_list">
|
238
|
+
<h2>Constructor Details</h2>
|
239
|
+
|
240
|
+
<div class="method_details first">
|
241
|
+
<p class="signature first" id="initialize-instance_method">
|
242
|
+
|
243
|
+
- (<tt><span class='object_link'><a href="" title="ROTP::TOTP (class)">TOTP</a></span></tt>) <strong>initialize</strong>(s, options = {})
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
</p><div class="docstring">
|
248
|
+
<div class="discussion">
|
249
|
+
<p>
|
250
|
+
A new instance of TOTP
|
251
|
+
</p>
|
252
|
+
|
253
|
+
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
<div class="tags">
|
257
|
+
|
258
|
+
</div><table class="source_code">
|
259
|
+
<tr>
|
260
|
+
<td>
|
261
|
+
<pre class="lines">
|
262
|
+
|
263
|
+
|
264
|
+
6
|
265
|
+
7
|
266
|
+
8
|
267
|
+
9</pre>
|
268
|
+
</td>
|
269
|
+
<td>
|
270
|
+
<pre class="code"><span class="info file"># File 'lib/rotp/totp.rb', line 6</span>
|
271
|
+
|
272
|
+
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='s identifier id'>s</span><span class='comma token'>,</span> <span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
273
|
+
<span class='@interval ivar id'>@interval</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:interval</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='integer val'>30</span>
|
274
|
+
<span class='super super kw'>super</span>
|
275
|
+
<span class='end end kw'>end</span>
|
276
|
+
</pre>
|
277
|
+
</td>
|
278
|
+
</tr>
|
279
|
+
</table>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
</div>
|
283
|
+
|
284
|
+
<div id="instance_attr_details" class="attr_details">
|
285
|
+
<h2>Instance Attribute Details</h2>
|
286
|
+
|
287
|
+
|
288
|
+
<span id=""></span>
|
289
|
+
<span id="interval-instance_method"></span>
|
290
|
+
<div class="method_details first">
|
291
|
+
<p class="signature first" id="interval-instance_method">
|
292
|
+
|
293
|
+
- (<tt>Object</tt>) <strong>interval</strong> <span class="extras">(readonly)</span>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</p><div class="docstring">
|
298
|
+
<div class="discussion">
|
299
|
+
<p>
|
300
|
+
Returns the value of attribute interval
|
301
|
+
</p>
|
302
|
+
|
303
|
+
|
304
|
+
</div>
|
305
|
+
</div>
|
306
|
+
<div class="tags">
|
307
|
+
|
308
|
+
</div><table class="source_code">
|
309
|
+
<tr>
|
310
|
+
<td>
|
311
|
+
<pre class="lines">
|
312
|
+
|
313
|
+
|
314
|
+
4
|
315
|
+
5
|
316
|
+
6</pre>
|
317
|
+
</td>
|
318
|
+
<td>
|
319
|
+
<pre class="code"><span class="info file"># File 'lib/rotp/totp.rb', line 4</span>
|
320
|
+
|
321
|
+
<span class='def def kw'>def</span> <span class='interval identifier id'>interval</span>
|
322
|
+
<span class='@interval ivar id'>@interval</span>
|
323
|
+
<span class='end end kw'>end</span>
|
324
|
+
</pre>
|
325
|
+
</td>
|
326
|
+
</tr>
|
327
|
+
</table>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
</div>
|
331
|
+
|
332
|
+
|
333
|
+
<div id="instance_method_details" class="method_details_list">
|
334
|
+
<h2>Instance Method Details</h2>
|
335
|
+
|
336
|
+
|
337
|
+
<div class="method_details first">
|
338
|
+
<p class="signature first" id="at-instance_method">
|
339
|
+
|
340
|
+
- (<tt>Object</tt>) <strong>at</strong>(time)
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
</p><table class="source_code">
|
345
|
+
<tr>
|
346
|
+
<td>
|
347
|
+
<pre class="lines">
|
348
|
+
|
349
|
+
|
350
|
+
11
|
351
|
+
12
|
352
|
+
13
|
353
|
+
14
|
354
|
+
15
|
355
|
+
16</pre>
|
356
|
+
</td>
|
357
|
+
<td>
|
358
|
+
<pre class="code"><span class="info file"># File 'lib/rotp/totp.rb', line 11</span>
|
359
|
+
|
360
|
+
<span class='def def kw'>def</span> <span class='at identifier id'>at</span><span class='lparen token'>(</span><span class='time identifier id'>time</span><span class='rparen token'>)</span>
|
361
|
+
<span class='unless unless kw'>unless</span> <span class='time identifier id'>time</span><span class='dot token'>.</span><span class='class identifier id'>class</span> <span class='eq op'>==</span> <span class='Time constant id'>Time</span>
|
362
|
+
<span class='time identifier id'>time</span> <span class='assign token'>=</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='at identifier id'>at</span><span class='lparen token'>(</span><span class='time identifier id'>time</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span><span class='rparen token'>)</span>
|
363
|
+
<span class='end end kw'>end</span>
|
364
|
+
<span class='generate_otp identifier id'>generate_otp</span><span class='lparen token'>(</span><span class='timecode identifier id'>timecode</span><span class='lparen token'>(</span><span class='time identifier id'>time</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
365
|
+
<span class='end end kw'>end</span>
|
366
|
+
</pre>
|
367
|
+
</td>
|
368
|
+
</tr>
|
369
|
+
</table>
|
370
|
+
</div>
|
371
|
+
|
372
|
+
<div class="method_details ">
|
373
|
+
<p class="signature " id="now-instance_method">
|
374
|
+
|
375
|
+
- (<tt>Object</tt>) <strong>now</strong>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
</p><table class="source_code">
|
380
|
+
<tr>
|
381
|
+
<td>
|
382
|
+
<pre class="lines">
|
383
|
+
|
384
|
+
|
385
|
+
18
|
386
|
+
19
|
387
|
+
20</pre>
|
388
|
+
</td>
|
389
|
+
<td>
|
390
|
+
<pre class="code"><span class="info file"># File 'lib/rotp/totp.rb', line 18</span>
|
391
|
+
|
392
|
+
<span class='def def kw'>def</span> <span class='now identifier id'>now</span>
|
393
|
+
<span class='generate_otp identifier id'>generate_otp</span><span class='lparen token'>(</span><span class='timecode identifier id'>timecode</span><span class='lparen token'>(</span><span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='now identifier id'>now</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
394
|
+
<span class='end end kw'>end</span>
|
395
|
+
</pre>
|
396
|
+
</td>
|
397
|
+
</tr>
|
398
|
+
</table>
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div class="method_details ">
|
402
|
+
<p class="signature " id="provisioning_uri-instance_method">
|
403
|
+
|
404
|
+
- (<tt>String</tt>) <strong>provisioning_uri</strong>(name)
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</p><div class="docstring">
|
409
|
+
<div class="discussion">
|
410
|
+
<p>
|
411
|
+
Returns the provisioning URI for the OTP This can then be encoded in a QR
|
412
|
+
Code and used to provision the Google Authenticator app
|
413
|
+
</p>
|
414
|
+
|
415
|
+
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
<div class="tags">
|
419
|
+
<h3>Parameters:</h3>
|
420
|
+
<ul class="param">
|
421
|
+
|
422
|
+
<li>
|
423
|
+
|
424
|
+
<span class='type'>(<tt>String</tt>)</span>
|
425
|
+
|
426
|
+
|
427
|
+
<span class='name'>name</span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
—
|
432
|
+
<div class='inline'><p>
|
433
|
+
of the account
|
434
|
+
</p>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
</li>
|
438
|
+
|
439
|
+
</ul>
|
440
|
+
<h3>Returns:</h3>
|
441
|
+
<ul class="return">
|
442
|
+
|
443
|
+
<li>
|
444
|
+
|
445
|
+
<span class='type'>(<tt>String</tt>)</span>
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
—
|
451
|
+
<div class='inline'><p>
|
452
|
+
provisioning uri
|
453
|
+
</p>
|
454
|
+
</div>
|
455
|
+
|
456
|
+
</li>
|
457
|
+
|
458
|
+
</ul>
|
459
|
+
|
460
|
+
</div><table class="source_code">
|
461
|
+
<tr>
|
462
|
+
<td>
|
463
|
+
<pre class="lines">
|
464
|
+
|
465
|
+
|
466
|
+
27
|
467
|
+
28
|
468
|
+
29</pre>
|
469
|
+
</td>
|
470
|
+
<td>
|
471
|
+
<pre class="code"><span class="info file"># File 'lib/rotp/totp.rb', line 27</span>
|
472
|
+
|
473
|
+
<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='rparen token'>)</span>
|
474
|
+
<span class='dstring node'>"otpauth://totp/#{URI.encode(name)}?secret=#{secret}"</span>
|
475
|
+
<span class='end end kw'>end</span>
|
476
|
+
</pre>
|
477
|
+
</td>
|
478
|
+
</tr>
|
479
|
+
</table>
|
480
|
+
</div>
|
481
|
+
|
482
|
+
</div>
|
483
|
+
|
484
|
+
</div>
|
485
|
+
|
486
|
+
<div id="footer">
|
487
|
+
Generated on Sun Feb 13 12:31:41 2011 by
|
488
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
489
|
+
0.6.4 (ruby-1.8.7).
|
490
|
+
</div>
|
491
|
+
|
492
|
+
</body>
|
493
|
+
</html>
|