Skip to content

Studiosity/snuffleupagus

Repository files navigation

Snuffleupagus

A little simple.. auth token generator

Handles basic time-limited authentication token creation / validation

Uses OpenSSL AES with 256 bit CBC encryption

Snuffy

Installation

Include it in your Gemfile:

gem 'snuffleupagus'

Basic Usage

Token creation

snuffy = Snuffleupagus::AuthToken.new('p4ssw0rd')
snuffy.create_token context: 'my-context'
#=> "53616c7465645f5f25dba4d4a97b238c4560ab46ffdfb77b28ad3e7121ab1917"

Token validation

snuffy = Snuffleupagus::AuthToken.new('p4ssw0rd')
snuffy.token_valid? token: "53616c7465645f5f25dba4d4a97b238c4560ab46ffdfb77b28ad3e7121ab1917", context: 'my-context'
#=> true