import { TotpChecker } from "./totpChecker.js"; export class SqliteAuthenticationHandler { passwordEncoder; getAccountInformation; constructor(getAccountInformationFunction, passwordEncoder) { this.passwordEncoder = passwordEncoder; this.getAccountInformation = getAccountInformationFunction; } async needTotp(username, _password) { const accountInformation = await this.getAccountInformation(username); if (!accountInformation) return null; return !!accountInformation.totpSecret; } async tryLogin(username, password, totp) { const accountInformation = await this.getAccountInformation(username); if (!accountInformation) return null; password = this.passwordEncoder(password); if (accountInformation.passwordEncoded !== password) return false; return TotpChecker.ValidateTotp(accountInformation.totpSecret, totp); } } //# sourceMappingURL=sqliteAuthenticationHandler.js.map