From 9f3da824548d94b8400f912b57c4a5ecd96a7040 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 3 Jul 2021 23:05:09 -0400 Subject: [PATCH] finishing touches for x509/pgp store --- src/api/comm.libraryofcode.org/routes/keys.ts | 2 +- src/commands/whois.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/api/comm.libraryofcode.org/routes/keys.ts b/src/api/comm.libraryofcode.org/routes/keys.ts index e525b93..b68f9f9 100644 --- a/src/api/comm.libraryofcode.org/routes/keys.ts +++ b/src/api/comm.libraryofcode.org/routes/keys.ts @@ -58,7 +58,7 @@ export default class Keys extends Route {

Common Name: ${x509.data.subject.commonName}

Email Address: ${x509.data.emailAddresses[0]}

-

Expires on: ${x509.data.notAfter.toLocaleString('en-us')}

+

Expires on: ${new Date(x509.data.notAfter).toLocaleString('en-us')}

Public Key Algorithm ${x509.data.publicKeyAlgorithm}

Key Bit Length ${x509.data.bitLength}

diff --git a/src/commands/whois.ts b/src/commands/whois.ts index ce52fec..0f1c6b9 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -3,6 +3,7 @@ import moment from 'moment'; import { Message, Member } from 'eris'; import { Client, Command, RichEmbed } from '../class'; import { whois as emotes } from '../configs/emotes.json'; +import { profile } from '.'; export default class Whois extends Command { constructor(client: Client) { @@ -224,6 +225,15 @@ export default class Whois extends Command { if (permissions.length > 0) { embed.addField('Permissions', permissions.join(', ')); } + if (account.x509 || account.pgp) { + if (account.x509 && account.pgp) { + embed.addField('Credentials', `[PGP](https://comm.libraryofcode.org/keys/~/pgp/${member.id}) | [x509](https://comm.libraryofcode.org/keys/~/x509/${member.id})`); + } else if (account.pgp) { + embed.addField('Credentials', `[PGP](https://comm.libraryofcode.org/keys/~/pgp/${member.id})`); + } else if (account.x509) { + embed.addField('Credentials', `[x509](https://comm.libraryofcode.org/keys/~/x509/${member.id})`); + } + } if (serverAcknowledgements.length > 0) { embed.addField('Acknowledgements', serverAcknowledgements[0]); }