import type { CommunicationGetTokenOptions, TokenCredential } from "./communicationTokenCredential.js"; import type { AbortSignalLike } from "@azure/abort-controller"; import type { AccessToken } from "@azure/core-auth"; /** * Options for auto-refreshing a Communication Token credential. */ export interface CommunicationTokenRefreshOptions { /** * Callback that returns a token acquired from the Communication Identity API. * The returned token must be valid (expiration date must be in the future). * * Return a `string` to have the expiry read from the JWT, or an `AccessToken` * to supply the expiry explicitly (required for encrypted access tokens that * cannot be decoded). */ tokenRefresher: (abortSignal?: AbortSignalLike) => Promise; /** * Optional token to initialize. May be a `string` or an `AccessToken` carrying * an explicit expiry. */ token?: string | AccessToken; /** * Indicates whether the token should be proactively renewed prior to expiry or only renew on demand. * By default false. */ refreshProactively?: boolean; /** * Lifetime, in seconds, assumed for a returned token that cannot be decoded and * carries no explicit expiry (e.g. an encrypted access token). Defaults to 600 (10 minutes). * * Set this to your tokens' real lifetime. It is not capped: a value larger than the token's * actual lifetime means the credential refreshes later than it should and the service will * reject the expired token. To avoid guessing, prefer returning an `AccessToken` with an * explicit `expiresOnTimestamp` (e.g. derived from the token response's `expires_in`). */ undecodableTokenExpiryIntervalInSeconds?: number; } export declare class AutoRefreshTokenCredential implements TokenCredential { private readonly refresh; private readonly refreshProactively; private readonly expiringSoonIntervalInMs; private readonly refreshAfterLifetimePercentage; private readonly undecodableTokenExpiryIntervalInSeconds; private currentToken; private activeTimeout; private activeTokenFetching; private activeTokenUpdating; private disposed; constructor(refreshArgs: CommunicationTokenRefreshOptions); getToken(options?: CommunicationGetTokenOptions): Promise; dispose(): void; private updateTokenAndReschedule; private refreshTokenAndReschedule; private refreshToken; private scheduleRefresh; private isTokenValid; private isTokenExpiringSoon; } //# sourceMappingURL=autoRefreshTokenCredential.d.ts.map