import type { Metadata } from '@grpc/grpc-js'; import { Bearer, Receiver } from '../token.js'; import { custom, customJson } from '../util/logging.js'; import type { Authenticator, AuthorizationOptions, Provider } from './provider.js'; /** * Fetches a token and adds it as an HTTP `Authorization: Bearer …` value. * * The authenticator mutates the supplied gRPC metadata. A fetch error rejects * authentication before the RPC starts. */ export declare class TokenAuthenticator implements Authenticator { [custom]: () => string; private readonly receiver; /** Contains the fully qualified runtime type name. */ readonly $type = "nebius.sdk.TokenAuthenticator"; /** Returns a JSON-safe value for logs. */ [customJson](): unknown; /** Creates an authenticator that fetches tokens from `receiver`. */ constructor(receiver: Receiver); /** Adds authorization data to the request metadata. */ authenticate(metadata: Metadata, timeoutMs?: number, options?: AuthorizationOptions | undefined): Promise; /** Returns whether the retry is allowed. */ canRetry(err: unknown, options?: AuthorizationOptions | undefined): boolean; } /** * Adapts a {@link Bearer} to the SDK authorization-provider interface. * * @example Use a custom bearer with the SDK * ```ts * import { SDK } from '@nebius/js-sdk'; * import { TokenProvider } from '@nebius/js-sdk/runtime/authorization/token'; * import { EnvBearer } from '@nebius/js-sdk/runtime/token/static'; * * const sdk = new SDK({ * credentials: new TokenProvider(new EnvBearer()), * userAgentPrefix: 'example-application/1.0', * }); * ``` */ export declare class TokenProvider implements Provider { [custom]: () => string; private readonly tokenProvider; /** Contains the fully qualified runtime type name. */ readonly $type = "nebius.sdk.TokenProvider"; /** Returns a JSON-safe value for logs. */ [customJson](): unknown; /** Creates a provider for the supplied credential source. */ constructor(tokenProvider: Bearer); /** Returns the configured authenticator. */ authenticator(): Authenticator; /** Closes the bearer and its wrapped resources, including renewal timers. */ close(graceMs?: number | undefined): Promise; } //# sourceMappingURL=token.d.ts.map