unpwn 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4642564366c6e8700db38f6a35d4fd4194957f266ca199987de796fd6f7993a4
4
- data.tar.gz: ab5b529c9a58c6ba807adbce7eb90048ce9c6a5b2b074ac279d30178532e528e
3
+ metadata.gz: 50c1081ffc7e72b8a1e361ad624adf96198a4c6e514591b3594882a2a9def135
4
+ data.tar.gz: 65d5f0f41746f64b9cc91861e664c85fd7d9d0f15242459b4a928e9e47bdab18
5
5
  SHA512:
6
- metadata.gz: ca8b19488b52bb19be2534354fea873195be038f0dd9834cccc58201c10baad2f620a89a47a5a69387ff73ea9bff2c2a291ad76c4dfcab4d08becabbc500fdab
7
- data.tar.gz: 3b97ceb239217b5a96ca50f8baa217e58cfbfa1e1edb025d1c385fb907499e1693245811bc38270caea225d1777433fa198157c186ed298530cce58fbac9610b
6
+ metadata.gz: 55b0fead2d885c1ea121c6f188225dfd6ba75a8ddb921c43d188f74d33b2bcc466d2dda1a9fffd7905cd5353ba4b1b5f17a702810a63a04b83f9d819aa37efc1
7
+ data.tar.gz: e1479fe39d6fd86d6a450ceb35681c4311d7125ebeb2c9da382301a0d7d13b4bcf8256f5205fcbf969295ff5459c57ac04c741c3b5160f87242249e0dc2d8891
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- unpwn (0.2.0)
4
+ unpwn (0.3.0)
5
5
  bloomer (~> 1.0)
6
6
  pwned (~> 1.2)
7
7
 
@@ -6,24 +6,26 @@ require "pwned"
6
6
 
7
7
  # Unpwn.pwned? tells you if a password should be rejected.
8
8
  class Unpwn
9
+ attr_reader :min, :max, :request_options
9
10
 
10
- def initialize(min: 8, max: nil)
11
+ def initialize(min: 8, max: nil, request_options: nil)
11
12
  raise ArgumentError if min && min < 8
12
13
  raise ArgumentError if max && max < 64
13
14
 
14
15
  @min = min
15
16
  @max = max
17
+ @request_options = request_options || {}
16
18
  end
17
19
 
18
20
  def acceptable?(password)
19
- return false if @min && password.size < @min
20
- return false if @max && password.size > @max
21
+ return false if min && password.size < min
22
+ return false if max && password.size > max
21
23
 
22
24
  !pwned?(password)
23
25
  end
24
26
 
25
27
  def pwned?(password)
26
- bloom.include?(password) || Pwned.pwned?(password)
28
+ bloom.include?(password) || Pwned.pwned?(password, request_options)
27
29
  end
28
30
 
29
31
  def bloom
@@ -1,3 +1,3 @@
1
1
  class Unpwn
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unpwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andre Arko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-15 00:00:00.000000000 Z
11
+ date: 2019-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bloomer