Skip to content

cyx/nobi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages