altpass 0.2.0 → 0.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 +7 -0
- data/CHANGELOG.md +16 -0
- data/Rakefile +1 -1
- data/altpass.gemspec +3 -3
- data/lib/altpass.rb +1 -1
- data/lib/altpass/version.rb +1 -1
- data/test/test_altpass.rb +49 -49
- metadata +12 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2e48db58e96074606898c8995c43f70c33910636a68de49f3d6c72cf9d0f13c9
|
4
|
+
data.tar.gz: a7e1a22621003186d7b3715f1f08e8f8c119328cc45edc17cef489dc4098d278
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 829bf82e62255cba82668a144d1cc4dead098a745797dbf65168e51609906b1ed1dc50ccc3c4a37a2e18002cdbe7e313826b59e278e4f3ca7dda43071d147be1
|
7
|
+
data.tar.gz: 83e73d56564f5fa729a1d3126128813fe884196cba151fc71fabb33a401b2b1b72a0fd2cc6bc6bac8e14f1b062287857ae9ef4478c88407840f4e850fa021e93
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
|
+
|
6
|
+
## [0.2.1] - 2021-04-26
|
7
|
+
### Fixed
|
8
|
+
- `warning: constant ::Fixnum is deprecated`
|
9
|
+
|
10
|
+
## [0.2.0] - 2013-01-09
|
11
|
+
### Added
|
12
|
+
- The 'configuration file' option
|
13
|
+
|
14
|
+
## [0.1.0] - 2012-12-13
|
15
|
+
### Added
|
16
|
+
- The initial release
|
data/Rakefile
CHANGED
data/altpass.gemspec
CHANGED
@@ -6,11 +6,11 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.name = 'altpass'
|
7
7
|
gem.version = Altpass::VERSION
|
8
8
|
|
9
|
-
gem.authors = ['
|
10
|
-
gem.email = ['
|
9
|
+
gem.authors = ['Aba Tkosan']
|
10
|
+
gem.email = ['aba.tkosan@gmail.com']
|
11
11
|
|
12
12
|
gem.summary = %q{Generate passwords derived from hand-alternating, visually unambiguous, alphanumeric characters}
|
13
|
-
gem.description = "#{gem.summary}. This is a Ruby gem and command-line utility.
|
13
|
+
gem.description = "#{gem.summary}. This is a Ruby gem and command-line utility."
|
14
14
|
|
15
15
|
gem.homepage = 'https://github.com/abatko/altpass'
|
16
16
|
|
data/lib/altpass.rb
CHANGED
@@ -62,7 +62,7 @@ private
|
|
62
62
|
raise ArgumentError, "expected a Hash, but got: #{options.inspect}" unless options.kind_of?(Hash)
|
63
63
|
options = DEFAULT_OPTIONS.merge(options)
|
64
64
|
raise ArgumentError, "expected :memorizable to be boolean, but got: #{options[:memorizable].inspect}" unless options[:memorizable].kind_of?(TrueClass) || options[:memorizable].kind_of?(FalseClass)
|
65
|
-
raise ArgumentError, "expected :length to be
|
65
|
+
raise ArgumentError, "expected :length to be an Integer, but got: #{options[:length].inspect}" unless options[:length].kind_of?(Integer)
|
66
66
|
raise ArgumentError, "expected :length > 0, but got: #{options[:length]}" unless options[:length] > 0
|
67
67
|
options
|
68
68
|
end
|
data/lib/altpass/version.rb
CHANGED
data/test/test_altpass.rb
CHANGED
@@ -3,64 +3,64 @@ require 'test_helper'
|
|
3
3
|
|
4
4
|
class AltpassTest < Test::Unit::TestCase
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def test__generate__default_length
|
7
|
+
assert_equal Altpass::DEFAULT_LENGTH, Altpass.generate.length
|
8
|
+
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
def test__generate__random_length
|
11
|
+
random_length = rand(20)+1
|
12
|
+
assert_equal random_length, Altpass.generate(:length=>random_length).length
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
def test__generate__raise_exception_for_non_hash_argument
|
16
|
+
non_hash_argument = 10
|
17
|
+
exception = assert_raise(ArgumentError) { Altpass.generate(non_hash_argument) }
|
18
|
+
assert_equal "expected a Hash, but got: #{non_hash_argument}", exception.message
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
def test__generate__raise_exception_for_bad_memorizable_hash_value_type
|
22
|
+
non_boolean = {:memorizable => 10}
|
23
|
+
exception = assert_raise(ArgumentError) { Altpass.generate(non_boolean) }
|
24
|
+
assert_equal "expected :memorizable to be boolean, but got: #{non_boolean[:memorizable].inspect}", exception.message
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
def test__generate__raise_exception_for_bad_length_hash_value_type
|
28
|
+
non_fixnum = {:length => 'A'}
|
29
|
+
exception = assert_raise(ArgumentError) { Altpass.generate(non_fixnum) }
|
30
|
+
assert_equal "expected :length to be an Integer, but got: #{non_fixnum[:length].inspect}", exception.message
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
def test_raise_exception_for_fixnum_argument_less_than_one_to_generate_to_length
|
34
|
+
fixnum_argument = {:length => 0}
|
35
|
+
exception = assert_raise(ArgumentError) { Altpass.generate(fixnum_argument) }
|
36
|
+
assert_equal "expected :length > 0, but got: #{fixnum_argument[:length].inspect}", exception.message
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
def test__sample
|
40
|
+
assert_equal 'a', Altpass._sample(['a'])
|
41
|
+
assert_equal 'a', Altpass._sample(['a', 'a', 'a'])
|
42
|
+
random_element = Altpass._sample(['a', 'b', 'c'])
|
43
|
+
assert_equal String, random_element.class
|
44
|
+
assert_equal 1, random_element.length
|
45
|
+
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
def test__sample_raise_exception_for_non_array_argument
|
48
|
+
exception = assert_raise(ArgumentError) { Altpass._sample({}) }
|
49
|
+
assert_equal "expected an Array, but got: Hash", exception.message
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
def test__sample_raise_exception_for_empty_array_argument
|
53
|
+
exception = assert_raise(ArgumentError) { Altpass._sample([]) }
|
54
|
+
assert_equal "expected a non-empty Array, but got an empty one", exception.message
|
55
|
+
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
def test__permutations
|
58
|
+
# these hardcoded values will need to be updated if/when the character set lengths change
|
59
|
+
assert_equal 31752000, Altpass.permutations
|
60
|
+
assert_equal 53572004640, Altpass.permutations(:memorizable => false)
|
61
|
+
assert_equal 60011280000, Altpass.permutations(:memorizable => true, :length => 11)
|
62
|
+
assert_equal 544505855160960, Altpass.permutations(:memorizable => false, :length => 11)
|
63
|
+
end
|
64
64
|
|
65
65
|
end
|
66
66
|
|
metadata
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: altpass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- Aba Tkosan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Generate passwords derived from hand-alternating, visually unambiguous,
|
15
|
-
alphanumeric characters. This is a Ruby gem and command-line utility.
|
16
|
-
as 'alexpass'.
|
14
|
+
alphanumeric characters. This is a Ruby gem and command-line utility.
|
17
15
|
email:
|
18
|
-
-
|
16
|
+
- aba.tkosan@gmail.com
|
19
17
|
executables:
|
20
18
|
- altpass.rb
|
21
19
|
extensions: []
|
22
20
|
extra_rdoc_files: []
|
23
21
|
files:
|
24
|
-
- .gitignore
|
22
|
+
- ".gitignore"
|
23
|
+
- CHANGELOG.md
|
25
24
|
- Gemfile
|
26
25
|
- LICENSE.txt
|
27
26
|
- README.md
|
@@ -35,27 +34,25 @@ files:
|
|
35
34
|
homepage: https://github.com/abatko/altpass
|
36
35
|
licenses:
|
37
36
|
- MIT
|
37
|
+
metadata: {}
|
38
38
|
post_install_message:
|
39
39
|
rdoc_options: []
|
40
40
|
require_paths:
|
41
41
|
- lib
|
42
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
43
|
requirements:
|
45
|
-
- -
|
44
|
+
- - ">="
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '0'
|
48
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
48
|
requirements:
|
51
|
-
- -
|
49
|
+
- - ">="
|
52
50
|
- !ruby/object:Gem::Version
|
53
51
|
version: '0'
|
54
52
|
requirements: []
|
55
|
-
|
56
|
-
rubygems_version: 1.8.10
|
53
|
+
rubygems_version: 3.0.8
|
57
54
|
signing_key:
|
58
|
-
specification_version:
|
55
|
+
specification_version: 4
|
59
56
|
summary: Generate passwords derived from hand-alternating, visually unambiguous, alphanumeric
|
60
57
|
characters
|
61
58
|
test_files:
|