mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[PM-24030] Migrate abstract services in libs/common strict TS (#15727)
Migrates the abstract classes in libs/common to be strict ts compatible. Primarily by adding abstract to every field and converting it to a function syntax instead of lambda.
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import {
|
import {
|
||||||
@@ -128,7 +126,7 @@ import { OptionalCipherResponse } from "../vault/models/response/optional-cipher
|
|||||||
* of this decision please read https://contributing.bitwarden.com/architecture/adr/refactor-api-service.
|
* of this decision please read https://contributing.bitwarden.com/architecture/adr/refactor-api-service.
|
||||||
*/
|
*/
|
||||||
export abstract class ApiService {
|
export abstract class ApiService {
|
||||||
send: (
|
abstract send(
|
||||||
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
|
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
|
||||||
path: string,
|
path: string,
|
||||||
body: any,
|
body: any,
|
||||||
@@ -136,196 +134,225 @@ export abstract class ApiService {
|
|||||||
hasResponse: boolean,
|
hasResponse: boolean,
|
||||||
apiUrl?: string | null,
|
apiUrl?: string | null,
|
||||||
alterHeaders?: (headers: Headers) => void,
|
alterHeaders?: (headers: Headers) => void,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
|
|
||||||
postIdentityToken: (
|
abstract postIdentityToken(
|
||||||
request:
|
request:
|
||||||
| PasswordTokenRequest
|
| PasswordTokenRequest
|
||||||
| SsoTokenRequest
|
| SsoTokenRequest
|
||||||
| UserApiTokenRequest
|
| UserApiTokenRequest
|
||||||
| WebAuthnLoginTokenRequest,
|
| WebAuthnLoginTokenRequest,
|
||||||
) => Promise<
|
): Promise<
|
||||||
IdentityTokenResponse | IdentityTwoFactorResponse | IdentityDeviceVerificationResponse
|
IdentityTokenResponse | IdentityTwoFactorResponse | IdentityDeviceVerificationResponse
|
||||||
>;
|
>;
|
||||||
refreshIdentityToken: () => Promise<any>;
|
abstract refreshIdentityToken(): Promise<any>;
|
||||||
|
|
||||||
getProfile: () => Promise<ProfileResponse>;
|
abstract getProfile(): Promise<ProfileResponse>;
|
||||||
getUserSubscription: () => Promise<SubscriptionResponse>;
|
abstract getUserSubscription(): Promise<SubscriptionResponse>;
|
||||||
getTaxInfo: () => Promise<TaxInfoResponse>;
|
abstract getTaxInfo(): Promise<TaxInfoResponse>;
|
||||||
putProfile: (request: UpdateProfileRequest) => Promise<ProfileResponse>;
|
abstract putProfile(request: UpdateProfileRequest): Promise<ProfileResponse>;
|
||||||
putAvatar: (request: UpdateAvatarRequest) => Promise<ProfileResponse>;
|
abstract putAvatar(request: UpdateAvatarRequest): Promise<ProfileResponse>;
|
||||||
putTaxInfo: (request: TaxInfoUpdateRequest) => Promise<any>;
|
abstract putTaxInfo(request: TaxInfoUpdateRequest): Promise<any>;
|
||||||
postPrelogin: (request: PreloginRequest) => Promise<PreloginResponse>;
|
abstract postPrelogin(request: PreloginRequest): Promise<PreloginResponse>;
|
||||||
postEmailToken: (request: EmailTokenRequest) => Promise<any>;
|
abstract postEmailToken(request: EmailTokenRequest): Promise<any>;
|
||||||
postEmail: (request: EmailRequest) => Promise<any>;
|
abstract postEmail(request: EmailRequest): Promise<any>;
|
||||||
postSetKeyConnectorKey: (request: SetKeyConnectorKeyRequest) => Promise<any>;
|
abstract postSetKeyConnectorKey(request: SetKeyConnectorKeyRequest): Promise<any>;
|
||||||
postSecurityStamp: (request: SecretVerificationRequest) => Promise<any>;
|
abstract postSecurityStamp(request: SecretVerificationRequest): Promise<any>;
|
||||||
getAccountRevisionDate: () => Promise<number>;
|
abstract getAccountRevisionDate(): Promise<number>;
|
||||||
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
|
abstract postPasswordHint(request: PasswordHintRequest): Promise<any>;
|
||||||
postPremium: (data: FormData) => Promise<PaymentResponse>;
|
abstract postPremium(data: FormData): Promise<PaymentResponse>;
|
||||||
postReinstatePremium: () => Promise<any>;
|
abstract postReinstatePremium(): Promise<any>;
|
||||||
postAccountStorage: (request: StorageRequest) => Promise<PaymentResponse>;
|
abstract postAccountStorage(request: StorageRequest): Promise<PaymentResponse>;
|
||||||
postAccountPayment: (request: PaymentRequest) => Promise<void>;
|
abstract postAccountPayment(request: PaymentRequest): Promise<void>;
|
||||||
postAccountLicense: (data: FormData) => Promise<any>;
|
abstract postAccountLicense(data: FormData): Promise<any>;
|
||||||
postAccountKeys: (request: KeysRequest) => Promise<any>;
|
abstract postAccountKeys(request: KeysRequest): Promise<any>;
|
||||||
postAccountVerifyEmail: () => Promise<any>;
|
abstract postAccountVerifyEmail(): Promise<any>;
|
||||||
postAccountVerifyEmailToken: (request: VerifyEmailRequest) => Promise<any>;
|
abstract postAccountVerifyEmailToken(request: VerifyEmailRequest): Promise<any>;
|
||||||
postAccountRecoverDelete: (request: DeleteRecoverRequest) => Promise<any>;
|
abstract postAccountRecoverDelete(request: DeleteRecoverRequest): Promise<any>;
|
||||||
postAccountRecoverDeleteToken: (request: VerifyDeleteRecoverRequest) => Promise<any>;
|
abstract postAccountRecoverDeleteToken(request: VerifyDeleteRecoverRequest): Promise<any>;
|
||||||
postAccountKdf: (request: KdfRequest) => Promise<any>;
|
abstract postAccountKdf(request: KdfRequest): Promise<any>;
|
||||||
postUserApiKey: (id: string, request: SecretVerificationRequest) => Promise<ApiKeyResponse>;
|
abstract postUserApiKey(id: string, request: SecretVerificationRequest): Promise<ApiKeyResponse>;
|
||||||
postUserRotateApiKey: (id: string, request: SecretVerificationRequest) => Promise<ApiKeyResponse>;
|
abstract postUserRotateApiKey(
|
||||||
postConvertToKeyConnector: () => Promise<void>;
|
id: string,
|
||||||
|
request: SecretVerificationRequest,
|
||||||
|
): Promise<ApiKeyResponse>;
|
||||||
|
abstract postConvertToKeyConnector(): Promise<void>;
|
||||||
//passwordless
|
//passwordless
|
||||||
getAuthRequest: (id: string) => Promise<AuthRequestResponse>;
|
abstract getAuthRequest(id: string): Promise<AuthRequestResponse>;
|
||||||
putAuthRequest: (id: string, request: PasswordlessAuthRequest) => Promise<AuthRequestResponse>;
|
abstract putAuthRequest(
|
||||||
getAuthRequests: () => Promise<ListResponse<AuthRequestResponse>>;
|
id: string,
|
||||||
getLastAuthRequest: () => Promise<AuthRequestResponse>;
|
request: PasswordlessAuthRequest,
|
||||||
|
): Promise<AuthRequestResponse>;
|
||||||
|
abstract getAuthRequests(): Promise<ListResponse<AuthRequestResponse>>;
|
||||||
|
abstract getLastAuthRequest(): Promise<AuthRequestResponse>;
|
||||||
|
|
||||||
getUserBillingHistory: () => Promise<BillingHistoryResponse>;
|
abstract getUserBillingHistory(): Promise<BillingHistoryResponse>;
|
||||||
getUserBillingPayment: () => Promise<BillingPaymentResponse>;
|
abstract getUserBillingPayment(): Promise<BillingPaymentResponse>;
|
||||||
|
|
||||||
getCipher: (id: string) => Promise<CipherResponse>;
|
abstract getCipher(id: string): Promise<CipherResponse>;
|
||||||
getFullCipherDetails: (id: string) => Promise<CipherResponse>;
|
abstract getFullCipherDetails(id: string): Promise<CipherResponse>;
|
||||||
getCipherAdmin: (id: string) => Promise<CipherResponse>;
|
abstract getCipherAdmin(id: string): Promise<CipherResponse>;
|
||||||
getAttachmentData: (
|
abstract getAttachmentData(
|
||||||
cipherId: string,
|
cipherId: string,
|
||||||
attachmentId: string,
|
attachmentId: string,
|
||||||
emergencyAccessId?: string,
|
emergencyAccessId?: string,
|
||||||
) => Promise<AttachmentResponse>;
|
): Promise<AttachmentResponse>;
|
||||||
getAttachmentDataAdmin: (cipherId: string, attachmentId: string) => Promise<AttachmentResponse>;
|
abstract getAttachmentDataAdmin(
|
||||||
getCiphersOrganization: (organizationId: string) => Promise<ListResponse<CipherResponse>>;
|
cipherId: string,
|
||||||
postCipher: (request: CipherRequest) => Promise<CipherResponse>;
|
attachmentId: string,
|
||||||
postCipherCreate: (request: CipherCreateRequest) => Promise<CipherResponse>;
|
): Promise<AttachmentResponse>;
|
||||||
postCipherAdmin: (request: CipherCreateRequest) => Promise<CipherResponse>;
|
abstract getCiphersOrganization(organizationId: string): Promise<ListResponse<CipherResponse>>;
|
||||||
putCipher: (id: string, request: CipherRequest) => Promise<CipherResponse>;
|
abstract postCipher(request: CipherRequest): Promise<CipherResponse>;
|
||||||
putPartialCipher: (id: string, request: CipherPartialRequest) => Promise<CipherResponse>;
|
abstract postCipherCreate(request: CipherCreateRequest): Promise<CipherResponse>;
|
||||||
putCipherAdmin: (id: string, request: CipherRequest) => Promise<CipherResponse>;
|
abstract postCipherAdmin(request: CipherCreateRequest): Promise<CipherResponse>;
|
||||||
deleteCipher: (id: string) => Promise<any>;
|
abstract putCipher(id: string, request: CipherRequest): Promise<CipherResponse>;
|
||||||
deleteCipherAdmin: (id: string) => Promise<any>;
|
abstract putPartialCipher(id: string, request: CipherPartialRequest): Promise<CipherResponse>;
|
||||||
deleteManyCiphers: (request: CipherBulkDeleteRequest) => Promise<any>;
|
abstract putCipherAdmin(id: string, request: CipherRequest): Promise<CipherResponse>;
|
||||||
deleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
abstract deleteCipher(id: string): Promise<any>;
|
||||||
putMoveCiphers: (request: CipherBulkMoveRequest) => Promise<any>;
|
abstract deleteCipherAdmin(id: string): Promise<any>;
|
||||||
putShareCipher: (id: string, request: CipherShareRequest) => Promise<CipherResponse>;
|
abstract deleteManyCiphers(request: CipherBulkDeleteRequest): Promise<any>;
|
||||||
putShareCiphers: (request: CipherBulkShareRequest) => Promise<ListResponse<CipherResponse>>;
|
abstract deleteManyCiphersAdmin(request: CipherBulkDeleteRequest): Promise<any>;
|
||||||
putCipherCollections: (
|
abstract putMoveCiphers(request: CipherBulkMoveRequest): Promise<any>;
|
||||||
|
abstract putShareCipher(id: string, request: CipherShareRequest): Promise<CipherResponse>;
|
||||||
|
abstract putShareCiphers(request: CipherBulkShareRequest): Promise<ListResponse<CipherResponse>>;
|
||||||
|
abstract putCipherCollections(
|
||||||
id: string,
|
id: string,
|
||||||
request: CipherCollectionsRequest,
|
request: CipherCollectionsRequest,
|
||||||
) => Promise<OptionalCipherResponse>;
|
): Promise<OptionalCipherResponse>;
|
||||||
putCipherCollectionsAdmin: (id: string, request: CipherCollectionsRequest) => Promise<any>;
|
abstract putCipherCollectionsAdmin(id: string, request: CipherCollectionsRequest): Promise<any>;
|
||||||
postPurgeCiphers: (request: SecretVerificationRequest, organizationId?: string) => Promise<any>;
|
abstract postPurgeCiphers(
|
||||||
putDeleteCipher: (id: string) => Promise<any>;
|
request: SecretVerificationRequest,
|
||||||
putDeleteCipherAdmin: (id: string) => Promise<any>;
|
organizationId?: string,
|
||||||
putDeleteManyCiphers: (request: CipherBulkDeleteRequest) => Promise<any>;
|
): Promise<any>;
|
||||||
putDeleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
abstract putDeleteCipher(id: string): Promise<any>;
|
||||||
putRestoreCipher: (id: string) => Promise<CipherResponse>;
|
abstract putDeleteCipherAdmin(id: string): Promise<any>;
|
||||||
putRestoreCipherAdmin: (id: string) => Promise<CipherResponse>;
|
abstract putDeleteManyCiphers(request: CipherBulkDeleteRequest): Promise<any>;
|
||||||
putRestoreManyCiphers: (
|
abstract putDeleteManyCiphersAdmin(request: CipherBulkDeleteRequest): Promise<any>;
|
||||||
|
abstract putRestoreCipher(id: string): Promise<CipherResponse>;
|
||||||
|
abstract putRestoreCipherAdmin(id: string): Promise<CipherResponse>;
|
||||||
|
abstract putRestoreManyCiphers(
|
||||||
request: CipherBulkRestoreRequest,
|
request: CipherBulkRestoreRequest,
|
||||||
) => Promise<ListResponse<CipherResponse>>;
|
): Promise<ListResponse<CipherResponse>>;
|
||||||
putRestoreManyCiphersAdmin: (
|
abstract putRestoreManyCiphersAdmin(
|
||||||
request: CipherBulkRestoreRequest,
|
request: CipherBulkRestoreRequest,
|
||||||
) => Promise<ListResponse<CipherResponse>>;
|
): Promise<ListResponse<CipherResponse>>;
|
||||||
|
|
||||||
postCipherAttachment: (
|
abstract postCipherAttachment(
|
||||||
id: string,
|
id: string,
|
||||||
request: AttachmentRequest,
|
request: AttachmentRequest,
|
||||||
) => Promise<AttachmentUploadDataResponse>;
|
): Promise<AttachmentUploadDataResponse>;
|
||||||
deleteCipherAttachment: (id: string, attachmentId: string) => Promise<any>;
|
abstract deleteCipherAttachment(id: string, attachmentId: string): Promise<any>;
|
||||||
deleteCipherAttachmentAdmin: (id: string, attachmentId: string) => Promise<any>;
|
abstract deleteCipherAttachmentAdmin(id: string, attachmentId: string): Promise<any>;
|
||||||
postShareCipherAttachment: (
|
abstract postShareCipherAttachment(
|
||||||
id: string,
|
id: string,
|
||||||
attachmentId: string,
|
attachmentId: string,
|
||||||
data: FormData,
|
data: FormData,
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
renewAttachmentUploadUrl: (
|
abstract renewAttachmentUploadUrl(
|
||||||
id: string,
|
id: string,
|
||||||
attachmentId: string,
|
attachmentId: string,
|
||||||
) => Promise<AttachmentUploadDataResponse>;
|
): Promise<AttachmentUploadDataResponse>;
|
||||||
postAttachmentFile: (id: string, attachmentId: string, data: FormData) => Promise<any>;
|
abstract postAttachmentFile(id: string, attachmentId: string, data: FormData): Promise<any>;
|
||||||
|
|
||||||
getUserCollections: () => Promise<ListResponse<CollectionResponse>>;
|
abstract getUserCollections(): Promise<ListResponse<CollectionResponse>>;
|
||||||
getCollections: (organizationId: string) => Promise<ListResponse<CollectionResponse>>;
|
abstract getCollections(organizationId: string): Promise<ListResponse<CollectionResponse>>;
|
||||||
getCollectionUsers: (organizationId: string, id: string) => Promise<SelectionReadOnlyResponse[]>;
|
abstract getCollectionUsers(
|
||||||
getCollectionAccessDetails: (
|
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
id: string,
|
id: string,
|
||||||
) => Promise<CollectionAccessDetailsResponse>;
|
): Promise<SelectionReadOnlyResponse[]>;
|
||||||
getManyCollectionsWithAccessDetails: (
|
abstract getCollectionAccessDetails(
|
||||||
|
organizationId: string,
|
||||||
|
id: string,
|
||||||
|
): Promise<CollectionAccessDetailsResponse>;
|
||||||
|
abstract getManyCollectionsWithAccessDetails(
|
||||||
orgId: string,
|
orgId: string,
|
||||||
) => Promise<ListResponse<CollectionAccessDetailsResponse>>;
|
): Promise<ListResponse<CollectionAccessDetailsResponse>>;
|
||||||
postCollection: (
|
abstract postCollection(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: CollectionRequest,
|
request: CollectionRequest,
|
||||||
) => Promise<CollectionDetailsResponse>;
|
): Promise<CollectionDetailsResponse>;
|
||||||
putCollection: (
|
abstract putCollection(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
id: string,
|
id: string,
|
||||||
request: CollectionRequest,
|
request: CollectionRequest,
|
||||||
) => Promise<CollectionDetailsResponse>;
|
): Promise<CollectionDetailsResponse>;
|
||||||
deleteCollection: (organizationId: string, id: string) => Promise<any>;
|
abstract deleteCollection(organizationId: string, id: string): Promise<any>;
|
||||||
deleteManyCollections: (organizationId: string, collectionIds: string[]) => Promise<any>;
|
abstract deleteManyCollections(organizationId: string, collectionIds: string[]): Promise<any>;
|
||||||
|
|
||||||
getGroupUsers: (organizationId: string, id: string) => Promise<string[]>;
|
abstract getGroupUsers(organizationId: string, id: string): Promise<string[]>;
|
||||||
deleteGroupUser: (organizationId: string, id: string, organizationUserId: string) => Promise<any>;
|
abstract deleteGroupUser(
|
||||||
|
|
||||||
getSync: () => Promise<SyncResponse>;
|
|
||||||
|
|
||||||
getSettingsDomains: () => Promise<DomainsResponse>;
|
|
||||||
putSettingsDomains: (request: UpdateDomainsRequest) => Promise<DomainsResponse>;
|
|
||||||
|
|
||||||
getTwoFactorProviders: () => Promise<ListResponse<TwoFactorProviderResponse>>;
|
|
||||||
getTwoFactorOrganizationProviders: (
|
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
) => Promise<ListResponse<TwoFactorProviderResponse>>;
|
id: string,
|
||||||
getTwoFactorAuthenticator: (
|
organizationUserId: string,
|
||||||
|
): Promise<any>;
|
||||||
|
|
||||||
|
abstract getSync(): Promise<SyncResponse>;
|
||||||
|
|
||||||
|
abstract getSettingsDomains(): Promise<DomainsResponse>;
|
||||||
|
abstract putSettingsDomains(request: UpdateDomainsRequest): Promise<DomainsResponse>;
|
||||||
|
|
||||||
|
abstract getTwoFactorProviders(): Promise<ListResponse<TwoFactorProviderResponse>>;
|
||||||
|
abstract getTwoFactorOrganizationProviders(
|
||||||
|
organizationId: string,
|
||||||
|
): Promise<ListResponse<TwoFactorProviderResponse>>;
|
||||||
|
abstract getTwoFactorAuthenticator(
|
||||||
request: SecretVerificationRequest,
|
request: SecretVerificationRequest,
|
||||||
) => Promise<TwoFactorAuthenticatorResponse>;
|
): Promise<TwoFactorAuthenticatorResponse>;
|
||||||
getTwoFactorEmail: (request: SecretVerificationRequest) => Promise<TwoFactorEmailResponse>;
|
abstract getTwoFactorEmail(request: SecretVerificationRequest): Promise<TwoFactorEmailResponse>;
|
||||||
getTwoFactorDuo: (request: SecretVerificationRequest) => Promise<TwoFactorDuoResponse>;
|
abstract getTwoFactorDuo(request: SecretVerificationRequest): Promise<TwoFactorDuoResponse>;
|
||||||
getTwoFactorOrganizationDuo: (
|
abstract getTwoFactorOrganizationDuo(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: SecretVerificationRequest,
|
request: SecretVerificationRequest,
|
||||||
) => Promise<TwoFactorDuoResponse>;
|
): Promise<TwoFactorDuoResponse>;
|
||||||
getTwoFactorYubiKey: (request: SecretVerificationRequest) => Promise<TwoFactorYubiKeyResponse>;
|
abstract getTwoFactorYubiKey(
|
||||||
getTwoFactorWebAuthn: (request: SecretVerificationRequest) => Promise<TwoFactorWebAuthnResponse>;
|
request: SecretVerificationRequest,
|
||||||
getTwoFactorWebAuthnChallenge: (request: SecretVerificationRequest) => Promise<ChallengeResponse>;
|
): Promise<TwoFactorYubiKeyResponse>;
|
||||||
getTwoFactorRecover: (request: SecretVerificationRequest) => Promise<TwoFactorRecoverResponse>;
|
abstract getTwoFactorWebAuthn(
|
||||||
putTwoFactorAuthenticator: (
|
request: SecretVerificationRequest,
|
||||||
|
): Promise<TwoFactorWebAuthnResponse>;
|
||||||
|
abstract getTwoFactorWebAuthnChallenge(
|
||||||
|
request: SecretVerificationRequest,
|
||||||
|
): Promise<ChallengeResponse>;
|
||||||
|
abstract getTwoFactorRecover(
|
||||||
|
request: SecretVerificationRequest,
|
||||||
|
): Promise<TwoFactorRecoverResponse>;
|
||||||
|
abstract putTwoFactorAuthenticator(
|
||||||
request: UpdateTwoFactorAuthenticatorRequest,
|
request: UpdateTwoFactorAuthenticatorRequest,
|
||||||
) => Promise<TwoFactorAuthenticatorResponse>;
|
): Promise<TwoFactorAuthenticatorResponse>;
|
||||||
deleteTwoFactorAuthenticator: (
|
abstract deleteTwoFactorAuthenticator(
|
||||||
request: DisableTwoFactorAuthenticatorRequest,
|
request: DisableTwoFactorAuthenticatorRequest,
|
||||||
) => Promise<TwoFactorProviderResponse>;
|
): Promise<TwoFactorProviderResponse>;
|
||||||
putTwoFactorEmail: (request: UpdateTwoFactorEmailRequest) => Promise<TwoFactorEmailResponse>;
|
abstract putTwoFactorEmail(request: UpdateTwoFactorEmailRequest): Promise<TwoFactorEmailResponse>;
|
||||||
putTwoFactorDuo: (request: UpdateTwoFactorDuoRequest) => Promise<TwoFactorDuoResponse>;
|
abstract putTwoFactorDuo(request: UpdateTwoFactorDuoRequest): Promise<TwoFactorDuoResponse>;
|
||||||
putTwoFactorOrganizationDuo: (
|
abstract putTwoFactorOrganizationDuo(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: UpdateTwoFactorDuoRequest,
|
request: UpdateTwoFactorDuoRequest,
|
||||||
) => Promise<TwoFactorDuoResponse>;
|
): Promise<TwoFactorDuoResponse>;
|
||||||
putTwoFactorYubiKey: (
|
abstract putTwoFactorYubiKey(
|
||||||
request: UpdateTwoFactorYubikeyOtpRequest,
|
request: UpdateTwoFactorYubikeyOtpRequest,
|
||||||
) => Promise<TwoFactorYubiKeyResponse>;
|
): Promise<TwoFactorYubiKeyResponse>;
|
||||||
putTwoFactorWebAuthn: (
|
abstract putTwoFactorWebAuthn(
|
||||||
request: UpdateTwoFactorWebAuthnRequest,
|
request: UpdateTwoFactorWebAuthnRequest,
|
||||||
) => Promise<TwoFactorWebAuthnResponse>;
|
): Promise<TwoFactorWebAuthnResponse>;
|
||||||
deleteTwoFactorWebAuthn: (
|
abstract deleteTwoFactorWebAuthn(
|
||||||
request: UpdateTwoFactorWebAuthnDeleteRequest,
|
request: UpdateTwoFactorWebAuthnDeleteRequest,
|
||||||
) => Promise<TwoFactorWebAuthnResponse>;
|
): Promise<TwoFactorWebAuthnResponse>;
|
||||||
putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
|
abstract putTwoFactorDisable(
|
||||||
putTwoFactorOrganizationDisable: (
|
request: TwoFactorProviderRequest,
|
||||||
|
): Promise<TwoFactorProviderResponse>;
|
||||||
|
abstract putTwoFactorOrganizationDisable(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: TwoFactorProviderRequest,
|
request: TwoFactorProviderRequest,
|
||||||
) => Promise<TwoFactorProviderResponse>;
|
): Promise<TwoFactorProviderResponse>;
|
||||||
postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise<any>;
|
abstract postTwoFactorEmailSetup(request: TwoFactorEmailRequest): Promise<any>;
|
||||||
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
|
abstract postTwoFactorEmail(request: TwoFactorEmailRequest): Promise<any>;
|
||||||
getDeviceVerificationSettings: () => Promise<DeviceVerificationResponse>;
|
abstract getDeviceVerificationSettings(): Promise<DeviceVerificationResponse>;
|
||||||
putDeviceVerificationSettings: (
|
abstract putDeviceVerificationSettings(
|
||||||
request: DeviceVerificationRequest,
|
request: DeviceVerificationRequest,
|
||||||
) => Promise<DeviceVerificationResponse>;
|
): Promise<DeviceVerificationResponse>;
|
||||||
|
|
||||||
getCloudCommunicationsEnabled: () => Promise<boolean>;
|
abstract getCloudCommunicationsEnabled(): Promise<boolean>;
|
||||||
abstract getOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
|
abstract getOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
|
||||||
id: string,
|
id: string,
|
||||||
type: OrganizationConnectionType,
|
type: OrganizationConnectionType,
|
||||||
@@ -340,136 +367,147 @@ export abstract class ApiService {
|
|||||||
configType: { new (response: any): TConfig },
|
configType: { new (response: any): TConfig },
|
||||||
organizationConnectionId: string,
|
organizationConnectionId: string,
|
||||||
): Promise<OrganizationConnectionResponse<TConfig>>;
|
): Promise<OrganizationConnectionResponse<TConfig>>;
|
||||||
deleteOrganizationConnection: (id: string) => Promise<void>;
|
abstract deleteOrganizationConnection(id: string): Promise<void>;
|
||||||
getPlans: () => Promise<ListResponse<PlanResponse>>;
|
abstract getPlans(): Promise<ListResponse<PlanResponse>>;
|
||||||
|
|
||||||
getProviderUsers: (providerId: string) => Promise<ListResponse<ProviderUserUserDetailsResponse>>;
|
abstract getProviderUsers(
|
||||||
getProviderUser: (providerId: string, id: string) => Promise<ProviderUserResponse>;
|
providerId: string,
|
||||||
postProviderUserInvite: (providerId: string, request: ProviderUserInviteRequest) => Promise<any>;
|
): Promise<ListResponse<ProviderUserUserDetailsResponse>>;
|
||||||
postProviderUserReinvite: (providerId: string, id: string) => Promise<any>;
|
abstract getProviderUser(providerId: string, id: string): Promise<ProviderUserResponse>;
|
||||||
postManyProviderUserReinvite: (
|
abstract postProviderUserInvite(
|
||||||
|
providerId: string,
|
||||||
|
request: ProviderUserInviteRequest,
|
||||||
|
): Promise<any>;
|
||||||
|
abstract postProviderUserReinvite(providerId: string, id: string): Promise<any>;
|
||||||
|
abstract postManyProviderUserReinvite(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: ProviderUserBulkRequest,
|
request: ProviderUserBulkRequest,
|
||||||
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
): Promise<ListResponse<ProviderUserBulkResponse>>;
|
||||||
postProviderUserAccept: (
|
abstract postProviderUserAccept(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
id: string,
|
id: string,
|
||||||
request: ProviderUserAcceptRequest,
|
request: ProviderUserAcceptRequest,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
postProviderUserConfirm: (
|
abstract postProviderUserConfirm(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
id: string,
|
id: string,
|
||||||
request: ProviderUserConfirmRequest,
|
request: ProviderUserConfirmRequest,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
postProviderUsersPublicKey: (
|
abstract postProviderUsersPublicKey(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: ProviderUserBulkRequest,
|
request: ProviderUserBulkRequest,
|
||||||
) => Promise<ListResponse<ProviderUserBulkPublicKeyResponse>>;
|
): Promise<ListResponse<ProviderUserBulkPublicKeyResponse>>;
|
||||||
postProviderUserBulkConfirm: (
|
abstract postProviderUserBulkConfirm(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: ProviderUserBulkConfirmRequest,
|
request: ProviderUserBulkConfirmRequest,
|
||||||
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
): Promise<ListResponse<ProviderUserBulkResponse>>;
|
||||||
putProviderUser: (
|
abstract putProviderUser(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
id: string,
|
id: string,
|
||||||
request: ProviderUserUpdateRequest,
|
request: ProviderUserUpdateRequest,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
deleteProviderUser: (organizationId: string, id: string) => Promise<any>;
|
abstract deleteProviderUser(organizationId: string, id: string): Promise<any>;
|
||||||
deleteManyProviderUsers: (
|
abstract deleteManyProviderUsers(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: ProviderUserBulkRequest,
|
request: ProviderUserBulkRequest,
|
||||||
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
): Promise<ListResponse<ProviderUserBulkResponse>>;
|
||||||
getProviderClients: (
|
abstract getProviderClients(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
) => Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
|
): Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
|
||||||
postProviderAddOrganization: (
|
abstract postProviderAddOrganization(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: ProviderAddOrganizationRequest,
|
request: ProviderAddOrganizationRequest,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
postProviderCreateOrganization: (
|
abstract postProviderCreateOrganization(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: ProviderOrganizationCreateRequest,
|
request: ProviderOrganizationCreateRequest,
|
||||||
) => Promise<ProviderOrganizationResponse>;
|
): Promise<ProviderOrganizationResponse>;
|
||||||
deleteProviderOrganization: (providerId: string, organizationId: string) => Promise<any>;
|
abstract deleteProviderOrganization(providerId: string, organizationId: string): Promise<any>;
|
||||||
|
|
||||||
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
abstract getEvents(
|
||||||
getEventsCipher: (
|
start: string,
|
||||||
|
end: string,
|
||||||
|
token: string,
|
||||||
|
): Promise<ListResponse<EventResponse>>;
|
||||||
|
abstract getEventsCipher(
|
||||||
id: string,
|
id: string,
|
||||||
start: string,
|
start: string,
|
||||||
end: string,
|
end: string,
|
||||||
token: string,
|
token: string,
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
): Promise<ListResponse<EventResponse>>;
|
||||||
getEventsOrganization: (
|
abstract getEventsOrganization(
|
||||||
id: string,
|
id: string,
|
||||||
start: string,
|
start: string,
|
||||||
end: string,
|
end: string,
|
||||||
token: string,
|
token: string,
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
): Promise<ListResponse<EventResponse>>;
|
||||||
getEventsOrganizationUser: (
|
abstract getEventsOrganizationUser(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
id: string,
|
id: string,
|
||||||
start: string,
|
start: string,
|
||||||
end: string,
|
end: string,
|
||||||
token: string,
|
token: string,
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
): Promise<ListResponse<EventResponse>>;
|
||||||
getEventsProvider: (
|
abstract getEventsProvider(
|
||||||
id: string,
|
id: string,
|
||||||
start: string,
|
start: string,
|
||||||
end: string,
|
end: string,
|
||||||
token: string,
|
token: string,
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
): Promise<ListResponse<EventResponse>>;
|
||||||
getEventsProviderUser: (
|
abstract getEventsProviderUser(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
id: string,
|
id: string,
|
||||||
start: string,
|
start: string,
|
||||||
end: string,
|
end: string,
|
||||||
token: string,
|
token: string,
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
): Promise<ListResponse<EventResponse>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Posts events for a user
|
* Posts events for a user
|
||||||
* @param request The array of events to upload
|
* @param request The array of events to upload
|
||||||
* @param userId The optional user id the events belong to. If no user id is provided the active user id is used.
|
* @param userId The optional user id the events belong to. If no user id is provided the active user id is used.
|
||||||
*/
|
*/
|
||||||
postEventsCollect: (request: EventRequest[], userId?: UserId) => Promise<any>;
|
abstract postEventsCollect(request: EventRequest[], userId?: UserId): Promise<any>;
|
||||||
|
|
||||||
deleteSsoUser: (organizationId: string) => Promise<void>;
|
abstract deleteSsoUser(organizationId: string): Promise<void>;
|
||||||
getSsoUserIdentifier: () => Promise<string>;
|
abstract getSsoUserIdentifier(): Promise<string>;
|
||||||
|
|
||||||
getUserPublicKey: (id: string) => Promise<UserKeyResponse>;
|
abstract getUserPublicKey(id: string): Promise<UserKeyResponse>;
|
||||||
|
|
||||||
getHibpBreach: (username: string) => Promise<BreachAccountResponse[]>;
|
abstract getHibpBreach(username: string): Promise<BreachAccountResponse[]>;
|
||||||
|
|
||||||
postBitPayInvoice: (request: BitPayInvoiceRequest) => Promise<string>;
|
abstract postBitPayInvoice(request: BitPayInvoiceRequest): Promise<string>;
|
||||||
postSetupPayment: () => Promise<string>;
|
abstract postSetupPayment(): Promise<string>;
|
||||||
|
|
||||||
getActiveBearerToken: () => Promise<string>;
|
abstract getActiveBearerToken(): Promise<string>;
|
||||||
fetch: (request: Request) => Promise<Response>;
|
abstract fetch(request: Request): Promise<Response>;
|
||||||
nativeFetch: (request: Request) => Promise<Response>;
|
abstract nativeFetch(request: Request): Promise<Response>;
|
||||||
|
|
||||||
preValidateSso: (identifier: string) => Promise<SsoPreValidateResponse>;
|
abstract preValidateSso(identifier: string): Promise<SsoPreValidateResponse>;
|
||||||
|
|
||||||
postCreateSponsorship: (
|
abstract postCreateSponsorship(
|
||||||
sponsorshipOrgId: string,
|
sponsorshipOrgId: string,
|
||||||
request: OrganizationSponsorshipCreateRequest,
|
request: OrganizationSponsorshipCreateRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
getSponsorshipSyncStatus: (
|
abstract getSponsorshipSyncStatus(
|
||||||
sponsoredOrgId: string,
|
sponsoredOrgId: string,
|
||||||
) => Promise<OrganizationSponsorshipSyncStatusResponse>;
|
): Promise<OrganizationSponsorshipSyncStatusResponse>;
|
||||||
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
|
abstract deleteRemoveSponsorship(sponsoringOrgId: string): Promise<void>;
|
||||||
postPreValidateSponsorshipToken: (
|
abstract postPreValidateSponsorshipToken(
|
||||||
sponsorshipToken: string,
|
sponsorshipToken: string,
|
||||||
) => Promise<PreValidateSponsorshipResponse>;
|
): Promise<PreValidateSponsorshipResponse>;
|
||||||
postRedeemSponsorship: (
|
abstract postRedeemSponsorship(
|
||||||
sponsorshipToken: string,
|
sponsorshipToken: string,
|
||||||
request: OrganizationSponsorshipRedeemRequest,
|
request: OrganizationSponsorshipRedeemRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
getMasterKeyFromKeyConnector: (keyConnectorUrl: string) => Promise<KeyConnectorUserKeyResponse>;
|
abstract getMasterKeyFromKeyConnector(
|
||||||
postUserKeyToKeyConnector: (
|
keyConnectorUrl: string,
|
||||||
|
): Promise<KeyConnectorUserKeyResponse>;
|
||||||
|
abstract postUserKeyToKeyConnector(
|
||||||
keyConnectorUrl: string,
|
keyConnectorUrl: string,
|
||||||
request: KeyConnectorUserKeyRequest,
|
request: KeyConnectorUserKeyRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
getKeyConnectorAlive: (keyConnectorUrl: string) => Promise<void>;
|
abstract getKeyConnectorAlive(keyConnectorUrl: string): Promise<void>;
|
||||||
getOrganizationExport: (organizationId: string) => Promise<OrganizationExportResponse>;
|
abstract getOrganizationExport(organizationId: string): Promise<OrganizationExportResponse>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { EventType } from "../../enums";
|
import { EventType } from "../../enums";
|
||||||
import { CipherView } from "../../vault/models/view/cipher.view";
|
import { CipherView } from "../../vault/models/view/cipher.view";
|
||||||
|
|
||||||
export abstract class EventCollectionService {
|
export abstract class EventCollectionService {
|
||||||
collectMany: (
|
abstract collectMany(
|
||||||
eventType: EventType,
|
eventType: EventType,
|
||||||
ciphers: CipherView[],
|
ciphers: CipherView[],
|
||||||
uploadImmediately?: boolean,
|
uploadImmediately?: boolean,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
collect: (
|
abstract collect(
|
||||||
eventType: EventType,
|
eventType: EventType,
|
||||||
cipherId?: string,
|
cipherId?: string,
|
||||||
uploadImmediately?: boolean,
|
uploadImmediately?: boolean,
|
||||||
organizationId?: string,
|
organizationId?: string,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { UserId } from "../../types/guid";
|
import { UserId } from "../../types/guid";
|
||||||
|
|
||||||
export abstract class EventUploadService {
|
export abstract class EventUploadService {
|
||||||
uploadEvents: (userId?: UserId) => Promise<void>;
|
abstract uploadEvents(userId?: UserId): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { ListResponse } from "../../../models/response/list.response";
|
import { ListResponse } from "../../../models/response/list.response";
|
||||||
import { OrganizationDomainRequest } from "../../services/organization-domain/requests/organization-domain.request";
|
import { OrganizationDomainRequest } from "../../services/organization-domain/requests/organization-domain.request";
|
||||||
|
|
||||||
@@ -8,19 +6,19 @@ import { OrganizationDomainResponse } from "./responses/organization-domain.resp
|
|||||||
import { VerifiedOrganizationDomainSsoDetailsResponse } from "./responses/verified-organization-domain-sso-details.response";
|
import { VerifiedOrganizationDomainSsoDetailsResponse } from "./responses/verified-organization-domain-sso-details.response";
|
||||||
|
|
||||||
export abstract class OrgDomainApiServiceAbstraction {
|
export abstract class OrgDomainApiServiceAbstraction {
|
||||||
getAllByOrgId: (orgId: string) => Promise<Array<OrganizationDomainResponse>>;
|
abstract getAllByOrgId(orgId: string): Promise<Array<OrganizationDomainResponse>>;
|
||||||
getByOrgIdAndOrgDomainId: (
|
abstract getByOrgIdAndOrgDomainId(
|
||||||
orgId: string,
|
orgId: string,
|
||||||
orgDomainId: string,
|
orgDomainId: string,
|
||||||
) => Promise<OrganizationDomainResponse>;
|
): Promise<OrganizationDomainResponse>;
|
||||||
post: (
|
abstract post(
|
||||||
orgId: string,
|
orgId: string,
|
||||||
orgDomain: OrganizationDomainRequest,
|
orgDomain: OrganizationDomainRequest,
|
||||||
) => Promise<OrganizationDomainResponse>;
|
): Promise<OrganizationDomainResponse>;
|
||||||
verify: (orgId: string, orgDomainId: string) => Promise<OrganizationDomainResponse>;
|
abstract verify(orgId: string, orgDomainId: string): Promise<OrganizationDomainResponse>;
|
||||||
delete: (orgId: string, orgDomainId: string) => Promise<any>;
|
abstract delete(orgId: string, orgDomainId: string): Promise<any>;
|
||||||
getClaimedOrgDomainByEmail: (email: string) => Promise<OrganizationDomainSsoDetailsResponse>;
|
abstract getClaimedOrgDomainByEmail(email: string): Promise<OrganizationDomainSsoDetailsResponse>;
|
||||||
getVerifiedOrgDomainsByEmail: (
|
abstract getVerifiedOrgDomainsByEmail(
|
||||||
email: string,
|
email: string,
|
||||||
) => Promise<ListResponse<VerifiedOrganizationDomainSsoDetailsResponse>>;
|
): Promise<ListResponse<VerifiedOrganizationDomainSsoDetailsResponse>>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { OrganizationDomainResponse } from "./responses/organization-domain.response";
|
import { OrganizationDomainResponse } from "./responses/organization-domain.response";
|
||||||
|
|
||||||
export abstract class OrgDomainServiceAbstraction {
|
export abstract class OrgDomainServiceAbstraction {
|
||||||
orgDomains$: Observable<OrganizationDomainResponse[]>;
|
abstract orgDomains$: Observable<OrganizationDomainResponse[]>;
|
||||||
|
|
||||||
get: (orgDomainId: string) => OrganizationDomainResponse;
|
abstract get(orgDomainId: string): OrganizationDomainResponse;
|
||||||
|
|
||||||
copyDnsTxt: (dnsTxt: string) => void;
|
abstract copyDnsTxt(dnsTxt: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: this separate class is designed to hold methods that are not
|
// Note: this separate class is designed to hold methods that are not
|
||||||
// meant to be used in components (e.g., data write methods)
|
// meant to be used in components (e.g., data write methods)
|
||||||
export abstract class OrgDomainInternalServiceAbstraction extends OrgDomainServiceAbstraction {
|
export abstract class OrgDomainInternalServiceAbstraction extends OrgDomainServiceAbstraction {
|
||||||
upsert: (orgDomains: OrganizationDomainResponse[]) => void;
|
abstract upsert(orgDomains: OrganizationDomainResponse[]): void;
|
||||||
replace: (orgDomains: OrganizationDomainResponse[]) => void;
|
abstract replace(orgDomains: OrganizationDomainResponse[]): void;
|
||||||
clearCache: () => void;
|
abstract clearCache(): void;
|
||||||
delete: (orgDomainIds: string[]) => void;
|
abstract delete(orgDomainIds: string[]): void;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { OrganizationApiKeyRequest } from "../../../admin-console/models/request/organization-api-key.request";
|
import { OrganizationApiKeyRequest } from "../../../admin-console/models/request/organization-api-key.request";
|
||||||
import { OrganizationSsoRequest } from "../../../auth/models/request/organization-sso.request";
|
import { OrganizationSsoRequest } from "../../../auth/models/request/organization-sso.request";
|
||||||
import { SecretVerificationRequest } from "../../../auth/models/request/secret-verification.request";
|
import { SecretVerificationRequest } from "../../../auth/models/request/secret-verification.request";
|
||||||
@@ -34,60 +32,66 @@ import { OrganizationKeysResponse } from "../../models/response/organization-key
|
|||||||
import { OrganizationResponse } from "../../models/response/organization.response";
|
import { OrganizationResponse } from "../../models/response/organization.response";
|
||||||
import { ProfileOrganizationResponse } from "../../models/response/profile-organization.response";
|
import { ProfileOrganizationResponse } from "../../models/response/profile-organization.response";
|
||||||
|
|
||||||
export class OrganizationApiServiceAbstraction {
|
export abstract class OrganizationApiServiceAbstraction {
|
||||||
get: (id: string) => Promise<OrganizationResponse>;
|
abstract get(id: string): Promise<OrganizationResponse>;
|
||||||
getBilling: (id: string) => Promise<BillingResponse>;
|
abstract getBilling(id: string): Promise<BillingResponse>;
|
||||||
getBillingHistory: (id: string) => Promise<BillingHistoryResponse>;
|
abstract getBillingHistory(id: string): Promise<BillingHistoryResponse>;
|
||||||
getSubscription: (id: string) => Promise<OrganizationSubscriptionResponse>;
|
abstract getSubscription(id: string): Promise<OrganizationSubscriptionResponse>;
|
||||||
getLicense: (id: string, installationId: string) => Promise<unknown>;
|
abstract getLicense(id: string, installationId: string): Promise<unknown>;
|
||||||
getAutoEnrollStatus: (identifier: string) => Promise<OrganizationAutoEnrollStatusResponse>;
|
abstract getAutoEnrollStatus(identifier: string): Promise<OrganizationAutoEnrollStatusResponse>;
|
||||||
create: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
|
abstract create(request: OrganizationCreateRequest): Promise<OrganizationResponse>;
|
||||||
createWithoutPayment: (
|
abstract createWithoutPayment(
|
||||||
request: OrganizationNoPaymentMethodCreateRequest,
|
request: OrganizationNoPaymentMethodCreateRequest,
|
||||||
) => Promise<OrganizationResponse>;
|
): Promise<OrganizationResponse>;
|
||||||
createLicense: (data: FormData) => Promise<OrganizationResponse>;
|
abstract createLicense(data: FormData): Promise<OrganizationResponse>;
|
||||||
save: (id: string, request: OrganizationUpdateRequest) => Promise<OrganizationResponse>;
|
abstract save(id: string, request: OrganizationUpdateRequest): Promise<OrganizationResponse>;
|
||||||
updatePayment: (id: string, request: PaymentRequest) => Promise<void>;
|
abstract updatePayment(id: string, request: PaymentRequest): Promise<void>;
|
||||||
upgrade: (id: string, request: OrganizationUpgradeRequest) => Promise<PaymentResponse>;
|
abstract upgrade(id: string, request: OrganizationUpgradeRequest): Promise<PaymentResponse>;
|
||||||
updatePasswordManagerSeats: (
|
abstract updatePasswordManagerSeats(
|
||||||
id: string,
|
id: string,
|
||||||
request: OrganizationSubscriptionUpdateRequest,
|
request: OrganizationSubscriptionUpdateRequest,
|
||||||
) => Promise<ProfileOrganizationResponse>;
|
): Promise<ProfileOrganizationResponse>;
|
||||||
updateSecretsManagerSubscription: (
|
abstract updateSecretsManagerSubscription(
|
||||||
id: string,
|
id: string,
|
||||||
request: OrganizationSmSubscriptionUpdateRequest,
|
request: OrganizationSmSubscriptionUpdateRequest,
|
||||||
) => Promise<ProfileOrganizationResponse>;
|
): Promise<ProfileOrganizationResponse>;
|
||||||
updateSeats: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
|
abstract updateSeats(id: string, request: SeatRequest): Promise<PaymentResponse>;
|
||||||
updateStorage: (id: string, request: StorageRequest) => Promise<PaymentResponse>;
|
abstract updateStorage(id: string, request: StorageRequest): Promise<PaymentResponse>;
|
||||||
verifyBank: (id: string, request: VerifyBankRequest) => Promise<void>;
|
abstract verifyBank(id: string, request: VerifyBankRequest): Promise<void>;
|
||||||
reinstate: (id: string) => Promise<void>;
|
abstract reinstate(id: string): Promise<void>;
|
||||||
leave: (id: string) => Promise<void>;
|
abstract leave(id: string): Promise<void>;
|
||||||
delete: (id: string, request: SecretVerificationRequest) => Promise<void>;
|
abstract delete(id: string, request: SecretVerificationRequest): Promise<void>;
|
||||||
deleteUsingToken: (
|
abstract deleteUsingToken(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: OrganizationVerifyDeleteRecoverRequest,
|
request: OrganizationVerifyDeleteRecoverRequest,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
updateLicense: (id: string, data: FormData) => Promise<void>;
|
abstract updateLicense(id: string, data: FormData): Promise<void>;
|
||||||
importDirectory: (organizationId: string, request: ImportDirectoryRequest) => Promise<void>;
|
abstract importDirectory(organizationId: string, request: ImportDirectoryRequest): Promise<void>;
|
||||||
getOrCreateApiKey: (id: string, request: OrganizationApiKeyRequest) => Promise<ApiKeyResponse>;
|
abstract getOrCreateApiKey(
|
||||||
getApiKeyInformation: (
|
id: string,
|
||||||
|
request: OrganizationApiKeyRequest,
|
||||||
|
): Promise<ApiKeyResponse>;
|
||||||
|
abstract getApiKeyInformation(
|
||||||
id: string,
|
id: string,
|
||||||
organizationApiKeyType?: OrganizationApiKeyType,
|
organizationApiKeyType?: OrganizationApiKeyType,
|
||||||
) => Promise<ListResponse<OrganizationApiKeyInformationResponse>>;
|
): Promise<ListResponse<OrganizationApiKeyInformationResponse>>;
|
||||||
rotateApiKey: (id: string, request: OrganizationApiKeyRequest) => Promise<ApiKeyResponse>;
|
abstract rotateApiKey(id: string, request: OrganizationApiKeyRequest): Promise<ApiKeyResponse>;
|
||||||
getTaxInfo: (id: string) => Promise<TaxInfoResponse>;
|
abstract getTaxInfo(id: string): Promise<TaxInfoResponse>;
|
||||||
updateTaxInfo: (id: string, request: ExpandedTaxInfoUpdateRequest) => Promise<void>;
|
abstract updateTaxInfo(id: string, request: ExpandedTaxInfoUpdateRequest): Promise<void>;
|
||||||
getKeys: (id: string) => Promise<OrganizationKeysResponse>;
|
abstract getKeys(id: string): Promise<OrganizationKeysResponse>;
|
||||||
updateKeys: (id: string, request: OrganizationKeysRequest) => Promise<OrganizationKeysResponse>;
|
abstract updateKeys(
|
||||||
getSso: (id: string) => Promise<OrganizationSsoResponse>;
|
id: string,
|
||||||
updateSso: (id: string, request: OrganizationSsoRequest) => Promise<OrganizationSsoResponse>;
|
request: OrganizationKeysRequest,
|
||||||
selfHostedSyncLicense: (id: string) => Promise<void>;
|
): Promise<OrganizationKeysResponse>;
|
||||||
subscribeToSecretsManager: (
|
abstract getSso(id: string): Promise<OrganizationSsoResponse>;
|
||||||
|
abstract updateSso(id: string, request: OrganizationSsoRequest): Promise<OrganizationSsoResponse>;
|
||||||
|
abstract selfHostedSyncLicense(id: string): Promise<void>;
|
||||||
|
abstract subscribeToSecretsManager(
|
||||||
id: string,
|
id: string,
|
||||||
request: SecretsManagerSubscribeRequest,
|
request: SecretsManagerSubscribeRequest,
|
||||||
) => Promise<ProfileOrganizationResponse>;
|
): Promise<ProfileOrganizationResponse>;
|
||||||
updateCollectionManagement: (
|
abstract updateCollectionManagement(
|
||||||
id: string,
|
id: string,
|
||||||
request: OrganizationCollectionManagementUpdateRequest,
|
request: OrganizationCollectionManagementUpdateRequest,
|
||||||
) => Promise<OrganizationResponse>;
|
): Promise<OrganizationResponse>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { map, Observable } from "rxjs";
|
import { map, Observable } from "rxjs";
|
||||||
|
|
||||||
import { UserId } from "../../../types/guid";
|
import { UserId } from "../../../types/guid";
|
||||||
@@ -68,20 +66,20 @@ export abstract class OrganizationService {
|
|||||||
* Publishes state for all organizations under the specified user.
|
* Publishes state for all organizations under the specified user.
|
||||||
* @returns An observable list of organizations
|
* @returns An observable list of organizations
|
||||||
*/
|
*/
|
||||||
organizations$: (userId: UserId) => Observable<Organization[]>;
|
abstract organizations$(userId: UserId): Observable<Organization[]>;
|
||||||
|
|
||||||
// @todo Clean these up. Continuing to expand them is not recommended.
|
// @todo Clean these up. Continuing to expand them is not recommended.
|
||||||
// @see https://bitwarden.atlassian.net/browse/AC-2252
|
// @see https://bitwarden.atlassian.net/browse/AC-2252
|
||||||
memberOrganizations$: (userId: UserId) => Observable<Organization[]>;
|
abstract memberOrganizations$(userId: UserId): Observable<Organization[]>;
|
||||||
/**
|
/**
|
||||||
* Emits true if the user can create or manage a Free Bitwarden Families sponsorship.
|
* Emits true if the user can create or manage a Free Bitwarden Families sponsorship.
|
||||||
*/
|
*/
|
||||||
canManageSponsorships$: (userId: UserId) => Observable<boolean>;
|
abstract canManageSponsorships$(userId: UserId): Observable<boolean>;
|
||||||
/**
|
/**
|
||||||
* Emits true if any of the user's organizations have a Free Bitwarden Families sponsorship available.
|
* Emits true if any of the user's organizations have a Free Bitwarden Families sponsorship available.
|
||||||
*/
|
*/
|
||||||
familySponsorshipAvailable$: (userId: UserId) => Observable<boolean>;
|
abstract familySponsorshipAvailable$(userId: UserId): Observable<boolean>;
|
||||||
hasOrganizations: (userId: UserId) => Observable<boolean>;
|
abstract hasOrganizations(userId: UserId): Observable<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +94,7 @@ export abstract class InternalOrganizationServiceAbstraction extends Organizatio
|
|||||||
* @param organization The organization state being saved.
|
* @param organization The organization state being saved.
|
||||||
* @param userId The userId to replace state for.
|
* @param userId The userId to replace state for.
|
||||||
*/
|
*/
|
||||||
upsert: (OrganizationData: OrganizationData, userId: UserId) => Promise<void>;
|
abstract upsert(OrganizationData: OrganizationData, userId: UserId): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces state for the entire registered organization list for the specified user.
|
* Replaces state for the entire registered organization list for the specified user.
|
||||||
@@ -107,5 +105,8 @@ export abstract class InternalOrganizationServiceAbstraction extends Organizatio
|
|||||||
* user.
|
* user.
|
||||||
* @param userId The userId to replace state for.
|
* @param userId The userId to replace state for.
|
||||||
*/
|
*/
|
||||||
replace: (organizations: { [id: string]: OrganizationData }, userId: UserId) => Promise<void>;
|
abstract replace(
|
||||||
|
organizations: { [id: string]: OrganizationData },
|
||||||
|
userId: UserId,
|
||||||
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { UserId } from "../../types/guid";
|
import { UserId } from "../../types/guid";
|
||||||
@@ -7,8 +5,8 @@ import { ProviderData } from "../models/data/provider.data";
|
|||||||
import { Provider } from "../models/domain/provider";
|
import { Provider } from "../models/domain/provider";
|
||||||
|
|
||||||
export abstract class ProviderService {
|
export abstract class ProviderService {
|
||||||
get$: (id: string) => Observable<Provider>;
|
abstract get$(id: string): Observable<Provider>;
|
||||||
get: (id: string) => Promise<Provider>;
|
abstract get(id: string): Promise<Provider>;
|
||||||
getAll: () => Promise<Provider[]>;
|
abstract getAll(): Promise<Provider[]>;
|
||||||
save: (providers: { [id: string]: ProviderData }, userId?: UserId) => Promise<any>;
|
abstract save(providers: { [id: string]: ProviderData }, userId?: UserId): Promise<any>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { AddableOrganizationResponse } from "@bitwarden/common/admin-console/models/response/addable-organization.response";
|
import { AddableOrganizationResponse } from "@bitwarden/common/admin-console/models/response/addable-organization.response";
|
||||||
|
|
||||||
import { ProviderSetupRequest } from "../../models/request/provider/provider-setup.request";
|
import { ProviderSetupRequest } from "../../models/request/provider/provider-setup.request";
|
||||||
@@ -7,21 +5,23 @@ import { ProviderUpdateRequest } from "../../models/request/provider/provider-up
|
|||||||
import { ProviderVerifyRecoverDeleteRequest } from "../../models/request/provider/provider-verify-recover-delete.request";
|
import { ProviderVerifyRecoverDeleteRequest } from "../../models/request/provider/provider-verify-recover-delete.request";
|
||||||
import { ProviderResponse } from "../../models/response/provider/provider.response";
|
import { ProviderResponse } from "../../models/response/provider/provider.response";
|
||||||
|
|
||||||
export class ProviderApiServiceAbstraction {
|
export abstract class ProviderApiServiceAbstraction {
|
||||||
postProviderSetup: (id: string, request: ProviderSetupRequest) => Promise<ProviderResponse>;
|
abstract postProviderSetup(id: string, request: ProviderSetupRequest): Promise<ProviderResponse>;
|
||||||
getProvider: (id: string) => Promise<ProviderResponse>;
|
abstract getProvider(id: string): Promise<ProviderResponse>;
|
||||||
putProvider: (id: string, request: ProviderUpdateRequest) => Promise<ProviderResponse>;
|
abstract putProvider(id: string, request: ProviderUpdateRequest): Promise<ProviderResponse>;
|
||||||
providerRecoverDeleteToken: (
|
abstract providerRecoverDeleteToken(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: ProviderVerifyRecoverDeleteRequest,
|
request: ProviderVerifyRecoverDeleteRequest,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
deleteProvider: (id: string) => Promise<void>;
|
abstract deleteProvider(id: string): Promise<void>;
|
||||||
getProviderAddableOrganizations: (providerId: string) => Promise<AddableOrganizationResponse[]>;
|
abstract getProviderAddableOrganizations(
|
||||||
addOrganizationToProvider: (
|
providerId: string,
|
||||||
|
): Promise<AddableOrganizationResponse[]>;
|
||||||
|
abstract addOrganizationToProvider(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: {
|
request: {
|
||||||
key: string;
|
key: string;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
},
|
},
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { UserId } from "../../types/guid";
|
import { UserId } from "../../types/guid";
|
||||||
@@ -35,20 +33,20 @@ export function accountInfoEqual(a: AccountInfo, b: AccountInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export abstract class AccountService {
|
export abstract class AccountService {
|
||||||
accounts$: Observable<Record<UserId, AccountInfo>>;
|
abstract accounts$: Observable<Record<UserId, AccountInfo>>;
|
||||||
|
|
||||||
activeAccount$: Observable<Account | null>;
|
abstract activeAccount$: Observable<Account | null>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Observable of the last activity time for each account.
|
* Observable of the last activity time for each account.
|
||||||
*/
|
*/
|
||||||
accountActivity$: Observable<Record<UserId, Date>>;
|
abstract accountActivity$: Observable<Record<UserId, Date>>;
|
||||||
/** Observable of the new device login verification property for the account. */
|
/** Observable of the new device login verification property for the account. */
|
||||||
accountVerifyNewDeviceLogin$: Observable<boolean>;
|
abstract accountVerifyNewDeviceLogin$: Observable<boolean>;
|
||||||
/** Account list in order of descending recency */
|
/** Account list in order of descending recency */
|
||||||
sortedUserIds$: Observable<UserId[]>;
|
abstract sortedUserIds$: Observable<UserId[]>;
|
||||||
/** Next account that is not the current active account */
|
/** Next account that is not the current active account */
|
||||||
nextUpAccount$: Observable<Account>;
|
abstract nextUpAccount$: Observable<Account>;
|
||||||
/**
|
/**
|
||||||
* Updates the `accounts$` observable with the new account data.
|
* Updates the `accounts$` observable with the new account data.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
export abstract class AnonymousHubService {
|
export abstract class AnonymousHubService {
|
||||||
createHubConnection: (token: string) => Promise<void>;
|
abstract createHubConnection(token: string): Promise<void>;
|
||||||
stopHubConnection: () => Promise<void>;
|
abstract stopHubConnection(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { UserId } from "../../types/guid";
|
import { UserId } from "../../types/guid";
|
||||||
@@ -9,7 +7,7 @@ export abstract class AvatarService {
|
|||||||
* An observable monitoring the active user's avatar color.
|
* An observable monitoring the active user's avatar color.
|
||||||
* The observable updates when the avatar color changes.
|
* The observable updates when the avatar color changes.
|
||||||
*/
|
*/
|
||||||
avatarColor$: Observable<string | null>;
|
abstract avatarColor$: Observable<string | null>;
|
||||||
/**
|
/**
|
||||||
* Sets the avatar color of the active user
|
* Sets the avatar color of the active user
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,47 +1,45 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { ListResponse } from "../../models/response/list.response";
|
import { ListResponse } from "../../models/response/list.response";
|
||||||
import { DeviceResponse } from "../abstractions/devices/responses/device.response";
|
import { DeviceResponse } from "../abstractions/devices/responses/device.response";
|
||||||
import { UpdateDevicesTrustRequest } from "../models/request/update-devices-trust.request";
|
import { UpdateDevicesTrustRequest } from "../models/request/update-devices-trust.request";
|
||||||
import { ProtectedDeviceResponse } from "../models/response/protected-device.response";
|
import { ProtectedDeviceResponse } from "../models/response/protected-device.response";
|
||||||
|
|
||||||
export abstract class DevicesApiServiceAbstraction {
|
export abstract class DevicesApiServiceAbstraction {
|
||||||
getKnownDevice: (email: string, deviceIdentifier: string) => Promise<boolean>;
|
abstract getKnownDevice(email: string, deviceIdentifier: string): Promise<boolean>;
|
||||||
|
|
||||||
getDeviceByIdentifier: (deviceIdentifier: string) => Promise<DeviceResponse>;
|
abstract getDeviceByIdentifier(deviceIdentifier: string): Promise<DeviceResponse>;
|
||||||
|
|
||||||
getDevices: () => Promise<ListResponse<DeviceResponse>>;
|
abstract getDevices(): Promise<ListResponse<DeviceResponse>>;
|
||||||
|
|
||||||
updateTrustedDeviceKeys: (
|
abstract updateTrustedDeviceKeys(
|
||||||
deviceIdentifier: string,
|
deviceIdentifier: string,
|
||||||
devicePublicKeyEncryptedUserKey: string,
|
devicePublicKeyEncryptedUserKey: string,
|
||||||
userKeyEncryptedDevicePublicKey: string,
|
userKeyEncryptedDevicePublicKey: string,
|
||||||
deviceKeyEncryptedDevicePrivateKey: string,
|
deviceKeyEncryptedDevicePrivateKey: string,
|
||||||
) => Promise<DeviceResponse>;
|
): Promise<DeviceResponse>;
|
||||||
|
|
||||||
updateTrust: (
|
abstract updateTrust(
|
||||||
updateDevicesTrustRequestModel: UpdateDevicesTrustRequest,
|
updateDevicesTrustRequestModel: UpdateDevicesTrustRequest,
|
||||||
deviceIdentifier: string,
|
deviceIdentifier: string,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
getDeviceKeys: (deviceIdentifier: string) => Promise<ProtectedDeviceResponse>;
|
abstract getDeviceKeys(deviceIdentifier: string): Promise<ProtectedDeviceResponse>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the server that the device has a device key, but didn't receive any associated decryption keys.
|
* Notifies the server that the device has a device key, but didn't receive any associated decryption keys.
|
||||||
* Note: For debugging purposes only.
|
* Note: For debugging purposes only.
|
||||||
* @param deviceIdentifier - current device identifier
|
* @param deviceIdentifier - current device identifier
|
||||||
*/
|
*/
|
||||||
postDeviceTrustLoss: (deviceIdentifier: string) => Promise<void>;
|
abstract postDeviceTrustLoss(deviceIdentifier: string): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deactivates a device
|
* Deactivates a device
|
||||||
* @param deviceId - The device ID
|
* @param deviceId - The device ID
|
||||||
*/
|
*/
|
||||||
deactivateDevice: (deviceId: string) => Promise<void>;
|
abstract deactivateDevice(deviceId: string): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes trust from a list of devices
|
* Removes trust from a list of devices
|
||||||
* @param deviceIds - The device IDs to be untrusted
|
* @param deviceIds - The device IDs to be untrusted
|
||||||
*/
|
*/
|
||||||
untrustDevices: (deviceIds: string[]) => Promise<void>;
|
abstract untrustDevices(deviceIds: string[]): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { VaultTimeout, VaultTimeoutAction } from "../../key-management/vault-timeout";
|
import { VaultTimeout, VaultTimeoutAction } from "../../key-management/vault-timeout";
|
||||||
@@ -27,20 +25,20 @@ export abstract class TokenService {
|
|||||||
*
|
*
|
||||||
* @returns A promise that resolves with the SetTokensResult containing the tokens that were set.
|
* @returns A promise that resolves with the SetTokensResult containing the tokens that were set.
|
||||||
*/
|
*/
|
||||||
setTokens: (
|
abstract setTokens(
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
vaultTimeoutAction: VaultTimeoutAction,
|
vaultTimeoutAction: VaultTimeoutAction,
|
||||||
vaultTimeout: VaultTimeout,
|
vaultTimeout: VaultTimeout,
|
||||||
refreshToken?: string,
|
refreshToken?: string,
|
||||||
clientIdClientSecret?: [string, string],
|
clientIdClientSecret?: [string, string],
|
||||||
) => Promise<SetTokensResult>;
|
): Promise<SetTokensResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the access token, refresh token, API Key Client ID, and API Key Client Secret out of memory, disk, and secure storage if supported.
|
* Clears the access token, refresh token, API Key Client ID, and API Key Client Secret out of memory, disk, and secure storage if supported.
|
||||||
* @param userId The optional user id to clear the tokens for; if not provided, the active user id is used.
|
* @param userId The optional user id to clear the tokens for; if not provided, the active user id is used.
|
||||||
* @returns A promise that resolves when the tokens have been cleared.
|
* @returns A promise that resolves when the tokens have been cleared.
|
||||||
*/
|
*/
|
||||||
clearTokens: (userId?: UserId) => Promise<void>;
|
abstract clearTokens(userId?: UserId): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the access token in memory or disk based on the given vaultTimeoutAction and vaultTimeout
|
* Sets the access token in memory or disk based on the given vaultTimeoutAction and vaultTimeout
|
||||||
@@ -51,11 +49,11 @@ export abstract class TokenService {
|
|||||||
* @param vaultTimeout The timeout for the vault.
|
* @param vaultTimeout The timeout for the vault.
|
||||||
* @returns A promise that resolves with the access token that has been set.
|
* @returns A promise that resolves with the access token that has been set.
|
||||||
*/
|
*/
|
||||||
setAccessToken: (
|
abstract setAccessToken(
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
vaultTimeoutAction: VaultTimeoutAction,
|
vaultTimeoutAction: VaultTimeoutAction,
|
||||||
vaultTimeout: VaultTimeout,
|
vaultTimeout: VaultTimeout,
|
||||||
) => Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
// TODO: revisit having this public clear method approach once the state service is fully deprecated.
|
// TODO: revisit having this public clear method approach once the state service is fully deprecated.
|
||||||
/**
|
/**
|
||||||
@@ -67,21 +65,21 @@ export abstract class TokenService {
|
|||||||
* pass in the vaultTimeoutAction and vaultTimeout.
|
* pass in the vaultTimeoutAction and vaultTimeout.
|
||||||
* This avoids a circular dependency between the StateService, TokenService, and VaultTimeoutSettingsService.
|
* This avoids a circular dependency between the StateService, TokenService, and VaultTimeoutSettingsService.
|
||||||
*/
|
*/
|
||||||
clearAccessToken: (userId?: UserId) => Promise<void>;
|
abstract clearAccessToken(userId?: UserId): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the access token
|
* Gets the access token
|
||||||
* @param userId - The optional user id to get the access token for; if not provided, the active user is used.
|
* @param userId - The optional user id to get the access token for; if not provided, the active user is used.
|
||||||
* @returns A promise that resolves with the access token or null.
|
* @returns A promise that resolves with the access token or null.
|
||||||
*/
|
*/
|
||||||
getAccessToken: (userId?: UserId) => Promise<string | null>;
|
abstract getAccessToken(userId?: UserId): Promise<string | null>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the refresh token.
|
* Gets the refresh token.
|
||||||
* @param userId - The optional user id to get the refresh token for; if not provided, the active user is used.
|
* @param userId - The optional user id to get the refresh token for; if not provided, the active user is used.
|
||||||
* @returns A promise that resolves with the refresh token or null.
|
* @returns A promise that resolves with the refresh token or null.
|
||||||
*/
|
*/
|
||||||
getRefreshToken: (userId?: UserId) => Promise<string | null>;
|
abstract getRefreshToken(userId?: UserId): Promise<string | null>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the API Key Client ID for the active user id in memory or disk based on the given vaultTimeoutAction and vaultTimeout.
|
* Sets the API Key Client ID for the active user id in memory or disk based on the given vaultTimeoutAction and vaultTimeout.
|
||||||
@@ -90,18 +88,18 @@ export abstract class TokenService {
|
|||||||
* @param vaultTimeout The timeout for the vault.
|
* @param vaultTimeout The timeout for the vault.
|
||||||
* @returns A promise that resolves with the API Key Client ID that has been set.
|
* @returns A promise that resolves with the API Key Client ID that has been set.
|
||||||
*/
|
*/
|
||||||
setClientId: (
|
abstract setClientId(
|
||||||
clientId: string,
|
clientId: string,
|
||||||
vaultTimeoutAction: VaultTimeoutAction,
|
vaultTimeoutAction: VaultTimeoutAction,
|
||||||
vaultTimeout: VaultTimeout,
|
vaultTimeout: VaultTimeout,
|
||||||
userId?: UserId,
|
userId?: UserId,
|
||||||
) => Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the API Key Client ID for the active user.
|
* Gets the API Key Client ID for the active user.
|
||||||
* @returns A promise that resolves with the API Key Client ID or undefined
|
* @returns A promise that resolves with the API Key Client ID or undefined
|
||||||
*/
|
*/
|
||||||
getClientId: (userId?: UserId) => Promise<string | undefined>;
|
abstract getClientId(userId?: UserId): Promise<string | undefined>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the API Key Client Secret for the active user id in memory or disk based on the given vaultTimeoutAction and vaultTimeout.
|
* Sets the API Key Client Secret for the active user id in memory or disk based on the given vaultTimeoutAction and vaultTimeout.
|
||||||
@@ -110,18 +108,18 @@ export abstract class TokenService {
|
|||||||
* @param vaultTimeout The timeout for the vault.
|
* @param vaultTimeout The timeout for the vault.
|
||||||
* @returns A promise that resolves with the client secret that has been set.
|
* @returns A promise that resolves with the client secret that has been set.
|
||||||
*/
|
*/
|
||||||
setClientSecret: (
|
abstract setClientSecret(
|
||||||
clientSecret: string,
|
clientSecret: string,
|
||||||
vaultTimeoutAction: VaultTimeoutAction,
|
vaultTimeoutAction: VaultTimeoutAction,
|
||||||
vaultTimeout: VaultTimeout,
|
vaultTimeout: VaultTimeout,
|
||||||
userId?: UserId,
|
userId?: UserId,
|
||||||
) => Promise<string>;
|
): Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the API Key Client Secret for the active user.
|
* Gets the API Key Client Secret for the active user.
|
||||||
* @returns A promise that resolves with the API Key Client Secret or undefined
|
* @returns A promise that resolves with the API Key Client Secret or undefined
|
||||||
*/
|
*/
|
||||||
getClientSecret: (userId?: UserId) => Promise<string | undefined>;
|
abstract getClientSecret(userId?: UserId): Promise<string | undefined>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the two factor token for the given email in global state.
|
* Sets the two factor token for the given email in global state.
|
||||||
@@ -131,21 +129,21 @@ export abstract class TokenService {
|
|||||||
* @param twoFactorToken The two factor token to set.
|
* @param twoFactorToken The two factor token to set.
|
||||||
* @returns A promise that resolves when the two factor token has been set.
|
* @returns A promise that resolves when the two factor token has been set.
|
||||||
*/
|
*/
|
||||||
setTwoFactorToken: (email: string, twoFactorToken: string) => Promise<void>;
|
abstract setTwoFactorToken(email: string, twoFactorToken: string): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the two factor token for the given email.
|
* Gets the two factor token for the given email.
|
||||||
* @param email The email to get the two factor token for.
|
* @param email The email to get the two factor token for.
|
||||||
* @returns A promise that resolves with the two factor token for the given email or null if it isn't found.
|
* @returns A promise that resolves with the two factor token for the given email or null if it isn't found.
|
||||||
*/
|
*/
|
||||||
getTwoFactorToken: (email: string) => Promise<string | null>;
|
abstract getTwoFactorToken(email: string): Promise<string | null>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the two factor token for the given email out of global state.
|
* Clears the two factor token for the given email out of global state.
|
||||||
* @param email The email to clear the two factor token for.
|
* @param email The email to clear the two factor token for.
|
||||||
* @returns A promise that resolves when the two factor token has been cleared.
|
* @returns A promise that resolves when the two factor token has been cleared.
|
||||||
*/
|
*/
|
||||||
clearTwoFactorToken: (email: string) => Promise<void>;
|
abstract clearTwoFactorToken(email: string): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes the access token.
|
* Decodes the access token.
|
||||||
@@ -153,13 +151,13 @@ export abstract class TokenService {
|
|||||||
* If null, the currently active user's token is used.
|
* If null, the currently active user's token is used.
|
||||||
* @returns A promise that resolves with the decoded access token.
|
* @returns A promise that resolves with the decoded access token.
|
||||||
*/
|
*/
|
||||||
decodeAccessToken: (tokenOrUserId?: string | UserId) => Promise<DecodedAccessToken>;
|
abstract decodeAccessToken(tokenOrUserId?: string | UserId): Promise<DecodedAccessToken>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the expiration date for the access token. Returns if token can't be decoded or has no expiration
|
* Gets the expiration date for the access token. Returns if token can't be decoded or has no expiration
|
||||||
* @returns A promise that resolves with the expiration date for the access token.
|
* @returns A promise that resolves with the expiration date for the access token.
|
||||||
*/
|
*/
|
||||||
getTokenExpirationDate: () => Promise<Date | null>;
|
abstract getTokenExpirationDate(): Promise<Date | null>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the adjusted time in seconds until the access token expires, considering an optional offset.
|
* Calculates the adjusted time in seconds until the access token expires, considering an optional offset.
|
||||||
@@ -170,58 +168,58 @@ export abstract class TokenService {
|
|||||||
* based on the actual expiration.
|
* based on the actual expiration.
|
||||||
* @returns {Promise<number>} Promise resolving to the adjusted seconds remaining.
|
* @returns {Promise<number>} Promise resolving to the adjusted seconds remaining.
|
||||||
*/
|
*/
|
||||||
tokenSecondsRemaining: (offsetSeconds?: number) => Promise<number>;
|
abstract tokenSecondsRemaining(offsetSeconds?: number): Promise<number>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the access token needs to be refreshed.
|
* Checks if the access token needs to be refreshed.
|
||||||
* @param {number} [minutes=5] - Optional number of minutes before the access token expires to consider refreshing it.
|
* @param {number} [minutes=5] - Optional number of minutes before the access token expires to consider refreshing it.
|
||||||
* @returns A promise that resolves with a boolean indicating if the access token needs to be refreshed.
|
* @returns A promise that resolves with a boolean indicating if the access token needs to be refreshed.
|
||||||
*/
|
*/
|
||||||
tokenNeedsRefresh: (minutes?: number) => Promise<boolean>;
|
abstract tokenNeedsRefresh(minutes?: number): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user id for the active user from the access token.
|
* Gets the user id for the active user from the access token.
|
||||||
* @returns A promise that resolves with the user id for the active user.
|
* @returns A promise that resolves with the user id for the active user.
|
||||||
* @deprecated Use AccountService.activeAccount$ instead.
|
* @deprecated Use AccountService.activeAccount$ instead.
|
||||||
*/
|
*/
|
||||||
getUserId: () => Promise<UserId>;
|
abstract getUserId(): Promise<UserId>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the email for the active user from the access token.
|
* Gets the email for the active user from the access token.
|
||||||
* @returns A promise that resolves with the email for the active user.
|
* @returns A promise that resolves with the email for the active user.
|
||||||
* @deprecated Use AccountService.activeAccount$ instead.
|
* @deprecated Use AccountService.activeAccount$ instead.
|
||||||
*/
|
*/
|
||||||
getEmail: () => Promise<string>;
|
abstract getEmail(): Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the email verified status for the active user from the access token.
|
* Gets the email verified status for the active user from the access token.
|
||||||
* @returns A promise that resolves with the email verified status for the active user.
|
* @returns A promise that resolves with the email verified status for the active user.
|
||||||
*/
|
*/
|
||||||
getEmailVerified: () => Promise<boolean>;
|
abstract getEmailVerified(): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name for the active user from the access token.
|
* Gets the name for the active user from the access token.
|
||||||
* @returns A promise that resolves with the name for the active user.
|
* @returns A promise that resolves with the name for the active user.
|
||||||
* @deprecated Use AccountService.activeAccount$ instead.
|
* @deprecated Use AccountService.activeAccount$ instead.
|
||||||
*/
|
*/
|
||||||
getName: () => Promise<string>;
|
abstract getName(): Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the issuer for the active user from the access token.
|
* Gets the issuer for the active user from the access token.
|
||||||
* @returns A promise that resolves with the issuer for the active user.
|
* @returns A promise that resolves with the issuer for the active user.
|
||||||
*/
|
*/
|
||||||
getIssuer: () => Promise<string>;
|
abstract getIssuer(): Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether or not the user authenticated via an external mechanism.
|
* Gets whether or not the user authenticated via an external mechanism.
|
||||||
* @param userId The optional user id to check for external authN status; if not provided, the active user is used.
|
* @param userId The optional user id to check for external authN status; if not provided, the active user is used.
|
||||||
* @returns A promise that resolves with a boolean representing the user's external authN status.
|
* @returns A promise that resolves with a boolean representing the user's external authN status.
|
||||||
*/
|
*/
|
||||||
getIsExternal: (userId: UserId) => Promise<boolean>;
|
abstract getIsExternal(userId: UserId): Promise<boolean>;
|
||||||
|
|
||||||
/** Gets the active or passed in user's security stamp */
|
/** Gets the active or passed in user's security stamp */
|
||||||
getSecurityStamp: (userId?: UserId) => Promise<string | null>;
|
abstract getSecurityStamp(userId?: UserId): Promise<string | null>;
|
||||||
|
|
||||||
/** Sets the security stamp for the active or passed in user */
|
/** Sets the security stamp for the active or passed in user */
|
||||||
setSecurityStamp: (securityStamp: string, userId?: UserId) => Promise<void>;
|
abstract setSecurityStamp(securityStamp: string, userId?: UserId): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { SecretVerificationRequest } from "../../models/request/secret-verification.request";
|
import { SecretVerificationRequest } from "../../models/request/secret-verification.request";
|
||||||
import { VerifyOTPRequest } from "../../models/request/verify-otp.request";
|
import { VerifyOTPRequest } from "../../models/request/verify-otp.request";
|
||||||
import { MasterPasswordPolicyResponse } from "../../models/response/master-password-policy.response";
|
import { MasterPasswordPolicyResponse } from "../../models/response/master-password-policy.response";
|
||||||
|
|
||||||
export abstract class UserVerificationApiServiceAbstraction {
|
export abstract class UserVerificationApiServiceAbstraction {
|
||||||
postAccountVerifyOTP: (request: VerifyOTPRequest) => Promise<void>;
|
abstract postAccountVerifyOTP(request: VerifyOTPRequest): Promise<void>;
|
||||||
postAccountRequestOTP: () => Promise<void>;
|
abstract postAccountRequestOTP(): Promise<void>;
|
||||||
postAccountVerifyPassword: (
|
abstract postAccountVerifyPassword(
|
||||||
request: SecretVerificationRequest,
|
request: SecretVerificationRequest,
|
||||||
) => Promise<MasterPasswordPolicyResponse>;
|
): Promise<MasterPasswordPolicyResponse>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { UserId } from "../../../types/guid";
|
import { UserId } from "../../../types/guid";
|
||||||
import { SecretVerificationRequest } from "../../models/request/secret-verification.request";
|
import { SecretVerificationRequest } from "../../models/request/secret-verification.request";
|
||||||
import { UserVerificationOptions } from "../../types/user-verification-options";
|
import { UserVerificationOptions } from "../../types/user-verification-options";
|
||||||
@@ -16,9 +14,9 @@ export abstract class UserVerificationService {
|
|||||||
* @param verificationType Type of verification to restrict the options to
|
* @param verificationType Type of verification to restrict the options to
|
||||||
* @returns Available verification options for the user
|
* @returns Available verification options for the user
|
||||||
*/
|
*/
|
||||||
getAvailableVerificationOptions: (
|
abstract getAvailableVerificationOptions(
|
||||||
verificationType: keyof UserVerificationOptions,
|
verificationType: keyof UserVerificationOptions,
|
||||||
) => Promise<UserVerificationOptions>;
|
): Promise<UserVerificationOptions>;
|
||||||
/**
|
/**
|
||||||
* Create a new request model to be used for server-side verification
|
* Create a new request model to be used for server-side verification
|
||||||
* @param verification User-supplied verification data (Master Password or OTP)
|
* @param verification User-supplied verification data (Master Password or OTP)
|
||||||
@@ -26,11 +24,11 @@ export abstract class UserVerificationService {
|
|||||||
* @param alreadyHashed Whether the master password is already hashed
|
* @param alreadyHashed Whether the master password is already hashed
|
||||||
* @throws Error if the verification data is invalid
|
* @throws Error if the verification data is invalid
|
||||||
*/
|
*/
|
||||||
buildRequest: <T extends SecretVerificationRequest>(
|
abstract buildRequest<T extends SecretVerificationRequest>(
|
||||||
verification: Verification,
|
verification: Verification,
|
||||||
requestClass?: new () => T,
|
requestClass?: new () => T,
|
||||||
alreadyHashed?: boolean,
|
alreadyHashed?: boolean,
|
||||||
) => Promise<T>;
|
): Promise<T>;
|
||||||
/**
|
/**
|
||||||
* Verifies the user using the provided verification data.
|
* Verifies the user using the provided verification data.
|
||||||
* PIN or biometrics are verified client-side.
|
* PIN or biometrics are verified client-side.
|
||||||
@@ -39,11 +37,11 @@ export abstract class UserVerificationService {
|
|||||||
* @param verification User-supplied verification data (OTP, MP, PIN, or biometrics)
|
* @param verification User-supplied verification data (OTP, MP, PIN, or biometrics)
|
||||||
* @throws Error if the verification data is invalid or the verification fails
|
* @throws Error if the verification data is invalid or the verification fails
|
||||||
*/
|
*/
|
||||||
verifyUser: (verification: Verification) => Promise<boolean>;
|
abstract verifyUser(verification: Verification): Promise<boolean>;
|
||||||
/**
|
/**
|
||||||
* Request a one-time password (OTP) to be sent to the user's email
|
* Request a one-time password (OTP) to be sent to the user's email
|
||||||
*/
|
*/
|
||||||
requestOTP: () => Promise<void>;
|
abstract requestOTP(): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Check if user has master password or can only use passwordless technologies to log in
|
* Check if user has master password or can only use passwordless technologies to log in
|
||||||
* Note: This only checks the server, not the local state
|
* Note: This only checks the server, not the local state
|
||||||
@@ -51,13 +49,13 @@ export abstract class UserVerificationService {
|
|||||||
* @returns True if the user has a master password
|
* @returns True if the user has a master password
|
||||||
* @deprecated Use UserDecryptionOptionsService.hasMasterPassword$ instead
|
* @deprecated Use UserDecryptionOptionsService.hasMasterPassword$ instead
|
||||||
*/
|
*/
|
||||||
hasMasterPassword: (userId?: string) => Promise<boolean>;
|
abstract hasMasterPassword(userId?: string): Promise<boolean>;
|
||||||
/**
|
/**
|
||||||
* Check if the user has a master password and has used it during their current session
|
* Check if the user has a master password and has used it during their current session
|
||||||
* @param userId The user id to check. If not provided, the current user id used
|
* @param userId The user id to check. If not provided, the current user id used
|
||||||
* @returns True if the user has a master password and has used it in the current session
|
* @returns True if the user has a master password and has used it in the current session
|
||||||
*/
|
*/
|
||||||
hasMasterPasswordAndMasterKeyHash: (userId?: string) => Promise<boolean>;
|
abstract hasMasterPasswordAndMasterKeyHash(userId?: string): Promise<boolean>;
|
||||||
/**
|
/**
|
||||||
* Verifies the user using the provided master password.
|
* Verifies the user using the provided master password.
|
||||||
* Attempts to verify client-side first, then server-side if necessary.
|
* Attempts to verify client-side first, then server-side if necessary.
|
||||||
@@ -68,9 +66,9 @@ export abstract class UserVerificationService {
|
|||||||
* @throws Error if the master password is invalid
|
* @throws Error if the master password is invalid
|
||||||
* @returns An object containing the master key, and master password policy options if verified on server.
|
* @returns An object containing the master key, and master password policy options if verified on server.
|
||||||
*/
|
*/
|
||||||
verifyUserByMasterPassword: (
|
abstract verifyUserByMasterPassword(
|
||||||
verification: MasterPasswordVerification,
|
verification: MasterPasswordVerification,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
email: string,
|
email: string,
|
||||||
) => Promise<MasterPasswordVerificationResponse>;
|
): Promise<MasterPasswordVerificationResponse>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { CredentialAssertionOptionsResponse } from "../../services/webauthn-login/response/credential-assertion-options.response";
|
import { CredentialAssertionOptionsResponse } from "../../services/webauthn-login/response/credential-assertion-options.response";
|
||||||
|
|
||||||
export class WebAuthnLoginApiServiceAbstraction {
|
export abstract class WebAuthnLoginApiServiceAbstraction {
|
||||||
getCredentialAssertionOptions: () => Promise<CredentialAssertionOptionsResponse>;
|
abstract getCredentialAssertionOptions(): Promise<CredentialAssertionOptionsResponse>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { PrfKey } from "../../../types/key";
|
import { PrfKey } from "../../../types/key";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,11 +7,11 @@ export abstract class WebAuthnLoginPrfKeyServiceAbstraction {
|
|||||||
/**
|
/**
|
||||||
* Get the salt used to generate the PRF-output used when logging in with WebAuthn.
|
* Get the salt used to generate the PRF-output used when logging in with WebAuthn.
|
||||||
*/
|
*/
|
||||||
getLoginWithPrfSalt: () => Promise<ArrayBuffer>;
|
abstract getLoginWithPrfSalt(): Promise<ArrayBuffer>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a symmetric key from the PRF-output by stretching it.
|
* Create a symmetric key from the PRF-output by stretching it.
|
||||||
* This should be used as `ExternalKey` with `RotateableKeySet`.
|
* This should be used as `ExternalKey` with `RotateableKeySet`.
|
||||||
*/
|
*/
|
||||||
createSymmetricKeyFromPrf: (prf: ArrayBuffer) => Promise<PrfKey>;
|
abstract createSymmetricKeyFromPrf(prf: ArrayBuffer): Promise<PrfKey>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { AuthResult } from "../../models/domain/auth-result";
|
import { AuthResult } from "../../models/domain/auth-result";
|
||||||
import { WebAuthnLoginCredentialAssertionOptionsView } from "../../models/view/webauthn-login/webauthn-login-credential-assertion-options.view";
|
import { WebAuthnLoginCredentialAssertionOptionsView } from "../../models/view/webauthn-login/webauthn-login-credential-assertion-options.view";
|
||||||
import { WebAuthnLoginCredentialAssertionView } from "../../models/view/webauthn-login/webauthn-login-credential-assertion.view";
|
import { WebAuthnLoginCredentialAssertionView } from "../../models/view/webauthn-login/webauthn-login-credential-assertion.view";
|
||||||
@@ -14,7 +12,7 @@ export abstract class WebAuthnLoginServiceAbstraction {
|
|||||||
* (whether FIDO2 user verification is required, the relying party id, timeout duration for the process to complete, etc.)
|
* (whether FIDO2 user verification is required, the relying party id, timeout duration for the process to complete, etc.)
|
||||||
* for the authenticator.
|
* for the authenticator.
|
||||||
*/
|
*/
|
||||||
getCredentialAssertionOptions: () => Promise<WebAuthnLoginCredentialAssertionOptionsView>;
|
abstract getCredentialAssertionOptions(): Promise<WebAuthnLoginCredentialAssertionOptionsView>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts the credential. This involves user interaction with the authenticator
|
* Asserts the credential. This involves user interaction with the authenticator
|
||||||
@@ -27,9 +25,9 @@ export abstract class WebAuthnLoginServiceAbstraction {
|
|||||||
* @returns {WebAuthnLoginCredentialAssertionView} The assertion obtained from the authenticator.
|
* @returns {WebAuthnLoginCredentialAssertionView} The assertion obtained from the authenticator.
|
||||||
* If the assertion is not successfully obtained, it returns undefined.
|
* If the assertion is not successfully obtained, it returns undefined.
|
||||||
*/
|
*/
|
||||||
assertCredential: (
|
abstract assertCredential(
|
||||||
credentialAssertionOptions: WebAuthnLoginCredentialAssertionOptionsView,
|
credentialAssertionOptions: WebAuthnLoginCredentialAssertionOptionsView,
|
||||||
) => Promise<WebAuthnLoginCredentialAssertionView | undefined>;
|
): Promise<WebAuthnLoginCredentialAssertionView | undefined>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the user in using the assertion obtained from the authenticator.
|
* Logs the user in using the assertion obtained from the authenticator.
|
||||||
@@ -39,5 +37,5 @@ export abstract class WebAuthnLoginServiceAbstraction {
|
|||||||
* @param {WebAuthnLoginCredentialAssertionView} assertion - The assertion obtained from the authenticator
|
* @param {WebAuthnLoginCredentialAssertionView} assertion - The assertion obtained from the authenticator
|
||||||
* that needs to be validated for login.
|
* that needs to be validated for login.
|
||||||
*/
|
*/
|
||||||
logIn: (assertion: WebAuthnLoginCredentialAssertionView) => Promise<AuthResult>;
|
abstract logIn(assertion: WebAuthnLoginCredentialAssertionView): Promise<AuthResult>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import {
|
import {
|
||||||
BillingInvoiceResponse,
|
BillingInvoiceResponse,
|
||||||
BillingTransactionResponse,
|
BillingTransactionResponse,
|
||||||
} from "../../models/response/billing.response";
|
} from "../../models/response/billing.response";
|
||||||
|
|
||||||
export class AccountBillingApiServiceAbstraction {
|
export abstract class AccountBillingApiServiceAbstraction {
|
||||||
getBillingInvoices: (status?: string, startAfter?: string) => Promise<BillingInvoiceResponse[]>;
|
abstract getBillingInvoices(
|
||||||
getBillingTransactions: (startAfter?: string) => Promise<BillingTransactionResponse[]>;
|
status?: string,
|
||||||
|
startAfter?: string,
|
||||||
|
): Promise<BillingInvoiceResponse[]>;
|
||||||
|
abstract getBillingTransactions(startAfter?: string): Promise<BillingTransactionResponse[]>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { UserId } from "../../../types/guid";
|
import { UserId } from "../../../types/guid";
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
|
|
||||||
import { TaxInfoResponse } from "@bitwarden/common/billing/models/response/tax-info.response";
|
import { TaxInfoResponse } from "@bitwarden/common/billing/models/response/tax-info.response";
|
||||||
|
|
||||||
import { OrganizationCreateRequest } from "../../admin-console/models/request/organization-create.request";
|
import { OrganizationCreateRequest } from "../../admin-console/models/request/organization-create.request";
|
||||||
@@ -20,78 +17,78 @@ import { PaymentMethodResponse } from "../models/response/payment-method.respons
|
|||||||
import { ProviderSubscriptionResponse } from "../models/response/provider-subscription-response";
|
import { ProviderSubscriptionResponse } from "../models/response/provider-subscription-response";
|
||||||
|
|
||||||
export abstract class BillingApiServiceAbstraction {
|
export abstract class BillingApiServiceAbstraction {
|
||||||
cancelOrganizationSubscription: (
|
abstract cancelOrganizationSubscription(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: SubscriptionCancellationRequest,
|
request: SubscriptionCancellationRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
cancelPremiumUserSubscription: (request: SubscriptionCancellationRequest) => Promise<void>;
|
abstract cancelPremiumUserSubscription(request: SubscriptionCancellationRequest): Promise<void>;
|
||||||
|
|
||||||
createProviderClientOrganization: (
|
abstract createProviderClientOrganization(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: CreateClientOrganizationRequest,
|
request: CreateClientOrganizationRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
createSetupIntent: (paymentMethodType: PaymentMethodType) => Promise<string>;
|
abstract createSetupIntent(paymentMethodType: PaymentMethodType): Promise<string>;
|
||||||
|
|
||||||
getOrganizationBillingMetadata: (
|
abstract getOrganizationBillingMetadata(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
) => Promise<OrganizationBillingMetadataResponse>;
|
): Promise<OrganizationBillingMetadataResponse>;
|
||||||
|
|
||||||
getOrganizationPaymentMethod: (organizationId: string) => Promise<PaymentMethodResponse>;
|
abstract getOrganizationPaymentMethod(organizationId: string): Promise<PaymentMethodResponse>;
|
||||||
|
|
||||||
getPlans: () => Promise<ListResponse<PlanResponse>>;
|
abstract getPlans(): Promise<ListResponse<PlanResponse>>;
|
||||||
|
|
||||||
getProviderClientInvoiceReport: (providerId: string, invoiceId: string) => Promise<string>;
|
abstract getProviderClientInvoiceReport(providerId: string, invoiceId: string): Promise<string>;
|
||||||
|
|
||||||
getProviderClientOrganizations: (
|
abstract getProviderClientOrganizations(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
) => Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
|
): Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
|
||||||
|
|
||||||
getProviderInvoices: (providerId: string) => Promise<InvoicesResponse>;
|
abstract getProviderInvoices(providerId: string): Promise<InvoicesResponse>;
|
||||||
|
|
||||||
getProviderSubscription: (providerId: string) => Promise<ProviderSubscriptionResponse>;
|
abstract getProviderSubscription(providerId: string): Promise<ProviderSubscriptionResponse>;
|
||||||
|
|
||||||
getProviderTaxInformation: (providerId: string) => Promise<TaxInfoResponse>;
|
abstract getProviderTaxInformation(providerId: string): Promise<TaxInfoResponse>;
|
||||||
|
|
||||||
updateOrganizationPaymentMethod: (
|
abstract updateOrganizationPaymentMethod(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: UpdatePaymentMethodRequest,
|
request: UpdatePaymentMethodRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
updateOrganizationTaxInformation: (
|
abstract updateOrganizationTaxInformation(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: ExpandedTaxInfoUpdateRequest,
|
request: ExpandedTaxInfoUpdateRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
updateProviderClientOrganization: (
|
abstract updateProviderClientOrganization(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: UpdateClientOrganizationRequest,
|
request: UpdateClientOrganizationRequest,
|
||||||
) => Promise<any>;
|
): Promise<any>;
|
||||||
|
|
||||||
updateProviderPaymentMethod: (
|
abstract updateProviderPaymentMethod(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: UpdatePaymentMethodRequest,
|
request: UpdatePaymentMethodRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
updateProviderTaxInformation: (
|
abstract updateProviderTaxInformation(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: ExpandedTaxInfoUpdateRequest,
|
request: ExpandedTaxInfoUpdateRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
verifyOrganizationBankAccount: (
|
abstract verifyOrganizationBankAccount(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: VerifyBankAccountRequest,
|
request: VerifyBankAccountRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
verifyProviderBankAccount: (
|
abstract verifyProviderBankAccount(
|
||||||
providerId: string,
|
providerId: string,
|
||||||
request: VerifyBankAccountRequest,
|
request: VerifyBankAccountRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
restartSubscription: (
|
abstract restartSubscription(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
request: OrganizationCreateRequest,
|
request: OrganizationCreateRequest,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||||
@@ -49,20 +47,22 @@ export type SubscriptionInformation = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export abstract class OrganizationBillingServiceAbstraction {
|
export abstract class OrganizationBillingServiceAbstraction {
|
||||||
getPaymentSource: (organizationId: string) => Promise<PaymentSourceResponse>;
|
abstract getPaymentSource(organizationId: string): Promise<PaymentSourceResponse>;
|
||||||
|
|
||||||
purchaseSubscription: (subscription: SubscriptionInformation) => Promise<OrganizationResponse>;
|
abstract purchaseSubscription(
|
||||||
|
|
||||||
purchaseSubscriptionNoPaymentMethod: (
|
|
||||||
subscription: SubscriptionInformation,
|
subscription: SubscriptionInformation,
|
||||||
) => Promise<OrganizationResponse>;
|
): Promise<OrganizationResponse>;
|
||||||
|
|
||||||
startFree: (subscription: SubscriptionInformation) => Promise<OrganizationResponse>;
|
abstract purchaseSubscriptionNoPaymentMethod(
|
||||||
|
subscription: SubscriptionInformation,
|
||||||
|
): Promise<OrganizationResponse>;
|
||||||
|
|
||||||
restartSubscription: (
|
abstract startFree(subscription: SubscriptionInformation): Promise<OrganizationResponse>;
|
||||||
|
|
||||||
|
abstract restartSubscription(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
subscription: SubscriptionInformation,
|
subscription: SubscriptionInformation,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if breadcrumbing policies is enabled for the organizations meeting certain criteria.
|
* Determines if breadcrumbing policies is enabled for the organizations meeting certain criteria.
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { OtherDeviceKeysUpdateRequest } from "@bitwarden/common/auth/models/request/update-devices-trust.request";
|
import { OtherDeviceKeysUpdateRequest } from "@bitwarden/common/auth/models/request/update-devices-trust.request";
|
||||||
@@ -15,51 +13,51 @@ export abstract class DeviceTrustServiceAbstraction {
|
|||||||
* by Platform
|
* by Platform
|
||||||
* @description Checks if the device trust feature is supported for the active user.
|
* @description Checks if the device trust feature is supported for the active user.
|
||||||
*/
|
*/
|
||||||
supportsDeviceTrust$: Observable<boolean>;
|
abstract supportsDeviceTrust$: Observable<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emits when a device has been trusted. This emission is specifically for the purpose of notifying
|
* Emits when a device has been trusted. This emission is specifically for the purpose of notifying
|
||||||
* the consuming component to display a toast informing the user the device has been trusted.
|
* the consuming component to display a toast informing the user the device has been trusted.
|
||||||
*/
|
*/
|
||||||
deviceTrusted$: Observable<void>;
|
abstract deviceTrusted$: Observable<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Checks if the device trust feature is supported for the given user.
|
* @description Checks if the device trust feature is supported for the given user.
|
||||||
*/
|
*/
|
||||||
supportsDeviceTrustByUserId$: (userId: UserId) => Observable<boolean>;
|
abstract supportsDeviceTrustByUserId$(userId: UserId): Observable<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Retrieves the users choice to trust the device which can only happen after decryption
|
* @description Retrieves the users choice to trust the device which can only happen after decryption
|
||||||
* Note: this value should only be used once and then reset
|
* Note: this value should only be used once and then reset
|
||||||
*/
|
*/
|
||||||
getShouldTrustDevice: (userId: UserId) => Promise<boolean | null>;
|
abstract getShouldTrustDevice(userId: UserId): Promise<boolean | null>;
|
||||||
setShouldTrustDevice: (userId: UserId, value: boolean) => Promise<void>;
|
abstract setShouldTrustDevice(userId: UserId, value: boolean): Promise<void>;
|
||||||
|
|
||||||
trustDeviceIfRequired: (userId: UserId) => Promise<void>;
|
abstract trustDeviceIfRequired(userId: UserId): Promise<void>;
|
||||||
|
|
||||||
trustDevice: (userId: UserId) => Promise<DeviceResponse>;
|
abstract trustDevice(userId: UserId): Promise<DeviceResponse>;
|
||||||
|
|
||||||
/** Retrieves the device key if it exists from state or secure storage if supported for the active user. */
|
/** Retrieves the device key if it exists from state or secure storage if supported for the active user. */
|
||||||
getDeviceKey: (userId: UserId) => Promise<DeviceKey | null>;
|
abstract getDeviceKey(userId: UserId): Promise<DeviceKey | null>;
|
||||||
decryptUserKeyWithDeviceKey: (
|
abstract decryptUserKeyWithDeviceKey(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
encryptedDevicePrivateKey: EncString,
|
encryptedDevicePrivateKey: EncString,
|
||||||
encryptedUserKey: EncString,
|
encryptedUserKey: EncString,
|
||||||
deviceKey: DeviceKey,
|
deviceKey: DeviceKey,
|
||||||
) => Promise<UserKey | null>;
|
): Promise<UserKey | null>;
|
||||||
rotateDevicesTrust: (
|
abstract rotateDevicesTrust(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
newUserKey: UserKey,
|
newUserKey: UserKey,
|
||||||
masterPasswordHash: string,
|
masterPasswordHash: string,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Notifies the server that the device has a device key, but didn't receive any associated decryption keys.
|
* Notifies the server that the device has a device key, but didn't receive any associated decryption keys.
|
||||||
* Note: For debugging purposes only.
|
* Note: For debugging purposes only.
|
||||||
*/
|
*/
|
||||||
recordDeviceTrustLoss: () => Promise<void>;
|
abstract recordDeviceTrustLoss(): Promise<void>;
|
||||||
getRotatedData: (
|
abstract getRotatedData(
|
||||||
oldUserKey: UserKey,
|
oldUserKey: UserKey,
|
||||||
newUserKey: UserKey,
|
newUserKey: UserKey,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
) => Promise<OtherDeviceKeysUpdateRequest[]>;
|
): Promise<OtherDeviceKeysUpdateRequest[]>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { UserId } from "../../../types/guid";
|
import { UserId } from "../../../types/guid";
|
||||||
@@ -13,11 +11,11 @@ export abstract class VaultTimeoutSettingsService {
|
|||||||
* @param vaultTimeoutAction The vault timeout action
|
* @param vaultTimeoutAction The vault timeout action
|
||||||
* @param userId The user id to set the data for.
|
* @param userId The user id to set the data for.
|
||||||
*/
|
*/
|
||||||
setVaultTimeoutOptions: (
|
abstract setVaultTimeoutOptions(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
vaultTimeout: VaultTimeout,
|
vaultTimeout: VaultTimeout,
|
||||||
vaultTimeoutAction: VaultTimeoutAction,
|
vaultTimeoutAction: VaultTimeoutAction,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the available vault timeout actions for the current user
|
* Get the available vault timeout actions for the current user
|
||||||
@@ -25,13 +23,13 @@ export abstract class VaultTimeoutSettingsService {
|
|||||||
* **NOTE:** This observable is not yet connected to the state service, so it will not update when the state changes
|
* **NOTE:** This observable is not yet connected to the state service, so it will not update when the state changes
|
||||||
* @param userId The user id to check. If not provided, the current user is used
|
* @param userId The user id to check. If not provided, the current user is used
|
||||||
*/
|
*/
|
||||||
availableVaultTimeoutActions$: (userId?: string) => Observable<VaultTimeoutAction[]>;
|
abstract availableVaultTimeoutActions$(userId?: string): Observable<VaultTimeoutAction[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates the user's available vault timeout actions and returns a boolean representing
|
* Evaluates the user's available vault timeout actions and returns a boolean representing
|
||||||
* if the user can lock or not
|
* if the user can lock or not
|
||||||
*/
|
*/
|
||||||
canLock: (userId: string) => Promise<boolean>;
|
abstract canLock(userId: string): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the vault timeout action for the given user id. The returned value is
|
* Gets the vault timeout action for the given user id. The returned value is
|
||||||
@@ -41,7 +39,7 @@ export abstract class VaultTimeoutSettingsService {
|
|||||||
* A new action will be emitted if the current state changes or if the user's policy changes and the new policy affects the action.
|
* A new action will be emitted if the current state changes or if the user's policy changes and the new policy affects the action.
|
||||||
* @param userId - the user id to get the vault timeout action for
|
* @param userId - the user id to get the vault timeout action for
|
||||||
*/
|
*/
|
||||||
getVaultTimeoutActionByUserId$: (userId: string) => Observable<VaultTimeoutAction>;
|
abstract getVaultTimeoutActionByUserId$(userId: string): Observable<VaultTimeoutAction>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the vault timeout for the given user id. The returned value is calculated based on the current state
|
* Get the vault timeout for the given user id. The returned value is calculated based on the current state
|
||||||
@@ -50,14 +48,14 @@ export abstract class VaultTimeoutSettingsService {
|
|||||||
* A new timeout will be emitted if the current state changes or if the user's policy changes and the new policy affects the timeout.
|
* A new timeout will be emitted if the current state changes or if the user's policy changes and the new policy affects the timeout.
|
||||||
* @param userId The user id to get the vault timeout for
|
* @param userId The user id to get the vault timeout for
|
||||||
*/
|
*/
|
||||||
getVaultTimeoutByUserId$: (userId: string) => Observable<VaultTimeout>;
|
abstract getVaultTimeoutByUserId$(userId: string): Observable<VaultTimeout>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has the user enabled unlock with Biometric.
|
* Has the user enabled unlock with Biometric.
|
||||||
* @param userId The user id to check. If not provided, the current user is used
|
* @param userId The user id to check. If not provided, the current user is used
|
||||||
* @returns boolean true if biometric lock is set
|
* @returns boolean true if biometric lock is set
|
||||||
*/
|
*/
|
||||||
isBiometricLockSet: (userId?: string) => Promise<boolean>;
|
abstract isBiometricLockSet(userId?: string): Promise<boolean>;
|
||||||
|
|
||||||
clear: (userId: UserId) => Promise<void>;
|
abstract clear(userId: UserId): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
export abstract class VaultTimeoutService {
|
export abstract class VaultTimeoutService {
|
||||||
checkVaultTimeout: () => Promise<void>;
|
abstract checkVaultTimeout(): Promise<void>;
|
||||||
lock: (userId?: string) => Promise<void>;
|
abstract lock(userId?: string): Promise<void>;
|
||||||
logOut: (userId?: string) => Promise<void>;
|
abstract logOut(userId?: string): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Fido2CredentialView } from "../../../vault/models/view/fido2-credential.view";
|
import { Fido2CredentialView } from "../../../vault/models/view/fido2-credential.view";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,11 +15,11 @@ export abstract class Fido2AuthenticatorService<ParentWindowReference> {
|
|||||||
* @param abortController An AbortController that can be used to abort the operation.
|
* @param abortController An AbortController that can be used to abort the operation.
|
||||||
* @returns A promise that resolves with the new credential and an attestation signature.
|
* @returns A promise that resolves with the new credential and an attestation signature.
|
||||||
**/
|
**/
|
||||||
makeCredential: (
|
abstract makeCredential(
|
||||||
params: Fido2AuthenticatorMakeCredentialsParams,
|
params: Fido2AuthenticatorMakeCredentialsParams,
|
||||||
window: ParentWindowReference,
|
window: ParentWindowReference,
|
||||||
abortController?: AbortController,
|
abortController?: AbortController,
|
||||||
) => Promise<Fido2AuthenticatorMakeCredentialResult>;
|
): Promise<Fido2AuthenticatorMakeCredentialResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate an assertion using an existing credential as describe in:
|
* Generate an assertion using an existing credential as describe in:
|
||||||
@@ -31,11 +29,11 @@ export abstract class Fido2AuthenticatorService<ParentWindowReference> {
|
|||||||
* @param abortController An AbortController that can be used to abort the operation.
|
* @param abortController An AbortController that can be used to abort the operation.
|
||||||
* @returns A promise that resolves with the asserted credential and an assertion signature.
|
* @returns A promise that resolves with the asserted credential and an assertion signature.
|
||||||
*/
|
*/
|
||||||
getAssertion: (
|
abstract getAssertion(
|
||||||
params: Fido2AuthenticatorGetAssertionParams,
|
params: Fido2AuthenticatorGetAssertionParams,
|
||||||
window: ParentWindowReference,
|
window: ParentWindowReference,
|
||||||
abortController?: AbortController,
|
abortController?: AbortController,
|
||||||
) => Promise<Fido2AuthenticatorGetAssertionResult>;
|
): Promise<Fido2AuthenticatorGetAssertionResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discover credentials for a given Relying Party
|
* Discover credentials for a given Relying Party
|
||||||
@@ -43,7 +41,7 @@ export abstract class Fido2AuthenticatorService<ParentWindowReference> {
|
|||||||
* @param rpId The Relying Party's ID
|
* @param rpId The Relying Party's ID
|
||||||
* @returns A promise that resolves with an array of discoverable credentials
|
* @returns A promise that resolves with an array of discoverable credentials
|
||||||
*/
|
*/
|
||||||
silentCredentialDiscovery: (rpId: string) => Promise<Fido2CredentialView[]>;
|
abstract silentCredentialDiscovery(rpId: string): Promise<Fido2CredentialView[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: update to use a const object instead of a typescript enum
|
// FIXME: update to use a const object instead of a typescript enum
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
export const UserRequestedFallbackAbortReason = "UserRequestedFallback";
|
export const UserRequestedFallbackAbortReason = "UserRequestedFallback";
|
||||||
|
|
||||||
export type UserVerification = "discouraged" | "preferred" | "required";
|
export type UserVerification = "discouraged" | "preferred" | "required";
|
||||||
@@ -16,7 +14,7 @@ export type UserVerification = "discouraged" | "preferred" | "required";
|
|||||||
* and for returning the results of the latter operations to the Web Authentication API's callers.
|
* and for returning the results of the latter operations to the Web Authentication API's callers.
|
||||||
*/
|
*/
|
||||||
export abstract class Fido2ClientService<ParentWindowReference> {
|
export abstract class Fido2ClientService<ParentWindowReference> {
|
||||||
isFido2FeatureEnabled: (hostname: string, origin: string) => Promise<boolean>;
|
abstract isFido2FeatureEnabled(hostname: string, origin: string): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows WebAuthn Relying Party scripts to request the creation of a new public key credential source.
|
* Allows WebAuthn Relying Party scripts to request the creation of a new public key credential source.
|
||||||
@@ -26,11 +24,11 @@ export abstract class Fido2ClientService<ParentWindowReference> {
|
|||||||
* @param abortController An AbortController that can be used to abort the operation.
|
* @param abortController An AbortController that can be used to abort the operation.
|
||||||
* @returns A promise that resolves with the new credential.
|
* @returns A promise that resolves with the new credential.
|
||||||
*/
|
*/
|
||||||
createCredential: (
|
abstract createCredential(
|
||||||
params: CreateCredentialParams,
|
params: CreateCredentialParams,
|
||||||
window: ParentWindowReference,
|
window: ParentWindowReference,
|
||||||
abortController?: AbortController,
|
abortController?: AbortController,
|
||||||
) => Promise<CreateCredentialResult>;
|
): Promise<CreateCredentialResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows WebAuthn Relying Party scripts to discover and use an existing public key credential, with the user’s consent.
|
* Allows WebAuthn Relying Party scripts to discover and use an existing public key credential, with the user’s consent.
|
||||||
@@ -41,11 +39,11 @@ export abstract class Fido2ClientService<ParentWindowReference> {
|
|||||||
* @param abortController An AbortController that can be used to abort the operation.
|
* @param abortController An AbortController that can be used to abort the operation.
|
||||||
* @returns A promise that resolves with the asserted credential.
|
* @returns A promise that resolves with the asserted credential.
|
||||||
*/
|
*/
|
||||||
assertCredential: (
|
abstract assertCredential(
|
||||||
params: AssertCredentialParams,
|
params: AssertCredentialParams,
|
||||||
window: ParentWindowReference,
|
window: ParentWindowReference,
|
||||||
abortController?: AbortController,
|
abortController?: AbortController,
|
||||||
) => Promise<AssertCredentialResult>;
|
): Promise<AssertCredentialResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
/**
|
/**
|
||||||
* Parameters used to ask the user to confirm the creation of a new credential.
|
* Parameters used to ask the user to confirm the creation of a new credential.
|
||||||
*/
|
*/
|
||||||
@@ -69,11 +67,11 @@ export abstract class Fido2UserInterfaceService<ParentWindowReference> {
|
|||||||
* @param fallbackSupported Whether or not the browser natively supports WebAuthn.
|
* @param fallbackSupported Whether or not the browser natively supports WebAuthn.
|
||||||
* @param abortController An abort controller that can be used to cancel/close the session.
|
* @param abortController An abort controller that can be used to cancel/close the session.
|
||||||
*/
|
*/
|
||||||
newSession: (
|
abstract newSession(
|
||||||
fallbackSupported: boolean,
|
fallbackSupported: boolean,
|
||||||
window: ParentWindowReference,
|
window: ParentWindowReference,
|
||||||
abortController?: AbortController,
|
abortController?: AbortController,
|
||||||
) => Promise<Fido2UserInterfaceSession>;
|
): Promise<Fido2UserInterfaceSession>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class Fido2UserInterfaceSession {
|
export abstract class Fido2UserInterfaceSession {
|
||||||
@@ -84,9 +82,9 @@ export abstract class Fido2UserInterfaceSession {
|
|||||||
* @param abortController An abort controller that can be used to cancel/close the session.
|
* @param abortController An abort controller that can be used to cancel/close the session.
|
||||||
* @returns The ID of the cipher that contains the credentials the user picked. If not cipher was picked, return cipherId = undefined to to let the authenticator throw the error.
|
* @returns The ID of the cipher that contains the credentials the user picked. If not cipher was picked, return cipherId = undefined to to let the authenticator throw the error.
|
||||||
*/
|
*/
|
||||||
pickCredential: (
|
abstract pickCredential(
|
||||||
params: PickCredentialParams,
|
params: PickCredentialParams,
|
||||||
) => Promise<{ cipherId: string; userVerified: boolean }>;
|
): Promise<{ cipherId: string; userVerified: boolean }>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask the user to confirm the creation of a new credential.
|
* Ask the user to confirm the creation of a new credential.
|
||||||
@@ -95,30 +93,30 @@ export abstract class Fido2UserInterfaceSession {
|
|||||||
* @param abortController An abort controller that can be used to cancel/close the session.
|
* @param abortController An abort controller that can be used to cancel/close the session.
|
||||||
* @returns The ID of the cipher where the new credential should be saved.
|
* @returns The ID of the cipher where the new credential should be saved.
|
||||||
*/
|
*/
|
||||||
confirmNewCredential: (
|
abstract confirmNewCredential(
|
||||||
params: NewCredentialParams,
|
params: NewCredentialParams,
|
||||||
) => Promise<{ cipherId: string; userVerified: boolean }>;
|
): Promise<{ cipherId: string; userVerified: boolean }>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure that the vault is unlocked.
|
* Make sure that the vault is unlocked.
|
||||||
* This will open a window and ask the user to login or unlock the vault if necessary.
|
* This will open a window and ask the user to login or unlock the vault if necessary.
|
||||||
*/
|
*/
|
||||||
ensureUnlockedVault: () => Promise<void>;
|
abstract ensureUnlockedVault(): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inform the user that the operation was cancelled because their vault contains excluded credentials.
|
* Inform the user that the operation was cancelled because their vault contains excluded credentials.
|
||||||
*
|
*
|
||||||
* @param existingCipherIds The IDs of the excluded credentials.
|
* @param existingCipherIds The IDs of the excluded credentials.
|
||||||
*/
|
*/
|
||||||
informExcludedCredential: (existingCipherIds: string[]) => Promise<void>;
|
abstract informExcludedCredential(existingCipherIds: string[]): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inform the user that the operation was cancelled because their vault does not contain any useable credentials.
|
* Inform the user that the operation was cancelled because their vault does not contain any useable credentials.
|
||||||
*/
|
*/
|
||||||
informCredentialNotFound: (abortController?: AbortController) => Promise<void>;
|
abstract informCredentialNotFound(abortController?: AbortController): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the session, including any windows that may be open.
|
* Close the session, including any windows that may be open.
|
||||||
*/
|
*/
|
||||||
close: () => void;
|
abstract close(): void;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { BiometricKey } from "../../auth/types/biometric-key";
|
import { BiometricKey } from "../../auth/types/biometric-key";
|
||||||
import { Account } from "../models/domain/account";
|
import { Account } from "../models/domain/account";
|
||||||
import { StorageOptions } from "../models/domain/storage-options";
|
import { StorageOptions } from "../models/domain/storage-options";
|
||||||
@@ -19,47 +17,47 @@ export type InitOptions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export abstract class StateService<T extends Account = Account> {
|
export abstract class StateService<T extends Account = Account> {
|
||||||
addAccount: (account: T) => Promise<void>;
|
abstract addAccount(account: T): Promise<void>;
|
||||||
clean: (options?: StorageOptions) => Promise<void>;
|
abstract clean(options?: StorageOptions): Promise<void>;
|
||||||
init: (initOptions?: InitOptions) => Promise<void>;
|
abstract init(initOptions?: InitOptions): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user's auto key
|
* Gets the user's auto key
|
||||||
*/
|
*/
|
||||||
getUserKeyAutoUnlock: (options?: StorageOptions) => Promise<string>;
|
abstract getUserKeyAutoUnlock(options?: StorageOptions): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* Sets the user's auto key
|
* Sets the user's auto key
|
||||||
*/
|
*/
|
||||||
setUserKeyAutoUnlock: (value: string | null, options?: StorageOptions) => Promise<void>;
|
abstract setUserKeyAutoUnlock(value: string | null, options?: StorageOptions): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Gets the user's biometric key
|
* Gets the user's biometric key
|
||||||
*/
|
*/
|
||||||
getUserKeyBiometric: (options?: StorageOptions) => Promise<string>;
|
abstract getUserKeyBiometric(options?: StorageOptions): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* Checks if the user has a biometric key available
|
* Checks if the user has a biometric key available
|
||||||
*/
|
*/
|
||||||
hasUserKeyBiometric: (options?: StorageOptions) => Promise<boolean>;
|
abstract hasUserKeyBiometric(options?: StorageOptions): Promise<boolean>;
|
||||||
/**
|
/**
|
||||||
* Sets the user's biometric key
|
* Sets the user's biometric key
|
||||||
*/
|
*/
|
||||||
setUserKeyBiometric: (value: BiometricKey, options?: StorageOptions) => Promise<void>;
|
abstract setUserKeyBiometric(value: BiometricKey, options?: StorageOptions): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* @deprecated For backwards compatible purposes only, use DesktopAutofillSettingsService
|
* @deprecated For backwards compatible purposes only, use DesktopAutofillSettingsService
|
||||||
*/
|
*/
|
||||||
setEnableDuckDuckGoBrowserIntegration: (
|
abstract setEnableDuckDuckGoBrowserIntegration(
|
||||||
value: boolean,
|
value: boolean,
|
||||||
options?: StorageOptions,
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
getDuckDuckGoSharedKey: (options?: StorageOptions) => Promise<string>;
|
abstract getDuckDuckGoSharedKey(options?: StorageOptions): Promise<string>;
|
||||||
setDuckDuckGoSharedKey: (value: string, options?: StorageOptions) => Promise<void>;
|
abstract setDuckDuckGoSharedKey(value: string, options?: StorageOptions): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use `TokenService.hasAccessToken$()` or `AuthService.authStatusFor$` instead.
|
* @deprecated Use `TokenService.hasAccessToken$()` or `AuthService.authStatusFor$` instead.
|
||||||
*/
|
*/
|
||||||
getIsAuthenticated: (options?: StorageOptions) => Promise<boolean>;
|
abstract getIsAuthenticated(options?: StorageOptions): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use `AccountService.activeAccount$` instead.
|
* @deprecated Use `AccountService.activeAccount$` instead.
|
||||||
*/
|
*/
|
||||||
getUserId: (options?: StorageOptions) => Promise<string>;
|
abstract getUserId(options?: StorageOptions): Promise<string>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { ZXCVBNResult } from "zxcvbn";
|
import { ZXCVBNResult } from "zxcvbn";
|
||||||
|
|
||||||
export abstract class PasswordStrengthServiceAbstraction {
|
export abstract class PasswordStrengthServiceAbstraction {
|
||||||
getPasswordStrength: (password: string, email?: string, userInputs?: string[]) => ZXCVBNResult;
|
abstract getPasswordStrength(
|
||||||
|
password: string,
|
||||||
|
email?: string,
|
||||||
|
userInputs?: string[],
|
||||||
|
): ZXCVBNResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { ListResponse } from "../../../models/response/list.response";
|
import { ListResponse } from "../../../models/response/list.response";
|
||||||
import { EncArrayBuffer } from "../../../platform/models/domain/enc-array-buffer";
|
import { EncArrayBuffer } from "../../../platform/models/domain/enc-array-buffer";
|
||||||
import { Send } from "../models/domain/send";
|
import { Send } from "../models/domain/send";
|
||||||
@@ -12,26 +10,29 @@ import { SendResponse } from "../models/response/send.response";
|
|||||||
import { SendAccessView } from "../models/view/send-access.view";
|
import { SendAccessView } from "../models/view/send-access.view";
|
||||||
|
|
||||||
export abstract class SendApiService {
|
export abstract class SendApiService {
|
||||||
getSend: (id: string) => Promise<SendResponse>;
|
abstract getSend(id: string): Promise<SendResponse>;
|
||||||
postSendAccess: (
|
abstract postSendAccess(
|
||||||
id: string,
|
id: string,
|
||||||
request: SendAccessRequest,
|
request: SendAccessRequest,
|
||||||
apiUrl?: string,
|
apiUrl?: string,
|
||||||
) => Promise<SendAccessResponse>;
|
): Promise<SendAccessResponse>;
|
||||||
getSends: () => Promise<ListResponse<SendResponse>>;
|
abstract getSends(): Promise<ListResponse<SendResponse>>;
|
||||||
postSend: (request: SendRequest) => Promise<SendResponse>;
|
abstract postSend(request: SendRequest): Promise<SendResponse>;
|
||||||
postFileTypeSend: (request: SendRequest) => Promise<SendFileUploadDataResponse>;
|
abstract postFileTypeSend(request: SendRequest): Promise<SendFileUploadDataResponse>;
|
||||||
postSendFile: (sendId: string, fileId: string, data: FormData) => Promise<any>;
|
abstract postSendFile(sendId: string, fileId: string, data: FormData): Promise<any>;
|
||||||
putSend: (id: string, request: SendRequest) => Promise<SendResponse>;
|
abstract putSend(id: string, request: SendRequest): Promise<SendResponse>;
|
||||||
putSendRemovePassword: (id: string) => Promise<SendResponse>;
|
abstract putSendRemovePassword(id: string): Promise<SendResponse>;
|
||||||
deleteSend: (id: string) => Promise<any>;
|
abstract deleteSend(id: string): Promise<any>;
|
||||||
getSendFileDownloadData: (
|
abstract getSendFileDownloadData(
|
||||||
send: SendAccessView,
|
send: SendAccessView,
|
||||||
request: SendAccessRequest,
|
request: SendAccessRequest,
|
||||||
apiUrl?: string,
|
apiUrl?: string,
|
||||||
) => Promise<SendFileDownloadDataResponse>;
|
): Promise<SendFileDownloadDataResponse>;
|
||||||
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
|
abstract renewSendFileUploadUrl(
|
||||||
removePassword: (id: string) => Promise<any>;
|
sendId: string,
|
||||||
delete: (id: string) => Promise<any>;
|
fileId: string,
|
||||||
save: (sendData: [Send, EncArrayBuffer]) => Promise<Send>;
|
): Promise<SendFileUploadDataResponse>;
|
||||||
|
abstract removePassword(id: string): Promise<any>;
|
||||||
|
abstract delete(id: string): Promise<any>;
|
||||||
|
abstract save(sendData: [Send, EncArrayBuffer]): Promise<Send>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||||
@@ -16,49 +14,49 @@ import { SendWithIdRequest } from "../models/request/send-with-id.request";
|
|||||||
import { SendView } from "../models/view/send.view";
|
import { SendView } from "../models/view/send.view";
|
||||||
|
|
||||||
export abstract class SendService implements UserKeyRotationDataProvider<SendWithIdRequest> {
|
export abstract class SendService implements UserKeyRotationDataProvider<SendWithIdRequest> {
|
||||||
sends$: Observable<Send[]>;
|
abstract sends$: Observable<Send[]>;
|
||||||
sendViews$: Observable<SendView[]>;
|
abstract sendViews$: Observable<SendView[]>;
|
||||||
|
|
||||||
encrypt: (
|
abstract encrypt(
|
||||||
model: SendView,
|
model: SendView,
|
||||||
file: File | ArrayBuffer,
|
file: File | ArrayBuffer,
|
||||||
password: string,
|
password: string,
|
||||||
key?: SymmetricCryptoKey,
|
key?: SymmetricCryptoKey,
|
||||||
) => Promise<[Send, EncArrayBuffer]>;
|
): Promise<[Send, EncArrayBuffer]>;
|
||||||
/**
|
/**
|
||||||
* Provides a send for a determined id
|
* Provides a send for a determined id
|
||||||
* updates after a change occurs to the send that matches the id
|
* updates after a change occurs to the send that matches the id
|
||||||
* @param id The id of the desired send
|
* @param id The id of the desired send
|
||||||
* @returns An observable that listens to the value of the desired send
|
* @returns An observable that listens to the value of the desired send
|
||||||
*/
|
*/
|
||||||
get$: (id: string) => Observable<Send | undefined>;
|
abstract get$(id: string): Observable<Send | undefined>;
|
||||||
/**
|
/**
|
||||||
* Provides re-encrypted user sends for the key rotation process
|
* Provides re-encrypted user sends for the key rotation process
|
||||||
* @param newUserKey The new user key to use for re-encryption
|
* @param newUserKey The new user key to use for re-encryption
|
||||||
* @throws Error if the new user key is null or undefined
|
* @throws Error if the new user key is null or undefined
|
||||||
* @returns A list of user sends that have been re-encrypted with the new user key
|
* @returns A list of user sends that have been re-encrypted with the new user key
|
||||||
*/
|
*/
|
||||||
getRotatedData: (
|
abstract getRotatedData(
|
||||||
originalUserKey: UserKey,
|
originalUserKey: UserKey,
|
||||||
newUserKey: UserKey,
|
newUserKey: UserKey,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
) => Promise<SendWithIdRequest[]>;
|
): Promise<SendWithIdRequest[]>;
|
||||||
/**
|
/**
|
||||||
* @deprecated Do not call this, use the sends$ observable collection
|
* @deprecated Do not call this, use the sends$ observable collection
|
||||||
*/
|
*/
|
||||||
getAll: () => Promise<Send[]>;
|
abstract getAll(): Promise<Send[]>;
|
||||||
/**
|
/**
|
||||||
* @deprecated Only use in CLI
|
* @deprecated Only use in CLI
|
||||||
*/
|
*/
|
||||||
getFromState: (id: string) => Promise<Send>;
|
abstract getFromState(id: string): Promise<Send>;
|
||||||
/**
|
/**
|
||||||
* @deprecated Only use in CLI
|
* @deprecated Only use in CLI
|
||||||
*/
|
*/
|
||||||
getAllDecryptedFromState: (userId: UserId) => Promise<SendView[]>;
|
abstract getAllDecryptedFromState(userId: UserId): Promise<SendView[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class InternalSendService extends SendService {
|
export abstract class InternalSendService extends SendService {
|
||||||
upsert: (send: SendData | SendData[]) => Promise<any>;
|
abstract upsert(send: SendData | SendData[]): Promise<any>;
|
||||||
replace: (sends: { [id: string]: SendData }, userId: UserId) => Promise<void>;
|
abstract replace(sends: { [id: string]: SendData }, userId: UserId): Promise<void>;
|
||||||
delete: (id: string | string[]) => Promise<any>;
|
abstract delete(id: string | string[]): Promise<any>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { EncString } from "../../../key-management/crypto/models/enc-string";
|
import { EncString } from "../../../key-management/crypto/models/enc-string";
|
||||||
import { EncArrayBuffer } from "../../../platform/models/domain/enc-array-buffer";
|
import { EncArrayBuffer } from "../../../platform/models/domain/enc-array-buffer";
|
||||||
import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key";
|
import { SymmetricCryptoKey } from "../../../platform/models/domain/symmetric-crypto-key";
|
||||||
@@ -7,11 +5,11 @@ import { Cipher } from "../../models/domain/cipher";
|
|||||||
import { CipherResponse } from "../../models/response/cipher.response";
|
import { CipherResponse } from "../../models/response/cipher.response";
|
||||||
|
|
||||||
export abstract class CipherFileUploadService {
|
export abstract class CipherFileUploadService {
|
||||||
upload: (
|
abstract upload(
|
||||||
cipher: Cipher,
|
cipher: Cipher,
|
||||||
encFileName: EncString,
|
encFileName: EncString,
|
||||||
encData: EncArrayBuffer,
|
encData: EncArrayBuffer,
|
||||||
admin: boolean,
|
admin: boolean,
|
||||||
dataEncKey: [SymmetricCryptoKey, EncString],
|
dataEncKey: [SymmetricCryptoKey, EncString],
|
||||||
) => Promise<CipherResponse>;
|
): Promise<CipherResponse>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
|
|
||||||
import { UserId } from "../../../types/guid";
|
import { UserId } from "../../../types/guid";
|
||||||
import { FolderData } from "../../models/data/folder.data";
|
import { FolderData } from "../../models/data/folder.data";
|
||||||
import { Folder } from "../../models/domain/folder";
|
import { Folder } from "../../models/domain/folder";
|
||||||
import { FolderResponse } from "../../models/response/folder.response";
|
import { FolderResponse } from "../../models/response/folder.response";
|
||||||
|
|
||||||
export class FolderApiServiceAbstraction {
|
export abstract class FolderApiServiceAbstraction {
|
||||||
save: (folder: Folder, userId: UserId) => Promise<FolderData>;
|
abstract save(folder: Folder, userId: UserId): Promise<FolderData>;
|
||||||
delete: (id: string, userId: UserId) => Promise<any>;
|
abstract delete(id: string, userId: UserId): Promise<any>;
|
||||||
get: (id: string) => Promise<FolderResponse>;
|
abstract get(id: string): Promise<FolderResponse>;
|
||||||
deleteAll: (userId: UserId) => Promise<void>;
|
abstract deleteAll(userId: UserId): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||||
@@ -15,27 +13,27 @@ import { FolderWithIdRequest } from "../../models/request/folder-with-id.request
|
|||||||
import { FolderView } from "../../models/view/folder.view";
|
import { FolderView } from "../../models/view/folder.view";
|
||||||
|
|
||||||
export abstract class FolderService implements UserKeyRotationDataProvider<FolderWithIdRequest> {
|
export abstract class FolderService implements UserKeyRotationDataProvider<FolderWithIdRequest> {
|
||||||
folders$: (userId: UserId) => Observable<Folder[]>;
|
abstract folders$(userId: UserId): Observable<Folder[]>;
|
||||||
folderViews$: (userId: UserId) => Observable<FolderView[]>;
|
abstract folderViews$(userId: UserId): Observable<FolderView[]>;
|
||||||
|
|
||||||
clearDecryptedFolderState: (userId: UserId) => Promise<void>;
|
abstract clearDecryptedFolderState(userId: UserId): Promise<void>;
|
||||||
encrypt: (model: FolderView, key: SymmetricCryptoKey) => Promise<Folder>;
|
abstract encrypt(model: FolderView, key: SymmetricCryptoKey): Promise<Folder>;
|
||||||
get: (id: string, userId: UserId) => Promise<Folder>;
|
abstract get(id: string, userId: UserId): Promise<Folder>;
|
||||||
getDecrypted$: (id: string, userId: UserId) => Observable<FolderView | undefined>;
|
abstract getDecrypted$(id: string, userId: UserId): Observable<FolderView | undefined>;
|
||||||
/**
|
/**
|
||||||
* @deprecated Use firstValueFrom(folders$) directly instead
|
* @deprecated Use firstValueFrom(folders$) directly instead
|
||||||
* @param userId The user id
|
* @param userId The user id
|
||||||
* @returns Promise of folders array
|
* @returns Promise of folders array
|
||||||
*/
|
*/
|
||||||
getAllFromState: (userId: UserId) => Promise<Folder[]>;
|
abstract getAllFromState(userId: UserId): Promise<Folder[]>;
|
||||||
/**
|
/**
|
||||||
* @deprecated Only use in CLI!
|
* @deprecated Only use in CLI!
|
||||||
*/
|
*/
|
||||||
getFromState: (id: string, userId: UserId) => Promise<Folder>;
|
abstract getFromState(id: string, userId: UserId): Promise<Folder>;
|
||||||
/**
|
/**
|
||||||
* @deprecated Only use in CLI!
|
* @deprecated Only use in CLI!
|
||||||
*/
|
*/
|
||||||
getAllDecryptedFromState: (userId: UserId) => Promise<FolderView[]>;
|
abstract getAllDecryptedFromState(userId: UserId): Promise<FolderView[]>;
|
||||||
/**
|
/**
|
||||||
* Returns user folders re-encrypted with the new user key.
|
* Returns user folders re-encrypted with the new user key.
|
||||||
* @param originalUserKey the original user key
|
* @param originalUserKey the original user key
|
||||||
@@ -44,16 +42,16 @@ export abstract class FolderService implements UserKeyRotationDataProvider<Folde
|
|||||||
* @throws Error if new user key is null
|
* @throws Error if new user key is null
|
||||||
* @returns a list of user folders that have been re-encrypted with the new user key
|
* @returns a list of user folders that have been re-encrypted with the new user key
|
||||||
*/
|
*/
|
||||||
getRotatedData: (
|
abstract getRotatedData(
|
||||||
originalUserKey: UserKey,
|
originalUserKey: UserKey,
|
||||||
newUserKey: UserKey,
|
newUserKey: UserKey,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
) => Promise<FolderWithIdRequest[]>;
|
): Promise<FolderWithIdRequest[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class InternalFolderService extends FolderService {
|
export abstract class InternalFolderService extends FolderService {
|
||||||
upsert: (folder: FolderData | FolderData[], userId: UserId) => Promise<void>;
|
abstract upsert(folder: FolderData | FolderData[], userId: UserId): Promise<void>;
|
||||||
replace: (folders: { [id: string]: FolderData }, userId: UserId) => Promise<void>;
|
abstract replace(folders: { [id: string]: FolderData }, userId: UserId): Promise<void>;
|
||||||
clear: (userId: UserId) => Promise<void>;
|
abstract clear(userId: UserId): Promise<void>;
|
||||||
delete: (id: string | string[], userId: UserId) => Promise<any>;
|
abstract delete(id: string | string[], userId: UserId): Promise<any>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
import { SendView } from "../../tools/send/models/view/send.view";
|
import { SendView } from "../../tools/send/models/view/send.view";
|
||||||
@@ -8,25 +6,25 @@ import { CipherView } from "../models/view/cipher.view";
|
|||||||
import { CipherViewLike } from "../utils/cipher-view-like-utils";
|
import { CipherViewLike } from "../utils/cipher-view-like-utils";
|
||||||
|
|
||||||
export abstract class SearchService {
|
export abstract class SearchService {
|
||||||
indexedEntityId$: (userId: UserId) => Observable<IndexedEntityId | null>;
|
abstract indexedEntityId$(userId: UserId): Observable<IndexedEntityId | null>;
|
||||||
|
|
||||||
clearIndex: (userId: UserId) => Promise<void>;
|
abstract clearIndex(userId: UserId): Promise<void>;
|
||||||
isSearchable: (userId: UserId, query: string) => Promise<boolean>;
|
abstract isSearchable(userId: UserId, query: string): Promise<boolean>;
|
||||||
indexCiphers: (
|
abstract indexCiphers(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
ciphersToIndex: CipherView[],
|
ciphersToIndex: CipherView[],
|
||||||
indexedEntityGuid?: string,
|
indexedEntityGuid?: string,
|
||||||
) => Promise<void>;
|
): Promise<void>;
|
||||||
searchCiphers: <C extends CipherViewLike>(
|
abstract searchCiphers<C extends CipherViewLike>(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
query: string,
|
query: string,
|
||||||
filter?: ((cipher: C) => boolean) | ((cipher: C) => boolean)[],
|
filter?: ((cipher: C) => boolean) | ((cipher: C) => boolean)[],
|
||||||
ciphers?: C[],
|
ciphers?: C[],
|
||||||
) => Promise<C[]>;
|
): Promise<C[]>;
|
||||||
searchCiphersBasic: <C extends CipherViewLike>(
|
abstract searchCiphersBasic<C extends CipherViewLike>(
|
||||||
ciphers: C[],
|
ciphers: C[],
|
||||||
query: string,
|
query: string,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
) => C[];
|
): C[];
|
||||||
searchSends: (sends: SendView[], query: string) => SendView[];
|
abstract searchSends(sends: SendView[], query: string): SendView[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
|
||||||
// @ts-strict-ignore
|
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
/**
|
/**
|
||||||
* Service for managing vault settings.
|
* Service for managing vault settings.
|
||||||
@@ -9,42 +7,40 @@ export abstract class VaultSettingsService {
|
|||||||
* An observable monitoring the state of the enable passkeys setting.
|
* An observable monitoring the state of the enable passkeys setting.
|
||||||
* The observable updates when the setting changes.
|
* The observable updates when the setting changes.
|
||||||
*/
|
*/
|
||||||
enablePasskeys$: Observable<boolean>;
|
abstract enablePasskeys$: Observable<boolean>;
|
||||||
/**
|
/**
|
||||||
* An observable monitoring the state of the show cards on the current tab.
|
* An observable monitoring the state of the show cards on the current tab.
|
||||||
*/
|
*/
|
||||||
showCardsCurrentTab$: Observable<boolean>;
|
abstract showCardsCurrentTab$: Observable<boolean>;
|
||||||
/**
|
/**
|
||||||
* An observable monitoring the state of the show identities on the current tab.
|
* An observable monitoring the state of the show identities on the current tab.
|
||||||
*/
|
*/
|
||||||
showIdentitiesCurrentTab$: Observable<boolean>;
|
abstract showIdentitiesCurrentTab$: Observable<boolean>;
|
||||||
/**
|
|
||||||
/**
|
/**
|
||||||
* An observable monitoring the state of the click items on the Vault view
|
* An observable monitoring the state of the click items on the Vault view
|
||||||
* for Autofill suggestions.
|
* for Autofill suggestions.
|
||||||
*/
|
*/
|
||||||
clickItemsToAutofillVaultView$: Observable<boolean>;
|
abstract clickItemsToAutofillVaultView$: Observable<boolean>;
|
||||||
/**
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the enable passkeys setting to disk.
|
* Saves the enable passkeys setting to disk.
|
||||||
* @param value The new value for the passkeys setting.
|
* @param value The new value for the passkeys setting.
|
||||||
*/
|
*/
|
||||||
setEnablePasskeys: (value: boolean) => Promise<void>;
|
abstract setEnablePasskeys(value: boolean): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Saves the show cards on tab page setting to disk.
|
* Saves the show cards on tab page setting to disk.
|
||||||
* @param value The new value for the show cards on tab page setting.
|
* @param value The new value for the show cards on tab page setting.
|
||||||
*/
|
*/
|
||||||
setShowCardsCurrentTab: (value: boolean) => Promise<void>;
|
abstract setShowCardsCurrentTab(value: boolean): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Saves the show identities on tab page setting to disk.
|
* Saves the show identities on tab page setting to disk.
|
||||||
* @param value The new value for the show identities on tab page setting.
|
* @param value The new value for the show identities on tab page setting.
|
||||||
*/
|
*/
|
||||||
setShowIdentitiesCurrentTab: (value: boolean) => Promise<void>;
|
abstract setShowIdentitiesCurrentTab(value: boolean): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Saves the click items on vault View for Autofill suggestions to disk.
|
* Saves the click items on vault View for Autofill suggestions to disk.
|
||||||
* @param value The new value for the click items on vault View for
|
* @param value The new value for the click items on vault View for
|
||||||
* Autofill suggestions setting.
|
* Autofill suggestions setting.
|
||||||
*/
|
*/
|
||||||
setClickItemsToAutofillVaultView: (value: boolean) => Promise<void>;
|
abstract setClickItemsToAutofillVaultView(value: boolean): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user