Bouncer.Token

A library of functions used to work with session data.

Summary

Functions

Deletes token(s) and disassociates them with the given user’s ID

Deletes all tokens of a given namespace and disassociates them with the given user’s ID

Generates a token, uses it as a key to save user data to the store, and associates it with the user’s ID

Gets rid of any existing tokens given a namespace and user ID. Generates and returns a new token

Validates a token against a given namespace. Returns the token if valid and false otherwise

Verifies that a given token is valid. Returns data retrieved from the store using the token as a key if token is valid

Functions

delete(token, id)

Deletes token(s) and disassociates them with the given user’s ID.

delete_all(conn, namespace, id)

Deletes all tokens of a given namespace and disassociates them with the given user’s ID.

generate(conn, namespace, user, ttl)

Generates a token, uses it as a key to save user data to the store, and associates it with the user’s ID.

regenerate(conn, namespace, user, ttl)

Gets rid of any existing tokens given a namespace and user ID. Generates and returns a new token.

validate(list)

Validates a token against a given namespace. Returns the token if valid and false otherwise.

verify(conn, namespace, token)

Verifies that a given token is valid. Returns data retrieved from the store using the token as a key if token is valid.