kitcn
Version:
kitcn - React Query integration and CLI tools for Convex
45 lines (44 loc) • 1.11 kB
TypeScript
import { JwtOptions } from "better-auth/plugins/jwt";
//#region src/auth/auth-config.d.ts
type JwksDoc = {
id: string;
publicKey: string;
privateKey: string;
createdAt: number;
expiresAt?: number;
alg?: string;
crv?: string;
};
declare const createPublicJwks: (jwks: JwksDoc[], options?: JwtOptions) => {
keys: any[];
};
declare const getAuthConfigProvider: (opts?: {
basePath?: string;
/**
* @param jwks - Optional static JWKS to avoid fetching from the database.
*
* This should be a stringified document from the Better Auth JWKS table. You
* can create one in the console.
*
* Example:
* ```bash
* npx convex run generated/auth:generateJwk | npx convex env set JWKS
* ```
*
* Then use it in your auth config:
* ```ts
* export default {
* providers: [getAuthConfigProvider({ jwks: process.env.JWKS })],
* } satisfies AuthConfig;
* ```
*/
jwks?: string;
}) => {
type: "customJwt";
issuer: string;
applicationID: string;
algorithm: "RS256";
jwks: string;
};
//#endregion
export { createPublicJwks, getAuthConfigProvider };