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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/unpwn.rb +6 -4
- data/lib/unpwn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50c1081ffc7e72b8a1e361ad624adf96198a4c6e514591b3594882a2a9def135
|
4
|
+
data.tar.gz: 65d5f0f41746f64b9cc91861e664c85fd7d9d0f15242459b4a928e9e47bdab18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55b0fead2d885c1ea121c6f188225dfd6ba75a8ddb921c43d188f74d33b2bcc466d2dda1a9fffd7905cd5353ba4b1b5f17a702810a63a04b83f9d819aa37efc1
|
7
|
+
data.tar.gz: e1479fe39d6fd86d6a450ceb35681c4311d7125ebeb2c9da382301a0d7d13b4bcf8256f5205fcbf969295ff5459c57ac04c741c3b5160f87242249e0dc2d8891
|
data/Gemfile.lock
CHANGED
data/lib/unpwn.rb
CHANGED
@@ -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
|
20
|
-
return false if
|
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
|
data/lib/unpwn/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bloomer
|