glogin 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cc141a23e15b0f3ab7b965b281e0af9f0b62d35d4d6e4bfe7f08126f5fd15a8
4
- data.tar.gz: f1c8f19028513466cc34370655d07d2a9eb0036ee12d36a191c0f46c5e8b89d2
3
+ metadata.gz: cbb6b682a4165d9835c47fc78a8ca518ddc3fb01b8292a1f3eb202aad075f6fd
4
+ data.tar.gz: b697264e4615fc83a4039781001ff324d632e393cba2d1f759fcf6ab3c21b600
5
5
  SHA512:
6
- metadata.gz: '0639b3241684fb1b20c81e0008f1e4366c579acedb4fa5fede72c0920b9e9c6b9b3f8a7a6cae4a63eb49f394ad7592e86f7a11b7dca1765795cdd4e5c9908266'
7
- data.tar.gz: 584d6a182b189286a3a2feb9559e9decdf5a0821aa3a62241c4b71373201b348c12969f2afd72352f5e81c27ce629929dbc17f1aa1832dc0a095973aa5d9144f
6
+ metadata.gz: 12201bbccf0b2f44210030dc3e8bef73a323a33b773f855ffb853b207eff281ff266de90ee344e54470d1d997d58c01f66274ce3cddb187ad81bb433ade74bee
7
+ data.tar.gz: 0031771355c95b84efb2b7293ef60d7e3cbb313fda141bc0470db792b95383ee980ac027984189ec0f4751a51449b6f1e7131fa5c1c10afe6d4029e8ba01349a
@@ -6,10 +6,10 @@ on:
6
6
  - master
7
7
  jobs:
8
8
  codecov:
9
- runs-on: ubuntu-latest
9
+ runs-on: ubuntu-20.04
10
10
  steps:
11
11
  - uses: actions/checkout@v3
12
- - uses: actions/setup-ruby@v1
12
+ - uses: ruby/setup-ruby@v1
13
13
  with:
14
14
  ruby-version: 2.7
15
15
  - run: bundle update
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: pdd
3
+ on:
4
+ push:
5
+ pull_request:
6
+ jobs:
7
+ pdd:
8
+ runs-on: ubuntu-20.04
9
+ steps:
10
+ - uses: actions/checkout@v3
11
+ - uses: g4s8/pdd-action@master
@@ -12,12 +12,12 @@ jobs:
12
12
  name: test
13
13
  strategy:
14
14
  matrix:
15
- os: [ubuntu-latest, macos-latest]
16
- ruby: [2.7]
15
+ os: [ubuntu-20.04, macos-12]
16
+ ruby: [2.7, 3.2]
17
17
  runs-on: ${{ matrix.os }}
18
18
  steps:
19
19
  - uses: actions/checkout@v3
20
- - uses: actions/setup-ruby@v1
20
+ - uses: ruby/setup-ruby@v1
21
21
  with:
22
22
  ruby-version: ${{ matrix.ruby }}
23
23
  - run: bundle update
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: xcop
3
+ on:
4
+ push:
5
+ pull_request:
6
+ jobs:
7
+ xcop:
8
+ runs-on: ubuntu-20.04
9
+ steps:
10
+ - uses: actions/checkout@v3
11
+ - uses: g4s8/xcop-action@master
data/.rultor.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  docker:
2
- image: yegor256/rultor-image:1.9.0
2
+ image: yegor256/rultor-image:1.19.0
3
3
  assets:
4
4
  rubygems.yml: yegor256/home#assets/rubygems.yml
5
5
  install: |
@@ -19,7 +19,3 @@ release:
19
19
  merge:
20
20
  script: |-
21
21
  bundle exec rake
22
- deploy:
23
- script: |-
24
- echo "There is nothing to deploy"
25
- exit -1
data/.simplecov CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -22,5 +22,4 @@
22
22
  # SOFTWARE.
23
23
 
24
24
  source 'https://rubygems.org'
25
- ruby '~>2.3'
26
25
  gemspec
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2022 Yegor Bugayenko
3
+ Copyright (c) 2017-2023 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the 'Software'), to deal
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  <img src="/logo.svg" width="64px" height="64px"/>
2
2
 
