omniauth-ethereum 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +3 -2
- data/Gemfile.lock +37 -29
- data/lib/new_session.js +1 -1
- data/lib/omniauth-ethereum.rb +10 -8
- data/omniauth-ethereum.gemspec +9 -9
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3559fd68d95f838f447ce5ce7e15cf72593779482d7b0dee33471261283aff25
|
4
|
+
data.tar.gz: 222cbb83cf1680c9acaa8abe1969de99b5897ec63026ecc4dc97db0bbf23343d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e07df8b3516f97675f74a88ff903774b18d4c5d9a4e578534a917adbd802e95c285a3155a52874590f0cea0e92550100c0f15c194019a0f1839b70f7c96e4aa7
|
7
|
+
data.tar.gz: 2923ebbb1acbb140e6149a7914ba1f011620bea2af2256662124dfab8a520c73abbd9158ed98363c3649ec5dcc75370d3e26cc4c333270a2e9974f449b99177c
|
data/.github/workflows/test.yml
CHANGED
@@ -15,13 +15,14 @@ jobs:
|
|
15
15
|
strategy:
|
16
16
|
fail-fast: false
|
17
17
|
matrix:
|
18
|
-
os: [ubuntu-latest]
|
19
|
-
ruby: ['2.7', '3.
|
18
|
+
os: [ubuntu-latest, macos-latest]
|
19
|
+
ruby: ['2.7', '3.1']
|
20
20
|
steps:
|
21
21
|
- uses: actions/checkout@v2
|
22
22
|
- uses: ruby/setup-ruby@v1
|
23
23
|
with:
|
24
24
|
ruby-version: ${{ matrix.ruby }}
|
25
|
+
bundler-cache: true
|
25
26
|
- name: Install Dependencies
|
26
27
|
run: |
|
27
28
|
bundle install
|
data/Gemfile.lock
CHANGED
@@ -1,52 +1,60 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-ethereum (0.
|
5
|
-
eth (~> 0.
|
6
|
-
omniauth (~> 2.
|
4
|
+
omniauth-ethereum (0.2.0)
|
5
|
+
eth (~> 0.5)
|
6
|
+
omniauth (~> 2.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
diff-lcs (1.
|
12
|
-
eth (0.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
eth (0.5.2)
|
13
|
+
keccak (~> 1.3)
|
14
|
+
konstructor (~> 1.0)
|
15
|
+
openssl (~> 2.2)
|
16
|
+
rbsecp256k1 (~> 5.1)
|
17
17
|
scrypt (~> 3.0)
|
18
|
-
ffi (1.15.
|
18
|
+
ffi (1.15.5)
|
19
19
|
ffi-compiler (1.0.1)
|
20
20
|
ffi (>= 1.0.0)
|
21
21
|
rake
|
22
22
|
hashie (5.0.0)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
ipaddr (1.2.4)
|
24
|
+
keccak (1.3.0)
|
25
|
+
konstructor (1.0.2)
|
26
|
+
mini_portile2 (2.8.0)
|
27
|
+
omniauth (2.1.0)
|
27
28
|
hashie (>= 3.4.6)
|
28
|
-
rack (>=
|
29
|
+
rack (>= 2.2.3)
|
29
30
|
rack-protection
|
31
|
+
openssl (2.2.1)
|
32
|
+
ipaddr
|
33
|
+
pkg-config (1.4.7)
|
30
34
|
rack (2.2.3)
|
31
|
-
rack-protection (2.
|
35
|
+
rack-protection (2.2.0)
|
32
36
|
rack
|
33
37
|
rack-test (1.1.0)
|
34
38
|
rack (>= 1.0, < 3)
|
35
39
|
rake (13.0.6)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
rspec-
|
43
|
-
|
40
|
+
rbsecp256k1 (5.1.0)
|
41
|
+
mini_portile2 (~> 2.7)
|
42
|
+
pkg-config (~> 1.4)
|
43
|
+
rubyzip (~> 2.3)
|
44
|
+
rspec (3.11.0)
|
45
|
+
rspec-core (~> 3.11.0)
|
46
|
+
rspec-expectations (~> 3.11.0)
|
47
|
+
rspec-mocks (~> 3.11.0)
|
48
|
+
rspec-core (3.11.0)
|
49
|
+
rspec-support (~> 3.11.0)
|
50
|
+
rspec-expectations (3.11.0)
|
44
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-mocks (3.
|
52
|
+
rspec-support (~> 3.11.0)
|
53
|
+
rspec-mocks (3.11.1)
|
47
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-support (3.
|
55
|
+
rspec-support (~> 3.11.0)
|
56
|
+
rspec-support (3.11.0)
|
57
|
+
rubyzip (2.3.2)
|
50
58
|
scrypt (3.0.7)
|
51
59
|
ffi-compiler (>= 1.0, < 2.0)
|
52
60
|
|
@@ -56,7 +64,7 @@ PLATFORMS
|
|
56
64
|
DEPENDENCIES
|
57
65
|
omniauth-ethereum!
|
58
66
|
rack-test (~> 1.1)
|
59
|
-
rspec (~> 3.
|
67
|
+
rspec (~> 3.11)
|
60
68
|
|
61
69
|
BUNDLED WITH
|
62
70
|
2.2.28
|
data/lib/new_session.js
CHANGED
@@ -22,7 +22,7 @@ if (typeof window.ethereum !== 'undefined') {
|
|
22
22
|
const etherbase = accounts[0];
|
23
23
|
|
24
24
|
// sign a message with current time
|
25
|
-
const customTitle =
|
25
|
+
const customTitle = document.querySelector('.custom_title').textContent;
|
26
26
|
const requestTime = Math.floor(new Date().getTime() / 1000);
|
27
27
|
const message = customTitle + " " + requestTime;
|
28
28
|
const signature = await personalSign(etherbase, message);
|
data/lib/omniauth-ethereum.rb
CHANGED
@@ -14,11 +14,13 @@ module OmniAuth
|
|
14
14
|
|
15
15
|
# the `eth_address` will be the _fake_ unique identifier for the Ethereum strategy
|
16
16
|
option :uid_field, :eth_address
|
17
|
-
|
18
|
-
|
17
|
+
|
18
|
+
# this will be shown on signature screen
|
19
|
+
option :custom_title, 'Hello from Ruby!'
|
19
20
|
|
20
21
|
def request_phase
|
21
22
|
form = OmniAuth::Form.new :title => 'Ethereum Authentication', :url => callback_path
|
23
|
+
form.html("<span class='custom_title'>#{options.custom_title}</span>")
|
22
24
|
options.fields.each do |field|
|
23
25
|
|
24
26
|
# these fields are read-only and will be filled by javascript in the process
|
@@ -40,17 +42,17 @@ module OmniAuth
|
|
40
42
|
end
|
41
43
|
|
42
44
|
def callback_phase
|
43
|
-
address = request.params['eth_address'].downcase
|
44
|
-
message = request.params['eth_message']
|
45
|
-
signature = request.params['eth_signature']
|
46
|
-
signature_pubkey = Eth::Key.personal_recover message, signature
|
47
|
-
signature_address = (Eth::Utils.public_key_to_address signature_pubkey).downcase
|
48
45
|
|
46
|
+
message = request.params['eth_message']
|
49
47
|
unix_time = message.scan(/\d+/).first.to_i
|
50
48
|
ten_min = 10 * 60
|
51
49
|
return fail!(:invalid_time) unless unix_time + ten_min >= now && unix_time - ten_min <= now
|
52
50
|
|
53
|
-
|
51
|
+
address = Eth::Address.new request.params['eth_address']
|
52
|
+
signature = request.params['eth_signature']
|
53
|
+
signature_pubkey = Eth::Signature.personal_recover message, signature
|
54
|
+
signature_address = Eth::Util.public_key_to_address(signature_pubkey)
|
55
|
+
return fail!(:invalid_credentials) unless signature_address.to_s == address.to_s
|
54
56
|
|
55
57
|
super
|
56
58
|
end
|
data/omniauth-ethereum.gemspec
CHANGED
@@ -3,19 +3,19 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'omniauth-ethereum'
|
6
|
-
spec.version = '0.
|
6
|
+
spec.version = '0.2.0'
|
7
7
|
spec.summary = "OmniAuth Strategy for Ethereum"
|
8
8
|
spec.description = "Authentication Strategy for OmniAuth to authenticate a user with an Ethereum account"
|
9
9
|
spec.authors = ["Afri Schoedon"]
|
10
10
|
spec.email = 'gems@fault.dev'
|
11
|
-
spec.homepage = 'https://github.com/q9f/omniauth-ethereum'
|
11
|
+
spec.homepage = 'https://github.com/q9f/omniauth-ethereum.rb'
|
12
12
|
spec.license = 'Apache-2.0'
|
13
13
|
|
14
14
|
spec.metadata = {
|
15
|
-
'homepage_uri' => 'https://github.com/q9f/omniauth-ethereum',
|
16
|
-
'source_code_uri' => 'https://github.com/q9f/omniauth-ethereum',
|
17
|
-
'github_repo' => 'https://github.com/q9f/omniauth-ethereum',
|
18
|
-
'bug_tracker_uri' => 'https://github.com/q9f/omniauth-ethereum/issues',
|
15
|
+
'homepage_uri' => 'https://github.com/q9f/omniauth-ethereum.rb',
|
16
|
+
'source_code_uri' => 'https://github.com/q9f/omniauth-ethereum.rb',
|
17
|
+
'github_repo' => 'https://github.com/q9f/omniauth-ethereum.rb',
|
18
|
+
'bug_tracker_uri' => 'https://github.com/q9f/omniauth-ethereum.rb/issues',
|
19
19
|
}.freeze
|
20
20
|
|
21
21
|
spec.require_paths = ["lib"]
|
@@ -25,12 +25,12 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = ">= 2.7", "< 4.0"
|
26
26
|
|
27
27
|
# OmniAuth is what this strategy is providing
|
28
|
-
spec.add_dependency 'omniauth', '~> 2.
|
28
|
+
spec.add_dependency 'omniauth', '~> 2.1'
|
29
29
|
|
30
30
|
# Use Ruby-Eth for signature recovery
|
31
|
-
spec.add_dependency 'eth', '~> 0.
|
31
|
+
spec.add_dependency 'eth', '~> 0.5'
|
32
32
|
|
33
33
|
# Spec tests
|
34
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.11'
|
35
35
|
spec.add_development_dependency 'rack-test', '~> 1.1'
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-ethereum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Afri Schoedon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.1'
|
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: '2.
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: eth
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: '0.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.11'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.11'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rack-test
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,14 +82,14 @@ files:
|
|
82
82
|
- lib/new_session.js
|
83
83
|
- lib/omniauth-ethereum.rb
|
84
84
|
- omniauth-ethereum.gemspec
|
85
|
-
homepage: https://github.com/q9f/omniauth-ethereum
|
85
|
+
homepage: https://github.com/q9f/omniauth-ethereum.rb
|
86
86
|
licenses:
|
87
87
|
- Apache-2.0
|
88
88
|
metadata:
|
89
|
-
homepage_uri: https://github.com/q9f/omniauth-ethereum
|
90
|
-
source_code_uri: https://github.com/q9f/omniauth-ethereum
|
91
|
-
github_repo: https://github.com/q9f/omniauth-ethereum
|
92
|
-
bug_tracker_uri: https://github.com/q9f/omniauth-ethereum/issues
|
89
|
+
homepage_uri: https://github.com/q9f/omniauth-ethereum.rb
|
90
|
+
source_code_uri: https://github.com/q9f/omniauth-ethereum.rb
|
91
|
+
github_repo: https://github.com/q9f/omniauth-ethereum.rb
|
92
|
+
bug_tracker_uri: https://github.com/q9f/omniauth-ethereum.rb/issues
|
93
93
|
post_install_message:
|
94
94
|
rdoc_options: []
|
95
95
|
require_paths:
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
111
|
+
rubygems_version: 3.3.8
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: OmniAuth Strategy for Ethereum
|