feat(api): add authenticators api (#2124)

* feat(api): add authenticators api

* fix(services): responses interpreting in authenticator manager
This commit is contained in:
Karol Sójko
2022-12-29 16:04:53 +01:00
committed by GitHub
parent 5a8a37413e
commit 59e8b5c8b5
32 changed files with 585 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import { Either } from '@standardnotes/common'
import { HttpErrorResponseBody } from '../../Http/HttpErrorResponseBody'
import { HttpResponse } from '../../Http/HttpResponse'
import { DeleteAuthenticatorResponseBody } from './DeleteAuthenticatorResponseBody'
export interface DeleteAuthenticatorResponse extends HttpResponse {
data: Either<DeleteAuthenticatorResponseBody, HttpErrorResponseBody>
}

View File

@@ -0,0 +1,3 @@
export interface DeleteAuthenticatorResponseBody {
message: string
}

View File

@@ -0,0 +1,10 @@
import { Either } from '@standardnotes/common'
import { HttpErrorResponseBody } from '../../Http/HttpErrorResponseBody'
import { HttpResponse } from '../../Http/HttpResponse'
import { GenerateAuthenticatorAuthenticationOptionsResponseBody } from './GenerateAuthenticatorAuthenticationOptionsResponseBody'
export interface GenerateAuthenticatorAuthenticationOptionsResponse extends HttpResponse {
data: Either<GenerateAuthenticatorAuthenticationOptionsResponseBody, HttpErrorResponseBody>
}

View File

@@ -0,0 +1,3 @@
export interface GenerateAuthenticatorAuthenticationOptionsResponseBody {
options: Record<string, unknown>
}

View File

@@ -0,0 +1,10 @@
import { Either } from '@standardnotes/common'
import { HttpErrorResponseBody } from '../../Http/HttpErrorResponseBody'
import { HttpResponse } from '../../Http/HttpResponse'
import { GenerateAuthenticatorRegistrationOptionsResponseBody } from './GenerateAuthenticatorRegistrationOptionsResponseBody'
export interface GenerateAuthenticatorRegistrationOptionsResponse extends HttpResponse {
data: Either<GenerateAuthenticatorRegistrationOptionsResponseBody, HttpErrorResponseBody>
}

View File

@@ -0,0 +1,3 @@
export interface GenerateAuthenticatorRegistrationOptionsResponseBody {
options: Record<string, unknown>
}

View File

@@ -0,0 +1,10 @@
import { Either } from '@standardnotes/common'
import { HttpErrorResponseBody } from '../../Http/HttpErrorResponseBody'
import { HttpResponse } from '../../Http/HttpResponse'
import { ListAuthenticatorsResponseBody } from './ListAuthenticatorsResponseBody'
export interface ListAuthenticatorsResponse extends HttpResponse {
data: Either<ListAuthenticatorsResponseBody, HttpErrorResponseBody>
}

View File

@@ -0,0 +1,6 @@
export interface ListAuthenticatorsResponseBody {
authenticators: Array<{
id: string
name: string
}>
}

View File

@@ -0,0 +1,10 @@
import { Either } from '@standardnotes/common'
import { HttpErrorResponseBody } from '../../Http/HttpErrorResponseBody'
import { HttpResponse } from '../../Http/HttpResponse'
import { VerifyAuthenticatorAuthenticationResponseResponseBody } from './VerifyAuthenticatorAuthenticationResponseResponseBody'
export interface VerifyAuthenticatorAuthenticationResponseResponse extends HttpResponse {
data: Either<VerifyAuthenticatorAuthenticationResponseResponseBody, HttpErrorResponseBody>
}

View File

@@ -0,0 +1,3 @@
export interface VerifyAuthenticatorAuthenticationResponseResponseBody {
success: boolean
}

View File

@@ -0,0 +1,10 @@
import { Either } from '@standardnotes/common'
import { HttpErrorResponseBody } from '../../Http/HttpErrorResponseBody'
import { HttpResponse } from '../../Http/HttpResponse'
import { VerifyAuthenticatorRegistrationResponseResponseBody } from './VerifyAuthenticatorRegistrationResponseResponseBody'
export interface VerifyAuthenticatorRegistrationResponseResponse extends HttpResponse {
data: Either<VerifyAuthenticatorRegistrationResponseResponseBody, HttpErrorResponseBody>
}

View File

@@ -0,0 +1,3 @@
export interface VerifyAuthenticatorRegistrationResponseResponseBody {
success: boolean
}

View File

@@ -1,3 +1,17 @@
export * from './Auth/SessionRefreshResponse'
export * from './Auth/SessionRefreshResponseBody'
export * from './Authenticator/DeleteAuthenticatorResponse'
export * from './Authenticator/DeleteAuthenticatorResponseBody'
export * from './Authenticator/GenerateAuthenticatorAuthenticationOptionsResponse'
export * from './Authenticator/GenerateAuthenticatorAuthenticationOptionsResponseBody'
export * from './Authenticator/GenerateAuthenticatorRegistrationOptionsResponse'
export * from './Authenticator/GenerateAuthenticatorRegistrationOptionsResponseBody'
export * from './Authenticator/ListAuthenticatorsResponse'
export * from './Authenticator/ListAuthenticatorsResponseBody'
export * from './Authenticator/VerifyAuthenticatorAuthenticationResponseResponse'
export * from './Authenticator/VerifyAuthenticatorAuthenticationResponseResponseBody'
export * from './Authenticator/VerifyAuthenticatorRegistrationResponseResponse'
export * from './Authenticator/VerifyAuthenticatorRegistrationResponseResponseBody'
export * from './Subscription/AppleIAPConfirmResponse'
export * from './Subscription/AppleIAPConfirmResponseBody'
export * from './Subscription/SubscriptionInviteAcceptResponse'