From 4ab3244f8f1c9131673ebb28f5884dec0ef7e690 Mon Sep 17 00:00:00 2001 From: Maurice Date: Thu, 29 Oct 2026 09:56:32 +0100 Subject: [PATCH] fix(server): mark the identity reset as writing its new key on its own Regenerating clears the stored key at once and writes the new one only after the issuer answered in the background, so the two writes cannot share a transaction. --- server/src/nest/service-identity/service-key.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/nest/service-identity/service-key.service.ts b/server/src/nest/service-identity/service-key.service.ts index b5d8f861d..ba45ff54e 100644 --- a/server/src/nest/service-identity/service-key.service.ts +++ b/server/src/nest/service-identity/service-key.service.ts @@ -138,7 +138,10 @@ export class ServiceKeyService { }); } - /** The admin's way out of a revoked or cloned identity: forget the key and ask for a new one. */ + /** + * The admin's way out of a revoked or cloned identity: forget the key and ask for a new one. + * @txIndependent the new key is written in the background once the issuer answered, long after the old one is gone. + */ async regenerate(): Promise { if (this.config.key) throw conflict('The key is set by TREK_SERVICES_KEY and is changed there'); if (!this.inUse()) throw conflict('TREK services are not in use on this instance');