From bcd96523cb9cdd5891d26ab6c95fcc3e6b09afcc Mon Sep 17 00:00:00 2001 From: Reynaldi Chernando <12949382+reynaldichernando@users.noreply.github.com> Date: Thu, 11 Dec 2025 04:44:31 +0700 Subject: [PATCH] Add auth types (#2117) --- src/puter-js/types/modules/auth.d.ts | 36 +++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/puter-js/types/modules/auth.d.ts b/src/puter-js/types/modules/auth.d.ts index fc559326c..6a7b47b9c 100644 --- a/src/puter-js/types/modules/auth.d.ts +++ b/src/puter-js/types/modules/auth.d.ts @@ -1,8 +1,18 @@ -export interface AuthUser { +export interface User { uuid: string; username: string; - email_confirmed?: boolean; - [key: string]: unknown; + email_confirmed?: boolean | number; + actual_free_storage?: number; + app_name?: string; + feature_flags?: Record; + hasDevAccountAccess?: boolean; + is_temp?: boolean; + last_activity_ts?: number; + otp?: boolean; + paid_storage?: number; + referral_code?: string; + requires_email_confirmation?: boolean | number; + subscribed?: boolean; } export interface AllowanceInfo { @@ -32,17 +42,21 @@ export interface DetailedAppUsage { [key: string]: APIUsage; } +export interface SignInResult { + success: boolean; + token: string; + app_uid: string; + username: string; + error?: string; + msg?: string; +} + export class Auth { - constructor (context: { authToken?: string; APIOrigin: string; appID?: string }); - - setAuthToken (authToken: string): void; - setAPIOrigin (APIOrigin: string): void; - - signIn (options?: { attempt_temp_user_creation?: boolean }): Promise; + signIn (options?: { attempt_temp_user_creation?: boolean }): Promise; signOut (): void; isSignedIn (): boolean; - getUser (): Promise; - whoami (): Promise; + getUser (): Promise; + whoami (): Promise; getMonthlyUsage (): Promise; getDetailedAppUsage (appId: string): Promise; }