captcha-canvas
Version:
A captcha generator by using skia-canvas module.
39 lines (38 loc) • 1.08 kB
JavaScript
;
/**
* Configuration management for CAPTCHA generation
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_CONFIG = void 0;
exports.setConfig = setConfig;
exports.getConfig = getConfig;
exports.DEFAULT_CONFIG = {
security: {
maxDimensions: { width: 2000, height: 2000 },
minDimensions: { width: 50, height: 50 },
maxTextLength: 50,
enableTimingProtection: true,
},
performance: {
enableGPU: true,
maxConcurrentGenerations: 10,
},
defaults: {
charset: 'ALPHANUMERIC',
enableDecoys: true,
enableTraces: true,
},
};
let currentConfig = { ...exports.DEFAULT_CONFIG };
function setConfig(config) {
currentConfig = {
...currentConfig,
...config,
security: { ...currentConfig.security, ...config.security },
performance: { ...currentConfig.performance, ...config.performance },
defaults: { ...currentConfig.defaults, ...config.defaults },
};
}
function getConfig() {
return { ...currentConfig };
}