3
- [![Managed by Zerocracy](https://www.0crat.com/badge/C3RFVLU72.svg)](https://www.0crat.com/p/C3RFVLU72)
4
3
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/glogin)](http://www.rultor.com/p/yegor256/glogin)
5
4
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
6
5
 
@@ -10,7 +9,6 @@
10
9
  [![Maintainability](https://api.codeclimate.com/v1/badges/155f86b639d155259219/maintainability)](https://codeclimate.com/github/yegor256/glogin/maintainability)
11
10
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/glogin.svg)](https://codecov.io/github/yegor256/glogin?branch=master)
12
11
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/glogin/master/frames)
13
-
14
12
  ![Lines of code](https://img.shields.io/tokei/lines/github/yegor256/glogin)
15
13
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/glogin)](https://hitsofcode.com/view/github/yegor256/glogin)
16
14
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/glogin/blob/master/LICENSE.txt)
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
data/glogin.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2017-2022 Yegor Bugayenko
3
+ # Copyright (c) 2017-2023 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -42,13 +42,13 @@ Gem::Specification.new do |s|
42
42
  s.rdoc_options = ['--charset=UTF-8']
43
43
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
44
44
  s.add_runtime_dependency 'base58', '0.2.3'
45
- s.add_development_dependency 'codecov', '0.6.0'
46
45
  s.add_development_dependency 'minitest', '5.16.1'
47
46
  s.add_development_dependency 'rake', '13.0.6'
48
47
  s.add_development_dependency 'rdoc', '6.4.0'
49
48
  s.add_development_dependency 'rspec-rails', '5.1.2'
50
49
  s.add_development_dependency 'rubocop', '1.31.1'
51
50
  s.add_development_dependency 'rubocop-rspec', '2.11.1'
51
+ s.add_development_dependency 'simplecov', '0.22.0'
52
52
  s.add_development_dependency 'webmock', '3.14.0'
53
53
  s.metadata['rubygems_mfa_required'] = 'true'
54
54
  end
data/lib/glogin/auth.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,7 +28,7 @@ require 'cgi'
28
28
 
29
29
  # GLogin main module.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2017-2022 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2017-2023 Yegor Bugayenko
32
32
  # License:: MIT
33
33
  module GLogin
34
34
  #
data/lib/glogin/codec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,60 +28,63 @@ require 'base58'
28
28
 
29
29
  # Codec.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2017-2022 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2017-2023 Yegor Bugayenko
32
32
  # License:: MIT
33
- class GLogin::Codec
34
- # When can't decode.
35
- class DecodingError < StandardError; end
33
+ module GLogin
34
+ # The codec
35
+ class Codec
36
+ # When can't decode.
37
+ class DecodingError < StandardError; end
36
38
 
37
- def initialize(secret = '')
38
- raise 'Secret can\'t be nil' if secret.nil?
39
- @secret = secret
40
- end
39
+ def initialize(secret = '')
40
+ raise 'Secret can\'t be nil' if secret.nil?
41
+ @secret = secret
42
+ end
41
43
 
42
- def decrypt(text)
43
- raise 'Text can\'t be nil' if text.nil?
44
- if @secret.empty?
45
- text
46
- else
47
- cpr = cipher
48
- cpr.decrypt
49
- cpr.key = digest
50
- raise DecodingError unless /^[a-zA-Z0-9]+$/.match?(text)
51
- plain = Base58.base58_to_binary(text)
52
- raise DecodingError if plain.empty?
53
- decrypted = cpr.update(plain)
54
- decrypted << cpr.final
55
- salt, body = decrypted.to_s.split(' ', 2)
56
- raise DecodingError if salt.empty?
57
- raise DecodingError if body.nil?
58
- body.force_encoding('UTF-8')
59
- body
44
+ def decrypt(text)
45
+ raise 'Text can\'t be nil' if text.nil?
46
+ if @secret.empty?
47
+ text
48
+ else
49
+ cpr = cipher
50
+ cpr.decrypt
51
+ cpr.key = digest
52
+ raise DecodingError unless /^[a-zA-Z0-9]+$/.match?(text)
53
+ plain = Base58.base58_to_binary(text)
54
+ raise DecodingError if plain.empty?
55
+ decrypted = cpr.update(plain)
56
+ decrypted << cpr.final
57
+ salt, body = decrypted.to_s.split(' ', 2)
58
+ raise DecodingError if salt.empty?
59
+ raise DecodingError if body.nil?
60
+ body.force_encoding('UTF-8')
61
+ body
62
+ end
63
+ rescue OpenSSL::Cipher::CipherError => e
64
+ raise DecodingError, e.message
60
65
  end
61
- rescue OpenSSL::Cipher::CipherError => e
62
- raise DecodingError, e.message
63
- end
64
66
 
