1
0
Fork 0

Merge branch 'master' of gitlab.libraryofcode.org:engineering/cloudservices

refactor/models
Matthew 2020-01-31 00:45:32 -05:00
commit f25b118eff
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 2 additions and 1 deletions

View File

@ -20,13 +20,14 @@ export default class SecureSign_Init extends Command {
if (!account.hash) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Account not initialized***`); if (!account.hash) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Account not initialized***`);
// @ts-ignore // @ts-ignore
const options: { s?: string, c?: string, m?: string } = args.length ? Object.fromEntries(` ${args.join(' ')}`.split(' -').filter((a) => a).map((a) => a.split(' '))) : {}; // eslint-disable-line const options: { s?: string, c?: string, m?: string } = args.length ? Object.fromEntries(` ${args.join(' ')}`.split(' -').filter((a) => a).map((a) => a.split(/ (.+)/)).filter((a) => a.length > 1)) : {};
if (options.s && options.s.toLowerCase() !== 'ecc' && options.s.toLowerCase() !== 'rsa') return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid signing type, choose between \`ecc\` or \`rsa\``); if (options.s && options.s.toLowerCase() !== 'ecc' && options.s.toLowerCase() !== 'rsa') return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid signing type, choose between \`ecc\` or \`rsa\``);
if (options.c && (!Number(options.c) || Number(options.c) < 1 || Number(options.c) > 3)) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid class selected, choose between Class \`1\`, \`2\` or \`3\``); if (options.c && (!Number(options.c) || Number(options.c) < 1 || Number(options.c) > 3)) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid class selected, choose between Class \`1\`, \`2\` or \`3\``);
if (options.m && (!Number(options.m) || (options.m !== '256' && options.m !== '384' && options.m !== '512'))) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid SHA Digest selected, choose between \`256\`, \`384\` or \`512\``); if (options.m && (!Number(options.m) || (options.m !== '256' && options.m !== '384' && options.m !== '512'))) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid SHA Digest selected, choose between \`256\`, \`384\` or \`512\``);
if (Number(options.c) === 3 && (!options.s || options.s.toLowerCase() === 'ecc')) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Class 3 ECC certificates are not supported, please use the \`-s rsa\` option instead***`); if (Number(options.c) === 3 && (!options.s || options.s.toLowerCase() === 'ecc')) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Class 3 ECC certificates are not supported, please use the \`-s rsa\` option instead***`);
const msg = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Creating certificate...***`); const msg = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Creating certificate...***`);
if (options.s) options.s = options.s.toLowerCase();
const hash = this.client.util.getAcctHash(account.homepath); const hash = this.client.util.getAcctHash(account.homepath);
// Check if they can generate certificate // Check if they can generate certificate