import { MailAdapter } from "@platform-modules/mail";
//#region src/otp-email.d.ts
type OtpRecord = {
  codeHash: string;
  expiresAt: number;
  attempts: number;
};
type OtpStore = {
  get(key: string): Promise<OtpRecord | null>;
  set(key: string, record: OtpRecord): Promise<void>;
  delete(key: string): Promise<void>;
};
type OtpEmailConfig = {
  mail: MailAdapter;
  store: OtpStore;
  from: string;
  ttlMs?: number;
  maxAttempts?: number;
  rateLimit?: (email: string) => Promise<boolean>;
};
declare class OtpError extends Error {}
declare class OtpExpiredError extends OtpError {
  readonly name = "OtpExpiredError";
}
declare class OtpAttemptsExceededError extends OtpError {
  readonly name = "OtpAttemptsExceededError";
}
declare function createOtpEmail(config: OtpEmailConfig): {
  issueAndSend(email: string, message: {
    subject: string;
    text: string;
  }): Promise<{
    expiresAt: number;
  }>;
  verify(email: string, code: string): Promise<boolean>;
};
//#endregion
export { OtpAttemptsExceededError, OtpEmailConfig, OtpError, OtpExpiredError, OtpRecord, OtpStore, createOtpEmail };