Auth.d.ts 927 B

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