import * as better_call from 'better-call'; import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext, G as GenericEndpointContext } from '../../shared/better-auth.6fr3ElRe.js'; import '../../shared/better-auth.Bi8FQwDD.js'; import 'zod'; import '../../shared/better-auth.BLX8BItA.js'; import 'jose'; import 'kysely'; import 'better-sqlite3'; declare const schema: { jwks: { fields: { publicKey: { type: "string"; required: true; }; privateKey: { type: "string"; required: true; }; createdAt: { type: "date"; required: true; }; }; }; }; type JWKOptions = { alg: "EdDSA"; crv?: "Ed25519" | "Ed448"; } | { alg: "ES256"; crv?: never; } | { alg: "RS256"; modulusLength?: number; } | { alg: "PS256"; modulusLength?: number; } | { alg: "ECDH-ES"; crv?: "P-256" | "P-384" | "P-521"; } | { alg: "ES512"; crv?: never; }; interface JwtOptions { jwks?: { /** * Key pair configuration * @description A subset of the options available for the generateKeyPair function * * @see https://github.com/panva/jose/blob/main/src/runtime/node/generate.ts * * @default { alg: 'EdDSA', crv: 'Ed25519' } */ keyPairConfig?: JWKOptions; /** * Disable private key encryption * @description Disable the encryption of the private key in the database * * @default false */ disablePrivateKeyEncryption?: boolean; }; jwt?: { issuer?: string; audience?: string; /** * Set the "exp" (Expiration Time) Claim. * * - If a `number` is passed as an argument it is used as the claim directly. * - If a `Date` instance is passed as an argument it is converted to unix timestamp and used as the * claim. * - If a `string` is passed as an argument it is resolved to a time span, and then added to the * current unix timestamp and used as the claim. * * Format used for time span should be a number followed by a unit, such as "5 minutes" or "1 * day". * * Valid units are: "sec", "secs", "second", "seconds", "s", "minute", "minutes", "min", "mins", * "m", "hour", "hours", "hr", "hrs", "h", "day", "days", "d", "week", "weeks", "w", "year", * "years", "yr", "yrs", and "y". It is not possible to specify months. 365.25 days is used as an * alias for a year. * * If the string is suffixed with "ago", or prefixed with a "-", the resulting time span gets * subtracted from the current unix timestamp. A "from now" suffix can also be used for * readability when adding to the current unix timestamp. * * @default 15m */ expirationTime?: number | string | Date; definePayload?: (session: { user: User & Record; session: Session & Record; }) => Promise> | Record; }; /** * Custom schema for the admin plugin */ schema?: InferOptionSchema; } declare function getJwtToken(ctx: GenericEndpointContext, options?: JwtOptions): Promise; declare function getCustomJwtToken(ctx: GenericEndpointContext, user: User, options?: JwtOptions): Promise; declare const jwt: (options?: JwtOptions) => { id: "jwt"; endpoints: { getJwks: { | undefined)?]>(...inputCtx: C): Promise; options: { method: "GET"; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { keys: { type: string; items: { type: string; properties: { kid: { type: string; }; kty: { type: string; }; use: { type: string; }; alg: { type: string; }; n: { type: string; }; e: { type: string; }; }; }; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/jwks"; }; getToken: { ) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { token: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }>]>(...inputCtx: C): Promise; options: { method: "GET"; requireHeaders: true; use: ((inputContext: better_call.MiddlewareInputContext) => Promise<{ session: { session: Record & { id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }; user: Record & { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; }; }>)[]; metadata: { openapi: { description: string; responses: { 200: { description: string; content: { "application/json": { schema: { type: "object"; properties: { token: { type: string; }; }; }; }; }; }; }; }; }; } & { use: any[]; }; path: "/token"; }; }; hooks: { after: { matcher(context: HookEndpointContext): boolean; handler: (inputContext: better_call.MiddlewareInputContext) => Promise; }[]; }; schema: { jwks: { fields: { publicKey: { type: "string"; required: true; }; privateKey: { type: "string"; required: true; }; createdAt: { type: "date"; required: true; }; }; }; }; }; export { type JwtOptions, getCustomJwtToken, getJwtToken, jwt };