ruby_auth_metamask 0.2.1 → 0.2.3
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 +4 -4
- data/app/controllers/ruby_auth_metamask/users_controller.rb +11 -7
- data/lib/ruby_auth_metamask/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a362ca429634dbf653e1a071640c52731729e774b2bd385f3a760dc8f8a2a4b
|
4
|
+
data.tar.gz: 64d2b043d60f2da7f75446db0aa83008d15322187373afa29316bd1d09dddf5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80ab219b6aadbc2c75b92950253f049dd78c48f75335edce429530174f3a781ff290eb5b1564130fe90707c0184c880e1682a50b855b2318c745912ec4243a88
|
7
|
+
data.tar.gz: b12935258760428718c8d325b65320cac6c3eacc8c3cdc8b24ba4bf672e31971f95b4f3eb199d3daad0fa74a408df7359a1d4237379ac906fe61ed000d299ea5
|
@@ -14,8 +14,12 @@ module RubyAuthMetamask
|
|
14
14
|
|
15
15
|
class UsersController < ApplicationController
|
16
16
|
def signin
|
17
|
-
|
18
|
-
|
17
|
+
if session[:user_id].nil?
|
18
|
+
@message = "ruby_auth_metamask:#{SecureRandom.hex}"
|
19
|
+
session[:message] = @message
|
20
|
+
else
|
21
|
+
redirect_to main_app.root_path
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
def verify
|
@@ -44,11 +48,11 @@ module RubyAuthMetamask
|
|
44
48
|
end
|
45
49
|
|
46
50
|
valid = ECDSA.valid_signature?(public_key, hash, my_signature.sig_obj) rescue false
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
redirect_to main_app.root_path, notice: 'User authentication failed' unless valid
|
52
|
+
|
53
|
+
user = User.find_by_address(address) || User.create(address: address)
|
54
|
+
session[:user_id] = user.id
|
55
|
+
redirect_to main_app.root_path, notice: 'User authentication succeeded'
|
52
56
|
end
|
53
57
|
|
54
58
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_auth_metamask
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -28,30 +28,30 @@ dependencies:
|
|
28
28
|
name: ecdsa
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.2.0
|
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:
|
40
|
+
version: 1.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: keccak
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.3.1
|
48
48
|
type: :runtime
|
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:
|
54
|
+
version: 1.3.1
|
55
55
|
description: This is a Ruby on Rails Engine. It authenticates users against their
|
56
56
|
metamask signature.
|
57
57
|
email:
|