import { Logger } from 'homebridge'; import { SmartRentPlatformConfig } from './config'; /** Credentials stored in config.json */ declare type ConfigCredentials = Pick; /** Session stored in session.json */ export declare type Session = { userId: number; accessToken: string; refreshToken: string; expires: Date; }; /** * SmartRent Auth client */ export declare class SmartRentAuthClient { isTfaSession: boolean; private session?; private storagePath; private pluginPath; private sessionPath; private readonly log; private readonly client; constructor(storagePath: string, log?: Logger); private static _isOauthSession; private static _isTfaSession; private static _getExpireDate; /** * Initialize Axios instance for SmartRent OAuth token requests * @returns Axios instance */ private _initializeClient; /** * Log the SmartRent API response * @param response Axios response * @returns SmartRent response data payload */ private _handleResponse; /** * Request a new session using either basic or 2FA credentials * @param credentials username/password or two-factor authentication credentials * @returns OAuth 2 session or two-factor authentication data */ private _requestSession; /** * Read the session from session.json and store in this.session * @returns Session data */ private _readStoredSession; /** * Format session data from SmartRent API and store to disk * @param data SmartRent session data * @param refreshed Whether the session was refreshed * @returns formatted session data */ private _storeSession; /** * Start a new session * @param credentials email, password, and 2FA credentials * @returns OAuth2 session data */ private _startSession; /** * Get a new session using the given username & password * @param credentials username & password credentials * @returns OAuth2 session data */ private _startBasicSession; /** * Get a new session using the given 2FA credentials * @param credentials two-factor authentication credentials * @returns OAuth2 session data */ private _startTfaSession; /** * Refresh a session * @returns OAuth2 session data */ private _refreshSession; private _handleResponseError; /** * Get the current session if valid, a new session, or a refreshed session * @returns OAuth2 session data */ private _getSession; /** * Get the stored access token or a refreshed token if it's expired * @returns OAuth2 access token */ getAccessToken(credentials: ConfigCredentials): Promise; } export {}; //# sourceMappingURL=auth.d.ts.map