// src/strategies/passport/passport-otp/otp-auth.ts
import * as passport from "passport";
var Otp;
((Otp2) => {
  class Strategy2 extends passport.Strategy {
    constructor(_options, verify) {
      super();
      this.name = "otp";
      if (verify) {
        this.verify = verify;
      }
    }
    authenticate(req, options) {
      const key = req.body.key || (options == null ? void 0 : options.key);
      const otp = req.body.otp || (options == null ? void 0 : options.otp);
      if (!key) {
        this.fail();
        return;
      }
      const verified = (err, user, _info) => {
        if (err) {
          this.error(err);
          return;
        }
        if (!user) {
          this.fail();
          return;
        }
        this.success(user);
      };
      this.verify(key, otp, verified);
    }
  }
  Otp2.Strategy = Strategy2;
})(Otp || (Otp = {}));
export {
  Otp
};
//# sourceMappingURL=otp-auth.js.map