import { type CallbackWithPromise } from '../../apis/callbacks.ts'; import { type SASLAuthenticationAPI, type SaslAuthenticateResponse } from '../../apis/security/sasl-authenticate-v2.ts'; import { type Connection, type CredentialProvider } from '../../network/connection.ts'; export interface ScramAlgorithmDefinition { keyLength: number; algorithm: string; minIterations: number; } export interface ScramCryptoModule { h: (definition: ScramAlgorithmDefinition, data: string | Buffer) => Buffer; hi: (definition: ScramAlgorithmDefinition, password: string, salt: Buffer, iterations: number) => Promise; hmac: (definition: ScramAlgorithmDefinition, key: Buffer, data: string | Buffer) => Buffer; xor: (a: Buffer, b: Buffer) => Buffer; } export declare const ScramAlgorithms: { readonly 'SHA-256': { readonly id: "SHA-256"; readonly keyLength: 32; readonly algorithm: "sha256"; readonly minIterations: 4096; }; readonly 'SHA-512': { readonly id: "SHA-512"; readonly keyLength: 64; readonly algorithm: "sha512"; readonly minIterations: 4096; }; }; export type ScramAlgorithm = keyof typeof ScramAlgorithms; export declare function createNonce(): string; export declare function sanitizeString(str: string): string; export declare function parseParameters(data: Buffer): Record; export declare function h(definition: ScramAlgorithmDefinition, data: string | Buffer): Buffer; export declare function hi(definition: ScramAlgorithmDefinition, password: string, salt: Buffer, iterations: number): Promise; export declare function hmac(definition: ScramAlgorithmDefinition, key: Buffer, data: string | Buffer): Buffer; export declare function xor(a: Buffer, b: Buffer): Buffer; export declare const defaultCrypto: ScramCryptoModule; export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, algorithm: ScramAlgorithm, usernameProvider: string | CredentialProvider, passwordProvider: string | CredentialProvider, crypto: ScramCryptoModule, callback: CallbackWithPromise): void; export declare function authenticate(authenticateAPI: SASLAuthenticationAPI, connection: Connection, algorithm: ScramAlgorithm, usernameProvider: string | CredentialProvider, passwordProvider: string | CredentialProvider, crypto?: ScramCryptoModule): Promise;