Skip to content

wingbotai/wingbot-jwt

Repository files navigation

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

BotTokenStorage

Storage for JWT tokens

Typedefs

Token : Object

BotTokenStorage

Storage for JWT tokens

Kind: global class

new BotTokenStorage(secretOrPrivateKey, [jwtOptions])

Param Type
secretOrPrivateKey string | Buffer
[jwtOptions] Object

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

Kind: instance method of BotTokenStorage

Param Type
token string

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

Kind: instance method of BotTokenStorage

Param Type
senderId string
pageId string

Token : Object

Kind: global typedef
Properties

Name Type
senderId string
pageId string
token string

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published