Skip to content

Commit 3524aae

Browse files
3nprob3nprob
authored andcommitted
Report new certificate fingerprint
1 parent f812f95 commit 3524aae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bridge/AdminRoomHandler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,9 @@ export class AdminRoomHandler {
673673
new MatrixUser(userId), server.domain
674674
);
675675
}
676+
let c: crypto.X509Certificate;
676677
try {
677-
const c = new crypto.X509Certificate(cert);
678+
c = new crypto.X509Certificate(cert);
678679
const pk = config.getSASLKey();
679680
if (pk) {
680681
if (!c.checkPrivateKey(crypto.createPrivateKey(pk))) {
@@ -689,10 +690,13 @@ export class AdminRoomHandler {
689690
catch (err) {
690691
throw new Error(`Invalid certificate: ${err.message})`);
691692
}
693+
const fingerprint512 = crypto.createHash('sha512').update(c.raw).digest('hex')
694+
.replace(/:/g, '').toLowerCase();
692695
config.setSASLCert(cert);
693696
await this.ircBridge.getStore().storeIrcClientConfig(config);
694697
notice = new MatrixAction(
695-
"notice", `Successfully stored SASL cert for ${domain}. Use !reconnect to reauthenticate.`
698+
"notice", `Successfully stored SASL cert for ${domain} with fingerprint ${fingerprint512}.\n' +
699+
'Use !reconnect to reauthenticate.`
696700
);
697701
}
698702
}

0 commit comments

Comments
 (0)