You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
435 B
13 lines
435 B
5 years ago
|
import * as jwt from "jsonwebtoken"
|
||
|
export * from "jsonwebtoken"
|
||
|
|
||
|
import fs = require('fs')
|
||
|
import path = require('path')
|
||
|
|
||
|
const PRIVATE_KEY = fs.readFileSync(path.join(__dirname, 'keys', 'jwtRS256.key'))
|
||
|
export const PUBLIC_KEY = fs.readFileSync(path.join(__dirname, 'keys', 'jwtRS256.key.pub'))
|
||
|
|
||
|
export function signWithRS256(payload: string | object) {
|
||
|
return jwt.sign(payload, PRIVATE_KEY, {algorithm: "RS256"})
|
||
|
}
|