No description, website, or topics provided.
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tests
.gems
LICENSE
README.md
makefile
nobi.gemspec

README.md

nobi

Requirements

  • Ruby 2.0

Ruby port of itsdangerous python signer.

Examples

Best two usecases:

  1. Creating an activation link for users
  2. Creating a password reset link

Creating an activation link for users

signer = Nobi::Signer.new('my secret')

# Let's say the user's ID is 101
signed = signer.sign('101')

# You can now email this url to your users!
url = "http://yoursite.com/activate/?key=%s" % signed

Creating a password reset link

signer = Nobi::TimestampSigner.new('my secret')

# Let's say the user's ID is 101
signed = signer.sign('101')

# You can now email this url to your users!
url = "http://yoursite.com/password-reset/?key=%s" % signed

# In your code, you can verify the expiration:
signer.unsign(signed, max_age: 86400) # 1 day expiration

Installation

As usual, you can install it using rubygems.

$ gem install nobi