mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-28 12:03:01 +00:00
log key rotation
This commit is contained in:
parent
5eb9a263e2
commit
c0a5955e0a
1 changed files with 3 additions and 0 deletions
|
@ -16,6 +16,7 @@ import type { MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
|||
import { getApId } from './type.js';
|
||||
import { ApPersonService } from './models/ApPersonService.js';
|
||||
import type { IObject } from './type.js';
|
||||
import { ApLoggerService } from '@/core/activitypub/ApLoggerService.js';
|
||||
|
||||
export type UriParseResult = {
|
||||
/** wether the URI was generated by us */
|
||||
|
@ -53,6 +54,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
|||
|
||||
private cacheService: CacheService,
|
||||
private apPersonService: ApPersonService,
|
||||
private apLoggerService: ApLoggerService,
|
||||
) {
|
||||
this.publicKeyCache = new MemoryKVCache<MiUserPublickey | null>(1000 * 60 * 60 * 12); // 12h
|
||||
this.publicKeyByUserIdCache = new MemoryKVCache<MiUserPublickey | null>(1000 * 60 * 60 * 12); // 12h
|
||||
|
@ -174,6 +176,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
|
|||
*/
|
||||
@bindThis
|
||||
public async refetchPublicKeyForApId(user: MiRemoteUser): Promise<MiUserPublickey | null> {
|
||||
this.apLoggerService.logger.info('Re-fetching public key for user', { userId: user.id });
|
||||
await this.apPersonService.updatePerson(user.uri);
|
||||
const key = await this.userPublickeysRepository.findOneBy({ userId: user.id });
|
||||
this.publicKeyByUserIdCache.set(user.id, key);
|
||||
|
|
Loading…
Reference in a new issue