jwtin

0.0.2 • Public • Published

JWTIn

Super simple service-to-service authentication mechanism with distributed secrets as environment variables.

Define Services Secrets

You need to provide an environment variable JWTIN with a JSON encoded map of service:secret:

JWTIN="{\"s1\":\"aaa\"\"s2\":\"bbb\"}"

Create a Token

const { createToken } = require('../index')
const token = await createToken('s1', 's2', { foo: 123 })

The token's secret will be secret(s1) + secret(s2)

Validate a Token

const { validateToken } = require('../index')
const token = await validateToken('xxx')
// console.log(token.from)
// console.log(token.to)
// console.log(token.payload)

Readme

Keywords

Package Sidebar

Install

npm i jwtin

Weekly Downloads

4

Version

0.0.2

License

MIT

Unpacked Size

5.34 kB

Total Files

8

Last publish

Collaborators

  • subnik