omniauth-blockstack 0.9.1 → 0.9.2

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
  SHA1:
3
- metadata.gz: 18504d2409da70a8f58bfd3062c6ee91421d294e
4
- data.tar.gz: 204f6056ca5f183da7a942c6c4e96886aaec2251
3
+ metadata.gz: ee8e420a1f50250e8dc92e239efb5770aba60f7a
4
+ data.tar.gz: 8ae852e1d4861afd79a6667aee564553f79f83d3
5
5
  SHA512:
6
- metadata.gz: bc7d5f5bbb209461a8f7a8e163b31235725038b33213f38136a1e0599992a5e3a36cbe6ed4c6c5ed7235737a408aeaadaa5d6d0a5cea35fa5923865c9cea2b8b
7
- data.tar.gz: 03bface310a157b1d88be5cd953a248ccb80fa713e78a0264a0d7d90b0e85b207742eaf0203aa060dd93ffb00a5c4fb22e3ebb988bd53eb086a7433bb5a8eff9
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.0)
5
- blockstack (~> 0.5)
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.4)
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 (1.5.6)
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)
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Blockstack
3
- VERSION = "0.9.1"
3
+ VERSION = "0.9.2"
4
4
  end
5
5
  end
@@ -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
- puts "decoded_token: #{decoded_token}"
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
- options.info_map.inject({}) do |h,(k,v)|
72
- h[k.to_s] = decoded_token[v.to_s]
73
- h
74
- end
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.1
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-15 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler