2.0.1 • Published 1 year ago

wingbot-jwt v2.0.1

Weekly downloads
24
License
MIT
Repository
github
Last release
1 year ago

JSON web token plugin for wingbot

Fast solution for webview requests authorization

Usage

const { Processor } = require('wingbot');
const { BotTokenStorage } = require('wingbot-jwt');

const processor = new Processor(bot, {
    tokenStorage: new BotTokenStorage('<put a secret here>', { expiresIn: '30d' })
})

API

Classes

Typedefs

BotTokenStorage

Storage for JWT tokens

Kind: global class

new BotTokenStorage(secretOrPrivateKey, jwtOptions)

ParamType
secretOrPrivateKeystring | Buffer
jwtOptionsObject

botTokenStorage.findByToken(token) ⇒ Promise.<(Token|null)>

Kind: instance method of BotTokenStorage

ParamType
tokenstring

botTokenStorage.getOrCreateToken(senderId, pageId) ⇒ Promise.<(Token|null)>

Kind: instance method of BotTokenStorage

ParamType
senderIdstring
pageIdstring

Token : Object

Kind: global typedef
Properties

NameType
senderIdstring
pageIdstring
tokenstring