"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const rs = require("jsrsasign");
const rsu = require('jsrsasign-util');
// TODO implementar https://www.npmjs.com/package/node-forge#rsa
class Key extends core_1.Command {
    async run() {
        const { prvKeyObj, pubKeyObj } = rs.KEYUTIL.generateKeypair('RSA', 2048);
        const prvPEM = rs.KEYUTIL.getPEM(prvKeyObj, 'PKCS1PRV');
        const pubPEM = rs.KEYUTIL.getPEM(pubKeyObj);
        rsu.saveFile('oauth-private.key', prvPEM);
        rsu.saveFile('oauth-public.key', pubPEM);
        this.log('Private key saved in oauth-private.key and public key saved in oauth-public.key');
    }
}
exports.default = Key;
Key.description = 'Generate private key and public key';
Key.flags = {
    help: core_1.Flags.help({ char: 'h' }),
};
Key.examples = [
    '$ aurora keys',
    '$ aurora --help',
];
