pwned 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +32 -13
- data/bin/pwned +3 -3
- data/lib/pwned.rb +18 -2
- data/lib/pwned/hashed_password.rb +35 -0
- data/lib/pwned/password.rb +4 -125
- data/lib/pwned/password_base.rb +133 -0
- data/lib/pwned/version.rb +1 -1
- data/pwned.gemspec +1 -1
- metadata +5 -23
- data/docs/NotPwnedValidator.html +0 -494
- data/docs/Pwned.html +0 -521
- data/docs/Pwned/Error.html +0 -149
- data/docs/Pwned/Password.html +0 -936
- data/docs/Pwned/TimeoutError.html +0 -152
- data/docs/PwnedValidator.html +0 -192
- data/docs/_index.html +0 -162
- data/docs/class_list.html +0 -51
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -496
- data/docs/file.README.html +0 -424
- data/docs/file_list.html +0 -56
- data/docs/frames.html +0 -17
- data/docs/index.html +0 -424
- data/docs/js/app.js +0 -303
- data/docs/js/full_list.js +0 -216
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -115
- data/docs/top-level-namespace.html +0 -112
data/docs/Pwned/Error.html
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Exception: Pwned::Error
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.20
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "Pwned::Error";
|
19
|
-
relpath = '../';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="../_index.html">Index (E)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Pwned.html" title="Pwned (module)">Pwned</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">Error</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="../class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Exception: Pwned::Error
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
<dl>
|
70
|
-
<dt>Inherits:</dt>
|
71
|
-
<dd>
|
72
|
-
<span class="inheritName">StandardError</span>
|
73
|
-
|
74
|
-
<ul class="fullTree">
|
75
|
-
<li>Object</li>
|
76
|
-
|
77
|
-
<li class="next">StandardError</li>
|
78
|
-
|
79
|
-
<li class="next">Pwned::Error</li>
|
80
|
-
|
81
|
-
</ul>
|
82
|
-
<a href="#" class="inheritanceTree">show all</a>
|
83
|
-
|
84
|
-
</dd>
|
85
|
-
</dl>
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
<dl>
|
98
|
-
<dt>Defined in:</dt>
|
99
|
-
<dd>lib/pwned/error.rb</dd>
|
100
|
-
</dl>
|
101
|
-
|
102
|
-
</div>
|
103
|
-
|
104
|
-
<h2>Overview</h2><div class="docstring">
|
105
|
-
<div class="discussion">
|
106
|
-
|
107
|
-
<p>A base error for HTTP request errors that may be thrown when making
|
108
|
-
requests to the Pwned Passwords API.</p>
|
109
|
-
|
110
|
-
|
111
|
-
</div>
|
112
|
-
</div>
|
113
|
-
<div class="tags">
|
114
|
-
|
115
|
-
|
116
|
-
<p class="tag_title">See Also:</p>
|
117
|
-
<ul class="see">
|
118
|
-
|
119
|
-
<li><span class='object_link'><a href="Password.html#pwned%3F-instance_method" title="Pwned::Password#pwned? (method)">Password#pwned?</a></span></li>
|
120
|
-
|
121
|
-
<li><span class='object_link'><a href="Password.html#pwned_count-instance_method" title="Pwned::Password#pwned_count (method)">Password#pwned_count</a></span></li>
|
122
|
-
|
123
|
-
</ul>
|
124
|
-
|
125
|
-
</div><div id="subclasses">
|
126
|
-
<h2>Direct Known Subclasses</h2>
|
127
|
-
<p class="children"><span class='object_link'><a href="TimeoutError.html" title="Pwned::TimeoutError (class)">TimeoutError</a></span></p>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div id="footer">
|
142
|
-
Generated on Tue Oct 1 21:19:37 2019 by
|
143
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
144
|
-
0.9.20 (ruby-2.5.5).
|
145
|
-
</div>
|
146
|
-
|
147
|
-
</div>
|
148
|
-
</body>
|
149
|
-
</html>
|
data/docs/Pwned/Password.html
DELETED
@@ -1,936 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Class: Pwned::Password
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.20
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "Pwned::Password";
|
19
|
-
relpath = '../';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="../_index.html">Index (P)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Pwned.html" title="Pwned (module)">Pwned</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">Password</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="../class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Class: Pwned::Password
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
<dl>
|
70
|
-
<dt>Inherits:</dt>
|
71
|
-
<dd>
|
72
|
-
<span class="inheritName">Object</span>
|
73
|
-
|
74
|
-
<ul class="fullTree">
|
75
|
-
<li>Object</li>
|
76
|
-
|
77
|
-
<li class="next">Pwned::Password</li>
|
78
|
-
|
79
|
-
</ul>
|
80
|
-
<a href="#" class="inheritanceTree">show all</a>
|
81
|
-
|
82
|
-
</dd>
|
83
|
-
</dl>
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<dl>
|
96
|
-
<dt>Defined in:</dt>
|
97
|
-
<dd>lib/pwned/password.rb</dd>
|
98
|
-
</dl>
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<h2>Overview</h2><div class="docstring">
|
103
|
-
<div class="discussion">
|
104
|
-
|
105
|
-
<p>This class represents a password. It does all the work of talking to the
|
106
|
-
Pwned Passwords API to find out if the password has been pwned.</p>
|
107
|
-
|
108
|
-
|
109
|
-
</div>
|
110
|
-
</div>
|
111
|
-
<div class="tags">
|
112
|
-
|
113
|
-
|
114
|
-
<p class="tag_title">See Also:</p>
|
115
|
-
<ul class="see">
|
116
|
-
|
117
|
-
<li><a href="https://haveibeenpwned.com/API/v2#PwnedPasswords" target="_parent" title="https://haveibeenpwned.com/API/v2#PwnedPasswords">https://haveibeenpwned.com/API/v2#PwnedPasswords</a></li>
|
118
|
-
|
119
|
-
</ul>
|
120
|
-
|
121
|
-
</div>
|
122
|
-
|
123
|
-
<h2>
|
124
|
-
Constant Summary
|
125
|
-
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
126
|
-
</h2>
|
127
|
-
|
128
|
-
<dl class="constants">
|
129
|
-
|
130
|
-
<dt id="API_URL-constant" class="">API_URL =
|
131
|
-
<div class="docstring">
|
132
|
-
<div class="discussion">
|
133
|
-
|
134
|
-
<p>The base URL for the Pwned Passwords API</p>
|
135
|
-
|
136
|
-
|
137
|
-
</div>
|
138
|
-
</div>
|
139
|
-
<div class="tags">
|
140
|
-
|
141
|
-
|
142
|
-
</div>
|
143
|
-
</dt>
|
144
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>https://api.pwnedpasswords.com/range/</span><span class='tstring_end'>"</span></span></pre></dd>
|
145
|
-
|
146
|
-
<dt id="HASH_PREFIX_LENGTH-constant" class="">HASH_PREFIX_LENGTH =
|
147
|
-
<div class="docstring">
|
148
|
-
<div class="discussion">
|
149
|
-
|
150
|
-
<p>The number of characters from the start of the hash of the password that
|
151
|
-
are used to search for the range of passwords.</p>
|
152
|
-
|
153
|
-
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
<div class="tags">
|
157
|
-
|
158
|
-
|
159
|
-
</div>
|
160
|
-
</dt>
|
161
|
-
<dd><pre class="code"><span class='int'>5</span></pre></dd>
|
162
|
-
|
163
|
-
<dt id="SHA1_LENGTH-constant" class="">SHA1_LENGTH =
|
164
|
-
<div class="docstring">
|
165
|
-
<div class="discussion">
|
166
|
-
|
167
|
-
<p>The total length of a SHA1 hash</p>
|
168
|
-
|
169
|
-
|
170
|
-
</div>
|
171
|
-
</div>
|
172
|
-
<div class="tags">
|
173
|
-
|
174
|
-
|
175
|
-
</div>
|
176
|
-
</dt>
|
177
|
-
<dd><pre class="code"><span class='int'>40</span></pre></dd>
|
178
|
-
|
179
|
-
<dt id="DEFAULT_REQUEST_HEADERS-constant" class="">DEFAULT_REQUEST_HEADERS =
|
180
|
-
<div class="docstring">
|
181
|
-
<div class="discussion">
|
182
|
-
|
183
|
-
<p>The default request headers that are used to make HTTP requests to the API.
|
184
|
-
A user agent is provided as requested in the documentation.</p>
|
185
|
-
|
186
|
-
|
187
|
-
</div>
|
188
|
-
</div>
|
189
|
-
<div class="tags">
|
190
|
-
|
191
|
-
|
192
|
-
<p class="tag_title">See Also:</p>
|
193
|
-
<ul class="see">
|
194
|
-
|
195
|
-
<li><a href="https://haveibeenpwned.com/API/v2#UserAgent" target="_parent" title="https://haveibeenpwned.com/API/v2#UserAgent">https://haveibeenpwned.com/API/v2#UserAgent</a></li>
|
196
|
-
|
197
|
-
</ul>
|
198
|
-
|
199
|
-
</div>
|
200
|
-
</dt>
|
201
|
-
<dd><pre class="code"><span class='lbrace'>{</span>
|
202
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Ruby Pwned::Password </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="../Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Pwned.html#VERSION-constant" title="Pwned::VERSION (constant)">VERSION</a></span></span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
203
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
204
|
-
|
205
|
-
</dl>
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
212
|
-
<ul class="summary">
|
213
|
-
|
214
|
-
<li class="public ">
|
215
|
-
<span class="summary_signature">
|
216
|
-
|
217
|
-
<a href="#password-instance_method" title="#password (instance method)">#<strong>password</strong> ⇒ String </a>
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
</span>
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
<span class="note title readonly">readonly</span>
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
<span class="summary_desc"><div class='inline'>
|
237
|
-
<p>The password that is being checked.</p>
|
238
|
-
</div></span>
|
239
|
-
|
240
|
-
</li>
|
241
|
-
|
242
|
-
|
243
|
-
</ul>
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
<h2>
|
250
|
-
Instance Method Summary
|
251
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
252
|
-
</h2>
|
253
|
-
|
254
|
-
<ul class="summary">
|
255
|
-
|
256
|
-
<li class="public ">
|
257
|
-
<span class="summary_signature">
|
258
|
-
|
259
|
-
<a href="#hashed_password-instance_method" title="#hashed_password (instance method)">#<strong>hashed_password</strong> ⇒ String </a>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
</span>
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
<span class="summary_desc"><div class='inline'>
|
274
|
-
<p>Returns the full SHA1 hash of the given password in uppercase.</p>
|
275
|
-
</div></span>
|
276
|
-
|
277
|
-
</li>
|
278
|
-
|
279
|
-
|
280
|
-
<li class="public ">
|
281
|
-
<span class="summary_signature">
|
282
|
-
|
283
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(password, request_options = {}) ⇒ Boolean </a>
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
</span>
|
288
|
-
|
289
|
-
|
290
|
-
<span class="note title constructor">constructor</span>
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
<span class="summary_desc"><div class='inline'>
|
300
|
-
<p>Creates a new password object.</p>
|
301
|
-
</div></span>
|
302
|
-
|
303
|
-
</li>
|
304
|
-
|
305
|
-
|
306
|
-
<li class="public ">
|
307
|
-
<span class="summary_signature">
|
308
|
-
|
309
|
-
<a href="#pwned%3F-instance_method" title="#pwned? (instance method)">#<strong>pwned?</strong> ⇒ Boolean </a>
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
</span>
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
<span class="summary_desc"><div class='inline'>
|
324
|
-
<p><code>true</code> when the password has been pwned.</p>
|
325
|
-
</div></span>
|
326
|
-
|
327
|
-
</li>
|
328
|
-
|
329
|
-
|
330
|
-
<li class="public ">
|
331
|
-
<span class="summary_signature">
|
332
|
-
|
333
|
-
<a href="#pwned_count-instance_method" title="#pwned_count (instance method)">#<strong>pwned_count</strong> ⇒ Integer </a>
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
</span>
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
<span class="summary_desc"><div class='inline'>
|
348
|
-
<p>The number of times the password has been pwned.</p>
|
349
|
-
</div></span>
|
350
|
-
|
351
|
-
</li>
|
352
|
-
|
353
|
-
|
354
|
-
</ul>
|
355
|
-
|
356
|
-
|
357
|
-
<div id="constructor_details" class="method_details_list">
|
358
|
-
<h2>Constructor Details</h2>
|
359
|
-
|
360
|
-
<div class="method_details first">
|
361
|
-
<h3 class="signature first" id="initialize-instance_method">
|
362
|
-
|
363
|
-
#<strong>initialize</strong>(password, request_options = {}) ⇒ <tt>Boolean</tt>
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
</h3><div class="docstring">
|
370
|
-
<div class="discussion">
|
371
|
-
|
372
|
-
<p>Creates a new password object.</p>
|
373
|
-
|
374
|
-
|
375
|
-
</div>
|
376
|
-
</div>
|
377
|
-
<div class="tags">
|
378
|
-
|
379
|
-
<div class="examples">
|
380
|
-
<p class="tag_title">Examples:</p>
|
381
|
-
|
382
|
-
|
383
|
-
<p class="example_title"><div class='inline'>
|
384
|
-
<p>A simple password with the default request options</p>
|
385
|
-
</div></p>
|
386
|
-
|
387
|
-
<pre class="example code"><code><span class='id identifier rubyid_password'>password</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>password</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span></code></pre>
|
388
|
-
|
389
|
-
|
390
|
-
<p class="example_title"><div class='inline'>
|
391
|
-
<p>Setting the user agent and the read timeout of the request</p>
|
392
|
-
</div></p>
|
393
|
-
|
394
|
-
<pre class="example code"><code><span class='id identifier rubyid_password'>password</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>password</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>My user agent</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>read_timout:</span> <span class='int'>10</span><span class='rparen'>)</span></code></pre>
|
395
|
-
|
396
|
-
</div>
|
397
|
-
<p class="tag_title">Parameters:</p>
|
398
|
-
<ul class="param">
|
399
|
-
|
400
|
-
<li>
|
401
|
-
|
402
|
-
<span class='name'>password</span>
|
403
|
-
|
404
|
-
|
405
|
-
<span class='type'>(<tt>String</tt>)</span>
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
—
|
410
|
-
<div class='inline'>
|
411
|
-
<p>The password you want to check against the API.</p>
|
412
|
-
</div>
|
413
|
-
|
414
|
-
</li>
|
415
|
-
|
416
|
-
<li>
|
417
|
-
|
418
|
-
<span class='name'>request_options</span>
|
419
|
-
|
420
|
-
|
421
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
422
|
-
|
423
|
-
|
424
|
-
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
425
|
-
|
426
|
-
|
427
|
-
—
|
428
|
-
<div class='inline'>
|
429
|
-
<p>Options that can be passed to <code>Net::HTTP.start</code> when calling the
|
430
|
-
API</p>
|
431
|
-
</div>
|
432
|
-
|
433
|
-
</li>
|
434
|
-
|
435
|
-
</ul>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
<p class="tag_title">Options Hash (<tt>request_options</tt>):</p>
|
443
|
-
<ul class="option">
|
444
|
-
|
445
|
-
<li>
|
446
|
-
<span class="name">:headers</span>
|
447
|
-
<span class="type">(<tt>Symbol</tt>)</span>
|
448
|
-
<span class="default">
|
449
|
-
|
450
|
-
— default:
|
451
|
-
<tt>{ "User-Agent" => '"Ruby Pwned::Password #{Pwned::VERSION}" }</tt>
|
452
|
-
|
453
|
-
</span>
|
454
|
-
|
455
|
-
— <div class='inline'>
|
456
|
-
<p>HTTP headers to include in the request</p>
|
457
|
-
</div>
|
458
|
-
|
459
|
-
</li>
|
460
|
-
|
461
|
-
</ul>
|
462
|
-
|
463
|
-
|
464
|
-
<p class="tag_title">Raises:</p>
|
465
|
-
<ul class="raise">
|
466
|
-
|
467
|
-
<li>
|
468
|
-
|
469
|
-
|
470
|
-
<span class='type'>(<tt>TypeError</tt>)</span>
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
—
|
475
|
-
<div class='inline'>
|
476
|
-
<p>if the password is not a string.</p>
|
477
|
-
</div>
|
478
|
-
|
479
|
-
</li>
|
480
|
-
|
481
|
-
</ul>
|
482
|
-
<p class="tag_title">Since:</p>
|
483
|
-
<ul class="since">
|
484
|
-
|
485
|
-
<li>
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
<div class='inline'>
|
492
|
-
<p>1.1.0</p>
|
493
|
-
</div>
|
494
|
-
|
495
|
-
</li>
|
496
|
-
|
497
|
-
</ul>
|
498
|
-
|
499
|
-
</div><table class="source_code">
|
500
|
-
<tr>
|
501
|
-
<td>
|
502
|
-
<pre class="lines">
|
503
|
-
|
504
|
-
|
505
|
-
54
|
506
|
-
55
|
507
|
-
56
|
508
|
-
57
|
509
|
-
58
|
510
|
-
59
|
511
|
-
60</pre>
|
512
|
-
</td>
|
513
|
-
<td>
|
514
|
-
<pre class="code"><span class="info file"># File 'lib/pwned/password.rb', line 54</span>
|
515
|
-
|
516
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_password'>password</span><span class='comma'>,</span> <span class='id identifier rubyid_request_options'>request_options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
517
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>password must be of type String</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
|
518
|
-
<span class='ivar'>@password</span> <span class='op'>=</span> <span class='id identifier rubyid_password'>password</span>
|
519
|
-
<span class='ivar'>@request_options</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lparen'>(</span><span class='id identifier rubyid_request_options'>request_options</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
520
|
-
<span class='ivar'>@request_headers</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lparen'>(</span><span class='id identifier rubyid_request_options'>request_options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:headers</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
521
|
-
<span class='ivar'>@request_headers</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#DEFAULT_REQUEST_HEADERS-constant" title="Pwned::Password::DEFAULT_REQUEST_HEADERS (constant)">DEFAULT_REQUEST_HEADERS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='ivar'>@request_headers</span><span class='rparen'>)</span>
|
522
|
-
<span class='kw'>end</span></pre>
|
523
|
-
</td>
|
524
|
-
</tr>
|
525
|
-
</table>
|
526
|
-
</div>
|
527
|
-
|
528
|
-
</div>
|
529
|
-
|
530
|
-
<div id="instance_attr_details" class="attr_details">
|
531
|
-
<h2>Instance Attribute Details</h2>
|
532
|
-
|
533
|
-
|
534
|
-
<span id=""></span>
|
535
|
-
<div class="method_details first">
|
536
|
-
<h3 class="signature first" id="password-instance_method">
|
537
|
-
|
538
|
-
#<strong>password</strong> ⇒ <tt>String</tt> <span class="extras">(readonly)</span>
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
</h3><div class="docstring">
|
545
|
-
<div class="discussion">
|
546
|
-
|
547
|
-
<p>Returns the password that is being checked.</p>
|
548
|
-
|
549
|
-
|
550
|
-
</div>
|
551
|
-
</div>
|
552
|
-
<div class="tags">
|
553
|
-
|
554
|
-
<p class="tag_title">Returns:</p>
|
555
|
-
<ul class="return">
|
556
|
-
|
557
|
-
<li>
|
558
|
-
|
559
|
-
|
560
|
-
<span class='type'>(<tt>String</tt>)</span>
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
—
|
565
|
-
<div class='inline'>
|
566
|
-
<p>the password that is being checked.</p>
|
567
|
-
</div>
|
568
|
-
|
569
|
-
</li>
|
570
|
-
|
571
|
-
</ul>
|
572
|
-
<p class="tag_title">Since:</p>
|
573
|
-
<ul class="since">
|
574
|
-
|
575
|
-
<li>
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
<div class='inline'>
|
582
|
-
<p>1.0.0</p>
|
583
|
-
</div>
|
584
|
-
|
585
|
-
</li>
|
586
|
-
|
587
|
-
</ul>
|
588
|
-
|
589
|
-
</div><table class="source_code">
|
590
|
-
<tr>
|
591
|
-
<td>
|
592
|
-
<pre class="lines">
|
593
|
-
|
594
|
-
|
595
|
-
36
|
596
|
-
37
|
597
|
-
38</pre>
|
598
|
-
</td>
|
599
|
-
<td>
|
600
|
-
<pre class="code"><span class="info file"># File 'lib/pwned/password.rb', line 36</span>
|
601
|
-
|
602
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_password'>password</span>
|
603
|
-
<span class='ivar'>@password</span>
|
604
|
-
<span class='kw'>end</span></pre>
|
605
|
-
</td>
|
606
|
-
</tr>
|
607
|
-
</table>
|
608
|
-
</div>
|
609
|
-
|
610
|
-
</div>
|
611
|
-
|
612
|
-
|
613
|
-
<div id="instance_method_details" class="method_details_list">
|
614
|
-
<h2>Instance Method Details</h2>
|
615
|
-
|
616
|
-
|
617
|
-
<div class="method_details first">
|
618
|
-
<h3 class="signature first" id="hashed_password-instance_method">
|
619
|
-
|
620
|
-
#<strong>hashed_password</strong> ⇒ <tt>String</tt>
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
</h3><div class="docstring">
|
627
|
-
<div class="discussion">
|
628
|
-
|
629
|
-
<p>Returns the full SHA1 hash of the given password in uppercase.</p>
|
630
|
-
|
631
|
-
|
632
|
-
</div>
|
633
|
-
</div>
|
634
|
-
<div class="tags">
|
635
|
-
|
636
|
-
<p class="tag_title">Returns:</p>
|
637
|
-
<ul class="return">
|
638
|
-
|
639
|
-
<li>
|
640
|
-
|
641
|
-
|
642
|
-
<span class='type'>(<tt>String</tt>)</span>
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
—
|
647
|
-
<div class='inline'>
|
648
|
-
<p>The full SHA1 hash of the given password.</p>
|
649
|
-
</div>
|
650
|
-
|
651
|
-
</li>
|
652
|
-
|
653
|
-
</ul>
|
654
|
-
<p class="tag_title">Since:</p>
|
655
|
-
<ul class="since">
|
656
|
-
|
657
|
-
<li>
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
<div class='inline'>
|
664
|
-
<p>1.0.0</p>
|
665
|
-
</div>
|
666
|
-
|
667
|
-
</li>
|
668
|
-
|
669
|
-
</ul>
|
670
|
-
|
671
|
-
</div><table class="source_code">
|
672
|
-
<tr>
|
673
|
-
<td>
|
674
|
-
<pre class="lines">
|
675
|
-
|
676
|
-
|
677
|
-
66
|
678
|
-
67
|
679
|
-
68</pre>
|
680
|
-
</td>
|
681
|
-
<td>
|
682
|
-
<pre class="code"><span class="info file"># File 'lib/pwned/password.rb', line 66</span>
|
683
|
-
|
684
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_hashed_password'>hashed_password</span>
|
685
|
-
<span class='ivar'>@hashed_password</span> <span class='op'>||=</span> <span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span>
|
686
|
-
<span class='kw'>end</span></pre>
|
687
|
-
</td>
|
688
|
-
</tr>
|
689
|
-
</table>
|
690
|
-
</div>
|
691
|
-
|
692
|
-
<div class="method_details ">
|
693
|
-
<h3 class="signature " id="pwned?-instance_method">
|
694
|
-
|
695
|
-
#<strong>pwned?</strong> ⇒ <tt>Boolean</tt>
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
</h3><div class="docstring">
|
702
|
-
<div class="discussion">
|
703
|
-
|
704
|
-
<p>Returns <code>true</code> when the password has been pwned.</p>
|
705
|
-
|
706
|
-
|
707
|
-
</div>
|
708
|
-
</div>
|
709
|
-
<div class="tags">
|
710
|
-
|
711
|
-
<div class="examples">
|
712
|
-
<p class="tag_title">Examples:</p>
|
713
|
-
|
714
|
-
|
715
|
-
<pre class="example code"><code><span class='id identifier rubyid_password'>password</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>password</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
716
|
-
<span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned?'>pwned?</span> <span class='comment'>#=> true</span></code></pre>
|
717
|
-
|
718
|
-
</div>
|
719
|
-
|
720
|
-
<p class="tag_title">Returns:</p>
|
721
|
-
<ul class="return">
|
722
|
-
|
723
|
-
<li>
|
724
|
-
|
725
|
-
|
726
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
—
|
731
|
-
<div class='inline'>
|
732
|
-
<p><code>true</code> when the password has been pwned.</p>
|
733
|
-
</div>
|
734
|
-
|
735
|
-
</li>
|
736
|
-
|
737
|
-
</ul>
|
738
|
-
<p class="tag_title">Raises:</p>
|
739
|
-
<ul class="raise">
|
740
|
-
|
741
|
-
<li>
|
742
|
-
|
743
|
-
|
744
|
-
<span class='type'>(<tt><span class='object_link'><a href="Error.html" title="Pwned::Error (class)">Pwned::Error</a></span></tt>)</span>
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
—
|
749
|
-
<div class='inline'>
|
750
|
-
<p>if there are errors with the HTTP request.</p>
|
751
|
-
</div>
|
752
|
-
|
753
|
-
</li>
|
754
|
-
|
755
|
-
<li>
|
756
|
-
|
757
|
-
|
758
|
-
<span class='type'>(<tt><span class='object_link'><a href="TimeoutError.html" title="Pwned::TimeoutError (class)">Pwned::TimeoutError</a></span></tt>)</span>
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
—
|
763
|
-
<div class='inline'>
|
764
|
-
<p>if the HTTP request times out.</p>
|
765
|
-
</div>
|
766
|
-
|
767
|
-
</li>
|
768
|
-
|
769
|
-
</ul>
|
770
|
-
<p class="tag_title">Since:</p>
|
771
|
-
<ul class="since">
|
772
|
-
|
773
|
-
<li>
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
<div class='inline'>
|
780
|
-
<p>1.0.0</p>
|
781
|
-
</div>
|
782
|
-
|
783
|
-
</li>
|
784
|
-
|
785
|
-
</ul>
|
786
|
-
|
787
|
-
</div><table class="source_code">
|
788
|
-
<tr>
|
789
|
-
<td>
|
790
|
-
<pre class="lines">
|
791
|
-
|
792
|
-
|
793
|
-
79
|
794
|
-
80
|
795
|
-
81</pre>
|
796
|
-
</td>
|
797
|
-
<td>
|
798
|
-
<pre class="code"><span class="info file"># File 'lib/pwned/password.rb', line 79</span>
|
799
|
-
|
800
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_pwned?'>pwned?</span>
|
801
|
-
<span class='id identifier rubyid_pwned_count'>pwned_count</span> <span class='op'>></span> <span class='int'>0</span>
|
802
|
-
<span class='kw'>end</span></pre>
|
803
|
-
</td>
|
804
|
-
</tr>
|
805
|
-
</table>
|
806
|
-
</div>
|
807
|
-
|
808
|
-
<div class="method_details ">
|
809
|
-
<h3 class="signature " id="pwned_count-instance_method">
|
810
|
-
|
811
|
-
#<strong>pwned_count</strong> ⇒ <tt>Integer</tt>
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
</h3><div class="docstring">
|
818
|
-
<div class="discussion">
|
819
|
-
|
820
|
-
<p>Returns the number of times the password has been pwned.</p>
|
821
|
-
|
822
|
-
|
823
|
-
</div>
|
824
|
-
</div>
|
825
|
-
<div class="tags">
|
826
|
-
|
827
|
-
<div class="examples">
|
828
|
-
<p class="tag_title">Examples:</p>
|
829
|
-
|
830
|
-
|
831
|
-
<pre class="example code"><code><span class='id identifier rubyid_password'>password</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>password</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
832
|
-
<span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned_count'>pwned_count</span> <span class='comment'>#=> 3303003</span></code></pre>
|
833
|
-
|
834
|
-
</div>
|
835
|
-
|
836
|
-
<p class="tag_title">Returns:</p>
|
837
|
-
<ul class="return">
|
838
|
-
|
839
|
-
<li>
|
840
|
-
|
841
|
-
|
842
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
—
|
847
|
-
<div class='inline'>
|
848
|
-
<p>the number of times the password has been pwned.</p>
|
849
|
-
</div>
|
850
|
-
|
851
|
-
</li>
|
852
|
-
|
853
|
-
</ul>
|
854
|
-
<p class="tag_title">Raises:</p>
|
855
|
-
<ul class="raise">
|
856
|
-
|
857
|
-
<li>
|
858
|
-
|
859
|
-
|
860
|
-
<span class='type'>(<tt><span class='object_link'><a href="Error.html" title="Pwned::Error (class)">Pwned::Error</a></span></tt>)</span>
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
—
|
865
|
-
<div class='inline'>
|
866
|
-
<p>if there are errors with the HTTP request.</p>
|
867
|
-
</div>
|
868
|
-
|
869
|
-
</li>
|
870
|
-
|
871
|
-
<li>
|
872
|
-
|
873
|
-
|
874
|
-
<span class='type'>(<tt><span class='object_link'><a href="TimeoutError.html" title="Pwned::TimeoutError (class)">Pwned::TimeoutError</a></span></tt>)</span>
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
—
|
879
|
-
<div class='inline'>
|
880
|
-
<p>if the HTTP request times out.</p>
|
881
|
-
</div>
|
882
|
-
|
883
|
-
</li>
|
884
|
-
|
885
|
-
</ul>
|
886
|
-
<p class="tag_title">Since:</p>
|
887
|
-
<ul class="since">
|
888
|
-
|
889
|
-
<li>
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
<div class='inline'>
|
896
|
-
<p>1.0.0</p>
|
897
|
-
</div>
|
898
|
-
|
899
|
-
</li>
|
900
|
-
|
901
|
-
</ul>
|
902
|
-
|
903
|
-
</div><table class="source_code">
|
904
|
-
<tr>
|
905
|
-
<td>
|
906
|
-
<pre class="lines">
|
907
|
-
|
908
|
-
|
909
|
-
92
|
910
|
-
93
|
911
|
-
94</pre>
|
912
|
-
</td>
|
913
|
-
<td>
|
914
|
-
<pre class="code"><span class="info file"># File 'lib/pwned/password.rb', line 92</span>
|
915
|
-
|
916
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_pwned_count'>pwned_count</span>
|
917
|
-
<span class='ivar'>@pwned_count</span> <span class='op'>||=</span> <span class='id identifier rubyid_fetch_pwned_count'>fetch_pwned_count</span>
|
918
|
-
<span class='kw'>end</span></pre>
|
919
|
-
</td>
|
920
|
-
</tr>
|
921
|
-
</table>
|
922
|
-
</div>
|
923
|
-
|
924
|
-
</div>
|
925
|
-
|
926
|
-
</div>
|
927
|
-
|
928
|
-
<div id="footer">
|
929
|
-
Generated on Tue Oct 1 21:19:37 2019 by
|
930
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
931
|
-
0.9.20 (ruby-2.5.5).
|
932
|
-
</div>
|
933
|
-
|
934
|
-
</div>
|
935
|
-
</body>
|
936
|
-
</html>
|