blockstack 0.5.3 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2afc7cfdcf15787fa05c54435909bcffb382fd3b
4
- data.tar.gz: e4380227dd173ad40ab834a4b4ada210a226c77f
3
+ metadata.gz: 02267b69cdddc84f00b4191a4f7e01d437899683
4
+ data.tar.gz: 8a6570ed5583f394aedee4651f428066eb07fe87
5
5
  SHA512:
6
- metadata.gz: 1bed0576f8b639ff12fd0897a892abba6fa431bc0185b05f2daf230427ef3b14520f41f447656e6bc5b6d5630f44f62cbf15d02272604b0ad6aba9f40a71a2cb
7
- data.tar.gz: 4d38536fe524a51ca0bd1476fa63b81b35df9443fa9963bfcdb7dcb1e8a29366dab6271d987c5e46b3d54a42a257fcf7a06e505c973e61537ec0e6ff891c0583
6
+ metadata.gz: de6af8bb0904587a96085cf1df76f584c1ca2c043db6c9795e96dccd33f9e403dcda5f9e5d9b42e7b0e61576f97ada1bd7f128de1995f95769ac6b5c9ac3eebc
7
+ data.tar.gz: 2d57131387cb060c3a2dd4bf166e354021b72b052ec1192d05add01b87fa4e7495a3e98d9ecc938e57d893edc974bb7d9913006b7a541e6dbd253e4a55ee689b
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Blockstack
1
+ # Blockstack Ruby
2
2
 
3
3
  The Blockstack ruby library for identity and authentication
4
4
 
@@ -20,7 +20,35 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ The Blockstack Ruby gem can be used to enable authentication with Blockstack on ruby apps
24
+ where authentication needs to occur on the server.
25
+
26
+ Authentication requests are generated with the [blockstack-js](https://github.com/blockstack/blockstack.js) JavaScript library in the user's web browser.
27
+
28
+ Authentication responses from the user's Blockstack Portal will be sent to a callback URL
29
+ that you provide and are verified using this library on your server.
30
+
31
+ For an example of this process and library in action, see
32
+ the [OmniAuth Blockstack strategy](https://github.com/blockstack/omniauth-blockstack).
33
+
34
+ ### To verify an auth response
35
+
36
+ ```ruby
37
+ require "blockstack"
38
+
39
+ begin
40
+ auth_response = request.params['authResponse']
41
+
42
+ decoded_auth_response = ::Blockstack.verify_auth_response auth_response
43
+
44
+ # login succeeded
45
+ users_unique_id = decoded_auth_response['iss']
46
+ verified_username = decoded_auth_response['username'] # nil if not provided
47
+ profile = decoded_auth_response['profile']
48
+ rescue ::Blockstack::InvalidAuthResponse => error
49
+ # login failed
50
+ end
51
+ ```
24
52
 
25
53
  ## Development
26
54
 
@@ -30,7 +58,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
30
58
 
31
59
  ## Contributing
32
60
 
33
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/blockstack. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
61
+ Bug reports and pull requests are welcome on GitHub at https://github.com/blockstack/blockstack-ruby.
34
62
 
35
63
 
36
64
  ## License
@@ -1,3 +1,3 @@
1
1
  module Blockstack
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
data/lib/blockstack.rb CHANGED
@@ -94,6 +94,8 @@ module Blockstack
94
94
  decentralized_id.split(':')[2]
95
95
  end
96
96
 
97
+ protected
98
+
97
99
  def self.public_keys_match_issuer?(decoded_token)
98
100
  public_keys = decoded_token['publicKeys']
99
101
  address_from_issuer = get_address_from_did(decoded_token['iss'])
@@ -120,8 +122,6 @@ module Blockstack
120
122
  name_owning_address == address_from_issuer
121
123
  end
122
124
 
123
- protected
124
-
125
125
  def self.faraday
126
126
  connection = Faraday.new
127
127
  connection.headers[:user_agent] = USER_AGENT
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blockstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Larry Salibra