pwned 2.0.2 β†’ 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,424 +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
- File: README
8
-
9
- &mdash; 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 = "README";
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="file_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</a> &raquo;
40
- <span class="title">File: README</span>
41
-
42
- </div>
43
-
44
- <div id="search">
45
-
46
- <a class="full_list_link" id="class_list_link"
47
- href="class_list.html">
48
-
49
- <svg width="24" height="24">
50
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
- </svg>
54
- </a>
55
-
56
- </div>
57
- <div class="clear"></div>
58
- </div>
59
-
60
- <div id="content"><div id='filecontents'>
61
- <h1 id="label-Pwned">Pwned</h1>
62
-
63
- <p>An easy, Ruby way to use the Pwned Passwords API.</p>
64
-
65
- <p><a href="https://rubygems.org/gems/pwned"><img
66
- src="https://badge.fury.io/rb/pwned.svg"></a> <a
67
- href="https://travis-ci.org/philnash/pwned"><img
68
- src="https://travis-ci.org/philnash/pwned.svg?branch=master"></a> <a
69
- href="https://codeclimate.com/github/philnash/pwned/maintainability"><img
70
- src="https://codeclimate.com/github/philnash/pwned/badges/gpa.svg"></a> <a
71
- href="https://inch-ci.org/github/philnash/pwned"><img
72
- src="https://inch-ci.org/github/philnash/pwned.svg?branch=master"></a></p>
73
-
74
- <p><a href="https://philnash.github.io/pwned/">API docs</a> | <a
75
- href="https://github.com/philnash/pwned">GitHub repo</a></p>
76
-
77
- <h2 id="label-Table+of+Contents">Table of Contents</h2>
78
- <ul><li>
79
- <p><a href="#about">About</a></p>
80
- </li><li>
81
- <p><a href="#installation">Installation</a></p>
82
- </li><li>
83
- <p><a href="#usage">Usage</a></p>
84
- </li><li>
85
- <p><a href="#plain-ruby">Plain Ruby</a></p>
86
- </li><li>
87
- <p><a href="#activerecord-validator">Rails (ActiveRecord)</a></p>
88
- </li><li>
89
- <p><a href="#devise">Devise</a></p>
90
- </li><li>
91
- <p><a href="#command-line">Command line</a></p>
92
- </li><li>
93
- <p><a href="#how-pwned-is-pi">How Pwned is Pi?</a></p>
94
- </li><li>
95
- <p><a href="#development">Development</a></p>
96
- </li><li>
97
- <p><a href="#contributing">Contributing</a></p>
98
- </li><li>
99
- <p><a href="#license">License</a></p>
100
- </li><li>
101
- <p><a href="#code-of-conduct">Code of Conduct</a></p>
102
- </li></ul>
103
-
104
- <h2 id="label-About">About</h2>
105
-
106
- <p>Troy Hunt&#39;s <a
107
- href="https://haveibeenpwned.com/API/v2#PwnedPasswords">Pwned Passwords API
108
- V2</a> allows you to check if a password has been found in any of the huge
109
- data breaches.</p>
110
-
111
- <p><code>Pwned</code> is a Ruby library to use the Pwned Passwords API&#39;s
112
- <a
113
- href="https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/#cloudflareprivacyandkanonymity">k-Anonymity
114
- model</a> to test a password against the API without sending the entire
115
- password to the service.</p>
116
-
117
- <p>The data from this API is provided by <a
118
- href="https://haveibeenpwned.com/">Have I been pwned?</a>. Before using the
119
- API, please check <a
120
- href="https://haveibeenpwned.com/API/v2#AcceptableUse">the acceptable uses
121
- and license of the API</a>.</p>
122
-
123
- <p>Here is a blog post I wrote on <a
124
- href="https://www.twilio.com/blog/2018/03/better-passwords-in-ruby-applications-pwned-passwords-api.html">how
125
- to use this gem in your Ruby applications to make your users’ passwords
126
- better</a>.</p>
127
-
128
- <h2 id="label-Installation">Installation</h2>
129
-
130
- <p>Add this line to your application&#39;s Gemfile:</p>
131
-
132
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pwned</span><span class='tstring_end'>&#39;</span></span>
133
- </code></pre>
134
-
135
- <p>And then execute:</p>
136
-
137
- <pre class="code ruby"><code class="ruby">$ bundle
138
- </code></pre>
139
-
140
- <p>Or install it yourself as:</p>
141
-
142
- <pre class="code ruby"><code class="ruby">$ gem install pwned
143
- </code></pre>
144
-
145
- <h2 id="label-Usage">Usage</h2>
146
-
147
- <p>There are a few ways you can use this gem:</p>
148
- <ol><li>
149
- <p><a href="#plain-ruby">Plain Ruby</a></p>
150
- </li><li>
151
- <p><a href="#activerecord-validator">Rails</a></p>
152
- </li><li>
153
- <p><a href="#devise">Rails and Devise</a></p>
154
- </li></ol>
155
-
156
- <h3 id="label-Plain+Ruby">Plain Ruby</h3>
157
-
158
- <p>To test a password against the API, instantiate a
159
- <code>Pwned::Password</code> object and then ask if it is
160
- <code>pwned?</code>.</p>
161
-
162
- <pre class="code ruby"><code class="ruby"><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="Pwned/Password.html" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pwned/Password.html#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>password</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
163
- <span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned?'>pwned?</span>
164
- <span class='comment'>#=&gt; true
165
- </span><span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned_count'>pwned_count</span>
166
- <span class='comment'>#=&gt; 3303003
167
- </span></code></pre>
168
-
169
- <p>You can also check how many times the password appears in the dataset.</p>
170
-
171
- <pre class="code ruby"><code class="ruby"><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="Pwned/Password.html" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pwned/Password.html#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>password</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
172
- <span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned_count'>pwned_count</span>
173
- <span class='comment'>#=&gt; 3303003
174
- </span></code></pre>
175
-
176
- <p>Since you are likely using this as part of a signup flow, it is recommended
177
- that you rescue errors so if the service does go down, your user journey is
178
- not disturbed.</p>
179
-
180
- <pre class="code ruby"><code class="ruby"><span class='kw'>begin</span>
181
- <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="Pwned/Password.html" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pwned/Password.html#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>password</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
182
- <span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned?'>pwned?</span>
183
- <span class='kw'>rescue</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/Error.html" title="Pwned::Error (class)">Error</a></span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
184
- <span class='comment'># Ummm... don&#39;t worry about it, I guess?
185
- </span><span class='kw'>end</span>
186
- </code></pre>
187
-
188
- <p>Most of the times you only care if the password has been pwned before or
189
- not. You can use simplified accessors to check whether the password has
190
- been pwned, or how many times it was pwned:</p>
191
-
192
- <pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='period'>.</span><span class='id identifier rubyid_pwned?'><span class='object_link'><a href="Pwned.html#pwned%3F-class_method" title="Pwned.pwned? (method)">pwned?</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>password</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
193
- <span class='comment'>#=&gt; true
194
- </span><span class='const'><span class='object_link'><a href="Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='period'>.</span><span class='id identifier rubyid_pwned_count'><span class='object_link'><a href="Pwned.html#pwned_count-class_method" title="Pwned.pwned_count (method)">pwned_count</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>password</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
195
- <span class='comment'>#=&gt; 3303003
196
- </span></code></pre>
197
-
198
- <h4 id="label-Advanced">Advanced</h4>
199
-
200
- <p>You can set http request options to be used with
201
- <code>Net::HTTP.start</code> when making the request to the API. These
202
- options are documented in the <a
203
- href="http://ruby-doc.org/stdlib-2.6.3/libdoc/net/http/rdoc/Net/HTTP.html#method-c-start">Net::HTTP.start
204
- documentation</a>. The <code>:headers</code> option defines defines HTTP
205
- headers. These headers must be string keys.</p>
206
-
207
- <pre class="code ruby"><code class="ruby"><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="Pwned/Password.html" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pwned/Password.html#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>password</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Super fun new user agent</span><span class='tstring_end'>&#39;</span></span> <span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>read_timeout:</span> <span class='int'>10</span><span class='rparen'>)</span>
208
- </code></pre>
209
-
210
- <h3 id="label-ActiveRecord+Validator">ActiveRecord Validator</h3>
211
-
212
- <p>There is a custom validator available for your ActiveRecord models:</p>
213
-
214
- <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
215
- <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='kw'>true</span>
216
- <span class='comment'># or
217
- </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>message:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>has been pwned %{count} times</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
218
- <span class='kw'>end</span>
219
- </code></pre>
220
-
221
- <h4 id="label-I18n">I18n</h4>
222
-
223
- <p>You can change the error message using I18n (use <code>%{count}</code> to
224
- interpolate the number of times the password was seen in the data
225
- breaches):</p>
226
-
227
- <pre class="code ruby"><code class="ruby">en:
228
- errors:
229
- messages:
230
- not_pwned: has been pwned %{count} times
231
- pwned_error: might be pwned
232
- </code></pre>
233
-
234
- <h4 id="label-Threshold">Threshold</h4>
235
-
236
- <p>If you are ok with the password appearing a certain number of times before
237
- you decide it is invalid, you can set a threshold. The validator will check
238
- whether the <code>pwned_count</code> is greater than the threshold.</p>
239
-
240
- <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
241
- <span class='comment'># The record is marked as valid if the password has been used once in the breached data
242
- </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>threshold:</span> <span class='int'>1</span> <span class='rbrace'>}</span>
243
- <span class='kw'>end</span>
244
- </code></pre>
245
-
246
- <h4 id="label-Network+Error+Handling">Network Error Handling</h4>
247
-
248
- <p>By default the record will be treated as valid when we cannot reach the <a
249
- href="https://haveibeenpwned.com/">haveibeenpwned.com</a> servers. This can
250
- be changed with the <code>:on_error</code> validator parameter:</p>
251
-
252
- <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
253
- <span class='comment'># The record is marked as valid on network errors.
254
- </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='kw'>true</span>
255
- <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>on_error:</span> <span class='symbol'>:valid</span> <span class='rbrace'>}</span>
256
-
257
- <span class='comment'># The record is marked as invalid on network errors
258
- </span> <span class='comment'># (error message &quot;could not be verified against the past data breaches&quot;.)
259
- </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>on_error:</span> <span class='symbol'>:invalid</span> <span class='rbrace'>}</span>
260
-
261
- <span class='comment'># The record is marked as invalid on network errors with custom error.
262
- </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>on_error:</span> <span class='symbol'>:invalid</span><span class='comma'>,</span> <span class='label'>error_message:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>might be pwned</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
263
-
264
- <span class='comment'># We will raise an error on network errors.
265
- </span> <span class='comment'># This means that `record.valid?` will raise `Pwned::Error`.
266
- </span> <span class='comment'># Not recommended to use in production.
267
- </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>on_error:</span> <span class='symbol'>:raise_error</span> <span class='rbrace'>}</span>
268
-
269
- <span class='comment'># Call custom proc on error. For example, capture errors in Sentry,
270
- </span> <span class='comment'># but do not mark the record as invalid.
271
- </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span>
272
- <span class='label'>on_error:</span> <span class='tlambda'>-&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='const'>Raven</span><span class='period'>.</span><span class='id identifier rubyid_capture_exception'>capture_exception</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
273
- <span class='rbrace'>}</span>
274
- <span class='kw'>end</span>
275
- </code></pre>
276
-
277
- <h4 id="label-Custom+Request+Options">Custom Request Options</h4>
278
-
279
- <p>You can configure network requests made from the validator using
280
- <code>:request_options</code> (see <a
281
- href="http://ruby-doc.org/stdlib-2.6.3/libdoc/net/http/rdoc/Net/HTTP.html#method-c-start">Net::HTTP.start</a>
282
- for the list of available options). In addition to these options, HTTP
283
- headers can be specified with the <code>:headers</code> key, e.g.
284
- <code>&quot;User-Agent&quot;</code>):</p>
285
-
286
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span>
287
- <span class='label'>request_options:</span> <span class='lbrace'>{</span> <span class='label'>read_timeout:</span> <span class='int'>5</span><span class='comma'>,</span> <span class='label'>open_timeout:</span> <span class='int'>1</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Super fun user agent</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
288
- <span class='rbrace'>}</span>
289
- </code></pre>
290
-
291
- <h3 id="label-Devise">Devise</h3>
292
-
293
- <p>If you are using Devise I recommend you use the <a
294
- href="https://github.com/michaelbanfield/devise-pwned_password">devise-pwned_password
295
- extension</a> which is now powered by this gem.</p>
296
-
297
- <h3 id="label-Command+line">Command line</h3>
298
-
299
- <p>The gem provides a command line utility for checking passwords. You can
300
- call it from your terminal application like this:</p>
301
-
302
- <pre class="code ruby"><code class="ruby">$ pwned password
303
- Pwned!
304
- The password has been found in public breaches 3645804 times.
305
- </code></pre>
306
-
307
- <p>If you don&#39;t want the password you are checking to be visible, call:</p>
308
-
309
- <pre class="code ruby"><code class="ruby">$ pwned --secret
310
- </code></pre>
311
-
312
- <p>You will be prompted for the password, but it won&#39;t be displayed.</p>
313
-
314
- <h2 id="label-How+Pwned+is+Pi-3F">How Pwned is Pi?</h2>
315
-
316
- <p><a href="https://github.com/daz">@daz</a> <a
317
- href="https://twitter.com/dazonic/status/1074647842046660609">shared</a> a
318
- fantastic example of using this gem to show how many times the digits of Pi
319
- have been used as passwords and leaked.</p>
320
-
321
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pwned</span><span class='tstring_end'>&#39;</span></span>
322
-
323
- <span class='const'>PI</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111</span><span class='tstring_end'>&#39;</span></span>
324
-
325
- <span class='kw'>for</span> <span class='id identifier rubyid_n'>n</span> <span class='kw'>in</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>40</span>
326
- <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="Pwned/Password.html" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pwned/Password.html#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span> <span class='const'>PI</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span> <span class='op'>+</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rbracket'>]</span>
327
- <span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='lbracket'>[</span> <span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_rjust'>rjust</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span> <span class='rbracket'>]</span>
328
- <span class='id identifier rubyid_str'>str</span> <span class='op'>&lt;&lt;</span> <span class='lparen'>(</span><span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned?'>pwned?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>😑</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>πŸ˜ƒ</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
329
- <span class='id identifier rubyid_str'>str</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_pwned_count'>pwned_count</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_rjust'>rjust</span><span class='lparen'>(</span><span class='int'>4</span><span class='rparen'>)</span>
330
- <span class='id identifier rubyid_str'>str</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_password'>password</span><span class='period'>.</span><span class='id identifier rubyid_password'>password</span>
331
-
332
- <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> </span><span class='tstring_end'>&#39;</span></span>
333
- <span class='kw'>end</span>
334
- </code></pre>
335
-
336
- <p>The results may, or may not, surprise you.</p>
337
-
338
- <pre class="code ruby"><code class="ruby">1 😑 16 3.1
339
- 2 😑 238 3.14
340
- 3 😑 34 3.141
341
- 4 😑 1345 3.1415
342
- 5 😑 2552 3.14159
343
- 6 😑 791 3.141592
344
- 7 😑 9582 3.1415926
345
- 8 😑 1591 3.14159265
346
- 9 😑 637 3.141592653
347
- 10 😑 873 3.1415926535
348
- 11 😑 137 3.14159265358
349
- 12 😑 103 3.141592653589
350
- 13 😑 65 3.1415926535897
351
- 14 😑 201 3.14159265358979
352
- 15 😑 41 3.141592653589793
353
- 16 😑 57 3.1415926535897932
354
- 17 😑 28 3.14159265358979323
355
- 18 😑 29 3.141592653589793238
356
- 19 😑 1 3.1415926535897932384
357
- 20 😑 7 3.14159265358979323846
358
- 21 😑 5 3.141592653589793238462
359
- 22 😑 2 3.1415926535897932384626
360
- 23 😑 2 3.14159265358979323846264
361
- 24 πŸ˜ƒ 0 3.141592653589793238462643
362
- 25 😑 3 3.1415926535897932384626433
363
- 26 πŸ˜ƒ 0 3.14159265358979323846264338
364
- 27 πŸ˜ƒ 0 3.141592653589793238462643383
365
- 28 πŸ˜ƒ 0 3.1415926535897932384626433832
366
- 29 πŸ˜ƒ 0 3.14159265358979323846264338327
367
- 30 πŸ˜ƒ 0 3.141592653589793238462643383279
368
- 31 πŸ˜ƒ 0 3.1415926535897932384626433832795
369
- 32 πŸ˜ƒ 0 3.14159265358979323846264338327950
370
- 33 πŸ˜ƒ 0 3.141592653589793238462643383279502
371
- 34 πŸ˜ƒ 0 3.1415926535897932384626433832795028
372
- 35 πŸ˜ƒ 0 3.14159265358979323846264338327950288
373
- 36 πŸ˜ƒ 0 3.141592653589793238462643383279502884
374
- 37 πŸ˜ƒ 0 3.1415926535897932384626433832795028841
375
- 38 πŸ˜ƒ 0 3.14159265358979323846264338327950288419
376
- 39 πŸ˜ƒ 0 3.141592653589793238462643383279502884197
377
- 40 πŸ˜ƒ 0 3.1415926535897932384626433832795028841971
378
- </code></pre>
379
-
380
- <h2 id="label-Development">Development</h2>
381
-
382
- <p>After checking out the repo, run <code>bin/setup</code> to install
383
- dependencies. Then, run <code>rake spec</code> to run the tests. You can
384
- also run <code>bin/console</code> for an interactive prompt that will allow
385
- you to experiment.</p>
386
-
387
- <p>To install this gem onto your local machine, run <code>bundle exec rake
388
- install</code>. To release a new version, update the version number in
389
- <code>version.rb</code>, and then run <code>bundle exec rake
390
- release</code>, which will create a git tag for the version, push git
391
- commits and tags, and push the <code>.gem</code> file to <a
392
- href="https://rubygems.org">rubygems.org</a>.</p>
393
-
394
- <h2 id="label-Contributing">Contributing</h2>
395
-
396
- <p>Bug reports and pull requests are welcome on GitHub at <a
397
- href="https://github.com/philnash/pwned">github.com/philnash/pwned</a>.
398
- This project is intended to be a safe, welcoming space for collaboration,
399
- and contributors are expected to adhere to the <a
400
- href="http://contributor-covenant.org">Contributor Covenant</a> code of
401
- conduct.</p>
402
-
403
- <h2 id="label-License">License</h2>
404
-
405
- <p>The gem is available as open source under the terms of the <a
406
- href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
407
-
408
- <h2 id="label-Code+of+Conduct">Code of Conduct</h2>
409
-
410
- <p>Everyone interacting in the Pwned project’s codebases, issue trackers, chat
411
- rooms and mailing lists is expected to follow the <a
412
- href="https://github.com/philnash/pwned/blob/master/CODE_OF_CONDUCT.md">code
413
- of conduct</a>.</p>
414
- </div></div>
415
-
416
- <div id="footer">
417
- Generated on Tue Oct 1 21:19:37 2019 by
418
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
419
- 0.9.20 (ruby-2.5.5).
420
- </div>
421
-
422
- </div>
423
- </body>
424
- </html>
@@ -1,56 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
- <meta charset="utf-8" />
6
-
7
- <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
-
9
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
-
11
-
12
-
13
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
-
17
-
18
- <title>File List</title>
19
- <base id="base_target" target="_parent" />
20
- </head>
21
- <body>
22
- <div id="content">
23
- <div class="fixed_header">
24
- <h1 id="full_list_header">File List</h1>
25
- <div id="full_list_nav">
26
-
27
- <span><a target="_self" href="class_list.html">
28
- Classes
29
- </a></span>
30
-
31
- <span><a target="_self" href="method_list.html">
32
- Methods
33
- </a></span>
34
-
35
- <span><a target="_self" href="file_list.html">
36
- Files
37
- </a></span>
38
-
39
- </div>
40
-
41
- <div id="search">Search: <input type="text" /></div>
42
- </div>
43
-
44
- <ul id="full_list" class="file">
45
-
46
-
47
- <li id="object_README" class="odd">
48
- <div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
49
- </li>
50
-
51
-
52
-
53
- </ul>
54
- </div>
55
- </body>
56
- </html>