UNPKG

927 BTypeScriptView Raw
1import { RsaPublicKey, RsaPrivateKey, KeyLike } from 'crypto';
2import { Connection } from './Connection.js';
3
4export type AuthPlugin = (pluginMetadata: {
5 connection: Connection;
6 command: string;
7}) => (
8 pluginData: Buffer,
9) => Promise<string> | string | Buffer | Promise<Buffer> | null;
10
11type AuthPluginDefinition<T> = (pluginOptions?: T) => AuthPlugin;
12
13export const authPlugins: {
14 caching_sha2_password: AuthPluginDefinition<{
15 overrideIsSecure?: boolean;
16 serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
17 onServerPublicKey?: (data: Buffer) => void;
18 }>;
19 mysql_clear_password: AuthPluginDefinition<{
20 password?: string;
21 }>;
22 mysql_native_password: AuthPluginDefinition<{
23 password?: string;
24 passwordSha1?: string;
25 }>;
26 sha256_password: AuthPluginDefinition<{
27 serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike;
28 onServerPublicKey?: (data: Buffer) => void;
29 }>;
30};