feat: Sync to OSS repo

This commit is contained in:
Wanjohi
2026-08-06 22:13:51 +03:00
parent 46d2a56180
commit 3faac3008f
144 changed files with 27561 additions and 0 deletions

13
packages/auth/src/jwt.ts Normal file
View File

@@ -0,0 +1,13 @@
import { JWTPayload, jwtVerify, KeyLike, SignJWT } from 'jose';
export namespace jwt {
export function create(payload: JWTPayload, algorithm: string, privateKey: KeyLike) {
return new SignJWT(payload)
.setProtectedHeader({ alg: algorithm, typ: 'JWT', kid: 'sst' })
.sign(privateKey);
}
export function verify<T>(token: string, publicKey: KeyLike) {
return jwtVerify<T>(token, publicKey);
}
}