65
- def encrypt(text)
66
- raise 'Text can\'t be nil' if text.nil?
67
- if @secret.empty?
68
- text
69
- else
70
- cpr = cipher
71
- cpr.encrypt
72
- cpr.key = digest
73
- salt = SecureRandom.base64(Random.rand(8..32))
74
- encrypted = cpr.update("#{salt} #{text}")
75
- encrypted << cpr.final
76
- Base58.binary_to_base58(encrypted)
67
+ def encrypt(text)
68
+ raise 'Text can\'t be nil' if text.nil?
69
+ if @secret.empty?
70
+ text
71
+ else
72
+ cpr = cipher
73
+ cpr.encrypt
74
+ cpr.key = digest
75
+ salt = SecureRandom.base64(Random.rand(8..32))
76
+ encrypted = cpr.update("#{salt} #{text}")
77
+ encrypted << cpr.final
78
+ Base58.binary_to_base58(encrypted)
79
+ end
77
80
  end
78
- end
79
81
 
80
- def digest
81
- Digest::SHA1.hexdigest(@secret)[0..31]
82
- end
82
+ def digest
83
+ Digest::SHA1.hexdigest(@secret)[0..31]
84
+ end
83
85
 
84
- def cipher
85
- OpenSSL::Cipher.new('aes-256-cbc')
86
+ def cipher
87
+ OpenSSL::Cipher.new('aes-256-cbc')
88
+ end
86
89
  end
87
90
  end
data/lib/glogin/cookie.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,7 +28,7 @@ require_relative 'codec'
28
28
 
29
29
  # GLogin main module.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2017-2022 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2017-2023 Yegor Bugayenko
32
32
  # License:: MIT
33
33
  module GLogin
34
34
  # Split symbol inside the cookie text
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -23,8 +23,8 @@
23
23
 
24
24
  # GLogin main module.
25
25
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
26
- # Copyright:: Copyright (c) 2017-2022 Yegor Bugayenko
26
+ # Copyright:: Copyright (c) 2017-2023 Yegor Bugayenko
27
27
  # License:: MIT
28
28
  module GLogin
29
- VERSION = '0.9.0'
29
+ VERSION = '0.10.0'
30
30
  end
data/lib/glogin.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,7 +28,7 @@ require_relative 'glogin/cookie'
28
28
 
29
29
  # GLogin main module.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2017-2022 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2017-2023 Yegor Bugayenko
32
32
  # License:: MIT
33
33
  module GLogin
34
34
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test__helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -25,10 +25,6 @@ $stdout.sync = true
25
25
 
26
26
  require 'simplecov'
27
27
  SimpleCov.start
28
- if ENV['CI'] == 'true'
29
- require 'codecov'
30
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
31
- end
32
28
 
33
29
  require 'minitest/autorun'
34
30
  require_relative '../lib/glogin'
data/test/test_glogin.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #
4
- # Copyright (c) 2017-2022 Yegor Bugayenko
4
+ # Copyright (c) 2017-2023 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,7 +26,7 @@ require_relative '../lib/glogin'
26
26
 
27
27
  # GLogin main module test.
28
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2017-2022 Yegor Bugayenko
29
+ # Copyright:: Copyright (c) 2017-2023 Yegor Bugayenko
30
30
  # License:: MIT
31
31
  class TestGLogin < Minitest::Test
32
32
  def test_basic
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.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: 2022-12-20 00:00:00.000000000 Z
11
+ date: 2023-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base58
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.2.3
27
- - !ruby/object:Gem::Dependency
28
- name: codecov
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.6.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 0.6.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: minitest
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +108,20 @@ dependencies:
122
108
  - - '='
123
109
  - !ruby/object:Gem::Version
124
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
125
  - !ruby/object:Gem::Dependency
126
126
  name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -147,7 +147,9 @@ files:
147
147
  - ".0pdd.yml"
148
148
  - ".gitattributes"
149
149
  - ".github/workflows/codecov.yml"
150
+ - ".github/workflows/pdd.yml"
150
151
  - ".github/workflows/rake.yml"
152
+ - ".github/workflows/xcop.yml"
151
153
  - ".gitignore"
152
154
  - ".pdd"
153
155
  - ".rubocop.yml"
@@ -191,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
193
  - !ruby/object:Gem::Version
192
194
  version: '0'
193
195
  requirements: []
194
- rubygems_version: 3.1.2
196
+ rubygems_version: 3.2.15
195
197
  signing_key:
196
198
  specification_version: 4
197
199
  summary: Login/logout via GitHub OAuth for your web app