glogin 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rultor.yml +2 -0
- data/Gemfile +9 -0
- data/glogin.gemspec +2 -9
- data/lib/glogin/codec.rb +6 -4
- data/lib/glogin/version.rb +1 -1
- data/test/glogin/test_codec.rb +6 -0
- metadata +12 -110
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47dc331e9d98417c38d66ddbeae5b6424284ede02d5a9e1680bc1c3eba6dd3f2
|
4
|
+
data.tar.gz: abaa0b7082a1b641a21b1c5828e8ff775cefe0bd78bae72f01d8a5592098ea00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9212904c0f496ae545e401e995bc4d1e47e23c9c0d6644fda205a2cad7e46160244417455a3333501c8e542a2707985aea87319dd3fe7982b4b72a2e2d30fb9b
|
7
|
+
data.tar.gz: e093b8ef78894ac6350d8b36f5cacd4251c04957a85b8742d0bd4c7170ff064f77da087172590c5f8715dbb6ba04efd887fa8f4c0821d8c7690d01f280f9a90c
|
data/.rultor.yml
CHANGED
@@ -3,9 +3,11 @@ docker:
|
|
3
3
|
assets:
|
4
4
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
5
5
|
install: |
|
6
|
+
sudo gem install openssl -- --with-openssl-dir=/usr/local/rvm/rubies/ruby-3.0.1/lib/ruby/3.0.0/openssl
|
6
7
|
pdd -f /dev/null
|
7
8
|
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
8
9
|
release:
|
10
|
+
pre: false
|
9
11
|
script: |-
|
10
12
|
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
11
13
|
bundle exec rake
|
data/Gemfile
CHANGED
@@ -23,3 +23,12 @@
|
|
23
23
|
|
24
24
|
source 'https://rubygems.org'
|
25
25
|
gemspec
|
26
|
+
|
27
|
+
gem 'minitest', '5.18.0', require: false
|
28
|
+
gem 'rake', '13.0.6', require: false
|
29
|
+
gem 'rdoc', '6.5.0', require: false
|
30
|
+
gem 'rspec-rails', '5.1.2', require: false
|
31
|
+
gem 'rubocop', '1.51.0', require: false
|
32
|
+
gem 'rubocop-rspec', '2.22.0', require: false
|
33
|
+
gem 'simplecov', '0.22.0', require: false
|
34
|
+
gem 'webmock', '3.18.1', require: false
|
data/glogin.gemspec
CHANGED
@@ -41,14 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
42
42
|
s.rdoc_options = ['--charset=UTF-8']
|
43
43
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
44
|
-
s.add_runtime_dependency 'base58', '0.2
|
45
|
-
s.
|
46
|
-
s.add_development_dependency 'rake', '13.0.6'
|
47
|
-
s.add_development_dependency 'rdoc', '6.4.0'
|
48
|
-
s.add_development_dependency 'rspec-rails', '5.1.2'
|
49
|
-
s.add_development_dependency 'rubocop', '1.31.1'
|
50
|
-
s.add_development_dependency 'rubocop-rspec', '2.11.1'
|
51
|
-
s.add_development_dependency 'simplecov', '0.22.0'
|
52
|
-
s.add_development_dependency 'webmock', '3.14.0'
|
44
|
+
s.add_runtime_dependency 'base58', '~>0.2'
|
45
|
+
s.add_runtime_dependency 'openssl', '~>3.1'
|
53
46
|
s.metadata['rubygems_mfa_required'] = 'true'
|
54
47
|
end
|
data/lib/glogin/codec.rb
CHANGED
@@ -48,7 +48,7 @@ module GLogin
|
|
48
48
|
else
|
49
49
|
cpr = cipher
|
50
50
|
cpr.decrypt
|
51
|
-
cpr.key = digest
|
51
|
+
cpr.key = digest(cpr.key_len)
|
52
52
|
raise DecodingError unless /^[a-zA-Z0-9]+$/.match?(text)
|
53
53
|
plain = Base58.base58_to_binary(text)
|
54
54
|
raise DecodingError if plain.empty?
|
@@ -71,7 +71,7 @@ module GLogin
|
|
71
71
|
else
|
72
72
|
cpr = cipher
|
73
73
|
cpr.encrypt
|
74
|
-
cpr.key = digest
|
74
|
+
cpr.key = digest(cpr.key_len)
|
75
75
|
salt = SecureRandom.base64(Random.rand(8..32))
|
76
76
|
encrypted = cpr.update("#{salt} #{text}")
|
77
77
|
encrypted << cpr.final
|
@@ -79,8 +79,10 @@ module GLogin
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
|
83
|
-
|
82
|
+
private
|
83
|
+
|
84
|
+
def digest(len)
|
85
|
+
Digest::SHA1.hexdigest(@secret)[0..len - 1]
|
84
86
|
end
|
85
87
|
|
86
88
|
def cipher
|
data/lib/glogin/version.rb
CHANGED
data/test/glogin/test_codec.rb
CHANGED
@@ -60,6 +60,12 @@ class TestCodec < Minitest::Test
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
def test_decrypts_broken_text_with_empty_key
|
64
|
+
assert_raises GLogin::Codec::DecodingError do
|
65
|
+
GLogin::Codec.new('key').decrypt('')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
63
69
|
def test_encrypts_and_decrypts_with_empty_key
|
64
70
|
crypt = GLogin::Codec.new
|
65
71
|
text = 'This is the text, дорогой друг!'
|
metadata
CHANGED
@@ -1,141 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glogin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base58
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.2
|
19
|
+
version: '0.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.2
|
26
|
+
version: '0.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: openssl
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 5.16.1
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 13.0.6
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 13.0.6
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rdoc
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 6.4.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 6.4.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec-rails
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 5.1.2
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 5.1.2
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - '='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.31.1
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - '='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.31.1
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 2.11.1
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 2.11.1
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: simplecov
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.22.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.22.0
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: webmock
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - '='
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 3.14.0
|
132
|
-
type: :development
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
133
35
|
prerelease: false
|
134
36
|
version_requirements: !ruby/object:Gem::Requirement
|
135
37
|
requirements:
|
136
|
-
- -
|
38
|
+
- - "~>"
|
137
39
|
- !ruby/object:Gem::Version
|
138
|
-
version: 3.
|
40
|
+
version: '3.1'
|
139
41
|
description: Enables login/logout functionality for a Ruby web app
|
140
42
|
email: yegor256@gmail.com
|
141
43
|
executables: []
|