1 | import { RsaPublicKey, RsaPrivateKey, KeyLike } from 'crypto';
|
2 | import { Connection } from './Connection.js';
|
3 |
|
4 | export type AuthPlugin = (pluginMetadata: {
|
5 | connection: Connection;
|
6 | command: string;
|
7 | }) => (
|
8 | pluginData: Buffer,
|
9 | ) => Promise<string> | string | Buffer | Promise<Buffer> | null;
|
10 |
|
11 | type AuthPluginDefinition<T> = (pluginOptions?: T) => AuthPlugin;
|
12 |
|
13 | export 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 | };
|