keygentoolshed
Version:
Key generation utilities for cryptographic operations. QUANTUM ENCRYPTION FOLDER UPDATE!!! See its folder for all <3
46 lines (39 loc) • 1.24 kB
JavaScript
import fs from 'fs';
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
const argv = yargs(hideBin(process.argv))
.usage('Usage: $0 --key [key]')
.option('key', {
alias: 'k',
describe: 'Specify the key to check expiration for',
type: 'string',
demandOption: true
})
.help()
.argv;
function checkKeyExpiration(key) {
fs.readFile('keyExpirations', 'utf8', (err, data) => {
if (err) {
console.error(`Error reading file: ${err.message}`);
return;
}
const lines = data.split('\n');
let expirationDate = null;
for (let i = 0; i < lines.length; i++) {
if (lines[i].includes(`Key: ${key}`)) {
expirationDate = lines[i + 1].replace('Expiration date: ', '').trim();
break;
}
}
if (expirationDate) {
console.log(`The expiration date for key "${key}" is: ${expirationDate}`);
} else {
console.log(`Key "${key}" not found in the expiration list.`);
}
});
}
function main() {
const { key } = argv;
checkKeyExpiration(key);
}
main();