bitwarden-estensione-browser/libs/common/src/services/api.service.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2700 lines
88 KiB
TypeScript
Raw Normal View History

import { ApiService as ApiServiceAbstraction } from "../abstractions/api.service";
2022-06-14 17:10:53 +02:00
import { AppIdService } from "../abstractions/appId.service";
import { EnvironmentService } from "../abstractions/environment.service";
import { PlatformUtilsService } from "../abstractions/platformUtils.service";
import { TokenService } from "../abstractions/token.service";
2022-02-22 15:39:11 +01:00
import { DeviceType } from "../enums/deviceType";
2022-06-14 17:10:53 +02:00
import { OrganizationConnectionType } from "../enums/organizationConnectionType";
2022-02-22 15:39:11 +01:00
import { PolicyType } from "../enums/policyType";
import { Utils } from "../misc/utils";
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
import { VerifyOTPRequest } from "../models/request/account/verifyOTPRequest";
import { AttachmentRequest } from "../models/request/attachmentRequest";
2019-02-22 04:45:56 +01:00
import { BitPayInvoiceRequest } from "../models/request/bitPayInvoiceRequest";
2018-06-12 23:12:27 +02:00
import { CipherBulkDeleteRequest } from "../models/request/cipherBulkDeleteRequest";
import { CipherBulkMoveRequest } from "../models/request/cipherBulkMoveRequest";
2018-06-13 06:02:15 +02:00
import { CipherBulkShareRequest } from "../models/request/cipherBulkShareRequest";
2018-06-12 19:07:06 +02:00
import { CipherCollectionsRequest } from "../models/request/cipherCollectionsRequest";
2018-10-19 15:14:11 +02:00
import { CipherCreateRequest } from "../models/request/cipherCreateRequest";
import { CipherRequest } from "../models/request/cipherRequest";
2018-06-12 17:45:02 +02:00
import { CipherShareRequest } from "../models/request/cipherShareRequest";
2018-07-06 18:40:43 +02:00
import { CollectionRequest } from "../models/request/collectionRequest";
2018-07-13 21:55:02 +02:00
import { DeleteRecoverRequest } from "../models/request/deleteRecoverRequest";
2022-06-14 17:10:53 +02:00
import { DeviceRequest } from "../models/request/deviceRequest";
import { DeviceVerificationRequest } from "../models/request/deviceVerificationRequest";
import { EmailRequest } from "../models/request/emailRequest";
import { EmailTokenRequest } from "../models/request/emailTokenRequest";
import { EmergencyAccessAcceptRequest } from "../models/request/emergencyAccessAcceptRequest";
import { EmergencyAccessConfirmRequest } from "../models/request/emergencyAccessConfirmRequest";
import { EmergencyAccessInviteRequest } from "../models/request/emergencyAccessInviteRequest";
import { EmergencyAccessPasswordRequest } from "../models/request/emergencyAccessPasswordRequest";
import { EmergencyAccessUpdateRequest } from "../models/request/emergencyAccessUpdateRequest";
2019-06-20 14:56:45 +02:00
import { EventRequest } from "../models/request/eventRequest";
import { FolderRequest } from "../models/request/folderRequest";
2018-07-06 18:40:43 +02:00
import { GroupRequest } from "../models/request/groupRequest";
2019-09-19 14:52:57 +02:00
import { IapCheckRequest } from "../models/request/iapCheckRequest";
import { ApiTokenRequest } from "../models/request/identityToken/apiTokenRequest";
import { PasswordTokenRequest } from "../models/request/identityToken/passwordTokenRequest";
import { SsoTokenRequest } from "../models/request/identityToken/ssoTokenRequest";
2022-06-14 17:10:53 +02:00
import { TokenRequestTwoFactor } from "../models/request/identityToken/tokenRequestTwoFactor";
2018-06-23 21:41:22 +02:00
import { ImportCiphersRequest } from "../models/request/importCiphersRequest";
import { ImportDirectoryRequest } from "../models/request/importDirectoryRequest";
2018-06-23 21:41:22 +02:00
import { ImportOrganizationCiphersRequest } from "../models/request/importOrganizationCiphersRequest";
2018-08-28 01:55:05 +02:00
import { KdfRequest } from "../models/request/kdfRequest";
2022-02-22 15:39:11 +01:00
import { KeyConnectorUserKeyRequest } from "../models/request/keyConnectorUserKeyRequest";
2018-07-03 18:06:01 +02:00
import { KeysRequest } from "../models/request/keysRequest";
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
import { OrganizationSponsorshipCreateRequest } from "../models/request/organization/organizationSponsorshipCreateRequest";
import { OrganizationSponsorshipRedeemRequest } from "../models/request/organization/organizationSponsorshipRedeemRequest";
import { OrganizationSsoRequest } from "../models/request/organization/organizationSsoRequest";
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
import { OrganizationApiKeyRequest } from "../models/request/organizationApiKeyRequest";
2022-06-14 17:10:53 +02:00
import { OrganizationConnectionRequest } from "../models/request/organizationConnectionRequest";
2018-07-02 21:36:32 +02:00
import { OrganizationCreateRequest } from "../models/request/organizationCreateRequest";
import { OrganizationImportRequest } from "../models/request/organizationImportRequest";
import { OrganizationKeysRequest } from "../models/request/organizationKeysRequest";
import { OrganizationSubscriptionUpdateRequest } from "../models/request/organizationSubscriptionUpdateRequest";
2020-06-13 01:29:52 +02:00
import { OrganizationTaxInfoUpdateRequest } from "../models/request/organizationTaxInfoUpdateRequest";
2018-07-16 18:30:45 +02:00
import { OrganizationUpdateRequest } from "../models/request/organizationUpdateRequest";
2019-03-22 02:38:52 +01:00
import { OrganizationUpgradeRequest } from "../models/request/organizationUpgradeRequest";
2018-07-10 19:03:24 +02:00
import { OrganizationUserAcceptRequest } from "../models/request/organizationUserAcceptRequest";
import { OrganizationUserBulkConfirmRequest } from "../models/request/organizationUserBulkConfirmRequest";
import { OrganizationUserBulkRequest } from "../models/request/organizationUserBulkRequest";
2018-07-10 19:03:24 +02:00
import { OrganizationUserConfirmRequest } from "../models/request/organizationUserConfirmRequest";
import { OrganizationUserInviteRequest } from "../models/request/organizationUserInviteRequest";
import { OrganizationUserResetPasswordEnrollmentRequest } from "../models/request/organizationUserResetPasswordEnrollmentRequest";
import { OrganizationUserResetPasswordRequest } from "../models/request/organizationUserResetPasswordRequest";
2018-07-10 19:03:24 +02:00
import { OrganizationUserUpdateGroupsRequest } from "../models/request/organizationUserUpdateGroupsRequest";
import { OrganizationUserUpdateRequest } from "../models/request/organizationUserUpdateRequest";
import { PasswordHintRequest } from "../models/request/passwordHintRequest";
import { PasswordRequest } from "../models/request/passwordRequest";
2018-06-30 19:22:21 +02:00
import { PaymentRequest } from "../models/request/paymentRequest";
2020-01-15 17:24:00 +01:00
import { PolicyRequest } from "../models/request/policyRequest";
2018-08-14 21:12:10 +02:00
import { PreloginRequest } from "../models/request/preloginRequest";
import { ProviderAddOrganizationRequest } from "../models/request/provider/providerAddOrganizationRequest";
import { ProviderOrganizationCreateRequest } from "../models/request/provider/providerOrganizationCreateRequest";
import { ProviderSetupRequest } from "../models/request/provider/providerSetupRequest";
import { ProviderUpdateRequest } from "../models/request/provider/providerUpdateRequest";
import { ProviderUserAcceptRequest } from "../models/request/provider/providerUserAcceptRequest";
import { ProviderUserBulkConfirmRequest } from "../models/request/provider/providerUserBulkConfirmRequest";
import { ProviderUserBulkRequest } from "../models/request/provider/providerUserBulkRequest";
import { ProviderUserConfirmRequest } from "../models/request/provider/providerUserConfirmRequest";
import { ProviderUserInviteRequest } from "../models/request/provider/providerUserInviteRequest";
import { ProviderUserUpdateRequest } from "../models/request/provider/providerUserUpdateRequest";
import { RegisterRequest } from "../models/request/registerRequest";
2018-07-17 18:05:19 +02:00
import { SeatRequest } from "../models/request/seatRequest";
import { SecretVerificationRequest } from "../models/request/secretVerificationRequest";
2018-10-18 04:18:28 +02:00
import { SelectionReadOnlyRequest } from "../models/request/selectionReadOnlyRequest";
import { SendAccessRequest } from "../models/request/sendAccessRequest";
import { SendRequest } from "../models/request/sendRequest";
import { SetPasswordRequest } from "../models/request/setPasswordRequest";
2018-06-30 05:40:10 +02:00
import { StorageRequest } from "../models/request/storageRequest";
2020-06-13 01:29:52 +02:00
import { TaxInfoUpdateRequest } from "../models/request/taxInfoUpdateRequest";
import { TwoFactorEmailRequest } from "../models/request/twoFactorEmailRequest";
2018-06-26 21:17:14 +02:00
import { TwoFactorProviderRequest } from "../models/request/twoFactorProviderRequest";
import { TwoFactorRecoveryRequest } from "../models/request/twoFactorRecoveryRequest";
2018-06-26 05:04:59 +02:00
import { UpdateDomainsRequest } from "../models/request/updateDomainsRequest";
2018-07-17 23:22:45 +02:00
import { UpdateKeyRequest } from "../models/request/updateKeyRequest";
2018-06-21 05:40:59 +02:00
import { UpdateProfileRequest } from "../models/request/updateProfileRequest";
import { UpdateTempPasswordRequest } from "../models/request/updateTempPasswordRequest";
2018-06-26 21:17:14 +02:00
import { UpdateTwoFactorAuthenticatorRequest } from "../models/request/updateTwoFactorAuthenticatorRequest";
import { UpdateTwoFactorDuoRequest } from "../models/request/updateTwoFactorDuoRequest";
import { UpdateTwoFactorEmailRequest } from "../models/request/updateTwoFactorEmailRequest";
2021-03-15 16:16:51 +01:00
import { UpdateTwoFactorWebAuthnDeleteRequest } from "../models/request/updateTwoFactorWebAuthnDeleteRequest";
import { UpdateTwoFactorWebAuthnRequest } from "../models/request/updateTwoFactorWebAuthnRequest";
2018-06-26 21:17:14 +02:00
import { UpdateTwoFactorYubioOtpRequest } from "../models/request/updateTwoFactorYubioOtpRequest";
2018-07-17 17:04:19 +02:00
import { VerifyBankRequest } from "../models/request/verifyBankRequest";
2018-07-13 21:55:02 +02:00
import { VerifyDeleteRecoverRequest } from "../models/request/verifyDeleteRecoverRequest";
2018-07-12 17:35:04 +02:00
import { VerifyEmailRequest } from "../models/request/verifyEmailRequest";
2019-03-07 16:58:27 +01:00
import { ApiKeyResponse } from "../models/response/apiKeyResponse";
import { AttachmentResponse } from "../models/response/attachmentResponse";
import { AttachmentUploadDataResponse } from "../models/response/attachmentUploadDataResponse";
2022-06-14 17:10:53 +02:00
import { BillingHistoryResponse } from "../models/response/billingHistoryResponse";
import { BillingPaymentResponse } from "../models/response/billingPaymentResponse";
2018-06-29 17:29:24 +02:00
import { BillingResponse } from "../models/response/billingResponse";
2019-01-17 16:46:24 +01:00
import { BreachAccountResponse } from "../models/response/breachAccountResponse";
import { CipherResponse } from "../models/response/cipherResponse";
2018-07-06 18:40:43 +02:00
import {
CollectionGroupDetailsResponse,
CollectionResponse,
} from "../models/response/collectionResponse";
import { DeviceVerificationResponse } from "../models/response/deviceVerificationResponse";
2018-06-26 05:04:59 +02:00
import { DomainsResponse } from "../models/response/domainsResponse";
import {
EmergencyAccessGranteeDetailsResponse,
EmergencyAccessGrantorDetailsResponse,
EmergencyAccessTakeoverResponse,
EmergencyAccessViewResponse,
} from "../models/response/emergencyAccessResponse";
import { ErrorResponse } from "../models/response/errorResponse";
2018-07-07 05:06:38 +02:00
import { EventResponse } from "../models/response/eventResponse";
import { FolderResponse } from "../models/response/folderResponse";
import { GroupDetailsResponse, GroupResponse } from "../models/response/groupResponse";
import { IdentityCaptchaResponse } from "../models/response/identityCaptchaResponse";
import { IdentityTokenResponse } from "../models/response/identityTokenResponse";
import { IdentityTwoFactorResponse } from "../models/response/identityTwoFactorResponse";
2022-02-22 15:39:11 +01:00
import { KeyConnectorUserKeyResponse } from "../models/response/keyConnectorUserKeyResponse";
2018-06-26 21:17:14 +02:00
import { ListResponse } from "../models/response/listResponse";
import { OrganizationSsoResponse } from "../models/response/organization/organizationSsoResponse";
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
import { OrganizationApiKeyInformationResponse } from "../models/response/organizationApiKeyInformationResponse";
import { OrganizationAutoEnrollStatusResponse } from "../models/response/organizationAutoEnrollStatusResponse";
2022-06-14 17:10:53 +02:00
import {
OrganizationConnectionConfigApis,
OrganizationConnectionResponse,
} from "../models/response/organizationConnectionResponse";
import { OrganizationKeysResponse } from "../models/response/organizationKeysResponse";
import { OrganizationResponse } from "../models/response/organizationResponse";
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
import { OrganizationSponsorshipSyncStatusResponse } from "../models/response/organizationSponsorshipSyncStatusResponse";
import { OrganizationSubscriptionResponse } from "../models/response/organizationSubscriptionResponse";
import { OrganizationUserBulkPublicKeyResponse } from "../models/response/organizationUserBulkPublicKeyResponse";
import { OrganizationUserBulkResponse } from "../models/response/organizationUserBulkResponse";
2018-07-06 18:40:43 +02:00
import {
OrganizationUserDetailsResponse,
OrganizationUserResetPasswordDetailsReponse,
OrganizationUserUserDetailsResponse,
} from "../models/response/organizationUserResponse";
import { PaymentResponse } from "../models/response/paymentResponse";
import { PlanResponse } from "../models/response/planResponse";
import { PolicyResponse } from "../models/response/policyResponse";
import { PreloginResponse } from "../models/response/preloginResponse";
import { ProfileResponse } from "../models/response/profileResponse";
2018-07-10 19:03:24 +02:00
import {
ProviderOrganizationOrganizationDetailsResponse,
ProviderOrganizationResponse,
} from "../models/response/provider/providerOrganizationResponse";
import { ProviderResponse } from "../models/response/provider/providerResponse";
import { ProviderUserBulkPublicKeyResponse } from "../models/response/provider/providerUserBulkPublicKeyResponse";
import { ProviderUserBulkResponse } from "../models/response/provider/providerUserBulkResponse";
import {
ProviderUserResponse,
ProviderUserUserDetailsResponse,
} from "../models/response/provider/providerUserResponse";
2018-10-17 23:31:13 +02:00
import { SelectionReadOnlyResponse } from "../models/response/selectionReadOnlyResponse";
import { SendAccessResponse } from "../models/response/sendAccessResponse";
import { SendFileDownloadDataResponse } from "../models/response/sendFileDownloadDataResponse";
import { SendFileUploadDataResponse } from "../models/response/sendFileUploadDataResponse";
import { SendResponse } from "../models/response/sendResponse";
2022-06-14 17:10:53 +02:00
import { SsoPreValidateResponse } from "../models/response/ssoPreValidateResponse";
import { SubscriptionResponse } from "../models/response/subscriptionResponse";
import { SyncResponse } from "../models/response/syncResponse";
2020-06-13 01:29:52 +02:00
import { TaxInfoResponse } from "../models/response/taxInfoResponse";
import { TaxRateResponse } from "../models/response/taxRateResponse";
2018-06-26 21:17:14 +02:00
import { TwoFactorAuthenticatorResponse } from "../models/response/twoFactorAuthenticatorResponse";
import { TwoFactorDuoResponse } from "../models/response/twoFactorDuoResponse";
import { TwoFactorEmailResponse } from "../models/response/twoFactorEmailResponse";
import { TwoFactorProviderResponse } from "../models/response/twoFactorProviderResponse";
import { TwoFactorRecoverResponse } from "../models/response/twoFactorRescoverResponse";
2022-02-22 15:39:11 +01:00
import {
TwoFactorWebAuthnResponse,
ChallengeResponse,
} from "../models/response/twoFactorWebAuthnResponse";
2018-06-26 21:17:14 +02:00
import { TwoFactorYubiKeyResponse } from "../models/response/twoFactorYubiKeyResponse";
2018-07-11 19:30:06 +02:00
import { UserKeyResponse } from "../models/response/userKeyResponse";
import { SendAccessView } from "../models/view/sendAccessView";
2018-01-31 20:27:11 +01:00
export class ApiService implements ApiServiceAbstraction {
2019-08-22 18:04:15 +02:00
private device: DeviceType;
2018-06-14 04:09:47 +02:00
private deviceType: string;
private isWebClient = false;
private isDesktopClient = false;
2021-12-16 13:36:21 +01:00
2018-03-21 16:19:05 +01:00
constructor(
private tokenService: TokenService,
private platformUtilsService: PlatformUtilsService,
private environmentService: EnvironmentService,
private appIdService: AppIdService,
private logoutCallback: (expired: boolean) => Promise<void>,
private customUserAgent: string = null
) {
2019-08-22 18:04:15 +02:00
this.device = platformUtilsService.getDevice();
this.deviceType = this.device.toString();
this.isWebClient =
this.device === DeviceType.IEBrowser ||
this.device === DeviceType.ChromeBrowser ||
this.device === DeviceType.EdgeBrowser ||
this.device === DeviceType.FirefoxBrowser ||
this.device === DeviceType.OperaBrowser ||
this.device === DeviceType.SafariBrowser ||
this.device === DeviceType.UnknownBrowser ||
this.device === DeviceType.VivaldiBrowser;
this.isDesktopClient =
this.device === DeviceType.WindowsDesktop ||
this.device === DeviceType.MacOsDesktop ||
this.device === DeviceType.LinuxDesktop;
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
// Auth APIs
2021-12-16 13:36:21 +01:00
async postIdentityToken(
request: ApiTokenRequest | PasswordTokenRequest | SsoTokenRequest
): Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse> {
2019-10-07 16:02:18 +02:00
const headers = new Headers({
"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
Accept: "application/json",
"Device-Type": this.deviceType,
});
if (this.customUserAgent != null) {
headers.set("User-Agent", this.customUserAgent);
}
2021-05-28 21:41:41 +02:00
request.alterIdentityTokenHeaders(headers);
const identityToken =
request instanceof ApiTokenRequest
? request.toIdentityToken()
: request.toIdentityToken(this.platformUtilsService.getClientType());
const response = await this.fetch(
new Request(this.environmentService.getIdentityUrl() + "/connect/token", {
body: this.qsStringify(identityToken),
2018-06-05 21:45:19 +02:00
credentials: this.getCredentials(),
2020-01-13 13:49:05 +01:00
cache: "no-store",
2019-10-07 16:02:18 +02:00
headers: headers,
2018-01-09 22:19:55 +01:00
method: "POST",
})
);
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
let responseJson: any = null;
2019-04-10 21:39:36 +02:00
if (this.isJsonResponse(response)) {
2018-01-09 22:19:55 +01:00
responseJson = await response.json();
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
if (responseJson != null) {
if (response.status === 200) {
return new IdentityTokenResponse(responseJson);
} else if (
response.status === 400 &&
responseJson.TwoFactorProviders2 &&
Object.keys(responseJson.TwoFactorProviders2).length
) {
await this.tokenService.clearTwoFactorToken();
2018-02-02 04:55:49 +01:00
return new IdentityTwoFactorResponse(responseJson);
} else if (
response.status === 400 &&
responseJson.HCaptcha_SiteKey &&
Object.keys(responseJson.HCaptcha_SiteKey).length
) {
return new IdentityCaptchaResponse(responseJson);
2021-12-16 13:36:21 +01:00
}
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
return Promise.reject(new ErrorResponse(responseJson, response.status, true));
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
async refreshIdentityToken(): Promise<any> {
try {
await this.doAuthRefresh();
2018-01-09 22:19:55 +01:00
} catch (e) {
return Promise.reject(null);
2021-12-16 13:36:21 +01:00
}
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
// Account APIs
2021-12-16 13:36:21 +01:00
2018-05-03 18:46:49 +02:00
async getProfile(): Promise<ProfileResponse> {
const r = await this.send("GET", "/accounts/profile", null, true, true);
2018-06-26 04:42:57 +02:00
return new ProfileResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-06-29 17:29:24 +02:00
async getUserSubscription(): Promise<SubscriptionResponse> {
const r = await this.send("GET", "/accounts/subscription", null, true, true);
2018-10-18 04:56:28 +02:00
return new SubscriptionResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-06-29 17:29:24 +02:00
async getTaxInfo(): Promise<TaxInfoResponse> {
const r = await this.send("GET", "/accounts/tax", null, true, true);
return new TaxInfoResponse(r);
}
2021-12-16 13:36:21 +01:00
async putProfile(request: UpdateProfileRequest): Promise<ProfileResponse> {
const r = await this.send("PUT", "/accounts/profile", request, true, true);
return new ProfileResponse(r);
}
2021-12-16 13:36:21 +01:00
2020-06-13 01:29:52 +02:00
putTaxInfo(request: TaxInfoUpdateRequest): Promise<any> {
return this.send("PUT", "/accounts/tax", request, true, false);
2021-12-16 13:36:21 +01:00
}
2020-06-13 01:29:52 +02:00
async postPrelogin(request: PreloginRequest): Promise<PreloginResponse> {
const r = await this.send(
"POST",
"/accounts/prelogin",
request,
false,
true,
this.platformUtilsService.isDev()
? this.environmentService.getIdentityUrl()
: this.environmentService.getApiUrl()
);
2020-06-13 01:29:52 +02:00
return new PreloginResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-06-21 05:40:59 +02:00
postEmailToken(request: EmailTokenRequest): Promise<any> {
2018-06-26 04:42:57 +02:00
return this.send("POST", "/accounts/email-token", request, true, false);
2018-06-21 05:40:59 +02:00
}
2021-12-16 13:36:21 +01:00
2020-06-13 01:29:52 +02:00
postEmail(request: EmailRequest): Promise<any> {
return this.send("POST", "/accounts/email", request, true, false);
2021-12-16 13:36:21 +01:00
}
postPassword(request: PasswordRequest): Promise<any> {
2020-06-13 01:29:52 +02:00
return this.send("POST", "/accounts/password", request, true, false);
}
2021-12-16 13:36:21 +01:00
2018-08-14 21:12:10 +02:00
setPassword(request: SetPasswordRequest): Promise<any> {
return this.send("POST", "/accounts/set-password", request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-08-14 21:12:10 +02:00
postSetKeyConnectorKey(request: SetKeyConnectorKeyRequest): Promise<any> {
return this.send("POST", "/accounts/set-key-connector-key", request, true, false);
}
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
postSecurityStamp(request: SecretVerificationRequest): Promise<any> {
return this.send("POST", "/accounts/security-stamp", request, true, false);
}
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
deleteAccount(request: SecretVerificationRequest): Promise<any> {
return this.send("DELETE", "/accounts", request, true, false);
2021-12-16 13:36:21 +01:00
}
async getAccountRevisionDate(): Promise<number> {
2018-06-26 04:42:57 +02:00
const r = await this.send("GET", "/accounts/revision-date", null, true, true);
return r as number;
}
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
postPasswordHint(request: PasswordHintRequest): Promise<any> {
return this.send("POST", "/accounts/password-hint", request, false, false);
}
2021-12-16 13:36:21 +01:00
postRegister(request: RegisterRequest): Promise<any> {
return this.send(
"POST",
"/accounts/register",
request,
false,
false,
this.platformUtilsService.isDev()
? this.environmentService.getIdentityUrl()
: this.environmentService.getApiUrl()
);
2021-12-16 13:36:21 +01:00
}
async postPremium(data: FormData): Promise<PaymentResponse> {
const r = await this.send("POST", "/accounts/premium", data, true, true);
return new PaymentResponse(r);
2021-12-16 13:36:21 +01:00
}
async postIapCheck(request: IapCheckRequest): Promise<any> {
return this.send("POST", "/accounts/iap-check", request, true, false);
2021-10-25 18:21:40 +02:00
}
2021-12-16 13:36:21 +01:00
postReinstatePremium(): Promise<any> {
2018-06-26 04:42:57 +02:00
return this.send("POST", "/accounts/reinstate-premium", null, true, false);
2018-06-21 23:15:43 +02:00
}
2021-12-16 13:36:21 +01:00
postCancelPremium(): Promise<any> {
2018-07-20 19:01:48 +02:00
return this.send("POST", "/accounts/cancel-premium", null, true, false);
2021-12-16 13:36:21 +01:00
}
async postAccountStorage(request: StorageRequest): Promise<PaymentResponse> {
2018-07-09 22:27:03 +02:00
const r = await this.send("POST", "/accounts/storage", request, true, true);
2019-08-10 05:56:55 +02:00
return new PaymentResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-07-17 23:22:45 +02:00
postAccountPayment(request: PaymentRequest): Promise<any> {
2018-07-20 19:01:48 +02:00
return this.send("POST", "/accounts/payment", request, true, false);
2018-06-21 23:15:43 +02:00
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
postAccountLicense(data: FormData): Promise<any> {
2018-06-26 04:42:57 +02:00
return this.send("POST", "/accounts/license", data, true, false);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
postAccountKeys(request: KeysRequest): Promise<any> {
return this.send("POST", "/accounts/keys", request, true, false);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
postAccountKey(request: UpdateKeyRequest): Promise<any> {
return this.send("POST", "/accounts/key", request, true, false);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2019-08-10 05:56:55 +02:00
postAccountVerifyEmail(): Promise<any> {
return this.send("POST", "/accounts/verify-email", null, true, false);
2021-12-16 13:36:21 +01:00
}
2019-08-10 05:56:55 +02:00
postAccountVerifyEmailToken(request: VerifyEmailRequest): Promise<any> {
return this.send("POST", "/accounts/verify-email-token", request, false, false);
2018-06-29 19:58:01 +02:00
}
2021-12-16 13:36:21 +01:00
2019-09-19 14:52:57 +02:00
postAccountVerifyPassword(request: SecretVerificationRequest): Promise<any> {
return this.send("POST", "/accounts/verify-password", request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-07-13 21:55:02 +02:00
postAccountRecoverDelete(request: DeleteRecoverRequest): Promise<any> {
2019-09-19 14:52:57 +02:00
return this.send("POST", "/accounts/delete-recover", request, false, false);
}
2021-12-16 13:36:21 +01:00
2018-06-29 19:58:01 +02:00
postAccountRecoverDeleteToken(request: VerifyDeleteRecoverRequest): Promise<any> {
return this.send("POST", "/accounts/delete-recover-token", request, false, false);
}
2021-12-16 13:36:21 +01:00
2018-06-29 19:58:01 +02:00
postAccountKdf(request: KdfRequest): Promise<any> {
return this.send("POST", "/accounts/kdf", request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-06-29 19:58:01 +02:00
async deleteSsoUser(organizationId: string): Promise<any> {
return this.send("DELETE", "/accounts/sso/" + organizationId, null, true, false);
2018-06-29 05:05:25 +02:00
}
2021-12-16 13:36:21 +01:00
async getSsoUserIdentifier(): Promise<string> {
return this.send("GET", "/accounts/sso/user-identifier", null, true, true);
2021-12-16 13:36:21 +01:00
}
async postUserApiKey(id: string, request: SecretVerificationRequest): Promise<ApiKeyResponse> {
2018-07-09 22:27:03 +02:00
const r = await this.send("POST", "/accounts/api-key", request, true, true);
return new ApiKeyResponse(r);
2021-12-16 13:36:21 +01:00
}
async postUserRotateApiKey(
2018-07-09 22:27:03 +02:00
id: string,
request: SecretVerificationRequest
): Promise<ApiKeyResponse> {
const r = await this.send("POST", "/accounts/rotate-api-key", request, true, true);
return new ApiKeyResponse(r);
2018-06-30 05:40:10 +02:00
}
2021-12-16 13:36:21 +01:00
2018-06-30 19:22:21 +02:00
putUpdateTempPassword(request: UpdateTempPasswordRequest): Promise<any> {
return this.send("PUT", "/accounts/update-temp-password", request, true, false);
2021-12-16 13:36:21 +01:00
}
postAccountRequestOTP(): Promise<void> {
2018-06-30 19:22:21 +02:00
return this.send("POST", "/accounts/request-otp", null, true, false);
2021-12-16 13:36:21 +01:00
}
2018-06-30 19:22:21 +02:00
postAccountVerifyOTP(request: VerifyOTPRequest): Promise<void> {
return this.send("POST", "/accounts/verify-otp", request, true, false);
2018-07-02 15:53:43 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-12 17:35:04 +02:00
postConvertToKeyConnector(): Promise<void> {
return this.send("POST", "/accounts/convert-to-key-connector", null, true, false);
2021-12-16 13:36:21 +01:00
}
[feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-09 14:09:46 +02:00
// Account Billing APIs
async getUserBillingHistory(): Promise<BillingHistoryResponse> {
const r = await this.send("GET", "/accounts/billing/history", null, true, true);
return new BillingHistoryResponse(r);
}
async getUserBillingPayment(): Promise<BillingPaymentResponse> {
const r = await this.send("GET", "/accounts/billing/payment-method", null, true, true);
return new BillingPaymentResponse(r);
}
2018-01-09 22:19:55 +01:00
// Folder APIs
2021-12-16 13:36:21 +01:00
2018-07-12 17:35:04 +02:00
async getFolder(id: string): Promise<FolderResponse> {
const r = await this.send("GET", "/folders/" + id, null, true, true);
return new FolderResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-07-12 17:35:04 +02:00
async postFolder(request: FolderRequest): Promise<FolderResponse> {
const r = await this.send("POST", "/folders", request, true, true);
return new FolderResponse(r);
}
2021-12-16 13:36:21 +01:00
async putFolder(id: string, request: FolderRequest): Promise<FolderResponse> {
const r = await this.send("PUT", "/folders/" + id, request, true, true);
return new FolderResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-07-13 21:55:02 +02:00
deleteFolder(id: string): Promise<any> {
return this.send("DELETE", "/folders/" + id, null, true, false);
}
2021-12-16 13:36:21 +01:00
2018-06-27 23:50:12 +02:00
// Send APIs
2021-12-16 13:36:21 +01:00
2018-07-13 21:55:02 +02:00
async getSend(id: string): Promise<SendResponse> {
const r = await this.send("GET", "/sends/" + id, null, true, true);
return new SendResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-07-13 21:55:02 +02:00
async postSendAccess(
2018-08-28 01:55:05 +02:00
id: string,
request: SendAccessRequest,
apiUrl?: string
2018-08-28 01:55:05 +02:00
): Promise<SendAccessResponse> {
const addSendIdHeader = (headers: Headers) => {
headers.set("Send-Id", id);
2021-12-16 13:36:21 +01:00
};
2018-08-28 01:55:05 +02:00
const r = await this.send(
"POST",
"/sends/access/" + id,
request,
false,
true,
2021-12-16 13:36:21 +01:00
apiUrl,
addSendIdHeader
2021-12-16 13:36:21 +01:00
);
2018-08-28 01:55:05 +02:00
return new SendAccessResponse(r);
}
2021-12-16 13:36:21 +01:00
async getSendFileDownloadData(
send: SendAccessView,
request: SendAccessRequest,
apiUrl?: string
): Promise<SendFileDownloadDataResponse> {
const addSendIdHeader = (headers: Headers) => {
headers.set("Send-Id", send.id);
2021-12-16 13:36:21 +01:00
};
const r = await this.send(
"POST",
"/sends/" + send.id + "/access/file/" + send.file.id,
request,
false,
true,
apiUrl,
addSendIdHeader
2021-12-16 13:36:21 +01:00
);
return new SendFileDownloadDataResponse(r);
2021-12-16 13:36:21 +01:00
}
async getSends(): Promise<ListResponse<SendResponse>> {
2020-10-20 16:20:22 +02:00
const r = await this.send("GET", "/sends", null, true, true);
return new ListResponse(r, SendResponse);
2021-12-16 13:36:21 +01:00
}
async postSend(request: SendRequest): Promise<SendResponse> {
const r = await this.send("POST", "/sends", request, true, true);
return new SendResponse(r);
}
2021-12-16 13:36:21 +01:00
async postFileTypeSend(request: SendRequest): Promise<SendFileUploadDataResponse> {
const r = await this.send("POST", "/sends/file/v2", request, true, true);
return new SendFileUploadDataResponse(r);
}
2021-12-16 13:36:21 +01:00
async renewSendFileUploadUrl(
sendId: string,
2018-08-20 22:01:26 +02:00
fileId: string
): Promise<SendFileUploadDataResponse> {
const r = await this.send("GET", "/sends/" + sendId + "/file/" + fileId, null, true, true);
return new SendFileUploadDataResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-08-20 22:01:26 +02:00
postSendFile(sendId: string, fileId: string, data: FormData): Promise<any> {
2021-03-31 01:43:10 +02:00
return this.send("POST", "/sends/" + sendId + "/file/" + fileId, data, true, false);
2018-08-20 22:01:26 +02:00
}
2021-12-16 13:36:21 +01:00
/**
2018-01-09 22:19:55 +01:00
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
* This method still exists for backward compatibility with old server versions.
2021-12-16 13:36:21 +01:00
*/
2018-01-09 22:19:55 +01:00
async postSendFileLegacy(data: FormData): Promise<SendResponse> {
2018-06-26 04:42:57 +02:00
const r = await this.send("POST", "/sends/file", data, true, true);
return new SendResponse(r);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
async putSend(id: string, request: SendRequest): Promise<SendResponse> {
2018-06-26 04:42:57 +02:00
const r = await this.send("PUT", "/sends/" + id, request, true, true);
return new SendResponse(r);
2021-12-16 13:36:21 +01:00
}
async putSendRemovePassword(id: string): Promise<SendResponse> {
2018-07-10 19:03:24 +02:00
const r = await this.send("PUT", "/sends/" + id + "/remove-password", null, true, true);
2018-06-26 04:42:57 +02:00
return new SendResponse(r);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
deleteSend(id: string): Promise<any> {
return this.send("DELETE", "/sends/" + id, null, true, false);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
// Cipher APIs
2021-12-16 13:36:21 +01:00
async getCipher(id: string): Promise<CipherResponse> {
const r = await this.send("GET", "/ciphers/" + id, null, true, true);
return new CipherResponse(r);
}
2021-12-16 13:36:21 +01:00
async getCipherAdmin(id: string): Promise<CipherResponse> {
const r = await this.send("GET", "/ciphers/" + id + "/admin", null, true, true);
return new CipherResponse(r);
2021-12-16 13:36:21 +01:00
}
async getCiphersOrganization(organizationId: string): Promise<ListResponse<CipherResponse>> {
const r = await this.send(
2021-12-16 13:36:21 +01:00
"GET",
2018-07-04 05:33:15 +02:00
"/ciphers/organization-details?organizationId=" + organizationId,
2021-12-16 13:36:21 +01:00
null,
true,
true
);
2018-07-04 05:33:15 +02:00
return new ListResponse(r, CipherResponse);
2021-12-16 13:36:21 +01:00
}
async postCipher(request: CipherRequest): Promise<CipherResponse> {
const r = await this.send("POST", "/ciphers", request, true, true);
2018-06-26 04:42:57 +02:00
return new CipherResponse(r);
2021-12-16 13:36:21 +01:00
}
async postCipherCreate(request: CipherCreateRequest): Promise<CipherResponse> {
const r = await this.send("POST", "/ciphers/create", request, true, true);
return new CipherResponse(r);
2021-12-16 13:36:21 +01:00
}
async postCipherAdmin(request: CipherCreateRequest): Promise<CipherResponse> {
const r = await this.send("POST", "/ciphers/admin", request, true, true);
return new CipherResponse(r);
}
2021-12-16 13:36:21 +01:00
async putCipher(id: string, request: CipherRequest): Promise<CipherResponse> {
const r = await this.send("PUT", "/ciphers/" + id, request, true, true);
return new CipherResponse(r);
}
2021-12-16 13:36:21 +01:00
async putCipherAdmin(id: string, request: CipherRequest): Promise<CipherResponse> {
const r = await this.send("PUT", "/ciphers/" + id + "/admin", request, true, true);
return new CipherResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
deleteCipher(id: string): Promise<any> {
return this.send("DELETE", "/ciphers/" + id, null, true, false);
2021-12-16 13:36:21 +01:00
}
deleteCipherAdmin(id: string): Promise<any> {
2018-07-05 15:42:13 +02:00
return this.send("DELETE", "/ciphers/" + id + "/admin", null, true, false);
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
deleteManyCiphers(request: CipherBulkDeleteRequest): Promise<any> {
return this.send("DELETE", "/ciphers", request, true, false);
}
2021-12-16 13:36:21 +01:00
deleteManyCiphersAdmin(request: CipherBulkDeleteRequest): Promise<any> {
return this.send("DELETE", "/ciphers/admin", request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
putMoveCiphers(request: CipherBulkMoveRequest): Promise<any> {
return this.send("PUT", "/ciphers/move", request, true, false);
2021-12-16 13:36:21 +01:00
}
async putShareCipher(id: string, request: CipherShareRequest): Promise<CipherResponse> {
const r = await this.send("PUT", "/ciphers/" + id + "/share", request, true, true);
return new CipherResponse(r);
}
2021-12-16 13:36:21 +01:00
putShareCiphers(request: CipherBulkShareRequest): Promise<any> {
return this.send("PUT", "/ciphers/share", request, true, false);
}
2021-12-16 13:36:21 +01:00
putCipherCollections(id: string, request: CipherCollectionsRequest): Promise<any> {
return this.send("PUT", "/ciphers/" + id + "/collections", request, true, false);
}
2021-12-16 13:36:21 +01:00
putCipherCollectionsAdmin(id: string, request: CipherCollectionsRequest): Promise<any> {
return this.send("PUT", "/ciphers/" + id + "/collections-admin", request, true, false);
2021-12-16 13:36:21 +01:00
}
postPurgeCiphers(
request: SecretVerificationRequest,
organizationId: string = null
): Promise<any> {
let path = "/ciphers/purge";
if (organizationId != null) {
path += "?organizationId=" + organizationId;
2021-12-16 13:36:21 +01:00
}
return this.send("POST", path, request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
postImportCiphers(request: ImportCiphersRequest): Promise<any> {
return this.send("POST", "/ciphers/import", request, true, false);
2021-12-16 13:36:21 +01:00
}
postImportOrganizationCiphers(
organizationId: string,
request: ImportOrganizationCiphersRequest
2018-06-26 04:42:57 +02:00
): Promise<any> {
return this.send(
2021-12-16 13:36:21 +01:00
"POST",
2018-07-04 05:33:15 +02:00
"/ciphers/import-organization?organizationId=" + organizationId,
2021-12-16 13:36:21 +01:00
request,
true,
false
);
}
putDeleteCipher(id: string): Promise<any> {
return this.send("PUT", "/ciphers/" + id + "/delete", null, true, false);
}
2021-12-16 13:36:21 +01:00
putDeleteCipherAdmin(id: string): Promise<any> {
return this.send("PUT", "/ciphers/" + id + "/delete-admin", null, true, false);
}
2021-12-16 13:36:21 +01:00
putDeleteManyCiphers(request: CipherBulkDeleteRequest): Promise<any> {
return this.send("PUT", "/ciphers/delete", request, true, false);
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
putDeleteManyCiphersAdmin(request: CipherBulkDeleteRequest): Promise<any> {
2018-07-05 15:42:13 +02:00
return this.send("PUT", "/ciphers/delete-admin", request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-07-05 15:42:13 +02:00
async putRestoreCipher(id: string): Promise<CipherResponse> {
const r = await this.send("PUT", "/ciphers/" + id + "/restore", null, true, true);
return new CipherResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-07-05 15:42:13 +02:00
async putRestoreCipherAdmin(id: string): Promise<CipherResponse> {
const r = await this.send("PUT", "/ciphers/" + id + "/restore-admin", null, true, true);
return new CipherResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-07-04 05:33:15 +02:00
async putRestoreManyCiphers(
request: CipherBulkDeleteRequest
): Promise<ListResponse<CipherResponse>> {
2018-10-19 15:14:11 +02:00
const r = await this.send("PUT", "/ciphers/restore", request, true, true);
return new ListResponse<CipherResponse>(r, CipherResponse);
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
// Attachments APIs
2021-12-16 13:36:21 +01:00
2018-10-19 15:14:11 +02:00
async getAttachmentData(
cipherId: string,
attachmentId: string,
emergencyAccessId?: string
): Promise<AttachmentResponse> {
const path =
2018-07-05 15:42:13 +02:00
(emergencyAccessId != null ? "/emergency-access/" + emergencyAccessId + "/" : "/ciphers/") +
2021-12-16 13:36:21 +01:00
cipherId +
2018-07-05 15:42:13 +02:00
"/attachment/" +
2021-03-31 01:43:10 +02:00
attachmentId;
2018-07-05 15:42:13 +02:00
const r = await this.send("GET", path, null, true, true);
return new AttachmentResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
async postCipherAttachment(
id: string,
request: AttachmentRequest
): Promise<AttachmentUploadDataResponse> {
2018-06-26 04:42:57 +02:00
const r = await this.send("POST", "/ciphers/" + id + "/attachment/v2", request, true, true);
return new AttachmentUploadDataResponse(r);
2021-12-16 13:36:21 +01:00
}
/**
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
* This method still exists for backward compatibility with old server versions.
2021-12-16 13:36:21 +01:00
*/
async postCipherAttachmentLegacy(id: string, data: FormData): Promise<CipherResponse> {
const r = await this.send("POST", "/ciphers/" + id + "/attachment", data, true, true);
2018-06-26 04:42:57 +02:00
return new CipherResponse(r);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
/**
2018-07-05 15:42:13 +02:00
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
* This method still exists for backward compatibility with old server versions.
2021-12-16 13:36:21 +01:00
*/
2018-07-05 15:42:13 +02:00
async postCipherAttachmentAdminLegacy(id: string, data: FormData): Promise<CipherResponse> {
const r = await this.send("POST", "/ciphers/" + id + "/attachment-admin", data, true, true);
return new CipherResponse(r);
2018-06-12 19:07:06 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-05 15:42:13 +02:00
deleteCipherAttachment(id: string, attachmentId: string): Promise<any> {
return this.send("DELETE", "/ciphers/" + id + "/attachment/" + attachmentId, null, true, false);
}
2021-12-16 13:36:21 +01:00
deleteCipherAttachmentAdmin(id: string, attachmentId: string): Promise<any> {
return this.send(
"DELETE",
"/ciphers/" + id + "/attachment/" + attachmentId + "/admin",
null,
true,
false
);
}
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
postShareCipherAttachment(
2018-07-09 22:27:03 +02:00
id: string,
attachmentId: string,
2018-06-26 04:42:57 +02:00
data: FormData,
organizationId: string
): Promise<any> {
return this.send(
2018-10-23 22:16:59 +02:00
"POST",
"/ciphers/" + id + "/attachment/" + attachmentId + "/share?organizationId=" + organizationId,
data,
true,
2021-12-16 13:36:21 +01:00
false
2018-10-23 22:16:59 +02:00
);
2021-12-16 13:36:21 +01:00
}
2018-10-23 22:16:59 +02:00
async renewAttachmentUploadUrl(
id: string,
attachmentId: string
2018-10-23 22:16:59 +02:00
): Promise<AttachmentUploadDataResponse> {
const r = await this.send(
2021-12-16 13:36:21 +01:00
"GET",
2018-10-23 22:16:59 +02:00
"/ciphers/" + id + "/attachment/" + attachmentId + "/renew",
2021-12-16 13:36:21 +01:00
null,
true,
true
);
2018-10-23 22:16:59 +02:00
return new AttachmentUploadDataResponse(r);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-07-05 15:42:13 +02:00
postAttachmentFile(id: string, attachmentId: string, data: FormData): Promise<any> {
return this.send("POST", "/ciphers/" + id + "/attachment/" + attachmentId, data, true, false);
2021-12-16 13:36:21 +01:00
}
2018-07-05 15:42:13 +02:00
// Collections APIs
2021-12-16 13:36:21 +01:00
2018-07-04 05:33:15 +02:00
async getCollectionDetails(
organizationId: string,
id: string
): Promise<CollectionGroupDetailsResponse> {
const r = await this.send(
2021-12-16 13:36:21 +01:00
"GET",
"/organizations/" + organizationId + "/collections/" + id + "/details",
null,
true,
true
2021-12-16 13:36:21 +01:00
);
return new CollectionGroupDetailsResponse(r);
2021-12-16 13:36:21 +01:00
}
async getUserCollections(): Promise<ListResponse<CollectionResponse>> {
2018-06-26 04:42:57 +02:00
const r = await this.send("GET", "/collections", null, true, true);
return new ListResponse(r, CollectionResponse);
2018-06-23 21:41:22 +02:00
}
2021-12-16 13:36:21 +01:00
async getCollections(organizationId: string): Promise<ListResponse<CollectionResponse>> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/collections",
null,
true,
true
);
return new ListResponse(r, CollectionResponse);
}
2021-12-16 13:36:21 +01:00
async getCollectionUsers(
organizationId: string,
id: string
): Promise<SelectionReadOnlyResponse[]> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/collections/" + id + "/users",
null,
true,
true
);
return r.map((dr: any) => new SelectionReadOnlyResponse(dr));
}
2021-12-16 13:36:21 +01:00
async postCollection(
organizationId: string,
request: CollectionRequest
): Promise<CollectionResponse> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/collections",
request,
true,
true
);
return new CollectionResponse(r);
}
2021-12-16 13:36:21 +01:00
async putCollection(
organizationId: string,
id: string,
request: CollectionRequest
): Promise<CollectionResponse> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/collections/" + id,
request,
true,
true
);
return new CollectionResponse(r);
}
2021-12-16 13:36:21 +01:00
async putCollectionUsers(
organizationId: string,
id: string,
request: SelectionReadOnlyRequest[]
2018-07-10 19:03:24 +02:00
): Promise<any> {
await this.send(
2021-12-16 13:36:21 +01:00
"PUT",
"/organizations/" + organizationId + "/collections/" + id + "/users",
2021-12-16 13:36:21 +01:00
request,
true,
false
);
}
deleteCollection(organizationId: string, id: string): Promise<any> {
return this.send(
2021-12-16 13:36:21 +01:00
"DELETE",
"/organizations/" + organizationId + "/collections/" + id,
null,
true,
false
);
}
2021-12-16 13:36:21 +01:00
deleteCollectionUser(
organizationId: string,
id: string,
organizationUserId: string
): Promise<any> {
2018-06-26 04:42:57 +02:00
return this.send(
"DELETE",
"/organizations/" + organizationId + "/collections/" + id + "/user/" + organizationUserId,
null,
true,
false
);
2018-06-12 17:45:02 +02:00
}
2021-12-16 13:36:21 +01:00
// Groups APIs
2021-12-16 13:36:21 +01:00
async getGroupDetails(organizationId: string, id: string): Promise<GroupDetailsResponse> {
2018-07-05 15:42:13 +02:00
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/groups/" + id + "/details",
null,
true,
true
);
return new GroupDetailsResponse(r);
2018-06-12 19:07:06 +02:00
}
2021-12-16 13:36:21 +01:00
2018-06-12 17:45:02 +02:00
async getGroups(organizationId: string): Promise<ListResponse<GroupResponse>> {
2018-06-26 04:42:57 +02:00
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/groups",
null,
true,
2021-12-16 13:36:21 +01:00
true
2018-06-26 04:42:57 +02:00
);
return new ListResponse(r, GroupResponse);
2021-12-16 13:36:21 +01:00
}
async getGroupUsers(organizationId: string, id: string): Promise<string[]> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/groups/" + id + "/users",
null,
true,
true
);
return r;
}
2021-12-16 13:36:21 +01:00
2018-07-06 18:40:43 +02:00
async postGroup(organizationId: string, request: GroupRequest): Promise<GroupResponse> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/groups",
request,
true,
true
);
return new GroupResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-10-17 17:18:12 +02:00
async putGroup(
organizationId: string,
id: string,
2018-10-17 17:18:12 +02:00
request: GroupRequest
): Promise<GroupResponse> {
const r = await this.send(
"PUT",
2018-07-04 05:33:15 +02:00
"/organizations/" + organizationId + "/groups/" + id,
request,
true,
true
);
return new GroupResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-10-18 04:56:28 +02:00
async putGroupUsers(organizationId: string, id: string, request: string[]): Promise<any> {
2018-07-06 18:40:43 +02:00
await this.send(
"PUT",
"/organizations/" + organizationId + "/groups/" + id + "/users",
request,
true,
2021-12-16 13:36:21 +01:00
false
2018-07-06 18:40:43 +02:00
);
}
2021-12-16 13:36:21 +01:00
2018-07-09 22:27:03 +02:00
deleteGroup(organizationId: string, id: string): Promise<any> {
return this.send(
"DELETE",
"/organizations/" + organizationId + "/groups/" + id,
null,
true,
2021-12-16 13:36:21 +01:00
false
2018-07-09 22:27:03 +02:00
);
2018-07-06 18:40:43 +02:00
}
2021-12-16 13:36:21 +01:00
2018-10-18 04:18:28 +02:00
deleteGroupUser(organizationId: string, id: string, organizationUserId: string): Promise<any> {
return this.send(
"DELETE",
"/organizations/" + organizationId + "/groups/" + id + "/user/" + organizationUserId,
null,
true,
false
);
}
2021-12-16 13:36:21 +01:00
2020-01-15 17:24:00 +01:00
// Policy APIs
2021-12-16 13:36:21 +01:00
2018-07-09 22:27:03 +02:00
async getPolicy(organizationId: string, type: PolicyType): Promise<PolicyResponse> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/policies/" + type,
null,
true,
2021-12-16 13:36:21 +01:00
true
);
2018-07-09 22:27:03 +02:00
return new PolicyResponse(r);
2018-07-06 18:40:43 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-10 05:47:12 +02:00
async getPolicies(organizationId: string): Promise<ListResponse<PolicyResponse>> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/policies",
null,
true,
2018-07-06 18:40:43 +02:00
true
);
return new ListResponse(r, PolicyResponse);
}
2021-12-16 13:36:21 +01:00
2018-07-06 18:40:43 +02:00
async getPoliciesByToken(
organizationId: string,
token: string,
email: string,
organizationUserId: string
2018-07-06 18:40:43 +02:00
): Promise<ListResponse<PolicyResponse>> {
const r = await this.send(
"GET",
"/organizations/" +
organizationId +
2020-03-02 17:37:44 +01:00
"/policies/token?" +
2021-12-16 13:36:21 +01:00
"token=" +
2020-03-02 17:37:44 +01:00
encodeURIComponent(token) +
2021-12-16 13:36:21 +01:00
"&email=" +
2020-03-02 17:37:44 +01:00
encodeURIComponent(email) +
2018-07-10 05:47:12 +02:00
"&organizationUserId=" +
2018-07-06 18:40:43 +02:00
organizationUserId,
null,
false,
true
);
return new ListResponse(r, PolicyResponse);
}
2021-12-16 13:36:21 +01:00
async getPoliciesByInvitedUser(
organizationId: string,
userId: string
): Promise<ListResponse<PolicyResponse>> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/policies/invited-user?" + "userId=" + userId,
null,
false,
true
);
return new ListResponse(r, PolicyResponse);
}
2018-10-18 04:56:28 +02:00
async putPolicy(
organizationId: string,
2020-01-20 14:54:51 +01:00
type: PolicyType,
2018-10-18 04:56:28 +02:00
request: PolicyRequest
): Promise<PolicyResponse> {
2018-07-06 18:40:43 +02:00
const r = await this.send(
2018-07-09 22:27:03 +02:00
"PUT",
"/organizations/" + organizationId + "/policies/" + type,
request,
true,
true
);
2018-07-06 18:40:43 +02:00
return new PolicyResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-07-06 21:00:55 +02:00
// Organization User APIs
2021-12-16 13:36:21 +01:00
2018-10-18 04:56:28 +02:00
async getOrganizationUser(
organizationId: string,
id: string
): Promise<OrganizationUserDetailsResponse> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/users/" + id,
2018-07-09 22:27:03 +02:00
null,
true,
true
2021-12-16 13:36:21 +01:00
);
2018-07-09 22:27:03 +02:00
return new OrganizationUserDetailsResponse(r);
2018-07-06 18:40:43 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-10 05:47:12 +02:00
async getOrganizationUserGroups(organizationId: string, id: string): Promise<string[]> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/users/" + id + "/groups",
null,
true,
2021-12-16 13:36:21 +01:00
true
2018-07-10 05:47:12 +02:00
);
2018-07-10 19:03:24 +02:00
return r;
2021-12-16 13:36:21 +01:00
}
2018-07-10 05:47:12 +02:00
async getOrganizationUsers(
2020-01-20 14:54:51 +01:00
organizationId: string
2020-01-15 17:24:00 +01:00
): Promise<ListResponse<OrganizationUserUserDetailsResponse>> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/users",
null,
true,
true
);
return new ListResponse(r, OrganizationUserUserDetailsResponse);
}
2021-12-16 13:36:21 +01:00
async getOrganizationUserResetPasswordDetails(
organizationId: string,
id: string
): Promise<OrganizationUserResetPasswordDetailsReponse> {
2020-03-02 17:37:44 +01:00
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/users/" + id + "/reset-password-details",
null,
true,
2021-12-16 13:36:21 +01:00
true
);
2020-03-02 17:37:44 +01:00
return new OrganizationUserResetPasswordDetailsReponse(r);
2021-12-16 13:36:21 +01:00
}
2020-03-02 17:37:44 +01:00
async getOrganizationAutoEnrollStatus(
2020-01-20 14:54:51 +01:00
identifier: string
): Promise<OrganizationAutoEnrollStatusResponse> {
const r = await this.send(
"GET",
"/organizations/" + identifier + "/auto-enroll-status",
2021-12-16 13:36:21 +01:00
null,
2020-01-20 14:54:51 +01:00
true,
true
2021-12-16 13:36:21 +01:00
);
2020-01-20 14:54:51 +01:00
return new OrganizationAutoEnrollStatusResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-07-10 19:03:24 +02:00
postOrganizationUserInvite(
organizationId: string,
2020-01-20 14:54:51 +01:00
request: OrganizationUserInviteRequest
): Promise<any> {
2020-01-20 14:54:51 +01:00
return this.send(
2021-12-16 13:36:21 +01:00
"POST",
2020-01-20 14:54:51 +01:00
"/organizations/" + organizationId + "/users/invite",
2020-01-15 17:24:00 +01:00
request,
2021-12-16 13:36:21 +01:00
true,
2018-07-10 19:03:24 +02:00
false
2021-12-16 13:36:21 +01:00
);
}
2018-07-10 19:03:24 +02:00
postOrganizationUserReinvite(organizationId: string, id: string): Promise<any> {
return this.send(
"POST",
"/organizations/" + organizationId + "/users/" + id + "/reinvite",
null,
true,
2018-07-06 21:00:55 +02:00
false
2021-12-16 13:36:21 +01:00
);
}
2018-07-06 21:00:55 +02:00
async postManyOrganizationUserReinvite(
organizationId: string,
request: OrganizationUserBulkRequest
): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/users/reinvite",
request,
true,
true
);
return new ListResponse(r, OrganizationUserBulkResponse);
}
2021-12-16 13:36:21 +01:00
postOrganizationUserAccept(
organizationId: string,
2018-07-10 19:03:24 +02:00
id: string,
request: OrganizationUserAcceptRequest
): Promise<any> {
return this.send(
"POST",
"/organizations/" + organizationId + "/users/" + id + "/accept",
request,
true,
false
);
}
2021-12-16 13:36:21 +01:00
postOrganizationUserConfirm(
organizationId: string,
id: string,
request: OrganizationUserConfirmRequest
2018-07-10 19:03:24 +02:00
): Promise<any> {
return this.send(
"POST",
"/organizations/" + organizationId + "/users/" + id + "/confirm",
request,
true,
false
);
}
2021-12-16 13:36:21 +01:00
async postOrganizationUsersPublicKey(
organizationId: string,
request: OrganizationUserBulkRequest
): Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/users/public-keys",
request,
true,
true
);
return new ListResponse(r, OrganizationUserBulkPublicKeyResponse);
}
2021-12-16 13:36:21 +01:00
async postOrganizationUserBulkConfirm(
organizationId: string,
request: OrganizationUserBulkConfirmRequest
): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/users/confirm",
request,
true,
true
);
return new ListResponse(r, OrganizationUserBulkResponse);
}
2021-12-16 13:36:21 +01:00
2018-07-10 19:03:24 +02:00
putOrganizationUser(
organizationId: string,
id: string,
request: OrganizationUserUpdateRequest
): Promise<any> {
return this.send(
"PUT",
"/organizations/" + organizationId + "/users/" + id,
request,
true,
false
);
}
2021-12-16 13:36:21 +01:00
2018-07-10 19:03:24 +02:00
putOrganizationUserGroups(
organizationId: string,
id: string,
request: OrganizationUserUpdateGroupsRequest
): Promise<any> {
return this.send(
"PUT",
"/organizations/" + organizationId + "/users/" + id + "/groups",
request,
true,
false
);
}
2021-12-16 13:36:21 +01:00
putOrganizationUserResetPasswordEnrollment(
organizationId: string,
userId: string,
request: OrganizationUserResetPasswordEnrollmentRequest
): Promise<any> {
return this.send(
"PUT",
"/organizations/" + organizationId + "/users/" + userId + "/reset-password-enrollment",
request,
true,
false
);
}
2021-12-16 13:36:21 +01:00
2018-07-10 19:03:24 +02:00
putOrganizationUserResetPassword(
organizationId: string,
id: string,
request: OrganizationUserResetPasswordRequest
2018-07-10 19:03:24 +02:00
): Promise<any> {
return this.send(
"PUT",
"/organizations/" + organizationId + "/users/" + id + "/reset-password",
request,
true,
false
);
}
2021-12-16 13:36:21 +01:00
deleteOrganizationUser(organizationId: string, id: string): Promise<any> {
2018-06-26 04:42:57 +02:00
return this.send(
"DELETE",
"/organizations/" + organizationId + "/users/" + id,
null,
true,
false
);
}
2021-12-16 13:36:21 +01:00
async deleteManyOrganizationUsers(
organizationId: string,
request: OrganizationUserBulkRequest
): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send(
"DELETE",
"/organizations/" + organizationId + "/users",
request,
true,
2021-12-16 13:36:21 +01:00
true
);
return new ListResponse(r, OrganizationUserBulkResponse);
}
2021-12-16 13:36:21 +01:00
deactivateOrganizationUser(organizationId: string, id: string): Promise<any> {
return this.send(
"PUT",
"/organizations/" + organizationId + "/users/" + id + "/deactivate",
null,
true,
false
);
}
async deactivateManyOrganizationUsers(
organizationId: string,
request: OrganizationUserBulkRequest
): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/users/deactivate",
request,
true,
true
);
return new ListResponse(r, OrganizationUserBulkResponse);
}
activateOrganizationUser(organizationId: string, id: string): Promise<any> {
return this.send(
"PUT",
"/organizations/" + organizationId + "/users/" + id + "/activate",
null,
true,
false
);
}
async activateManyOrganizationUsers(
organizationId: string,
request: OrganizationUserBulkRequest
): Promise<ListResponse<OrganizationUserBulkResponse>> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/users/activate",
request,
true,
true
);
return new ListResponse(r, OrganizationUserBulkResponse);
}
// Plan APIs
2021-12-16 13:36:21 +01:00
async getPlans(): Promise<ListResponse<PlanResponse>> {
const r = await this.send("GET", "/plans/", null, true, true);
return new ListResponse(r, PlanResponse);
}
2021-12-16 13:36:21 +01:00
2018-06-26 05:04:59 +02:00
async postImportDirectory(organizationId: string, request: ImportDirectoryRequest): Promise<any> {
return this.send("POST", "/organizations/" + organizationId + "/import", request, true, false);
}
2021-12-16 13:36:21 +01:00
2018-06-26 05:04:59 +02:00
async postPublicImportDirectory(request: OrganizationImportRequest): Promise<any> {
return this.send("POST", "/public/organization/import", request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-06-26 05:04:59 +02:00
async getTaxRates(): Promise<ListResponse<TaxRateResponse>> {
const r = await this.send("GET", "/plans/sales-tax-rates/", null, true, true);
return new ListResponse(r, TaxRateResponse);
}
2021-12-16 13:36:21 +01:00
// Settings APIs
2021-12-16 13:36:21 +01:00
async getSettingsDomains(): Promise<DomainsResponse> {
const r = await this.send("GET", "/settings/domains", null, true, true);
return new DomainsResponse(r);
2021-12-16 13:36:21 +01:00
}
async putSettingsDomains(request: UpdateDomainsRequest): Promise<DomainsResponse> {
const r = await this.send("PUT", "/settings/domains", request, true, true);
2018-06-26 05:04:59 +02:00
return new DomainsResponse(r);
2021-12-16 13:36:21 +01:00
}
// Sync APIs
2021-12-16 13:36:21 +01:00
async getSync(): Promise<SyncResponse> {
const path = this.isDesktopClient || this.isWebClient ? "/sync?excludeDomains=true" : "/sync";
const r = await this.send("GET", path, null, true, true);
return new SyncResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-06-27 23:50:12 +02:00
// Two-factor APIs
2021-12-16 13:36:21 +01:00
2018-06-26 21:17:14 +02:00
async getTwoFactorProviders(): Promise<ListResponse<TwoFactorProviderResponse>> {
const r = await this.send("GET", "/two-factor", null, true, true);
return new ListResponse(r, TwoFactorProviderResponse);
}
2021-12-16 13:36:21 +01:00
2018-07-18 23:07:59 +02:00
async getTwoFactorOrganizationProviders(
organizationId: string
): Promise<ListResponse<TwoFactorProviderResponse>> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/two-factor",
null,
2018-06-26 21:17:14 +02:00
true,
true
);
return new ListResponse(r, TwoFactorProviderResponse);
}
2021-12-16 13:36:21 +01:00
async getTwoFactorAuthenticator(
request: SecretVerificationRequest
): Promise<TwoFactorAuthenticatorResponse> {
2018-06-26 21:17:14 +02:00
const r = await this.send("POST", "/two-factor/get-authenticator", request, true, true);
return new TwoFactorAuthenticatorResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-06-26 21:17:14 +02:00
async getTwoFactorEmail(request: SecretVerificationRequest): Promise<TwoFactorEmailResponse> {
const r = await this.send("POST", "/two-factor/get-email", request, true, true);
return new TwoFactorEmailResponse(r);
}
2021-12-16 13:36:21 +01:00
async getTwoFactorDuo(request: SecretVerificationRequest): Promise<TwoFactorDuoResponse> {
2018-06-26 21:17:14 +02:00
const r = await this.send("POST", "/two-factor/get-duo", request, true, true);
return new TwoFactorDuoResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-07-18 23:07:59 +02:00
async getTwoFactorOrganizationDuo(
organizationId: string,
request: SecretVerificationRequest
): Promise<TwoFactorDuoResponse> {
2018-07-18 23:07:59 +02:00
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/two-factor/get-duo",
request,
true,
true
);
return new TwoFactorDuoResponse(r);
2021-12-16 13:36:21 +01:00
}
async getTwoFactorYubiKey(request: SecretVerificationRequest): Promise<TwoFactorYubiKeyResponse> {
2018-06-26 21:17:14 +02:00
const r = await this.send("POST", "/two-factor/get-yubikey", request, true, true);
return new TwoFactorYubiKeyResponse(r);
}
2021-12-16 13:36:21 +01:00
async getTwoFactorWebAuthn(
request: SecretVerificationRequest
): Promise<TwoFactorWebAuthnResponse> {
2021-03-15 16:16:51 +01:00
const r = await this.send("POST", "/two-factor/get-webauthn", request, true, true);
return new TwoFactorWebAuthnResponse(r);
2018-06-26 21:17:14 +02:00
}
2021-12-16 13:36:21 +01:00
async getTwoFactorWebAuthnChallenge(
request: SecretVerificationRequest
): Promise<ChallengeResponse> {
2021-03-15 16:16:51 +01:00
const r = await this.send("POST", "/two-factor/get-webauthn-challenge", request, true, true);
2018-10-08 20:21:53 +02:00
return new ChallengeResponse(r);
}
2021-12-16 13:36:21 +01:00
async getTwoFactorRecover(request: SecretVerificationRequest): Promise<TwoFactorRecoverResponse> {
2018-06-26 21:17:14 +02:00
const r = await this.send("POST", "/two-factor/get-recover", request, true, true);
return new TwoFactorRecoverResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-06-26 21:17:14 +02:00
async putTwoFactorAuthenticator(
request: UpdateTwoFactorAuthenticatorRequest
): Promise<TwoFactorAuthenticatorResponse> {
const r = await this.send("PUT", "/two-factor/authenticator", request, true, true);
return new TwoFactorAuthenticatorResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-06-26 21:17:14 +02:00
async putTwoFactorEmail(request: UpdateTwoFactorEmailRequest): Promise<TwoFactorEmailResponse> {
const r = await this.send("PUT", "/two-factor/email", request, true, true);
return new TwoFactorEmailResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-06-26 21:17:14 +02:00
async putTwoFactorDuo(request: UpdateTwoFactorDuoRequest): Promise<TwoFactorDuoResponse> {
const r = await this.send("PUT", "/two-factor/duo", request, true, true);
return new TwoFactorDuoResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-07-18 23:07:59 +02:00
async putTwoFactorOrganizationDuo(
organizationId: string,
request: UpdateTwoFactorDuoRequest
): Promise<TwoFactorDuoResponse> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/two-factor/duo",
request,
true,
true
);
return new TwoFactorDuoResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-06-26 21:17:14 +02:00
async putTwoFactorYubiKey(
request: UpdateTwoFactorYubioOtpRequest
): Promise<TwoFactorYubiKeyResponse> {
const r = await this.send("PUT", "/two-factor/yubikey", request, true, true);
return new TwoFactorYubiKeyResponse(r);
}
2021-12-16 13:36:21 +01:00
2021-03-15 16:16:51 +01:00
async putTwoFactorWebAuthn(
request: UpdateTwoFactorWebAuthnRequest
): Promise<TwoFactorWebAuthnResponse> {
const response = request.deviceResponse.response as AuthenticatorAttestationResponse;
const data: any = Object.assign({}, request);
2021-12-16 13:36:21 +01:00
2021-03-15 16:16:51 +01:00
data.deviceResponse = {
id: request.deviceResponse.id,
rawId: btoa(request.deviceResponse.id),
type: request.deviceResponse.type,
extensions: request.deviceResponse.getClientExtensionResults(),
response: {
AttestationObject: Utils.fromBufferToB64(response.attestationObject),
clientDataJson: Utils.fromBufferToB64(response.clientDataJSON),
},
};
2021-12-16 13:36:21 +01:00
2021-03-15 16:16:51 +01:00
const r = await this.send("PUT", "/two-factor/webauthn", data, true, true);
return new TwoFactorWebAuthnResponse(r);
2018-06-26 21:17:14 +02:00
}
2021-12-16 13:36:21 +01:00
2021-03-15 16:16:51 +01:00
async deleteTwoFactorWebAuthn(
request: UpdateTwoFactorWebAuthnDeleteRequest
): Promise<TwoFactorWebAuthnResponse> {
const r = await this.send("DELETE", "/two-factor/webauthn", request, true, true);
return new TwoFactorWebAuthnResponse(r);
2018-10-08 20:21:53 +02:00
}
2021-12-16 13:36:21 +01:00
2018-06-26 21:17:14 +02:00
async putTwoFactorDisable(request: TwoFactorProviderRequest): Promise<TwoFactorProviderResponse> {
const r = await this.send("PUT", "/two-factor/disable", request, true, true);
return new TwoFactorProviderResponse(r);
2018-07-18 23:07:59 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-18 23:07:59 +02:00
async putTwoFactorOrganizationDisable(
organizationId: string,
request: TwoFactorProviderRequest
): Promise<TwoFactorProviderResponse> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/two-factor/disable",
request,
true,
true
);
return new TwoFactorProviderResponse(r);
2018-06-26 21:17:14 +02:00
}
2021-12-16 13:36:21 +01:00
2018-06-26 21:17:14 +02:00
postTwoFactorRecover(request: TwoFactorRecoveryRequest): Promise<any> {
return this.send("POST", "/two-factor/recover", request, false, false);
}
2021-12-16 13:36:21 +01:00
2018-06-27 23:50:12 +02:00
postTwoFactorEmailSetup(request: TwoFactorEmailRequest): Promise<any> {
return this.send("POST", "/two-factor/send-email", request, true, false);
}
2021-12-16 13:36:21 +01:00
2018-06-27 23:50:12 +02:00
postTwoFactorEmail(request: TwoFactorEmailRequest): Promise<any> {
return this.send("POST", "/two-factor/send-email-login", request, false, false);
}
2021-12-16 13:36:21 +01:00
async getDeviceVerificationSettings(): Promise<DeviceVerificationResponse> {
const r = await this.send(
"GET",
"/two-factor/get-device-verification-settings",
null,
true,
true
);
return new DeviceVerificationResponse(r);
}
async putDeviceVerificationSettings(
request: DeviceVerificationRequest
): Promise<DeviceVerificationResponse> {
const r = await this.send(
"PUT",
"/two-factor/device-verification-settings",
request,
true,
true
);
return new DeviceVerificationResponse(r);
}
// Emergency Access APIs
2021-12-16 13:36:21 +01:00
async getEmergencyAccessTrusted(): Promise<ListResponse<EmergencyAccessGranteeDetailsResponse>> {
const r = await this.send("GET", "/emergency-access/trusted", null, true, true);
return new ListResponse(r, EmergencyAccessGranteeDetailsResponse);
}
2021-12-16 13:36:21 +01:00
async getEmergencyAccessGranted(): Promise<ListResponse<EmergencyAccessGrantorDetailsResponse>> {
const r = await this.send("GET", "/emergency-access/granted", null, true, true);
return new ListResponse(r, EmergencyAccessGrantorDetailsResponse);
}
2021-12-16 13:36:21 +01:00
async getEmergencyAccess(id: string): Promise<EmergencyAccessGranteeDetailsResponse> {
const r = await this.send("GET", "/emergency-access/" + id, null, true, true);
return new EmergencyAccessGranteeDetailsResponse(r);
}
2021-12-16 13:36:21 +01:00
async getEmergencyGrantorPolicies(id: string): Promise<ListResponse<PolicyResponse>> {
const r = await this.send("GET", "/emergency-access/" + id + "/policies", null, true, true);
return new ListResponse(r, PolicyResponse);
2021-12-16 13:36:21 +01:00
}
putEmergencyAccess(id: string, request: EmergencyAccessUpdateRequest): Promise<any> {
return this.send("PUT", "/emergency-access/" + id, request, true, false);
}
2021-12-16 13:36:21 +01:00
deleteEmergencyAccess(id: string): Promise<any> {
return this.send("DELETE", "/emergency-access/" + id, null, true, false);
2021-12-16 13:36:21 +01:00
}
postEmergencyAccessInvite(request: EmergencyAccessInviteRequest): Promise<any> {
return this.send("POST", "/emergency-access/invite", request, true, false);
}
2021-12-16 13:36:21 +01:00
postEmergencyAccessReinvite(id: string): Promise<any> {
return this.send("POST", "/emergency-access/" + id + "/reinvite", null, true, false);
}
2021-12-16 13:36:21 +01:00
postEmergencyAccessAccept(id: string, request: EmergencyAccessAcceptRequest): Promise<any> {
return this.send("POST", "/emergency-access/" + id + "/accept", request, true, false);
2021-12-16 13:36:21 +01:00
}
postEmergencyAccessConfirm(id: string, request: EmergencyAccessConfirmRequest): Promise<any> {
return this.send("POST", "/emergency-access/" + id + "/confirm", request, true, false);
}
2021-12-16 13:36:21 +01:00
postEmergencyAccessInitiate(id: string): Promise<any> {
return this.send("POST", "/emergency-access/" + id + "/initiate", null, true, false);
}
2021-12-16 13:36:21 +01:00
postEmergencyAccessApprove(id: string): Promise<any> {
return this.send("POST", "/emergency-access/" + id + "/approve", null, true, false);
}
2021-12-16 13:36:21 +01:00
postEmergencyAccessReject(id: string): Promise<any> {
return this.send("POST", "/emergency-access/" + id + "/reject", null, true, false);
2021-12-16 13:36:21 +01:00
}
async postEmergencyAccessTakeover(id: string): Promise<EmergencyAccessTakeoverResponse> {
const r = await this.send("POST", "/emergency-access/" + id + "/takeover", null, true, true);
2018-01-09 22:19:55 +01:00
return new EmergencyAccessTakeoverResponse(r);
2021-12-16 13:36:21 +01:00
}
async postEmergencyAccessPassword(
id: string,
request: EmergencyAccessPasswordRequest
): Promise<any> {
2022-02-22 15:39:11 +01:00
await this.send("POST", "/emergency-access/" + id + "/password", request, true, true);
}
2021-12-16 13:36:21 +01:00
async postEmergencyAccessView(id: string): Promise<EmergencyAccessViewResponse> {
const r = await this.send("POST", "/emergency-access/" + id + "/view", null, true, true);
return new EmergencyAccessViewResponse(r);
2021-12-16 13:36:21 +01:00
}
// Organization APIs
2021-12-16 13:36:21 +01:00
async getOrganization(id: string): Promise<OrganizationResponse> {
const r = await this.send("GET", "/organizations/" + id, null, true, true);
return new OrganizationResponse(r);
}
2021-12-16 13:36:21 +01:00
async getOrganizationBilling(id: string): Promise<BillingResponse> {
const r = await this.send("GET", "/organizations/" + id + "/billing", null, true, true);
return new BillingResponse(r);
}
2021-12-16 13:36:21 +01:00
async getOrganizationSubscription(id: string): Promise<OrganizationSubscriptionResponse> {
const r = await this.send("GET", "/organizations/" + id + "/subscription", null, true, true);
return new OrganizationSubscriptionResponse(r);
}
2021-12-16 13:36:21 +01:00
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
async getCloudCommunicationsEnabled(): Promise<boolean> {
const r = await this.send("GET", "/organizations/connections/enabled", null, true, true);
return r as boolean;
}
async getOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
id: string,
type: OrganizationConnectionType,
configType: { new (response: any): TConfig }
): Promise<OrganizationConnectionResponse<TConfig>> {
const r = await this.send("GET", `/organizations/connections/${id}/${type}`, null, true, true);
return new OrganizationConnectionResponse(r, configType);
}
async createOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
request: OrganizationConnectionRequest,
configType: { new (response: any): TConfig }
): Promise<OrganizationConnectionResponse<TConfig>> {
const r = await this.send("POST", "/organizations/connections/", request, true, true);
return new OrganizationConnectionResponse(r, configType);
}
async updateOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
request: OrganizationConnectionRequest,
configType: { new (response: any): TConfig },
organizationConnectionId?: string
): Promise<OrganizationConnectionResponse<TConfig>> {
const r = await this.send(
"PUT",
"/organizations/connections/" + organizationConnectionId,
request,
true,
true
);
return new OrganizationConnectionResponse(r, configType);
}
async deleteOrganizationConnection(id: string): Promise<void> {
return this.send("DELETE", "/organizations/connections/" + id, null, true, false);
}
async getOrganizationLicense(id: string, installationId: string): Promise<any> {
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
return this.send(
2021-12-16 13:36:21 +01:00
"GET",
"/organizations/" + id + "/license?installationId=" + installationId,
2021-12-16 13:36:21 +01:00
null,
true,
true
);
}
async getOrganizationTaxInfo(id: string): Promise<TaxInfoResponse> {
const r = await this.send("GET", "/organizations/" + id + "/tax", null, true, true);
return new TaxInfoResponse(r);
}
2021-12-16 13:36:21 +01:00
2018-07-16 18:30:45 +02:00
async getOrganizationSso(id: string): Promise<OrganizationSsoResponse> {
const r = await this.send("GET", "/organizations/" + id + "/sso", null, true, true);
return new OrganizationSsoResponse(r);
}
2021-12-16 13:36:21 +01:00
async postOrganization(request: OrganizationCreateRequest): Promise<OrganizationResponse> {
2018-07-16 23:16:15 +02:00
const r = await this.send("POST", "/organizations", request, true, true);
return new OrganizationResponse(r);
}
2021-12-16 13:36:21 +01:00
async putOrganization(
id: string,
request: OrganizationUpdateRequest
): Promise<OrganizationResponse> {
const r = await this.send("PUT", "/organizations/" + id, request, true, true);
return new OrganizationResponse(r);
2018-07-16 23:16:15 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-17 17:25:15 +02:00
async putOrganizationTaxInfo(
id: string,
request: OrganizationTaxInfoUpdateRequest
): Promise<any> {
2018-07-17 17:25:15 +02:00
return this.send("PUT", "/organizations/" + id + "/tax", request, true, false);
2021-12-16 13:36:21 +01:00
}
2018-07-17 17:25:15 +02:00
postLeaveOrganization(id: string): Promise<any> {
return this.send("POST", "/organizations/" + id + "/leave", null, true, false);
}
2021-12-16 13:36:21 +01:00
2020-06-13 01:29:52 +02:00
async postOrganizationLicense(data: FormData): Promise<OrganizationResponse> {
const r = await this.send("POST", "/organizations/license", data, true, true);
return new OrganizationResponse(r);
}
2021-12-16 13:36:21 +01:00
async postOrganizationLicenseUpdate(id: string, data: FormData): Promise<any> {
return this.send("POST", "/organizations/" + id + "/license", data, true, false);
2021-12-16 13:36:21 +01:00
}
async postOrganizationApiKey(
id: string,
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
request: OrganizationApiKeyRequest
2018-07-02 21:36:32 +02:00
): Promise<ApiKeyResponse> {
const r = await this.send("POST", "/organizations/" + id + "/api-key", request, true, true);
return new ApiKeyResponse(r);
2021-12-16 13:36:21 +01:00
}
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
async getOrganizationApiKeyInformation(
id: string
): Promise<ListResponse<OrganizationApiKeyInformationResponse>> {
const r = await this.send(
"GET",
"/organizations/" + id + "/api-key-information",
null,
true,
true
);
return new ListResponse(r, OrganizationApiKeyInformationResponse);
}
2018-07-02 21:36:32 +02:00
async postOrganizationRotateApiKey(
2018-07-16 18:30:45 +02:00
id: string,
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
request: OrganizationApiKeyRequest
): Promise<ApiKeyResponse> {
const r = await this.send(
2021-12-16 13:36:21 +01:00
"POST",
2018-07-16 18:30:45 +02:00
"/organizations/" + id + "/rotate-api-key",
2021-12-16 13:36:21 +01:00
request,
true,
true
);
2018-10-18 04:56:28 +02:00
return new ApiKeyResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-07-16 18:30:45 +02:00
async postOrganizationSso(
id: string,
2018-07-16 18:30:45 +02:00
request: OrganizationSsoRequest
): Promise<OrganizationSsoResponse> {
const r = await this.send("POST", "/organizations/" + id + "/sso", request, true, true);
return new OrganizationSsoResponse(r);
}
2021-12-16 13:36:21 +01:00
2020-06-13 01:29:52 +02:00
async postOrganizationUpgrade(
id: string,
request: OrganizationUpgradeRequest
): Promise<PaymentResponse> {
2018-07-09 22:27:03 +02:00
const r = await this.send("POST", "/organizations/" + id + "/upgrade", request, true, true);
2020-06-13 01:29:52 +02:00
return new PaymentResponse(r);
2021-12-16 13:36:21 +01:00
}
async postOrganizationUpdateSubscription(
2020-06-13 01:29:52 +02:00
id: string,
request: OrganizationSubscriptionUpdateRequest
): Promise<void> {
2020-06-13 01:29:52 +02:00
return this.send("POST", "/organizations/" + id + "/subscription", request, true, false);
2018-07-04 15:54:14 +02:00
}
2021-12-16 13:36:21 +01:00
async postOrganizationSeat(id: string, request: SeatRequest): Promise<PaymentResponse> {
2019-03-07 16:58:27 +01:00
const r = await this.send("POST", "/organizations/" + id + "/seat", request, true, true);
return new PaymentResponse(r);
}
2021-12-16 13:36:21 +01:00
async postOrganizationStorage(id: string, request: StorageRequest): Promise<PaymentResponse> {
2019-03-07 16:58:27 +01:00
const r = await this.send("POST", "/organizations/" + id + "/storage", request, true, true);
2019-08-10 05:56:55 +02:00
return new PaymentResponse(r);
2021-12-16 13:36:21 +01:00
}
2019-03-07 16:58:27 +01:00
postOrganizationPayment(id: string, request: PaymentRequest): Promise<any> {
return this.send("POST", "/organizations/" + id + "/payment", request, true, false);
}
2021-12-16 13:36:21 +01:00
postOrganizationVerifyBank(id: string, request: VerifyBankRequest): Promise<any> {
return this.send("POST", "/organizations/" + id + "/verify-bank", request, true, false);
2021-12-16 13:36:21 +01:00
}
postOrganizationCancel(id: string): Promise<any> {
return this.send("POST", "/organizations/" + id + "/cancel", null, true, false);
}
2021-12-16 13:36:21 +01:00
2019-08-10 05:56:55 +02:00
postOrganizationReinstate(id: string): Promise<any> {
return this.send("POST", "/organizations/" + id + "/reinstate", null, true, false);
2021-12-16 13:36:21 +01:00
}
2019-08-10 05:56:55 +02:00
deleteOrganization(id: string, request: SecretVerificationRequest): Promise<any> {
return this.send("DELETE", "/organizations/" + id, request, true, false);
2019-03-22 02:38:52 +01:00
}
2021-12-16 13:36:21 +01:00
async getOrganizationKeys(id: string): Promise<OrganizationKeysResponse> {
const r = await this.send("GET", "/organizations/" + id + "/keys", null, true, true);
return new OrganizationKeysResponse(r);
}
2021-12-16 13:36:21 +01:00
2019-08-10 19:14:53 +02:00
async postOrganizationKeys(
id: string,
request: OrganizationKeysRequest
): Promise<OrganizationKeysResponse> {
const r = await this.send("POST", "/organizations/" + id + "/keys", request, true, true);
return new OrganizationKeysResponse(r);
2018-07-17 18:05:19 +02:00
}
2021-12-16 13:36:21 +01:00
// Provider APIs
2021-12-16 13:36:21 +01:00
async postProviderSetup(id: string, request: ProviderSetupRequest) {
const r = await this.send("POST", "/providers/" + id + "/setup", request, true, true);
return new ProviderResponse(r);
2018-07-16 23:16:15 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-16 23:16:15 +02:00
async getProvider(id: string) {
const r = await this.send("GET", "/providers/" + id, null, true, true);
return new ProviderResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-07-16 23:16:15 +02:00
async putProvider(id: string, request: ProviderUpdateRequest) {
const r = await this.send("PUT", "/providers/" + id, request, true, true);
return new ProviderResponse(r);
2021-12-16 13:36:21 +01:00
}
// Provider User APIs
2021-12-16 13:36:21 +01:00
async getProviderUsers(
providerId: string
): Promise<ListResponse<ProviderUserUserDetailsResponse>> {
2018-07-16 23:16:15 +02:00
const r = await this.send("GET", "/providers/" + providerId + "/users", null, true, true);
return new ListResponse(r, ProviderUserUserDetailsResponse);
}
2021-12-16 13:36:21 +01:00
2018-07-17 17:04:19 +02:00
async getProviderUser(providerId: string, id: string): Promise<ProviderUserResponse> {
const r = await this.send("GET", "/providers/" + providerId + "/users/" + id, null, true, true);
return new ProviderUserResponse(r);
2021-12-16 13:36:21 +01:00
}
2018-07-17 17:04:19 +02:00
postProviderUserInvite(providerId: string, request: ProviderUserInviteRequest): Promise<any> {
return this.send("POST", "/providers/" + providerId + "/users/invite", request, true, false);
}
2021-12-16 13:36:21 +01:00
postProviderUserReinvite(providerId: string, id: string): Promise<any> {
2018-07-16 23:16:15 +02:00
return this.send(
"POST",
"/providers/" + providerId + "/users/" + id + "/reinvite",
null,
true,
false
);
2021-12-16 13:36:21 +01:00
}
2018-07-16 23:16:15 +02:00
async postManyProviderUserReinvite(
providerId: string,
2018-07-16 23:16:15 +02:00
request: ProviderUserBulkRequest
): Promise<ListResponse<ProviderUserBulkResponse>> {
const r = await this.send(
"POST",
"/providers/" + providerId + "/users/reinvite",
request,
true,
true
);
return new ListResponse(r, ProviderUserBulkResponse);
}
2021-12-16 13:36:21 +01:00
async postProviderUserBulkConfirm(
providerId: string,
request: ProviderUserBulkConfirmRequest
): Promise<ListResponse<ProviderUserBulkResponse>> {
const r = await this.send(
"POST",
"/providers/" + providerId + "/users/confirm",
request,
true,
true
);
return new ListResponse(r, ProviderUserBulkResponse);
}
2021-12-16 13:36:21 +01:00
async deleteManyProviderUsers(
providerId: string,
request: ProviderUserBulkRequest
): Promise<ListResponse<ProviderUserBulkResponse>> {
const r = await this.send("DELETE", "/providers/" + providerId + "/users", request, true, true);
return new ListResponse(r, ProviderUserBulkResponse);
}
2021-12-16 13:36:21 +01:00
postProviderUserAccept(
providerId: string,
id: string,
request: ProviderUserAcceptRequest
): Promise<any> {
return this.send(
"POST",
"/providers/" + providerId + "/users/" + id + "/accept",
request,
true,
false
);
2021-12-16 13:36:21 +01:00
}
postProviderUserConfirm(
providerId: string,
id: string,
request: ProviderUserConfirmRequest
): Promise<any> {
return this.send(
"POST",
"/providers/" + providerId + "/users/" + id + "/confirm",
request,
true,
false
);
}
2021-12-16 13:36:21 +01:00
async postProviderUsersPublicKey(
providerId: string,
request: ProviderUserBulkRequest
): Promise<ListResponse<ProviderUserBulkPublicKeyResponse>> {
const r = await this.send(
"POST",
"/providers/" + providerId + "/users/public-keys",
request,
true,
2021-12-16 13:36:21 +01:00
true
);
return new ListResponse(r, ProviderUserBulkPublicKeyResponse);
}
2021-12-16 13:36:21 +01:00
putProviderUser(
providerId: string,
id: string,
request: ProviderUserUpdateRequest
): Promise<any> {
return this.send("PUT", "/providers/" + providerId + "/users/" + id, request, true, false);
}
2021-12-16 13:36:21 +01:00
deleteProviderUser(providerId: string, id: string): Promise<any> {
return this.send("DELETE", "/providers/" + providerId + "/users/" + id, null, true, false);
}
2021-12-16 13:36:21 +01:00
// Provider Organization APIs
2021-12-16 13:36:21 +01:00
async getProviderClients(
providerId: string
): Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>> {
const r = await this.send(
"GET",
"/providers/" + providerId + "/organizations",
null,
true,
true
);
return new ListResponse(r, ProviderOrganizationOrganizationDetailsResponse);
}
2021-12-16 13:36:21 +01:00
postProviderAddOrganization(
providerId: string,
request: ProviderAddOrganizationRequest
): Promise<any> {
return this.send(
"POST",
"/providers/" + providerId + "/organizations/add",
request,
true,
false
);
2021-12-16 13:36:21 +01:00
}
async postProviderCreateOrganization(
providerId: string,
request: ProviderOrganizationCreateRequest
): Promise<ProviderOrganizationResponse> {
const r = await this.send(
2021-12-16 13:36:21 +01:00
"POST",
"/providers/" + providerId + "/organizations",
2021-12-16 13:36:21 +01:00
request,
true,
2021-12-16 13:36:21 +01:00
true
);
return new ProviderOrganizationResponse(r);
2021-12-16 13:36:21 +01:00
}
deleteProviderOrganization(providerId: string, id: string): Promise<any> {
return this.send(
"DELETE",
"/providers/" + providerId + "/organizations/" + id,
null,
true,
false
);
}
2021-12-16 13:36:21 +01:00
// Event APIs
2021-12-16 13:36:21 +01:00
async getEvents(start: string, end: string, token: string): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters("/events", start, end, token),
null,
true,
true
);
return new ListResponse(r, EventResponse);
}
2021-12-16 13:36:21 +01:00
2018-07-07 05:06:38 +02:00
async getEventsCipher(
id: string,
start: string,
end: string,
token: string
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters("/ciphers/" + id + "/events", start, end, token),
null,
true,
true
);
return new ListResponse(r, EventResponse);
}
2021-12-16 13:36:21 +01:00
2018-07-07 05:06:38 +02:00
async getEventsOrganization(
id: string,
start: string,
end: string,
token: string
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters("/organizations/" + id + "/events", start, end, token),
null,
true,
true
);
return new ListResponse(r, EventResponse);
}
2021-12-16 13:36:21 +01:00
2018-07-07 05:06:38 +02:00
async getEventsOrganizationUser(
organizationId: string,
id: string,
start: string,
end: string,
token: string
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters(
"/organizations/" + organizationId + "/users/" + id + "/events",
start,
end,
token
),
null,
true,
true
);
return new ListResponse(r, EventResponse);
}
2021-12-16 13:36:21 +01:00
async getEventsProvider(
id: string,
start: string,
end: string,
token: string
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters("/providers/" + id + "/events", start, end, token),
null,
true,
true
);
return new ListResponse(r, EventResponse);
}
2021-12-16 13:36:21 +01:00
2019-07-03 18:13:20 +02:00
async getEventsProviderUser(
providerId: string,
id: string,
2019-07-03 18:13:20 +02:00
start: string,
end: string,
2018-07-07 05:06:38 +02:00
token: string
2019-07-03 18:13:20 +02:00
): Promise<ListResponse<EventResponse>> {
2019-06-20 14:56:45 +02:00
const r = await this.send(
"GET",
2019-10-07 16:02:18 +02:00
this.addEventParameters(
"/providers/" + providerId + "/users/" + id + "/events",
start,
2021-12-16 13:36:21 +01:00
end,
2019-10-07 16:02:18 +02:00
token
2021-12-16 13:36:21 +01:00
),
null,
true,
true
2021-12-16 13:36:21 +01:00
);
return new ListResponse(r, EventResponse);
2021-12-16 13:36:21 +01:00
}
async postEventsCollect(request: EventRequest[]): Promise<any> {
const authHeader = await this.getActiveBearerToken();
2018-06-26 04:42:57 +02:00
const headers = new Headers({
"Device-Type": this.deviceType,
2020-01-13 13:49:05 +01:00
Authorization: "Bearer " + authHeader,
"Content-Type": "application/json; charset=utf-8",
2021-12-16 13:36:21 +01:00
});
2020-01-13 13:49:05 +01:00
if (this.customUserAgent != null) {
2019-06-20 14:56:45 +02:00
headers.set("User-Agent", this.customUserAgent);
2021-12-16 13:36:21 +01:00
}
2019-06-20 14:56:45 +02:00
const response = await this.fetch(
new Request(this.environmentService.getEventsUrl() + "/collect", {
cache: "no-store",
credentials: this.getCredentials(),
2018-06-26 04:42:57 +02:00
method: "POST",
2019-06-20 14:56:45 +02:00
body: JSON.stringify(request),
headers: headers,
})
);
if (response.status !== 200) {
return Promise.reject("Event post failed.");
}
2021-12-16 13:36:21 +01:00
}
2018-07-11 19:30:06 +02:00
// User APIs
2021-12-16 13:36:21 +01:00
2018-07-11 19:30:06 +02:00
async getUserPublicKey(id: string): Promise<UserKeyResponse> {
const r = await this.send("GET", "/users/" + id + "/public-key", null, true, true);
return new UserKeyResponse(r);
}
2021-12-16 13:36:21 +01:00
2019-01-17 16:46:24 +01:00
// HIBP APIs
2021-12-16 13:36:21 +01:00
2019-01-17 16:46:24 +01:00
async getHibpBreach(username: string): Promise<BreachAccountResponse[]> {
const r = await this.send("GET", "/hibp/breach?username=" + username, null, true, true);
return r.map((a: any) => new BreachAccountResponse(a));
}
2021-12-16 13:36:21 +01:00
2019-02-22 04:45:56 +01:00
// Misc
2021-12-16 13:36:21 +01:00
2019-02-22 04:45:56 +01:00
async postBitPayInvoice(request: BitPayInvoiceRequest): Promise<string> {
const r = await this.send("POST", "/bitpay-invoice", request, true, true);
return r as string;
}
2021-12-16 13:36:21 +01:00
2019-08-10 05:56:55 +02:00
async postSetupPayment(): Promise<string> {
const r = await this.send("POST", "/setup-payment", null, true, true);
return r as string;
}
2021-12-16 13:36:21 +01:00
// Key Connector
2021-12-16 13:36:21 +01:00
async getUserKeyFromKeyConnector(keyConnectorUrl: string): Promise<KeyConnectorUserKeyResponse> {
2021-10-25 18:21:40 +02:00
const authHeader = await this.getActiveBearerToken();
2021-12-16 13:36:21 +01:00
const response = await this.fetch(
new Request(keyConnectorUrl + "/user-keys", {
2021-10-25 18:21:40 +02:00
cache: "no-store",
method: "GET",
headers: new Headers({
Accept: "application/json",
Authorization: "Bearer " + authHeader,
}),
})
);
2021-12-16 13:36:21 +01:00
2021-10-25 18:21:40 +02:00
if (response.status !== 200) {
const error = await this.handleError(response, false, true);
return Promise.reject(error);
}
2021-12-16 13:36:21 +01:00
return new KeyConnectorUserKeyResponse(await response.json());
2021-10-25 18:21:40 +02:00
}
2021-12-16 13:36:21 +01:00
async postUserKeyToKeyConnector(
keyConnectorUrl: string,
request: KeyConnectorUserKeyRequest
): Promise<void> {
2021-10-25 18:21:40 +02:00
const authHeader = await this.getActiveBearerToken();
2021-12-16 13:36:21 +01:00
const response = await this.fetch(
new Request(keyConnectorUrl + "/user-keys", {
2021-10-25 18:21:40 +02:00
cache: "no-store",
method: "POST",
headers: new Headers({
Accept: "application/json",
Authorization: "Bearer " + authHeader,
"Content-Type": "application/json; charset=utf-8",
2021-12-16 13:36:21 +01:00
}),
2021-10-25 18:21:40 +02:00
body: JSON.stringify(request),
2021-12-16 13:36:21 +01:00
})
);
2018-06-26 04:42:57 +02:00
if (response.status !== 200) {
const error = await this.handleError(response, false, true);
return Promise.reject(error);
2021-12-16 13:36:21 +01:00
}
}
async getKeyConnectorAlive(keyConnectorUrl: string) {
const response = await this.fetch(
new Request(keyConnectorUrl + "/alive", {
2020-01-13 13:49:05 +01:00
cache: "no-store",
method: "GET",
headers: new Headers({
Accept: "application/json",
2021-10-25 18:21:40 +02:00
"Content-Type": "application/json; charset=utf-8",
}),
})
);
2021-12-16 13:36:21 +01:00
2021-10-25 18:21:40 +02:00
if (response.status !== 200) {
const error = await this.handleError(response, false, true);
return Promise.reject(error);
}
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
// Helpers
2021-12-16 13:36:21 +01:00
async getActiveBearerToken(): Promise<string> {
let accessToken = await this.tokenService.getToken();
if (await this.tokenService.tokenNeedsRefresh()) {
await this.doAuthRefresh();
[Account Switching] [Feature] Allow clients to store data for more than one user (#491) * [refactor] Extract, rename, and expand StorageServiceOptions * Pulled StorageServiceOptions into its own file * Renamed StorageServiceOptions to StorageOptions * Pulled KeySuffixOpptions into its own file * Converted KeySuffixOptions into an enum from a union type * [refactor] Expand StateService into a full coverage storage proxy * Expand StateService to allow it to manage all data points of the application state regardless of memory. * Expand StateService to allow for storing and managing multiple accounts * [refactor] Create helper services for managing organization and provider state data * [refactor] Implement StateService across service layer * Remove service level variables used for in memory data storage and replaced with calls to StateService * Remove direct calls to StorageService in favor of using StateService as a proxy * [feature] Implement account switching capable services across components and processes * Replace calls to StorageService and deprecated services with calls to a StateService * [chore] Remove unused services Several services are no longer in use because of the expanded state service. These have simply been removed. * [bug] Add loginRedirect to the account model * [bug] Add awaits to newly async calls in TokenService * [bug] Add several missing awaits * [bug] Add state service handlers for AutoConfirmFingerprint * [bug] Move TwoFactorToken to global state * Update unauth-guard.service.ts Add back return true * [refactor] Slim down the boilerplate needed to manage options on StateService calls * [bug] Allow the lock message handler to manipulate a specific acount * [bug] Add missing await to auth guard * [bug] Adjust state scope of several biometric data points * [bug] Ensure vault locking logic can operate over non-active accounts * [style] Fix lint complaints * [bug] Move disableFavicon to global state * [refactor] Remove an unecassary parameter from a StorageOptions instance * [bug] Ensure HtmlStorageService paths are accounted for in StateService * [feature] Add a server url helper to the account model for the account switcher * [refactor] Remove some unused getters from the account model * [bug] Ensure locking and logging out can function over any user * Fix account getting set to null in getAccountFromDisk * [bug] Ensure lock component is always working with the latest active account in state * [chore] Update recent KeyConnector changes to use stateService * [style] Fix lint complaints * [chore] Resolve TokenService merge issues from KeyConnector * [bug] Add missing service arguement * [bug] Correct several default storage option types * [bug] Check for the right key in hasEncKey * [bug] Add enableFullWidth to the account model * [style] Fix lint complaints * [review] Revist remember email * [refactor] Remove RememberEmail from state * setDisableFavicon to correct storage location * [bug] Convert vault lock loop returns into continues to not skip secondary accounts * [review] Sorted state service methods * [bug] Correct neverDomains type on the account model * [review] Rename stateService.purge to stateService.clean * [review] [refactor] Extract lock refresh logic to a load function * [review] [refactor] Extract some timeout logic to dedicated functions * [review] [refactor] Move AuthenticationStatus to a dedicated file * [review] [refactor] Rename Globals to GlobalState * [style] Fix lint complaints * [review] Remove unused global state property for decodedToken * [review] [bug] Adjust state scope for OrganizationInvitation * [review] [bug] Put back the homepage variable in lock guard * [review] Un-try-catch the window creation function * Revert "[review] [bug] Adjust state scope for OrganizationInvitation" This reverts commit caa4574a65d9d0c3573a7529ed2221764fd55497. * [bug] Change || to && in recent vault timeout refactor * [bug] Keep up with entire state in storage instead of just accounts and globals Not having access to the last active user was creating issues across clients when restarting the process. For example: when refreshing the page on web we no longer maintain an understanding of who is logged in. To resolve this I converted all storage save operations to get and save an entire state object, instead of specifying accounts and globals. This allows for more flexible saving, like saving activeUserId as a top level storage item. * [style] Fix lint complaints * Revert "[bug] Keep up with entire state in storage instead of just accounts and globals" This reverts commit e8970725be472386358c1e2f06f53663c4979e0e. * [bug] Initialize GlobalState by default * [bug] Only get key hash from storage * [bug] Remove settings storage location overrides * [bug] Only save accessToken to storage * [refactor] Remove unecassary argements from electron crypto state calls * [bug] Ensure keys and tokens load and save to the right locations for web * [style] Fix lint complaints * [bug] Remove keySuffix storage option and split uses into unique methods The keySuffix options don't work with saving serialized json as a storage object - use cases simply overwrite each other in state. This commit breaks Auto and Biometric keys into distinct storage items and adjusts logic accordingly. * [bug] Add default vault timeouts to new accounts * [bug] Save appId as a top level storage item * [bug] Add missing await to timeout logic * [bug] Adjust state scope for everBeenUnlocked * [bug] Clear access tokens when loading account state from disk * [bug] Adjust theme to be a global state item * [bug] Adjust null checking for window in state * [bug] Correct getGlobals not pulling from the stored state item * [bug] Null check in memory account before claiming it has a userId * [bug] Scaffold secure storage service when building storage objects on init * [bug] Adjusted state scope of event collection * [bug] Adjusted state scope of vault timeout and action * [bug] Grab account from normal storage if secure storage is requested but does not exist * [bug] Create a State if one is requested from memory before it exists * [bug] Ensure all storage locations are cleared on state clean * [style] Fix lint complaints * [bug] Remove uneeded clearing of access token * [bug] Reset tokens when toggling * [refactor] Split up the Account model Until this point the account model has been very flat, holding many kinds of data. In order to be able to prune data at appropriate times, for example clearing keys at logout without clearing QoL settings like locale, the Account model has been divided into logical chunks. * [bug] Correct the serverUrl helpers return * Fix sends always coming back as empty in browser * Get settings properly (I think) * [bug] Fix lint error * [bug] Add missing await to identity token refresh This was causing weird behavior in web that was creating a lot of 429s * [bug] Scaffold memory storage for web Not properly creating storage objects on signin was creating weird behavior when logging out, locking, and logging back in. Namely, encrypted data that was recently synced had nowhere to save to and was lost. * [bug] Implement better null handling in a few places for retrieving state * [bug] Update correct storage locations on account removal * [bug] Added missing awaits to lock component * [bug] Reload lock component on account switching vs. account update * [bug] Store master keys correctly * [bug] Move some biometrics storage items to global state * [feature] Add platform helper isMac() * [refactor] Comment emphasis and call order refresh * [refactor] Remove unecassary using * [bug] Relocate authenticationStatus check logic to component * [bug] Stop not clearing everything on state clean * [style] Fix lint complaints * [bug] Correct mismatched uses of encrypted and decrypted pin states * Add browser specific state classes and methods * lint fixes * [bug] Migrate existing persistant data to new schema * [style] Fix lint complaints * [bug] Dont clear settings on state clean * [bug] Maintain the right storage items on logout * [chore] resolve issues from merge * [bug] Resolve settings clearing on lock * [chore] Added a comment * [review] fromatting for code review * Revert browser state items Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2021-12-13 17:15:16 +01:00
accessToken = await this.tokenService.getToken();
2021-12-16 13:36:21 +01:00
}
return accessToken;
2021-12-16 13:36:21 +01:00
}
async fetch(request: Request): Promise<Response> {
if (request.method === "GET") {
request.headers.set("Cache-Control", "no-store");
request.headers.set("Pragma", "no-cache");
2021-12-16 13:36:21 +01:00
}
request.headers.set("Bitwarden-Client-Name", this.platformUtilsService.getClientType());
request.headers.set(
"Bitwarden-Client-Version",
await this.platformUtilsService.getApplicationVersion()
);
return this.nativeFetch(request);
2021-12-16 13:36:21 +01:00
}
nativeFetch(request: Request): Promise<Response> {
return fetch(request);
}
2021-12-16 13:36:21 +01:00
async preValidateSso(identifier: string): Promise<SsoPreValidateResponse> {
if (identifier == null || identifier === "") {
throw new Error("Organization Identifier was not provided.");
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
const headers = new Headers({
Accept: "application/json",
"Device-Type": this.deviceType,
2021-12-16 13:36:21 +01:00
});
if (this.customUserAgent != null) {
headers.set("User-Agent", this.customUserAgent);
2021-12-16 13:36:21 +01:00
}
const path = `/account/prevalidate?domainHint=${encodeURIComponent(identifier)}`;
const response = await this.fetch(
new Request(this.environmentService.getIdentityUrl() + path, {
2018-07-08 05:48:58 +02:00
cache: "no-store",
credentials: this.getCredentials(),
headers: headers,
2018-07-08 05:48:58 +02:00
method: "GET",
2021-12-16 13:36:21 +01:00
})
);
2018-07-08 05:48:58 +02:00
if (response.status === 200) {
const body = await response.json();
return new SsoPreValidateResponse(body);
2021-12-16 13:36:21 +01:00
} else {
2020-01-13 13:49:05 +01:00
const error = await this.handleError(response, false, true);
return Promise.reject(error);
2021-12-16 13:36:21 +01:00
}
}
async postCreateSponsorship(
sponsoredOrgId: string,
request: OrganizationSponsorshipCreateRequest
): Promise<void> {
2018-07-08 05:48:58 +02:00
return await this.send(
2021-12-16 13:36:21 +01:00
"POST",
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
"/organization/sponsorship/" +
(this.platformUtilsService.isSelfHost() ? "self-hosted/" : "") +
sponsoredOrgId +
"/families-for-enterprise",
2018-07-08 05:48:58 +02:00
request,
2021-12-16 13:36:21 +01:00
true,
2018-07-08 05:48:58 +02:00
false
);
}
2021-12-16 13:36:21 +01:00
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
async getSponsorshipSyncStatus(
sponsoredOrgId: string
): Promise<OrganizationSponsorshipSyncStatusResponse> {
const response = await this.send(
"GET",
"/organization/sponsorship/" + sponsoredOrgId + "/sync-status",
null,
true,
true
);
return new OrganizationSponsorshipSyncStatusResponse(response);
}
async deleteRevokeSponsorship(sponsoringOrganizationId: string): Promise<void> {
return await this.send(
"DELETE",
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
"/organization/sponsorship/" +
(this.platformUtilsService.isSelfHost() ? "self-hosted/" : "") +
sponsoringOrganizationId,
2021-12-16 13:36:21 +01:00
null,
true,
false
2021-12-16 13:36:21 +01:00
);
}
async deleteRemoveSponsorship(sponsoringOrgId: string): Promise<void> {
return await this.send(
2021-12-16 13:36:21 +01:00
"DELETE",
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
"/organization/sponsorship/sponsored/" + sponsoringOrgId,
2021-12-16 13:36:21 +01:00
null,
true,
false
);
}
async postPreValidateSponsorshipToken(sponsorshipToken: string): Promise<boolean> {
const r = await this.send(
"POST",
"/organization/sponsorship/validate-token?sponsorshipToken=" +
encodeURIComponent(sponsorshipToken),
2021-12-16 13:36:21 +01:00
null,
true,
2021-12-16 13:36:21 +01:00
true
);
return r as boolean;
2021-12-16 13:36:21 +01:00
}
async postRedeemSponsorship(
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
sponsorshipToken: string,
request: OrganizationSponsorshipRedeemRequest
): Promise<void> {
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
return await this.send(
2021-12-16 13:36:21 +01:00
"POST",
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
"/organization/sponsorship/redeem?sponsorshipToken=" + encodeURIComponent(sponsorshipToken),
2021-12-16 13:36:21 +01:00
request,
true,
false
);
}
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
async postResendSponsorshipOffer(sponsoringOrgId: string): Promise<void> {
return await this.send(
"POST",
"/organization/sponsorship/" + sponsoringOrgId + "/families-for-enterprise/resend",
null,
true,
false
);
}
2021-12-16 13:36:21 +01:00
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
protected async doAuthRefresh(): Promise<void> {
const refreshToken = await this.tokenService.getRefreshToken();
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
if (refreshToken != null && refreshToken !== "") {
return this.doRefreshToken();
2021-12-16 13:36:21 +01:00
}
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
const clientId = await this.tokenService.getClientId();
const clientSecret = await this.tokenService.getClientSecret();
if (!Utils.isNullOrWhitespace(clientId) && !Utils.isNullOrWhitespace(clientSecret)) {
return this.doApiTokenRefresh();
2021-12-16 13:36:21 +01:00
}
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
throw new Error("Cannot refresh token, no refresh token or api keys are stored");
}
2021-12-16 13:36:21 +01:00
protected async doRefreshToken(): Promise<void> {
const refreshToken = await this.tokenService.getRefreshToken();
if (refreshToken == null || refreshToken === "") {
throw new Error();
}
const headers = new Headers({
"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
Accept: "application/json",
"Device-Type": this.deviceType,
2021-12-16 13:36:21 +01:00
});
if (this.customUserAgent != null) {
headers.set("User-Agent", this.customUserAgent);
2021-12-16 13:36:21 +01:00
}
const decodedToken = await this.tokenService.decodeToken();
const response = await this.fetch(
new Request(this.environmentService.getIdentityUrl() + "/connect/token", {
body: this.qsStringify({
grant_type: "refresh_token",
client_id: decodedToken.client_id,
refresh_token: refreshToken,
2021-12-16 13:36:21 +01:00
}),
cache: "no-store",
credentials: this.getCredentials(),
headers: headers,
2018-06-26 04:42:57 +02:00
method: "POST",
2021-12-16 13:36:21 +01:00
})
);
if (response.status === 200) {
const responseJson = await response.json();
const tokenResponse = new IdentityTokenResponse(responseJson);
await this.tokenService.setTokens(
tokenResponse.accessToken,
tokenResponse.refreshToken,
null
);
} else {
const error = await this.handleError(response, true, true);
return Promise.reject(error);
2021-12-16 13:36:21 +01:00
}
}
protected async doApiTokenRefresh(): Promise<void> {
const clientId = await this.tokenService.getClientId();
const clientSecret = await this.tokenService.getClientSecret();
const appId = await this.appIdService.getAppId();
const deviceRequest = new DeviceRequest(appId, this.platformUtilsService);
const tokenRequest = new ApiTokenRequest(
clientId,
clientSecret,
new TokenRequestTwoFactor(),
deviceRequest
);
const response = await this.postIdentityToken(tokenRequest);
if (!(response instanceof IdentityTokenResponse)) {
throw new Error("Invalid response received when refreshing api token");
}
await this.tokenService.setToken(response.accessToken);
}
private async send(
2018-06-26 04:42:57 +02:00
method: "GET" | "POST" | "PUT" | "DELETE",
path: string,
body: any,
authed: boolean,
hasResponse: boolean,
apiUrl?: string,
alterHeaders?: (headers: Headers) => void
): Promise<any> {
apiUrl = Utils.isNullOrWhitespace(apiUrl) ? this.environmentService.getApiUrl() : apiUrl;
2021-12-16 13:36:21 +01:00
const requestUrl = apiUrl + path;
// Prevent directory traversal from malicious paths
if (new URL(requestUrl).href !== requestUrl) {
return Promise.reject("Invalid request url path.");
}
2021-12-16 13:36:21 +01:00
const headers = new Headers({
"Device-Type": this.deviceType,
});
if (this.customUserAgent != null) {
headers.set("User-Agent", this.customUserAgent);
}
2021-12-16 13:36:21 +01:00
const requestInit: RequestInit = {
cache: "no-store",
credentials: this.getCredentials(),
method: method,
};
2021-12-16 13:36:21 +01:00
if (authed) {
const authHeader = await this.getActiveBearerToken();
headers.set("Authorization", "Bearer " + authHeader);
2021-12-16 13:36:21 +01:00
}
if (body != null) {
if (typeof body === "string") {
requestInit.body = body;
headers.set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
} else if (typeof body === "object") {
if (body instanceof FormData) {
requestInit.body = body;
} else {
headers.set("Content-Type", "application/json; charset=utf-8");
requestInit.body = JSON.stringify(body);
}
2021-12-16 13:36:21 +01:00
}
}
2018-06-26 04:42:57 +02:00
if (hasResponse) {
headers.set("Accept", "application/json");
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
if (alterHeaders != null) {
alterHeaders(headers);
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
requestInit.headers = headers;
const response = await this.fetch(new Request(requestUrl, requestInit));
2021-12-16 13:36:21 +01:00
2018-06-26 04:42:57 +02:00
if (hasResponse && response.status === 200) {
const responseJson = await response.json();
return responseJson;
} else if (response.status !== 200) {
const error = await this.handleError(response, false, authed);
return Promise.reject(error);
2018-06-26 04:42:57 +02:00
}
2021-12-16 13:36:21 +01:00
}
2018-06-26 04:42:57 +02:00
private async handleError(
response: Response,
tokenError: boolean,
authed: boolean
): Promise<ErrorResponse> {
if (
authed &&
2018-06-26 04:42:57 +02:00
((tokenError && response.status === 400) ||
response.status === 401 ||
response.status === 403)
2021-12-16 13:36:21 +01:00
) {
2018-05-16 05:40:15 +02:00
await this.logoutCallback(true);
2018-01-09 22:19:55 +01:00
return null;
2021-12-16 13:36:21 +01:00
}
2018-01-09 22:19:55 +01:00
let responseJson: any = null;
2018-06-26 04:42:57 +02:00
if (this.isJsonResponse(response)) {
responseJson = await response.json();
} else if (this.isTextResponse(response)) {
responseJson = { Message: await response.text() };
}
2021-12-16 13:36:21 +01:00
return new ErrorResponse(responseJson, response.status, tokenError);
2018-01-09 22:19:55 +01:00
}
2021-12-16 13:36:21 +01:00
2018-01-09 22:19:55 +01:00
private qsStringify(params: any): string {
return Object.keys(params)
.map((key) => {
2018-01-09 22:19:55 +01:00
return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
})
.join("&");
}
2021-12-16 13:36:21 +01:00
2018-06-05 21:45:19 +02:00
private getCredentials(): RequestCredentials {
if (!this.isWebClient || this.environmentService.hasBaseUrl()) {
2018-06-05 21:45:19 +02:00
return "include";
}
return undefined;
}
2021-12-16 13:36:21 +01:00
2018-07-07 05:06:38 +02:00
private addEventParameters(base: string, start: string, end: string, token: string) {
if (start != null) {
base += "?start=" + start;
}
if (end != null) {
base += base.indexOf("?") > -1 ? "&" : "?";
base += "end=" + end;
2021-12-16 13:36:21 +01:00
}
2018-07-07 05:06:38 +02:00
if (token != null) {
base += base.indexOf("?") > -1 ? "&" : "?";
base += "continuationToken=" + token;
}
return base;
}
2021-12-16 13:36:21 +01:00
2019-04-10 21:39:36 +02:00
private isJsonResponse(response: Response): boolean {
const typeHeader = response.headers.get("content-type");
return typeHeader != null && typeHeader.indexOf("application/json") > -1;
}
2021-12-16 13:36:21 +01:00
private isTextResponse(response: Response): boolean {
const typeHeader = response.headers.get("content-type");
return typeHeader != null && typeHeader.indexOf("text") > -1;
}
2018-01-09 22:19:55 +01:00
}