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.
 
 
 
 
 

20 lines
588 B

import { IUser } from "../models/user";
import { ObjectID } from "bson";
import { createJWT } from "../keys";
import { IClient } from "../models/client";
export interface OAuthJWT {
user: string;
username: string;
permissions: string[];
application: string
}
export default function getOAuthJWT(token: { user: IUser, permissions: ObjectID[], client: IClient }) {
return createJWT(<OAuthJWT>{
user: token.user.uid,
username: token.user.username,
permissions: token.permissions.map(p => p.toHexString()),
application: token.client.client_id
})
}