cantina-tokens

4.1.2 • Public • Published

cantina-tokens

Provides generation, validation, and deletion of expirable tokens for Cantina applications.

Provides

  • app.tokens.create(id, options, cb) - Create a token that will automatically expire.
    • id {String}: The id to pair with this token
    • options {Object}: A hash containing the following keys:
      • expire {Number} (optional expiry time in milliseconds, default is 15 minutes)
      • len {Number} (optional token length, default is 16 characters)
      • prefix {String} (required redis prefix, final key is app_prefix:tokensprefix:)
    • callback {Function} Receives err and the newly generated token
  • app.tokens.check(token, prefix, cb) - Check the validity of a token and return the associated id.
  • app.tokens.delete(token, prefix, cb) - Delete a token.

Developed by Terra Eclipse

Terra Eclipse, Inc. is a nationally recognized political technology and strategy firm located in Santa Cruz, CA and Washington, D.C.

Readme

Keywords

Package Sidebar

Install

npm i cantina-tokens

Weekly Downloads

2

Version

4.1.2

License

none

Last publish

Collaborators

  • cpsubrian