import * as grpc from '@grpc/grpc-js'; import { LoadBalancerMode } from './LoadBalancerMode.js'; import { type ChronicleTlsMaterial } from './ChronicleTlsMaterial.js'; /** * Authentication mode for Chronicle connection. */ export declare enum AuthenticationMode { /** No authentication at all (`auth=none`, or a cleartext connection without credentials). */ None = "None", ClientCredentials = "ClientCredentials", ApiKey = "ApiKey" } /** * Represents a server address with host and port. */ export interface ChronicleServerAddress { host: string; port: number; } /** * Builder for constructing Chronicle connection strings. */ export declare class ChronicleConnectionStringBuilder { private static readonly _defaultPort; private static readonly _usernameKey; private static readonly _passwordKey; private static readonly _schemeKey; private static readonly _apiKeyKey; private static readonly _disableTlsKey; private static readonly _skipKeepAliveKey; private static readonly _authKey; private static readonly _skipCompatibilityCheckKey; private static readonly _caCertificatePathKey; private static readonly _noAuthenticationValue; /** Every option the builder knows, so a differently cased spelling folds to its canonical one. */ private static readonly _knownKeys; /** Options whose value may legitimately hold an at sign, such as a path or a name server. */ private static readonly _keysThatMayHoldAtSign; private static readonly _skipTlsValidationKey; private static readonly _certificatePathKey; private static readonly _certificatePasswordKey; private static readonly _loadBalancerKey; private static readonly _srvNameServerKey; private readonly _properties; private _hosts; constructor(connectionString?: string); get hosts(): ChronicleServerAddress[]; set hosts(value: ChronicleServerAddress[]); /** * Convenience accessor for the first host in {@link hosts}. Setting it collapses the * configuration to that single host, discarding any others previously set via * {@link hosts} - the same "single server" reset a plain host/port connection string * implies. */ get host(): string; set host(value: string); /** * Convenience accessor for the first host's port in {@link hosts}. Setting it collapses * the configuration to that single host, discarding any others previously set via * {@link hosts}. */ get port(): number; set port(value: number); get username(): string | undefined; set username(value: string | undefined); get password(): string | undefined; set password(value: string | undefined); get scheme(): string; set scheme(value: string); /** * Whether the connection string uses the DNS SRV lookup scheme (`chronicle+srv://`). * Compared case-insensitively, matching {@link scheme}'s own parsing. */ get isSrv(): boolean; get authenticationMode(): AuthenticationMode; /** * Whether `auth=none` is set: no authentication at all. It wins over any credentials or API key the * connection string also carries. */ get noAuthentication(): boolean; set noAuthentication(value: boolean); get apiKey(): string | undefined; set apiKey(value: string | undefined); get disableTls(): boolean; set disableTls(value: boolean); /** * Whether TLS certificate validation is skipped for the gRPC channel and OAuth token * requests. Distinct from {@link disableTls}, which controls whether TLS is used at * all. Defaults to `true` in this release when omitted. Set it to `false` explicitly * to require full certificate validation whenever TLS is on; an explicit `false` * always requires validation. A later major release will require validation by default. */ get skipTlsValidation(): boolean; set skipTlsValidation(value: boolean); /** Whether {@link skipTlsValidation} was set explicitly, rather than left at its default. */ get hasExplicitSkipTlsValidation(): boolean; /** Skip the client keep-alive connection for short-lived processes. Defaults to false. */ get skipKeepAlive(): boolean; set skipKeepAlive(value: boolean); get certificatePath(): string | undefined; set certificatePath(value: string | undefined); get certificatePassword(): string | undefined; set certificatePassword(value: string | undefined); /** * Whether to skip the server compatibility check on connect (`skipCompatibilityCheck=true`). An escape hatch * for a known-safe client and kernel skew; it hides every other incompatibility too. */ get skipCompatibilityCheck(): boolean; set skipCompatibilityCheck(value: boolean); /** * The path to a PEM file with the certificate authorities the server certificate must chain to, in place of * the system trust store (`caCertificatePath=`). Used only when `skipTlsValidation=false`; the file is * nevertheless read when the connection is created, so a missing or unreadable file, or one without * certificates, fails the connection setup. */ get caCertificatePath(): string | undefined; set caCertificatePath(value: string | undefined); /** * The strategy used to select one address from {@link hosts} (or the addresses * resolved from a `chronicle+srv://` host) on every connect/reconnect attempt. * Defaults to {@link LoadBalancerMode.LeastConnections}. */ get loadBalancer(): LoadBalancerMode; set loadBalancer(value: LoadBalancerMode); /** * The `host[:port]` DNS name server used to resolve `chronicle+srv://` SRV records. * Defaults to port 53 when no port is given. Undefined uses the system default * resolver. */ get srvNameServer(): string | undefined; set srvNameServer(value: string | undefined); build(): string; private booleanOption; private static hasMisplacedAtSign; private appendSkipKeepAlive; private propertiesWithoutSkipKeepAlive; private parseConnectionString; private parseUrl; } /** * Represents a Chronicle connection string. */ export declare class ChronicleConnectionString { static readonly DEVELOPMENT_CLIENT = "chronicle-dev-client"; static readonly DEVELOPMENT_CLIENT_SECRET = "chronicle-dev-secret"; static readonly Default: ChronicleConnectionString; static readonly Development: ChronicleConnectionString; private readonly _builder; private readonly _serverAddresses; constructor(connectionString: string); /** * The connection string's scheme, either `chronicle` or `chronicle+srv`. */ get scheme(): string; /** * Whether the connection string uses the DNS SRV lookup scheme (`chronicle+srv://`). */ get isSrv(): boolean; /** * Convenience accessor for the first entry in {@link serverAddresses}, for callers * that only ever expect a single server address. */ get serverAddress(): ChronicleServerAddress; /** * All server addresses parsed from a multi-host `chronicle://` connection string. * For `chronicle+srv://` connection strings, this holds the single SRV lookup host, * not the resolved addresses - resolve those via {@link ChronicleServerAddressResolver}. */ get serverAddresses(): ChronicleServerAddress[]; get username(): string | undefined; get password(): string | undefined; get authenticationMode(): AuthenticationMode; get apiKey(): string | undefined; get disableTls(): boolean; /** Whether the client skips the keep-alive connection for short-lived processes. */ get skipKeepAlive(): boolean; /** Whether `auth=none` is set: no authentication at all. */ get noAuthentication(): boolean; /** Whether to skip the server compatibility check on connect. */ get skipCompatibilityCheck(): boolean; /** The path to a PEM file with the certificate authorities the server certificate must chain to. */ get caCertificatePath(): string | undefined; /** * Whether TLS certificate validation is skipped. See * {@link ChronicleConnectionStringBuilder.skipTlsValidation}. */ get skipTlsValidation(): boolean; /** Whether `skipTlsValidation` was set explicitly in the connection string. */ get hasExplicitSkipTlsValidation(): boolean; get certificatePath(): string | undefined; get certificatePassword(): string | undefined; /** * The strategy used to select one server address on every connect/reconnect attempt. */ get loadBalancer(): LoadBalancerMode; /** * The `host[:port]` DNS name server used to resolve `chronicle+srv://` SRV records. */ get srvNameServer(): string | undefined; withCredentials(username: string, password: string): ChronicleConnectionString; withApiKey(apiKey: string): ChronicleConnectionString; /** * Loads the TLS material the connection string names: the client certificate from `certificatePath` and the * certificate authorities from `caCertificatePath`. * @throws When a file is missing, unreadable or holds no usable material. */ loadTlsMaterial(): ChronicleTlsMaterial; /** * Creates the gRPC channel credentials for this connection string. * @param tlsMaterial - The TLS material to use. Defaults to loading what the connection string names. */ createCredentials(tlsMaterial?: ChronicleTlsMaterial): grpc.ChannelCredentials; toString(): string; } //# sourceMappingURL=ChronicleConnectionString.d.ts.map