@aikidosec/firewall
Version:
Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks
21 lines (20 loc) • 703 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReportingAPIThatValidatesToken = void 0;
class ReportingAPIThatValidatesToken {
constructor(api) {
this.api = api;
this.tokenIsInvalid = false;
}
async report(token, event, timeoutInMS) {
if (this.tokenIsInvalid) {
return { success: false, error: "invalid_token" };
}
const result = await this.api.report(token, event, timeoutInMS);
if (!result.success && result.error === "invalid_token") {
this.tokenIsInvalid = true;
}
return result;
}
}
exports.ReportingAPIThatValidatesToken = ReportingAPIThatValidatesToken;