From 54901bdc79fff4f0b1718ba8163cf10431582fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20K=C3=B6nig?= Date: Thu, 12 Dec 2024 10:24:44 +0100 Subject: [PATCH] whatever --- .../facades/transport/IdentityRecoveryKitsFacade.ts | 13 +++++++++---- ...st.ts => CheckForExistingIdentityRecoveryKit.ts} | 6 +++--- .../transport/identityRecoveryKits/index.ts | 2 +- .../test/transport/identityRecoveryKits.test.ts | 4 ++-- 4 files changed, 15 insertions(+), 10 deletions(-) rename packages/runtime/src/useCases/transport/identityRecoveryKits/{DoesIdentityRecoveryKitExist.ts => CheckForExistingIdentityRecoveryKit.ts} (63%) diff --git a/packages/runtime/src/extensibility/facades/transport/IdentityRecoveryKitsFacade.ts b/packages/runtime/src/extensibility/facades/transport/IdentityRecoveryKitsFacade.ts index b198a52de..8f6895664 100644 --- a/packages/runtime/src/extensibility/facades/transport/IdentityRecoveryKitsFacade.ts +++ b/packages/runtime/src/extensibility/facades/transport/IdentityRecoveryKitsFacade.ts @@ -1,19 +1,24 @@ import { Result } from "@js-soft/ts-utils"; import { Inject } from "@nmshd/typescript-ioc"; import { TokenDTO } from "../../../types"; -import { CreateIdentityRecoveryKitRequest, CreateIdentityRecoveryKitUseCase, DoesIdentityRecoveryKitExistResponse, DoesIdentityRecoveryKitExistUseCase } from "../../../useCases"; +import { + CheckForExistingIdentityRecoveryKitResponse, + CheckForExistingIdentityRecoveryKitUseCase, + CreateIdentityRecoveryKitRequest, + CreateIdentityRecoveryKitUseCase +} from "../../../useCases"; export class IdentityRecoveryKitsFacade { public constructor( @Inject private readonly createIdentityRecoveryKitUseCase: CreateIdentityRecoveryKitUseCase, - @Inject private readonly existsIdentityRecoveryKitUseCase: DoesIdentityRecoveryKitExistUseCase + @Inject private readonly checkForExistingIdentityRecoveryKitUseCase: CheckForExistingIdentityRecoveryKitUseCase ) {} public async createIdentityRecoveryKit(request: CreateIdentityRecoveryKitRequest): Promise> { return await this.createIdentityRecoveryKitUseCase.execute(request); } - public async doesIdentityRecoveryKitExist(): Promise> { - return await this.existsIdentityRecoveryKitUseCase.execute(); + public async checkForExistingIdentityRecoveryKit(): Promise> { + return await this.checkForExistingIdentityRecoveryKitUseCase.execute(); } } diff --git a/packages/runtime/src/useCases/transport/identityRecoveryKits/DoesIdentityRecoveryKitExist.ts b/packages/runtime/src/useCases/transport/identityRecoveryKits/CheckForExistingIdentityRecoveryKit.ts similarity index 63% rename from packages/runtime/src/useCases/transport/identityRecoveryKits/DoesIdentityRecoveryKitExist.ts rename to packages/runtime/src/useCases/transport/identityRecoveryKits/CheckForExistingIdentityRecoveryKit.ts index 11a98b142..9f3130493 100644 --- a/packages/runtime/src/useCases/transport/identityRecoveryKits/DoesIdentityRecoveryKitExist.ts +++ b/packages/runtime/src/useCases/transport/identityRecoveryKits/CheckForExistingIdentityRecoveryKit.ts @@ -3,16 +3,16 @@ import { DevicesController } from "@nmshd/transport"; import { Inject } from "@nmshd/typescript-ioc"; import { UseCase } from "../../common"; -export interface DoesIdentityRecoveryKitExistResponse { +export interface CheckForExistingIdentityRecoveryKitResponse { exists: boolean; } -export class DoesIdentityRecoveryKitExistUseCase extends UseCase { +export class CheckForExistingIdentityRecoveryKitUseCase extends UseCase { public constructor(@Inject private readonly devicesController: DevicesController) { super(); } - protected async executeInternal(): Promise> { + protected async executeInternal(): Promise> { const devices = await this.devicesController.list(); return Result.ok({ diff --git a/packages/runtime/src/useCases/transport/identityRecoveryKits/index.ts b/packages/runtime/src/useCases/transport/identityRecoveryKits/index.ts index 2f8d23756..84c918983 100644 --- a/packages/runtime/src/useCases/transport/identityRecoveryKits/index.ts +++ b/packages/runtime/src/useCases/transport/identityRecoveryKits/index.ts @@ -1,2 +1,2 @@ +export * from "./CheckForExistingIdentityRecoveryKit"; export * from "./CreateIdentityRecoveryKit"; -export * from "./DoesIdentityRecoveryKitExist"; diff --git a/packages/runtime/test/transport/identityRecoveryKits.test.ts b/packages/runtime/test/transport/identityRecoveryKits.test.ts index d70677823..3f1eef297 100644 --- a/packages/runtime/test/transport/identityRecoveryKits.test.ts +++ b/packages/runtime/test/transport/identityRecoveryKits.test.ts @@ -74,7 +74,7 @@ describe("Identity Recovery Kits", () => { }); test("should tell that no recovery kit exists", async () => { - const response = await services.transport.identityRecoveryKits.doesIdentityRecoveryKitExist(); + const response = await services.transport.identityRecoveryKits.checkForExistingIdentityRecoveryKit(); expect(response).toBeSuccessful(); expect(response.value.exists).toBe(false); @@ -83,7 +83,7 @@ describe("Identity Recovery Kits", () => { test("should tell that a recovery kit exists", async () => { await services.transport.identityRecoveryKits.createIdentityRecoveryKit({ profileName: "profileName", passwordProtection: { password: "aPassword" } }); - const response = await services.transport.identityRecoveryKits.doesIdentityRecoveryKitExist(); + const response = await services.transport.identityRecoveryKits.checkForExistingIdentityRecoveryKit(); expect(response).toBeSuccessful(); expect(response.value.exists).toBe(true);