@izzius94/crypter
Version:
The crypter library makes easy to share encrypted data with a Laravel project.
18 lines (17 loc) • 600 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
const setAlgo = (algorithm) => {
if (algorithm === undefined) {
return 'aes-256-cbc';
}
if (algorithm === 'aes-256-cbc' || algorithm === 'aes-128-cbc' || algorithm === 'aes-256-gcm' || algorithm === 'aes-128-gcm') {
return algorithm;
}
console.error(`Invalid algorithm: ${algorithm}`);
process.exit(1);
};
const key = (0, index_1.generateKey)(setAlgo(process.argv[2]));
console.info('Encryption key: ' + key);
process.exit(0);