Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elcuervo/net-http-auth-hmac
Signs Net::HTTP requests
https://github.com/elcuervo/net-http-auth-hmac
Last synced: about 2 months ago
JSON representation
Signs Net::HTTP requests
- Host: GitHub
- URL: https://github.com/elcuervo/net-http-auth-hmac
- Owner: elcuervo
- Created: 2012-05-14T15:57:17.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-05-14T15:57:52.000Z (over 12 years ago)
- Last Synced: 2024-11-28T23:28:27.299Z (about 2 months ago)
- Language: Ruby
- Size: 89.8 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# net-http-auth-hmac
![HMAC](http://www.gmkfreelogos.com/logos/H/img/HMAC.gif)
Signs a request with given token to be validated in the backend.
## Usage
Sending a request
```ruby
uri = URI.parse("http://google.com/")
http = Net::HTTP.new(uri.host, uri.port)signer = Net::HTTP::Auth::HMAC.new('super_secret_secret')
request = Net::HTTP::Post.new('/somewhere')
request.body = 'super_secret_value=42'signed_request = signer.sign_request(request)
http.request request
```Receiving a request
```ruby
signer = Net::HTTP::Auth::HMAC.new('super_secret_secret')
unsigned_request = signer.unsign_request(request)
request.body
```## Installation
```bash
gem install net-http-auth-hmac
```