secure-2fa
Version:
A secure, developer-friendly Node.js package for email-based OTP (2FA) with strong security controls
31 lines • 945 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomAdapter = void 0;
class CustomAdapter {
constructor(config) {
this.sendFunction = config.sendFunction;
this.verifyFunction = config.verifyFunction;
}
async sendEmail(params) {
try {
await this.sendFunction(params);
}
catch (error) {
throw new Error(`Failed to send email via custom provider: ${error instanceof Error ? error.message : 'Unknown error'}`);
}
}
async verifyConnection() {
if (!this.verifyFunction) {
// If no verify function is provided, assume connection is always valid
return true;
}
try {
return await this.verifyFunction();
}
catch (error) {
return false;
}
}
}
exports.CustomAdapter = CustomAdapter;
//# sourceMappingURL=custom-adapter.js.map
;