mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 20:53:15 +00:00
16 lines
373 B
TypeScript
16 lines
373 B
TypeScript
import jsonwebtoken from "jsonwebtoken";
|
|
|
|
/**
|
|
* Generates a JWT for GitHub App authentication
|
|
*/
|
|
export function generateJWT(appId: string, privateKey: string): string {
|
|
const now = Math.floor(Date.now() / 1000);
|
|
|
|
const payload = {
|
|
iat: now,
|
|
exp: now + 10 * 60,
|
|
iss: appId,
|
|
};
|
|
|
|
return jsonwebtoken.sign(payload, privateKey, { algorithm: "RS256" });
|
|
}
|