mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Add local types for dashboard account settings API keys.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
c2ce97e8ce
commit
5ed337eb38
@ -0,0 +1,36 @@
|
||||
export type ApiKeyType = "user" | "team";
|
||||
|
||||
export type ApiKey<Type extends ApiKeyType = ApiKeyType, IsFirstView extends boolean = false> = {
|
||||
id: string;
|
||||
description: string;
|
||||
createdAt: Date;
|
||||
expiresAt?: Date | null;
|
||||
manuallyRevokedAt?: Date | null;
|
||||
value: {
|
||||
lastFour: string;
|
||||
secret?: string;
|
||||
};
|
||||
type: Type;
|
||||
userId: string;
|
||||
update: (options: { description?: string }) => Promise<void>;
|
||||
revoke: () => Promise<void>;
|
||||
isValid: () => boolean;
|
||||
whyInvalid: () => 'manually-revoked' | 'expired' | null;
|
||||
}
|
||||
|
||||
export type ApiKeyCreationOptions<Type extends ApiKeyType = ApiKeyType> = {
|
||||
description: string;
|
||||
expiresAt?: Date | null;
|
||||
}
|
||||
|
||||
export type ActiveSession = {
|
||||
id: string;
|
||||
isCurrentSession: boolean;
|
||||
isImpersonation?: boolean;
|
||||
createdAt: string;
|
||||
lastUsedAt?: string;
|
||||
geoInfo?: {
|
||||
ip?: string;
|
||||
cityName?: string;
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user