omniauth-blockstack 0.9.1 → 0.9.2
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/Gemfile.lock +6 -8
- data/lib/omniauth/blockstack/version.rb +1 -1
- data/lib/omniauth/strategies/blockstack.rb +40 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee8e420a1f50250e8dc92e239efb5770aba60f7a
|
4
|
+
data.tar.gz: 8ae852e1d4861afd79a6667aee564553f79f83d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eaedb263decd0751ab70dac0864545a2707cf1ffca20af77092890aa3ce4c10e66920c533ef70a23dc7536e2727a0af270c20536976725c3f996a6c78871ee8
|
7
|
+
data.tar.gz: 1227d23e58ec20d81df3dc37abb7721976672d0d6163239b8ff5948e8fb11cce50c4280da39bdbc1f038e8869c5c5323cce451f6ea47d210f60da3eea75e9d41
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-blockstack (0.9.
|
5
|
-
blockstack (
|
4
|
+
omniauth-blockstack (0.9.2)
|
5
|
+
blockstack (= 0.5.7)
|
6
6
|
omniauth (~> 1.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
bitcoin (0.2.0)
|
12
|
-
bitcoin-ruby
|
13
11
|
bitcoin-ruby (0.0.10)
|
14
|
-
blockstack (0.5.
|
15
|
-
bitcoin
|
12
|
+
blockstack (0.5.7)
|
13
|
+
bitcoin-ruby
|
16
14
|
faraday
|
17
|
-
jwt
|
15
|
+
jwt-blockstack (= 2.0.0.beta2)
|
18
16
|
coderay (1.1.1)
|
19
17
|
diff-lcs (1.3)
|
20
18
|
faraday (0.11.0)
|
@@ -36,7 +34,7 @@ GEM
|
|
36
34
|
guard-compat (~> 1.1)
|
37
35
|
rspec (>= 2.99.0, < 4.0)
|
38
36
|
hashie (3.5.5)
|
39
|
-
jwt (
|
37
|
+
jwt-blockstack (2.0.0.beta2)
|
40
38
|
listen (3.1.5)
|
41
39
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
42
40
|
rb-inotify (~> 0.9, >= 0.9.7)
|
@@ -11,7 +11,6 @@ module OmniAuth
|
|
11
11
|
args [:app_name, :blockstack_api]
|
12
12
|
|
13
13
|
option :uid_claim, 'iss'
|
14
|
-
option :info_map, {"name" => "username"}
|
15
14
|
option :leeway, nil
|
16
15
|
option :valid_within, nil
|
17
16
|
option :blockstack_api, nil
|
@@ -54,7 +53,7 @@ module OmniAuth
|
|
54
53
|
::Blockstack.leeway = options.leeway
|
55
54
|
::Blockstack.valid_within = options.valid_within
|
56
55
|
@decoded_token = ::Blockstack.verify_auth_response auth_response
|
57
|
-
|
56
|
+
|
58
57
|
super
|
59
58
|
|
60
59
|
rescue ::Blockstack::InvalidAuthResponse => error
|
@@ -67,11 +66,46 @@ module OmniAuth
|
|
67
66
|
{:raw_info => decoded_token}
|
68
67
|
end
|
69
68
|
|
69
|
+
credentials do
|
70
|
+
token = nil # In future store token to access Blockstack Core node/storage here
|
71
|
+
{:token => token}
|
72
|
+
end
|
73
|
+
|
70
74
|
info do
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
+
{
|
76
|
+
:nickname => decoded_token["username"],
|
77
|
+
:first_name => decoded_token["profile"].try(:[],"givenName"),
|
78
|
+
:last_name => decoded_token["profile"].try(:[],"familyName"),
|
79
|
+
:location => decoded_token["profile"].try(:[],"address").try(:[],"addressLocality"),
|
80
|
+
:description => decoded_token["profile"].try(:[],"description"),
|
81
|
+
:image => lambda {|images|
|
82
|
+
return nil if images.nil?
|
83
|
+
for image in images
|
84
|
+
if image && image.try(:[],"name") == "avatar"
|
85
|
+
avatar_url = image.try(:[],"contentUrl")
|
86
|
+
if avatar_url && !avatar_url.blank?
|
87
|
+
return avatar_url
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
nil
|
92
|
+
}.call(decoded_token["profile"].try(:[],"image")),
|
93
|
+
:urls => lambda {|websites|
|
94
|
+
urls = {}
|
95
|
+
return urls if websites.nil?
|
96
|
+
count = 0
|
97
|
+
websites.each {|website|
|
98
|
+
if website.try(:[],"@type") == "WebSite"
|
99
|
+
if !website.try(:[],"url").nil?
|
100
|
+
count++
|
101
|
+
urls["site-#{count}"] = website["url"]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
urls
|
105
|
+
}
|
106
|
+
return nil
|
107
|
+
}.call(decoded_token["profile"].try(:[],"website"))
|
108
|
+
}
|
75
109
|
end
|
76
110
|
|
77
111
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-blockstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Larry Salibra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|