Clear stale sender certificates
This commit is contained in:
parent
9888e6d38f
commit
cf4c81b11c
4 changed files with 62 additions and 11 deletions
|
@ -75,6 +75,24 @@ export class SenderCertificateService {
|
|||
return this.fetchCertificate(mode);
|
||||
}
|
||||
|
||||
// This is intended to be called when our credentials have been deleted, so any fetches
|
||||
// made until this function is complete would fail anyway.
|
||||
async clear(): Promise<void> {
|
||||
log.info(
|
||||
'Sender certificate service: Clearing in-progress fetches and ' +
|
||||
'deleting cached certificates'
|
||||
);
|
||||
await Promise.all(this.fetchPromises.values());
|
||||
|
||||
const { storage } = this;
|
||||
assert(
|
||||
storage,
|
||||
'Sender certificate service method was called before it was initialized'
|
||||
);
|
||||
await storage.remove('senderCertificate');
|
||||
await storage.remove('senderCertificateNoE164');
|
||||
}
|
||||
|
||||
private getStoredCertificate(
|
||||
mode: SenderCertificateMode
|
||||
): undefined | SerializedCertificateType {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue