fix(snjs): simplify authenticator api for generating options (#2147)

This commit is contained in:
Karol Sójko
2023-01-11 14:44:31 +01:00
committed by GitHub
parent 2e7302e3c1
commit 5d20a53e6e
12 changed files with 18 additions and 76 deletions

View File

@@ -1,9 +1,9 @@
import { Username, Uuid } from '@standardnotes/domain-core'
import { Uuid } from '@standardnotes/domain-core'
export interface AuthenticatorClientInterface {
list(): Promise<Array<{ id: string; name: string }>>
delete(authenticatorId: Uuid): Promise<boolean>
generateRegistrationOptions(userUuid: Uuid, username: Username): Promise<Record<string, unknown> | null>
generateRegistrationOptions(): Promise<Record<string, unknown> | null>
verifyRegistrationResponse(
userUuid: Uuid,
name: string,

View File

@@ -1,7 +1,7 @@
/* istanbul ignore file */
import { AuthenticatorApiServiceInterface } from '@standardnotes/api'
import { Username, Uuid } from '@standardnotes/domain-core'
import { Uuid } from '@standardnotes/domain-core'
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
import { AbstractService } from '../Service/AbstractService'
@@ -43,9 +43,9 @@ export class AuthenticatorManager extends AbstractService implements Authenticat
}
}
async generateRegistrationOptions(userUuid: Uuid, username: Username): Promise<Record<string, unknown> | null> {
async generateRegistrationOptions(): Promise<Record<string, unknown> | null> {
try {
const result = await this.authenticatorApiService.generateRegistrationOptions(userUuid.value, username.value)
const result = await this.authenticatorApiService.generateRegistrationOptions()
if (result.data.error) {
return null