@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
39 lines (38 loc) • 1.35 kB
TypeScript
export declare const DEFAULT_API_KEY_EXPIRATION_INTERVALS: readonly [30, 90];
export declare const API_KEY_EXPIRATION_SECONDS_PER_DAY: number;
export type ApiKeyExpirationOptions = {
/**
* Expiration intervals to offer, in days.
*
* Keep these values within the `minExpiresIn` and `maxExpiresIn` limits in
* the matching Better Auth API key server configuration.
*
* @default [30, 90]
*/
intervals?: readonly number[];
/**
* The interval selected when the create dialog opens, in days.
*
* Set this to `null` to select "Never". If the value is unavailable, the
* first configured interval is selected instead.
*
* @default 30
*/
defaultInterval?: number | null;
/**
* Let users create a key without a custom expiration interval.
*
* Better Auth will still apply `keyExpiration.defaultExpiresIn` when the
* server defines one.
*
* @default true
*/
allowNever?: boolean;
};
export type ResolvedApiKeyExpirationOptions = {
intervals: number[];
defaultInterval: number | null;
allowNever: boolean;
};
export declare function resolveApiKeyExpirationOptions(options?: ApiKeyExpirationOptions): ResolvedApiKeyExpirationOptions | false;
export declare const apiKeyExpirationDaysToSeconds: (days: number) => number;