UNPKG

@ydbjs/auth

Version:

Authentication providers for YDB: static credentials, tokens, anonymous, and cloud metadata. Integrates with the core driver for secure access.

32 lines 1.17 kB
import * as tls from 'node:tls'; import { type ChannelOptions } from '@grpc/grpc-js'; import { CredentialsProvider } from './index.js'; export type StaticCredentialsToken = { value: string; aud: string[]; exp: number; iat: number; sub: string; }; export type StaticCredentials = { username: string; password: string; }; /** * A credentials provider that uses static username and password to authenticate. * It fetches and caches a token from the specified authentication service. * * @extends CredentialsProvider */ export declare class StaticCredentialsProvider extends CredentialsProvider { #private; constructor({ username, password }: StaticCredentials, endpoint: string, secureOptions?: tls.SecureContextOptions | undefined, channelOptions?: ChannelOptions); /** * Returns the token from the credentials. * @param force - if true, forces a new token to be fetched * @param signal - an optional AbortSignal to cancel the request. Defaults to a timeout of 5 seconds. * @returns the token */ getToken(force?: boolean, signal?: AbortSignal): Promise<string>; } //# sourceMappingURL=static.d.ts.map