zxcvbn-ruby 1.2.0 β 1.2.1
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/CHANGELOG.md +11 -1
- data/README.md +1 -1
- data/lib/zxcvbn/clock.rb +10 -0
- data/lib/zxcvbn/password_strength.rb +3 -3
- data/lib/zxcvbn/version.rb +1 -1
- metadata +5 -73
- data/.github/workflows/ci.yml +0 -23
- data/.gitignore +0 -18
- data/.rspec +0 -1
- data/CODE_OF_CONDUCT.md +0 -130
- data/Gemfile +0 -10
- data/Guardfile +0 -26
- data/Rakefile +0 -22
- data/spec/dictionary_ranker_spec.rb +0 -12
- data/spec/feedback_giver_spec.rb +0 -212
- data/spec/matchers/date_spec.rb +0 -109
- data/spec/matchers/dictionary_spec.rb +0 -30
- data/spec/matchers/digits_spec.rb +0 -15
- data/spec/matchers/l33t_spec.rb +0 -87
- data/spec/matchers/repeat_spec.rb +0 -18
- data/spec/matchers/sequences_spec.rb +0 -21
- data/spec/matchers/spatial_spec.rb +0 -20
- data/spec/matchers/year_spec.rb +0 -15
- data/spec/omnimatch_spec.rb +0 -24
- data/spec/scorer_spec.rb +0 -5
- data/spec/scoring/crack_time_spec.rb +0 -106
- data/spec/scoring/entropy_spec.rb +0 -216
- data/spec/scoring/math_spec.rb +0 -135
- data/spec/spec_helper.rb +0 -54
- data/spec/support/js_helpers.rb +0 -34
- data/spec/support/js_source/adjacency_graphs.js +0 -8
- data/spec/support/js_source/compiled.js +0 -1188
- data/spec/support/js_source/frequency_lists.js +0 -10
- data/spec/support/js_source/init.coffee +0 -63
- data/spec/support/js_source/init.js +0 -95
- data/spec/support/js_source/matching.coffee +0 -444
- data/spec/support/js_source/matching.js +0 -685
- data/spec/support/js_source/scoring.coffee +0 -270
- data/spec/support/js_source/scoring.js +0 -390
- data/spec/support/matcher.rb +0 -35
- data/spec/tester_spec.rb +0 -99
- data/spec/zxcvbn_spec.rb +0 -24
- data/zxcvbn-ruby.gemspec +0 -33
data/spec/tester_spec.rb
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "spec_helper"
|
|
5
|
-
|
|
6
|
-
describe Zxcvbn::Tester do
|
|
7
|
-
let(:tester) { Zxcvbn::Tester.new }
|
|
8
|
-
|
|
9
|
-
TEST_PASSWORDS.each do |password|
|
|
10
|
-
it "gives back the same score for #{password}" do
|
|
11
|
-
ruby_result = tester.test(password)
|
|
12
|
-
js_result = js_zxcvbn(password)
|
|
13
|
-
|
|
14
|
-
expect(ruby_result.calc_time).not_to be_nil
|
|
15
|
-
expect(ruby_result.password).to eq js_result["password"]
|
|
16
|
-
expect(ruby_result.entropy).to eq js_result["entropy"]
|
|
17
|
-
expect(ruby_result.crack_time).to eq js_result["crack_time"]
|
|
18
|
-
expect(ruby_result.crack_time_display).to eq js_result["crack_time_display"]
|
|
19
|
-
expect(ruby_result.score).to eq js_result["score"]
|
|
20
|
-
expect(ruby_result.pattern).to eq js_result["pattern"]
|
|
21
|
-
expect(ruby_result.match_sequence.count).to eq js_result["match_sequence"].count
|
|
22
|
-
|
|
23
|
-
# NOTE: feedback didn't exist in the version of the JS library this gem
|
|
24
|
-
# is based on, so instead we just check that it put `Feedback` in
|
|
25
|
-
# there. Real tests for its values go in `feedback_giver_spec.rb`.
|
|
26
|
-
expect(ruby_result.feedback).to be_a Zxcvbn::Feedback
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context "with a custom user dictionary" do
|
|
31
|
-
it "scores them against the user dictionary" do
|
|
32
|
-
result = tester.test("themeforest", ["themeforest"])
|
|
33
|
-
expect(result.entropy).to eq 0
|
|
34
|
-
expect(result.score).to eq 0
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "matches l33t substitutions on this dictionary" do
|
|
38
|
-
result = tester.test("th3m3for3st", ["themeforest"])
|
|
39
|
-
expect(result.entropy).to eq 1
|
|
40
|
-
expect(result.score).to eq 0
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context "with Unicode entries in the password" do
|
|
45
|
-
it "validates the password" do
|
|
46
|
-
result = tester.test("β
π΄πstaple", %w[Theme Forest themeforest])
|
|
47
|
-
expect(result.entropy).to be_positive
|
|
48
|
-
expect(result.score).to be_positive
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
context "with Unicode entries in the dictionary" do
|
|
53
|
-
it "validates the password" do
|
|
54
|
-
result = tester.test("correct horse battery staple", %w[β
π΄ π])
|
|
55
|
-
expect(result.entropy).to be_positive
|
|
56
|
-
expect(result.score).to be_positive
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
context "with Unicode entries in the password and the dictionary" do
|
|
61
|
-
it "validates the password" do
|
|
62
|
-
result = tester.test("β
π΄πstaple", %w[β
π΄ π])
|
|
63
|
-
expect(result.entropy).to be_positive
|
|
64
|
-
expect(result.score).to be_zero
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
context "with invalid entries in the dictionary" do
|
|
69
|
-
it "ignores those entries" do
|
|
70
|
-
result = tester.test("themeforest", [nil, 1, "themeforest"])
|
|
71
|
-
expect(result.entropy).to eq 0
|
|
72
|
-
expect(result.score).to eq 0
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
context "with a custom global dictionary" do
|
|
77
|
-
before { tester.add_word_lists("envato" => ["envato"]) }
|
|
78
|
-
|
|
79
|
-
it "scores them against the dictionary" do
|
|
80
|
-
result = tester.test("envato")
|
|
81
|
-
expect(result.entropy).to eq 0
|
|
82
|
-
expect(result.score).to eq 0
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
context "with invalid entries in a custom dictionary" do
|
|
86
|
-
before { tester.add_word_lists("themeforest" => [nil, 1, "themeforest"]) }
|
|
87
|
-
|
|
88
|
-
it "ignores those entries" do
|
|
89
|
-
expect(tester.test("themeforest")).to have_attributes(entropy: 0, score: 0, crack_time: 0)
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
context "nil password" do
|
|
95
|
-
specify do
|
|
96
|
-
expect(tester.test(nil)).to have_attributes(entropy: 0, score: 0, crack_time: 0)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
data/spec/zxcvbn_spec.rb
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Zxcvbn.test' do
|
|
4
|
-
context 'with a password' do
|
|
5
|
-
it 'returns a result' do
|
|
6
|
-
result = Zxcvbn.test('password')
|
|
7
|
-
expect(result.entropy).to_not be_nil
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context 'with a password and user input' do
|
|
12
|
-
it 'returns a result' do
|
|
13
|
-
result = Zxcvbn.test('password', ['inputs'])
|
|
14
|
-
expect(result.entropy).to_not be_nil
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context 'with a password, user input and custom word lists' do
|
|
19
|
-
it 'returns a result' do
|
|
20
|
-
result = Zxcvbn.test('password', ['inputs'], {'list' => ['words']})
|
|
21
|
-
expect(result.entropy).to_not be_nil
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
data/zxcvbn-ruby.gemspec
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
require File.expand_path('../lib/zxcvbn/version', __FILE__)
|
|
3
|
-
|
|
4
|
-
GITHUB_URL = 'https://github.com/envato/zxcvbn-ruby'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |gem|
|
|
7
|
-
gem.authors = ["Steve Hodgkiss", "Matthieu Aussaguel"]
|
|
8
|
-
gem.email = ["steve@hodgkiss.me", "matthieu.aussaguel@gmail.com"]
|
|
9
|
-
gem.description = %q{Ruby port of Dropboxs zxcvbn.js}
|
|
10
|
-
gem.summary = %q{}
|
|
11
|
-
gem.homepage = "http://github.com/envato/zxcvbn-ruby"
|
|
12
|
-
|
|
13
|
-
gem.files = `git ls-files`.split($\)
|
|
14
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
15
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
16
|
-
gem.name = "zxcvbn-ruby"
|
|
17
|
-
gem.require_paths = ["lib"]
|
|
18
|
-
gem.version = Zxcvbn::VERSION
|
|
19
|
-
gem.license = 'MIT'
|
|
20
|
-
|
|
21
|
-
gem.required_ruby_version = '>= 2.5'
|
|
22
|
-
|
|
23
|
-
gem.add_development_dependency 'mini_racer'
|
|
24
|
-
gem.add_development_dependency 'rspec'
|
|
25
|
-
|
|
26
|
-
gem.metadata = {
|
|
27
|
-
'bug_tracker_uri' => "#{GITHUB_URL}/issues",
|
|
28
|
-
'changelog_uri' => "#{GITHUB_URL}/blob/HEAD/CHANGELOG.md",
|
|
29
|
-
'documentation_uri' => "#{GITHUB_URL}/blob/HEAD/README.md",
|
|
30
|
-
'homepage_uri' => GITHUB_URL,
|
|
31
|
-
'source_code_uri' => GITHUB_URL
|
|
32
|
-
}
|
|
33
|
-
end
|