diff --git a/libs/common/src/auth/opaque/default-opaque.service.ts b/libs/common/src/auth/opaque/default-opaque.service.ts new file mode 100644 index 00000000000..2294cf038b5 --- /dev/null +++ b/libs/common/src/auth/opaque/default-opaque.service.ts @@ -0,0 +1,18 @@ +import { UserKey } from "../../types/key"; + +import { OpaqueApiService } from "./opaque-api.service"; +import { OpaqueService } from "./opaque.service"; + +export class DefaultOpaqueService implements OpaqueService { + constructor(private opaqueApiService: OpaqueApiService) {} + + async Register(masterPassword: string, userKey: UserKey) { + throw new Error("Not implemented"); + await Promise.resolve(); + } + + async Login(masterPassword: string) { + throw new Error("Not implemented"); + return await Promise.resolve(null as unknown as UserKey); + } +} diff --git a/libs/common/src/auth/opaque/opaque-api.service.ts b/libs/common/src/auth/opaque/opaque-api.service.ts new file mode 100644 index 00000000000..d9ca05ade42 --- /dev/null +++ b/libs/common/src/auth/opaque/opaque-api.service.ts @@ -0,0 +1,6 @@ +export abstract class OpaqueApiService { + abstract StartRegistration(): any; + abstract FinishRegistration(): any; + abstract StartLogin(): any; + abstract FinishLogin(): any; +} diff --git a/libs/common/src/auth/opaque/opaque.service.ts b/libs/common/src/auth/opaque/opaque.service.ts new file mode 100644 index 00000000000..c7ee949c571 --- /dev/null +++ b/libs/common/src/auth/opaque/opaque.service.ts @@ -0,0 +1,14 @@ +import { UserKey } from "../../types/key"; + +export abstract class OpaqueService { + /** + * Register a user to use the Opaque login method. + */ + abstract Register(masterPassword: string, userKey: UserKey): Promise; + + /** + * Authenticate using the Opaque login method. + * @returns The UserKey obtained during the Opaque login flow. + */ + abstract Login(masterPassword: string): Promise; +}