zxcvbn-ruby 1.1.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -3
  3. data/README.md +5 -5
  4. data/lib/zxcvbn/clock.rb +10 -0
  5. data/lib/zxcvbn/password_strength.rb +3 -3
  6. data/lib/zxcvbn/version.rb +3 -1
  7. metadata +9 -77
  8. data/.gitignore +0 -18
  9. data/.rspec +0 -1
  10. data/.travis.yml +0 -12
  11. data/CODE_OF_CONDUCT.md +0 -130
  12. data/Gemfile +0 -10
  13. data/Guardfile +0 -26
  14. data/Rakefile +0 -22
  15. data/spec/dictionary_ranker_spec.rb +0 -12
  16. data/spec/feedback_giver_spec.rb +0 -212
  17. data/spec/matchers/date_spec.rb +0 -109
  18. data/spec/matchers/dictionary_spec.rb +0 -30
  19. data/spec/matchers/digits_spec.rb +0 -15
  20. data/spec/matchers/l33t_spec.rb +0 -87
  21. data/spec/matchers/repeat_spec.rb +0 -18
  22. data/spec/matchers/sequences_spec.rb +0 -21
  23. data/spec/matchers/spatial_spec.rb +0 -20
  24. data/spec/matchers/year_spec.rb +0 -15
  25. data/spec/omnimatch_spec.rb +0 -24
  26. data/spec/scorer_spec.rb +0 -5
  27. data/spec/scoring/crack_time_spec.rb +0 -106
  28. data/spec/scoring/entropy_spec.rb +0 -216
  29. data/spec/scoring/math_spec.rb +0 -135
  30. data/spec/spec_helper.rb +0 -54
  31. data/spec/support/js_helpers.rb +0 -35
  32. data/spec/support/js_source/adjacency_graphs.js +0 -8
  33. data/spec/support/js_source/compiled.js +0 -1188
  34. data/spec/support/js_source/frequency_lists.js +0 -10
  35. data/spec/support/js_source/init.coffee +0 -63
  36. data/spec/support/js_source/init.js +0 -95
  37. data/spec/support/js_source/matching.coffee +0 -444
  38. data/spec/support/js_source/matching.js +0 -685
  39. data/spec/support/js_source/scoring.coffee +0 -270
  40. data/spec/support/js_source/scoring.js +0 -390
  41. data/spec/support/matcher.rb +0 -35
  42. data/spec/tester_spec.rb +0 -99
  43. data/spec/zxcvbn_spec.rb +0 -24
  44. data/zxcvbn-ruby.gemspec +0 -31
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,31 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/zxcvbn/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Steve Hodgkiss", "Matthieu Aussaguel"]
6
- gem.email = ["steve@hodgkiss.me", "matthieu.aussaguel@gmail.com"]
7
- gem.description = %q{Ruby port of Dropboxs zxcvbn.js}
8
- gem.summary = %q{}
9
- gem.homepage = "http://github.com/envato/zxcvbn-ruby"
10
-
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "zxcvbn-ruby"
15
- gem.require_paths = ["lib"]
16
- gem.version = Zxcvbn::VERSION
17
- gem.license = 'MIT'
18
-
19
- gem.required_ruby_version = '~> 2.5'
20
-
21
- gem.add_development_dependency 'therubyracer'
22
- gem.add_development_dependency 'rspec'
23
-
24
- gem.metadata = {
25
- "bug_tracker_uri" => "https://github.com/envato/zxcvbn-ruby/issues",
26
- "changelog_uri" => "https://github.com/envato/zxcvbn-ruby/blob/master/CHANGELOG.md",
27
- "documentation_uri" => "https://github.com/envato/zxcvbn-ruby/blob/master/README.md",
28
- "homepage_uri" => "https://github.com/envato/zxcvbn-ruby",
29
- "source_code_uri" => "https://github.com/envato/zxcvbn-ruby"
30
- }
31
- end