README.md in fernet-0.0.2 vs README.md in fernet-0.1

- old
+ new

@@ -1,12 +1,14 @@ # Fernet -Fernet allows you to easily generate and verify HMAC based authentication tokens for issuing API requests between remote servers. +Fernet allows you to easily generate and verify HMAC based authentication +tokens for issuing API requests between remote servers. ![Fernet](http://f.cl.ly/items/2d0P3d26271O3p2v253u/photo.JPG) -Fernet is usually served as a *digestif* after a meal but may also be served with coffee and espresso or mixed into coffee and espresso drinks. +Fernet is usually served as a *digestif* after a meal but may also be served +with coffee and espresso or mixed into coffee and espresso drinks. Fernet about it! ## Installation @@ -24,20 +26,21 @@ ## Usage Both server and client must share a secret. -You want to encode some data in the token as well, for example, an email address can be used to verify it on the other end. +You want to encode some data in the token as well, for example, an email +address can be used to verify it on the other end. ```ruby token = Fernet.generate(secret) do |generator| generator.data = { email: 'harold@heroku.com' } end ``` +On the server side, the receiver can use this token to verify whether it's +legit: -On the server side, the receiver can use this token to verify wether it's legit: - ```ruby verified = Fernet.verify(secret, token) do |verifier| verifier.data['email'] == 'harold@heroku.com' end ``` @@ -46,12 +49,23 @@ * The email encoded in the token data is `harold@heroku.com` * The token was generated in the last 60 seconds * The secret used to generate the token matches -Otherwise, `verified` will be false, and you should deny the request with an HTTP 401, for example. +Otherwise, `verified` will be false, and you should deny the request with an +HTTP 401, for example. -The specs ([spec/fernet_spec.rb](https://github.com/hgimenez/fernet/blob/master/spec/fernet_spec.rb)) have more usage examples. +The specs +([spec/fernet_spec.rb](https://github.com/hgimenez/fernet/blob/master/spec/fernet_spec.rb)) +have more usage examples. + +### Attribution + +This library was largely made possible by [Mr. Tom +Maher](http://twitter.com/#tmaher), who clearly articulated the mechanics +behind this process, and further found ways to make it +[more](https://github.com/hgimenez/fernet/commit/2bf0b4a66b49ef3fc92ef50708a2c8b401950fc2) +[secure](https://github.com/hgimenez/fernet/commit/051161d0afb0b41480734d84bc824bdbc7f9c563). ## License Fernet is copyright (c) Harold Giménez and is released under the terms of the MIT License found in the LICENSE file.