omniauth-ethereum 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +18 -0
- data/.github/workflows/code.yml +44 -0
- data/.github/workflows/test.yml +7 -3
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/lib/omniauth-ethereum.rb +10 -11
- data/omniauth-ethereum.gemspec +21 -21
- metadata +9 -8
- data/Gemfile.lock +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2285babef95f18732c8816620b392941e58350f2ea32800b45f7a54f9fefbaaa
|
4
|
+
data.tar.gz: 859bc6fd3b38eb10e711f4b0d9d4c4bbd3f964e030509cd155a1af3186c3e88f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec10f640de7d95291c442d7ba177e3c951adebc4f01d8449994a53ebf5517d514ce297150adac3ae49665347c77a9177d3af6048332b2202bcad632bc79d42a
|
7
|
+
data.tar.gz: 8adf7bfd0e2edf4f352448082ce24934cc3063dab2acb48f686e513671dd5332a484fc93256c2ebe6f1d7401c9cede411be11fdd180525d8733f14c2e54ff508
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
updates:
|
3
|
+
-
|
4
|
+
directory: /
|
5
|
+
labels:
|
6
|
+
- dependencies
|
7
|
+
package-ecosystem: bundler
|
8
|
+
schedule:
|
9
|
+
interval: weekly
|
10
|
+
versioning-strategy: increase
|
11
|
+
-
|
12
|
+
directory: /
|
13
|
+
labels:
|
14
|
+
- operations
|
15
|
+
package-ecosystem: github-actions
|
16
|
+
schedule:
|
17
|
+
interval: monthly
|
18
|
+
version: 2
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
name: CodeQL
|
3
|
+
|
4
|
+
on:
|
5
|
+
pull_request:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
push:
|
9
|
+
branches:
|
10
|
+
- main
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
analyze:
|
14
|
+
name: Analyze
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
permissions:
|
17
|
+
actions: read
|
18
|
+
contents: read
|
19
|
+
security-events: write
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
language:
|
24
|
+
- ruby
|
25
|
+
steps:
|
26
|
+
- name: "Checkout repository"
|
27
|
+
uses: actions/checkout@v4
|
28
|
+
- name: "Initialize CodeQL"
|
29
|
+
uses: github/codeql-action/init@v3
|
30
|
+
with:
|
31
|
+
languages: "${{ matrix.language }}"
|
32
|
+
- name: Autobuild
|
33
|
+
uses: github/codeql-action/autobuild@v3
|
34
|
+
- name: "Perform CodeQL Analysis"
|
35
|
+
uses: github/codeql-action/analyze@v3
|
36
|
+
- uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: '3.3'
|
39
|
+
bundler-cache: true
|
40
|
+
- name: "Run rufo code formatting checks"
|
41
|
+
run: |
|
42
|
+
gem install rufo
|
43
|
+
rufo --check ./lib
|
44
|
+
rufo --check ./spec
|
data/.github/workflows/test.yml
CHANGED
@@ -15,10 +15,14 @@ jobs:
|
|
15
15
|
strategy:
|
16
16
|
fail-fast: false
|
17
17
|
matrix:
|
18
|
-
os: [ubuntu-latest, macos-latest]
|
19
|
-
ruby: ['
|
18
|
+
os: ['ubuntu-latest', 'macos-latest']
|
19
|
+
ruby: ['3.0', '3.2', '3.3']
|
20
20
|
steps:
|
21
|
-
- uses: actions/checkout@
|
21
|
+
- uses: actions/checkout@v4
|
22
|
+
- name: MacOs Dependencies
|
23
|
+
run: |
|
24
|
+
brew install --verbose pkg-config automake autogen libtool gmp libffi
|
25
|
+
if: startsWith(matrix.os, 'macOS')
|
22
26
|
- uses: ruby/setup-ruby@v1
|
23
27
|
with:
|
24
28
|
ruby-version: ${{ matrix.ruby }}
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# omniauth-ethereum
|
2
2
|
|
3
|
-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/q9f/omniauth-ethereum/
|
3
|
+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/q9f/omniauth-ethereum.rb/test.yml?branch=main)](https://github.com/q9f/omniauth-ethereum/actions)
|
4
4
|
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/q9f/omniauth-ethereum)](https://github.com/q9f/omniauth-ethereum/releases)
|
5
5
|
[![Gem](https://img.shields.io/gem/v/omniauth-ethereum)](https://rubygems.org/gems/omniauth-ethereum)
|
6
6
|
[![GitHub top language](https://img.shields.io/github/languages/top/q9f/omniauth-ethereum?color=red)](https://github.com/q9f/omniauth-ethereum/pulse)
|
data/lib/omniauth-ethereum.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "omniauth"
|
2
|
+
require "eth"
|
3
3
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
@@ -16,10 +16,10 @@ module OmniAuth
|
|
16
16
|
option :uid_field, :eth_address
|
17
17
|
|
18
18
|
# this will be shown on signature screen
|
19
|
-
option :custom_title,
|
19
|
+
option :custom_title, "Hello from Ruby!"
|
20
20
|
|
21
21
|
def request_phase
|
22
|
-
form = OmniAuth::Form.new :title =>
|
22
|
+
form = OmniAuth::Form.new :title => "Ethereum Authentication", :url => callback_path
|
23
23
|
form.html("<span class='custom_title'>#{options.custom_title}</span>")
|
24
24
|
options.fields.each do |field|
|
25
25
|
|
@@ -32,8 +32,8 @@ module OmniAuth
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# the form button will be heavy on javascript, requesting account, nonce, and signature before submission
|
35
|
-
form.button
|
36
|
-
path = File.join(
|
35
|
+
form.button "Sign In"
|
36
|
+
path = File.join(File.dirname(__FILE__), "new_session.js")
|
37
37
|
js = File.read(path)
|
38
38
|
mod = "<script type='module'>\n#{js}\n</script>"
|
39
39
|
|
@@ -42,14 +42,13 @@ module OmniAuth
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def callback_phase
|
45
|
-
|
46
|
-
|
47
|
-
unix_time = message.scan(/\d+/).first.to_i
|
45
|
+
message = request.params["eth_message"]
|
46
|
+
unix_time = message.scan(/\d+/).last.to_i
|
48
47
|
ten_min = 10 * 60
|
49
48
|
return fail!(:invalid_time) unless unix_time + ten_min >= now && unix_time - ten_min <= now
|
50
49
|
|
51
|
-
address = Eth::Address.new request.params[
|
52
|
-
signature = request.params[
|
50
|
+
address = Eth::Address.new request.params["eth_address"]
|
51
|
+
signature = request.params["eth_signature"]
|
53
52
|
signature_pubkey = Eth::Signature.personal_recover message, signature
|
54
53
|
signature_address = Eth::Util.public_key_to_address(signature_pubkey)
|
55
54
|
return fail!(:invalid_credentials) unless signature_address.to_s == address.to_s
|
data/omniauth-ethereum.gemspec
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
|
-
spec.name
|
6
|
-
spec.version
|
7
|
-
spec.summary
|
8
|
-
spec.description
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
11
|
-
spec.homepage
|
12
|
-
spec.license
|
5
|
+
spec.name = "omniauth-ethereum"
|
6
|
+
spec.version = "0.2.1"
|
7
|
+
spec.summary = "OmniAuth Strategy for Ethereum"
|
8
|
+
spec.description = "Authentication Strategy for OmniAuth to authenticate a user with an Ethereum account"
|
9
|
+
spec.authors = ["Afri Schoedon"]
|
10
|
+
spec.email = "gems@q9f.cc"
|
11
|
+
spec.homepage = "https://github.com/q9f/omniauth-ethereum.rb"
|
12
|
+
spec.license = "Apache-2.0"
|
13
13
|
|
14
|
-
spec.metadata
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
spec.metadata = {
|
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
|
-
spec.require_paths
|
22
|
-
spec.files
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
23
|
|
24
24
|
spec.platform = Gem::Platform::RUBY
|
25
|
-
spec.required_ruby_version = ">=
|
25
|
+
spec.required_ruby_version = ">= 3.0", "< 4.0"
|
26
26
|
|
27
27
|
# OmniAuth is what this strategy is providing
|
28
|
-
spec.add_dependency
|
28
|
+
spec.add_dependency "omniauth", "~> 2.1"
|
29
29
|
|
30
30
|
# Use Ruby-Eth for signature recovery
|
31
|
-
spec.add_dependency
|
31
|
+
spec.add_dependency "eth", "~> 0.5"
|
32
32
|
|
33
33
|
# Spec tests
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_development_dependency
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
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.2.
|
4
|
+
version: 0.2.1
|
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: 2024-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.12'
|
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.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rack-test
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,15 +68,16 @@ dependencies:
|
|
68
68
|
version: '1.1'
|
69
69
|
description: Authentication Strategy for OmniAuth to authenticate a user with an Ethereum
|
70
70
|
account
|
71
|
-
email: gems@
|
71
|
+
email: gems@q9f.cc
|
72
72
|
executables: []
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/dependabot.yml"
|
77
|
+
- ".github/workflows/code.yml"
|
76
78
|
- ".github/workflows/test.yml"
|
77
79
|
- ".gitignore"
|
78
80
|
- Gemfile
|
79
|
-
- Gemfile.lock
|
80
81
|
- LICENSE
|
81
82
|
- README.md
|
82
83
|
- lib/new_session.js
|
@@ -98,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
99
|
requirements:
|
99
100
|
- - ">="
|
100
101
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
102
|
+
version: '3.0'
|
102
103
|
- - "<"
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: '4.0'
|
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.2.32
|
112
113
|
signing_key:
|
113
114
|
specification_version: 4
|
114
115
|
summary: OmniAuth Strategy for Ethereum
|
data/Gemfile.lock
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
omniauth-ethereum (0.2.0)
|
5
|
-
eth (~> 0.5)
|
6
|
-
omniauth (~> 2.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
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
|
-
scrypt (~> 3.0)
|
18
|
-
ffi (1.15.5)
|
19
|
-
ffi-compiler (1.0.1)
|
20
|
-
ffi (>= 1.0.0)
|
21
|
-
rake
|
22
|
-
hashie (5.0.0)
|
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)
|
28
|
-
hashie (>= 3.4.6)
|
29
|
-
rack (>= 2.2.3)
|
30
|
-
rack-protection
|
31
|
-
openssl (2.2.1)
|
32
|
-
ipaddr
|
33
|
-
pkg-config (1.4.7)
|
34
|
-
rack (2.2.3)
|
35
|
-
rack-protection (2.2.0)
|
36
|
-
rack
|
37
|
-
rack-test (1.1.0)
|
38
|
-
rack (>= 1.0, < 3)
|
39
|
-
rake (13.0.6)
|
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)
|
51
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.11.0)
|
53
|
-
rspec-mocks (3.11.1)
|
54
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
55
|
-
rspec-support (~> 3.11.0)
|
56
|
-
rspec-support (3.11.0)
|
57
|
-
rubyzip (2.3.2)
|
58
|
-
scrypt (3.0.7)
|
59
|
-
ffi-compiler (>= 1.0, < 2.0)
|
60
|
-
|
61
|
-
PLATFORMS
|
62
|
-
x86_64-linux
|
63
|
-
|
64
|
-
DEPENDENCIES
|
65
|
-
omniauth-ethereum!
|
66
|
-
rack-test (~> 1.1)
|
67
|
-
rspec (~> 3.11)
|
68
|
-
|
69
|
-
BUNDLED WITH
|
70
|
-
2.2.28
|