padding-oracle-attacker
Version:
CLI tool and library to execute padding oracle attacks easily
27 lines • 1.09 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const zlib_1 = __importDefault(require("zlib"));
const keyv_1 = __importDefault(require("keyv"));
const keyv_file_1 = __importDefault(require("keyv-file"));
const constants_1 = require("./constants");
// TODO: develop, publish keyv-json-file and use it instead of keyv-file
// $ cat poattack-cache.json.gz.txt|base64 -D|gunzip|jq
const cacheStore = new keyv_1.default({
store: new keyv_file_1.default({
filename: constants_1.CACHE_FILE_PATH,
encode: (obj) => {
const json = JSON.stringify(obj);
return zlib_1.default.gzipSync(json).toString('base64');
},
decode: (txt) => {
const bin = zlib_1.default.gunzipSync(Buffer.from(txt, 'base64'));
const json = bin.toString();
return JSON.parse(json);
}
})
});
exports.default = cacheStore;
//# sourceMappingURL=cache.js.map
;