From 739918731d515324f7411824e70d90a8e954f07d Mon Sep 17 00:00:00 2001 From: Subhankar Maiti Date: Wed, 12 Aug 2026 20:09:51 +0530 Subject: [PATCH 1/2] refactor!: drop the I prefix from TypeScript interfaces --- CLAUDE.md | 6 ++-- MIGRATION_GUIDE.md | 15 ++++++++ references/code-style.md | 6 ++-- src/Auth0.ts | 14 ++++---- .../{IAuth0Client.ts => Auth0Client.ts} | 26 +++++++------- ...nProvider.ts => AuthenticationProvider.ts} | 2 +- ...ntialsManager.ts => CredentialsManager.ts} | 2 +- .../{IMfaClient.ts => MfaClient.ts} | 2 +- ...IMyAccountClient.ts => MyAccountClient.ts} | 2 +- ...ordlessClient.ts => PasswordlessClient.ts} | 2 +- ...IWebAuthProvider.ts => WebAuthProvider.ts} | 2 +- src/core/interfaces/index.ts | 14 ++++---- src/core/models/ApiCredentials.ts | 6 ++-- src/core/models/Credentials.ts | 6 ++-- .../services/AuthenticationOrchestrator.ts | 4 +-- src/factory/Auth0ClientFactory.ts | 8 ++--- src/factory/Auth0ClientFactory.web.ts | 8 ++--- src/hooks/Auth0Context.ts | 8 ++--- src/hooks/Auth0Provider.tsx | 4 +-- src/index.ts | 2 +- .../native/adapters/NativeAuth0Client.ts | 32 ++++++++--------- .../adapters/NativeCredentialsManager.ts | 14 ++++---- .../native/adapters/NativeMfaClient.ts | 10 +++--- .../native/adapters/NativeMyAccountClient.ts | 10 +++--- .../adapters/NativePasswordlessClient.ts | 10 +++--- .../native/adapters/NativeWebAuthProvider.ts | 10 +++--- .../NativeCredentialsManager.errors.spec.ts | 4 +-- .../NativeCredentialsManager.spec.ts | 8 ++--- .../__tests__/NativeMfaClient.spec.ts | 4 +-- .../NativePasswordlessClient.spec.ts | 4 +-- .../NativeWebAuthProvider.errors.spec.ts | 4 +-- .../__tests__/NativeWebAuthProvider.spec.ts | 4 +-- .../{INativeBridge.ts => NativeBridge.ts} | 2 +- .../native/bridge/NativeBridgeManager.ts | 6 ++-- src/platforms/native/bridge/index.ts | 2 +- src/platforms/web/adapters/WebAuth0Client.ts | 34 +++++++++---------- .../web/adapters/WebAuthenticationProvider.ts | 6 ++-- .../web/adapters/WebCredentialsManager.ts | 4 +-- src/platforms/web/adapters/WebMfaClient.ts | 4 +-- .../web/adapters/WebMyAccountClient.ts | 4 +-- .../web/adapters/WebPasswordlessClient.ts | 4 +-- .../web/adapters/WebWebAuthProvider.ts | 4 +-- .../WebAuthenticationProvider.spec.ts | 2 +- 43 files changed, 170 insertions(+), 155 deletions(-) rename src/core/interfaces/{IAuth0Client.ts => Auth0Client.ts} (87%) rename src/core/interfaces/{IAuthenticationProvider.ts => AuthenticationProvider.ts} (97%) rename src/core/interfaces/{ICredentialsManager.ts => CredentialsManager.ts} (99%) rename src/core/interfaces/{IMfaClient.ts => MfaClient.ts} (98%) rename src/core/interfaces/{IMyAccountClient.ts => MyAccountClient.ts} (98%) rename src/core/interfaces/{IPasswordlessClient.ts => PasswordlessClient.ts} (97%) rename src/core/interfaces/{IWebAuthProvider.ts => WebAuthProvider.ts} (98%) rename src/platforms/native/bridge/{INativeBridge.ts => NativeBridge.ts} (99%) diff --git a/CLAUDE.md b/CLAUDE.md index 0dda59134..f0858591e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -39,7 +39,7 @@ react-native-auth0/ │ ├── index.ts # Public API exports (entry point) │ ├── Auth0.ts # Main Auth0 facade class │ ├── core/ # Platform-agnostic core -│ │ ├── interfaces/ # Contracts every platform implements (IAuth0Client, …) +│ │ ├── interfaces/ # Contracts every platform implements (Auth0Client, …) │ │ ├── models/ # Credentials, Auth0User, AuthError hierarchy │ │ ├── services/ # HttpClient, AuthenticationOrchestrator │ │ └── utils/ # scope, validation, telemetry, deepCamelCase @@ -65,7 +65,7 @@ react-native-auth0/ | -------------------------------------------------------- | --------------------------------------------------------- | | `src/index.ts` | Public API surface — everything exported to consumers | | `src/Auth0.ts` | Main facade class | -| `src/core/interfaces/IAuth0Client.ts` | Primary client interface; new methods start here | +| `src/core/interfaces/Auth0Client.ts` | Primary client interface; new methods start here | | `src/core/services/HttpClient.ts` | HTTP wrapper; injects the `Auth0-Client` telemetry header | | `src/core/services/AuthenticationOrchestrator.ts` | Authentication API calls | | `src/core/utils/telemetry.ts` | Telemetry payload (version injected at prebuild) | @@ -143,7 +143,7 @@ The default `yarn test` suite is unit-only — no credentials or live tenant req ## Code Style - **CI-enforced:** single quotes, trailing commas, 2-space indent (Prettier); `@typescript-eslint/unbound-method` is an error; strict TS with `noUnusedLocals`/`noUnusedParameters`. `prettier/prettier` failures fail lint. -- Naming: `PascalCase` types/classes/interfaces (interfaces prefixed `I`), `camelCase` functions/vars, `snake_case` only for raw API wire payloads (converted via `deepCamelCase`). +- Naming: `PascalCase` types/classes/interfaces (interfaces are **not** `I`-prefixed — the contract keeps the plain name, implementations carry the platform prefix), `camelCase` functions/vars, `snake_case` only for raw API wire payloads (converted via `deepCamelCase`). See [references/code-style.md](references/code-style.md) for good/bad examples and the dominant patterns (interface-driven design, factory selection, orchestrators). Read when writing non-trivial new code. diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 21bb27f22..5a8053281 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -235,6 +235,21 @@ Two codes were added for the new Auth0.swift cases, both iOS-only: `AUTHENTICATI `SSO_EXCHANGE_FAILED` (iOS and Android) and `CLEAR_FAILED` (iOS) are now reported instead of being collapsed into a generic credentials-manager error. No action is required unless you exhaustively match on these codes. +### 10. Interfaces no longer use the `I` prefix ✅ + +The platform contracts in `src/core/interfaces/` dropped their `I` prefix, so the interface now takes the plain name and the implementations keep their platform prefix (`Auth0Client` is the contract; `NativeAuth0Client` and `WebAuth0Client` implement it). + +Only one of these was exported to consumers: + +```diff +- import type { IMfaClient } from 'react-native-auth0'; ++ import type { MfaClient } from 'react-native-auth0'; +``` + +**✅ Action Required:** rename the import if you annotated anything with `IMfaClient` — typically a variable holding `auth0.mfa` or the `mfa` object from `useAuth0()`. This is a type-only change; runtime behaviour is identical. + +The rest (`AuthenticationProvider`, `CredentialsManager`, `MyAccountClient`, `PasswordlessClient`, `WebAuthProvider`, `NativeBridge`) were never exported from the package entry point, so nothing to do there. + ### Recommended Reading - The [FAQ](FAQ.md) for guidance on the `authorize()` redirect flow on web and the importance of the `offline_access` scope. diff --git a/references/code-style.md b/references/code-style.md index e5248512c..5283683ad 100644 --- a/references/code-style.md +++ b/references/code-style.md @@ -9,7 +9,7 @@ ## Naming -- `PascalCase` for classes, types, and interfaces; interfaces are `I`-prefixed (`IAuth0Client`, `ICredentialsManager`). +- `PascalCase` for classes, types, and interfaces. Interfaces are **not** `I`-prefixed — the contract takes the plain name (`Auth0Client`, `CredentialsManager`) and implementations carry the platform prefix (`NativeAuth0Client`, `WebCredentialsManager`). - `camelCase` for functions, methods, variables. - `snake_case` appears only in raw API wire payloads; convert to camelCase via `deepCamelCase` (`src/core/utils`) before it reaches public types. - Errors extend `AuthError` and carry a programmatic `code`, a `message`, and an optional `cause`. @@ -21,7 +21,7 @@ ```ts import type { Credentials } from '../../types'; -export interface IAuthenticationProvider { +export interface AuthenticationProvider { passwordRealm: (params: PasswordRealmParameters) => Promise; } @@ -37,7 +37,7 @@ export class InvalidTokenError extends AuthError { ```ts import { Credentials } from '../../types'; // should be `import type` -export interface IAuthenticationProvider { +export interface AuthenticationProvider { passwordRealm(params: any): Promise; // any + method syntax } diff --git a/src/Auth0.ts b/src/Auth0.ts index 7c4c68f8c..b4ee98d04 100644 --- a/src/Auth0.ts +++ b/src/Auth0.ts @@ -1,5 +1,5 @@ -import type { IAuth0Client } from './core/interfaces/IAuth0Client'; -import type { IMfaClient } from './core/interfaces/IMfaClient'; +import type { Auth0Client } from './core/interfaces/Auth0Client'; +import type { MfaClient } from './core/interfaces/MfaClient'; import { Auth0ClientFactory } from './factory/Auth0ClientFactory'; import type { Auth0Options, @@ -29,7 +29,7 @@ import type { * ``` */ class Auth0 { - private client: IAuth0Client; + private client: Auth0Client; /** * Creates an instance of the Auth0 client. @@ -43,7 +43,7 @@ class Auth0 { /** * Provides access to the web-based authentication methods. - * @see IWebAuthProvider + * @see WebAuthProvider */ get webAuth() { return this.client.webAuth; @@ -51,7 +51,7 @@ class Auth0 { /** * Provides access to the credentials management methods. - * @see ICredentialsManager + * @see CredentialsManager */ get credentialsManager() { return this.client.credentialsManager; @@ -59,7 +59,7 @@ class Auth0 { /** * Provides access to direct authentication methods (e.g., password-realm). - * @see IAuthenticationProvider + * @see AuthenticationProvider */ get auth() { return this.client.auth; @@ -165,7 +165,7 @@ class Auth0 { * const credentials = await auth0.mfa.verify({ mfaToken, otp: '123456' }); * ``` */ - get mfa(): IMfaClient { + get mfa(): MfaClient { return this.client.mfa; } diff --git a/src/core/interfaces/IAuth0Client.ts b/src/core/interfaces/Auth0Client.ts similarity index 87% rename from src/core/interfaces/IAuth0Client.ts rename to src/core/interfaces/Auth0Client.ts index a1bcdc54f..c55fc70ed 100644 --- a/src/core/interfaces/IAuth0Client.ts +++ b/src/core/interfaces/Auth0Client.ts @@ -1,9 +1,9 @@ -import type { IWebAuthProvider } from './IWebAuthProvider'; -import type { ICredentialsManager } from './ICredentialsManager'; -import type { IAuthenticationProvider } from './IAuthenticationProvider'; -import type { IMyAccountClient } from './IMyAccountClient'; -import type { IPasswordlessClient } from './IPasswordlessClient'; -import type { IMfaClient } from './IMfaClient'; +import type { WebAuthProvider } from './WebAuthProvider'; +import type { CredentialsManager } from './CredentialsManager'; +import type { AuthenticationProvider } from './AuthenticationProvider'; +import type { MyAccountClient } from './MyAccountClient'; +import type { PasswordlessClient } from './PasswordlessClient'; +import type { MfaClient } from './MfaClient'; import type { DPoPHeadersParams, CustomTokenExchangeParameters, @@ -21,33 +21,33 @@ import type { * into a single, cohesive contract. Platform-specific factories will produce an * object that conforms to this interface. */ -export interface IAuth0Client { +export interface Auth0Client { /** * Provides access to methods for handling web-based authentication flows. */ - readonly webAuth: IWebAuthProvider; + readonly webAuth: WebAuthProvider; /** * Provides access to methods for securely managing user credentials on the device. */ - readonly credentialsManager: ICredentialsManager; + readonly credentialsManager: CredentialsManager; /** * Provides access to methods for direct authentication grants (e.g., password-realm). */ - readonly auth: IAuthenticationProvider; + readonly auth: AuthenticationProvider; /** * Provides access to methods for interacting with the My Account API for managing authentication methods. */ - readonly myAccount: IMyAccountClient; + readonly myAccount: MyAccountClient; /** * Provides access to the passwordless OTP flow for database connections. * * @remarks Native only (iOS, Android). Not supported on web. */ - readonly passwordless: IPasswordlessClient; + readonly passwordless: PasswordlessClient; /** * Generates DPoP headers for making authenticated requests to custom APIs. @@ -101,7 +101,7 @@ export interface IAuth0Client { * const credentials = await auth0.mfa.verify({ mfaToken, otp: '123456' }); * ``` */ - readonly mfa: IMfaClient; + readonly mfa: MfaClient; /** * Requests a passkey signup challenge from Auth0. diff --git a/src/core/interfaces/IAuthenticationProvider.ts b/src/core/interfaces/AuthenticationProvider.ts similarity index 97% rename from src/core/interfaces/IAuthenticationProvider.ts rename to src/core/interfaces/AuthenticationProvider.ts index f2bc97a22..c477df6c5 100644 --- a/src/core/interfaces/IAuthenticationProvider.ts +++ b/src/core/interfaces/AuthenticationProvider.ts @@ -21,7 +21,7 @@ import type { * Defines the contract for direct authentication methods that interact with Auth0's * Authentication API endpoints without a web-based redirect. */ -export interface IAuthenticationProvider { +export interface AuthenticationProvider { passwordRealm(parameters: PasswordRealmParameters): Promise; refreshToken(parameters: RefreshTokenParameters): Promise; userInfo(parameters: UserInfoParameters): Promise; diff --git a/src/core/interfaces/ICredentialsManager.ts b/src/core/interfaces/CredentialsManager.ts similarity index 99% rename from src/core/interfaces/ICredentialsManager.ts rename to src/core/interfaces/CredentialsManager.ts index 936f1872b..15ee0a21d 100644 --- a/src/core/interfaces/ICredentialsManager.ts +++ b/src/core/interfaces/CredentialsManager.ts @@ -6,7 +6,7 @@ import { ApiCredentials } from '../models'; * Implementations are responsible for secure storage (e.g., Keychain on iOS, * EncryptedSharedPreferences on Android) and token refresh logic. */ -export interface ICredentialsManager { +export interface CredentialsManager { /** * Securely saves a set of credentials to the device's storage. * diff --git a/src/core/interfaces/IMfaClient.ts b/src/core/interfaces/MfaClient.ts similarity index 98% rename from src/core/interfaces/IMfaClient.ts rename to src/core/interfaces/MfaClient.ts index 93d003264..d862e19a0 100644 --- a/src/core/interfaces/IMfaClient.ts +++ b/src/core/interfaces/MfaClient.ts @@ -16,7 +16,7 @@ import type { * from an MFA_REQUIRED error. It provides methods to list authenticators, * enroll new factors, challenge existing factors, and verify MFA codes. */ -export interface IMfaClient { +export interface MfaClient { /** * Lists the user's enrolled MFA authenticators. * diff --git a/src/core/interfaces/IMyAccountClient.ts b/src/core/interfaces/MyAccountClient.ts similarity index 98% rename from src/core/interfaces/IMyAccountClient.ts rename to src/core/interfaces/MyAccountClient.ts index dcbcab2a4..5f9a669ba 100644 --- a/src/core/interfaces/IMyAccountClient.ts +++ b/src/core/interfaces/MyAccountClient.ts @@ -23,7 +23,7 @@ import type { Factor, } from '../../types'; -export interface IMyAccountClient { +export interface MyAccountClient { // --- Passkey Enrollment --- passkeyEnrollmentChallenge( diff --git a/src/core/interfaces/IPasswordlessClient.ts b/src/core/interfaces/PasswordlessClient.ts similarity index 97% rename from src/core/interfaces/IPasswordlessClient.ts rename to src/core/interfaces/PasswordlessClient.ts index 25514a224..fa2bcd036 100644 --- a/src/core/interfaces/IPasswordlessClient.ts +++ b/src/core/interfaces/PasswordlessClient.ts @@ -15,7 +15,7 @@ import type { * * @remarks Native only (iOS, Android). Not supported on web. */ -export interface IPasswordlessClient { +export interface PasswordlessClient { /** * Issues an OTP challenge to an email address for a database connection. * diff --git a/src/core/interfaces/IWebAuthProvider.ts b/src/core/interfaces/WebAuthProvider.ts similarity index 98% rename from src/core/interfaces/IWebAuthProvider.ts rename to src/core/interfaces/WebAuthProvider.ts index dbd12f48c..2412b31b2 100644 --- a/src/core/interfaces/IWebAuthProvider.ts +++ b/src/core/interfaces/WebAuthProvider.ts @@ -16,7 +16,7 @@ import type { * Defines the contract for a provider that handles web-based authentication flows, * such as redirecting to the Auth0 Universal Login page. */ -export interface IWebAuthProvider { +export interface WebAuthProvider { /** * Initiates the web-based authentication flow. * diff --git a/src/core/interfaces/index.ts b/src/core/interfaces/index.ts index bbdd9f1e9..44e9d2f5f 100644 --- a/src/core/interfaces/index.ts +++ b/src/core/interfaces/index.ts @@ -1,8 +1,8 @@ export * from './common'; -export * from './IAuth0Client'; -export * from './IAuthenticationProvider'; -export * from './ICredentialsManager'; -export * from './IMyAccountClient'; -export * from './IPasswordlessClient'; -export * from './IWebAuthProvider'; -export * from './IMfaClient'; +export * from './Auth0Client'; +export * from './AuthenticationProvider'; +export * from './CredentialsManager'; +export * from './MyAccountClient'; +export * from './PasswordlessClient'; +export * from './WebAuthProvider'; +export * from './MfaClient'; diff --git a/src/core/models/ApiCredentials.ts b/src/core/models/ApiCredentials.ts index a6dc8f8ac..4cdad6226 100644 --- a/src/core/models/ApiCredentials.ts +++ b/src/core/models/ApiCredentials.ts @@ -1,10 +1,10 @@ -import type { ApiCredentials as IApiCredentials } from '../../types'; +import type { ApiCredentials as ApiCredentialsData } from '../../types'; /** * A class representation of API-specific user credentials. * It encapsulates the tokens and provides helper methods for convenience. */ -export class ApiCredentials implements IApiCredentials { +export class ApiCredentials implements ApiCredentialsData { public accessToken: string; public tokenType: string; public expiresAt: number; @@ -15,7 +15,7 @@ export class ApiCredentials implements IApiCredentials { * * @param params An object conforming to the ApiCredentials type definition. */ - constructor(params: IApiCredentials) { + constructor(params: ApiCredentialsData) { this.accessToken = params.accessToken; this.tokenType = params.tokenType; this.expiresAt = params.expiresAt; diff --git a/src/core/models/Credentials.ts b/src/core/models/Credentials.ts index 4115f8ae2..89ae993b6 100644 --- a/src/core/models/Credentials.ts +++ b/src/core/models/Credentials.ts @@ -1,5 +1,5 @@ import type { - Credentials as ICredentials, + Credentials as CredentialsData, NativeCredentialsResponse, } from '../../types'; @@ -7,7 +7,7 @@ import type { * A class representation of user credentials. * It encapsulates the tokens and provides helper methods for convenience. */ -export class Credentials implements ICredentials { +export class Credentials implements CredentialsData { public idToken: string; public accessToken: string; public tokenType: string; @@ -25,7 +25,7 @@ export class Credentials implements ICredentials { * * @param params An object conforming to the Credentials type definition. */ - constructor(params: ICredentials) { + constructor(params: CredentialsData) { this.idToken = params.idToken; this.accessToken = params.accessToken; this.tokenType = params.tokenType; diff --git a/src/core/services/AuthenticationOrchestrator.ts b/src/core/services/AuthenticationOrchestrator.ts index d9dc1d2e0..62f4bab79 100644 --- a/src/core/services/AuthenticationOrchestrator.ts +++ b/src/core/services/AuthenticationOrchestrator.ts @@ -1,4 +1,4 @@ -import type { IAuthenticationProvider } from '../interfaces'; +import type { AuthenticationProvider } from '../interfaces'; import type { Credentials, SessionTransferCredentials, @@ -67,7 +67,7 @@ function includeRequiredScope(scope?: string): string { * Orchestrates all direct authentication flows by making calls to the Auth0 Authentication API. * This class is platform-agnostic and relies on an injected HttpClient. */ -export class AuthenticationOrchestrator implements IAuthenticationProvider { +export class AuthenticationOrchestrator implements AuthenticationProvider { private readonly client: HttpClient; private readonly clientId: string; private readonly tokenType: TokenType; diff --git a/src/factory/Auth0ClientFactory.ts b/src/factory/Auth0ClientFactory.ts index 08dd5cda4..bf848e3e7 100644 --- a/src/factory/Auth0ClientFactory.ts +++ b/src/factory/Auth0ClientFactory.ts @@ -1,4 +1,4 @@ -import type { IAuth0Client } from '../core/interfaces'; +import type { Auth0Client } from '../core/interfaces'; import type { Auth0Options } from '../types'; import type { NativeAuth0Options } from '../types/platform-specific'; import { validateAuth0Options, getConfigSignature } from '../core/utils'; @@ -7,12 +7,12 @@ import { validateAuth0Options, getConfigSignature } from '../core/utils'; import { NativeAuth0Client } from '../platforms/native'; /** - * Creates the Native-specific IAuth0Client; selected by Metro for iOS/Android. + * Creates the Native-specific Auth0Client; selected by Metro for iOS/Android. * Clients are cached by config signature so remounts reuse the same instance * (avoiding duplicate refresh exchanges); a config change yields a fresh client. */ export class Auth0ClientFactory { - private static clientCache = new Map(); + private static clientCache = new Map(); /** * Creates or returns a cached NativeAuth0Client instance. @@ -20,7 +20,7 @@ export class Auth0ClientFactory { * @param options The configuration options for the Auth0 client. * @returns An instance of NativeAuth0Client. */ - static createClient(options: Auth0Options): IAuth0Client { + static createClient(options: Auth0Options): Auth0Client { validateAuth0Options(options); const cacheKey = getConfigSignature(options); diff --git a/src/factory/Auth0ClientFactory.web.ts b/src/factory/Auth0ClientFactory.web.ts index 43888d643..2a6dbe555 100644 --- a/src/factory/Auth0ClientFactory.web.ts +++ b/src/factory/Auth0ClientFactory.web.ts @@ -1,4 +1,4 @@ -import type { IAuth0Client } from '../core/interfaces'; +import type { Auth0Client } from '../core/interfaces'; import type { Auth0Options } from '../types'; import type { WebAuth0Options } from '../types/platform-specific'; import { validateAuth0Options, getConfigSignature } from '../core/utils'; @@ -7,12 +7,12 @@ import { validateAuth0Options, getConfigSignature } from '../core/utils'; import { WebAuth0Client } from '../platforms/web'; /** - * Creates the Web-specific IAuth0Client; selected by bundlers when targeting web. + * Creates the Web-specific Auth0Client; selected by bundlers when targeting web. * Clients are cached by config signature so remounts reuse the same instance * (avoiding duplicate refresh exchanges); a config change yields a fresh client. */ export class Auth0ClientFactory { - private static clientCache = new Map(); + private static clientCache = new Map(); /** * Creates or returns a cached WebAuth0Client instance. @@ -20,7 +20,7 @@ export class Auth0ClientFactory { * @param options The configuration options for the Auth0 client. * @returns An instance of WebAuth0Client. */ - static createClient(options: Auth0Options): IAuth0Client { + static createClient(options: Auth0Options): Auth0Client { validateAuth0Options(options); const cacheKey = getConfigSignature(options); diff --git a/src/hooks/Auth0Context.ts b/src/hooks/Auth0Context.ts index d6aea5243..08f00ecc7 100644 --- a/src/hooks/Auth0Context.ts +++ b/src/hooks/Auth0Context.ts @@ -23,8 +23,8 @@ import type { DPoPHeadersParams, SessionTransferCredentials, } from '../types'; -import type { IMfaClient } from '../core/interfaces/IMfaClient'; -import type { IMyAccountClient } from '../core/interfaces'; +import type { MfaClient } from '../core/interfaces/MfaClient'; +import type { MyAccountClient } from '../core/interfaces'; import type { PasswordlessChallenge, PasswordlessChallengeEmailParameters, @@ -286,7 +286,7 @@ export interface Auth0ContextInterface extends AuthState { * const methods = await myAccount.getAuthenticationMethods({ accessToken }); * ``` */ - myAccount: IMyAccountClient; + myAccount: MyAccountClient; /** * Provides access to the Passwordless OTP flow for database connections. @@ -445,7 +445,7 @@ export interface Auth0ContextInterface extends AuthState { * const credentials = await mfa.verify({ mfaToken, otp: '123456' }); * ``` */ - mfa: IMfaClient; + mfa: MfaClient; /** * Exchanges a refresh token for session transfer credentials via the Authentication API. diff --git a/src/hooks/Auth0Provider.tsx b/src/hooks/Auth0Provider.tsx index c5099d0d5..c37e0b5f4 100644 --- a/src/hooks/Auth0Provider.tsx +++ b/src/hooks/Auth0Provider.tsx @@ -31,7 +31,7 @@ import type { PasswordlessChallengePhoneParameters, PasswordlessLoginOtpParameters, } from '../types'; -import type { IMfaClient } from '../core/interfaces/IMfaClient'; +import type { MfaClient } from '../core/interfaces/MfaClient'; import type { NativeAuthorizeOptions, NativeClearSessionOptions, @@ -455,7 +455,7 @@ export const Auth0Provider = ({ [client] ); - const mfa = useMemo(() => { + const mfa = useMemo(() => { const mfaClient = client.mfa; return { getAuthenticators: async (parameters) => { diff --git a/src/index.ts b/src/index.ts index cce9cddc7..02e423e64 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,7 +24,7 @@ export { LocalAuthenticationStrategy, } from './types/platform-specific'; export type { LocalAuthenticationOptions } from './types/platform-specific'; -export type { IMfaClient } from './core/interfaces/IMfaClient'; +export type { MfaClient } from './core/interfaces/MfaClient'; // Re-export Auth0 as default export { default } from './Auth0'; diff --git a/src/platforms/native/adapters/NativeAuth0Client.ts b/src/platforms/native/adapters/NativeAuth0Client.ts index edb962e44..514518f12 100644 --- a/src/platforms/native/adapters/NativeAuth0Client.ts +++ b/src/platforms/native/adapters/NativeAuth0Client.ts @@ -1,9 +1,9 @@ import type { - IAuth0Client, - IAuthenticationProvider, - IMyAccountClient, - IPasswordlessClient, - IMfaClient, + Auth0Client, + AuthenticationProvider, + MyAccountClient, + PasswordlessClient, + MfaClient, } from '../../../core/interfaces'; import type { NativeAuth0Options } from '../../../types/platform-specific'; import type { @@ -20,7 +20,7 @@ import { NativeCredentialsManager } from './NativeCredentialsManager'; import { NativeMfaClient } from './NativeMfaClient'; import { NativeMyAccountClient } from './NativeMyAccountClient'; import { NativePasswordlessClient } from './NativePasswordlessClient'; -import { type INativeBridge, NativeBridgeManager } from '../bridge'; +import { type NativeBridge, NativeBridgeManager } from '../bridge'; import { AuthenticationOrchestrator } from '../../../core/services'; import { HttpClient } from '../../../core/services/HttpClient'; import { TokenType } from '../../../types/common'; @@ -31,20 +31,20 @@ import { validateTokenTypeUri, } from '../../../core/utils'; -export class NativeAuth0Client implements IAuth0Client { +export class NativeAuth0Client implements Auth0Client { readonly webAuth: NativeWebAuthProvider; readonly credentialsManager: NativeCredentialsManager; - readonly auth: IAuthenticationProvider; - readonly mfa: IMfaClient; - readonly passwordless: IPasswordlessClient; + readonly auth: AuthenticationProvider; + readonly mfa: MfaClient; + readonly passwordless: PasswordlessClient; private ready: Promise; private readonly httpClient: HttpClient; private readonly tokenType: TokenType; - private readonly bridge: INativeBridge; + private readonly bridge: NativeBridge; private readonly options: NativeAuth0Options; private readonly configSignature: string; private syncLock: Promise = Promise.resolve(); - private guardedBridge!: INativeBridge; + private guardedBridge!: NativeBridge; // Signature last applied to the shared native singleton. `hasValidInstance` // only checks domain/clientId, so this tracks other identity options @@ -97,7 +97,7 @@ export class NativeAuth0Client implements IAuth0Client { } private async initialize( - bridge: INativeBridge, + bridge: NativeBridge, options: NativeAuth0Options ): Promise { const { @@ -141,7 +141,7 @@ export class NativeAuth0Client implements IAuth0Client { return this.syncLock; } - readonly myAccount: IMyAccountClient; + readonly myAccount: MyAccountClient; async getDPoPHeaders( params: DPoPHeadersParams @@ -158,7 +158,7 @@ export class NativeAuth0Client implements IAuth0Client { } } - private createGuardedBridge(bridge: INativeBridge): INativeBridge { + private createGuardedBridge(bridge: NativeBridge): NativeBridge { const guarded: any = {}; // Get the prototype of the bridge instance to access its methods. @@ -189,7 +189,7 @@ export class NativeAuth0Client implements IAuth0Client { }; } - return guarded as INativeBridge; + return guarded as NativeBridge; } /** diff --git a/src/platforms/native/adapters/NativeCredentialsManager.ts b/src/platforms/native/adapters/NativeCredentialsManager.ts index dd5f1d61d..b0fe8b521 100644 --- a/src/platforms/native/adapters/NativeCredentialsManager.ts +++ b/src/platforms/native/adapters/NativeCredentialsManager.ts @@ -1,20 +1,20 @@ -import type { ICredentialsManager } from '../../../core/interfaces'; +import type { CredentialsManager } from '../../../core/interfaces'; import { ApiCredentials, AuthError } from '../../../core/models'; import { CredentialsManagerError } from '../../../core/models'; import type { - ApiCredentials as IApiCredentials, + ApiCredentials as ApiCredentialsData, Credentials, SessionTransferCredentials, } from '../../../types'; -import type { INativeBridge } from '../bridge'; +import type { NativeBridge } from '../bridge'; /** - * A native platform-specific implementation of the ICredentialsManager. + * A native platform-specific implementation of the CredentialsManager. * It delegates all credential storage, retrieval, and management logic to the * underlying native bridge, which uses secure native storage. */ -export class NativeCredentialsManager implements ICredentialsManager { - constructor(private bridge: INativeBridge) {} +export class NativeCredentialsManager implements CredentialsManager { + constructor(private bridge: NativeBridge) {} private async handleError(promise: Promise): Promise { try { @@ -58,7 +58,7 @@ export class NativeCredentialsManager implements ICredentialsManager { this.bridge.getApiCredentials(audience, scope, minTtl ?? 0, parameters) ); // Convert plain object from native to class instance - return new ApiCredentials(nativeCredentials as IApiCredentials); + return new ApiCredentials(nativeCredentials as ApiCredentialsData); } async clearApiCredentials(audience: string, scope?: string): Promise { diff --git a/src/platforms/native/adapters/NativeMfaClient.ts b/src/platforms/native/adapters/NativeMfaClient.ts index b3514d144..078c973ab 100644 --- a/src/platforms/native/adapters/NativeMfaClient.ts +++ b/src/platforms/native/adapters/NativeMfaClient.ts @@ -1,5 +1,5 @@ -import type { IMfaClient } from '../../../core/interfaces'; -import type { INativeBridge } from '../bridge'; +import type { MfaClient } from '../../../core/interfaces'; +import type { NativeBridge } from '../bridge'; import type { Credentials, MfaAuthenticator, @@ -18,10 +18,10 @@ import type { } from '../../../types'; import { AuthError, MfaError } from '../../../core/models'; -export class NativeMfaClient implements IMfaClient { - private readonly bridge: INativeBridge; +export class NativeMfaClient implements MfaClient { + private readonly bridge: NativeBridge; - constructor(bridge: INativeBridge) { + constructor(bridge: NativeBridge) { this.bridge = bridge; } diff --git a/src/platforms/native/adapters/NativeMyAccountClient.ts b/src/platforms/native/adapters/NativeMyAccountClient.ts index 2a202fa1a..98f4a1bac 100644 --- a/src/platforms/native/adapters/NativeMyAccountClient.ts +++ b/src/platforms/native/adapters/NativeMyAccountClient.ts @@ -1,4 +1,4 @@ -import type { IMyAccountClient } from '../../../core/interfaces'; +import type { MyAccountClient } from '../../../core/interfaces'; import type { PasskeyEnrollmentChallengeParameters, PasskeyEnrollmentChallengeResponse, @@ -23,13 +23,13 @@ import type { RecoveryCodeEnrollmentChallenge, Factor, } from '../../../types'; -import type { INativeBridge } from '../bridge'; +import type { NativeBridge } from '../bridge'; import { AuthError, PasskeyError, MyAccountError } from '../../../core/models'; -export class NativeMyAccountClient implements IMyAccountClient { - private readonly bridge: INativeBridge; +export class NativeMyAccountClient implements MyAccountClient { + private readonly bridge: NativeBridge; - constructor(bridge: INativeBridge) { + constructor(bridge: NativeBridge) { this.bridge = bridge; } diff --git a/src/platforms/native/adapters/NativePasswordlessClient.ts b/src/platforms/native/adapters/NativePasswordlessClient.ts index 80492352e..0aed9329f 100644 --- a/src/platforms/native/adapters/NativePasswordlessClient.ts +++ b/src/platforms/native/adapters/NativePasswordlessClient.ts @@ -1,4 +1,4 @@ -import type { IPasswordlessClient } from '../../../core/interfaces'; +import type { PasswordlessClient } from '../../../core/interfaces'; import type { Credentials, PasswordlessChallenge, @@ -6,12 +6,12 @@ import type { PasswordlessChallengePhoneParameters, PasswordlessLoginOtpParameters, } from '../../../types'; -import type { INativeBridge } from '../bridge'; +import type { NativeBridge } from '../bridge'; -export class NativePasswordlessClient implements IPasswordlessClient { - private readonly bridge: INativeBridge; +export class NativePasswordlessClient implements PasswordlessClient { + private readonly bridge: NativeBridge; - constructor(bridge: INativeBridge) { + constructor(bridge: NativeBridge) { this.bridge = bridge; } diff --git a/src/platforms/native/adapters/NativeWebAuthProvider.ts b/src/platforms/native/adapters/NativeWebAuthProvider.ts index 0503c3cf9..533d43e51 100644 --- a/src/platforms/native/adapters/NativeWebAuthProvider.ts +++ b/src/platforms/native/adapters/NativeWebAuthProvider.ts @@ -1,5 +1,5 @@ import { Linking, Platform, type EmitterSubscription } from 'react-native'; -import type { IWebAuthProvider } from '../../../core/interfaces'; +import type { WebAuthProvider } from '../../../core/interfaces'; import type { Credentials, WebAuthorizeParameters, @@ -10,19 +10,19 @@ import type { NativeAuthorizeOptions, NativeClearSessionOptions, } from '../../../types/platform-specific'; -import type { INativeBridge } from '../bridge'; +import type { NativeBridge } from '../bridge'; import { finalizeScope } from '../../../core/utils'; import { AuthError, WebAuthError } from '../../../core/models'; const webAuthNotSupported = 'This Method is only available in web platform.'; /** - * A native platform-specific implementation of the IWebAuthProvider. + * A native platform-specific implementation of the WebAuthProvider. * This class translates web authentication calls into calls to the native bridge. */ -export class NativeWebAuthProvider implements IWebAuthProvider { +export class NativeWebAuthProvider implements WebAuthProvider { constructor( - private bridge: INativeBridge, + private bridge: NativeBridge, private domain: string ) {} handleRedirectCallback(): Promise { diff --git a/src/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.ts b/src/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.ts index 7a66c81b8..eae2182e2 100644 --- a/src/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.ts +++ b/src/platforms/native/adapters/__tests__/NativeCredentialsManager.errors.spec.ts @@ -1,9 +1,9 @@ import { NativeCredentialsManager } from '../NativeCredentialsManager'; -import { INativeBridge } from '../../bridge'; +import { NativeBridge } from '../../bridge'; import { CredentialsManagerError } from '../../../../core/models'; // Mock the native bridge -const mockBridge: jest.Mocked = { +const mockBridge: jest.Mocked = { getCredentials: jest.fn(), saveCredentials: jest.fn(), clearCredentials: jest.fn(), diff --git a/src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts b/src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts index be71ce9e0..b1c67c554 100644 --- a/src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts +++ b/src/platforms/native/adapters/__tests__/NativeCredentialsManager.spec.ts @@ -1,9 +1,9 @@ import { NativeCredentialsManager } from '../NativeCredentialsManager'; -import { INativeBridge } from '../../bridge'; +import { NativeBridge } from '../../bridge'; import { AuthError, CredentialsManagerError } from '../../../../core/models'; -// 1. Create a mock of the INativeBridge dependency. -const mockBridge: jest.Mocked = { +// 1. Create a mock of the NativeBridge dependency. +const mockBridge: jest.Mocked = { // We only need to mock the methods that this specific adapter uses. saveCredentials: jest.fn(), getCredentials: jest.fn(), @@ -13,7 +13,7 @@ const mockBridge: jest.Mocked = { getSSOCredentials: jest.fn(), getApiCredentials: jest.fn(), clearApiCredentials: jest.fn(), - // Add stubs for other INativeBridge methods to satisfy the type. + // Add stubs for other NativeBridge methods to satisfy the type. initialize: jest.fn(), hasValidInstance: jest.fn(), getBundleIdentifier: jest.fn(), diff --git a/src/platforms/native/adapters/__tests__/NativeMfaClient.spec.ts b/src/platforms/native/adapters/__tests__/NativeMfaClient.spec.ts index 1dcf62b46..dede27cb7 100644 --- a/src/platforms/native/adapters/__tests__/NativeMfaClient.spec.ts +++ b/src/platforms/native/adapters/__tests__/NativeMfaClient.spec.ts @@ -1,8 +1,8 @@ import { NativeMfaClient } from '../NativeMfaClient'; -import type { INativeBridge } from '../../bridge'; +import type { NativeBridge } from '../../bridge'; import { AuthError, MfaError, MfaErrorCodes } from '../../../../core/models'; -const mockBridge: jest.Mocked = { +const mockBridge: jest.Mocked = { getMfaAuthenticators: jest.fn(), mfaEnroll: jest.fn(), mfaChallenge: jest.fn(), diff --git a/src/platforms/native/adapters/__tests__/NativePasswordlessClient.spec.ts b/src/platforms/native/adapters/__tests__/NativePasswordlessClient.spec.ts index 746232a94..e01e20508 100644 --- a/src/platforms/native/adapters/__tests__/NativePasswordlessClient.spec.ts +++ b/src/platforms/native/adapters/__tests__/NativePasswordlessClient.spec.ts @@ -1,11 +1,11 @@ import { NativePasswordlessClient } from '../NativePasswordlessClient'; -import type { INativeBridge } from '../../bridge'; +import type { NativeBridge } from '../../bridge'; const mockBridge = { passwordlessChallengeWithEmail: jest.fn(), passwordlessChallengeWithPhoneNumber: jest.fn(), passwordlessLoginWithOTP: jest.fn(), -} as unknown as jest.Mocked; +} as unknown as jest.Mocked; describe('NativePasswordlessClient', () => { let client: NativePasswordlessClient; diff --git a/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.ts b/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.ts index 09462ba68..b40d256fd 100644 --- a/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.ts +++ b/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.errors.spec.ts @@ -1,9 +1,9 @@ import { NativeWebAuthProvider } from '../NativeWebAuthProvider'; -import { INativeBridge } from '../../bridge'; +import { NativeBridge } from '../../bridge'; import { WebAuthError } from '../../../../core/models'; // Mock the native bridge -const mockBridge: jest.Mocked = { +const mockBridge: jest.Mocked = { authorize: jest.fn(), clearSession: jest.fn(), getBundleIdentifier: jest.fn().mockResolvedValue('com.app.test'), diff --git a/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.spec.ts b/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.spec.ts index 90103e729..d59782928 100644 --- a/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.spec.ts +++ b/src/platforms/native/adapters/__tests__/NativeWebAuthProvider.spec.ts @@ -1,6 +1,6 @@ import { Linking, Platform } from 'react-native'; import { NativeWebAuthProvider } from '../NativeWebAuthProvider'; -import { INativeBridge } from '../../bridge'; +import { NativeBridge } from '../../bridge'; import { finalizeScope } from '../../../../core/utils'; import { AuthError, WebAuthError } from '../../../../core/models'; @@ -14,7 +14,7 @@ jest.mock('react-native', () => ({ jest.mock('../../../../core/utils/scope'); -const mockBridge: jest.Mocked = { +const mockBridge: jest.Mocked = { authorize: jest.fn(), clearSession: jest.fn(), cancelWebAuth: jest.fn(), diff --git a/src/platforms/native/bridge/INativeBridge.ts b/src/platforms/native/bridge/NativeBridge.ts similarity index 99% rename from src/platforms/native/bridge/INativeBridge.ts rename to src/platforms/native/bridge/NativeBridge.ts index bb4e7f35a..848ca990f 100644 --- a/src/platforms/native/bridge/INativeBridge.ts +++ b/src/platforms/native/bridge/NativeBridge.ts @@ -21,7 +21,7 @@ import type { * This interface is the single source of truth for communication between the * JavaScript and the native layers (iOS/Android). */ -export interface INativeBridge { +export interface NativeBridge { /** * Checks if the native SDK has been initialized with the required credentials. * This should be called before any other method. diff --git a/src/platforms/native/bridge/NativeBridgeManager.ts b/src/platforms/native/bridge/NativeBridgeManager.ts index b99c78863..036a802f9 100644 --- a/src/platforms/native/bridge/NativeBridgeManager.ts +++ b/src/platforms/native/bridge/NativeBridgeManager.ts @@ -1,4 +1,4 @@ -import type { INativeBridge } from './INativeBridge'; +import type { NativeBridge } from './NativeBridge'; import type { ApiCredentials, Credentials, @@ -26,12 +26,12 @@ import type { NativeModuleError } from '../../../core/interfaces'; /** * Manages the direct communication with the native Auth0 module. - * It implements the INativeBridge interface and is responsible for: + * It implements the NativeBridge interface and is responsible for: * - Calling the actual native methods. *- Normalizing data and parameters between JS and Native. * - Catching native errors and re-throwing them as structured AuthError objects. */ -export class NativeBridgeManager implements INativeBridge { +export class NativeBridgeManager implements NativeBridge { private async a0_call( nativeMethod: (...args: any[]) => Promise, ...args: any[] diff --git a/src/platforms/native/bridge/index.ts b/src/platforms/native/bridge/index.ts index ccca7230f..eb30570fe 100644 --- a/src/platforms/native/bridge/index.ts +++ b/src/platforms/native/bridge/index.ts @@ -1,2 +1,2 @@ -export * from './INativeBridge'; +export * from './NativeBridge'; export * from './NativeBridgeManager'; diff --git a/src/platforms/web/adapters/WebAuth0Client.ts b/src/platforms/web/adapters/WebAuth0Client.ts index 0cedbcfd0..a46a24a9e 100644 --- a/src/platforms/web/adapters/WebAuth0Client.ts +++ b/src/platforms/web/adapters/WebAuth0Client.ts @@ -1,14 +1,14 @@ import { - Auth0Client, + Auth0Client as SpaAuth0Client, type Auth0ClientOptions, type LogoutOptions, } from '@auth0/auth0-spa-js'; import type { - IAuth0Client, - IAuthenticationProvider, - IMyAccountClient, - IPasswordlessClient, - IMfaClient, + Auth0Client, + AuthenticationProvider, + MyAccountClient, + PasswordlessClient, + MfaClient, } from '../../../core/interfaces'; import type { WebAuth0Options } from '../../../types/platform-specific'; import type { @@ -35,32 +35,32 @@ import { validateTokenTypeUri, } from '../../../core/utils'; -export class WebAuth0Client implements IAuth0Client { +export class WebAuth0Client implements Auth0Client { readonly webAuth: WebWebAuthProvider; readonly credentialsManager: WebCredentialsManager; - readonly auth: IAuthenticationProvider; - readonly mfa: IMfaClient; - readonly myAccount: IMyAccountClient; + readonly auth: AuthenticationProvider; + readonly mfa: MfaClient; + readonly myAccount: MyAccountClient; private readonly httpClient: HttpClient; private readonly tokenType: TokenType; - public readonly client: Auth0Client; - private static spaClient: Auth0Client | null = null; + public readonly client: SpaAuth0Client; + private static spaClient: SpaAuth0Client | null = null; private logoutInProgress = false; /** - * Factory method to get a singleton instance of Auth0Client. + * Factory method to get a singleton instance of SpaAuth0Client. * This ensures that the client is only created once and reused. * * @param options - The Auth0ClientOptions to configure the client. - * @returns An instance of Auth0Client. + * @returns An instance of SpaAuth0Client. */ - private static getSpaClient(options: Auth0ClientOptions): Auth0Client { + private static getSpaClient(options: Auth0ClientOptions): SpaAuth0Client { if (WebAuth0Client.spaClient) { return WebAuth0Client.spaClient; } - WebAuth0Client.spaClient = new Auth0Client(options); + WebAuth0Client.spaClient = new SpaAuth0Client(options); return WebAuth0Client.spaClient; } @@ -131,7 +131,7 @@ export class WebAuth0Client implements IAuth0Client { ); } - readonly passwordless: IPasswordlessClient = new WebPasswordlessClient(); + readonly passwordless: PasswordlessClient = new WebPasswordlessClient(); public async logout(options?: LogoutOptions): Promise { // If a logout process has already started, do nothing. diff --git a/src/platforms/web/adapters/WebAuthenticationProvider.ts b/src/platforms/web/adapters/WebAuthenticationProvider.ts index 96f35726e..5aa604aa6 100644 --- a/src/platforms/web/adapters/WebAuthenticationProvider.ts +++ b/src/platforms/web/adapters/WebAuthenticationProvider.ts @@ -1,4 +1,4 @@ -import type { IAuthenticationProvider } from '../../../core/interfaces'; +import type { AuthenticationProvider } from '../../../core/interfaces'; import { AuthError } from '../../../core/models'; const webAuthNotSupported = @@ -11,11 +11,11 @@ export const ssoExchangeNotSupported = 'Native to Web SSO Exchange is only supported on native platforms (iOS/Android). This feature is not available in web environments.'; /** - * An IAuthenticationProvider implementation for the web that explicitly + * An AuthenticationProvider implementation for the web that explicitly * disallows direct-grant authentication methods for security reasons. */ -export const UnimplementedWebAuthenticationProvider: IAuthenticationProvider = { +export const UnimplementedWebAuthenticationProvider: AuthenticationProvider = { // Original stubs passwordRealm: () => Promise.reject(new AuthError('NotImplemented', webAuthNotSupported)), diff --git a/src/platforms/web/adapters/WebCredentialsManager.ts b/src/platforms/web/adapters/WebCredentialsManager.ts index 197773c1d..2d8719a2d 100644 --- a/src/platforms/web/adapters/WebCredentialsManager.ts +++ b/src/platforms/web/adapters/WebCredentialsManager.ts @@ -1,4 +1,4 @@ -import type { ICredentialsManager } from '../../../core/interfaces'; +import type { CredentialsManager } from '../../../core/interfaces'; import type { Credentials, SessionTransferCredentials } from '../../../types'; import { AuthError, @@ -8,7 +8,7 @@ import { } from '../../../core/models'; import type { Auth0Client } from '@auth0/auth0-spa-js'; -export class WebCredentialsManager implements ICredentialsManager { +export class WebCredentialsManager implements CredentialsManager { constructor(private client: Auth0Client) {} // @auth0/auth0-spa-js (>= ^2.22.0) enforces the IPSIE `session_expiry` ceiling diff --git a/src/platforms/web/adapters/WebMfaClient.ts b/src/platforms/web/adapters/WebMfaClient.ts index 8116a72fb..06e990bd2 100644 --- a/src/platforms/web/adapters/WebMfaClient.ts +++ b/src/platforms/web/adapters/WebMfaClient.ts @@ -1,5 +1,5 @@ import type { MfaApiClient } from '@auth0/auth0-spa-js'; -import type { IMfaClient } from '../../../core/interfaces'; +import type { MfaClient } from '../../../core/interfaces'; import type { Credentials, MfaAuthenticator, @@ -15,7 +15,7 @@ import type { } from '../../../types'; import { AuthError, MfaError } from '../../../core/models'; -export class WebMfaClient implements IMfaClient { +export class WebMfaClient implements MfaClient { private readonly spaMfa: MfaApiClient; private readonly tokenType: string; diff --git a/src/platforms/web/adapters/WebMyAccountClient.ts b/src/platforms/web/adapters/WebMyAccountClient.ts index 55787e2cc..4c6b414ba 100644 --- a/src/platforms/web/adapters/WebMyAccountClient.ts +++ b/src/platforms/web/adapters/WebMyAccountClient.ts @@ -12,7 +12,7 @@ import { type PushNotificationEnrollmentChallengeResponse as SpaPushEnrollmentChallengeResponse, type RecoveryCodeEnrollmentChallengeResponse as SpaRecoveryCodeEnrollmentChallengeResponse, } from '@auth0/auth0-spa-js'; -import type { IMyAccountClient } from '../../../core/interfaces'; +import type { MyAccountClient } from '../../../core/interfaces'; import type { PasskeyEnrollmentChallengeParameters, PasskeyEnrollmentChallengeResponse, @@ -54,7 +54,7 @@ import { * signed with its own keypair — so DPoP My Account calls only succeed when the * passed token was issued by this same spa-js client. Bearer tokens always work. */ -export class WebMyAccountClient implements IMyAccountClient { +export class WebMyAccountClient implements MyAccountClient { private readonly spaClient: Auth0Client; private readonly apiBase: string; private readonly useDPoP: boolean; diff --git a/src/platforms/web/adapters/WebPasswordlessClient.ts b/src/platforms/web/adapters/WebPasswordlessClient.ts index cee545878..005159010 100644 --- a/src/platforms/web/adapters/WebPasswordlessClient.ts +++ b/src/platforms/web/adapters/WebPasswordlessClient.ts @@ -1,4 +1,4 @@ -import type { IPasswordlessClient } from '../../../core/interfaces'; +import type { PasswordlessClient } from '../../../core/interfaces'; import type { Credentials, PasswordlessChallenge, @@ -10,7 +10,7 @@ import { AuthError } from '../../../core/models'; const NOT_SUPPORTED = 'Passwordless OTP is not supported on the web platform'; -export class WebPasswordlessClient implements IPasswordlessClient { +export class WebPasswordlessClient implements PasswordlessClient { async challengeWithEmail( _parameters: PasswordlessChallengeEmailParameters ): Promise { diff --git a/src/platforms/web/adapters/WebWebAuthProvider.ts b/src/platforms/web/adapters/WebWebAuthProvider.ts index fd9bf00b8..87b47d75d 100644 --- a/src/platforms/web/adapters/WebWebAuthProvider.ts +++ b/src/platforms/web/adapters/WebWebAuthProvider.ts @@ -1,4 +1,4 @@ -import type { IWebAuthProvider } from '../../../core/interfaces'; +import type { WebAuthProvider } from '../../../core/interfaces'; import type { Credentials, WebAuthorizeParameters, @@ -13,7 +13,7 @@ import type { User as SpaJSUser, } from '@auth0/auth0-spa-js'; -export class WebWebAuthProvider implements IWebAuthProvider { +export class WebWebAuthProvider implements WebAuthProvider { constructor(private client: Auth0Client) {} // private method to convert a SpaJSUser to a User diff --git a/src/platforms/web/adapters/__tests__/WebAuthenticationProvider.spec.ts b/src/platforms/web/adapters/__tests__/WebAuthenticationProvider.spec.ts index ac1fcce91..f6d78cdac 100644 --- a/src/platforms/web/adapters/__tests__/WebAuthenticationProvider.spec.ts +++ b/src/platforms/web/adapters/__tests__/WebAuthenticationProvider.spec.ts @@ -256,7 +256,7 @@ describe('UnimplementedWebAuthenticationProvider', () => { }); describe('comprehensive method coverage', () => { - it('should ensure all IAuthenticationProvider methods are implemented', () => { + it('should ensure all AuthenticationProvider methods are implemented', () => { const provider = UnimplementedWebAuthenticationProvider; // Verify all expected methods exist From ee20e8eb41166825df556683648da655ba7daedf Mon Sep 17 00:00:00 2001 From: Subhankar Maiti Date: Wed, 12 Aug 2026 20:12:35 +0530 Subject: [PATCH 2/2] style: fix prettier formatting in the TurboModule spec --- src/specs/NativeA0Auth0.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/specs/NativeA0Auth0.ts b/src/specs/NativeA0Auth0.ts index 299b6f8aa..db9ba29c1 100644 --- a/src/specs/NativeA0Auth0.ts +++ b/src/specs/NativeA0Auth0.ts @@ -23,8 +23,7 @@ export interface Spec extends TurboModule { clientId: string, domain: string, localAuthenticationOptions: - | { [key: string]: string | Int32 | boolean } - | undefined, + { [key: string]: string | Int32 | boolean } | undefined, useDPoP: boolean | undefined, maxRetries: Int32, credentialsManagerStorageKey: string | undefined