From 9e91f240e461b2064d87b4a391c238107c64eb1b Mon Sep 17 00:00:00 2001 From: Hinton Date: Mon, 21 Oct 2024 09:10:50 -0700 Subject: [PATCH 1/2] Remove moved libraries --- .github/CODEOWNERS | 5 - .github/workflows/build-android.yml | 111 - .github/workflows/build-rust-crates.yml | 6 +- .github/workflows/build-swift.yml | 115 - .github/workflows/build-wasm-internal.yml | 59 - .github/workflows/delete-old-packages.yml | 25 - .github/workflows/memory-testing.yml | 43 - .github/workflows/publish-internal.yml | 94 - .github/workflows/publish-rust-crates.yml | 2 +- .github/workflows/release-swift.yml | 263 - .gitignore | 7 - .prettierignore | 8 - .vscode/launch.json | 14 - Cargo.lock | 1218 +-- Cargo.toml | 40 +- README.md | 66 +- crates/bitwarden-api-api/.gitignore | 3 - .../.openapi-generator-ignore | 27 - .../.openapi-generator/FILES | 451 - .../.openapi-generator/VERSION | 1 - crates/bitwarden-api-api/Cargo.toml | 26 - crates/bitwarden-api-api/README.md | 889 -- .../src/apis/access_policies_api.rs | 680 -- .../src/apis/accounts_api.rs | 2147 ----- .../src/apis/accounts_billing_api.rs | 113 - .../src/apis/auth_requests_api.rs | 320 - .../bitwarden-api-api/src/apis/ciphers_api.rs | 2995 ------- .../src/apis/collections_api.rs | 929 -- .../bitwarden-api-api/src/apis/config_api.rs | 61 - .../src/apis/configuration.rs | 49 - .../bitwarden-api-api/src/apis/counts_api.rs | 174 - .../bitwarden-api-api/src/apis/devices_api.rs | 985 --- .../src/apis/emergency_access_api.rs | 1005 --- .../bitwarden-api-api/src/apis/events_api.rs | 410 - .../bitwarden-api-api/src/apis/folders_api.rs | 368 - .../bitwarden-api-api/src/apis/groups_api.rs | 714 -- crates/bitwarden-api-api/src/apis/hibp_api.rs | 66 - .../src/apis/import_ciphers_api.rs | 121 - crates/bitwarden-api-api/src/apis/info_api.rs | 194 - .../src/apis/installations_api.rs | 114 - .../src/apis/licenses_api.rs | 126 - crates/bitwarden-api-api/src/apis/misc_api.rs | 109 - crates/bitwarden-api-api/src/apis/mod.rs | 146 - .../apis/organization_auth_requests_api.rs | 235 - .../src/apis/organization_billing_api.rs | 168 - .../src/apis/organization_connections_api.rs | 327 - .../src/apis/organization_domain_api.rs | 392 - .../src/apis/organization_export_api.rs | 66 - .../src/apis/organization_sponsorships_api.rs | 555 -- .../src/apis/organization_users_api.rs | 1737 ---- .../src/apis/organizations_api.rs | 1862 ---- .../bitwarden-api-api/src/apis/plans_api.rs | 109 - .../src/apis/policies_api.rs | 344 - .../src/apis/projects_api.rs | 274 - .../src/apis/provider_billing_api.rs | 223 - .../src/apis/provider_clients_api.rs | 123 - .../src/apis/provider_organizations_api.rs | 286 - .../src/apis/provider_users_api.rs | 834 -- .../src/apis/providers_api.rs | 383 - crates/bitwarden-api-api/src/apis/push_api.rs | 261 - .../src/apis/request_sm_access_api.rs | 66 - .../bitwarden-api-api/src/apis/secrets_api.rs | 430 - .../src/apis/secrets_manager_events_api.rs | 83 - .../src/apis/secrets_manager_porting_api.rs | 119 - .../self_hosted_organization_licenses_api.rs | 189 - ...lf_hosted_organization_sponsorships_api.rs | 179 - .../bitwarden-api-api/src/apis/sends_api.rs | 671 -- .../src/apis/service_accounts_api.rs | 447 - .../src/apis/settings_api.rs | 162 - .../bitwarden-api-api/src/apis/stripe_api.rs | 110 - crates/bitwarden-api-api/src/apis/sync_api.rs | 65 - .../bitwarden-api-api/src/apis/trash_api.rs | 173 - .../src/apis/two_factor_api.rs | 1633 ---- .../bitwarden-api-api/src/apis/users_api.rs | 66 - .../src/apis/web_authn_api.rs | 324 - crates/bitwarden-api-api/src/lib.rs | 14 - .../src/models/access_policy_request.rs | 33 - .../access_token_create_request_model.rs | 40 - .../access_token_creation_response_model.rs | 45 - .../src/models/access_token_response_model.rs | 45 - ...oken_response_model_list_response_model.rs | 33 - ...admin_auth_request_update_request_model.rs | 30 - .../bitwarden-api-api/src/models/algorithm.rs | 67 - .../src/models/api_key_response_model.rs | 33 - .../src/models/assertion_options.rs | 51 - .../src/models/assertion_response.rs | 42 - .../src/models/attachment_request_model.rs | 36 - .../src/models/attachment_response_model.rs | 45 - .../attachment_upload_data_response_model.rs | 42 - .../attestation_conveyance_preference.rs | 40 - .../auth_request_create_request_model.rs | 45 - .../src/models/auth_request_response_model.rs | 57 - ...uest_response_model_list_response_model.rs | 33 - .../src/models/auth_request_type.rs | 49 - .../auth_request_update_request_model.rs | 36 - ...authentication_extensions_client_inputs.rs | 39 - ...uthentication_extensions_client_outputs.rs | 39 - .../authenticator_assertion_raw_response.rs | 43 - .../src/models/authenticator_attachment.rs | 37 - .../authenticator_attestation_raw_response.rs | 43 - .../src/models/authenticator_selection.rs | 36 - .../src/models/authenticator_transport.rs | 43 - .../src/models/base_secret_response_model.rs | 51 - ...cret_response_model_list_response_model.rs | 33 - .../src/models/billing_customer_discount.rs | 36 - .../models/billing_history_response_model.rs | 33 - .../src/models/billing_invoice.rs | 42 - .../models/billing_payment_response_model.rs | 33 - .../src/models/billing_source.rs | 36 - .../src/models/billing_subscription.rs | 66 - .../src/models/billing_subscription_item.rs | 51 - .../billing_subscription_upcoming_invoice.rs | 30 - .../src/models/billing_transaction.rs | 48 - .../models/bit_pay_invoice_request_model.rs | 48 - .../bulk_collection_access_request_model.rs | 33 - .../src/models/bulk_delete_response_model.rs | 33 - ...lete_response_model_list_response_model.rs | 33 - ...k_deny_admin_auth_request_request_model.rs | 25 - .../src/models/cipher_attachment_model.rs | 30 - .../cipher_bulk_delete_request_model.rs | 30 - .../models/cipher_bulk_move_request_model.rs | 30 - .../cipher_bulk_restore_request_model.rs | 30 - .../models/cipher_bulk_share_request_model.rs | 33 - ...r_bulk_update_collections_request_model.rs | 37 - .../src/models/cipher_card_model.rs | 42 - .../cipher_collections_request_model.rs | 25 - .../src/models/cipher_create_request_model.rs | 30 - .../models/cipher_details_response_model.rs | 102 - ...ails_response_model_list_response_model.rs | 33 - .../models/cipher_fido2_credential_model.rs | 63 - .../src/models/cipher_field_model.rs | 36 - .../src/models/cipher_identity_model.rs | 78 - .../src/models/cipher_login_model.rs | 51 - .../src/models/cipher_login_uri_model.rs | 33 - .../cipher_mini_details_response_model.rs | 90 - ...ails_response_model_list_response_model.rs | 33 - .../src/models/cipher_mini_response_model.rs | 87 - ...mini_response_model_list_response_model.rs | 33 - .../models/cipher_partial_request_model.rs | 30 - .../models/cipher_password_history_model.rs | 30 - .../src/models/cipher_reprompt_type.rs | 47 - .../src/models/cipher_request_model.rs | 78 - .../src/models/cipher_response_model.rs | 99 - .../src/models/cipher_secure_note_model.rs | 25 - .../src/models/cipher_share_request_model.rs | 33 - .../src/models/cipher_type.rs | 51 - .../models/cipher_with_id_request_model.rs | 81 - ...ollection_access_details_response_model.rs | 61 - ...ails_response_model_list_response_model.rs | 33 - .../collection_bulk_delete_request_model.rs | 25 - .../collection_details_response_model.rs | 52 - ...ails_response_model_list_response_model.rs | 33 - .../src/models/collection_request_model.rs | 36 - .../src/models/collection_response_model.rs | 39 - ...tion_response_model_list_response_model.rs | 33 - .../collection_with_id_request_model.rs | 39 - .../src/models/config_response_model.rs | 42 - ...create_client_organization_request_body.rs | 51 - .../src/models/credential_create_options.rs | 63 - .../models/delete_recover_request_model.rs | 25 - .../src/models/device_keys_request_model.rs | 37 - .../device_keys_update_request_model.rs | 33 - .../src/models/device_request_model.rs | 36 - .../src/models/device_response_model.rs | 45 - ...vice_response_model_list_response_model.rs | 33 - .../src/models/device_token_request_model.rs | 25 - .../src/models/device_type.rs | 95 - .../device_verification_request_model.rs | 27 - .../device_verification_response_model.rs | 39 - .../src/models/domains_response_model.rs | 36 - .../src/models/email_request_model.rs | 56 - .../src/models/email_token_request_model.rs | 42 - ...y_access_grantee_details_response_model.rs | 51 - ...ails_response_model_list_response_model.rs | 33 - ...y_access_grantor_details_response_model.rs | 51 - ...ails_response_model_list_response_model.rs | 33 - .../emergency_access_invite_request_model.rs | 37 - ...emergency_access_password_request_model.rs | 33 - .../models/emergency_access_status_type.rs | 53 - ...mergency_access_takeover_response_model.rs | 42 - .../src/models/emergency_access_type.rs | 47 - .../emergency_access_update_request_model.rs | 36 - .../emergency_access_view_response_model.rs | 33 - .../emergency_access_with_id_request_model.rs | 40 - .../environment_config_response_model.rs | 42 - .../src/models/event_response_model.rs | 90 - ...vent_response_model_list_response_model.rs | 33 - .../src/models/event_system_user.rs | 47 - .../src/models/event_type.rs | 193 - .../expanded_tax_info_update_request_model.rs | 45 - .../src/models/fido2_user.rs | 36 - .../src/models/field_type.rs | 51 - .../src/models/file_upload_type.rs | 47 - .../src/models/folder_request_model.rs | 25 - .../src/models/folder_response_model.rs | 36 - ...lder_response_model_list_response_model.rs | 33 - .../models/folder_with_id_request_model.rs | 27 - .../src/models/get_secrets_request_model.rs | 25 - .../src/models/global_domains.rs | 33 - .../models/global_equivalent_domains_type.rs | 225 - .../models/granted_access_policy_request.rs | 33 - ...olicy_permission_details_response_model.rs | 33 - ...ed_project_access_policy_response_model.rs | 39 - crates/bitwarden-api-api/src/models/group.rs | 33 - .../group_access_policy_response_model.rs | 42 - .../src/models/group_bulk_request_model.rs | 25 - .../models/group_details_response_model.rs | 42 - ...ails_response_model_list_response_model.rs | 33 - .../src/models/group_request_model.rs | 33 - .../src/models/group_response_model.rs | 39 - .../models/import_ciphers_request_model.rs | 36 - ...port_organization_ciphers_request_model.rs | 36 - ...import_organization_users_request_model.rs | 36 - .../inner_project_export_response_model.rs | 30 - .../inner_project_import_request_model.rs | 27 - .../inner_secret_export_response_model.rs | 39 - .../inner_secret_import_request_model.rs | 45 - .../src/models/installation_request_model.rs | 25 - .../src/models/installation_response_model.rs | 36 - .../src/models/int32_int32_key_value_pair.rs | 30 - .../src/models/kdf_request_model.rs | 65 - .../bitwarden-api-api/src/models/kdf_type.rs | 47 - .../bitwarden-api-api/src/models/key_model.rs | 33 - .../src/models/key_pair_request_body.rs | 30 - .../src/models/keys_request_model.rs | 30 - .../src/models/keys_response_model.rs | 36 - .../src/models/license_type.rs | 47 - .../master_password_policy_response_model.rs | 48 - .../src/models/member_decryption_type.rs | 49 - crates/bitwarden-api-api/src/models/mod.rs | 786 -- .../open_id_connect_redirect_behavior.rs | 47 - .../optional_cipher_details_response_model.rs | 33 - .../organization_api_key_information.rs | 33 - ...api_key_information_list_response_model.rs | 33 - .../organization_api_key_request_model.rs | 42 - .../src/models/organization_api_key_type.rs | 49 - ..._auth_request_update_many_request_model.rs | 33 - ...ation_auto_enroll_status_response_model.rs | 36 - ...anization_billing_status_response_model.rs | 39 - ...lection_management_update_request_model.rs | 36 - .../organization_connection_request_model.rs | 36 - .../organization_connection_response_model.rs | 39 - .../models/organization_connection_type.rs | 47 - .../organization_counts_response_model.rs | 36 - .../organization_create_request_model.rs | 128 - .../organization_domain_request_model.rs | 25 - .../organization_domain_response_model.rs | 54 - ...main_response_model_list_response_model.rs | 33 - ...zation_domain_sso_details_request_model.rs | 25 - ...ation_domain_sso_details_response_model.rs | 42 - .../models/organization_keys_request_model.rs | 30 - .../organization_keys_response_model.rs | 33 - .../src/models/organization_license.rs | 159 - .../organization_public_key_response_model.rs | 30 - .../src/models/organization_response_model.rs | 162 - .../models/organization_seat_request_model.rs | 25 - ...zation_sponsorship_create_request_model.rs | 36 - ...zation_sponsorship_redeem_request_model.rs | 33 - .../organization_sponsorship_request_model.rs | 51 - ...organization_sponsorship_response_model.rs | 57 - ...nization_sponsorship_sync_request_model.rs | 36 - ...ization_sponsorship_sync_response_model.rs | 27 - .../models/organization_sso_request_model.rs | 36 - .../models/organization_sso_response_model.rs | 39 - ...rganization_subscription_response_model.rs | 188 - ...ation_subscription_update_request_model.rs | 30 - .../organization_update_request_model.rs | 39 - .../organization_upgrade_request_model.rs | 69 - ...nization_user_accept_init_request_model.rs | 40 - .../organization_user_accept_request_model.rs | 30 - ...ization_user_bulk_confirm_request_model.rs | 27 - ...n_user_bulk_confirm_request_model_entry.rs | 27 - .../organization_user_bulk_request_model.rs | 25 - .../organization_user_bulk_response_model.rs | 33 - ...bulk_response_model_list_response_model.rs | 33 - ...organization_user_confirm_request_model.rs | 25 - ...rganization_user_details_response_model.rs | 69 - .../organization_user_invite_request_model.rs | 48 - ...nization_user_public_key_response_model.rs | 36 - ..._key_response_model_list_response_model.rs | 33 - ...r_reset_password_details_response_model.rs | 51 - ...ails_response_model_list_response_model.rs | 33 - ...reset_password_enrollment_request_model.rs | 30 - ...ation_user_reset_password_request_model.rs | 33 - .../models/organization_user_status_type.rs | 51 - .../src/models/organization_user_type.rs | 51 - .../organization_user_update_request_model.rs | 42 - ...zation_user_user_details_response_model.rs | 84 - ...ails_response_model_list_response_model.rs | 33 - .../organization_verify_bank_request_model.rs | 27 - ...ion_verify_delete_recover_request_model.rs | 25 - .../other_device_keys_update_request_model.rs | 37 - .../src/models/password_hint_request_model.rs | 25 - ...rd_manager_plan_features_response_model.rs | 114 - .../src/models/password_request_model.rs | 48 - .../src/models/payment_method_type.rs | 59 - .../src/models/payment_request_model.rs | 55 - .../src/models/payment_response_model.rs | 39 - ...rganization_auth_request_response_model.rs | 57 - ...uest_response_model_list_response_model.rs | 33 - .../people_access_policies_request_model.rs | 36 - .../src/models/permissions.rs | 81 - .../src/models/plan_response_model.rs | 111 - ...plan_response_model_list_response_model.rs | 33 - .../src/models/plan_sponsorship_type.rs | 45 - .../bitwarden-api-api/src/models/plan_type.rs | 87 - .../src/models/policy_request_model.rs | 33 - .../src/models/policy_response_model.rs | 42 - ...licy_response_model_list_response_model.rs | 33 - .../src/models/policy_type.rs | 69 - .../potential_grantee_response_model.rs | 45 - ...ntee_response_model_list_response_model.rs | 33 - .../src/models/product_tier_type.rs | 53 - .../profile_organization_response_model.rs | 207 - ...tion_response_model_list_response_model.rs | 33 - ...le_provider_organization_response_model.rs | 207 - .../models/profile_provider_response_model.rs | 57 - .../src/models/profile_response_model.rs | 90 - .../models/project_counts_response_model.rs | 36 - .../models/project_create_request_model.rs | 25 - ...t_people_access_policies_response_model.rs | 36 - .../src/models/project_response_model.rs | 48 - ...ject_response_model_list_response_model.rs | 33 - ..._accounts_access_policies_request_model.rs | 29 - ...accounts_access_policies_response_model.rs | 34 - .../models/project_update_request_model.rs | 25 - .../models/protected_device_response_model.rs | 48 - ...provider_organization_add_request_model.rs | 30 - ...vider_organization_create_request_model.rs | 33 - ...ion_organization_details_response_model.rs | 66 - ...ails_response_model_list_response_model.rs | 33 - .../provider_organization_response_model.rs | 63 - .../src/models/provider_response_model.rs | 60 - .../models/provider_setup_request_model.rs | 47 - .../src/models/provider_status_type.rs | 49 - .../src/models/provider_type.rs | 47 - .../models/provider_update_request_model.rs | 33 - .../provider_user_accept_request_model.rs | 25 - ...rovider_user_bulk_confirm_request_model.rs | 27 - ...r_user_bulk_confirm_request_model_entry.rs | 27 - .../provider_user_bulk_request_model.rs | 25 - .../provider_user_bulk_response_model.rs | 33 - ...bulk_response_model_list_response_model.rs | 33 - .../provider_user_confirm_request_model.rs | 25 - .../provider_user_invite_request_model.rs | 30 - ...provider_user_public_key_response_model.rs | 36 - ..._key_response_model_list_response_model.rs | 33 - .../models/provider_user_response_model.rs | 42 - .../src/models/provider_user_status_type.rs | 49 - .../src/models/provider_user_type.rs | 47 - .../provider_user_update_request_model.rs | 25 - ...ovider_user_user_details_response_model.rs | 48 - ...ails_response_model_list_response_model.rs | 33 - ...der_verify_delete_recover_request_model.rs | 25 - .../src/models/pub_key_cred_param.rs | 30 - .../public_key_credential_descriptor.rs | 36 - .../models/public_key_credential_rp_entity.rs | 33 - .../src/models/public_key_credential_type.rs | 34 - .../src/models/push_device_request_model.rs | 27 - .../models/push_registration_request_model.rs | 45 - .../src/models/push_send_request_model.rs | 45 - .../bitwarden-api-api/src/models/push_type.rs | 79 - .../src/models/push_update_request_model.rs | 33 - .../models/request_sm_access_request_model.rs | 30 - ...eset_password_with_org_id_request_model.rs | 33 - .../src/models/response_data.rs | 34 - .../models/revoke_access_tokens_request.rs | 25 - .../src/models/saml2_binding_type.rs | 47 - .../src/models/saml2_name_id_format.rs | 61 - .../src/models/saml2_signing_behavior.rs | 49 - .../secret_access_policies_requests_model.rs | 37 - .../secret_access_policies_response_model.rs | 43 - .../src/models/secret_create_request_model.rs | 42 - .../models/secret_response_inner_project.rs | 30 - .../src/models/secret_response_model.rs | 57 - .../src/models/secret_update_request_model.rs | 42 - .../secret_verification_request_model.rs | 39 - .../secret_with_projects_inner_project.rs | 30 - ...ecret_with_projects_list_response_model.rs | 33 - ...ts_manager_plan_features_response_model.rs | 90 - ...secrets_manager_subscribe_request_model.rs | 33 - ...nager_subscription_update_request_model.rs | 42 - .../src/models/secrets_sync_response_model.rs | 33 - .../secrets_with_projects_inner_secret.rs | 48 - .../src/models/secure_note_type.rs | 45 - .../selection_read_only_request_model.rs | 36 - .../selection_read_only_response_model.rs | 36 - ...sted_organization_license_request_model.rs | 30 - .../src/models/send_access_request_model.rs | 25 - .../src/models/send_file_model.rs | 36 - .../send_file_upload_data_response_model.rs | 36 - .../src/models/send_request_model.rs | 63 - .../src/models/send_response_model.rs | 75 - ...send_response_model_list_response_model.rs | 33 - .../src/models/send_text_model.rs | 30 - .../bitwarden-api-api/src/models/send_type.rs | 47 - .../src/models/send_with_id_request_model.rs | 71 - .../models/server_config_response_model.rs | 30 - ...ce_account_access_policy_response_model.rs | 39 - .../service_account_counts_response_model.rs | 36 - .../service_account_create_request_model.rs | 25 - ...icies_permission_details_response_model.rs | 34 - ..._account_granted_policies_request_model.rs | 29 - ...t_people_access_policies_response_model.rs | 36 - .../models/service_account_response_model.rs | 42 - ..._account_secrets_details_response_model.rs | 45 - ...ails_response_model_list_response_model.rs | 33 - .../service_account_update_request_model.rs | 25 - .../set_key_connector_key_request_model.rs | 51 - .../src/models/set_password_request_model.rs | 56 - .../src/models/sm_export_response_model.rs | 33 - .../src/models/sm_import_request_model.rs | 30 - .../src/models/sso_configuration_data.rs | 181 - .../models/sso_configuration_data_request.rs | 177 - .../bitwarden-api-api/src/models/sso_type.rs | 47 - .../bitwarden-api-api/src/models/sso_urls.rs | 45 - .../src/models/storage_request_model.rs | 27 - ...subscription_cancellation_request_model.rs | 30 - .../src/models/subscription_response_model.rs | 48 - .../src/models/sync_response_model.rs | 48 - .../src/models/tax_info_response_model.rs | 48 - .../models/tax_info_update_request_model.rs | 30 - .../models/tax_information_request_body.rs | 45 - .../src/models/tax_rate_response_model.rs | 42 - ...rate_response_model_list_response_model.rs | 33 - .../src/models/transaction_type.rs | 53 - ...tor_authenticator_disable_request_model.rs | 52 - ...two_factor_authenticator_response_model.rs | 39 - .../models/two_factor_duo_response_model.rs | 45 - .../models/two_factor_email_request_model.rs | 51 - .../models/two_factor_email_response_model.rs | 33 - .../two_factor_provider_request_model.rs | 42 - .../two_factor_provider_response_model.rs | 33 - ...ider_response_model_list_response_model.rs | 33 - .../src/models/two_factor_provider_type.rs | 59 - .../two_factor_recover_response_model.rs | 30 - .../two_factor_recovery_request_model.rs | 54 - ...o_factor_web_authn_delete_request_model.rs | 42 - .../two_factor_web_authn_request_model.rs | 51 - .../two_factor_web_authn_response_model.rs | 33 - .../two_factor_yubi_key_response_model.rs | 48 - .../src/models/update_avatar_request_model.rs | 25 - ...update_client_organization_request_body.rs | 30 - .../update_devices_trust_request_model.rs | 47 - .../models/update_domains_request_model.rs | 33 - .../src/models/update_key_request_model.rs | 58 - .../models/update_profile_request_model.rs | 30 - ..._tde_offboarding_password_request_model.rs | 36 - .../update_temp_password_request_model.rs | 33 - ..._two_factor_authenticator_request_model.rs | 51 - .../update_two_factor_duo_request_model.rs | 54 - .../update_two_factor_email_request_model.rs | 54 - ...ate_two_factor_yubico_otp_request_model.rs | 57 - .../src/models/uri_match_type.rs | 55 - crates/bitwarden-api-api/src/models/user.rs | 33 - .../user_access_policy_response_model.rs | 45 - .../src/models/user_key_response_model.rs | 33 - .../src/models/user_license.rs | 66 - .../models/user_verification_requirement.rs | 40 - .../verify_delete_recover_request_model.rs | 27 - .../src/models/verify_email_request_model.rs | 27 - .../src/models/verify_otp_request_model.rs | 25 - ...redential_create_options_response_model.rs | 33 - .../web_authn_credential_response_model.rs | 42 - ...tial_response_model_list_response_model.rs | 33 - ..._login_assertion_options_response_model.rs | 33 - ...n_login_credential_create_request_model.rs | 53 - ...n_login_credential_update_request_model.rs | 45 - ...eb_authn_login_rotate_key_request_model.rs | 37 - .../src/models/web_authn_prf_status.rs | 49 - crates/bitwarden-api-identity/.gitignore | 3 - .../.openapi-generator-ignore | 27 - .../.openapi-generator/FILES | 29 - .../.openapi-generator/VERSION | 1 - crates/bitwarden-api-identity/Cargo.toml | 26 - crates/bitwarden-api-identity/README.md | 75 - .../src/apis/accounts_api.rs | 355 - .../src/apis/configuration.rs | 49 - .../src/apis/info_api.rs | 142 - crates/bitwarden-api-identity/src/apis/mod.rs | 98 - .../src/apis/sso_api.rs | 220 - crates/bitwarden-api-identity/src/lib.rs | 14 - .../src/models/assertion_options.rs | 51 - ...authentication_extensions_client_inputs.rs | 39 - .../src/models/authenticator_transport.rs | 43 - .../src/models/kdf_type.rs | 47 - .../src/models/keys_request_model.rs | 30 - .../bitwarden-api-identity/src/models/mod.rs | 38 - .../src/models/prelogin_request_model.rs | 25 - .../src/models/prelogin_response_model.rs | 36 - .../src/models/product_tier_type.rs | 53 - .../src/models/product_type.rs | 47 - .../public_key_credential_descriptor.rs | 36 - .../src/models/public_key_credential_type.rs | 34 - .../models/register_finish_request_model.rs | 70 - .../src/models/register_request_model.rs | 66 - .../src/models/register_response_model.rs | 30 - ...r_send_verification_email_request_model.rs | 36 - ...erification_email_clicked_request_model.rs | 33 - ...l_send_verification_email_request_model.rs | 42 - .../models/user_verification_requirement.rs | 40 - ..._login_assertion_options_response_model.rs | 33 - crates/bitwarden-cli/Cargo.toml | 23 - crates/bitwarden-cli/README.md | 6 - crates/bitwarden-cli/src/color.rs | 35 - crates/bitwarden-cli/src/lib.rs | 15 - crates/bitwarden-core/Cargo.toml | 67 - crates/bitwarden-core/README.md | 6 - crates/bitwarden-core/src/.gitignore | 1 - .../bitwarden-core/src/admin_console/mod.rs | 3 - .../src/admin_console/policy.rs | 87 - .../bitwarden-core/src/auth/access_token.rs | 110 - crates/bitwarden-core/src/auth/api/mod.rs | 2 - .../auth/api/request/access_token_request.rs | 33 - .../src/auth/api/request/api_token_request.rs | 41 - .../api/request/auth_request_token_request.rs | 59 - .../src/auth/api/request/mod.rs | 64 - .../api/request/password_token_request.rs | 70 - .../auth/api/request/renew_token_request.rs | 27 - .../api/response/identity_captcha_response.rs | 31 - .../api/response/identity_payload_response.rs | 13 - .../api/response/identity_refresh_response.rs | 11 - .../api/response/identity_success_response.rs | 68 - .../response/identity_token_fail_response.rs | 36 - .../api/response/identity_token_response.rs | 75 - .../response/identity_two_factor_response.rs | 36 - .../src/auth/api/response/mod.rs | 18 - .../two_factor_provider_data/authenticator.rs | 10 - .../response/two_factor_provider_data/duo.rs | 15 - .../two_factor_provider_data/email.rs | 13 - .../response/two_factor_provider_data/mod.rs | 7 - .../organization_duo.rs | 15 - .../two_factor_provider_data/remember.rs | 10 - .../two_factor_provider_data/web_authn.rs | 10 - .../two_factor_provider_data/yubi_key.rs | 13 - .../auth/api/response/two_factor_providers.rs | 57 - .../bitwarden-core/src/auth/auth_request.rs | 255 - crates/bitwarden-core/src/auth/client_auth.rs | 277 - crates/bitwarden-core/src/auth/jwt_token.rs | 71 - .../bitwarden-core/src/auth/key_connector.rs | 42 - .../src/auth/login/access_token.rs | 178 - .../bitwarden-core/src/auth/login/api_key.rs | 108 - .../src/auth/login/auth_request.rs | 129 - crates/bitwarden-core/src/auth/login/mod.rs | 94 - .../bitwarden-core/src/auth/login/password.rs | 153 - .../auth/login/response/captcha_response.rs | 23 - .../src/auth/login/response/mod.rs | 2 - .../response/two_factor/authenticator.rs | 16 - .../src/auth/login/response/two_factor/duo.rs | 31 - .../auth/login/response/two_factor/email.rs | 15 - .../src/auth/login/response/two_factor/mod.rs | 15 - .../login/response/two_factor/remember.rs | 12 - .../two_factor/two_factor_providers.rs | 39 - .../login/response/two_factor/web_authn.rs | 12 - .../login/response/two_factor/yubi_key.rs | 15 - .../src/auth/login/two_factor.rs | 71 - crates/bitwarden-core/src/auth/mod.rs | 76 - .../bitwarden-core/src/auth/password/mod.rs | 9 - .../src/auth/password/policy.rs | 176 - .../src/auth/password/strength.rs | 78 - .../src/auth/password/validate.rs | 195 - crates/bitwarden-core/src/auth/pin.rs | 101 - crates/bitwarden-core/src/auth/register.rs | 78 - crates/bitwarden-core/src/auth/renew.rs | 109 - crates/bitwarden-core/src/auth/tde.rs | 63 - crates/bitwarden-core/src/client/client.rs | 106 - .../src/client/client_settings.rs | 84 - .../src/client/encryption_settings.rs | 158 - crates/bitwarden-core/src/client/flags.rs | 43 - crates/bitwarden-core/src/client/internal.rs | 252 - .../bitwarden-core/src/client/login_method.rs | 46 - crates/bitwarden-core/src/client/mod.rs | 20 - .../src/client/test_accounts.rs | 189 - crates/bitwarden-core/src/error.rs | 213 - crates/bitwarden-core/src/lib.rs | 21 - .../src/mobile/client_crypto.rs | 65 - .../bitwarden-core/src/mobile/client_kdf.rs | 25 - crates/bitwarden-core/src/mobile/crypto.rs | 588 -- crates/bitwarden-core/src/mobile/kdf.rs | 14 - crates/bitwarden-core/src/mobile/mod.rs | 8 - .../src/platform/client_platform.rs | 33 - .../src/platform/generate_fingerprint.rs | 93 - .../src/platform/get_user_api_key.rs | 83 - crates/bitwarden-core/src/platform/mod.rs | 9 - .../platform/secret_verification_request.rs | 14 - .../bitwarden-core/src/secrets_manager/mod.rs | 1 - .../src/secrets_manager/state.rs | 53 - crates/bitwarden-core/src/uniffi_support.rs | 52 - crates/bitwarden-core/src/util.rs | 28 - crates/bitwarden-core/tests/register.rs | 41 - crates/bitwarden-core/uniffi.toml | 9 - crates/bitwarden-crypto/Cargo.toml | 68 - crates/bitwarden-crypto/README.md | 6 - .../benches/default_allocator.rs | 14 - .../benches/zeroizing_allocator.rs | 11 - crates/bitwarden-crypto/src/aes.rs | 250 - crates/bitwarden-crypto/src/allocator.rs | 167 - .../src/enc_string/asymmetric.rs | 329 - crates/bitwarden-crypto/src/enc_string/mod.rs | 137 - .../src/enc_string/symmetric.rs | 494 -- crates/bitwarden-crypto/src/error.rs | 71 - crates/bitwarden-crypto/src/fingerprint.rs | 95 - .../src/keys/asymmetric_crypto_key.rs | 226 - .../bitwarden-crypto/src/keys/device_key.rs | 140 - .../src/keys/key_encryptable.rs | 122 - .../bitwarden-crypto/src/keys/master_key.rs | 361 - crates/bitwarden-crypto/src/keys/mod.rs | 24 - crates/bitwarden-crypto/src/keys/pin_key.rs | 50 - .../src/keys/shareable_key.rs | 55 - .../src/keys/symmetric_crypto_key.rs | 163 - crates/bitwarden-crypto/src/keys/user_key.rs | 19 - crates/bitwarden-crypto/src/keys/utils.rs | 147 - crates/bitwarden-crypto/src/lib.rs | 90 - crates/bitwarden-crypto/src/rsa.rs | 60 - crates/bitwarden-crypto/src/uniffi_support.rs | 45 - crates/bitwarden-crypto/src/util.rs | 81 - crates/bitwarden-crypto/src/wordlist.rs | 7779 ----------------- crates/bitwarden-crypto/uniffi.toml | 9 - crates/bitwarden-exporters/Cargo.toml | 35 - crates/bitwarden-exporters/README.md | 6 - .../resources/json_export.json | 146 - .../src/client_exporter.rs | 45 - crates/bitwarden-exporters/src/csv.rs | 266 - .../bitwarden-exporters/src/encrypted_json.rs | 246 - crates/bitwarden-exporters/src/error.rs | 21 - crates/bitwarden-exporters/src/export.rs | 43 - crates/bitwarden-exporters/src/json.rs | 762 -- crates/bitwarden-exporters/src/lib.rs | 134 - crates/bitwarden-exporters/src/models.rs | 220 - crates/bitwarden-exporters/uniffi.toml | 9 - crates/bitwarden-fido/Cargo.toml | 43 - crates/bitwarden-fido/README.md | 6 - crates/bitwarden-fido/src/authenticator.rs | 670 -- crates/bitwarden-fido/src/client.rs | 142 - crates/bitwarden-fido/src/client_fido.rs | 67 - crates/bitwarden-fido/src/crypto.rs | 102 - crates/bitwarden-fido/src/lib.rs | 297 - crates/bitwarden-fido/src/traits.rs | 67 - crates/bitwarden-fido/src/types.rs | 484 - crates/bitwarden-fido/src/uniffi_support.rs | 3 - crates/bitwarden-fido/uniffi.toml | 9 - crates/bitwarden-generators/Cargo.toml | 36 - crates/bitwarden-generators/README.md | 6 - .../src/client_generator.rs | 106 - crates/bitwarden-generators/src/lib.rs | 13 - crates/bitwarden-generators/src/passphrase.rs | 229 - crates/bitwarden-generators/src/password.rs | 397 - crates/bitwarden-generators/src/username.rs | 267 - .../src/username_forwarders/addyio.rs | 158 - .../src/username_forwarders/duckduckgo.rs | 97 - .../src/username_forwarders/fastmail.rs | 206 - .../src/username_forwarders/firefox.rs | 173 - .../src/username_forwarders/forwardemail.rs | 209 - .../src/username_forwarders/mod.rs | 22 - .../src/username_forwarders/simplelogin.rs | 125 - crates/bitwarden-generators/src/util.rs | 10 - crates/bitwarden-generators/uniffi.toml | 9 - crates/bitwarden-json/Cargo.toml | 4 +- crates/bitwarden-send/Cargo.toml | 38 - crates/bitwarden-send/README.md | 6 - crates/bitwarden-send/src/client_sends.rs | 95 - crates/bitwarden-send/src/error.rs | 11 - crates/bitwarden-send/src/lib.rs | 11 - crates/bitwarden-send/src/send.rs | 606 -- crates/bitwarden-send/src/uniffi_support.rs | 8 - crates/bitwarden-send/uniffi.toml | 9 - crates/bitwarden-sm/Cargo.toml | 32 - crates/bitwarden-sm/src/client_projects.rs | 50 - crates/bitwarden-sm/src/client_secrets.rs | 70 - crates/bitwarden-sm/src/lib.rs | 7 - crates/bitwarden-sm/src/projects/create.rs | 116 - crates/bitwarden-sm/src/projects/delete.rs | 65 - crates/bitwarden-sm/src/projects/get.rs | 26 - crates/bitwarden-sm/src/projects/list.rs | 55 - crates/bitwarden-sm/src/projects/mod.rs | 18 - .../src/projects/project_response.rs | 40 - crates/bitwarden-sm/src/projects/update.rs | 116 - crates/bitwarden-sm/src/secrets/create.rs | 202 - crates/bitwarden-sm/src/secrets/delete.rs | 65 - crates/bitwarden-sm/src/secrets/get.rs | 25 - crates/bitwarden-sm/src/secrets/get_by_ids.rs | 30 - crates/bitwarden-sm/src/secrets/list.rs | 108 - crates/bitwarden-sm/src/secrets/mod.rs | 26 - .../src/secrets/secret_response.rs | 100 - crates/bitwarden-sm/src/secrets/sync.rs | 70 - crates/bitwarden-sm/src/secrets/update.rs | 198 - crates/bitwarden-uniffi/Cargo.toml | 51 - crates/bitwarden-uniffi/README.md | 1 - .../bitwarden-uniffi/src/android_support.rs | 77 - crates/bitwarden-uniffi/src/auth/mod.rs | 151 - crates/bitwarden-uniffi/src/crypto.rs | 76 - crates/bitwarden-uniffi/src/error.rs | 81 - crates/bitwarden-uniffi/src/lib.rs | 107 - crates/bitwarden-uniffi/src/platform/fido2.rs | 371 - crates/bitwarden-uniffi/src/platform/mod.rs | 38 - crates/bitwarden-uniffi/src/tool/mod.rs | 89 - crates/bitwarden-uniffi/src/tool/sends.rs | 64 - crates/bitwarden-uniffi/src/uniffi_support.rs | 13 - .../bitwarden-uniffi/src/vault/attachments.rs | 74 - crates/bitwarden-uniffi/src/vault/ciphers.rs | 54 - .../bitwarden-uniffi/src/vault/collections.rs | 21 - crates/bitwarden-uniffi/src/vault/folders.rs | 26 - crates/bitwarden-uniffi/src/vault/mod.rs | 75 - .../src/vault/password_history.rs | 26 - crates/bitwarden-uniffi/uniffi.toml | 10 - crates/bitwarden-vault/Cargo.toml | 49 - crates/bitwarden-vault/README.md | 6 - .../bitwarden-vault/src/cipher/attachment.rs | 342 - crates/bitwarden-vault/src/cipher/card.rs | 73 - crates/bitwarden-vault/src/cipher/cipher.rs | 1162 --- crates/bitwarden-vault/src/cipher/field.rs | 92 - crates/bitwarden-vault/src/cipher/identity.rs | 133 - .../bitwarden-vault/src/cipher/linked_id.rs | 168 - .../bitwarden-vault/src/cipher/local_data.rs | 37 - crates/bitwarden-vault/src/cipher/login.rs | 493 -- crates/bitwarden-vault/src/cipher/mod.rs | 21 - .../bitwarden-vault/src/cipher/secure_note.rs | 63 - crates/bitwarden-vault/src/client_totp.rs | 32 - crates/bitwarden-vault/src/client_vault.rs | 30 - crates/bitwarden-vault/src/collection.rs | 77 - crates/bitwarden-vault/src/domain.rs | 26 - crates/bitwarden-vault/src/error.rs | 11 - crates/bitwarden-vault/src/folder.rs | 65 - crates/bitwarden-vault/src/lib.rs | 25 - .../src/mobile/client_attachments.rs | 85 - .../src/mobile/client_ciphers.rs | 333 - .../src/mobile/client_collection.rs | 81 - .../src/mobile/client_folders.rs | 45 - .../src/mobile/client_password_history.rs | 39 - crates/bitwarden-vault/src/mobile/mod.rs | 5 - .../bitwarden-vault/src/password_history.rs | 57 - crates/bitwarden-vault/src/sync.rs | 169 - crates/bitwarden-vault/src/totp.rs | 381 - crates/bitwarden-vault/src/uniffi_support.rs | 8 - crates/bitwarden-vault/uniffi.toml | 9 - crates/bitwarden-wasm-internal/Cargo.toml | 31 - crates/bitwarden-wasm-internal/README.md | 25 - crates/bitwarden-wasm-internal/build.sh | 25 - crates/bitwarden-wasm-internal/src/client.rs | 71 - crates/bitwarden-wasm-internal/src/crypto.rs | 33 - .../src/custom_types.rs | 22 - crates/bitwarden-wasm-internal/src/error.rs | 28 - crates/bitwarden-wasm-internal/src/lib.rs | 9 - .../src/vault/folders.rs | 24 - .../bitwarden-wasm-internal/src/vault/mod.rs | 24 - crates/bitwarden/Cargo.toml | 6 +- crates/bw/Cargo.toml | 33 - crates/bw/README.md | 5 - crates/bw/src/auth/login.rs | 136 - crates/bw/src/auth/mod.rs | 2 - crates/bw/src/main.rs | 252 - crates/bw/src/render.rs | 11 - crates/memory-testing/.gitignore | 1 - crates/memory-testing/Cargo.toml | 20 - crates/memory-testing/Dockerfile | 49 - crates/memory-testing/Dockerfile.dockerignore | 4 - crates/memory-testing/cases.json | 128 - crates/memory-testing/run_test.sh | 22 - .../memory-testing/src/bin/analyze-dumps.rs | 89 - .../memory-testing/src/bin/capture-dumps.rs | 88 - crates/memory-testing/src/lib.rs | 69 - crates/memory-testing/src/main.rs | 76 - crates/sdk-schemas/Cargo.toml | 1 - crates/uniffi-bindgen/Cargo.toml | 20 - crates/uniffi-bindgen/uniffi-bindgen.rs | 3 - languages/js/sdk-internal/.gitignore | 7 - languages/js/sdk-internal/LICENSE | 295 - languages/js/sdk-internal/README.md | 3 - languages/js/sdk-internal/index.js | 8 - languages/js/sdk-internal/package.json | 25 - languages/kotlin/.gitignore | 15 - languages/kotlin/README.md | 44 - languages/kotlin/app/.gitignore | 1 - languages/kotlin/app/build.gradle | 75 - languages/kotlin/app/proguard-rules.pro | 21 - .../kotlin/app/src/main/AndroidManifest.xml | 31 - .../com/bitwarden/myapplication/Biometrics.kt | 132 - .../bitwarden/myapplication/MainActivity.kt | 445 - .../bitwarden/myapplication/ui/theme/Color.kt | 11 - .../bitwarden/myapplication/ui/theme/Theme.kt | 70 - .../bitwarden/myapplication/ui/theme/Type.kt | 34 - .../drawable-v24/ic_launcher_foreground.xml | 30 - .../res/drawable/ic_launcher_background.xml | 170 - .../res/mipmap-anydpi-v26/ic_launcher.xml | 6 - .../mipmap-anydpi-v26/ic_launcher_round.xml | 6 - .../src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 1404 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 2898 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 982 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 1772 -> 0 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 1900 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 3918 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 2884 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 5914 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 3844 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 7778 -> 0 bytes .../kotlin/app/src/main/res/values/colors.xml | 10 - .../app/src/main/res/values/strings.xml | 3 - .../kotlin/app/src/main/res/values/themes.xml | 5 - .../app/src/main/res/xml/backup_rules.xml | 13 - .../main/res/xml/data_extraction_rules.xml | 19 - .../main/res/xml/network_security_config.xml | 24 - languages/kotlin/build-schemas.sh | 6 - languages/kotlin/build.gradle | 7 - languages/kotlin/gradle.properties | 23 - .../kotlin/gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 - languages/kotlin/gradlew | 185 - languages/kotlin/gradlew.bat | 89 - languages/kotlin/publish-local.sh | 16 - languages/kotlin/sdk/.gitignore | 1 - languages/kotlin/sdk/build.gradle | 117 - languages/kotlin/sdk/consumer-rules.pro | 0 languages/kotlin/sdk/lint-baseline.xml | 39 - languages/kotlin/sdk/proguard-rules.pro | 21 - .../kotlin/sdk/src/main/AndroidManifest.xml | 4 - .../kotlin/sdk/src/main/jniLibs/.gitignore | 2 - .../java/com/bitwarden/sdk/ExampleUnitTest.kt | 17 - languages/kotlin/settings.gradle | 18 - languages/swift/Package.swift | 33 - languages/swift/README.md | 26 - .../swift/Sources/BitwardenSdk/.gitignore | 2 - .../BitwardenSdkTests/BitwardenSdkTests.swift | 11 - languages/swift/build.sh | 47 - .../swift/iOS/App.xcodeproj/project.pbxproj | 386 - .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../AccentColor.colorset/Contents.json | 11 - .../AppIcon.appiconset/Contents.json | 13 - .../iOS/App/Assets.xcassets/Contents.json | 6 - languages/swift/iOS/App/Biometrics.swift | 91 - languages/swift/iOS/App/ContentView.swift | 428 - .../Preview Assets.xcassets/Contents.json | 6 - languages/swift/iOS/App/testApp.swift | 17 - languages/swift/iOS/swift-format.json | 5 - openapitools.json | 7 - package-lock.json | 1249 +-- package.json | 1 - support/build-api.sh | 29 - support/openapi-template/.travis.yml | 1 - support/openapi-template/Cargo.mustache | 51 - support/openapi-template/README.mustache | 54 - support/openapi-template/api_doc.mustache | 47 - support/openapi-template/git_push.sh.mustache | 57 - support/openapi-template/gitignore.mustache | 3 - support/openapi-template/hyper/api.mustache | 173 - .../openapi-template/hyper/api_mod.mustache | 64 - .../openapi-template/hyper/client.mustache | 54 - .../hyper/configuration.mustache | 34 - support/openapi-template/lib.mustache | 20 - support/openapi-template/model.mustache | 180 - support/openapi-template/model_doc.mustache | 54 - support/openapi-template/model_mod.mustache | 6 - .../openapi-template/partial_header.mustache | 13 - support/openapi-template/request.rs | 242 - support/openapi-template/reqwest/api.mustache | 372 - .../openapi-template/reqwest/api_mod.mustache | 128 - .../reqwest/configuration.mustache | 91 - 857 files changed, 58 insertions(+), 86244 deletions(-) delete mode 100644 .github/workflows/build-android.yml delete mode 100644 .github/workflows/build-swift.yml delete mode 100644 .github/workflows/build-wasm-internal.yml delete mode 100644 .github/workflows/delete-old-packages.yml delete mode 100644 .github/workflows/memory-testing.yml delete mode 100644 .github/workflows/publish-internal.yml delete mode 100644 .github/workflows/release-swift.yml delete mode 100644 crates/bitwarden-api-api/.gitignore delete mode 100644 crates/bitwarden-api-api/.openapi-generator-ignore delete mode 100644 crates/bitwarden-api-api/.openapi-generator/FILES delete mode 100644 crates/bitwarden-api-api/.openapi-generator/VERSION delete mode 100644 crates/bitwarden-api-api/Cargo.toml delete mode 100644 crates/bitwarden-api-api/README.md delete mode 100644 crates/bitwarden-api-api/src/apis/access_policies_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/accounts_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/accounts_billing_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/auth_requests_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/ciphers_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/collections_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/config_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/configuration.rs delete mode 100644 crates/bitwarden-api-api/src/apis/counts_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/devices_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/emergency_access_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/events_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/folders_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/groups_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/hibp_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/import_ciphers_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/info_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/installations_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/licenses_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/misc_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/mod.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organization_auth_requests_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organization_billing_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organization_connections_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organization_domain_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organization_export_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organization_sponsorships_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organization_users_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/organizations_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/plans_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/policies_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/projects_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/provider_billing_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/provider_clients_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/provider_organizations_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/provider_users_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/providers_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/push_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/request_sm_access_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/secrets_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/secrets_manager_events_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/secrets_manager_porting_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/self_hosted_organization_licenses_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/self_hosted_organization_sponsorships_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/sends_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/service_accounts_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/settings_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/stripe_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/sync_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/trash_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/two_factor_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/users_api.rs delete mode 100644 crates/bitwarden-api-api/src/apis/web_authn_api.rs delete mode 100644 crates/bitwarden-api-api/src/lib.rs delete mode 100644 crates/bitwarden-api-api/src/models/access_policy_request.rs delete mode 100644 crates/bitwarden-api-api/src/models/access_token_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/access_token_creation_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/access_token_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/access_token_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/admin_auth_request_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/algorithm.rs delete mode 100644 crates/bitwarden-api-api/src/models/api_key_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/assertion_options.rs delete mode 100644 crates/bitwarden-api-api/src/models/assertion_response.rs delete mode 100644 crates/bitwarden-api-api/src/models/attachment_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/attachment_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/attachment_upload_data_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/attestation_conveyance_preference.rs delete mode 100644 crates/bitwarden-api-api/src/models/auth_request_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/auth_request_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/auth_request_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/auth_request_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/auth_request_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/authentication_extensions_client_inputs.rs delete mode 100644 crates/bitwarden-api-api/src/models/authentication_extensions_client_outputs.rs delete mode 100644 crates/bitwarden-api-api/src/models/authenticator_assertion_raw_response.rs delete mode 100644 crates/bitwarden-api-api/src/models/authenticator_attachment.rs delete mode 100644 crates/bitwarden-api-api/src/models/authenticator_attestation_raw_response.rs delete mode 100644 crates/bitwarden-api-api/src/models/authenticator_selection.rs delete mode 100644 crates/bitwarden-api-api/src/models/authenticator_transport.rs delete mode 100644 crates/bitwarden-api-api/src/models/base_secret_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/base_secret_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_customer_discount.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_history_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_invoice.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_payment_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_source.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_subscription.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_subscription_item.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_subscription_upcoming_invoice.rs delete mode 100644 crates/bitwarden-api-api/src/models/billing_transaction.rs delete mode 100644 crates/bitwarden-api-api/src/models/bit_pay_invoice_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/bulk_collection_access_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/bulk_delete_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/bulk_delete_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/bulk_deny_admin_auth_request_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_attachment_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_bulk_delete_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_bulk_move_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_bulk_restore_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_bulk_share_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_bulk_update_collections_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_card_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_collections_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_fido2_credential_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_field_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_identity_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_login_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_login_uri_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_mini_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_mini_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_mini_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_mini_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_partial_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_password_history_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_reprompt_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_secure_note_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_share_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/cipher_with_id_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_access_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_access_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_bulk_delete_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/collection_with_id_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/config_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/create_client_organization_request_body.rs delete mode 100644 crates/bitwarden-api-api/src/models/credential_create_options.rs delete mode 100644 crates/bitwarden-api-api/src/models/delete_recover_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_keys_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_keys_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_token_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_verification_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/device_verification_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/domains_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/email_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/email_token_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_invite_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_password_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_status_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_takeover_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_view_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/emergency_access_with_id_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/environment_config_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/event_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/event_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/event_system_user.rs delete mode 100644 crates/bitwarden-api-api/src/models/event_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/expanded_tax_info_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/fido2_user.rs delete mode 100644 crates/bitwarden-api-api/src/models/field_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/file_upload_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/folder_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/folder_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/folder_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/folder_with_id_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/get_secrets_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/global_domains.rs delete mode 100644 crates/bitwarden-api-api/src/models/global_equivalent_domains_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/granted_access_policy_request.rs delete mode 100644 crates/bitwarden-api-api/src/models/granted_project_access_policy_permission_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/granted_project_access_policy_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/group.rs delete mode 100644 crates/bitwarden-api-api/src/models/group_access_policy_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/group_bulk_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/group_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/group_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/group_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/group_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/import_ciphers_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/import_organization_ciphers_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/import_organization_users_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/inner_project_export_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/inner_project_import_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/inner_secret_export_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/inner_secret_import_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/installation_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/installation_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/int32_int32_key_value_pair.rs delete mode 100644 crates/bitwarden-api-api/src/models/kdf_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/kdf_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/key_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/key_pair_request_body.rs delete mode 100644 crates/bitwarden-api-api/src/models/keys_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/keys_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/license_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/master_password_policy_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/member_decryption_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/mod.rs delete mode 100644 crates/bitwarden-api-api/src/models/open_id_connect_redirect_behavior.rs delete mode 100644 crates/bitwarden-api-api/src/models/optional_cipher_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_api_key_information.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_api_key_information_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_api_key_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_api_key_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_auth_request_update_many_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_auto_enroll_status_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_billing_status_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_collection_management_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_connection_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_connection_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_connection_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_counts_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_domain_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_domain_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_domain_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_domain_sso_details_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_domain_sso_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_keys_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_keys_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_license.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_public_key_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_seat_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sponsorship_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sponsorship_redeem_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sponsorship_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sponsorship_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sponsorship_sync_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sponsorship_sync_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sso_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_sso_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_subscription_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_subscription_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_upgrade_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_accept_init_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_accept_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model_entry.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_bulk_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_bulk_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_bulk_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_confirm_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_invite_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_public_key_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_public_key_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_reset_password_enrollment_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_reset_password_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_status_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_user_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_user_user_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_verify_bank_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/organization_verify_delete_recover_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/other_device_keys_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/password_hint_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/password_manager_plan_features_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/password_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/payment_method_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/payment_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/payment_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/people_access_policies_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/permissions.rs delete mode 100644 crates/bitwarden-api-api/src/models/plan_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/plan_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/plan_sponsorship_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/plan_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/policy_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/policy_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/policy_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/policy_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/potential_grantee_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/potential_grantee_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/product_tier_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/profile_organization_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/profile_organization_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/profile_provider_organization_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/profile_provider_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/profile_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_counts_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_people_access_policies_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/project_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/protected_device_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_organization_add_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_organization_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_organization_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_setup_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_status_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_accept_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model_entry.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_bulk_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_bulk_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_bulk_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_confirm_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_invite_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_public_key_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_public_key_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_status_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_user_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_user_user_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/provider_verify_delete_recover_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/pub_key_cred_param.rs delete mode 100644 crates/bitwarden-api-api/src/models/public_key_credential_descriptor.rs delete mode 100644 crates/bitwarden-api-api/src/models/public_key_credential_rp_entity.rs delete mode 100644 crates/bitwarden-api-api/src/models/public_key_credential_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/push_device_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/push_registration_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/push_send_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/push_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/push_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/request_sm_access_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/reset_password_with_org_id_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/response_data.rs delete mode 100644 crates/bitwarden-api-api/src/models/revoke_access_tokens_request.rs delete mode 100644 crates/bitwarden-api-api/src/models/saml2_binding_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/saml2_name_id_format.rs delete mode 100644 crates/bitwarden-api-api/src/models/saml2_signing_behavior.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_access_policies_requests_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_access_policies_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_response_inner_project.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_verification_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_with_projects_inner_project.rs delete mode 100644 crates/bitwarden-api-api/src/models/secret_with_projects_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secrets_manager_plan_features_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secrets_manager_subscribe_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secrets_manager_subscription_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secrets_sync_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/secrets_with_projects_inner_secret.rs delete mode 100644 crates/bitwarden-api-api/src/models/secure_note_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/selection_read_only_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/selection_read_only_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/self_hosted_organization_license_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_access_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_file_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_file_upload_data_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_text_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/send_with_id_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/server_config_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_access_policy_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_counts_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_granted_policies_permission_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_granted_policies_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_people_access_policies_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/service_account_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/set_key_connector_key_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/set_password_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/sm_export_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/sm_import_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/sso_configuration_data.rs delete mode 100644 crates/bitwarden-api-api/src/models/sso_configuration_data_request.rs delete mode 100644 crates/bitwarden-api-api/src/models/sso_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/sso_urls.rs delete mode 100644 crates/bitwarden-api-api/src/models/storage_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/subscription_cancellation_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/subscription_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/sync_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/tax_info_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/tax_info_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/tax_information_request_body.rs delete mode 100644 crates/bitwarden-api-api/src/models/tax_rate_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/tax_rate_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/transaction_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_authenticator_disable_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_authenticator_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_duo_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_email_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_email_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_provider_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_provider_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_provider_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_provider_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_recover_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_recovery_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_web_authn_delete_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_web_authn_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_web_authn_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/two_factor_yubi_key_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_avatar_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_client_organization_request_body.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_devices_trust_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_domains_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_key_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_profile_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_tde_offboarding_password_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_temp_password_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_two_factor_authenticator_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_two_factor_duo_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_two_factor_email_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/update_two_factor_yubico_otp_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/uri_match_type.rs delete mode 100644 crates/bitwarden-api-api/src/models/user.rs delete mode 100644 crates/bitwarden-api-api/src/models/user_access_policy_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/user_key_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/user_license.rs delete mode 100644 crates/bitwarden-api-api/src/models/user_verification_requirement.rs delete mode 100644 crates/bitwarden-api-api/src/models/verify_delete_recover_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/verify_email_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/verify_otp_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_credential_create_options_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_credential_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_credential_response_model_list_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_login_assertion_options_response_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_login_credential_create_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_login_credential_update_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_login_rotate_key_request_model.rs delete mode 100644 crates/bitwarden-api-api/src/models/web_authn_prf_status.rs delete mode 100644 crates/bitwarden-api-identity/.gitignore delete mode 100644 crates/bitwarden-api-identity/.openapi-generator-ignore delete mode 100644 crates/bitwarden-api-identity/.openapi-generator/FILES delete mode 100644 crates/bitwarden-api-identity/.openapi-generator/VERSION delete mode 100644 crates/bitwarden-api-identity/Cargo.toml delete mode 100644 crates/bitwarden-api-identity/README.md delete mode 100644 crates/bitwarden-api-identity/src/apis/accounts_api.rs delete mode 100644 crates/bitwarden-api-identity/src/apis/configuration.rs delete mode 100644 crates/bitwarden-api-identity/src/apis/info_api.rs delete mode 100644 crates/bitwarden-api-identity/src/apis/mod.rs delete mode 100644 crates/bitwarden-api-identity/src/apis/sso_api.rs delete mode 100644 crates/bitwarden-api-identity/src/lib.rs delete mode 100644 crates/bitwarden-api-identity/src/models/assertion_options.rs delete mode 100644 crates/bitwarden-api-identity/src/models/authentication_extensions_client_inputs.rs delete mode 100644 crates/bitwarden-api-identity/src/models/authenticator_transport.rs delete mode 100644 crates/bitwarden-api-identity/src/models/kdf_type.rs delete mode 100644 crates/bitwarden-api-identity/src/models/keys_request_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/mod.rs delete mode 100644 crates/bitwarden-api-identity/src/models/prelogin_request_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/prelogin_response_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/product_tier_type.rs delete mode 100644 crates/bitwarden-api-identity/src/models/product_type.rs delete mode 100644 crates/bitwarden-api-identity/src/models/public_key_credential_descriptor.rs delete mode 100644 crates/bitwarden-api-identity/src/models/public_key_credential_type.rs delete mode 100644 crates/bitwarden-api-identity/src/models/register_finish_request_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/register_request_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/register_response_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/register_send_verification_email_request_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/register_verification_email_clicked_request_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/trial_send_verification_email_request_model.rs delete mode 100644 crates/bitwarden-api-identity/src/models/user_verification_requirement.rs delete mode 100644 crates/bitwarden-api-identity/src/models/web_authn_login_assertion_options_response_model.rs delete mode 100644 crates/bitwarden-cli/Cargo.toml delete mode 100644 crates/bitwarden-cli/README.md delete mode 100644 crates/bitwarden-cli/src/color.rs delete mode 100644 crates/bitwarden-cli/src/lib.rs delete mode 100644 crates/bitwarden-core/Cargo.toml delete mode 100644 crates/bitwarden-core/README.md delete mode 100644 crates/bitwarden-core/src/.gitignore delete mode 100644 crates/bitwarden-core/src/admin_console/mod.rs delete mode 100644 crates/bitwarden-core/src/admin_console/policy.rs delete mode 100644 crates/bitwarden-core/src/auth/access_token.rs delete mode 100644 crates/bitwarden-core/src/auth/api/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/api/request/access_token_request.rs delete mode 100644 crates/bitwarden-core/src/auth/api/request/api_token_request.rs delete mode 100644 crates/bitwarden-core/src/auth/api/request/auth_request_token_request.rs delete mode 100644 crates/bitwarden-core/src/auth/api/request/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/api/request/password_token_request.rs delete mode 100644 crates/bitwarden-core/src/auth/api/request/renew_token_request.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/identity_captcha_response.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/identity_payload_response.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/identity_refresh_response.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/identity_success_response.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/identity_token_fail_response.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/identity_token_response.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/identity_two_factor_response.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/authenticator.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/duo.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/email.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/organization_duo.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/remember.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/web_authn.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/yubi_key.rs delete mode 100644 crates/bitwarden-core/src/auth/api/response/two_factor_providers.rs delete mode 100644 crates/bitwarden-core/src/auth/auth_request.rs delete mode 100644 crates/bitwarden-core/src/auth/client_auth.rs delete mode 100644 crates/bitwarden-core/src/auth/jwt_token.rs delete mode 100644 crates/bitwarden-core/src/auth/key_connector.rs delete mode 100644 crates/bitwarden-core/src/auth/login/access_token.rs delete mode 100644 crates/bitwarden-core/src/auth/login/api_key.rs delete mode 100644 crates/bitwarden-core/src/auth/login/auth_request.rs delete mode 100644 crates/bitwarden-core/src/auth/login/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/login/password.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/captcha_response.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/authenticator.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/duo.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/email.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/remember.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/two_factor_providers.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/web_authn.rs delete mode 100644 crates/bitwarden-core/src/auth/login/response/two_factor/yubi_key.rs delete mode 100644 crates/bitwarden-core/src/auth/login/two_factor.rs delete mode 100644 crates/bitwarden-core/src/auth/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/password/mod.rs delete mode 100644 crates/bitwarden-core/src/auth/password/policy.rs delete mode 100644 crates/bitwarden-core/src/auth/password/strength.rs delete mode 100644 crates/bitwarden-core/src/auth/password/validate.rs delete mode 100644 crates/bitwarden-core/src/auth/pin.rs delete mode 100644 crates/bitwarden-core/src/auth/register.rs delete mode 100644 crates/bitwarden-core/src/auth/renew.rs delete mode 100644 crates/bitwarden-core/src/auth/tde.rs delete mode 100644 crates/bitwarden-core/src/client/client.rs delete mode 100644 crates/bitwarden-core/src/client/client_settings.rs delete mode 100644 crates/bitwarden-core/src/client/encryption_settings.rs delete mode 100644 crates/bitwarden-core/src/client/flags.rs delete mode 100644 crates/bitwarden-core/src/client/internal.rs delete mode 100644 crates/bitwarden-core/src/client/login_method.rs delete mode 100644 crates/bitwarden-core/src/client/mod.rs delete mode 100644 crates/bitwarden-core/src/client/test_accounts.rs delete mode 100644 crates/bitwarden-core/src/error.rs delete mode 100644 crates/bitwarden-core/src/lib.rs delete mode 100644 crates/bitwarden-core/src/mobile/client_crypto.rs delete mode 100644 crates/bitwarden-core/src/mobile/client_kdf.rs delete mode 100644 crates/bitwarden-core/src/mobile/crypto.rs delete mode 100644 crates/bitwarden-core/src/mobile/kdf.rs delete mode 100644 crates/bitwarden-core/src/mobile/mod.rs delete mode 100644 crates/bitwarden-core/src/platform/client_platform.rs delete mode 100644 crates/bitwarden-core/src/platform/generate_fingerprint.rs delete mode 100644 crates/bitwarden-core/src/platform/get_user_api_key.rs delete mode 100644 crates/bitwarden-core/src/platform/mod.rs delete mode 100644 crates/bitwarden-core/src/platform/secret_verification_request.rs delete mode 100644 crates/bitwarden-core/src/secrets_manager/mod.rs delete mode 100644 crates/bitwarden-core/src/secrets_manager/state.rs delete mode 100644 crates/bitwarden-core/src/uniffi_support.rs delete mode 100644 crates/bitwarden-core/src/util.rs delete mode 100644 crates/bitwarden-core/tests/register.rs delete mode 100644 crates/bitwarden-core/uniffi.toml delete mode 100644 crates/bitwarden-crypto/Cargo.toml delete mode 100644 crates/bitwarden-crypto/README.md delete mode 100644 crates/bitwarden-crypto/benches/default_allocator.rs delete mode 100644 crates/bitwarden-crypto/benches/zeroizing_allocator.rs delete mode 100644 crates/bitwarden-crypto/src/aes.rs delete mode 100644 crates/bitwarden-crypto/src/allocator.rs delete mode 100644 crates/bitwarden-crypto/src/enc_string/asymmetric.rs delete mode 100644 crates/bitwarden-crypto/src/enc_string/mod.rs delete mode 100644 crates/bitwarden-crypto/src/enc_string/symmetric.rs delete mode 100644 crates/bitwarden-crypto/src/error.rs delete mode 100644 crates/bitwarden-crypto/src/fingerprint.rs delete mode 100644 crates/bitwarden-crypto/src/keys/asymmetric_crypto_key.rs delete mode 100644 crates/bitwarden-crypto/src/keys/device_key.rs delete mode 100644 crates/bitwarden-crypto/src/keys/key_encryptable.rs delete mode 100644 crates/bitwarden-crypto/src/keys/master_key.rs delete mode 100644 crates/bitwarden-crypto/src/keys/mod.rs delete mode 100644 crates/bitwarden-crypto/src/keys/pin_key.rs delete mode 100644 crates/bitwarden-crypto/src/keys/shareable_key.rs delete mode 100644 crates/bitwarden-crypto/src/keys/symmetric_crypto_key.rs delete mode 100644 crates/bitwarden-crypto/src/keys/user_key.rs delete mode 100644 crates/bitwarden-crypto/src/keys/utils.rs delete mode 100644 crates/bitwarden-crypto/src/lib.rs delete mode 100644 crates/bitwarden-crypto/src/rsa.rs delete mode 100644 crates/bitwarden-crypto/src/uniffi_support.rs delete mode 100644 crates/bitwarden-crypto/src/util.rs delete mode 100644 crates/bitwarden-crypto/src/wordlist.rs delete mode 100644 crates/bitwarden-crypto/uniffi.toml delete mode 100644 crates/bitwarden-exporters/Cargo.toml delete mode 100644 crates/bitwarden-exporters/README.md delete mode 100644 crates/bitwarden-exporters/resources/json_export.json delete mode 100644 crates/bitwarden-exporters/src/client_exporter.rs delete mode 100644 crates/bitwarden-exporters/src/csv.rs delete mode 100644 crates/bitwarden-exporters/src/encrypted_json.rs delete mode 100644 crates/bitwarden-exporters/src/error.rs delete mode 100644 crates/bitwarden-exporters/src/export.rs delete mode 100644 crates/bitwarden-exporters/src/json.rs delete mode 100644 crates/bitwarden-exporters/src/lib.rs delete mode 100644 crates/bitwarden-exporters/src/models.rs delete mode 100644 crates/bitwarden-exporters/uniffi.toml delete mode 100644 crates/bitwarden-fido/Cargo.toml delete mode 100644 crates/bitwarden-fido/README.md delete mode 100644 crates/bitwarden-fido/src/authenticator.rs delete mode 100644 crates/bitwarden-fido/src/client.rs delete mode 100644 crates/bitwarden-fido/src/client_fido.rs delete mode 100644 crates/bitwarden-fido/src/crypto.rs delete mode 100644 crates/bitwarden-fido/src/lib.rs delete mode 100644 crates/bitwarden-fido/src/traits.rs delete mode 100644 crates/bitwarden-fido/src/types.rs delete mode 100644 crates/bitwarden-fido/src/uniffi_support.rs delete mode 100644 crates/bitwarden-fido/uniffi.toml delete mode 100644 crates/bitwarden-generators/Cargo.toml delete mode 100644 crates/bitwarden-generators/README.md delete mode 100644 crates/bitwarden-generators/src/client_generator.rs delete mode 100644 crates/bitwarden-generators/src/lib.rs delete mode 100644 crates/bitwarden-generators/src/passphrase.rs delete mode 100644 crates/bitwarden-generators/src/password.rs delete mode 100644 crates/bitwarden-generators/src/username.rs delete mode 100644 crates/bitwarden-generators/src/username_forwarders/addyio.rs delete mode 100644 crates/bitwarden-generators/src/username_forwarders/duckduckgo.rs delete mode 100644 crates/bitwarden-generators/src/username_forwarders/fastmail.rs delete mode 100644 crates/bitwarden-generators/src/username_forwarders/firefox.rs delete mode 100644 crates/bitwarden-generators/src/username_forwarders/forwardemail.rs delete mode 100644 crates/bitwarden-generators/src/username_forwarders/mod.rs delete mode 100644 crates/bitwarden-generators/src/username_forwarders/simplelogin.rs delete mode 100644 crates/bitwarden-generators/src/util.rs delete mode 100644 crates/bitwarden-generators/uniffi.toml delete mode 100644 crates/bitwarden-send/Cargo.toml delete mode 100644 crates/bitwarden-send/README.md delete mode 100644 crates/bitwarden-send/src/client_sends.rs delete mode 100644 crates/bitwarden-send/src/error.rs delete mode 100644 crates/bitwarden-send/src/lib.rs delete mode 100644 crates/bitwarden-send/src/send.rs delete mode 100644 crates/bitwarden-send/src/uniffi_support.rs delete mode 100644 crates/bitwarden-send/uniffi.toml delete mode 100644 crates/bitwarden-sm/Cargo.toml delete mode 100644 crates/bitwarden-sm/src/client_projects.rs delete mode 100644 crates/bitwarden-sm/src/client_secrets.rs delete mode 100644 crates/bitwarden-sm/src/lib.rs delete mode 100644 crates/bitwarden-sm/src/projects/create.rs delete mode 100644 crates/bitwarden-sm/src/projects/delete.rs delete mode 100644 crates/bitwarden-sm/src/projects/get.rs delete mode 100644 crates/bitwarden-sm/src/projects/list.rs delete mode 100644 crates/bitwarden-sm/src/projects/mod.rs delete mode 100644 crates/bitwarden-sm/src/projects/project_response.rs delete mode 100644 crates/bitwarden-sm/src/projects/update.rs delete mode 100644 crates/bitwarden-sm/src/secrets/create.rs delete mode 100644 crates/bitwarden-sm/src/secrets/delete.rs delete mode 100644 crates/bitwarden-sm/src/secrets/get.rs delete mode 100644 crates/bitwarden-sm/src/secrets/get_by_ids.rs delete mode 100644 crates/bitwarden-sm/src/secrets/list.rs delete mode 100644 crates/bitwarden-sm/src/secrets/mod.rs delete mode 100644 crates/bitwarden-sm/src/secrets/secret_response.rs delete mode 100644 crates/bitwarden-sm/src/secrets/sync.rs delete mode 100644 crates/bitwarden-sm/src/secrets/update.rs delete mode 100644 crates/bitwarden-uniffi/Cargo.toml delete mode 100644 crates/bitwarden-uniffi/README.md delete mode 100644 crates/bitwarden-uniffi/src/android_support.rs delete mode 100644 crates/bitwarden-uniffi/src/auth/mod.rs delete mode 100644 crates/bitwarden-uniffi/src/crypto.rs delete mode 100644 crates/bitwarden-uniffi/src/error.rs delete mode 100644 crates/bitwarden-uniffi/src/lib.rs delete mode 100644 crates/bitwarden-uniffi/src/platform/fido2.rs delete mode 100644 crates/bitwarden-uniffi/src/platform/mod.rs delete mode 100644 crates/bitwarden-uniffi/src/tool/mod.rs delete mode 100644 crates/bitwarden-uniffi/src/tool/sends.rs delete mode 100644 crates/bitwarden-uniffi/src/uniffi_support.rs delete mode 100644 crates/bitwarden-uniffi/src/vault/attachments.rs delete mode 100644 crates/bitwarden-uniffi/src/vault/ciphers.rs delete mode 100644 crates/bitwarden-uniffi/src/vault/collections.rs delete mode 100644 crates/bitwarden-uniffi/src/vault/folders.rs delete mode 100644 crates/bitwarden-uniffi/src/vault/mod.rs delete mode 100644 crates/bitwarden-uniffi/src/vault/password_history.rs delete mode 100644 crates/bitwarden-uniffi/uniffi.toml delete mode 100644 crates/bitwarden-vault/Cargo.toml delete mode 100644 crates/bitwarden-vault/README.md delete mode 100644 crates/bitwarden-vault/src/cipher/attachment.rs delete mode 100644 crates/bitwarden-vault/src/cipher/card.rs delete mode 100644 crates/bitwarden-vault/src/cipher/cipher.rs delete mode 100644 crates/bitwarden-vault/src/cipher/field.rs delete mode 100644 crates/bitwarden-vault/src/cipher/identity.rs delete mode 100644 crates/bitwarden-vault/src/cipher/linked_id.rs delete mode 100644 crates/bitwarden-vault/src/cipher/local_data.rs delete mode 100644 crates/bitwarden-vault/src/cipher/login.rs delete mode 100644 crates/bitwarden-vault/src/cipher/mod.rs delete mode 100644 crates/bitwarden-vault/src/cipher/secure_note.rs delete mode 100644 crates/bitwarden-vault/src/client_totp.rs delete mode 100644 crates/bitwarden-vault/src/client_vault.rs delete mode 100644 crates/bitwarden-vault/src/collection.rs delete mode 100644 crates/bitwarden-vault/src/domain.rs delete mode 100644 crates/bitwarden-vault/src/error.rs delete mode 100644 crates/bitwarden-vault/src/folder.rs delete mode 100644 crates/bitwarden-vault/src/lib.rs delete mode 100644 crates/bitwarden-vault/src/mobile/client_attachments.rs delete mode 100644 crates/bitwarden-vault/src/mobile/client_ciphers.rs delete mode 100644 crates/bitwarden-vault/src/mobile/client_collection.rs delete mode 100644 crates/bitwarden-vault/src/mobile/client_folders.rs delete mode 100644 crates/bitwarden-vault/src/mobile/client_password_history.rs delete mode 100644 crates/bitwarden-vault/src/mobile/mod.rs delete mode 100644 crates/bitwarden-vault/src/password_history.rs delete mode 100644 crates/bitwarden-vault/src/sync.rs delete mode 100644 crates/bitwarden-vault/src/totp.rs delete mode 100644 crates/bitwarden-vault/src/uniffi_support.rs delete mode 100644 crates/bitwarden-vault/uniffi.toml delete mode 100644 crates/bitwarden-wasm-internal/Cargo.toml delete mode 100644 crates/bitwarden-wasm-internal/README.md delete mode 100755 crates/bitwarden-wasm-internal/build.sh delete mode 100644 crates/bitwarden-wasm-internal/src/client.rs delete mode 100644 crates/bitwarden-wasm-internal/src/crypto.rs delete mode 100644 crates/bitwarden-wasm-internal/src/custom_types.rs delete mode 100644 crates/bitwarden-wasm-internal/src/error.rs delete mode 100644 crates/bitwarden-wasm-internal/src/lib.rs delete mode 100644 crates/bitwarden-wasm-internal/src/vault/folders.rs delete mode 100644 crates/bitwarden-wasm-internal/src/vault/mod.rs delete mode 100644 crates/bw/Cargo.toml delete mode 100644 crates/bw/README.md delete mode 100644 crates/bw/src/auth/login.rs delete mode 100644 crates/bw/src/auth/mod.rs delete mode 100644 crates/bw/src/main.rs delete mode 100644 crates/bw/src/render.rs delete mode 100644 crates/memory-testing/.gitignore delete mode 100644 crates/memory-testing/Cargo.toml delete mode 100644 crates/memory-testing/Dockerfile delete mode 100644 crates/memory-testing/Dockerfile.dockerignore delete mode 100644 crates/memory-testing/cases.json delete mode 100755 crates/memory-testing/run_test.sh delete mode 100644 crates/memory-testing/src/bin/analyze-dumps.rs delete mode 100644 crates/memory-testing/src/bin/capture-dumps.rs delete mode 100644 crates/memory-testing/src/lib.rs delete mode 100644 crates/memory-testing/src/main.rs delete mode 100644 crates/uniffi-bindgen/Cargo.toml delete mode 100644 crates/uniffi-bindgen/uniffi-bindgen.rs delete mode 100644 languages/js/sdk-internal/.gitignore delete mode 100644 languages/js/sdk-internal/LICENSE delete mode 100644 languages/js/sdk-internal/README.md delete mode 100644 languages/js/sdk-internal/index.js delete mode 100644 languages/js/sdk-internal/package.json delete mode 100644 languages/kotlin/.gitignore delete mode 100644 languages/kotlin/README.md delete mode 100644 languages/kotlin/app/.gitignore delete mode 100644 languages/kotlin/app/build.gradle delete mode 100644 languages/kotlin/app/proguard-rules.pro delete mode 100644 languages/kotlin/app/src/main/AndroidManifest.xml delete mode 100644 languages/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt delete mode 100644 languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt delete mode 100644 languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt delete mode 100644 languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt delete mode 100644 languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt delete mode 100644 languages/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml delete mode 100644 languages/kotlin/app/src/main/res/drawable/ic_launcher_background.xml delete mode 100644 languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml delete mode 100644 languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml delete mode 100644 languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp delete mode 100644 languages/kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp delete mode 100644 languages/kotlin/app/src/main/res/values/colors.xml delete mode 100644 languages/kotlin/app/src/main/res/values/strings.xml delete mode 100644 languages/kotlin/app/src/main/res/values/themes.xml delete mode 100644 languages/kotlin/app/src/main/res/xml/backup_rules.xml delete mode 100644 languages/kotlin/app/src/main/res/xml/data_extraction_rules.xml delete mode 100644 languages/kotlin/app/src/main/res/xml/network_security_config.xml delete mode 100755 languages/kotlin/build-schemas.sh delete mode 100644 languages/kotlin/build.gradle delete mode 100644 languages/kotlin/gradle.properties delete mode 100644 languages/kotlin/gradle/wrapper/gradle-wrapper.jar delete mode 100644 languages/kotlin/gradle/wrapper/gradle-wrapper.properties delete mode 100755 languages/kotlin/gradlew delete mode 100644 languages/kotlin/gradlew.bat delete mode 100755 languages/kotlin/publish-local.sh delete mode 100644 languages/kotlin/sdk/.gitignore delete mode 100644 languages/kotlin/sdk/build.gradle delete mode 100644 languages/kotlin/sdk/consumer-rules.pro delete mode 100644 languages/kotlin/sdk/lint-baseline.xml delete mode 100644 languages/kotlin/sdk/proguard-rules.pro delete mode 100644 languages/kotlin/sdk/src/main/AndroidManifest.xml delete mode 100644 languages/kotlin/sdk/src/main/jniLibs/.gitignore delete mode 100644 languages/kotlin/sdk/src/test/java/com/bitwarden/sdk/ExampleUnitTest.kt delete mode 100644 languages/kotlin/settings.gradle delete mode 100644 languages/swift/Package.swift delete mode 100644 languages/swift/README.md delete mode 100644 languages/swift/Sources/BitwardenSdk/.gitignore delete mode 100644 languages/swift/Tests/BitwardenSdkTests/BitwardenSdkTests.swift delete mode 100755 languages/swift/build.sh delete mode 100644 languages/swift/iOS/App.xcodeproj/project.pbxproj delete mode 100644 languages/swift/iOS/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 languages/swift/iOS/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 languages/swift/iOS/App/Assets.xcassets/AccentColor.colorset/Contents.json delete mode 100644 languages/swift/iOS/App/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 languages/swift/iOS/App/Assets.xcassets/Contents.json delete mode 100644 languages/swift/iOS/App/Biometrics.swift delete mode 100644 languages/swift/iOS/App/ContentView.swift delete mode 100644 languages/swift/iOS/App/Preview Content/Preview Assets.xcassets/Contents.json delete mode 100644 languages/swift/iOS/App/testApp.swift delete mode 100644 languages/swift/iOS/swift-format.json delete mode 100644 openapitools.json delete mode 100755 support/build-api.sh delete mode 100644 support/openapi-template/.travis.yml delete mode 100644 support/openapi-template/Cargo.mustache delete mode 100644 support/openapi-template/README.mustache delete mode 100644 support/openapi-template/api_doc.mustache delete mode 100755 support/openapi-template/git_push.sh.mustache delete mode 100644 support/openapi-template/gitignore.mustache delete mode 100644 support/openapi-template/hyper/api.mustache delete mode 100644 support/openapi-template/hyper/api_mod.mustache delete mode 100644 support/openapi-template/hyper/client.mustache delete mode 100644 support/openapi-template/hyper/configuration.mustache delete mode 100644 support/openapi-template/lib.mustache delete mode 100644 support/openapi-template/model.mustache delete mode 100644 support/openapi-template/model_doc.mustache delete mode 100644 support/openapi-template/model_mod.mustache delete mode 100644 support/openapi-template/partial_header.mustache delete mode 100644 support/openapi-template/request.rs delete mode 100644 support/openapi-template/reqwest/api.mustache delete mode 100644 support/openapi-template/reqwest/api_mod.mustache delete mode 100644 support/openapi-template/reqwest/configuration.mustache diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2698af85c..5f2666b53 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -29,19 +29,14 @@ .github/workflows/release-ruby.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev ## Multiple owners -.github/workflows/build-android.yml .github/workflows/build-rust-crates.yml .github/workflows/build-rust-cross-platform.yml -.github/workflows/build-swift.yml .github/workflows/build-wasm-internal.yml .github/workflows/build-wasm.yml .github/workflows/release-rust-crates.yml -.github/workflows/release-swift.yml .github/workflows/release-wasm.yml .github/workflows/version-bump.yml - - # Secrets Manager team crates/bitwarden-sm @bitwarden/team-secrets-manager-dev crates/bws @bitwarden/team-secrets-manager-dev diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml deleted file mode 100644 index e49fc0d6b..000000000 --- a/.github/workflows/build-android.yml +++ /dev/null @@ -1,111 +0,0 @@ ---- -name: Build Android - -on: - pull_request: - push: - branches: - - "main" - workflow_dispatch: - -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - settings: - - target: aarch64-linux-android - - target: armv7-linux-androideabi - - target: x86_64-linux-android - - target: i686-linux-android - steps: - - name: Checkout repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - with: - key: ${{ matrix.settings.target }}-cargo - - - name: Install Cross - run: cargo install cross --locked --git https://github.com/cross-rs/cross.git --rev 185398b1b885820515a212de720a306b08e2c8c9 - - - name: Build - env: - TARGET: ${{ matrix.settings.target }} - run: cross build -p bitwarden-uniffi --release --target=${{ matrix.settings.target }} - - - name: Upload artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: android-${{ matrix.settings.target }} - path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.so - if-no-files-found: error - - combine: - runs-on: ubuntu-22.04 - needs: build - steps: - - name: Checkout repo (PR) - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - if: github.event_name == 'pull_request' - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - - - name: Checkout repo (Push) - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - if: github.event_name == 'push' - with: - fetch-depth: 0 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - with: - key: cargo-combine-cache - - - name: Setup Java - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 - with: - distribution: temurin - java-version: 17 - - - name: Download Artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - - - name: Move artifacts - working-directory: languages/kotlin/sdk/src/main/jniLibs - run: | - mkdir armeabi-v7a arm64-v8a x86 x86_64 - mv /home/runner/work/sdk/sdk/android-armv7-linux-androideabi/libbitwarden_uniffi.so ./armeabi-v7a/libbitwarden_uniffi.so - mv /home/runner/work/sdk/sdk/android-aarch64-linux-android/libbitwarden_uniffi.so ./arm64-v8a/libbitwarden_uniffi.so - mv /home/runner/work/sdk/sdk/android-i686-linux-android/libbitwarden_uniffi.so ./x86/libbitwarden_uniffi.so - mv /home/runner/work/sdk/sdk/android-x86_64-linux-android/libbitwarden_uniffi.so ./x86_64/libbitwarden_uniffi.so - - - name: Generate bindings - working-directory: languages/kotlin - run: ./build-schemas.sh - - - name: Setup gradle - uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 - - - name: Publish - run: ./gradlew sdk:publish - working-directory: languages/kotlin - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index 115be589f..dbc5ba745 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -27,10 +27,6 @@ jobs: package: - bitwarden - - bitwarden-api-api - - bitwarden-api-identity - - bitwarden-crypto - - bitwarden-generators steps: - name: Checkout @@ -70,4 +66,4 @@ jobs: run: cargo install cargo-release - name: Cargo release dry run - run: cargo-release release publish --no-publish -p bitwarden-api-api -p bitwarden-api-identity -p bitwarden + run: cargo-release release publish --no-publish -p bitwarden diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml deleted file mode 100644 index 94b730e86..000000000 --- a/.github/workflows/build-swift.yml +++ /dev/null @@ -1,115 +0,0 @@ ---- -name: Build Swift Package - -on: - push: - branches: - - "rc" - - "hotfix-rc" - - "main" - workflow_dispatch: - -jobs: - version: - name: Get Version - runs-on: ubuntu-22.04 - outputs: - package_version: ${{ steps.retrieve-version.outputs.package_version }} - steps: - - name: Checkout repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Get Package Version - id: retrieve-version - run: | - VERSION=$(grep -o '^version = ".*"' Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") - echo "package_version=$VERSION" >> $GITHUB_OUTPUT - - build: - name: Build - runs-on: macos-13 - needs: version - env: - _VERSION: ${{ needs.version.outputs.package_version }} - steps: - - name: Checkout repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - with: - key: sdk-swift-cargo - - - name: Rustup target - run: | - rustup target install aarch64-apple-ios-sim - rustup target install aarch64-apple-ios - rustup target install x86_64-apple-ios - - - name: Build - shell: bash - working-directory: languages/swift - id: build - run: | - ./build.sh - - # SHA Short - echo "short-sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Zip BitwardenFFI.xcframework - run: | - mkdir artifacts - cp -rf languages/swift/BitwardenFFI.xcframework artifacts - - - name: Upload BitwardenFFI.xcframework artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: BitwardenFFI-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}.xcframework - path: artifacts - if-no-files-found: error - - - name: Upload BitwardenSdk sources - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: BitwardenSdk-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}-sources - path: languages/swift/Sources/BitwardenSdk - if-no-files-found: error - - trigger-swift-release: - name: Trigger Swift release - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-22.04 - needs: build - steps: - - name: Login to Azure - CI Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve github PAT secrets - id: retrieve-secret-pat - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Trigger Swift release - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - github-token: ${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'bitwarden', - repo: 'sdk', - workflow_id: 'release-swift.yml', - ref: 'main', - inputs: { - 'build-run-id': '${{ github.run_id }}', - 'pre-release': 'true' - } - }) diff --git a/.github/workflows/build-wasm-internal.yml b/.github/workflows/build-wasm-internal.yml deleted file mode 100644 index 6e0e28b98..000000000 --- a/.github/workflows/build-wasm-internal.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -name: Build @bitwarden/sdk-internal - -on: - pull_request: - push: - branches: - - "main" - - "rc" - - "hotfix-rc" - workflow_dispatch: - -defaults: - run: - shell: bash - working-directory: crates/bitwarden-wasm-internal - -jobs: - build: - name: Building @bitwarden/sdk-wasm-internal - runs-on: ubuntu-22.04 - - steps: - - name: Checkout repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version: 20 - registry-url: "https://npm.pkg.github.com" - cache: "npm" - - - name: Install dependencies - run: npm i -g binaryen - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: wasm32-unknown-unknown - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - with: - key: wasm-cargo-cache - - - name: Install wasm-bindgen-cli - run: cargo install wasm-bindgen-cli --version 0.2.95 - - - name: Build - run: ./build.sh -r - - - name: Upload artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: sdk-internal - path: ${{ github.workspace }}/languages/js/sdk-internal/* - if-no-files-found: error diff --git a/.github/workflows/delete-old-packages.yml b/.github/workflows/delete-old-packages.yml deleted file mode 100644 index b3be807a6..000000000 --- a/.github/workflows/delete-old-packages.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Delete old packages - -on: - schedule: - - cron: "0 0 * * *" - workflow_dispatch: - -defaults: - run: - shell: bash - -jobs: - delete: - name: Cleanup Android SDK - runs-on: ubuntu-22.04 - steps: - - uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0 - with: - package-name: com.bitwarden.sdk-android - package-type: maven - min-versions-to-keep: 25 - - # Ignore versions only containing version numbers - ignore-versions: '^\d*\.\d*\.\d*(-SNAPSHOT)?$' diff --git a/.github/workflows/memory-testing.yml b/.github/workflows/memory-testing.yml deleted file mode 100644 index 527121baf..000000000 --- a/.github/workflows/memory-testing.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -name: Test for memory leaks - -on: - pull_request: - paths: - - "crates/bitwarden-crypto/**" - - "crates/memory-testing/**" - push: - paths: - - "crates/bitwarden-crypto/**" - - "crates/memory-testing/**" - branches: - - "main" - - "rc" - - "hotfix-rc" - -jobs: - memory-test: - name: Testing - runs-on: ubuntu-22.04 - - steps: - - name: Check out repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Set up gdb - run: | - sudo apt update - sudo apt -y install gdb - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - with: - key: memtest-cargo - - - name: Test - run: ./crates/memory-testing/run_test.sh no-docker diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml deleted file mode 100644 index 62ffc9e45..000000000 --- a/.github/workflows/publish-internal.yml +++ /dev/null @@ -1,94 +0,0 @@ ---- -name: Publish @bitwarden/sdk-internal -run-name: Publish @bitwarden/sdk-internal ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Release Version" - required: true - -defaults: - run: - working-directory: languages/js/sdk-internal - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - steps: - - name: Checkout repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - npm: - name: Publish NPM - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version: 20 - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "npm-api-key" - - - name: Download artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-wasm-internal.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: sdk-internal - path: languages/js/sdk-internal - - - name: Set version - run: | - npm version --no-git-tag-version ${{ inputs.version }} - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup NPM - run: | - echo 'registry="https://registry.npmjs.org/"' > ./.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc - - echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - env: - NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} - - - name: Publish NPM - if: ${{ inputs.release_type != 'Dry Run' }} - run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index 156aedb0c..a517833ac 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -106,7 +106,7 @@ jobs: env: PUBLISH_GRACE_SLEEP: 10 CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }} - run: cargo-release release publish --exclude bw --exclude bws --execute --no-confirm + run: cargo-release release publish --exclude bws --execute --no-confirm - name: Update deployment status to Success if: ${{ inputs.release_type != 'Dry Run' && success() }} diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml deleted file mode 100644 index 38f247cce..000000000 --- a/.github/workflows/release-swift.yml +++ /dev/null @@ -1,263 +0,0 @@ ---- -name: Release Swift Package - -on: - workflow_call: - inputs: - build-run-id: - description: "Workflow Run ID to use for artifact download. If not provided the latest build from the selected branch will be used." - type: string - required: false - pre-release: - description: "Create a pre-release" - type: boolean - required: false - default: false - - workflow_dispatch: - inputs: - build-run-id: - description: "Workflow Run ID to use for artifact download. If not provided the latest build from the selected branch will be used." - type: string - required: false - pre-release: - description: "Create a pre-release" - type: boolean - required: false - default: false - -env: - _KEY_VAULT: "bitwarden-ci" - -jobs: - validate: - name: Set Version and SHA - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - sha: ${{ steps.set-sha.outputs.sha }} - short_sha: ${{ steps.set-sha.outputs.short_sha }} - release_name: ${{ steps.set-release-name.outputs.release_name }} - run_id: ${{ steps.get-run-id.outputs.build-run-id }} - swift_checksum: ${{ steps.calculate-swift-checksum.outputs.checksum }} - steps: - - name: Checkout repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Get version - id: version - run: | - VERSION=$(grep -o '^version = ".*"' Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Get run id - id: get-run-id - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - OWNER: ${{ github.repository_owner }} - REPO: ${{ github.event.repository.name }} - run: | - if [ -z ${{ inputs.build-run-id }} ]; then - BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} - RUN_ID=$(gh api \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/$OWNER/$REPO/actions/workflows/build-swift.yml/runs \ - | jq -r "[.workflow_runs[] | select(.head_branch == \"$BRANCH\").id ] | first") - else - RUN_ID=${{ inputs.build-run-id }} - fi - - echo "build-run-id=$RUN_ID" >> $GITHUB_OUTPUT - - - name: Download BitwardenEFI artifact - uses: bitwarden/gh-actions/download-artifacts@main - id: download-artifact - with: - workflow: build-swift.yml - workflow_conclusion: success - skip_unpack: true - run_id: ${{ steps.get-run-id.outputs.build-run-id }} - - - name: Set SHA - id: set-sha - run: | - echo "sha=${{ steps.download-artifact.outputs.artifact-build-commit }}" >> $GITHUB_OUTPUT - echo "short_sha=$(echo ${{ steps.download-artifact.outputs.artifact-build-commit }} | cut -c1-7)" >> $GITHUB_OUTPUT - - - name: Set release name - id: set-release-name - run: | - if [[ ${{ inputs.pre-release }} == true ]]; then - echo "release_name=${{ steps.version.outputs.version }}-unstable-${{ steps.set-sha.outputs.short_sha }}" >> $GITHUB_OUTPUT - else - echo "release_name=${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT - fi - - - name: Calculate swift file checksum - id: calculate-swift-checksum - run: | - CHECKSUM=$(swift package compute-checksum BitwardenFFI-${{ steps.version.outputs.version }}-${{ steps.set-sha.outputs.short_sha }}.xcframework.zip) - echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT - - repo-sync: - name: Push changed files to SDK Swift repo - runs-on: ubuntu-22.04 - needs: validate - env: - _BOT_EMAIL: 106330231+bitwarden-devops-bot@users.noreply.github.com - _BOT_NAME: bitwarden-devops-bot - _PKG_VERSION: ${{ needs.validate.outputs.version }} - _PRE_RELEASE: ${{ inputs.pre-release }} - _RELEASE_NAME: ${{ needs.validate.outputs.release_name }} - _SWIFT_CHECKSUM: ${{ needs.validate.outputs.swift_checksum }} - _BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }} - steps: - - name: Checkout SDK repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - with: - path: sdk - - - name: Get ref from SDK repo - id: get-ref - run: | - if [[ $_PRE_RELEASE == true ]]; then - echo "ref=unstable" >> $GITHUB_OUTPUT - else - echo "ref=main" >> $GITHUB_OUTPUT - fi - - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "github-gpg-private-key, - github-gpg-private-key-passphrase, - github-pat-bitwarden-devops-bot-repo-scope" - - - name: Checkout SDK-Swift repo - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - with: - repository: bitwarden/sdk-swift - path: sdk-swift - ref: ${{ steps.get-ref.outputs.ref }} - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0 - with: - gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }} - passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }} - git_user_signingkey: true - git_commit_gpgsign: true - workdir: sdk-swift - - - name: Setup Git - working-directory: sdk-swift - run: | - git config --local user.email "${{ env._BOT_EMAIL }}" - git config --local user.name "${{ env._BOT_NAME }}" - - - name: Download BitwardenSdk sources artifact - uses: bitwarden/gh-actions/download-artifacts@main - id: download-artifact - with: - workflow: build-swift.yml - workflow_conclusion: success - artifacts: "BitwardenSdk-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}-sources" - run_id: ${{ env._BUILD_RUN_ID }} - path: sdk/languages/swift/Sources/BitwardenSdk - - - name: Install Swift formatter - run: | - git clone https://github.com/nicklockwood/SwiftFormat - cd SwiftFormat - swift build -c release - cp -f .build/release/swiftformat /usr/local/bin/swiftformat - - - name: Update files - run: | - # Update BitwardenFFI path - sed -i 's|.binaryTarget(name: "BitwardenFFI", path: "BitwardenFFI.xcframework")|.binaryTarget(\ - name: "BitwardenFFI",\ - url: "https://github.com/bitwarden/sdk-swift/releases/download/v${{ env._RELEASE_NAME }}/BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip",\ - checksum: "${{ env._SWIFT_CHECKSUM }}" )|' sdk/languages/swift/Package.swift - - # Run swiftformat - swiftformat sdk/languages/swift/Package.swift - - find sdk/languages/swift/Sources/ -name ".gitignore" -exec rm -f {} \; - - rm -rf sdk-swift/Sources - rm -rf sdk-swift/Tests - - # Copy files to local sdk-swift repo path - cp --verbose -rf sdk/languages/swift/README.md sdk-swift/README.md - cp --verbose -rf sdk/languages/swift/Package.swift sdk-swift/Package.swift - cp --verbose -rf sdk/languages/swift/Sources sdk-swift - cp --verbose -rf sdk/languages/swift/Tests sdk-swift - - - name: Push changes - working-directory: sdk-swift - run: | - git add . - git commit -m "Update Swift SDK to ${{ needs.validate.outputs.sha }}" - git push origin ${{ steps.get-ref.outputs.ref }} - - - name: Create release tag on SDK Swift repo - working-directory: sdk-swift - run: | - git tag v${{ env._RELEASE_NAME }} - git push origin v${{ env._RELEASE_NAME }} - - github-release: - name: GitHub Release - runs-on: ubuntu-22.04 - needs: - - validate - - repo-sync - env: - _PKG_VERSION: ${{ needs.validate.outputs.version }} - _RELEASE_NAME: ${{ needs.validate.outputs.release_name }} - _BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }} - steps: - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Download BitwardenEFI artifact - uses: bitwarden/gh-actions/download-artifacts@main - id: download-artifact - with: - workflow: build-swift.yml - workflow_conclusion: success - artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework" - run_id: ${{ env._BUILD_RUN_ID }} - skip_unpack: true - - - name: Create release - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - with: - tag: v${{ env._RELEASE_NAME }} - name: v${{ env._RELEASE_NAME }} - body: "" - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - draft: false - repo: sdk-swift - owner: bitwarden - artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip" - prerelease: ${{ inputs.pre-release }} diff --git a/.gitignore b/.gitignore index 4a1d79fca..2840e5f92 100644 --- a/.gitignore +++ b/.gitignore @@ -44,13 +44,6 @@ crates/bitwarden-napi/sdk-napi.*.node crates/bitwarden-napi/dist languages/js/sdk-client/dist/ -# Uniffi -languages/swift/BitwardenFFI.xcframework -languages/swift/tmp -languages/swift/.build -languages/swift/.swiftpm -languages/kotlin/sdk/src/main/java/com/bitwarden/**/*.kt - # Schemas crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts languages/cpp/include/schemas.hpp diff --git a/.prettierignore b/.prettierignore index 16243942f..59c5da5ab 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,13 +1,5 @@ target languages/* -!languages/js -languages/js/* -!languages/js/sdk-internal -languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js schemas /crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts about.hbs -support/docs/template.hbs - -# Test fixtures -crates/bitwarden-exporters/resources/* diff --git a/.vscode/launch.json b/.vscode/launch.json index 7da474a22..6b32d31f8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -39,20 +39,6 @@ }, "args": [], "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "bw login", - "cargo": { - "args": ["build", "--package=bw"], - "filter": { - "name": "bw", - "kind": "bin" - } - }, - "args": ["login", "api-key", "--server", "https://localhost:8080"], - "cwd": "${workspaceFolder}" } ] } diff --git a/Cargo.lock b/Cargo.lock index e9b7646b2..682c4fc01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,23 +50,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" -[[package]] -name = "android_log-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ecc8056bf6ab9892dcd53216c83d1597487d7dacac16c8df6b877d127df9937" - -[[package]] -name = "android_logger" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b07e8e73d720a1f2e4b6014766e6039fd2e96a4fa44e2a78d0e1fa2ff49826" -dependencies = [ - "android_log-sys", - "env_filter", - "log", -] - [[package]] name = "android_system_properties" version = "0.1.5" @@ -76,12 +59,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anes" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" - [[package]] name = "ansi_colours" version = "1.2.3" @@ -165,81 +142,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "askama" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" -dependencies = [ - "askama_derive", - "askama_escape", -] - -[[package]] -name = "askama_derive" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" -dependencies = [ - "askama_parser", - "basic-toml", - "mime", - "mime_guess", - "proc-macro2", - "quote", - "serde", - "syn 2.0.79", -] - -[[package]] -name = "askama_escape" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" - -[[package]] -name = "askama_parser" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" -dependencies = [ - "nom", -] - -[[package]] -name = "assert-json-diff" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "async-compat" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bab94bde396a3f7b4962e396fdad640e241ed797d4d8d77fc8c237d14c58fc0" -dependencies = [ - "futures-core", - "futures-io", - "once_cell", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "async-trait" -version = "0.1.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -267,12 +169,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - [[package]] name = "base64" version = "0.22.1" @@ -285,15 +181,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "basic-toml" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" -dependencies = [ - "serde", -] - [[package]] name = "bat" version = "0.24.0" @@ -372,6 +259,8 @@ dependencies = [ [[package]] name = "bitwarden-api-api" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25eda77c61669987d7791e9a7a501359cc9589153297078aaa0a8b34681168b5" dependencies = [ "reqwest", "serde", @@ -385,6 +274,8 @@ dependencies = [ [[package]] name = "bitwarden-api-identity" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4370980eb58bb134cd2e1b475a69c37dc9a80a9e5ded097f4a46279cb1f96688" dependencies = [ "reqwest", "serde", @@ -407,6 +298,8 @@ dependencies = [ [[package]] name = "bitwarden-cli" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cf7e8de5faa94efeecb211ea275d3d62b2b3b59fd5a45ffc44e72234ada869" dependencies = [ "clap", "color-eyre", @@ -417,6 +310,8 @@ dependencies = [ [[package]] name = "bitwarden-core" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8122c157df8978e00c96b4f6d681238cff14c9994de699b56b517f1d540cbf6" dependencies = [ "base64", "bitwarden-api-api", @@ -427,7 +322,6 @@ dependencies = [ "hmac", "log", "rand", - "rand_chacha", "reqwest", "rustls-platform-verifier", "schemars", @@ -438,13 +332,8 @@ dependencies = [ "sha1", "sha2", "thiserror", - "tokio", - "tsify-next", - "uniffi", "uuid", "validator", - "wasm-bindgen", - "wiremock", "zeroize", "zxcvbn", ] @@ -452,12 +341,13 @@ dependencies = [ [[package]] name = "bitwarden-crypto" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b22580253052563027690cb85504e970abeaafa3ad3f2a20071b80744f4f5000" dependencies = [ "aes", "argon2", "base64", "cbc", - "criterion", "generic-array", "hkdf", "hmac", @@ -465,82 +355,32 @@ dependencies = [ "num-traits", "pbkdf2", "rand", - "rand_chacha", "rayon", "rsa", "schemars", "serde", - "serde_json", "sha1", "sha2", "subtle", "thiserror", - "tsify-next", - "uniffi", "uuid", - "wasm-bindgen", "zeroize", ] -[[package]] -name = "bitwarden-exporters" -version = "1.0.0" -dependencies = [ - "base64", - "bitwarden-core", - "bitwarden-crypto", - "bitwarden-vault", - "chrono", - "csv", - "schemars", - "serde", - "serde_json", - "thiserror", - "uniffi", - "uuid", -] - -[[package]] -name = "bitwarden-fido" -version = "1.0.0" -dependencies = [ - "async-trait", - "base64", - "bitwarden-core", - "bitwarden-crypto", - "bitwarden-vault", - "chrono", - "coset", - "itertools 0.13.0", - "log", - "p256", - "passkey", - "passkey-client", - "reqwest", - "schemars", - "serde", - "serde_json", - "thiserror", - "uniffi", - "uuid", -] - [[package]] name = "bitwarden-generators" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f08fa4dd39fbd8e5ffc6e94b766dba38e6907fd28e9837934d722a74763f5a8f" dependencies = [ "bitwarden-core", "bitwarden-crypto", "rand", - "rand_chacha", "reqwest", "schemars", "serde", "serde_json", "thiserror", - "tokio", - "uniffi", - "wiremock", ] [[package]] @@ -577,27 +417,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "bitwarden-send" -version = "1.0.0" -dependencies = [ - "base64", - "bitwarden-api-api", - "bitwarden-core", - "bitwarden-crypto", - "chrono", - "schemars", - "serde", - "serde_repr", - "thiserror", - "uniffi", - "uuid", - "zeroize", -] - [[package]] name = "bitwarden-sm" version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2addad9f568a541ce8621bc23c8b0bc88884243677c03b8819da62164bfe5e4b" dependencies = [ "bitwarden-api-api", "bitwarden-core", @@ -607,63 +431,10 @@ dependencies = [ "serde", "serde_json", "thiserror", - "tokio", "uuid", "validator", ] -[[package]] -name = "bitwarden-uniffi" -version = "0.1.0" -dependencies = [ - "android_logger", - "async-trait", - "bitwarden-core", - "bitwarden-crypto", - "bitwarden-exporters", - "bitwarden-fido", - "bitwarden-generators", - "bitwarden-send", - "bitwarden-vault", - "chrono", - "env_logger", - "jni", - "libloading", - "log", - "oslog", - "rustls-platform-verifier", - "schemars", - "thiserror", - "uniffi", - "uuid", -] - -[[package]] -name = "bitwarden-vault" -version = "1.0.0" -dependencies = [ - "base64", - "bitwarden-api-api", - "bitwarden-core", - "bitwarden-crypto", - "chrono", - "hmac", - "rand", - "reqwest", - "schemars", - "serde", - "serde_json", - "serde_repr", - "sha1", - "sha2", - "thiserror", - "tokio", - "tsify-next", - "uniffi", - "uuid", - "wasm-bindgen", -] - [[package]] name = "bitwarden-wasm" version = "0.1.0" @@ -681,22 +452,6 @@ dependencies = [ "wasm-bindgen-test", ] -[[package]] -name = "bitwarden-wasm-internal" -version = "0.1.0" -dependencies = [ - "bitwarden-core", - "bitwarden-crypto", - "bitwarden-vault", - "console_error_panic_hook", - "console_log", - "js-sys", - "log", - "serde_json", - "wasm-bindgen", - "wasm-bindgen-futures", -] - [[package]] name = "blake2" version = "0.10.6" @@ -740,24 +495,6 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" -[[package]] -name = "bw" -version = "0.0.2" -dependencies = [ - "bitwarden-cli", - "bitwarden-core", - "bitwarden-crypto", - "bitwarden-generators", - "bitwarden-vault", - "clap", - "color-eyre", - "env_logger", - "inquire", - "log", - "tempfile", - "tokio", -] - [[package]] name = "bws" version = "1.0.0" @@ -773,7 +510,7 @@ dependencies = [ "comfy-table", "directories", "env_logger", - "itertools 0.13.0", + "itertools", "log", "regex", "serde", @@ -783,7 +520,7 @@ dependencies = [ "tempfile", "thiserror", "tokio", - "toml 0.8.19", + "toml", "uuid", "which", ] @@ -812,44 +549,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "cast" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" - [[package]] name = "cbc" version = "0.1.2" @@ -895,33 +594,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "ciborium" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" -dependencies = [ - "ciborium-io", - "ciborium-ll", - "serde", -] - -[[package]] -name = "ciborium-io" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" - -[[package]] -name = "ciborium-ll" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" -dependencies = [ - "ciborium-io", - "half", -] - [[package]] name = "cipher" version = "0.4.4" @@ -970,7 +642,7 @@ version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.79", @@ -1054,8 +726,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" dependencies = [ "crossterm 0.27.0", - "strum 0.26.3", - "strum_macros 0.26.4", + "strum", + "strum_macros", "unicode-width", ] @@ -1133,16 +805,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "coset" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8cc80f631f8307b887faca24dcc3abc427cd0367f6eb6188f6e8f5b7ad8fb" -dependencies = [ - "ciborium", - "ciborium-io", -] - [[package]] name = "cpufeatures" version = "0.2.14" @@ -1161,42 +823,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "criterion" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" -dependencies = [ - "anes", - "cast", - "ciborium", - "clap", - "criterion-plot", - "is-terminal", - "itertools 0.10.5", - "num-traits", - "once_cell", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", -] - -[[package]] -name = "criterion-plot" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" -dependencies = [ - "cast", - "itertools 0.10.5", -] - [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1255,27 +881,9 @@ dependencies = [ name = "crossterm_winapi" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", + "winapi", ] [[package]] @@ -1288,27 +896,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "csv" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" -dependencies = [ - "memchr", -] - [[package]] name = "ctor" version = "0.2.8" @@ -1354,43 +941,6 @@ dependencies = [ "syn 2.0.79", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "deadpool" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" -dependencies = [ - "async-trait", - "deadpool-runtime", - "num_cpus", - "tokio", -] - -[[package]] -name = "deadpool-runtime" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" - [[package]] name = "der" version = "0.7.9" @@ -1482,49 +1032,12 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - [[package]] name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "base64ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "pem-rfc7468", - "pkcs8", - "rand_core", - "sec1", - "serde_json", - "serdect", - "subtle", - "zeroize", -] - [[package]] name = "encode_unicode" version = "0.3.6" @@ -1606,16 +1119,6 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core", - "subtle", -] - [[package]] name = "flate2" version = "1.0.34" @@ -1641,30 +1144,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fs-err" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" -dependencies = [ - "autocfg", -] - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.31" @@ -1672,7 +1151,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -1681,34 +1159,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", -] - [[package]] name = "futures-sink" version = "0.3.31" @@ -1727,16 +1177,10 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ - "futures-channel", "futures-core", - "futures-io", - "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", - "slab", ] [[package]] @@ -1787,12 +1231,6 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "globset" version = "0.4.15" @@ -1806,28 +1244,6 @@ dependencies = [ "regex-syntax", ] -[[package]] -name = "goblin" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" -dependencies = [ - "log", - "plain", - "scroll", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - [[package]] name = "h2" version = "0.4.6" @@ -1847,40 +1263,18 @@ dependencies = [ "tracing", ] -[[package]] -name = "half" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if", - "crunchy", -] - [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - [[package]] name = "hashbrown" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1893,12 +1287,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - [[package]] name = "hex" version = "0.4.3" @@ -1972,12 +1360,6 @@ version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "humantime" version = "2.1.0" @@ -1997,7 +1379,6 @@ dependencies = [ "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -2147,17 +1528,6 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" -[[package]] -name = "is-terminal" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" -dependencies = [ - "hermit-abi 0.4.0", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "is_ci" version = "1.2.0" @@ -2170,15 +1540,6 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -2301,18 +1662,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memory-testing" -version = "0.1.0" -dependencies = [ - "bitwarden-crypto", - "comfy-table", - "hex", - "serde", - "serde_json", - "zeroize", -] - [[package]] name = "mime" version = "0.3.17" @@ -2339,12 +1688,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.7.4" @@ -2381,7 +1724,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ - "hermit-abi 0.3.9", + "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -2454,16 +1797,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "nu-ansi-term" version = "0.49.0" @@ -2536,16 +1869,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - [[package]] name = "object" version = "0.32.2" @@ -2583,12 +1906,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "oorandom" -version = "11.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" - [[package]] name = "openssl-probe" version = "0.1.5" @@ -2601,35 +1918,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" -[[package]] -name = "oslog" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d2043d1f61d77cb2f4b1f7b7b2295f40507f5f8e9d1c8bf10a1ca5f97a3969" -dependencies = [ - "cc", - "dashmap", - "log", -] - [[package]] name = "owo-colors" version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - [[package]] name = "parking_lot" version = "0.12.3" @@ -2648,73 +1942,9 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "passkey" -version = "0.2.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" -dependencies = [ - "passkey-authenticator", - "passkey-client", - "passkey-transports", - "passkey-types", -] - -[[package]] -name = "passkey-authenticator" -version = "0.2.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" -dependencies = [ - "async-trait", - "coset", - "log", - "p256", - "passkey-types", - "rand", -] - -[[package]] -name = "passkey-client" -version = "0.2.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" -dependencies = [ - "ciborium", - "coset", - "idna", - "nom", - "passkey-authenticator", - "passkey-types", - "public-suffix", - "serde", - "serde_json", - "url", -] - -[[package]] -name = "passkey-transports" -version = "0.1.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" - -[[package]] -name = "passkey-types" -version = "0.2.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" -dependencies = [ - "bitflags 2.6.0", - "ciborium", - "coset", - "data-encoding", - "getrandom", - "indexmap 2.6.0", - "rand", - "serde", - "serde_json", - "sha2", - "strum 0.25.0", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", ] [[package]] @@ -2728,12 +1958,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "path_abs" version = "0.5.1" @@ -2806,12 +2030,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - [[package]] name = "plist" version = "1.7.0" @@ -2825,34 +2043,6 @@ dependencies = [ "time", ] -[[package]] -name = "plotters" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" - -[[package]] -name = "plotters-svg" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" -dependencies = [ - "plotters-backend", -] - [[package]] name = "portable-atomic" version = "1.9.0" @@ -2874,15 +2064,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -2916,11 +2097,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "public-suffix" -version = "0.1.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" - [[package]] name = "pyo3" version = "0.22.4" @@ -2988,7 +2164,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a09b550200e1e5ed9176976d0060cbc2ea82dc8515da07885e7b8153a85caacb" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "pyo3-build-config", "quote", @@ -3203,16 +2379,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - [[package]] name = "rgb" version = "0.8.50" @@ -3437,26 +2603,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "scroll" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6" -dependencies = [ - "scroll_derive", -] - -[[package]] -name = "scroll_derive" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", -] - [[package]] name = "sdk-schemas" version = "0.1.0" @@ -3464,27 +2610,11 @@ dependencies = [ "anyhow", "bitwarden", "bitwarden-json", - "bitwarden-uniffi", - "itertools 0.13.0", + "itertools", "schemars", "serde_json", ] -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "serdect", - "subtle", - "zeroize", -] - [[package]] name = "security-framework" version = "2.11.1" @@ -3514,9 +2644,6 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] [[package]] name = "serde" @@ -3527,17 +2654,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-wasm-bindgen" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - [[package]] name = "serde_derive" version = "1.0.210" @@ -3566,7 +2682,6 @@ version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ - "indexmap 2.6.0", "itoa", "memchr", "ryu", @@ -3659,16 +2774,6 @@ dependencies = [ "unsafe-libyaml", ] -[[package]] -name = "serdect" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" -dependencies = [ - "base16ct", - "serde", -] - [[package]] name = "sha1" version = "0.10.6" @@ -3746,12 +2851,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - [[package]] name = "slab" version = "0.4.9" @@ -3767,12 +2866,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "smawk" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" - [[package]] name = "socket2" version = "0.5.7" @@ -3799,12 +2892,6 @@ dependencies = [ "der", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "std_prelude" version = "0.2.12" @@ -3817,41 +2904,19 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -dependencies = [ - "strum_macros 0.25.3", -] - [[package]] name = "strum" version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -[[package]] -name = "strum_macros" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.79", -] - [[package]] name = "strum_macros" version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", @@ -3942,15 +3007,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" -dependencies = [ - "smawk", -] - [[package]] name = "thiserror" version = "1.0.64" @@ -4012,16 +3068,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "tinyvec" version = "1.8.0" @@ -4088,15 +3134,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.8.19" @@ -4184,30 +3221,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tsify-next" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4a645dca4ee0800f5ab60ce166deba2db6a0315de795a2691e138a3d55d756" -dependencies = [ - "serde", - "serde-wasm-bindgen", - "tsify-next-macros", - "wasm-bindgen", -] - -[[package]] -name = "tsify-next-macros" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d5c06f8a51d759bb58129e30b2631739e7e1e4579fad1f30ac09a6c88e488a6" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 2.0.79", -] - [[package]] name = "typenum" version = "1.17.0" @@ -4256,145 +3269,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" -[[package]] -name = "uniffi" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db87def739fe4183947f8419d572d1849a4a09355eba4e988a2105cfd0ac6a7" -dependencies = [ - "anyhow", - "camino", - "cargo_metadata", - "clap", - "uniffi_bindgen", - "uniffi_build", - "uniffi_core", - "uniffi_macros", -] - -[[package]] -name = "uniffi-bindgen" -version = "0.1.0" -dependencies = [ - "uniffi", -] - -[[package]] -name = "uniffi_bindgen" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a112599c9556d1581e4a3d72019a74c2c3e122cc27f4af12577a429c4d5e614" -dependencies = [ - "anyhow", - "askama", - "camino", - "cargo_metadata", - "fs-err", - "glob", - "goblin", - "heck 0.5.0", - "once_cell", - "paste", - "serde", - "textwrap", - "toml 0.5.11", - "uniffi_meta", - "uniffi_udl", -] - -[[package]] -name = "uniffi_build" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b12684401d2a8508ca9c72a95bbc45906417e42fc80942abaf033bbf01aa33" -dependencies = [ - "anyhow", - "camino", - "uniffi_bindgen", -] - -[[package]] -name = "uniffi_checksum_derive" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c801f0f05b06df456a2da4c41b9c2c4fdccc6b9916643c6c67275c4c9e4d07" -dependencies = [ - "quote", - "syn 2.0.79", -] - -[[package]] -name = "uniffi_core" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c35aaad30e3a9e6d4fe34e358d64dbc92ee09045b48591b05fc9f12e0905b" -dependencies = [ - "anyhow", - "async-compat", - "bytes", - "camino", - "log", - "once_cell", - "paste", - "static_assertions", -] - -[[package]] -name = "uniffi_macros" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db66474c5c61b0f7afc3b4995fecf9b72b340daa5ca0ef3da7778d75eb5482ea" -dependencies = [ - "bincode", - "camino", - "fs-err", - "once_cell", - "proc-macro2", - "quote", - "serde", - "syn 2.0.79", - "toml 0.5.11", - "uniffi_meta", -] - -[[package]] -name = "uniffi_meta" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d898893f102e0e39b8bcb7e3d2188f4156ba280db32db9e8af1f122d057e9526" -dependencies = [ - "anyhow", - "bytes", - "siphasher", - "uniffi_checksum_derive", -] - -[[package]] -name = "uniffi_testing" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6aa4f0cf9d12172d84fc00a35a6c1f3522b526daad05ae739f709f6941b9b6" -dependencies = [ - "anyhow", - "camino", - "cargo_metadata", - "fs-err", - "once_cell", -] - -[[package]] -name = "uniffi_udl" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b044e9c519e0bb51e516ab6f6d8f4f4dcf900ce30d5ad07c03f924e2824f28e" -dependencies = [ - "anyhow", - "textwrap", - "uniffi_meta", - "uniffi_testing", - "weedle2", -] - [[package]] name = "unindent" version = "0.2.3" @@ -4621,15 +3495,6 @@ dependencies = [ "rustls-pki-types", ] -[[package]] -name = "weedle2" -version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" -dependencies = [ - "nom", -] - [[package]] name = "which" version = "6.0.3" @@ -4875,30 +3740,6 @@ version = "0.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" -[[package]] -name = "wiremock" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fff469918e7ca034884c7fd8f93fe27bacb7fcb599fd879df6c7b429a29b646" -dependencies = [ - "assert-json-diff", - "async-trait", - "base64", - "deadpool", - "futures", - "http", - "http-body-util", - "hyper", - "hyper-util", - "log", - "once_cell", - "regex", - "serde", - "serde_json", - "tokio", - "url", -] - [[package]] name = "zerocopy" version = "0.7.35" @@ -4926,7 +3767,6 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ - "serde", "zeroize_derive", ] @@ -4950,7 +3790,7 @@ dependencies = [ "chrono", "derive_builder", "fancy-regex", - "itertools 0.13.0", + "itertools", "lazy_static", "regex", "time", diff --git a/Cargo.toml b/Cargo.toml index ce01a7b7e..b17e20d2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,45 +18,15 @@ keywords = ["bitwarden"] # Define dependencies that are expected to be consistent across all crates [workspace.dependencies] bitwarden = { path = "crates/bitwarden", version = "=1.0.0" } -bitwarden-api-api = { path = "crates/bitwarden-api-api", version = "=1.0.0" } -bitwarden-api-identity = { path = "crates/bitwarden-api-identity", version = "=1.0.0" } -bitwarden-cli = { path = "crates/bitwarden-cli", version = "=1.0.0" } -bitwarden-core = { path = "crates/bitwarden-core", version = "=1.0.0" } -bitwarden-crypto = { path = "crates/bitwarden-crypto", version = "=1.0.0" } -bitwarden-exporters = { path = "crates/bitwarden-exporters", version = "=1.0.0" } -bitwarden-fido = { path = "crates/bitwarden-fido", version = "=1.0.0" } -bitwarden-generators = { path = "crates/bitwarden-generators", version = "=1.0.0" } -bitwarden-send = { path = "crates/bitwarden-send", version = "=1.0.0" } -bitwarden-sm = { path = "crates/bitwarden-sm", version = "=1.0.0" } -bitwarden-vault = { path = "crates/bitwarden-vault", version = "=1.0.0" } +bitwarden-cli = { version = "=1.0.0" } +bitwarden-core = { version = "=1.0.0" } +bitwarden-crypto = { version = "=1.0.0" } +bitwarden-generators = { version = "=1.0.0" } +bitwarden-sm = { version = "=1.0.0" } -# External crates that are expected to maintain a consistent version across all crates -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", - "std", -], default-features = false } log = "0.4.20" -reqwest = { version = ">=0.12.5, <0.13", features = [ - "json", - "multipart", - "http2", -], default-features = false } schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" -serde_qs = ">=0.12.0, <0.14" -serde_repr = ">=0.1.12, <0.2" -thiserror = ">=1.0.40, <2.0" tokio = { version = "1.36.0", features = ["macros"] } -tsify-next = { version = ">=0.5.4, <0.6", features = [ - "js", -], default-features = false } -uniffi = "=0.28.1" -uuid = { version = ">=1.3.3, <2.0", features = ["serde", "v4"] } -validator = { version = "0.18.1", features = ["derive"] } -wasm-bindgen = { version = ">=0.2.91, <0.3", features = ["serde-serialize"] } -wasm-bindgen-futures = "0.4.41" [workspace.lints.clippy] unused_async = "deny" diff --git a/README.md b/README.md index 14ca1f667..5ce748ca0 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,7 @@ -# Bitwarden SDK +# Bitwarden Secrets Manager SDK -This repository houses the Bitwarden SDKs. We currently provide a public Secrets Manager SDK and an -internal SDK for the Bitwarden Password Manager which is used for the native mobile applications. -The SDK is written in Rust and provides a Rust API, CLI and various language bindings. - -### Disclaimer - -The password manager SDK is not intended for public use and is not supported by Bitwarden at this -stage. It is solely intended to centralize the business logic and to provide a single source of -truth for the internal applications. As the SDK evolves into a more stable and feature complete -state we will re-evaluate the possibility of publishing stable bindings for the public. **The -password manager interface is unstable and will change without warning.** +This repository houses the Bitwarden Secret Manager SDK. The SDK is written in Rust and provides a +Rust API, CLI and various language bindings. # We're Hiring! @@ -41,12 +32,8 @@ Please refer to our [Contributing Docs](https://contributing.bitwarden.com/) for [getting started](https://contributing.bitwarden.com/getting-started/sdk/) instructions and [architectural documentation](https://contributing.bitwarden.com/architecture/sdk/). -You can also browse the latest published documentation: - -- [docs.rs](https://docs.rs/bitwarden/latest/bitwarden/) for the public SDK. -- Or for developers of the SDK, view the internal - [API documentation](https://sdk-api-docs.bitwarden.com/bitwarden/index.html) which includes - private items. +You can also browse the latest published documentation on +[docs.rs](https://docs.rs/bitwarden/latest/bitwarden/). ## Crates @@ -54,10 +41,6 @@ The project is structured as a monorepo using cargo workspaces. Some of the more are: - [`bitwarden`](./crates/bitwarden/): Rust friendly API for interacting with the secrets manager. -- [`bitwarden-api-api`](./crates/bitwarden-api-api/): Auto-generated API bindings for the API - server. -- [`bitwarden-api-identity`](./crates/bitwarden-api-identity/): Auto-generated API bindings for the - Identity server. - [`bitwarden-c`](./crates/bitwarden-c/): C bindings for FFI interop. - [`bitwarden-json`](./crates/bitwarden-json/): JSON wrapper around the `bitwarden` crate. Powers the other language bindings. @@ -80,39 +63,6 @@ the API bindings for each language using [QuickType](https://github.com/quicktyp npm run schemas ``` -## API Bindings - -We autogenerate the server bindings using -[openapi-generator](https://github.com/OpenAPITools/openapi-generator). To do this we first need to -build the internal swagger documentation. - -### Swagger generation - -The first step is to generate the swagger documents from the server repository. - -```bash -# src/Api -dotnet swagger tofile --output ../../api.json ./bin/Debug/net8.0/Api.dll internal - -# src/Identity -ASPNETCORE_ENVIRONMENT=development dotnet swagger tofile --output ../../identity.json ./bin/Debug/net8.0/Identity.dll v1 -``` - -### OpenApi Generator - -To generate a new version of the bindings run the following script from the root of the SDK project. - -```bash -./support/build-api.sh -``` - -This project uses customized templates which lives in the `support/openapi-templates` directory. -These templates resolves some outstanding issues we've experienced with the rust generator. But we -strive towards modifying the templates as little as possible to ease future upgrades. - -Note: If you don't have the nightly toolchain installed, the `build-api.sh` script will install it -for you. - ## Developer tools This project recommends the use of certain developer tools, and also includes configurations for @@ -132,9 +82,6 @@ The list of developer tools is: `cargo install cargo-nextest --locked`. It can be manually run using `cargo nextest run --all-features` -[secrets-manager]: https://bitwarden.com/products/secrets-manager/ -[bws-help]: https://bitwarden.com/help/secrets-manager-cli/ - ## Cargo fmt We use certain unstable features for formatting which require the nightly version of cargo-fmt. @@ -167,3 +114,6 @@ No grant of any rights in the trademarks, service marks, or logos of Bitwarden i may be necessary to comply with the notice requirements as applicable), and use of any Bitwarden trademarks must comply with [Bitwarden Trademark Guidelines](https://github.com/bitwarden/server/blob/main/TRADEMARK_GUIDELINES.md). + +[secrets-manager]: https://bitwarden.com/products/secrets-manager/ +[bws-help]: https://bitwarden.com/help/secrets-manager-cli/ diff --git a/crates/bitwarden-api-api/.gitignore b/crates/bitwarden-api-api/.gitignore deleted file mode 100644 index 6aa106405..000000000 --- a/crates/bitwarden-api-api/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/target/ -**/*.rs.bk -Cargo.lock diff --git a/crates/bitwarden-api-api/.openapi-generator-ignore b/crates/bitwarden-api-api/.openapi-generator-ignore deleted file mode 100644 index 0a3fec13f..000000000 --- a/crates/bitwarden-api-api/.openapi-generator-ignore +++ /dev/null @@ -1,27 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md - -docs/*.md -.travis.yml -git_push.sh diff --git a/crates/bitwarden-api-api/.openapi-generator/FILES b/crates/bitwarden-api-api/.openapi-generator/FILES deleted file mode 100644 index 7ff73f0b3..000000000 --- a/crates/bitwarden-api-api/.openapi-generator/FILES +++ /dev/null @@ -1,451 +0,0 @@ -.gitignore -Cargo.toml -README.md -src/apis/access_policies_api.rs -src/apis/accounts_api.rs -src/apis/accounts_billing_api.rs -src/apis/auth_requests_api.rs -src/apis/ciphers_api.rs -src/apis/collections_api.rs -src/apis/config_api.rs -src/apis/configuration.rs -src/apis/counts_api.rs -src/apis/devices_api.rs -src/apis/emergency_access_api.rs -src/apis/events_api.rs -src/apis/folders_api.rs -src/apis/groups_api.rs -src/apis/hibp_api.rs -src/apis/import_ciphers_api.rs -src/apis/info_api.rs -src/apis/installations_api.rs -src/apis/licenses_api.rs -src/apis/misc_api.rs -src/apis/mod.rs -src/apis/organization_auth_requests_api.rs -src/apis/organization_billing_api.rs -src/apis/organization_connections_api.rs -src/apis/organization_domain_api.rs -src/apis/organization_export_api.rs -src/apis/organization_sponsorships_api.rs -src/apis/organization_users_api.rs -src/apis/organizations_api.rs -src/apis/plans_api.rs -src/apis/policies_api.rs -src/apis/projects_api.rs -src/apis/provider_billing_api.rs -src/apis/provider_clients_api.rs -src/apis/provider_organizations_api.rs -src/apis/provider_users_api.rs -src/apis/providers_api.rs -src/apis/push_api.rs -src/apis/request_sm_access_api.rs -src/apis/secrets_api.rs -src/apis/secrets_manager_events_api.rs -src/apis/secrets_manager_porting_api.rs -src/apis/self_hosted_organization_licenses_api.rs -src/apis/self_hosted_organization_sponsorships_api.rs -src/apis/sends_api.rs -src/apis/service_accounts_api.rs -src/apis/settings_api.rs -src/apis/stripe_api.rs -src/apis/sync_api.rs -src/apis/trash_api.rs -src/apis/two_factor_api.rs -src/apis/users_api.rs -src/apis/web_authn_api.rs -src/lib.rs -src/models/access_policy_request.rs -src/models/access_token_create_request_model.rs -src/models/access_token_creation_response_model.rs -src/models/access_token_response_model.rs -src/models/access_token_response_model_list_response_model.rs -src/models/admin_auth_request_update_request_model.rs -src/models/algorithm.rs -src/models/api_key_response_model.rs -src/models/assertion_options.rs -src/models/assertion_response.rs -src/models/attachment_request_model.rs -src/models/attachment_response_model.rs -src/models/attachment_upload_data_response_model.rs -src/models/attestation_conveyance_preference.rs -src/models/auth_request_create_request_model.rs -src/models/auth_request_response_model.rs -src/models/auth_request_response_model_list_response_model.rs -src/models/auth_request_type.rs -src/models/auth_request_update_request_model.rs -src/models/authentication_extensions_client_inputs.rs -src/models/authentication_extensions_client_outputs.rs -src/models/authenticator_assertion_raw_response.rs -src/models/authenticator_attachment.rs -src/models/authenticator_attestation_raw_response.rs -src/models/authenticator_selection.rs -src/models/authenticator_transport.rs -src/models/base_secret_response_model.rs -src/models/base_secret_response_model_list_response_model.rs -src/models/billing_customer_discount.rs -src/models/billing_history_response_model.rs -src/models/billing_invoice.rs -src/models/billing_payment_response_model.rs -src/models/billing_source.rs -src/models/billing_subscription.rs -src/models/billing_subscription_item.rs -src/models/billing_subscription_upcoming_invoice.rs -src/models/billing_transaction.rs -src/models/bit_pay_invoice_request_model.rs -src/models/bulk_collection_access_request_model.rs -src/models/bulk_delete_response_model.rs -src/models/bulk_delete_response_model_list_response_model.rs -src/models/bulk_deny_admin_auth_request_request_model.rs -src/models/cipher_attachment_model.rs -src/models/cipher_bulk_delete_request_model.rs -src/models/cipher_bulk_move_request_model.rs -src/models/cipher_bulk_restore_request_model.rs -src/models/cipher_bulk_share_request_model.rs -src/models/cipher_bulk_update_collections_request_model.rs -src/models/cipher_card_model.rs -src/models/cipher_collections_request_model.rs -src/models/cipher_create_request_model.rs -src/models/cipher_details_response_model.rs -src/models/cipher_details_response_model_list_response_model.rs -src/models/cipher_fido2_credential_model.rs -src/models/cipher_field_model.rs -src/models/cipher_identity_model.rs -src/models/cipher_login_model.rs -src/models/cipher_login_uri_model.rs -src/models/cipher_mini_details_response_model.rs -src/models/cipher_mini_details_response_model_list_response_model.rs -src/models/cipher_mini_response_model.rs -src/models/cipher_mini_response_model_list_response_model.rs -src/models/cipher_partial_request_model.rs -src/models/cipher_password_history_model.rs -src/models/cipher_reprompt_type.rs -src/models/cipher_request_model.rs -src/models/cipher_response_model.rs -src/models/cipher_secure_note_model.rs -src/models/cipher_share_request_model.rs -src/models/cipher_type.rs -src/models/cipher_with_id_request_model.rs -src/models/collection_access_details_response_model.rs -src/models/collection_access_details_response_model_list_response_model.rs -src/models/collection_bulk_delete_request_model.rs -src/models/collection_details_response_model.rs -src/models/collection_details_response_model_list_response_model.rs -src/models/collection_request_model.rs -src/models/collection_response_model.rs -src/models/collection_response_model_list_response_model.rs -src/models/collection_with_id_request_model.rs -src/models/config_response_model.rs -src/models/create_client_organization_request_body.rs -src/models/credential_create_options.rs -src/models/delete_recover_request_model.rs -src/models/device_keys_request_model.rs -src/models/device_keys_update_request_model.rs -src/models/device_request_model.rs -src/models/device_response_model.rs -src/models/device_response_model_list_response_model.rs -src/models/device_token_request_model.rs -src/models/device_type.rs -src/models/device_verification_request_model.rs -src/models/device_verification_response_model.rs -src/models/domains_response_model.rs -src/models/email_request_model.rs -src/models/email_token_request_model.rs -src/models/emergency_access_grantee_details_response_model.rs -src/models/emergency_access_grantee_details_response_model_list_response_model.rs -src/models/emergency_access_grantor_details_response_model.rs -src/models/emergency_access_grantor_details_response_model_list_response_model.rs -src/models/emergency_access_invite_request_model.rs -src/models/emergency_access_password_request_model.rs -src/models/emergency_access_status_type.rs -src/models/emergency_access_takeover_response_model.rs -src/models/emergency_access_type.rs -src/models/emergency_access_update_request_model.rs -src/models/emergency_access_view_response_model.rs -src/models/emergency_access_with_id_request_model.rs -src/models/environment_config_response_model.rs -src/models/event_response_model.rs -src/models/event_response_model_list_response_model.rs -src/models/event_system_user.rs -src/models/event_type.rs -src/models/expanded_tax_info_update_request_model.rs -src/models/fido2_user.rs -src/models/field_type.rs -src/models/file_upload_type.rs -src/models/folder_request_model.rs -src/models/folder_response_model.rs -src/models/folder_response_model_list_response_model.rs -src/models/folder_with_id_request_model.rs -src/models/get_secrets_request_model.rs -src/models/global_domains.rs -src/models/global_equivalent_domains_type.rs -src/models/granted_access_policy_request.rs -src/models/granted_project_access_policy_permission_details_response_model.rs -src/models/granted_project_access_policy_response_model.rs -src/models/group.rs -src/models/group_access_policy_response_model.rs -src/models/group_bulk_request_model.rs -src/models/group_details_response_model.rs -src/models/group_details_response_model_list_response_model.rs -src/models/group_request_model.rs -src/models/group_response_model.rs -src/models/import_ciphers_request_model.rs -src/models/import_organization_ciphers_request_model.rs -src/models/import_organization_users_request_model.rs -src/models/inner_project_export_response_model.rs -src/models/inner_project_import_request_model.rs -src/models/inner_secret_export_response_model.rs -src/models/inner_secret_import_request_model.rs -src/models/installation_request_model.rs -src/models/installation_response_model.rs -src/models/int32_int32_key_value_pair.rs -src/models/kdf_request_model.rs -src/models/kdf_type.rs -src/models/key_model.rs -src/models/key_pair_request_body.rs -src/models/keys_request_model.rs -src/models/keys_response_model.rs -src/models/license_type.rs -src/models/master_password_policy_response_model.rs -src/models/member_decryption_type.rs -src/models/mod.rs -src/models/open_id_connect_redirect_behavior.rs -src/models/optional_cipher_details_response_model.rs -src/models/organization_api_key_information.rs -src/models/organization_api_key_information_list_response_model.rs -src/models/organization_api_key_request_model.rs -src/models/organization_api_key_type.rs -src/models/organization_auth_request_update_many_request_model.rs -src/models/organization_auto_enroll_status_response_model.rs -src/models/organization_billing_status_response_model.rs -src/models/organization_collection_management_update_request_model.rs -src/models/organization_connection_request_model.rs -src/models/organization_connection_response_model.rs -src/models/organization_connection_type.rs -src/models/organization_counts_response_model.rs -src/models/organization_create_request_model.rs -src/models/organization_domain_request_model.rs -src/models/organization_domain_response_model.rs -src/models/organization_domain_response_model_list_response_model.rs -src/models/organization_domain_sso_details_request_model.rs -src/models/organization_domain_sso_details_response_model.rs -src/models/organization_keys_request_model.rs -src/models/organization_keys_response_model.rs -src/models/organization_license.rs -src/models/organization_public_key_response_model.rs -src/models/organization_response_model.rs -src/models/organization_seat_request_model.rs -src/models/organization_sponsorship_create_request_model.rs -src/models/organization_sponsorship_redeem_request_model.rs -src/models/organization_sponsorship_request_model.rs -src/models/organization_sponsorship_response_model.rs -src/models/organization_sponsorship_sync_request_model.rs -src/models/organization_sponsorship_sync_response_model.rs -src/models/organization_sso_request_model.rs -src/models/organization_sso_response_model.rs -src/models/organization_subscription_response_model.rs -src/models/organization_subscription_update_request_model.rs -src/models/organization_update_request_model.rs -src/models/organization_upgrade_request_model.rs -src/models/organization_user_accept_init_request_model.rs -src/models/organization_user_accept_request_model.rs -src/models/organization_user_bulk_confirm_request_model.rs -src/models/organization_user_bulk_confirm_request_model_entry.rs -src/models/organization_user_bulk_request_model.rs -src/models/organization_user_bulk_response_model.rs -src/models/organization_user_bulk_response_model_list_response_model.rs -src/models/organization_user_confirm_request_model.rs -src/models/organization_user_details_response_model.rs -src/models/organization_user_invite_request_model.rs -src/models/organization_user_public_key_response_model.rs -src/models/organization_user_public_key_response_model_list_response_model.rs -src/models/organization_user_reset_password_details_response_model.rs -src/models/organization_user_reset_password_details_response_model_list_response_model.rs -src/models/organization_user_reset_password_enrollment_request_model.rs -src/models/organization_user_reset_password_request_model.rs -src/models/organization_user_status_type.rs -src/models/organization_user_type.rs -src/models/organization_user_update_request_model.rs -src/models/organization_user_user_details_response_model.rs -src/models/organization_user_user_details_response_model_list_response_model.rs -src/models/organization_verify_bank_request_model.rs -src/models/organization_verify_delete_recover_request_model.rs -src/models/other_device_keys_update_request_model.rs -src/models/password_hint_request_model.rs -src/models/password_manager_plan_features_response_model.rs -src/models/password_request_model.rs -src/models/payment_method_type.rs -src/models/payment_request_model.rs -src/models/payment_response_model.rs -src/models/pending_organization_auth_request_response_model.rs -src/models/pending_organization_auth_request_response_model_list_response_model.rs -src/models/people_access_policies_request_model.rs -src/models/permissions.rs -src/models/plan_response_model.rs -src/models/plan_response_model_list_response_model.rs -src/models/plan_sponsorship_type.rs -src/models/plan_type.rs -src/models/policy_request_model.rs -src/models/policy_response_model.rs -src/models/policy_response_model_list_response_model.rs -src/models/policy_type.rs -src/models/potential_grantee_response_model.rs -src/models/potential_grantee_response_model_list_response_model.rs -src/models/product_tier_type.rs -src/models/profile_organization_response_model.rs -src/models/profile_organization_response_model_list_response_model.rs -src/models/profile_provider_organization_response_model.rs -src/models/profile_provider_response_model.rs -src/models/profile_response_model.rs -src/models/project_counts_response_model.rs -src/models/project_create_request_model.rs -src/models/project_people_access_policies_response_model.rs -src/models/project_response_model.rs -src/models/project_response_model_list_response_model.rs -src/models/project_service_accounts_access_policies_request_model.rs -src/models/project_service_accounts_access_policies_response_model.rs -src/models/project_update_request_model.rs -src/models/protected_device_response_model.rs -src/models/provider_organization_add_request_model.rs -src/models/provider_organization_create_request_model.rs -src/models/provider_organization_organization_details_response_model.rs -src/models/provider_organization_organization_details_response_model_list_response_model.rs -src/models/provider_organization_response_model.rs -src/models/provider_response_model.rs -src/models/provider_setup_request_model.rs -src/models/provider_status_type.rs -src/models/provider_type.rs -src/models/provider_update_request_model.rs -src/models/provider_user_accept_request_model.rs -src/models/provider_user_bulk_confirm_request_model.rs -src/models/provider_user_bulk_confirm_request_model_entry.rs -src/models/provider_user_bulk_request_model.rs -src/models/provider_user_bulk_response_model.rs -src/models/provider_user_bulk_response_model_list_response_model.rs -src/models/provider_user_confirm_request_model.rs -src/models/provider_user_invite_request_model.rs -src/models/provider_user_public_key_response_model.rs -src/models/provider_user_public_key_response_model_list_response_model.rs -src/models/provider_user_response_model.rs -src/models/provider_user_status_type.rs -src/models/provider_user_type.rs -src/models/provider_user_update_request_model.rs -src/models/provider_user_user_details_response_model.rs -src/models/provider_user_user_details_response_model_list_response_model.rs -src/models/provider_verify_delete_recover_request_model.rs -src/models/pub_key_cred_param.rs -src/models/public_key_credential_descriptor.rs -src/models/public_key_credential_rp_entity.rs -src/models/public_key_credential_type.rs -src/models/push_device_request_model.rs -src/models/push_registration_request_model.rs -src/models/push_send_request_model.rs -src/models/push_type.rs -src/models/push_update_request_model.rs -src/models/request_sm_access_request_model.rs -src/models/reset_password_with_org_id_request_model.rs -src/models/response_data.rs -src/models/revoke_access_tokens_request.rs -src/models/saml2_binding_type.rs -src/models/saml2_name_id_format.rs -src/models/saml2_signing_behavior.rs -src/models/secret_access_policies_requests_model.rs -src/models/secret_access_policies_response_model.rs -src/models/secret_create_request_model.rs -src/models/secret_response_inner_project.rs -src/models/secret_response_model.rs -src/models/secret_update_request_model.rs -src/models/secret_verification_request_model.rs -src/models/secret_with_projects_inner_project.rs -src/models/secret_with_projects_list_response_model.rs -src/models/secrets_manager_plan_features_response_model.rs -src/models/secrets_manager_subscribe_request_model.rs -src/models/secrets_manager_subscription_update_request_model.rs -src/models/secrets_sync_response_model.rs -src/models/secrets_with_projects_inner_secret.rs -src/models/secure_note_type.rs -src/models/selection_read_only_request_model.rs -src/models/selection_read_only_response_model.rs -src/models/self_hosted_organization_license_request_model.rs -src/models/send_access_request_model.rs -src/models/send_file_model.rs -src/models/send_file_upload_data_response_model.rs -src/models/send_request_model.rs -src/models/send_response_model.rs -src/models/send_response_model_list_response_model.rs -src/models/send_text_model.rs -src/models/send_type.rs -src/models/send_with_id_request_model.rs -src/models/server_config_response_model.rs -src/models/service_account_access_policy_response_model.rs -src/models/service_account_counts_response_model.rs -src/models/service_account_create_request_model.rs -src/models/service_account_granted_policies_permission_details_response_model.rs -src/models/service_account_granted_policies_request_model.rs -src/models/service_account_people_access_policies_response_model.rs -src/models/service_account_response_model.rs -src/models/service_account_secrets_details_response_model.rs -src/models/service_account_secrets_details_response_model_list_response_model.rs -src/models/service_account_update_request_model.rs -src/models/set_key_connector_key_request_model.rs -src/models/set_password_request_model.rs -src/models/sm_export_response_model.rs -src/models/sm_import_request_model.rs -src/models/sso_configuration_data.rs -src/models/sso_configuration_data_request.rs -src/models/sso_type.rs -src/models/sso_urls.rs -src/models/storage_request_model.rs -src/models/subscription_cancellation_request_model.rs -src/models/subscription_response_model.rs -src/models/sync_response_model.rs -src/models/tax_info_response_model.rs -src/models/tax_info_update_request_model.rs -src/models/tax_information_request_body.rs -src/models/tax_rate_response_model.rs -src/models/tax_rate_response_model_list_response_model.rs -src/models/transaction_type.rs -src/models/two_factor_authenticator_disable_request_model.rs -src/models/two_factor_authenticator_response_model.rs -src/models/two_factor_duo_response_model.rs -src/models/two_factor_email_request_model.rs -src/models/two_factor_email_response_model.rs -src/models/two_factor_provider_request_model.rs -src/models/two_factor_provider_response_model.rs -src/models/two_factor_provider_response_model_list_response_model.rs -src/models/two_factor_provider_type.rs -src/models/two_factor_recover_response_model.rs -src/models/two_factor_recovery_request_model.rs -src/models/two_factor_web_authn_delete_request_model.rs -src/models/two_factor_web_authn_request_model.rs -src/models/two_factor_web_authn_response_model.rs -src/models/two_factor_yubi_key_response_model.rs -src/models/update_avatar_request_model.rs -src/models/update_client_organization_request_body.rs -src/models/update_devices_trust_request_model.rs -src/models/update_domains_request_model.rs -src/models/update_key_request_model.rs -src/models/update_profile_request_model.rs -src/models/update_tde_offboarding_password_request_model.rs -src/models/update_temp_password_request_model.rs -src/models/update_two_factor_authenticator_request_model.rs -src/models/update_two_factor_duo_request_model.rs -src/models/update_two_factor_email_request_model.rs -src/models/update_two_factor_yubico_otp_request_model.rs -src/models/uri_match_type.rs -src/models/user.rs -src/models/user_access_policy_response_model.rs -src/models/user_key_response_model.rs -src/models/user_license.rs -src/models/user_verification_requirement.rs -src/models/verify_delete_recover_request_model.rs -src/models/verify_email_request_model.rs -src/models/verify_otp_request_model.rs -src/models/web_authn_credential_create_options_response_model.rs -src/models/web_authn_credential_response_model.rs -src/models/web_authn_credential_response_model_list_response_model.rs -src/models/web_authn_login_assertion_options_response_model.rs -src/models/web_authn_login_credential_create_request_model.rs -src/models/web_authn_login_credential_update_request_model.rs -src/models/web_authn_login_rotate_key_request_model.rs -src/models/web_authn_prf_status.rs diff --git a/crates/bitwarden-api-api/.openapi-generator/VERSION b/crates/bitwarden-api-api/.openapi-generator/VERSION deleted file mode 100644 index 93c8ddab9..000000000 --- a/crates/bitwarden-api-api/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.6.0 diff --git a/crates/bitwarden-api-api/Cargo.toml b/crates/bitwarden-api-api/Cargo.toml deleted file mode 100644 index 43ec79ff0..000000000 --- a/crates/bitwarden-api-api/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "bitwarden-api-api" -description = "Api bindings for the Bitwarden API." -categories = ["api-bindings"] - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[dependencies] -serde = { workspace = true } -serde_with = { version = ">=3.8, <4", default-features = false, features = [ - "base64", - "std", - "macros", -] } -serde_json = { workspace = true } -serde_repr = { workspace = true } -url = ">=2.5, <3" -uuid = { workspace = true } -reqwest = { workspace = true } diff --git a/crates/bitwarden-api-api/README.md b/crates/bitwarden-api-api/README.md deleted file mode 100644 index c3a05f846..000000000 --- a/crates/bitwarden-api-api/README.md +++ /dev/null @@ -1,889 +0,0 @@ -# Rust API client for bitwarden-api-api - -No description provided (generated by Openapi Generator -https://github.com/openapitools/openapi-generator) - -## Overview - -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By -using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API -client. - -- API version: latest -- Package version: 0.5.0 -- Generator version: 7.6.0 -- Build package: `org.openapitools.codegen.languages.RustClientCodegen` - -## Installation - -Put the package under your project folder in a directory named `bitwarden-api-api` and add the -following to `Cargo.toml` under `[dependencies]`: - -``` -bitwarden-api-api = { path = "./bitwarden-api-api" } -``` - -## Documentation for API Endpoints - -All URIs are relative to _http://localhost_ - -| Class | Method | HTTP request | Description | -| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | -| _AccessPoliciesApi_ | [**organizations_id_access_policies_people_potential_grantees_get**](docs/AccessPoliciesApi.md#organizations_id_access_policies_people_potential_grantees_get) | **GET** /organizations/{id}/access-policies/people/potential-grantees | -| _AccessPoliciesApi_ | [**organizations_id_access_policies_projects_potential_grantees_get**](docs/AccessPoliciesApi.md#organizations_id_access_policies_projects_potential_grantees_get) | **GET** /organizations/{id}/access-policies/projects/potential-grantees | -| _AccessPoliciesApi_ | [**organizations_id_access_policies_service_accounts_potential_grantees_get**](docs/AccessPoliciesApi.md#organizations_id_access_policies_service_accounts_potential_grantees_get) | **GET** /organizations/{id}/access-policies/service-accounts/potential-grantees | -| _AccessPoliciesApi_ | [**projects_id_access_policies_people_get**](docs/AccessPoliciesApi.md#projects_id_access_policies_people_get) | **GET** /projects/{id}/access-policies/people | -| _AccessPoliciesApi_ | [**projects_id_access_policies_people_put**](docs/AccessPoliciesApi.md#projects_id_access_policies_people_put) | **PUT** /projects/{id}/access-policies/people | -| _AccessPoliciesApi_ | [**projects_id_access_policies_service_accounts_get**](docs/AccessPoliciesApi.md#projects_id_access_policies_service_accounts_get) | **GET** /projects/{id}/access-policies/service-accounts | -| _AccessPoliciesApi_ | [**projects_id_access_policies_service_accounts_put**](docs/AccessPoliciesApi.md#projects_id_access_policies_service_accounts_put) | **PUT** /projects/{id}/access-policies/service-accounts | -| _AccessPoliciesApi_ | [**secrets_secret_id_access_policies_get**](docs/AccessPoliciesApi.md#secrets_secret_id_access_policies_get) | **GET** /secrets/{secretId}/access-policies | -| _AccessPoliciesApi_ | [**service_accounts_id_access_policies_people_get**](docs/AccessPoliciesApi.md#service_accounts_id_access_policies_people_get) | **GET** /service-accounts/{id}/access-policies/people | -| _AccessPoliciesApi_ | [**service_accounts_id_access_policies_people_put**](docs/AccessPoliciesApi.md#service_accounts_id_access_policies_people_put) | **PUT** /service-accounts/{id}/access-policies/people | -| _AccessPoliciesApi_ | [**service_accounts_id_granted_policies_get**](docs/AccessPoliciesApi.md#service_accounts_id_granted_policies_get) | **GET** /service-accounts/{id}/granted-policies | -| _AccessPoliciesApi_ | [**service_accounts_id_granted_policies_put**](docs/AccessPoliciesApi.md#service_accounts_id_granted_policies_put) | **PUT** /service-accounts/{id}/granted-policies | -| _AccountsApi_ | [**accounts_api_key_post**](docs/AccountsApi.md#accounts_api_key_post) | **POST** /accounts/api-key | -| _AccountsApi_ | [**accounts_avatar_post**](docs/AccountsApi.md#accounts_avatar_post) | **POST** /accounts/avatar | -| _AccountsApi_ | [**accounts_avatar_put**](docs/AccountsApi.md#accounts_avatar_put) | **PUT** /accounts/avatar | -| _AccountsApi_ | [**accounts_cancel_post**](docs/AccountsApi.md#accounts_cancel_post) | **POST** /accounts/cancel | -| _AccountsApi_ | [**accounts_convert_to_key_connector_post**](docs/AccountsApi.md#accounts_convert_to_key_connector_post) | **POST** /accounts/convert-to-key-connector | -| _AccountsApi_ | [**accounts_delete**](docs/AccountsApi.md#accounts_delete) | **DELETE** /accounts | -| _AccountsApi_ | [**accounts_delete_post**](docs/AccountsApi.md#accounts_delete_post) | **POST** /accounts/delete | -| _AccountsApi_ | [**accounts_delete_recover_post**](docs/AccountsApi.md#accounts_delete_recover_post) | **POST** /accounts/delete-recover | -| _AccountsApi_ | [**accounts_delete_recover_token_post**](docs/AccountsApi.md#accounts_delete_recover_token_post) | **POST** /accounts/delete-recover-token | -| _AccountsApi_ | [**accounts_email_post**](docs/AccountsApi.md#accounts_email_post) | **POST** /accounts/email | -| _AccountsApi_ | [**accounts_email_token_post**](docs/AccountsApi.md#accounts_email_token_post) | **POST** /accounts/email-token | -| _AccountsApi_ | [**accounts_kdf_post**](docs/AccountsApi.md#accounts_kdf_post) | **POST** /accounts/kdf | -| _AccountsApi_ | [**accounts_key_post**](docs/AccountsApi.md#accounts_key_post) | **POST** /accounts/key | -| _AccountsApi_ | [**accounts_keys_get**](docs/AccountsApi.md#accounts_keys_get) | **GET** /accounts/keys | -| _AccountsApi_ | [**accounts_keys_post**](docs/AccountsApi.md#accounts_keys_post) | **POST** /accounts/keys | -| _AccountsApi_ | [**accounts_license_post**](docs/AccountsApi.md#accounts_license_post) | **POST** /accounts/license | -| _AccountsApi_ | [**accounts_organizations_get**](docs/AccountsApi.md#accounts_organizations_get) | **GET** /accounts/organizations | -| _AccountsApi_ | [**accounts_password_hint_post**](docs/AccountsApi.md#accounts_password_hint_post) | **POST** /accounts/password-hint | -| _AccountsApi_ | [**accounts_password_post**](docs/AccountsApi.md#accounts_password_post) | **POST** /accounts/password | -| _AccountsApi_ | [**accounts_payment_post**](docs/AccountsApi.md#accounts_payment_post) | **POST** /accounts/payment | -| _AccountsApi_ | [**accounts_premium_post**](docs/AccountsApi.md#accounts_premium_post) | **POST** /accounts/premium | -| _AccountsApi_ | [**accounts_profile_get**](docs/AccountsApi.md#accounts_profile_get) | **GET** /accounts/profile | -| _AccountsApi_ | [**accounts_profile_post**](docs/AccountsApi.md#accounts_profile_post) | **POST** /accounts/profile | -| _AccountsApi_ | [**accounts_profile_put**](docs/AccountsApi.md#accounts_profile_put) | **PUT** /accounts/profile | -| _AccountsApi_ | [**accounts_reinstate_premium_post**](docs/AccountsApi.md#accounts_reinstate_premium_post) | **POST** /accounts/reinstate-premium | -| _AccountsApi_ | [**accounts_request_otp_post**](docs/AccountsApi.md#accounts_request_otp_post) | **POST** /accounts/request-otp | -| _AccountsApi_ | [**accounts_revision_date_get**](docs/AccountsApi.md#accounts_revision_date_get) | **GET** /accounts/revision-date | -| _AccountsApi_ | [**accounts_rotate_api_key_post**](docs/AccountsApi.md#accounts_rotate_api_key_post) | **POST** /accounts/rotate-api-key | -| _AccountsApi_ | [**accounts_security_stamp_post**](docs/AccountsApi.md#accounts_security_stamp_post) | **POST** /accounts/security-stamp | -| _AccountsApi_ | [**accounts_set_key_connector_key_post**](docs/AccountsApi.md#accounts_set_key_connector_key_post) | **POST** /accounts/set-key-connector-key | -| _AccountsApi_ | [**accounts_set_password_post**](docs/AccountsApi.md#accounts_set_password_post) | **POST** /accounts/set-password | -| _AccountsApi_ | [**accounts_sso_organization_id_delete**](docs/AccountsApi.md#accounts_sso_organization_id_delete) | **DELETE** /accounts/sso/{organizationId} | -| _AccountsApi_ | [**accounts_sso_user_identifier_get**](docs/AccountsApi.md#accounts_sso_user_identifier_get) | **GET** /accounts/sso/user-identifier | -| _AccountsApi_ | [**accounts_storage_post**](docs/AccountsApi.md#accounts_storage_post) | **POST** /accounts/storage | -| _AccountsApi_ | [**accounts_subscription_get**](docs/AccountsApi.md#accounts_subscription_get) | **GET** /accounts/subscription | -| _AccountsApi_ | [**accounts_tax_get**](docs/AccountsApi.md#accounts_tax_get) | **GET** /accounts/tax | -| _AccountsApi_ | [**accounts_tax_put**](docs/AccountsApi.md#accounts_tax_put) | **PUT** /accounts/tax | -| _AccountsApi_ | [**accounts_update_tde_offboarding_password_put**](docs/AccountsApi.md#accounts_update_tde_offboarding_password_put) | **PUT** /accounts/update-tde-offboarding-password | -| _AccountsApi_ | [**accounts_update_temp_password_put**](docs/AccountsApi.md#accounts_update_temp_password_put) | **PUT** /accounts/update-temp-password | -| _AccountsApi_ | [**accounts_verify_email_post**](docs/AccountsApi.md#accounts_verify_email_post) | **POST** /accounts/verify-email | -| _AccountsApi_ | [**accounts_verify_email_token_post**](docs/AccountsApi.md#accounts_verify_email_token_post) | **POST** /accounts/verify-email-token | -| _AccountsApi_ | [**accounts_verify_otp_post**](docs/AccountsApi.md#accounts_verify_otp_post) | **POST** /accounts/verify-otp | -| _AccountsApi_ | [**accounts_verify_password_post**](docs/AccountsApi.md#accounts_verify_password_post) | **POST** /accounts/verify-password | -| _AccountsBillingApi_ | [**accounts_billing_history_get**](docs/AccountsBillingApi.md#accounts_billing_history_get) | **GET** /accounts/billing/history | -| _AccountsBillingApi_ | [**accounts_billing_payment_method_get**](docs/AccountsBillingApi.md#accounts_billing_payment_method_get) | **GET** /accounts/billing/payment-method | -| _AuthRequestsApi_ | [**auth_requests_admin_request_post**](docs/AuthRequestsApi.md#auth_requests_admin_request_post) | **POST** /auth-requests/admin-request | -| _AuthRequestsApi_ | [**auth_requests_get**](docs/AuthRequestsApi.md#auth_requests_get) | **GET** /auth-requests | -| _AuthRequestsApi_ | [**auth_requests_id_get**](docs/AuthRequestsApi.md#auth_requests_id_get) | **GET** /auth-requests/{id} | -| _AuthRequestsApi_ | [**auth_requests_id_put**](docs/AuthRequestsApi.md#auth_requests_id_put) | **PUT** /auth-requests/{id} | -| _AuthRequestsApi_ | [**auth_requests_id_response_get**](docs/AuthRequestsApi.md#auth_requests_id_response_get) | **GET** /auth-requests/{id}/response | -| _AuthRequestsApi_ | [**auth_requests_post**](docs/AuthRequestsApi.md#auth_requests_post) | **POST** /auth-requests | -| _CiphersApi_ | [**ciphers_admin_delete**](docs/CiphersApi.md#ciphers_admin_delete) | **DELETE** /ciphers/admin | -| _CiphersApi_ | [**ciphers_admin_post**](docs/CiphersApi.md#ciphers_admin_post) | **POST** /ciphers/admin | -| _CiphersApi_ | [**ciphers_attachment_validate_azure_post**](docs/CiphersApi.md#ciphers_attachment_validate_azure_post) | **POST** /ciphers/attachment/validate/azure | -| _CiphersApi_ | [**ciphers_bulk_collections_post**](docs/CiphersApi.md#ciphers_bulk_collections_post) | **POST** /ciphers/bulk-collections | -| _CiphersApi_ | [**ciphers_create_post**](docs/CiphersApi.md#ciphers_create_post) | **POST** /ciphers/create | -| _CiphersApi_ | [**ciphers_delete**](docs/CiphersApi.md#ciphers_delete) | **DELETE** /ciphers | -| _CiphersApi_ | [**ciphers_delete_admin_post**](docs/CiphersApi.md#ciphers_delete_admin_post) | **POST** /ciphers/delete-admin | -| _CiphersApi_ | [**ciphers_delete_admin_put**](docs/CiphersApi.md#ciphers_delete_admin_put) | **PUT** /ciphers/delete-admin | -| _CiphersApi_ | [**ciphers_delete_post**](docs/CiphersApi.md#ciphers_delete_post) | **POST** /ciphers/delete | -| _CiphersApi_ | [**ciphers_delete_put**](docs/CiphersApi.md#ciphers_delete_put) | **PUT** /ciphers/delete | -| _CiphersApi_ | [**ciphers_get**](docs/CiphersApi.md#ciphers_get) | **GET** /ciphers | -| _CiphersApi_ | [**ciphers_id_admin_delete**](docs/CiphersApi.md#ciphers_id_admin_delete) | **DELETE** /ciphers/{id}/admin | -| _CiphersApi_ | [**ciphers_id_admin_get**](docs/CiphersApi.md#ciphers_id_admin_get) | **GET** /ciphers/{id}/admin | -| _CiphersApi_ | [**ciphers_id_admin_post**](docs/CiphersApi.md#ciphers_id_admin_post) | **POST** /ciphers/{id}/admin | -| _CiphersApi_ | [**ciphers_id_admin_put**](docs/CiphersApi.md#ciphers_id_admin_put) | **PUT** /ciphers/{id}/admin | -| _CiphersApi_ | [**ciphers_id_attachment_admin_post**](docs/CiphersApi.md#ciphers_id_attachment_admin_post) | **POST** /ciphers/{id}/attachment-admin | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_admin_delete**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_admin_delete) | **DELETE** /ciphers/{id}/attachment/{attachmentId}/admin | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_delete**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_delete) | **DELETE** /ciphers/{id}/attachment/{attachmentId} | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_delete_admin_post**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_delete_admin_post) | **POST** /ciphers/{id}/attachment/{attachmentId}/delete-admin | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_delete_post**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_delete_post) | **POST** /ciphers/{id}/attachment/{attachmentId}/delete | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_get**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_get) | **GET** /ciphers/{id}/attachment/{attachmentId} | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_post**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_post) | **POST** /ciphers/{id}/attachment/{attachmentId} | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_renew_get**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_renew_get) | **GET** /ciphers/{id}/attachment/{attachmentId}/renew | -| _CiphersApi_ | [**ciphers_id_attachment_attachment_id_share_post**](docs/CiphersApi.md#ciphers_id_attachment_attachment_id_share_post) | **POST** /ciphers/{id}/attachment/{attachmentId}/share | -| _CiphersApi_ | [**ciphers_id_attachment_post**](docs/CiphersApi.md#ciphers_id_attachment_post) | **POST** /ciphers/{id}/attachment | -| _CiphersApi_ | [**ciphers_id_attachment_v2_post**](docs/CiphersApi.md#ciphers_id_attachment_v2_post) | **POST** /ciphers/{id}/attachment/v2 | -| _CiphersApi_ | [**ciphers_id_collections_admin_post**](docs/CiphersApi.md#ciphers_id_collections_admin_post) | **POST** /ciphers/{id}/collections-admin | -| _CiphersApi_ | [**ciphers_id_collections_admin_put**](docs/CiphersApi.md#ciphers_id_collections_admin_put) | **PUT** /ciphers/{id}/collections-admin | -| _CiphersApi_ | [**ciphers_id_collections_post**](docs/CiphersApi.md#ciphers_id_collections_post) | **POST** /ciphers/{id}/collections | -| _CiphersApi_ | [**ciphers_id_collections_put**](docs/CiphersApi.md#ciphers_id_collections_put) | **PUT** /ciphers/{id}/collections | -| _CiphersApi_ | [**ciphers_id_collections_v2_post**](docs/CiphersApi.md#ciphers_id_collections_v2_post) | **POST** /ciphers/{id}/collections_v2 | -| _CiphersApi_ | [**ciphers_id_collections_v2_put**](docs/CiphersApi.md#ciphers_id_collections_v2_put) | **PUT** /ciphers/{id}/collections_v2 | -| _CiphersApi_ | [**ciphers_id_delete**](docs/CiphersApi.md#ciphers_id_delete) | **DELETE** /ciphers/{id} | -| _CiphersApi_ | [**ciphers_id_delete_admin_post**](docs/CiphersApi.md#ciphers_id_delete_admin_post) | **POST** /ciphers/{id}/delete-admin | -| _CiphersApi_ | [**ciphers_id_delete_admin_put**](docs/CiphersApi.md#ciphers_id_delete_admin_put) | **PUT** /ciphers/{id}/delete-admin | -| _CiphersApi_ | [**ciphers_id_delete_post**](docs/CiphersApi.md#ciphers_id_delete_post) | **POST** /ciphers/{id}/delete | -| _CiphersApi_ | [**ciphers_id_delete_put**](docs/CiphersApi.md#ciphers_id_delete_put) | **PUT** /ciphers/{id}/delete | -| _CiphersApi_ | [**ciphers_id_details_get**](docs/CiphersApi.md#ciphers_id_details_get) | **GET** /ciphers/{id}/details | -| _CiphersApi_ | [**ciphers_id_full_details_get**](docs/CiphersApi.md#ciphers_id_full_details_get) | **GET** /ciphers/{id}/full-details | -| _CiphersApi_ | [**ciphers_id_get**](docs/CiphersApi.md#ciphers_id_get) | **GET** /ciphers/{id} | -| _CiphersApi_ | [**ciphers_id_partial_post**](docs/CiphersApi.md#ciphers_id_partial_post) | **POST** /ciphers/{id}/partial | -| _CiphersApi_ | [**ciphers_id_partial_put**](docs/CiphersApi.md#ciphers_id_partial_put) | **PUT** /ciphers/{id}/partial | -| _CiphersApi_ | [**ciphers_id_post**](docs/CiphersApi.md#ciphers_id_post) | **POST** /ciphers/{id} | -| _CiphersApi_ | [**ciphers_id_put**](docs/CiphersApi.md#ciphers_id_put) | **PUT** /ciphers/{id} | -| _CiphersApi_ | [**ciphers_id_restore_admin_put**](docs/CiphersApi.md#ciphers_id_restore_admin_put) | **PUT** /ciphers/{id}/restore-admin | -| _CiphersApi_ | [**ciphers_id_restore_put**](docs/CiphersApi.md#ciphers_id_restore_put) | **PUT** /ciphers/{id}/restore | -| _CiphersApi_ | [**ciphers_id_share_post**](docs/CiphersApi.md#ciphers_id_share_post) | **POST** /ciphers/{id}/share | -| _CiphersApi_ | [**ciphers_id_share_put**](docs/CiphersApi.md#ciphers_id_share_put) | **PUT** /ciphers/{id}/share | -| _CiphersApi_ | [**ciphers_move_post**](docs/CiphersApi.md#ciphers_move_post) | **POST** /ciphers/move | -| _CiphersApi_ | [**ciphers_move_put**](docs/CiphersApi.md#ciphers_move_put) | **PUT** /ciphers/move | -| _CiphersApi_ | [**ciphers_organization_details_assigned_get**](docs/CiphersApi.md#ciphers_organization_details_assigned_get) | **GET** /ciphers/organization-details/assigned | -| _CiphersApi_ | [**ciphers_organization_details_get**](docs/CiphersApi.md#ciphers_organization_details_get) | **GET** /ciphers/organization-details | -| _CiphersApi_ | [**ciphers_post**](docs/CiphersApi.md#ciphers_post) | **POST** /ciphers | -| _CiphersApi_ | [**ciphers_purge_post**](docs/CiphersApi.md#ciphers_purge_post) | **POST** /ciphers/purge | -| _CiphersApi_ | [**ciphers_restore_admin_put**](docs/CiphersApi.md#ciphers_restore_admin_put) | **PUT** /ciphers/restore-admin | -| _CiphersApi_ | [**ciphers_restore_put**](docs/CiphersApi.md#ciphers_restore_put) | **PUT** /ciphers/restore | -| _CiphersApi_ | [**ciphers_share_post**](docs/CiphersApi.md#ciphers_share_post) | **POST** /ciphers/share | -| _CiphersApi_ | [**ciphers_share_put**](docs/CiphersApi.md#ciphers_share_put) | **PUT** /ciphers/share | -| _CollectionsApi_ | [**collections_get**](docs/CollectionsApi.md#collections_get) | **GET** /collections | -| _CollectionsApi_ | [**organizations_org_id_collections_bulk_access_post**](docs/CollectionsApi.md#organizations_org_id_collections_bulk_access_post) | **POST** /organizations/{orgId}/collections/bulk-access | -| _CollectionsApi_ | [**organizations_org_id_collections_delete**](docs/CollectionsApi.md#organizations_org_id_collections_delete) | **DELETE** /organizations/{orgId}/collections | -| _CollectionsApi_ | [**organizations_org_id_collections_delete_post**](docs/CollectionsApi.md#organizations_org_id_collections_delete_post) | **POST** /organizations/{orgId}/collections/delete | -| _CollectionsApi_ | [**organizations_org_id_collections_details_get**](docs/CollectionsApi.md#organizations_org_id_collections_details_get) | **GET** /organizations/{orgId}/collections/details | -| _CollectionsApi_ | [**organizations_org_id_collections_get**](docs/CollectionsApi.md#organizations_org_id_collections_get) | **GET** /organizations/{orgId}/collections | -| _CollectionsApi_ | [**organizations_org_id_collections_id_delete**](docs/CollectionsApi.md#organizations_org_id_collections_id_delete) | **DELETE** /organizations/{orgId}/collections/{id} | -| _CollectionsApi_ | [**organizations_org_id_collections_id_delete_post**](docs/CollectionsApi.md#organizations_org_id_collections_id_delete_post) | **POST** /organizations/{orgId}/collections/{id}/delete | -| _CollectionsApi_ | [**organizations_org_id_collections_id_delete_user_org_user_id_post**](docs/CollectionsApi.md#organizations_org_id_collections_id_delete_user_org_user_id_post) | **POST** /organizations/{orgId}/collections/{id}/delete-user/{orgUserId} | -| _CollectionsApi_ | [**organizations_org_id_collections_id_details_get**](docs/CollectionsApi.md#organizations_org_id_collections_id_details_get) | **GET** /organizations/{orgId}/collections/{id}/details | -| _CollectionsApi_ | [**organizations_org_id_collections_id_get**](docs/CollectionsApi.md#organizations_org_id_collections_id_get) | **GET** /organizations/{orgId}/collections/{id} | -| _CollectionsApi_ | [**organizations_org_id_collections_id_post**](docs/CollectionsApi.md#organizations_org_id_collections_id_post) | **POST** /organizations/{orgId}/collections/{id} | -| _CollectionsApi_ | [**organizations_org_id_collections_id_put**](docs/CollectionsApi.md#organizations_org_id_collections_id_put) | **PUT** /organizations/{orgId}/collections/{id} | -| _CollectionsApi_ | [**organizations_org_id_collections_id_user_org_user_id_delete**](docs/CollectionsApi.md#organizations_org_id_collections_id_user_org_user_id_delete) | **DELETE** /organizations/{orgId}/collections/{id}/user/{orgUserId} | -| _CollectionsApi_ | [**organizations_org_id_collections_id_users_get**](docs/CollectionsApi.md#organizations_org_id_collections_id_users_get) | **GET** /organizations/{orgId}/collections/{id}/users | -| _CollectionsApi_ | [**organizations_org_id_collections_id_users_put**](docs/CollectionsApi.md#organizations_org_id_collections_id_users_put) | **PUT** /organizations/{orgId}/collections/{id}/users | -| _CollectionsApi_ | [**organizations_org_id_collections_post**](docs/CollectionsApi.md#organizations_org_id_collections_post) | **POST** /organizations/{orgId}/collections | -| _ConfigApi_ | [**config_get**](docs/ConfigApi.md#config_get) | **GET** /config | -| _CountsApi_ | [**organizations_organization_id_sm_counts_get**](docs/CountsApi.md#organizations_organization_id_sm_counts_get) | **GET** /organizations/{organizationId}/sm-counts | -| _CountsApi_ | [**projects_project_id_sm_counts_get**](docs/CountsApi.md#projects_project_id_sm_counts_get) | **GET** /projects/{projectId}/sm-counts | -| _CountsApi_ | [**service_accounts_service_account_id_sm_counts_get**](docs/CountsApi.md#service_accounts_service_account_id_sm_counts_get) | **GET** /service-accounts/{serviceAccountId}/sm-counts | -| _DevicesApi_ | [**devices_get**](docs/DevicesApi.md#devices_get) | **GET** /devices | -| _DevicesApi_ | [**devices_id_delete**](docs/DevicesApi.md#devices_id_delete) | **DELETE** /devices/{id} | -| _DevicesApi_ | [**devices_id_delete_post**](docs/DevicesApi.md#devices_id_delete_post) | **POST** /devices/{id}/delete | -| _DevicesApi_ | [**devices_id_get**](docs/DevicesApi.md#devices_id_get) | **GET** /devices/{id} | -| _DevicesApi_ | [**devices_id_post**](docs/DevicesApi.md#devices_id_post) | **POST** /devices/{id} | -| _DevicesApi_ | [**devices_id_put**](docs/DevicesApi.md#devices_id_put) | **PUT** /devices/{id} | -| _DevicesApi_ | [**devices_identifier_identifier_clear_token_post**](docs/DevicesApi.md#devices_identifier_identifier_clear_token_post) | **POST** /devices/identifier/{identifier}/clear-token | -| _DevicesApi_ | [**devices_identifier_identifier_clear_token_put**](docs/DevicesApi.md#devices_identifier_identifier_clear_token_put) | **PUT** /devices/identifier/{identifier}/clear-token | -| _DevicesApi_ | [**devices_identifier_identifier_get**](docs/DevicesApi.md#devices_identifier_identifier_get) | **GET** /devices/identifier/{identifier} | -| _DevicesApi_ | [**devices_identifier_identifier_token_post**](docs/DevicesApi.md#devices_identifier_identifier_token_post) | **POST** /devices/identifier/{identifier}/token | -| _DevicesApi_ | [**devices_identifier_identifier_token_put**](docs/DevicesApi.md#devices_identifier_identifier_token_put) | **PUT** /devices/identifier/{identifier}/token | -| _DevicesApi_ | [**devices_identifier_keys_post**](docs/DevicesApi.md#devices_identifier_keys_post) | **POST** /devices/{identifier}/keys | -| _DevicesApi_ | [**devices_identifier_keys_put**](docs/DevicesApi.md#devices_identifier_keys_put) | **PUT** /devices/{identifier}/keys | -| _DevicesApi_ | [**devices_identifier_retrieve_keys_post**](docs/DevicesApi.md#devices_identifier_retrieve_keys_post) | **POST** /devices/{identifier}/retrieve-keys | -| _DevicesApi_ | [**devices_knowndevice_email_identifier_get**](docs/DevicesApi.md#devices_knowndevice_email_identifier_get) | **GET** /devices/knowndevice/{email}/{identifier} | -| _DevicesApi_ | [**devices_knowndevice_get**](docs/DevicesApi.md#devices_knowndevice_get) | **GET** /devices/knowndevice | -| _DevicesApi_ | [**devices_lost_trust_post**](docs/DevicesApi.md#devices_lost_trust_post) | **POST** /devices/lost-trust | -| _DevicesApi_ | [**devices_post**](docs/DevicesApi.md#devices_post) | **POST** /devices | -| _DevicesApi_ | [**devices_update_trust_post**](docs/DevicesApi.md#devices_update_trust_post) | **POST** /devices/update-trust | -| _EmergencyAccessApi_ | [**emergency_access_granted_get**](docs/EmergencyAccessApi.md#emergency_access_granted_get) | **GET** /emergency-access/granted | -| _EmergencyAccessApi_ | [**emergency_access_id_accept_post**](docs/EmergencyAccessApi.md#emergency_access_id_accept_post) | **POST** /emergency-access/{id}/accept | -| _EmergencyAccessApi_ | [**emergency_access_id_approve_post**](docs/EmergencyAccessApi.md#emergency_access_id_approve_post) | **POST** /emergency-access/{id}/approve | -| _EmergencyAccessApi_ | [**emergency_access_id_cipher_id_attachment_attachment_id_get**](docs/EmergencyAccessApi.md#emergency_access_id_cipher_id_attachment_attachment_id_get) | **GET** /emergency-access/{id}/{cipherId}/attachment/{attachmentId} | -| _EmergencyAccessApi_ | [**emergency_access_id_confirm_post**](docs/EmergencyAccessApi.md#emergency_access_id_confirm_post) | **POST** /emergency-access/{id}/confirm | -| _EmergencyAccessApi_ | [**emergency_access_id_delete**](docs/EmergencyAccessApi.md#emergency_access_id_delete) | **DELETE** /emergency-access/{id} | -| _EmergencyAccessApi_ | [**emergency_access_id_delete_post**](docs/EmergencyAccessApi.md#emergency_access_id_delete_post) | **POST** /emergency-access/{id}/delete | -| _EmergencyAccessApi_ | [**emergency_access_id_get**](docs/EmergencyAccessApi.md#emergency_access_id_get) | **GET** /emergency-access/{id} | -| _EmergencyAccessApi_ | [**emergency_access_id_initiate_post**](docs/EmergencyAccessApi.md#emergency_access_id_initiate_post) | **POST** /emergency-access/{id}/initiate | -| _EmergencyAccessApi_ | [**emergency_access_id_password_post**](docs/EmergencyAccessApi.md#emergency_access_id_password_post) | **POST** /emergency-access/{id}/password | -| _EmergencyAccessApi_ | [**emergency_access_id_policies_get**](docs/EmergencyAccessApi.md#emergency_access_id_policies_get) | **GET** /emergency-access/{id}/policies | -| _EmergencyAccessApi_ | [**emergency_access_id_post**](docs/EmergencyAccessApi.md#emergency_access_id_post) | **POST** /emergency-access/{id} | -| _EmergencyAccessApi_ | [**emergency_access_id_put**](docs/EmergencyAccessApi.md#emergency_access_id_put) | **PUT** /emergency-access/{id} | -| _EmergencyAccessApi_ | [**emergency_access_id_reinvite_post**](docs/EmergencyAccessApi.md#emergency_access_id_reinvite_post) | **POST** /emergency-access/{id}/reinvite | -| _EmergencyAccessApi_ | [**emergency_access_id_reject_post**](docs/EmergencyAccessApi.md#emergency_access_id_reject_post) | **POST** /emergency-access/{id}/reject | -| _EmergencyAccessApi_ | [**emergency_access_id_takeover_post**](docs/EmergencyAccessApi.md#emergency_access_id_takeover_post) | **POST** /emergency-access/{id}/takeover | -| _EmergencyAccessApi_ | [**emergency_access_id_view_post**](docs/EmergencyAccessApi.md#emergency_access_id_view_post) | **POST** /emergency-access/{id}/view | -| _EmergencyAccessApi_ | [**emergency_access_invite_post**](docs/EmergencyAccessApi.md#emergency_access_invite_post) | **POST** /emergency-access/invite | -| _EmergencyAccessApi_ | [**emergency_access_trusted_get**](docs/EmergencyAccessApi.md#emergency_access_trusted_get) | **GET** /emergency-access/trusted | -| _EventsApi_ | [**ciphers_id_events_get**](docs/EventsApi.md#ciphers_id_events_get) | **GET** /ciphers/{id}/events | -| _EventsApi_ | [**events_get**](docs/EventsApi.md#events_get) | **GET** /events | -| _EventsApi_ | [**organizations_id_events_get**](docs/EventsApi.md#organizations_id_events_get) | **GET** /organizations/{id}/events | -| _EventsApi_ | [**organizations_org_id_users_id_events_get**](docs/EventsApi.md#organizations_org_id_users_id_events_get) | **GET** /organizations/{orgId}/users/{id}/events | -| _EventsApi_ | [**providers_provider_id_events_get**](docs/EventsApi.md#providers_provider_id_events_get) | **GET** /providers/{providerId}/events | -| _EventsApi_ | [**providers_provider_id_users_id_events_get**](docs/EventsApi.md#providers_provider_id_users_id_events_get) | **GET** /providers/{providerId}/users/{id}/events | -| _FoldersApi_ | [**folders_get**](docs/FoldersApi.md#folders_get) | **GET** /folders | -| _FoldersApi_ | [**folders_id_delete**](docs/FoldersApi.md#folders_id_delete) | **DELETE** /folders/{id} | -| _FoldersApi_ | [**folders_id_delete_post**](docs/FoldersApi.md#folders_id_delete_post) | **POST** /folders/{id}/delete | -| _FoldersApi_ | [**folders_id_get**](docs/FoldersApi.md#folders_id_get) | **GET** /folders/{id} | -| _FoldersApi_ | [**folders_id_post**](docs/FoldersApi.md#folders_id_post) | **POST** /folders/{id} | -| _FoldersApi_ | [**folders_id_put**](docs/FoldersApi.md#folders_id_put) | **PUT** /folders/{id} | -| _FoldersApi_ | [**folders_post**](docs/FoldersApi.md#folders_post) | **POST** /folders | -| _GroupsApi_ | [**organizations_org_id_groups_delete**](docs/GroupsApi.md#organizations_org_id_groups_delete) | **DELETE** /organizations/{orgId}/groups | -| _GroupsApi_ | [**organizations_org_id_groups_delete_post**](docs/GroupsApi.md#organizations_org_id_groups_delete_post) | **POST** /organizations/{orgId}/groups/delete | -| _GroupsApi_ | [**organizations_org_id_groups_get**](docs/GroupsApi.md#organizations_org_id_groups_get) | **GET** /organizations/{orgId}/groups | -| _GroupsApi_ | [**organizations_org_id_groups_id_delete**](docs/GroupsApi.md#organizations_org_id_groups_id_delete) | **DELETE** /organizations/{orgId}/groups/{id} | -| _GroupsApi_ | [**organizations_org_id_groups_id_delete_post**](docs/GroupsApi.md#organizations_org_id_groups_id_delete_post) | **POST** /organizations/{orgId}/groups/{id}/delete | -| _GroupsApi_ | [**organizations_org_id_groups_id_delete_user_org_user_id_post**](docs/GroupsApi.md#organizations_org_id_groups_id_delete_user_org_user_id_post) | **POST** /organizations/{orgId}/groups/{id}/delete-user/{orgUserId} | -| _GroupsApi_ | [**organizations_org_id_groups_id_details_get**](docs/GroupsApi.md#organizations_org_id_groups_id_details_get) | **GET** /organizations/{orgId}/groups/{id}/details | -| _GroupsApi_ | [**organizations_org_id_groups_id_get**](docs/GroupsApi.md#organizations_org_id_groups_id_get) | **GET** /organizations/{orgId}/groups/{id} | -| _GroupsApi_ | [**organizations_org_id_groups_id_post**](docs/GroupsApi.md#organizations_org_id_groups_id_post) | **POST** /organizations/{orgId}/groups/{id} | -| _GroupsApi_ | [**organizations_org_id_groups_id_put**](docs/GroupsApi.md#organizations_org_id_groups_id_put) | **PUT** /organizations/{orgId}/groups/{id} | -| _GroupsApi_ | [**organizations_org_id_groups_id_user_org_user_id_delete**](docs/GroupsApi.md#organizations_org_id_groups_id_user_org_user_id_delete) | **DELETE** /organizations/{orgId}/groups/{id}/user/{orgUserId} | -| _GroupsApi_ | [**organizations_org_id_groups_id_users_get**](docs/GroupsApi.md#organizations_org_id_groups_id_users_get) | **GET** /organizations/{orgId}/groups/{id}/users | -| _GroupsApi_ | [**organizations_org_id_groups_post**](docs/GroupsApi.md#organizations_org_id_groups_post) | **POST** /organizations/{orgId}/groups | -| _HibpApi_ | [**hibp_breach_get**](docs/HibpApi.md#hibp_breach_get) | **GET** /hibp/breach | -| _ImportCiphersApi_ | [**ciphers_import_organization_post**](docs/ImportCiphersApi.md#ciphers_import_organization_post) | **POST** /ciphers/import-organization | -| _ImportCiphersApi_ | [**ciphers_import_post**](docs/ImportCiphersApi.md#ciphers_import_post) | **POST** /ciphers/import | -| _InfoApi_ | [**alive_get**](docs/InfoApi.md#alive_get) | **GET** /alive | -| _InfoApi_ | [**ip_get**](docs/InfoApi.md#ip_get) | **GET** /ip | -| _InfoApi_ | [**now_get**](docs/InfoApi.md#now_get) | **GET** /now | -| _InfoApi_ | [**version_get**](docs/InfoApi.md#version_get) | **GET** /version | -| _InstallationsApi_ | [**installations_id_get**](docs/InstallationsApi.md#installations_id_get) | **GET** /installations/{id} | -| _InstallationsApi_ | [**installations_post**](docs/InstallationsApi.md#installations_post) | **POST** /installations | -| _LicensesApi_ | [**licenses_organization_id_get**](docs/LicensesApi.md#licenses_organization_id_get) | **GET** /licenses/organization/{id} | Used by self-hosted installations to get an updated license file | -| _LicensesApi_ | [**licenses_user_id_get**](docs/LicensesApi.md#licenses_user_id_get) | **GET** /licenses/user/{id} | -| _MiscApi_ | [**bitpay_invoice_post**](docs/MiscApi.md#bitpay_invoice_post) | **POST** /bitpay-invoice | -| _MiscApi_ | [**setup_payment_post**](docs/MiscApi.md#setup_payment_post) | **POST** /setup-payment | -| _OrganizationAuthRequestsApi_ | [**organizations_org_id_auth_requests_deny_post**](docs/OrganizationAuthRequestsApi.md#organizations_org_id_auth_requests_deny_post) | **POST** /organizations/{orgId}/auth-requests/deny | -| _OrganizationAuthRequestsApi_ | [**organizations_org_id_auth_requests_get**](docs/OrganizationAuthRequestsApi.md#organizations_org_id_auth_requests_get) | **GET** /organizations/{orgId}/auth-requests | -| _OrganizationAuthRequestsApi_ | [**organizations_org_id_auth_requests_post**](docs/OrganizationAuthRequestsApi.md#organizations_org_id_auth_requests_post) | **POST** /organizations/{orgId}/auth-requests | -| _OrganizationAuthRequestsApi_ | [**organizations_org_id_auth_requests_request_id_post**](docs/OrganizationAuthRequestsApi.md#organizations_org_id_auth_requests_request_id_post) | **POST** /organizations/{orgId}/auth-requests/{requestId} | -| _OrganizationBillingApi_ | [**organizations_organization_id_billing_get**](docs/OrganizationBillingApi.md#organizations_organization_id_billing_get) | **GET** /organizations/{organizationId}/billing | -| _OrganizationBillingApi_ | [**organizations_organization_id_billing_history_get**](docs/OrganizationBillingApi.md#organizations_organization_id_billing_history_get) | **GET** /organizations/{organizationId}/billing/history | -| _OrganizationBillingApi_ | [**organizations_organization_id_billing_metadata_get**](docs/OrganizationBillingApi.md#organizations_organization_id_billing_metadata_get) | **GET** /organizations/{organizationId}/billing/metadata | -| _OrganizationConnectionsApi_ | [**organizations_connections_enabled_get**](docs/OrganizationConnectionsApi.md#organizations_connections_enabled_get) | **GET** /organizations/connections/enabled | -| _OrganizationConnectionsApi_ | [**organizations_connections_organization_connection_id_delete**](docs/OrganizationConnectionsApi.md#organizations_connections_organization_connection_id_delete) | **DELETE** /organizations/connections/{organizationConnectionId} | -| _OrganizationConnectionsApi_ | [**organizations_connections_organization_connection_id_delete_post**](docs/OrganizationConnectionsApi.md#organizations_connections_organization_connection_id_delete_post) | **POST** /organizations/connections/{organizationConnectionId}/delete | -| _OrganizationConnectionsApi_ | [**organizations_connections_organization_connection_id_put**](docs/OrganizationConnectionsApi.md#organizations_connections_organization_connection_id_put) | **PUT** /organizations/connections/{organizationConnectionId} | -| _OrganizationConnectionsApi_ | [**organizations_connections_organization_id_type_get**](docs/OrganizationConnectionsApi.md#organizations_connections_organization_id_type_get) | **GET** /organizations/connections/{organizationId}/{type} | -| _OrganizationConnectionsApi_ | [**organizations_connections_post**](docs/OrganizationConnectionsApi.md#organizations_connections_post) | **POST** /organizations/connections | -| _OrganizationDomainApi_ | [**organizations_domain_sso_details_post**](docs/OrganizationDomainApi.md#organizations_domain_sso_details_post) | **POST** /organizations/domain/sso/details | -| _OrganizationDomainApi_ | [**organizations_org_id_domain_get**](docs/OrganizationDomainApi.md#organizations_org_id_domain_get) | **GET** /organizations/{orgId}/domain | -| _OrganizationDomainApi_ | [**organizations_org_id_domain_id_delete**](docs/OrganizationDomainApi.md#organizations_org_id_domain_id_delete) | **DELETE** /organizations/{orgId}/domain/{id} | -| _OrganizationDomainApi_ | [**organizations_org_id_domain_id_get**](docs/OrganizationDomainApi.md#organizations_org_id_domain_id_get) | **GET** /organizations/{orgId}/domain/{id} | -| _OrganizationDomainApi_ | [**organizations_org_id_domain_id_remove_post**](docs/OrganizationDomainApi.md#organizations_org_id_domain_id_remove_post) | **POST** /organizations/{orgId}/domain/{id}/remove | -| _OrganizationDomainApi_ | [**organizations_org_id_domain_id_verify_post**](docs/OrganizationDomainApi.md#organizations_org_id_domain_id_verify_post) | **POST** /organizations/{orgId}/domain/{id}/verify | -| _OrganizationDomainApi_ | [**organizations_org_id_domain_post**](docs/OrganizationDomainApi.md#organizations_org_id_domain_post) | **POST** /organizations/{orgId}/domain | -| _OrganizationExportApi_ | [**organizations_organization_id_export_get**](docs/OrganizationExportApi.md#organizations_organization_id_export_get) | **GET** /organizations/{organizationId}/export | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_redeem_post**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_redeem_post) | **POST** /organization/sponsorship/redeem | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sponsored_sponsored_org_id_delete**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sponsored_sponsored_org_id_delete) | **DELETE** /organization/sponsorship/sponsored/{sponsoredOrgId} | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sponsored_sponsored_org_id_remove_post**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sponsored_sponsored_org_id_remove_post) | **POST** /organization/sponsorship/sponsored/{sponsoredOrgId}/remove | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sponsoring_org_id_families_for_enterprise_post**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sponsoring_org_id_families_for_enterprise_post) | **POST** /organization/sponsorship/{sponsoringOrgId}/families-for-enterprise | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sponsoring_org_id_families_for_enterprise_resend_post**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sponsoring_org_id_families_for_enterprise_resend_post) | **POST** /organization/sponsorship/{sponsoringOrgId}/families-for-enterprise/resend | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sponsoring_org_id_sync_status_get**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sponsoring_org_id_sync_status_get) | **GET** /organization/sponsorship/{sponsoringOrgId}/sync-status | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sponsoring_organization_id_delete**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sponsoring_organization_id_delete) | **DELETE** /organization/sponsorship/{sponsoringOrganizationId} | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sponsoring_organization_id_delete_post**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sponsoring_organization_id_delete_post) | **POST** /organization/sponsorship/{sponsoringOrganizationId}/delete | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_sync_post**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_sync_post) | **POST** /organization/sponsorship/sync | -| _OrganizationSponsorshipsApi_ | [**organization_sponsorship_validate_token_post**](docs/OrganizationSponsorshipsApi.md#organization_sponsorship_validate_token_post) | **POST** /organization/sponsorship/validate-token | -| _OrganizationUsersApi_ | [**organizations_org_id_users_account_recovery_details_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_account_recovery_details_post) | **POST** /organizations/{orgId}/users/account-recovery-details | -| _OrganizationUsersApi_ | [**organizations_org_id_users_confirm_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_confirm_post) | **POST** /organizations/{orgId}/users/confirm | -| _OrganizationUsersApi_ | [**organizations_org_id_users_delete**](docs/OrganizationUsersApi.md#organizations_org_id_users_delete) | **DELETE** /organizations/{orgId}/users | -| _OrganizationUsersApi_ | [**organizations_org_id_users_delete_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_delete_post) | **POST** /organizations/{orgId}/users/delete | -| _OrganizationUsersApi_ | [**organizations_org_id_users_enable_secrets_manager_patch**](docs/OrganizationUsersApi.md#organizations_org_id_users_enable_secrets_manager_patch) | **PATCH** /organizations/{orgId}/users/enable-secrets-manager | -| _OrganizationUsersApi_ | [**organizations_org_id_users_enable_secrets_manager_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_enable_secrets_manager_put) | **PUT** /organizations/{orgId}/users/enable-secrets-manager | -| _OrganizationUsersApi_ | [**organizations_org_id_users_get**](docs/OrganizationUsersApi.md#organizations_org_id_users_get) | **GET** /organizations/{orgId}/users | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_confirm_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_confirm_post) | **POST** /organizations/{orgId}/users/{id}/confirm | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_delete**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_delete) | **DELETE** /organizations/{orgId}/users/{id} | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_delete_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_delete_post) | **POST** /organizations/{orgId}/users/{id}/delete | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_get**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_get) | **GET** /organizations/{orgId}/users/{id} | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_groups_get**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_groups_get) | **GET** /organizations/{orgId}/users/{id}/groups | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_post) | **POST** /organizations/{orgId}/users/{id} | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_put) | **PUT** /organizations/{orgId}/users/{id} | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_reinvite_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_reinvite_post) | **POST** /organizations/{orgId}/users/{id}/reinvite | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_reset_password_details_get**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_reset_password_details_get) | **GET** /organizations/{orgId}/users/{id}/reset-password-details | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_reset_password_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_reset_password_put) | **PUT** /organizations/{orgId}/users/{id}/reset-password | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_restore_patch**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_restore_patch) | **PATCH** /organizations/{orgId}/users/{id}/restore | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_restore_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_restore_put) | **PUT** /organizations/{orgId}/users/{id}/restore | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_revoke_patch**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_revoke_patch) | **PATCH** /organizations/{orgId}/users/{id}/revoke | -| _OrganizationUsersApi_ | [**organizations_org_id_users_id_revoke_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_id_revoke_put) | **PUT** /organizations/{orgId}/users/{id}/revoke | -| _OrganizationUsersApi_ | [**organizations_org_id_users_invite_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_invite_post) | **POST** /organizations/{orgId}/users/invite | -| _OrganizationUsersApi_ | [**organizations_org_id_users_organization_user_id_accept_init_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_organization_user_id_accept_init_post) | **POST** /organizations/{orgId}/users/{organizationUserId}/accept-init | -| _OrganizationUsersApi_ | [**organizations_org_id_users_organization_user_id_accept_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_organization_user_id_accept_post) | **POST** /organizations/{orgId}/users/{organizationUserId}/accept | -| _OrganizationUsersApi_ | [**organizations_org_id_users_public_keys_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_public_keys_post) | **POST** /organizations/{orgId}/users/public-keys | -| _OrganizationUsersApi_ | [**organizations_org_id_users_reinvite_post**](docs/OrganizationUsersApi.md#organizations_org_id_users_reinvite_post) | **POST** /organizations/{orgId}/users/reinvite | -| _OrganizationUsersApi_ | [**organizations_org_id_users_restore_patch**](docs/OrganizationUsersApi.md#organizations_org_id_users_restore_patch) | **PATCH** /organizations/{orgId}/users/restore | -| _OrganizationUsersApi_ | [**organizations_org_id_users_restore_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_restore_put) | **PUT** /organizations/{orgId}/users/restore | -| _OrganizationUsersApi_ | [**organizations_org_id_users_revoke_patch**](docs/OrganizationUsersApi.md#organizations_org_id_users_revoke_patch) | **PATCH** /organizations/{orgId}/users/revoke | -| _OrganizationUsersApi_ | [**organizations_org_id_users_revoke_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_revoke_put) | **PUT** /organizations/{orgId}/users/revoke | -| _OrganizationUsersApi_ | [**organizations_org_id_users_user_id_reset_password_enrollment_put**](docs/OrganizationUsersApi.md#organizations_org_id_users_user_id_reset_password_enrollment_put) | **PUT** /organizations/{orgId}/users/{userId}/reset-password-enrollment | -| _OrganizationsApi_ | [**organizations_get**](docs/OrganizationsApi.md#organizations_get) | **GET** /organizations | -| _OrganizationsApi_ | [**organizations_id_api_key_information_type_get**](docs/OrganizationsApi.md#organizations_id_api_key_information_type_get) | **GET** /organizations/{id}/api-key-information/{type} | -| _OrganizationsApi_ | [**organizations_id_api_key_post**](docs/OrganizationsApi.md#organizations_id_api_key_post) | **POST** /organizations/{id}/api-key | -| _OrganizationsApi_ | [**organizations_id_billing_status_get**](docs/OrganizationsApi.md#organizations_id_billing_status_get) | **GET** /organizations/{id}/billing-status | -| _OrganizationsApi_ | [**organizations_id_cancel_post**](docs/OrganizationsApi.md#organizations_id_cancel_post) | **POST** /organizations/{id}/cancel | -| _OrganizationsApi_ | [**organizations_id_collection_management_put**](docs/OrganizationsApi.md#organizations_id_collection_management_put) | **PUT** /organizations/{id}/collection-management | -| _OrganizationsApi_ | [**organizations_id_delete**](docs/OrganizationsApi.md#organizations_id_delete) | **DELETE** /organizations/{id} | -| _OrganizationsApi_ | [**organizations_id_delete_post**](docs/OrganizationsApi.md#organizations_id_delete_post) | **POST** /organizations/{id}/delete | -| _OrganizationsApi_ | [**organizations_id_delete_recover_token_post**](docs/OrganizationsApi.md#organizations_id_delete_recover_token_post) | **POST** /organizations/{id}/delete-recover-token | -| _OrganizationsApi_ | [**organizations_id_get**](docs/OrganizationsApi.md#organizations_id_get) | **GET** /organizations/{id} | -| _OrganizationsApi_ | [**organizations_id_import_post**](docs/OrganizationsApi.md#organizations_id_import_post) | **POST** /organizations/{id}/import | -| _OrganizationsApi_ | [**organizations_id_keys_get**](docs/OrganizationsApi.md#organizations_id_keys_get) | **GET** /organizations/{id}/keys | -| _OrganizationsApi_ | [**organizations_id_keys_post**](docs/OrganizationsApi.md#organizations_id_keys_post) | **POST** /organizations/{id}/keys | -| _OrganizationsApi_ | [**organizations_id_leave_post**](docs/OrganizationsApi.md#organizations_id_leave_post) | **POST** /organizations/{id}/leave | -| _OrganizationsApi_ | [**organizations_id_license_get**](docs/OrganizationsApi.md#organizations_id_license_get) | **GET** /organizations/{id}/license | -| _OrganizationsApi_ | [**organizations_id_payment_post**](docs/OrganizationsApi.md#organizations_id_payment_post) | **POST** /organizations/{id}/payment | -| _OrganizationsApi_ | [**organizations_id_post**](docs/OrganizationsApi.md#organizations_id_post) | **POST** /organizations/{id} | -| _OrganizationsApi_ | [**organizations_id_public_key_get**](docs/OrganizationsApi.md#organizations_id_public_key_get) | **GET** /organizations/{id}/public-key | -| _OrganizationsApi_ | [**organizations_id_put**](docs/OrganizationsApi.md#organizations_id_put) | **PUT** /organizations/{id} | -| _OrganizationsApi_ | [**organizations_id_reinstate_post**](docs/OrganizationsApi.md#organizations_id_reinstate_post) | **POST** /organizations/{id}/reinstate | -| _OrganizationsApi_ | [**organizations_id_rotate_api_key_post**](docs/OrganizationsApi.md#organizations_id_rotate_api_key_post) | **POST** /organizations/{id}/rotate-api-key | -| _OrganizationsApi_ | [**organizations_id_seat_post**](docs/OrganizationsApi.md#organizations_id_seat_post) | **POST** /organizations/{id}/seat | -| _OrganizationsApi_ | [**organizations_id_sm_subscription_post**](docs/OrganizationsApi.md#organizations_id_sm_subscription_post) | **POST** /organizations/{id}/sm-subscription | -| _OrganizationsApi_ | [**organizations_id_sso_get**](docs/OrganizationsApi.md#organizations_id_sso_get) | **GET** /organizations/{id}/sso | -| _OrganizationsApi_ | [**organizations_id_sso_post**](docs/OrganizationsApi.md#organizations_id_sso_post) | **POST** /organizations/{id}/sso | -| _OrganizationsApi_ | [**organizations_id_storage_post**](docs/OrganizationsApi.md#organizations_id_storage_post) | **POST** /organizations/{id}/storage | -| _OrganizationsApi_ | [**organizations_id_subscribe_secrets_manager_post**](docs/OrganizationsApi.md#organizations_id_subscribe_secrets_manager_post) | **POST** /organizations/{id}/subscribe-secrets-manager | -| _OrganizationsApi_ | [**organizations_id_subscription_get**](docs/OrganizationsApi.md#organizations_id_subscription_get) | **GET** /organizations/{id}/subscription | -| _OrganizationsApi_ | [**organizations_id_subscription_post**](docs/OrganizationsApi.md#organizations_id_subscription_post) | **POST** /organizations/{id}/subscription | -| _OrganizationsApi_ | [**organizations_id_tax_get**](docs/OrganizationsApi.md#organizations_id_tax_get) | **GET** /organizations/{id}/tax | -| _OrganizationsApi_ | [**organizations_id_tax_put**](docs/OrganizationsApi.md#organizations_id_tax_put) | **PUT** /organizations/{id}/tax | -| _OrganizationsApi_ | [**organizations_id_upgrade_post**](docs/OrganizationsApi.md#organizations_id_upgrade_post) | **POST** /organizations/{id}/upgrade | -| _OrganizationsApi_ | [**organizations_id_verify_bank_post**](docs/OrganizationsApi.md#organizations_id_verify_bank_post) | **POST** /organizations/{id}/verify-bank | -| _OrganizationsApi_ | [**organizations_identifier_auto_enroll_status_get**](docs/OrganizationsApi.md#organizations_identifier_auto_enroll_status_get) | **GET** /organizations/{identifier}/auto-enroll-status | -| _OrganizationsApi_ | [**organizations_post**](docs/OrganizationsApi.md#organizations_post) | **POST** /organizations | -| _PlansApi_ | [**plans_get**](docs/PlansApi.md#plans_get) | **GET** /plans | -| _PlansApi_ | [**plans_sales_tax_rates_get**](docs/PlansApi.md#plans_sales_tax_rates_get) | **GET** /plans/sales-tax-rates | -| _PoliciesApi_ | [**organizations_org_id_policies_get**](docs/PoliciesApi.md#organizations_org_id_policies_get) | **GET** /organizations/{orgId}/policies | -| _PoliciesApi_ | [**organizations_org_id_policies_invited_user_get**](docs/PoliciesApi.md#organizations_org_id_policies_invited_user_get) | **GET** /organizations/{orgId}/policies/invited-user | -| _PoliciesApi_ | [**organizations_org_id_policies_master_password_get**](docs/PoliciesApi.md#organizations_org_id_policies_master_password_get) | **GET** /organizations/{orgId}/policies/master-password | -| _PoliciesApi_ | [**organizations_org_id_policies_token_get**](docs/PoliciesApi.md#organizations_org_id_policies_token_get) | **GET** /organizations/{orgId}/policies/token | -| _PoliciesApi_ | [**organizations_org_id_policies_type_get**](docs/PoliciesApi.md#organizations_org_id_policies_type_get) | **GET** /organizations/{orgId}/policies/{type} | -| _PoliciesApi_ | [**organizations_org_id_policies_type_put**](docs/PoliciesApi.md#organizations_org_id_policies_type_put) | **PUT** /organizations/{orgId}/policies/{type} | -| _ProjectsApi_ | [**organizations_organization_id_projects_get**](docs/ProjectsApi.md#organizations_organization_id_projects_get) | **GET** /organizations/{organizationId}/projects | -| _ProjectsApi_ | [**organizations_organization_id_projects_post**](docs/ProjectsApi.md#organizations_organization_id_projects_post) | **POST** /organizations/{organizationId}/projects | -| _ProjectsApi_ | [**projects_delete_post**](docs/ProjectsApi.md#projects_delete_post) | **POST** /projects/delete | -| _ProjectsApi_ | [**projects_id_get**](docs/ProjectsApi.md#projects_id_get) | **GET** /projects/{id} | -| _ProjectsApi_ | [**projects_id_put**](docs/ProjectsApi.md#projects_id_put) | **PUT** /projects/{id} | -| _ProviderBillingApi_ | [**providers_provider_id_billing_invoices_get**](docs/ProviderBillingApi.md#providers_provider_id_billing_invoices_get) | **GET** /providers/{providerId}/billing/invoices | -| _ProviderBillingApi_ | [**providers_provider_id_billing_invoices_invoice_id_get**](docs/ProviderBillingApi.md#providers_provider_id_billing_invoices_invoice_id_get) | **GET** /providers/{providerId}/billing/invoices/{invoiceId} | -| _ProviderBillingApi_ | [**providers_provider_id_billing_subscription_get**](docs/ProviderBillingApi.md#providers_provider_id_billing_subscription_get) | **GET** /providers/{providerId}/billing/subscription | -| _ProviderBillingApi_ | [**providers_provider_id_billing_tax_information_put**](docs/ProviderBillingApi.md#providers_provider_id_billing_tax_information_put) | **PUT** /providers/{providerId}/billing/tax-information | -| _ProviderClientsApi_ | [**providers_provider_id_clients_post**](docs/ProviderClientsApi.md#providers_provider_id_clients_post) | **POST** /providers/{providerId}/clients | -| _ProviderClientsApi_ | [**providers_provider_id_clients_provider_organization_id_put**](docs/ProviderClientsApi.md#providers_provider_id_clients_provider_organization_id_put) | **PUT** /providers/{providerId}/clients/{providerOrganizationId} | -| _ProviderOrganizationsApi_ | [**providers_provider_id_organizations_add_post**](docs/ProviderOrganizationsApi.md#providers_provider_id_organizations_add_post) | **POST** /providers/{providerId}/organizations/add | -| _ProviderOrganizationsApi_ | [**providers_provider_id_organizations_get**](docs/ProviderOrganizationsApi.md#providers_provider_id_organizations_get) | **GET** /providers/{providerId}/organizations | -| _ProviderOrganizationsApi_ | [**providers_provider_id_organizations_id_delete**](docs/ProviderOrganizationsApi.md#providers_provider_id_organizations_id_delete) | **DELETE** /providers/{providerId}/organizations/{id} | -| _ProviderOrganizationsApi_ | [**providers_provider_id_organizations_id_delete_post**](docs/ProviderOrganizationsApi.md#providers_provider_id_organizations_id_delete_post) | **POST** /providers/{providerId}/organizations/{id}/delete | -| _ProviderOrganizationsApi_ | [**providers_provider_id_organizations_post**](docs/ProviderOrganizationsApi.md#providers_provider_id_organizations_post) | **POST** /providers/{providerId}/organizations | -| _ProviderUsersApi_ | [**providers_provider_id_users_confirm_post**](docs/ProviderUsersApi.md#providers_provider_id_users_confirm_post) | **POST** /providers/{providerId}/users/confirm | -| _ProviderUsersApi_ | [**providers_provider_id_users_delete**](docs/ProviderUsersApi.md#providers_provider_id_users_delete) | **DELETE** /providers/{providerId}/users | -| _ProviderUsersApi_ | [**providers_provider_id_users_delete_post**](docs/ProviderUsersApi.md#providers_provider_id_users_delete_post) | **POST** /providers/{providerId}/users/delete | -| _ProviderUsersApi_ | [**providers_provider_id_users_get**](docs/ProviderUsersApi.md#providers_provider_id_users_get) | **GET** /providers/{providerId}/users | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_accept_post**](docs/ProviderUsersApi.md#providers_provider_id_users_id_accept_post) | **POST** /providers/{providerId}/users/{id}/accept | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_confirm_post**](docs/ProviderUsersApi.md#providers_provider_id_users_id_confirm_post) | **POST** /providers/{providerId}/users/{id}/confirm | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_delete**](docs/ProviderUsersApi.md#providers_provider_id_users_id_delete) | **DELETE** /providers/{providerId}/users/{id} | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_delete_post**](docs/ProviderUsersApi.md#providers_provider_id_users_id_delete_post) | **POST** /providers/{providerId}/users/{id}/delete | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_get**](docs/ProviderUsersApi.md#providers_provider_id_users_id_get) | **GET** /providers/{providerId}/users/{id} | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_post**](docs/ProviderUsersApi.md#providers_provider_id_users_id_post) | **POST** /providers/{providerId}/users/{id} | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_put**](docs/ProviderUsersApi.md#providers_provider_id_users_id_put) | **PUT** /providers/{providerId}/users/{id} | -| _ProviderUsersApi_ | [**providers_provider_id_users_id_reinvite_post**](docs/ProviderUsersApi.md#providers_provider_id_users_id_reinvite_post) | **POST** /providers/{providerId}/users/{id}/reinvite | -| _ProviderUsersApi_ | [**providers_provider_id_users_invite_post**](docs/ProviderUsersApi.md#providers_provider_id_users_invite_post) | **POST** /providers/{providerId}/users/invite | -| _ProviderUsersApi_ | [**providers_provider_id_users_public_keys_post**](docs/ProviderUsersApi.md#providers_provider_id_users_public_keys_post) | **POST** /providers/{providerId}/users/public-keys | -| _ProviderUsersApi_ | [**providers_provider_id_users_reinvite_post**](docs/ProviderUsersApi.md#providers_provider_id_users_reinvite_post) | **POST** /providers/{providerId}/users/reinvite | -| _ProvidersApi_ | [**providers_id_delete**](docs/ProvidersApi.md#providers_id_delete) | **DELETE** /providers/{id} | -| _ProvidersApi_ | [**providers_id_delete_post**](docs/ProvidersApi.md#providers_id_delete_post) | **POST** /providers/{id}/delete | -| _ProvidersApi_ | [**providers_id_delete_recover_token_post**](docs/ProvidersApi.md#providers_id_delete_recover_token_post) | **POST** /providers/{id}/delete-recover-token | -| _ProvidersApi_ | [**providers_id_get**](docs/ProvidersApi.md#providers_id_get) | **GET** /providers/{id} | -| _ProvidersApi_ | [**providers_id_post**](docs/ProvidersApi.md#providers_id_post) | **POST** /providers/{id} | -| _ProvidersApi_ | [**providers_id_put**](docs/ProvidersApi.md#providers_id_put) | **PUT** /providers/{id} | -| _ProvidersApi_ | [**providers_id_setup_post**](docs/ProvidersApi.md#providers_id_setup_post) | **POST** /providers/{id}/setup | -| _PushApi_ | [**push_add_organization_put**](docs/PushApi.md#push_add_organization_put) | **PUT** /push/add-organization | -| _PushApi_ | [**push_delete_organization_put**](docs/PushApi.md#push_delete_organization_put) | **PUT** /push/delete-organization | -| _PushApi_ | [**push_delete_post**](docs/PushApi.md#push_delete_post) | **POST** /push/delete | -| _PushApi_ | [**push_register_post**](docs/PushApi.md#push_register_post) | **POST** /push/register | -| _PushApi_ | [**push_send_post**](docs/PushApi.md#push_send_post) | **POST** /push/send | -| _RequestSmAccessApi_ | [**request_access_request_sm_access_post**](docs/RequestSmAccessApi.md#request_access_request_sm_access_post) | **POST** /request-access/request-sm-access | -| _SecretsApi_ | [**organizations_organization_id_secrets_get**](docs/SecretsApi.md#organizations_organization_id_secrets_get) | **GET** /organizations/{organizationId}/secrets | -| _SecretsApi_ | [**organizations_organization_id_secrets_post**](docs/SecretsApi.md#organizations_organization_id_secrets_post) | **POST** /organizations/{organizationId}/secrets | -| _SecretsApi_ | [**organizations_organization_id_secrets_sync_get**](docs/SecretsApi.md#organizations_organization_id_secrets_sync_get) | **GET** /organizations/{organizationId}/secrets/sync | -| _SecretsApi_ | [**projects_project_id_secrets_get**](docs/SecretsApi.md#projects_project_id_secrets_get) | **GET** /projects/{projectId}/secrets | -| _SecretsApi_ | [**secrets_delete_post**](docs/SecretsApi.md#secrets_delete_post) | **POST** /secrets/delete | -| _SecretsApi_ | [**secrets_get_by_ids_post**](docs/SecretsApi.md#secrets_get_by_ids_post) | **POST** /secrets/get-by-ids | -| _SecretsApi_ | [**secrets_id_get**](docs/SecretsApi.md#secrets_id_get) | **GET** /secrets/{id} | -| _SecretsApi_ | [**secrets_id_put**](docs/SecretsApi.md#secrets_id_put) | **PUT** /secrets/{id} | -| _SecretsManagerEventsApi_ | [**sm_events_service_accounts_service_account_id_get**](docs/SecretsManagerEventsApi.md#sm_events_service_accounts_service_account_id_get) | **GET** /sm/events/service-accounts/{serviceAccountId} | -| _SecretsManagerPortingApi_ | [**sm_organization_id_export_get**](docs/SecretsManagerPortingApi.md#sm_organization_id_export_get) | **GET** /sm/{organizationId}/export | -| _SecretsManagerPortingApi_ | [**sm_organization_id_import_post**](docs/SecretsManagerPortingApi.md#sm_organization_id_import_post) | **POST** /sm/{organizationId}/import | -| _SelfHostedOrganizationLicensesApi_ | [**organizations_licenses_self_hosted_id_post**](docs/SelfHostedOrganizationLicensesApi.md#organizations_licenses_self_hosted_id_post) | **POST** /organizations/licenses/self-hosted/{id} | -| _SelfHostedOrganizationLicensesApi_ | [**organizations_licenses_self_hosted_id_sync_post**](docs/SelfHostedOrganizationLicensesApi.md#organizations_licenses_self_hosted_id_sync_post) | **POST** /organizations/licenses/self-hosted/{id}/sync | -| _SelfHostedOrganizationLicensesApi_ | [**organizations_licenses_self_hosted_post**](docs/SelfHostedOrganizationLicensesApi.md#organizations_licenses_self_hosted_post) | **POST** /organizations/licenses/self-hosted | -| _SelfHostedOrganizationSponsorshipsApi_ | [**organization_sponsorship_self_hosted_sponsoring_org_id_delete**](docs/SelfHostedOrganizationSponsorshipsApi.md#organization_sponsorship_self_hosted_sponsoring_org_id_delete) | **DELETE** /organization/sponsorship/self-hosted/{sponsoringOrgId} | -| _SelfHostedOrganizationSponsorshipsApi_ | [**organization_sponsorship_self_hosted_sponsoring_org_id_delete_post**](docs/SelfHostedOrganizationSponsorshipsApi.md#organization_sponsorship_self_hosted_sponsoring_org_id_delete_post) | **POST** /organization/sponsorship/self-hosted/{sponsoringOrgId}/delete | -| _SelfHostedOrganizationSponsorshipsApi_ | [**organization_sponsorship_self_hosted_sponsoring_org_id_families_for_enterprise_post**](docs/SelfHostedOrganizationSponsorshipsApi.md#organization_sponsorship_self_hosted_sponsoring_org_id_families_for_enterprise_post) | **POST** /organization/sponsorship/self-hosted/{sponsoringOrgId}/families-for-enterprise | -| _SendsApi_ | [**sends_access_id_post**](docs/SendsApi.md#sends_access_id_post) | **POST** /sends/access/{id} | -| _SendsApi_ | [**sends_encoded_send_id_access_file_file_id_post**](docs/SendsApi.md#sends_encoded_send_id_access_file_file_id_post) | **POST** /sends/{encodedSendId}/access/file/{fileId} | -| _SendsApi_ | [**sends_file_post**](docs/SendsApi.md#sends_file_post) | **POST** /sends/file | -| _SendsApi_ | [**sends_file_v2_post**](docs/SendsApi.md#sends_file_v2_post) | **POST** /sends/file/v2 | -| _SendsApi_ | [**sends_file_validate_azure_post**](docs/SendsApi.md#sends_file_validate_azure_post) | **POST** /sends/file/validate/azure | -| _SendsApi_ | [**sends_get**](docs/SendsApi.md#sends_get) | **GET** /sends | -| _SendsApi_ | [**sends_id_delete**](docs/SendsApi.md#sends_id_delete) | **DELETE** /sends/{id} | -| _SendsApi_ | [**sends_id_file_file_id_get**](docs/SendsApi.md#sends_id_file_file_id_get) | **GET** /sends/{id}/file/{fileId} | -| _SendsApi_ | [**sends_id_file_file_id_post**](docs/SendsApi.md#sends_id_file_file_id_post) | **POST** /sends/{id}/file/{fileId} | -| _SendsApi_ | [**sends_id_get**](docs/SendsApi.md#sends_id_get) | **GET** /sends/{id} | -| _SendsApi_ | [**sends_id_put**](docs/SendsApi.md#sends_id_put) | **PUT** /sends/{id} | -| _SendsApi_ | [**sends_id_remove_password_put**](docs/SendsApi.md#sends_id_remove_password_put) | **PUT** /sends/{id}/remove-password | -| _SendsApi_ | [**sends_post**](docs/SendsApi.md#sends_post) | **POST** /sends | -| _ServiceAccountsApi_ | [**organizations_organization_id_service_accounts_get**](docs/ServiceAccountsApi.md#organizations_organization_id_service_accounts_get) | **GET** /organizations/{organizationId}/service-accounts | -| _ServiceAccountsApi_ | [**organizations_organization_id_service_accounts_post**](docs/ServiceAccountsApi.md#organizations_organization_id_service_accounts_post) | **POST** /organizations/{organizationId}/service-accounts | -| _ServiceAccountsApi_ | [**service_accounts_delete_post**](docs/ServiceAccountsApi.md#service_accounts_delete_post) | **POST** /service-accounts/delete | -| _ServiceAccountsApi_ | [**service_accounts_id_access_tokens_get**](docs/ServiceAccountsApi.md#service_accounts_id_access_tokens_get) | **GET** /service-accounts/{id}/access-tokens | -| _ServiceAccountsApi_ | [**service_accounts_id_access_tokens_post**](docs/ServiceAccountsApi.md#service_accounts_id_access_tokens_post) | **POST** /service-accounts/{id}/access-tokens | -| _ServiceAccountsApi_ | [**service_accounts_id_access_tokens_revoke_post**](docs/ServiceAccountsApi.md#service_accounts_id_access_tokens_revoke_post) | **POST** /service-accounts/{id}/access-tokens/revoke | -| _ServiceAccountsApi_ | [**service_accounts_id_get**](docs/ServiceAccountsApi.md#service_accounts_id_get) | **GET** /service-accounts/{id} | -| _ServiceAccountsApi_ | [**service_accounts_id_put**](docs/ServiceAccountsApi.md#service_accounts_id_put) | **PUT** /service-accounts/{id} | -| _SettingsApi_ | [**settings_domains_get**](docs/SettingsApi.md#settings_domains_get) | **GET** /settings/domains | -| _SettingsApi_ | [**settings_domains_post**](docs/SettingsApi.md#settings_domains_post) | **POST** /settings/domains | -| _SettingsApi_ | [**settings_domains_put**](docs/SettingsApi.md#settings_domains_put) | **PUT** /settings/domains | -| _StripeApi_ | [**setup_intent_bank_account_post**](docs/StripeApi.md#setup_intent_bank_account_post) | **POST** /setup-intent/bank-account | -| _StripeApi_ | [**setup_intent_card_post**](docs/StripeApi.md#setup_intent_card_post) | **POST** /setup-intent/card | -| _SyncApi_ | [**sync_get**](docs/SyncApi.md#sync_get) | **GET** /sync | -| _TrashApi_ | [**secrets_organization_id_trash_empty_post**](docs/TrashApi.md#secrets_organization_id_trash_empty_post) | **POST** /secrets/{organizationId}/trash/empty | -| _TrashApi_ | [**secrets_organization_id_trash_get**](docs/TrashApi.md#secrets_organization_id_trash_get) | **GET** /secrets/{organizationId}/trash | -| _TrashApi_ | [**secrets_organization_id_trash_restore_post**](docs/TrashApi.md#secrets_organization_id_trash_restore_post) | **POST** /secrets/{organizationId}/trash/restore | -| _TwoFactorApi_ | [**organizations_id_two_factor_disable_post**](docs/TwoFactorApi.md#organizations_id_two_factor_disable_post) | **POST** /organizations/{id}/two-factor/disable | -| _TwoFactorApi_ | [**organizations_id_two_factor_disable_put**](docs/TwoFactorApi.md#organizations_id_two_factor_disable_put) | **PUT** /organizations/{id}/two-factor/disable | -| _TwoFactorApi_ | [**organizations_id_two_factor_duo_post**](docs/TwoFactorApi.md#organizations_id_two_factor_duo_post) | **POST** /organizations/{id}/two-factor/duo | -| _TwoFactorApi_ | [**organizations_id_two_factor_duo_put**](docs/TwoFactorApi.md#organizations_id_two_factor_duo_put) | **PUT** /organizations/{id}/two-factor/duo | -| _TwoFactorApi_ | [**organizations_id_two_factor_get**](docs/TwoFactorApi.md#organizations_id_two_factor_get) | **GET** /organizations/{id}/two-factor | -| _TwoFactorApi_ | [**organizations_id_two_factor_get_duo_post**](docs/TwoFactorApi.md#organizations_id_two_factor_get_duo_post) | **POST** /organizations/{id}/two-factor/get-duo | -| _TwoFactorApi_ | [**two_factor_authenticator_delete**](docs/TwoFactorApi.md#two_factor_authenticator_delete) | **DELETE** /two-factor/authenticator | -| _TwoFactorApi_ | [**two_factor_authenticator_post**](docs/TwoFactorApi.md#two_factor_authenticator_post) | **POST** /two-factor/authenticator | -| _TwoFactorApi_ | [**two_factor_authenticator_put**](docs/TwoFactorApi.md#two_factor_authenticator_put) | **PUT** /two-factor/authenticator | -| _TwoFactorApi_ | [**two_factor_device_verification_settings_put**](docs/TwoFactorApi.md#two_factor_device_verification_settings_put) | **PUT** /two-factor/device-verification-settings | -| _TwoFactorApi_ | [**two_factor_disable_post**](docs/TwoFactorApi.md#two_factor_disable_post) | **POST** /two-factor/disable | -| _TwoFactorApi_ | [**two_factor_disable_put**](docs/TwoFactorApi.md#two_factor_disable_put) | **PUT** /two-factor/disable | -| _TwoFactorApi_ | [**two_factor_duo_post**](docs/TwoFactorApi.md#two_factor_duo_post) | **POST** /two-factor/duo | -| _TwoFactorApi_ | [**two_factor_duo_put**](docs/TwoFactorApi.md#two_factor_duo_put) | **PUT** /two-factor/duo | -| _TwoFactorApi_ | [**two_factor_email_post**](docs/TwoFactorApi.md#two_factor_email_post) | **POST** /two-factor/email | -| _TwoFactorApi_ | [**two_factor_email_put**](docs/TwoFactorApi.md#two_factor_email_put) | **PUT** /two-factor/email | -| _TwoFactorApi_ | [**two_factor_get**](docs/TwoFactorApi.md#two_factor_get) | **GET** /two-factor | -| _TwoFactorApi_ | [**two_factor_get_authenticator_post**](docs/TwoFactorApi.md#two_factor_get_authenticator_post) | **POST** /two-factor/get-authenticator | -| _TwoFactorApi_ | [**two_factor_get_device_verification_settings_get**](docs/TwoFactorApi.md#two_factor_get_device_verification_settings_get) | **GET** /two-factor/get-device-verification-settings | -| _TwoFactorApi_ | [**two_factor_get_duo_post**](docs/TwoFactorApi.md#two_factor_get_duo_post) | **POST** /two-factor/get-duo | -| _TwoFactorApi_ | [**two_factor_get_email_post**](docs/TwoFactorApi.md#two_factor_get_email_post) | **POST** /two-factor/get-email | -| _TwoFactorApi_ | [**two_factor_get_recover_post**](docs/TwoFactorApi.md#two_factor_get_recover_post) | **POST** /two-factor/get-recover | -| _TwoFactorApi_ | [**two_factor_get_webauthn_post**](docs/TwoFactorApi.md#two_factor_get_webauthn_post) | **POST** /two-factor/get-webauthn | -| _TwoFactorApi_ | [**two_factor_get_yubikey_post**](docs/TwoFactorApi.md#two_factor_get_yubikey_post) | **POST** /two-factor/get-yubikey | -| _TwoFactorApi_ | [**two_factor_recover_post**](docs/TwoFactorApi.md#two_factor_recover_post) | **POST** /two-factor/recover | -| _TwoFactorApi_ | [**two_factor_send_email_login_post**](docs/TwoFactorApi.md#two_factor_send_email_login_post) | **POST** /two-factor/send-email-login | -| _TwoFactorApi_ | [**two_factor_send_email_post**](docs/TwoFactorApi.md#two_factor_send_email_post) | **POST** /two-factor/send-email | -| _TwoFactorApi_ | [**two_factor_webauthn_delete**](docs/TwoFactorApi.md#two_factor_webauthn_delete) | **DELETE** /two-factor/webauthn | -| _TwoFactorApi_ | [**two_factor_webauthn_post**](docs/TwoFactorApi.md#two_factor_webauthn_post) | **POST** /two-factor/webauthn | -| _TwoFactorApi_ | [**two_factor_webauthn_put**](docs/TwoFactorApi.md#two_factor_webauthn_put) | **PUT** /two-factor/webauthn | -| _TwoFactorApi_ | [**two_factor_yubikey_post**](docs/TwoFactorApi.md#two_factor_yubikey_post) | **POST** /two-factor/yubikey | -| _TwoFactorApi_ | [**two_factor_yubikey_put**](docs/TwoFactorApi.md#two_factor_yubikey_put) | **PUT** /two-factor/yubikey | -| _UsersApi_ | [**users_id_public_key_get**](docs/UsersApi.md#users_id_public_key_get) | **GET** /users/{id}/public-key | -| _WebAuthnApi_ | [**webauthn_assertion_options_post**](docs/WebAuthnApi.md#webauthn_assertion_options_post) | **POST** /webauthn/assertion-options | -| _WebAuthnApi_ | [**webauthn_attestation_options_post**](docs/WebAuthnApi.md#webauthn_attestation_options_post) | **POST** /webauthn/attestation-options | -| _WebAuthnApi_ | [**webauthn_get**](docs/WebAuthnApi.md#webauthn_get) | **GET** /webauthn | -| _WebAuthnApi_ | [**webauthn_id_delete_post**](docs/WebAuthnApi.md#webauthn_id_delete_post) | **POST** /webauthn/{id}/delete | -| _WebAuthnApi_ | [**webauthn_post**](docs/WebAuthnApi.md#webauthn_post) | **POST** /webauthn | -| _WebAuthnApi_ | [**webauthn_put**](docs/WebAuthnApi.md#webauthn_put) | **PUT** /webauthn | - -## Documentation For Models - -- [AccessPolicyRequest](docs/AccessPolicyRequest.md) -- [AccessTokenCreateRequestModel](docs/AccessTokenCreateRequestModel.md) -- [AccessTokenCreationResponseModel](docs/AccessTokenCreationResponseModel.md) -- [AccessTokenResponseModel](docs/AccessTokenResponseModel.md) -- [AccessTokenResponseModelListResponseModel](docs/AccessTokenResponseModelListResponseModel.md) -- [AdminAuthRequestUpdateRequestModel](docs/AdminAuthRequestUpdateRequestModel.md) -- [Algorithm](docs/Algorithm.md) -- [ApiKeyResponseModel](docs/ApiKeyResponseModel.md) -- [AssertionOptions](docs/AssertionOptions.md) -- [AssertionResponse](docs/AssertionResponse.md) -- [AttachmentRequestModel](docs/AttachmentRequestModel.md) -- [AttachmentResponseModel](docs/AttachmentResponseModel.md) -- [AttachmentUploadDataResponseModel](docs/AttachmentUploadDataResponseModel.md) -- [AttestationConveyancePreference](docs/AttestationConveyancePreference.md) -- [AuthRequestCreateRequestModel](docs/AuthRequestCreateRequestModel.md) -- [AuthRequestResponseModel](docs/AuthRequestResponseModel.md) -- [AuthRequestResponseModelListResponseModel](docs/AuthRequestResponseModelListResponseModel.md) -- [AuthRequestType](docs/AuthRequestType.md) -- [AuthRequestUpdateRequestModel](docs/AuthRequestUpdateRequestModel.md) -- [AuthenticationExtensionsClientInputs](docs/AuthenticationExtensionsClientInputs.md) -- [AuthenticationExtensionsClientOutputs](docs/AuthenticationExtensionsClientOutputs.md) -- [AuthenticatorAssertionRawResponse](docs/AuthenticatorAssertionRawResponse.md) -- [AuthenticatorAttachment](docs/AuthenticatorAttachment.md) -- [AuthenticatorAttestationRawResponse](docs/AuthenticatorAttestationRawResponse.md) -- [AuthenticatorSelection](docs/AuthenticatorSelection.md) -- [AuthenticatorTransport](docs/AuthenticatorTransport.md) -- [BaseSecretResponseModel](docs/BaseSecretResponseModel.md) -- [BaseSecretResponseModelListResponseModel](docs/BaseSecretResponseModelListResponseModel.md) -- [BillingCustomerDiscount](docs/BillingCustomerDiscount.md) -- [BillingHistoryResponseModel](docs/BillingHistoryResponseModel.md) -- [BillingInvoice](docs/BillingInvoice.md) -- [BillingPaymentResponseModel](docs/BillingPaymentResponseModel.md) -- [BillingSource](docs/BillingSource.md) -- [BillingSubscription](docs/BillingSubscription.md) -- [BillingSubscriptionItem](docs/BillingSubscriptionItem.md) -- [BillingSubscriptionUpcomingInvoice](docs/BillingSubscriptionUpcomingInvoice.md) -- [BillingTransaction](docs/BillingTransaction.md) -- [BitPayInvoiceRequestModel](docs/BitPayInvoiceRequestModel.md) -- [BulkCollectionAccessRequestModel](docs/BulkCollectionAccessRequestModel.md) -- [BulkDeleteResponseModel](docs/BulkDeleteResponseModel.md) -- [BulkDeleteResponseModelListResponseModel](docs/BulkDeleteResponseModelListResponseModel.md) -- [BulkDenyAdminAuthRequestRequestModel](docs/BulkDenyAdminAuthRequestRequestModel.md) -- [CipherAttachmentModel](docs/CipherAttachmentModel.md) -- [CipherBulkDeleteRequestModel](docs/CipherBulkDeleteRequestModel.md) -- [CipherBulkMoveRequestModel](docs/CipherBulkMoveRequestModel.md) -- [CipherBulkRestoreRequestModel](docs/CipherBulkRestoreRequestModel.md) -- [CipherBulkShareRequestModel](docs/CipherBulkShareRequestModel.md) -- [CipherBulkUpdateCollectionsRequestModel](docs/CipherBulkUpdateCollectionsRequestModel.md) -- [CipherCardModel](docs/CipherCardModel.md) -- [CipherCollectionsRequestModel](docs/CipherCollectionsRequestModel.md) -- [CipherCreateRequestModel](docs/CipherCreateRequestModel.md) -- [CipherDetailsResponseModel](docs/CipherDetailsResponseModel.md) -- [CipherDetailsResponseModelListResponseModel](docs/CipherDetailsResponseModelListResponseModel.md) -- [CipherFido2CredentialModel](docs/CipherFido2CredentialModel.md) -- [CipherFieldModel](docs/CipherFieldModel.md) -- [CipherIdentityModel](docs/CipherIdentityModel.md) -- [CipherLoginModel](docs/CipherLoginModel.md) -- [CipherLoginUriModel](docs/CipherLoginUriModel.md) -- [CipherMiniDetailsResponseModel](docs/CipherMiniDetailsResponseModel.md) -- [CipherMiniDetailsResponseModelListResponseModel](docs/CipherMiniDetailsResponseModelListResponseModel.md) -- [CipherMiniResponseModel](docs/CipherMiniResponseModel.md) -- [CipherMiniResponseModelListResponseModel](docs/CipherMiniResponseModelListResponseModel.md) -- [CipherPartialRequestModel](docs/CipherPartialRequestModel.md) -- [CipherPasswordHistoryModel](docs/CipherPasswordHistoryModel.md) -- [CipherRepromptType](docs/CipherRepromptType.md) -- [CipherRequestModel](docs/CipherRequestModel.md) -- [CipherResponseModel](docs/CipherResponseModel.md) -- [CipherSecureNoteModel](docs/CipherSecureNoteModel.md) -- [CipherShareRequestModel](docs/CipherShareRequestModel.md) -- [CipherType](docs/CipherType.md) -- [CipherWithIdRequestModel](docs/CipherWithIdRequestModel.md) -- [CollectionAccessDetailsResponseModel](docs/CollectionAccessDetailsResponseModel.md) -- [CollectionAccessDetailsResponseModelListResponseModel](docs/CollectionAccessDetailsResponseModelListResponseModel.md) -- [CollectionBulkDeleteRequestModel](docs/CollectionBulkDeleteRequestModel.md) -- [CollectionDetailsResponseModel](docs/CollectionDetailsResponseModel.md) -- [CollectionDetailsResponseModelListResponseModel](docs/CollectionDetailsResponseModelListResponseModel.md) -- [CollectionRequestModel](docs/CollectionRequestModel.md) -- [CollectionResponseModel](docs/CollectionResponseModel.md) -- [CollectionResponseModelListResponseModel](docs/CollectionResponseModelListResponseModel.md) -- [CollectionWithIdRequestModel](docs/CollectionWithIdRequestModel.md) -- [ConfigResponseModel](docs/ConfigResponseModel.md) -- [CreateClientOrganizationRequestBody](docs/CreateClientOrganizationRequestBody.md) -- [CredentialCreateOptions](docs/CredentialCreateOptions.md) -- [DeleteRecoverRequestModel](docs/DeleteRecoverRequestModel.md) -- [DeviceKeysRequestModel](docs/DeviceKeysRequestModel.md) -- [DeviceKeysUpdateRequestModel](docs/DeviceKeysUpdateRequestModel.md) -- [DeviceRequestModel](docs/DeviceRequestModel.md) -- [DeviceResponseModel](docs/DeviceResponseModel.md) -- [DeviceResponseModelListResponseModel](docs/DeviceResponseModelListResponseModel.md) -- [DeviceTokenRequestModel](docs/DeviceTokenRequestModel.md) -- [DeviceType](docs/DeviceType.md) -- [DeviceVerificationRequestModel](docs/DeviceVerificationRequestModel.md) -- [DeviceVerificationResponseModel](docs/DeviceVerificationResponseModel.md) -- [DomainsResponseModel](docs/DomainsResponseModel.md) -- [EmailRequestModel](docs/EmailRequestModel.md) -- [EmailTokenRequestModel](docs/EmailTokenRequestModel.md) -- [EmergencyAccessGranteeDetailsResponseModel](docs/EmergencyAccessGranteeDetailsResponseModel.md) -- [EmergencyAccessGranteeDetailsResponseModelListResponseModel](docs/EmergencyAccessGranteeDetailsResponseModelListResponseModel.md) -- [EmergencyAccessGrantorDetailsResponseModel](docs/EmergencyAccessGrantorDetailsResponseModel.md) -- [EmergencyAccessGrantorDetailsResponseModelListResponseModel](docs/EmergencyAccessGrantorDetailsResponseModelListResponseModel.md) -- [EmergencyAccessInviteRequestModel](docs/EmergencyAccessInviteRequestModel.md) -- [EmergencyAccessPasswordRequestModel](docs/EmergencyAccessPasswordRequestModel.md) -- [EmergencyAccessStatusType](docs/EmergencyAccessStatusType.md) -- [EmergencyAccessTakeoverResponseModel](docs/EmergencyAccessTakeoverResponseModel.md) -- [EmergencyAccessType](docs/EmergencyAccessType.md) -- [EmergencyAccessUpdateRequestModel](docs/EmergencyAccessUpdateRequestModel.md) -- [EmergencyAccessViewResponseModel](docs/EmergencyAccessViewResponseModel.md) -- [EmergencyAccessWithIdRequestModel](docs/EmergencyAccessWithIdRequestModel.md) -- [EnvironmentConfigResponseModel](docs/EnvironmentConfigResponseModel.md) -- [EventResponseModel](docs/EventResponseModel.md) -- [EventResponseModelListResponseModel](docs/EventResponseModelListResponseModel.md) -- [EventSystemUser](docs/EventSystemUser.md) -- [EventType](docs/EventType.md) -- [ExpandedTaxInfoUpdateRequestModel](docs/ExpandedTaxInfoUpdateRequestModel.md) -- [Fido2User](docs/Fido2User.md) -- [FieldType](docs/FieldType.md) -- [FileUploadType](docs/FileUploadType.md) -- [FolderRequestModel](docs/FolderRequestModel.md) -- [FolderResponseModel](docs/FolderResponseModel.md) -- [FolderResponseModelListResponseModel](docs/FolderResponseModelListResponseModel.md) -- [FolderWithIdRequestModel](docs/FolderWithIdRequestModel.md) -- [GetSecretsRequestModel](docs/GetSecretsRequestModel.md) -- [GlobalDomains](docs/GlobalDomains.md) -- [GlobalEquivalentDomainsType](docs/GlobalEquivalentDomainsType.md) -- [GrantedAccessPolicyRequest](docs/GrantedAccessPolicyRequest.md) -- [GrantedProjectAccessPolicyPermissionDetailsResponseModel](docs/GrantedProjectAccessPolicyPermissionDetailsResponseModel.md) -- [GrantedProjectAccessPolicyResponseModel](docs/GrantedProjectAccessPolicyResponseModel.md) -- [Group](docs/Group.md) -- [GroupAccessPolicyResponseModel](docs/GroupAccessPolicyResponseModel.md) -- [GroupBulkRequestModel](docs/GroupBulkRequestModel.md) -- [GroupDetailsResponseModel](docs/GroupDetailsResponseModel.md) -- [GroupDetailsResponseModelListResponseModel](docs/GroupDetailsResponseModelListResponseModel.md) -- [GroupRequestModel](docs/GroupRequestModel.md) -- [GroupResponseModel](docs/GroupResponseModel.md) -- [ImportCiphersRequestModel](docs/ImportCiphersRequestModel.md) -- [ImportOrganizationCiphersRequestModel](docs/ImportOrganizationCiphersRequestModel.md) -- [ImportOrganizationUsersRequestModel](docs/ImportOrganizationUsersRequestModel.md) -- [InnerProjectExportResponseModel](docs/InnerProjectExportResponseModel.md) -- [InnerProjectImportRequestModel](docs/InnerProjectImportRequestModel.md) -- [InnerSecretExportResponseModel](docs/InnerSecretExportResponseModel.md) -- [InnerSecretImportRequestModel](docs/InnerSecretImportRequestModel.md) -- [InstallationRequestModel](docs/InstallationRequestModel.md) -- [InstallationResponseModel](docs/InstallationResponseModel.md) -- [Int32Int32KeyValuePair](docs/Int32Int32KeyValuePair.md) -- [KdfRequestModel](docs/KdfRequestModel.md) -- [KdfType](docs/KdfType.md) -- [KeyModel](docs/KeyModel.md) -- [KeyPairRequestBody](docs/KeyPairRequestBody.md) -- [KeysRequestModel](docs/KeysRequestModel.md) -- [KeysResponseModel](docs/KeysResponseModel.md) -- [LicenseType](docs/LicenseType.md) -- [MasterPasswordPolicyResponseModel](docs/MasterPasswordPolicyResponseModel.md) -- [MemberDecryptionType](docs/MemberDecryptionType.md) -- [OpenIdConnectRedirectBehavior](docs/OpenIdConnectRedirectBehavior.md) -- [OptionalCipherDetailsResponseModel](docs/OptionalCipherDetailsResponseModel.md) -- [OrganizationApiKeyInformation](docs/OrganizationApiKeyInformation.md) -- [OrganizationApiKeyInformationListResponseModel](docs/OrganizationApiKeyInformationListResponseModel.md) -- [OrganizationApiKeyRequestModel](docs/OrganizationApiKeyRequestModel.md) -- [OrganizationApiKeyType](docs/OrganizationApiKeyType.md) -- [OrganizationAuthRequestUpdateManyRequestModel](docs/OrganizationAuthRequestUpdateManyRequestModel.md) -- [OrganizationAutoEnrollStatusResponseModel](docs/OrganizationAutoEnrollStatusResponseModel.md) -- [OrganizationBillingStatusResponseModel](docs/OrganizationBillingStatusResponseModel.md) -- [OrganizationCollectionManagementUpdateRequestModel](docs/OrganizationCollectionManagementUpdateRequestModel.md) -- [OrganizationConnectionRequestModel](docs/OrganizationConnectionRequestModel.md) -- [OrganizationConnectionResponseModel](docs/OrganizationConnectionResponseModel.md) -- [OrganizationConnectionType](docs/OrganizationConnectionType.md) -- [OrganizationCountsResponseModel](docs/OrganizationCountsResponseModel.md) -- [OrganizationCreateRequestModel](docs/OrganizationCreateRequestModel.md) -- [OrganizationDomainRequestModel](docs/OrganizationDomainRequestModel.md) -- [OrganizationDomainResponseModel](docs/OrganizationDomainResponseModel.md) -- [OrganizationDomainResponseModelListResponseModel](docs/OrganizationDomainResponseModelListResponseModel.md) -- [OrganizationDomainSsoDetailsRequestModel](docs/OrganizationDomainSsoDetailsRequestModel.md) -- [OrganizationDomainSsoDetailsResponseModel](docs/OrganizationDomainSsoDetailsResponseModel.md) -- [OrganizationKeysRequestModel](docs/OrganizationKeysRequestModel.md) -- [OrganizationKeysResponseModel](docs/OrganizationKeysResponseModel.md) -- [OrganizationLicense](docs/OrganizationLicense.md) -- [OrganizationPublicKeyResponseModel](docs/OrganizationPublicKeyResponseModel.md) -- [OrganizationResponseModel](docs/OrganizationResponseModel.md) -- [OrganizationSeatRequestModel](docs/OrganizationSeatRequestModel.md) -- [OrganizationSponsorshipCreateRequestModel](docs/OrganizationSponsorshipCreateRequestModel.md) -- [OrganizationSponsorshipRedeemRequestModel](docs/OrganizationSponsorshipRedeemRequestModel.md) -- [OrganizationSponsorshipRequestModel](docs/OrganizationSponsorshipRequestModel.md) -- [OrganizationSponsorshipResponseModel](docs/OrganizationSponsorshipResponseModel.md) -- [OrganizationSponsorshipSyncRequestModel](docs/OrganizationSponsorshipSyncRequestModel.md) -- [OrganizationSponsorshipSyncResponseModel](docs/OrganizationSponsorshipSyncResponseModel.md) -- [OrganizationSsoRequestModel](docs/OrganizationSsoRequestModel.md) -- [OrganizationSsoResponseModel](docs/OrganizationSsoResponseModel.md) -- [OrganizationSubscriptionResponseModel](docs/OrganizationSubscriptionResponseModel.md) -- [OrganizationSubscriptionUpdateRequestModel](docs/OrganizationSubscriptionUpdateRequestModel.md) -- [OrganizationUpdateRequestModel](docs/OrganizationUpdateRequestModel.md) -- [OrganizationUpgradeRequestModel](docs/OrganizationUpgradeRequestModel.md) -- [OrganizationUserAcceptInitRequestModel](docs/OrganizationUserAcceptInitRequestModel.md) -- [OrganizationUserAcceptRequestModel](docs/OrganizationUserAcceptRequestModel.md) -- [OrganizationUserBulkConfirmRequestModel](docs/OrganizationUserBulkConfirmRequestModel.md) -- [OrganizationUserBulkConfirmRequestModelEntry](docs/OrganizationUserBulkConfirmRequestModelEntry.md) -- [OrganizationUserBulkRequestModel](docs/OrganizationUserBulkRequestModel.md) -- [OrganizationUserBulkResponseModel](docs/OrganizationUserBulkResponseModel.md) -- [OrganizationUserBulkResponseModelListResponseModel](docs/OrganizationUserBulkResponseModelListResponseModel.md) -- [OrganizationUserConfirmRequestModel](docs/OrganizationUserConfirmRequestModel.md) -- [OrganizationUserDetailsResponseModel](docs/OrganizationUserDetailsResponseModel.md) -- [OrganizationUserInviteRequestModel](docs/OrganizationUserInviteRequestModel.md) -- [OrganizationUserPublicKeyResponseModel](docs/OrganizationUserPublicKeyResponseModel.md) -- [OrganizationUserPublicKeyResponseModelListResponseModel](docs/OrganizationUserPublicKeyResponseModelListResponseModel.md) -- [OrganizationUserResetPasswordDetailsResponseModel](docs/OrganizationUserResetPasswordDetailsResponseModel.md) -- [OrganizationUserResetPasswordDetailsResponseModelListResponseModel](docs/OrganizationUserResetPasswordDetailsResponseModelListResponseModel.md) -- [OrganizationUserResetPasswordEnrollmentRequestModel](docs/OrganizationUserResetPasswordEnrollmentRequestModel.md) -- [OrganizationUserResetPasswordRequestModel](docs/OrganizationUserResetPasswordRequestModel.md) -- [OrganizationUserStatusType](docs/OrganizationUserStatusType.md) -- [OrganizationUserType](docs/OrganizationUserType.md) -- [OrganizationUserUpdateRequestModel](docs/OrganizationUserUpdateRequestModel.md) -- [OrganizationUserUserDetailsResponseModel](docs/OrganizationUserUserDetailsResponseModel.md) -- [OrganizationUserUserDetailsResponseModelListResponseModel](docs/OrganizationUserUserDetailsResponseModelListResponseModel.md) -- [OrganizationVerifyBankRequestModel](docs/OrganizationVerifyBankRequestModel.md) -- [OrganizationVerifyDeleteRecoverRequestModel](docs/OrganizationVerifyDeleteRecoverRequestModel.md) -- [OtherDeviceKeysUpdateRequestModel](docs/OtherDeviceKeysUpdateRequestModel.md) -- [PasswordHintRequestModel](docs/PasswordHintRequestModel.md) -- [PasswordManagerPlanFeaturesResponseModel](docs/PasswordManagerPlanFeaturesResponseModel.md) -- [PasswordRequestModel](docs/PasswordRequestModel.md) -- [PaymentMethodType](docs/PaymentMethodType.md) -- [PaymentRequestModel](docs/PaymentRequestModel.md) -- [PaymentResponseModel](docs/PaymentResponseModel.md) -- [PendingOrganizationAuthRequestResponseModel](docs/PendingOrganizationAuthRequestResponseModel.md) -- [PendingOrganizationAuthRequestResponseModelListResponseModel](docs/PendingOrganizationAuthRequestResponseModelListResponseModel.md) -- [PeopleAccessPoliciesRequestModel](docs/PeopleAccessPoliciesRequestModel.md) -- [Permissions](docs/Permissions.md) -- [PlanResponseModel](docs/PlanResponseModel.md) -- [PlanResponseModelListResponseModel](docs/PlanResponseModelListResponseModel.md) -- [PlanSponsorshipType](docs/PlanSponsorshipType.md) -- [PlanType](docs/PlanType.md) -- [PolicyRequestModel](docs/PolicyRequestModel.md) -- [PolicyResponseModel](docs/PolicyResponseModel.md) -- [PolicyResponseModelListResponseModel](docs/PolicyResponseModelListResponseModel.md) -- [PolicyType](docs/PolicyType.md) -- [PotentialGranteeResponseModel](docs/PotentialGranteeResponseModel.md) -- [PotentialGranteeResponseModelListResponseModel](docs/PotentialGranteeResponseModelListResponseModel.md) -- [ProductTierType](docs/ProductTierType.md) -- [ProfileOrganizationResponseModel](docs/ProfileOrganizationResponseModel.md) -- [ProfileOrganizationResponseModelListResponseModel](docs/ProfileOrganizationResponseModelListResponseModel.md) -- [ProfileProviderOrganizationResponseModel](docs/ProfileProviderOrganizationResponseModel.md) -- [ProfileProviderResponseModel](docs/ProfileProviderResponseModel.md) -- [ProfileResponseModel](docs/ProfileResponseModel.md) -- [ProjectCountsResponseModel](docs/ProjectCountsResponseModel.md) -- [ProjectCreateRequestModel](docs/ProjectCreateRequestModel.md) -- [ProjectPeopleAccessPoliciesResponseModel](docs/ProjectPeopleAccessPoliciesResponseModel.md) -- [ProjectResponseModel](docs/ProjectResponseModel.md) -- [ProjectResponseModelListResponseModel](docs/ProjectResponseModelListResponseModel.md) -- [ProjectServiceAccountsAccessPoliciesRequestModel](docs/ProjectServiceAccountsAccessPoliciesRequestModel.md) -- [ProjectServiceAccountsAccessPoliciesResponseModel](docs/ProjectServiceAccountsAccessPoliciesResponseModel.md) -- [ProjectUpdateRequestModel](docs/ProjectUpdateRequestModel.md) -- [ProtectedDeviceResponseModel](docs/ProtectedDeviceResponseModel.md) -- [ProviderOrganizationAddRequestModel](docs/ProviderOrganizationAddRequestModel.md) -- [ProviderOrganizationCreateRequestModel](docs/ProviderOrganizationCreateRequestModel.md) -- [ProviderOrganizationOrganizationDetailsResponseModel](docs/ProviderOrganizationOrganizationDetailsResponseModel.md) -- [ProviderOrganizationOrganizationDetailsResponseModelListResponseModel](docs/ProviderOrganizationOrganizationDetailsResponseModelListResponseModel.md) -- [ProviderOrganizationResponseModel](docs/ProviderOrganizationResponseModel.md) -- [ProviderResponseModel](docs/ProviderResponseModel.md) -- [ProviderSetupRequestModel](docs/ProviderSetupRequestModel.md) -- [ProviderStatusType](docs/ProviderStatusType.md) -- [ProviderType](docs/ProviderType.md) -- [ProviderUpdateRequestModel](docs/ProviderUpdateRequestModel.md) -- [ProviderUserAcceptRequestModel](docs/ProviderUserAcceptRequestModel.md) -- [ProviderUserBulkConfirmRequestModel](docs/ProviderUserBulkConfirmRequestModel.md) -- [ProviderUserBulkConfirmRequestModelEntry](docs/ProviderUserBulkConfirmRequestModelEntry.md) -- [ProviderUserBulkRequestModel](docs/ProviderUserBulkRequestModel.md) -- [ProviderUserBulkResponseModel](docs/ProviderUserBulkResponseModel.md) -- [ProviderUserBulkResponseModelListResponseModel](docs/ProviderUserBulkResponseModelListResponseModel.md) -- [ProviderUserConfirmRequestModel](docs/ProviderUserConfirmRequestModel.md) -- [ProviderUserInviteRequestModel](docs/ProviderUserInviteRequestModel.md) -- [ProviderUserPublicKeyResponseModel](docs/ProviderUserPublicKeyResponseModel.md) -- [ProviderUserPublicKeyResponseModelListResponseModel](docs/ProviderUserPublicKeyResponseModelListResponseModel.md) -- [ProviderUserResponseModel](docs/ProviderUserResponseModel.md) -- [ProviderUserStatusType](docs/ProviderUserStatusType.md) -- [ProviderUserType](docs/ProviderUserType.md) -- [ProviderUserUpdateRequestModel](docs/ProviderUserUpdateRequestModel.md) -- [ProviderUserUserDetailsResponseModel](docs/ProviderUserUserDetailsResponseModel.md) -- [ProviderUserUserDetailsResponseModelListResponseModel](docs/ProviderUserUserDetailsResponseModelListResponseModel.md) -- [ProviderVerifyDeleteRecoverRequestModel](docs/ProviderVerifyDeleteRecoverRequestModel.md) -- [PubKeyCredParam](docs/PubKeyCredParam.md) -- [PublicKeyCredentialDescriptor](docs/PublicKeyCredentialDescriptor.md) -- [PublicKeyCredentialRpEntity](docs/PublicKeyCredentialRpEntity.md) -- [PublicKeyCredentialType](docs/PublicKeyCredentialType.md) -- [PushDeviceRequestModel](docs/PushDeviceRequestModel.md) -- [PushRegistrationRequestModel](docs/PushRegistrationRequestModel.md) -- [PushSendRequestModel](docs/PushSendRequestModel.md) -- [PushType](docs/PushType.md) -- [PushUpdateRequestModel](docs/PushUpdateRequestModel.md) -- [RequestSmAccessRequestModel](docs/RequestSmAccessRequestModel.md) -- [ResetPasswordWithOrgIdRequestModel](docs/ResetPasswordWithOrgIdRequestModel.md) -- [ResponseData](docs/ResponseData.md) -- [RevokeAccessTokensRequest](docs/RevokeAccessTokensRequest.md) -- [Saml2BindingType](docs/Saml2BindingType.md) -- [Saml2NameIdFormat](docs/Saml2NameIdFormat.md) -- [Saml2SigningBehavior](docs/Saml2SigningBehavior.md) -- [SecretAccessPoliciesRequestsModel](docs/SecretAccessPoliciesRequestsModel.md) -- [SecretAccessPoliciesResponseModel](docs/SecretAccessPoliciesResponseModel.md) -- [SecretCreateRequestModel](docs/SecretCreateRequestModel.md) -- [SecretResponseInnerProject](docs/SecretResponseInnerProject.md) -- [SecretResponseModel](docs/SecretResponseModel.md) -- [SecretUpdateRequestModel](docs/SecretUpdateRequestModel.md) -- [SecretVerificationRequestModel](docs/SecretVerificationRequestModel.md) -- [SecretWithProjectsInnerProject](docs/SecretWithProjectsInnerProject.md) -- [SecretWithProjectsListResponseModel](docs/SecretWithProjectsListResponseModel.md) -- [SecretsManagerPlanFeaturesResponseModel](docs/SecretsManagerPlanFeaturesResponseModel.md) -- [SecretsManagerSubscribeRequestModel](docs/SecretsManagerSubscribeRequestModel.md) -- [SecretsManagerSubscriptionUpdateRequestModel](docs/SecretsManagerSubscriptionUpdateRequestModel.md) -- [SecretsSyncResponseModel](docs/SecretsSyncResponseModel.md) -- [SecretsWithProjectsInnerSecret](docs/SecretsWithProjectsInnerSecret.md) -- [SecureNoteType](docs/SecureNoteType.md) -- [SelectionReadOnlyRequestModel](docs/SelectionReadOnlyRequestModel.md) -- [SelectionReadOnlyResponseModel](docs/SelectionReadOnlyResponseModel.md) -- [SelfHostedOrganizationLicenseRequestModel](docs/SelfHostedOrganizationLicenseRequestModel.md) -- [SendAccessRequestModel](docs/SendAccessRequestModel.md) -- [SendFileModel](docs/SendFileModel.md) -- [SendFileUploadDataResponseModel](docs/SendFileUploadDataResponseModel.md) -- [SendRequestModel](docs/SendRequestModel.md) -- [SendResponseModel](docs/SendResponseModel.md) -- [SendResponseModelListResponseModel](docs/SendResponseModelListResponseModel.md) -- [SendTextModel](docs/SendTextModel.md) -- [SendType](docs/SendType.md) -- [SendWithIdRequestModel](docs/SendWithIdRequestModel.md) -- [ServerConfigResponseModel](docs/ServerConfigResponseModel.md) -- [ServiceAccountAccessPolicyResponseModel](docs/ServiceAccountAccessPolicyResponseModel.md) -- [ServiceAccountCountsResponseModel](docs/ServiceAccountCountsResponseModel.md) -- [ServiceAccountCreateRequestModel](docs/ServiceAccountCreateRequestModel.md) -- [ServiceAccountGrantedPoliciesPermissionDetailsResponseModel](docs/ServiceAccountGrantedPoliciesPermissionDetailsResponseModel.md) -- [ServiceAccountGrantedPoliciesRequestModel](docs/ServiceAccountGrantedPoliciesRequestModel.md) -- [ServiceAccountPeopleAccessPoliciesResponseModel](docs/ServiceAccountPeopleAccessPoliciesResponseModel.md) -- [ServiceAccountResponseModel](docs/ServiceAccountResponseModel.md) -- [ServiceAccountSecretsDetailsResponseModel](docs/ServiceAccountSecretsDetailsResponseModel.md) -- [ServiceAccountSecretsDetailsResponseModelListResponseModel](docs/ServiceAccountSecretsDetailsResponseModelListResponseModel.md) -- [ServiceAccountUpdateRequestModel](docs/ServiceAccountUpdateRequestModel.md) -- [SetKeyConnectorKeyRequestModel](docs/SetKeyConnectorKeyRequestModel.md) -- [SetPasswordRequestModel](docs/SetPasswordRequestModel.md) -- [SmExportResponseModel](docs/SmExportResponseModel.md) -- [SmImportRequestModel](docs/SmImportRequestModel.md) -- [SsoConfigurationData](docs/SsoConfigurationData.md) -- [SsoConfigurationDataRequest](docs/SsoConfigurationDataRequest.md) -- [SsoType](docs/SsoType.md) -- [SsoUrls](docs/SsoUrls.md) -- [StorageRequestModel](docs/StorageRequestModel.md) -- [SubscriptionCancellationRequestModel](docs/SubscriptionCancellationRequestModel.md) -- [SubscriptionResponseModel](docs/SubscriptionResponseModel.md) -- [SyncResponseModel](docs/SyncResponseModel.md) -- [TaxInfoResponseModel](docs/TaxInfoResponseModel.md) -- [TaxInfoUpdateRequestModel](docs/TaxInfoUpdateRequestModel.md) -- [TaxInformationRequestBody](docs/TaxInformationRequestBody.md) -- [TaxRateResponseModel](docs/TaxRateResponseModel.md) -- [TaxRateResponseModelListResponseModel](docs/TaxRateResponseModelListResponseModel.md) -- [TransactionType](docs/TransactionType.md) -- [TwoFactorAuthenticatorDisableRequestModel](docs/TwoFactorAuthenticatorDisableRequestModel.md) -- [TwoFactorAuthenticatorResponseModel](docs/TwoFactorAuthenticatorResponseModel.md) -- [TwoFactorDuoResponseModel](docs/TwoFactorDuoResponseModel.md) -- [TwoFactorEmailRequestModel](docs/TwoFactorEmailRequestModel.md) -- [TwoFactorEmailResponseModel](docs/TwoFactorEmailResponseModel.md) -- [TwoFactorProviderRequestModel](docs/TwoFactorProviderRequestModel.md) -- [TwoFactorProviderResponseModel](docs/TwoFactorProviderResponseModel.md) -- [TwoFactorProviderResponseModelListResponseModel](docs/TwoFactorProviderResponseModelListResponseModel.md) -- [TwoFactorProviderType](docs/TwoFactorProviderType.md) -- [TwoFactorRecoverResponseModel](docs/TwoFactorRecoverResponseModel.md) -- [TwoFactorRecoveryRequestModel](docs/TwoFactorRecoveryRequestModel.md) -- [TwoFactorWebAuthnDeleteRequestModel](docs/TwoFactorWebAuthnDeleteRequestModel.md) -- [TwoFactorWebAuthnRequestModel](docs/TwoFactorWebAuthnRequestModel.md) -- [TwoFactorWebAuthnResponseModel](docs/TwoFactorWebAuthnResponseModel.md) -- [TwoFactorYubiKeyResponseModel](docs/TwoFactorYubiKeyResponseModel.md) -- [UpdateAvatarRequestModel](docs/UpdateAvatarRequestModel.md) -- [UpdateClientOrganizationRequestBody](docs/UpdateClientOrganizationRequestBody.md) -- [UpdateDevicesTrustRequestModel](docs/UpdateDevicesTrustRequestModel.md) -- [UpdateDomainsRequestModel](docs/UpdateDomainsRequestModel.md) -- [UpdateKeyRequestModel](docs/UpdateKeyRequestModel.md) -- [UpdateProfileRequestModel](docs/UpdateProfileRequestModel.md) -- [UpdateTdeOffboardingPasswordRequestModel](docs/UpdateTdeOffboardingPasswordRequestModel.md) -- [UpdateTempPasswordRequestModel](docs/UpdateTempPasswordRequestModel.md) -- [UpdateTwoFactorAuthenticatorRequestModel](docs/UpdateTwoFactorAuthenticatorRequestModel.md) -- [UpdateTwoFactorDuoRequestModel](docs/UpdateTwoFactorDuoRequestModel.md) -- [UpdateTwoFactorEmailRequestModel](docs/UpdateTwoFactorEmailRequestModel.md) -- [UpdateTwoFactorYubicoOtpRequestModel](docs/UpdateTwoFactorYubicoOtpRequestModel.md) -- [UriMatchType](docs/UriMatchType.md) -- [User](docs/User.md) -- [UserAccessPolicyResponseModel](docs/UserAccessPolicyResponseModel.md) -- [UserKeyResponseModel](docs/UserKeyResponseModel.md) -- [UserLicense](docs/UserLicense.md) -- [UserVerificationRequirement](docs/UserVerificationRequirement.md) -- [VerifyDeleteRecoverRequestModel](docs/VerifyDeleteRecoverRequestModel.md) -- [VerifyEmailRequestModel](docs/VerifyEmailRequestModel.md) -- [VerifyOtpRequestModel](docs/VerifyOtpRequestModel.md) -- [WebAuthnCredentialCreateOptionsResponseModel](docs/WebAuthnCredentialCreateOptionsResponseModel.md) -- [WebAuthnCredentialResponseModel](docs/WebAuthnCredentialResponseModel.md) -- [WebAuthnCredentialResponseModelListResponseModel](docs/WebAuthnCredentialResponseModelListResponseModel.md) -- [WebAuthnLoginAssertionOptionsResponseModel](docs/WebAuthnLoginAssertionOptionsResponseModel.md) -- [WebAuthnLoginCredentialCreateRequestModel](docs/WebAuthnLoginCredentialCreateRequestModel.md) -- [WebAuthnLoginCredentialUpdateRequestModel](docs/WebAuthnLoginCredentialUpdateRequestModel.md) -- [WebAuthnLoginRotateKeyRequestModel](docs/WebAuthnLoginRotateKeyRequestModel.md) -- [WebAuthnPrfStatus](docs/WebAuthnPrfStatus.md) - -To get access to the crate's generated documentation, use: - -``` -cargo doc --open -``` - -## Author diff --git a/crates/bitwarden-api-api/src/apis/access_policies_api.rs b/crates/bitwarden-api-api/src/apis/access_policies_api.rs deleted file mode 100644 index e97a9d567..000000000 --- a/crates/bitwarden-api-api/src/apis/access_policies_api.rs +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method -/// [`organizations_id_access_policies_people_potential_grantees_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdAccessPoliciesPeoplePotentialGranteesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_id_access_policies_projects_potential_grantees_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdAccessPoliciesProjectsPotentialGranteesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_id_access_policies_service_accounts_potential_grantees_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdAccessPoliciesServiceAccountsPotentialGranteesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_id_access_policies_people_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsIdAccessPoliciesPeopleGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_id_access_policies_people_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsIdAccessPoliciesPeoplePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_id_access_policies_service_accounts_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsIdAccessPoliciesServiceAccountsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_id_access_policies_service_accounts_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsIdAccessPoliciesServiceAccountsPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`secrets_secret_id_access_policies_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsSecretIdAccessPoliciesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_access_policies_people_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdAccessPoliciesPeopleGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_access_policies_people_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdAccessPoliciesPeoplePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_granted_policies_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdGrantedPoliciesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_granted_policies_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdGrantedPoliciesPutError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_id_access_policies_people_potential_grantees_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::PotentialGranteeResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/access-policies/people/potential-grantees", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_access_policies_projects_potential_grantees_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::PotentialGranteeResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/access-policies/projects/potential-grantees", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option< - OrganizationsIdAccessPoliciesProjectsPotentialGranteesGetError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_access_policies_service_accounts_potential_grantees_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::PotentialGranteeResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/access-policies/service-accounts/potential-grantees", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option< - OrganizationsIdAccessPoliciesServiceAccountsPotentialGranteesGetError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_id_access_policies_people_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::ProjectPeopleAccessPoliciesResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{id}/access-policies/people", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_id_access_policies_people_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - people_access_policies_request_model: Option, -) -> Result< - models::ProjectPeopleAccessPoliciesResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{id}/access-policies/people", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&people_access_policies_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_id_access_policies_service_accounts_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::ProjectServiceAccountsAccessPoliciesResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{id}/access-policies/service-accounts", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_id_access_policies_service_accounts_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - project_service_accounts_access_policies_request_model: Option< - models::ProjectServiceAccountsAccessPoliciesRequestModel, - >, -) -> Result< - models::ProjectServiceAccountsAccessPoliciesResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{id}/access-policies/service-accounts", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&project_service_accounts_access_policies_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn secrets_secret_id_access_policies_get( - configuration: &configuration::Configuration, - secret_id: uuid::Uuid, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/secrets/{secretId}/access-policies", - local_var_configuration.base_path, - secretId = crate::apis::urlencode(secret_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_access_policies_people_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::ServiceAccountPeopleAccessPoliciesResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}/access-policies/people", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_access_policies_people_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - people_access_policies_request_model: Option, -) -> Result< - models::ServiceAccountPeopleAccessPoliciesResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}/access-policies/people", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&people_access_policies_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_granted_policies_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::ServiceAccountGrantedPoliciesPermissionDetailsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}/granted-policies", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_granted_policies_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - service_account_granted_policies_request_model: Option< - models::ServiceAccountGrantedPoliciesRequestModel, - >, -) -> Result< - models::ServiceAccountGrantedPoliciesPermissionDetailsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}/granted-policies", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&service_account_granted_policies_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/accounts_api.rs b/crates/bitwarden-api-api/src/apis/accounts_api.rs deleted file mode 100644 index d4a5321f1..000000000 --- a/crates/bitwarden-api-api/src/apis/accounts_api.rs +++ /dev/null @@ -1,2147 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`accounts_api_key_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsApiKeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_avatar_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsAvatarPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_avatar_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsAvatarPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_cancel_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsCancelPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_convert_to_key_connector_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsConvertToKeyConnectorPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_delete_recover_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsDeleteRecoverPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_delete_recover_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsDeleteRecoverTokenPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_email_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsEmailPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_email_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsEmailTokenPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_kdf_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsKdfPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_key_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsKeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_keys_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsKeysGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_keys_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsKeysPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_license_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsLicensePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_organizations_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsOrganizationsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_password_hint_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsPasswordHintPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_password_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsPasswordPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_payment_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsPaymentPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_premium_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsPremiumPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_profile_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsProfileGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_profile_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsProfilePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_profile_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsProfilePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_reinstate_premium_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsReinstatePremiumPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_request_otp_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsRequestOtpPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_revision_date_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsRevisionDateGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_rotate_api_key_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsRotateApiKeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_security_stamp_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsSecurityStampPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_set_key_connector_key_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsSetKeyConnectorKeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_set_password_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsSetPasswordPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_sso_organization_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsSsoOrganizationIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_sso_user_identifier_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsSsoUserIdentifierGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_storage_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsStoragePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_subscription_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsSubscriptionGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_tax_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsTaxGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_tax_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsTaxPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_update_tde_offboarding_password_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsUpdateTdeOffboardingPasswordPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_update_temp_password_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsUpdateTempPasswordPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_verify_email_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsVerifyEmailPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_verify_email_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsVerifyEmailTokenPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_verify_otp_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsVerifyOtpPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_verify_password_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsVerifyPasswordPostError { - UnknownValue(serde_json::Value), -} - -pub async fn accounts_api_key_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/api-key", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_avatar_post( - configuration: &configuration::Configuration, - update_avatar_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/avatar", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_avatar_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_avatar_put( - configuration: &configuration::Configuration, - update_avatar_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/avatar", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_avatar_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_cancel_post( - configuration: &configuration::Configuration, - subscription_cancellation_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/cancel", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&subscription_cancellation_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_convert_to_key_connector_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/convert-to-key-connector", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_delete( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_delete_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/delete", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_delete_recover_post( - configuration: &configuration::Configuration, - delete_recover_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/delete-recover", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&delete_recover_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_delete_recover_token_post( - configuration: &configuration::Configuration, - verify_delete_recover_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/delete-recover-token", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&verify_delete_recover_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_email_post( - configuration: &configuration::Configuration, - email_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/email", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_email_token_post( - configuration: &configuration::Configuration, - email_token_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/email-token", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&email_token_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_kdf_post( - configuration: &configuration::Configuration, - kdf_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/kdf", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&kdf_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_key_post( - configuration: &configuration::Configuration, - update_key_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/key", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_key_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_keys_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/keys", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_keys_post( - configuration: &configuration::Configuration, - keys_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/keys", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&keys_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_license_post( - configuration: &configuration::Configuration, - license: std::path::PathBuf, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/license", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - let mut local_var_form = reqwest::multipart::Form::new(); - // TODO: support file upload for 'license' parameter - local_var_req_builder = local_var_req_builder.multipart(local_var_form); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_organizations_get( - configuration: &configuration::Configuration, -) -> Result< - models::ProfileOrganizationResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/organizations", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_password_hint_post( - configuration: &configuration::Configuration, - password_hint_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/password-hint", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&password_hint_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_password_post( - configuration: &configuration::Configuration, - password_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/password", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&password_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_payment_post( - configuration: &configuration::Configuration, - payment_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/payment", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&payment_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_premium_post( - configuration: &configuration::Configuration, - payment_method_type: models::PaymentMethodType, - payment_token: Option<&str>, - additional_storage_gb: Option, - country: Option<&str>, - postal_code: Option<&str>, - license: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/premium", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - local_var_req_builder = - local_var_req_builder.query(&[("paymentMethodType", &payment_method_type.to_string())]); - if let Some(ref local_var_str) = payment_token { - local_var_req_builder = - local_var_req_builder.query(&[("paymentToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = additional_storage_gb { - local_var_req_builder = - local_var_req_builder.query(&[("additionalStorageGb", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = country { - local_var_req_builder = - local_var_req_builder.query(&[("country", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = postal_code { - local_var_req_builder = - local_var_req_builder.query(&[("postalCode", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - let mut local_var_form = reqwest::multipart::Form::new(); - // TODO: support file upload for 'license' parameter - local_var_req_builder = local_var_req_builder.multipart(local_var_form); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_profile_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/profile", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_profile_post( - configuration: &configuration::Configuration, - update_profile_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/profile", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_profile_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_profile_put( - configuration: &configuration::Configuration, - update_profile_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/profile", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_profile_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_reinstate_premium_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/reinstate-premium", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_request_otp_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/request-otp", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_revision_date_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/revision-date", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_rotate_api_key_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/rotate-api-key", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_security_stamp_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/security-stamp", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_set_key_connector_key_post( - configuration: &configuration::Configuration, - set_key_connector_key_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/set-key-connector-key", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&set_key_connector_key_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_set_password_post( - configuration: &configuration::Configuration, - set_password_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/set-password", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&set_password_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_sso_organization_id_delete( - configuration: &configuration::Configuration, - organization_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/sso/{organizationId}", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_sso_user_identifier_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/sso/user-identifier", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_storage_post( - configuration: &configuration::Configuration, - storage_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/storage", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&storage_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_subscription_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/subscription", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_tax_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/tax", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_tax_put( - configuration: &configuration::Configuration, - tax_info_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/tax", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&tax_info_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_update_tde_offboarding_password_put( - configuration: &configuration::Configuration, - update_tde_offboarding_password_request_model: Option< - models::UpdateTdeOffboardingPasswordRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/update-tde-offboarding-password", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&update_tde_offboarding_password_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_update_temp_password_put( - configuration: &configuration::Configuration, - update_temp_password_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/update-temp-password", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_temp_password_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_verify_email_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/verify-email", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_verify_email_token_post( - configuration: &configuration::Configuration, - verify_email_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/verify-email-token", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&verify_email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_verify_otp_post( - configuration: &configuration::Configuration, - verify_otp_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/verify-otp", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&verify_otp_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_verify_password_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/verify-password", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/accounts_billing_api.rs b/crates/bitwarden-api-api/src/apis/accounts_billing_api.rs deleted file mode 100644 index 99306bb9d..000000000 --- a/crates/bitwarden-api-api/src/apis/accounts_billing_api.rs +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`accounts_billing_history_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsBillingHistoryGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_billing_payment_method_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsBillingPaymentMethodGetError { - UnknownValue(serde_json::Value), -} - -pub async fn accounts_billing_history_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/billing/history", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_billing_payment_method_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/billing/payment-method", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/auth_requests_api.rs b/crates/bitwarden-api-api/src/apis/auth_requests_api.rs deleted file mode 100644 index aaddb061c..000000000 --- a/crates/bitwarden-api-api/src/apis/auth_requests_api.rs +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`auth_requests_admin_request_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AuthRequestsAdminRequestPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`auth_requests_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AuthRequestsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`auth_requests_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AuthRequestsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`auth_requests_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AuthRequestsIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`auth_requests_id_response_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AuthRequestsIdResponseGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`auth_requests_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AuthRequestsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn auth_requests_admin_request_post( - configuration: &configuration::Configuration, - auth_request_create_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/auth-requests/admin-request", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&auth_request_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn auth_requests_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth-requests", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn auth_requests_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/auth-requests/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn auth_requests_id_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - auth_request_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/auth-requests/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&auth_request_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn auth_requests_id_response_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, - code: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/auth-requests/{id}/response", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = code { - local_var_req_builder = - local_var_req_builder.query(&[("code", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn auth_requests_post( - configuration: &configuration::Configuration, - auth_request_create_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth-requests", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&auth_request_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/ciphers_api.rs b/crates/bitwarden-api-api/src/apis/ciphers_api.rs deleted file mode 100644 index e0a522560..000000000 --- a/crates/bitwarden-api-api/src/apis/ciphers_api.rs +++ /dev/null @@ -1,2995 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`ciphers_admin_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersAdminDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_admin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersAdminPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_attachment_validate_azure_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersAttachmentValidateAzurePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_bulk_collections_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersBulkCollectionsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_create_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersCreatePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_delete_admin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersDeleteAdminPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_delete_admin_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersDeleteAdminPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_delete_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersDeletePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_admin_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAdminDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_admin_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAdminGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_admin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAdminPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_admin_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAdminPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_admin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAdminPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_admin_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdAdminDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_delete_admin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdDeleteAdminPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_renew_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdRenewGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_share_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentAttachmentIdSharePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_attachment_v2_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdAttachmentV2PostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_collections_admin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdCollectionsAdminPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_collections_admin_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdCollectionsAdminPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_collections_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdCollectionsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_collections_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdCollectionsPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_collections_v2_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdCollectionsV2PostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_collections_v2_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdCollectionsV2PutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_delete_admin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdDeleteAdminPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_delete_admin_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdDeleteAdminPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_delete_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdDeletePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_details_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdDetailsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_full_details_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdFullDetailsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_partial_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdPartialPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_partial_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdPartialPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_restore_admin_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdRestoreAdminPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_restore_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdRestorePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_share_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdSharePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_id_share_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdSharePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_move_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersMovePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_move_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersMovePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_organization_details_assigned_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersOrganizationDetailsAssignedGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_organization_details_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersOrganizationDetailsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_purge_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersPurgePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_restore_admin_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersRestoreAdminPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_restore_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersRestorePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_share_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersSharePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_share_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersSharePutError { - UnknownValue(serde_json::Value), -} - -pub async fn ciphers_admin_delete( - configuration: &configuration::Configuration, - cipher_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/admin", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_admin_post( - configuration: &configuration::Configuration, - cipher_create_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/admin", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_attachment_validate_azure_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/attachment/validate/azure", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_bulk_collections_post( - configuration: &configuration::Configuration, - cipher_bulk_update_collections_request_model: Option< - models::CipherBulkUpdateCollectionsRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/bulk-collections", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&cipher_bulk_update_collections_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_create_post( - configuration: &configuration::Configuration, - cipher_create_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/create", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_delete( - configuration: &configuration::Configuration, - cipher_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_delete_admin_post( - configuration: &configuration::Configuration, - cipher_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/delete-admin", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_delete_admin_put( - configuration: &configuration::Configuration, - cipher_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/delete-admin", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_delete_post( - configuration: &configuration::Configuration, - cipher_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/delete", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_delete_put( - configuration: &configuration::Configuration, - cipher_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/delete", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_admin_delete( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_admin_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_admin_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_admin_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_admin_post( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment-admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_admin_delete( - configuration: &configuration::Configuration, - id: &str, - attachment_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}/admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_delete( - configuration: &configuration::Configuration, - id: uuid::Uuid, - attachment_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_delete_admin_post( - configuration: &configuration::Configuration, - id: &str, - attachment_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}/delete-admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_delete_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - attachment_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, - attachment_id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - attachment_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_renew_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, - attachment_id: &str, -) -> Result< - models::AttachmentUploadDataResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}/renew", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_attachment_id_share_post( - configuration: &configuration::Configuration, - id: &str, - attachment_id: &str, - organization_id: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/{attachmentId}/share", - local_var_configuration.base_path, - id = crate::apis::urlencode(id), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = organization_id { - local_var_req_builder = - local_var_req_builder.query(&[("organizationId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_attachment_v2_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - attachment_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/attachment/v2", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&attachment_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_collections_admin_post( - configuration: &configuration::Configuration, - id: &str, - cipher_collections_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/collections-admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_collections_admin_put( - configuration: &configuration::Configuration, - id: &str, - cipher_collections_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/collections-admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_collections_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_collections_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/collections", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_collections_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_collections_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/collections", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_collections_v2_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_collections_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/collections_v2", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_collections_v2_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_collections_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/collections_v2", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_collections_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_delete( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_delete_admin_post( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/delete-admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_delete_admin_put( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/delete-admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_delete_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_delete_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_details_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/details", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_full_details_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/full-details", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_partial_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_partial_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/partial", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_partial_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_partial_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_partial_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/partial", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_partial_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_restore_admin_put( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/restore-admin", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_restore_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/restore", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_share_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_share_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/share", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_share_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_id_share_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_share_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/share", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_share_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_move_post( - configuration: &configuration::Configuration, - cipher_bulk_move_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/move", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_move_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_move_put( - configuration: &configuration::Configuration, - cipher_bulk_move_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/move", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_move_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_organization_details_assigned_get( - configuration: &configuration::Configuration, - organization_id: Option, -) -> Result< - models::CipherDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/organization-details/assigned", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = organization_id { - local_var_req_builder = - local_var_req_builder.query(&[("organizationId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_organization_details_get( - configuration: &configuration::Configuration, - organization_id: Option, -) -> Result< - models::CipherMiniDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/organization-details", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = organization_id { - local_var_req_builder = - local_var_req_builder.query(&[("organizationId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_post( - configuration: &configuration::Configuration, - cipher_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_purge_post( - configuration: &configuration::Configuration, - organization_id: Option<&str>, - secret_verification_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/purge", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = organization_id { - local_var_req_builder = - local_var_req_builder.query(&[("organizationId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_restore_admin_put( - configuration: &configuration::Configuration, - cipher_bulk_restore_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/restore-admin", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_restore_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_restore_put( - configuration: &configuration::Configuration, - cipher_bulk_restore_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/restore", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_restore_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_share_post( - configuration: &configuration::Configuration, - cipher_bulk_share_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/share", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_share_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_share_put( - configuration: &configuration::Configuration, - cipher_bulk_share_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/share", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cipher_bulk_share_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/collections_api.rs b/crates/bitwarden-api-api/src/apis/collections_api.rs deleted file mode 100644 index 2da881e7a..000000000 --- a/crates/bitwarden-api-api/src/apis/collections_api.rs +++ /dev/null @@ -1,929 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`collections_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CollectionsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_bulk_access_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsBulkAccessPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_details_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsDetailsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_org_id_collections_id_delete_user_org_user_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdDeleteUserOrgUserIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_details_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdDetailsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_org_id_collections_id_user_org_user_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdUserOrgUserIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_users_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdUsersGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_id_users_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsIdUsersPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_collections_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdCollectionsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn collections_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/collections", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_bulk_access_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - bulk_collection_access_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/bulk-access", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&bulk_collection_access_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_delete( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - collection_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&collection_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_delete_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - collection_bulk_delete_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/delete", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&collection_bulk_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_details_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, -) -> Result< - models::CollectionAccessDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/details", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, -) -> Result< - models::CollectionResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_delete( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_delete_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}/delete", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_delete_user_org_user_id_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - org_user_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}/delete-user/{orgUserId}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()), - orgUserId = crate::apis::urlencode(org_user_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_details_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result< - models::CollectionAccessDetailsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}/details", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - collection_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&collection_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - collection_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&collection_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_user_org_user_id_delete( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - org_user_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}/user/{orgUserId}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()), - orgUserId = crate::apis::urlencode(org_user_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_users_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result< - Vec, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}/users", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_id_users_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - selection_read_only_request_model: Option>, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections/{id}/users", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&selection_read_only_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_collections_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - collection_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/collections", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&collection_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/config_api.rs b/crates/bitwarden-api-api/src/apis/config_api.rs deleted file mode 100644 index e9b862825..000000000 --- a/crates/bitwarden-api-api/src/apis/config_api.rs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`config_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ConfigGetError { - UnknownValue(serde_json::Value), -} - -pub async fn config_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/config", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/configuration.rs b/crates/bitwarden-api-api/src/apis/configuration.rs deleted file mode 100644 index 83d56c8a5..000000000 --- a/crates/bitwarden-api-api/src/apis/configuration.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -#[derive(Debug, Clone)] -pub struct Configuration { - pub base_path: String, - pub user_agent: Option, - pub client: reqwest::Client, - pub basic_auth: Option, - pub oauth_access_token: Option, - pub bearer_access_token: Option, - pub api_key: Option, - // TODO: take an oauth2 token source, similar to the go one -} - -pub type BasicAuth = (String, Option); - -#[derive(Debug, Clone)] -pub struct ApiKey { - pub prefix: Option, - pub key: String, -} - -impl Configuration { - pub fn new() -> Configuration { - Configuration::default() - } -} - -impl Default for Configuration { - fn default() -> Self { - Configuration { - base_path: "http://localhost".to_owned(), - user_agent: Some("OpenAPI-Generator/latest/rust".to_owned()), - client: reqwest::Client::new(), - basic_auth: None, - oauth_access_token: None, - bearer_access_token: None, - api_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/apis/counts_api.rs b/crates/bitwarden-api-api/src/apis/counts_api.rs deleted file mode 100644 index 5331d91fa..000000000 --- a/crates/bitwarden-api-api/src/apis/counts_api.rs +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_organization_id_sm_counts_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdSmCountsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_project_id_sm_counts_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsProjectIdSmCountsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_service_account_id_sm_counts_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsServiceAccountIdSmCountsGetError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_organization_id_sm_counts_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result< - models::OrganizationCountsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/sm-counts", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_project_id_sm_counts_get( - configuration: &configuration::Configuration, - project_id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{projectId}/sm-counts", - local_var_configuration.base_path, - projectId = crate::apis::urlencode(project_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_service_account_id_sm_counts_get( - configuration: &configuration::Configuration, - service_account_id: uuid::Uuid, -) -> Result< - models::ServiceAccountCountsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{serviceAccountId}/sm-counts", - local_var_configuration.base_path, - serviceAccountId = crate::apis::urlencode(service_account_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/devices_api.rs b/crates/bitwarden-api-api/src/apis/devices_api.rs deleted file mode 100644 index 4b3b65980..000000000 --- a/crates/bitwarden-api-api/src/apis/devices_api.rs +++ /dev/null @@ -1,985 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`devices_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_identifier_clear_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierIdentifierClearTokenPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_identifier_clear_token_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierIdentifierClearTokenPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_identifier_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierIdentifierGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_identifier_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierIdentifierTokenPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_identifier_token_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierIdentifierTokenPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_keys_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierKeysPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_keys_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierKeysPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_identifier_retrieve_keys_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesIdentifierRetrieveKeysPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_knowndevice_email_identifier_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesKnowndeviceEmailIdentifierGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_knowndevice_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesKnowndeviceGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_lost_trust_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesLostTrustPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`devices_update_trust_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DevicesUpdateTrustPostError { - UnknownValue(serde_json::Value), -} - -pub async fn devices_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/devices", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_id_delete( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_id_delete_post( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_id_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_id_post( - configuration: &configuration::Configuration, - id: &str, - device_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_id_put( - configuration: &configuration::Configuration, - id: &str, - device_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_identifier_clear_token_post( - configuration: &configuration::Configuration, - identifier: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/identifier/{identifier}/clear-token", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_identifier_clear_token_put( - configuration: &configuration::Configuration, - identifier: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/identifier/{identifier}/clear-token", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_identifier_get( - configuration: &configuration::Configuration, - identifier: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/identifier/{identifier}", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_identifier_token_post( - configuration: &configuration::Configuration, - identifier: &str, - device_token_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/identifier/{identifier}/token", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_token_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_identifier_token_put( - configuration: &configuration::Configuration, - identifier: &str, - device_token_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/identifier/{identifier}/token", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_token_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_keys_post( - configuration: &configuration::Configuration, - identifier: &str, - device_keys_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{identifier}/keys", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_keys_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_keys_put( - configuration: &configuration::Configuration, - identifier: &str, - device_keys_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{identifier}/keys", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_keys_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_identifier_retrieve_keys_post( - configuration: &configuration::Configuration, - identifier: &str, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/{identifier}/retrieve-keys", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_knowndevice_email_identifier_get( - configuration: &configuration::Configuration, - email: &str, - identifier: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/devices/knowndevice/{email}/{identifier}", - local_var_configuration.base_path, - email = crate::apis::urlencode(email), - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_knowndevice_get( - configuration: &configuration::Configuration, - x_request_email: &str, - x_device_identifier: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/devices/knowndevice", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = - local_var_req_builder.header("x-Request-Email", x_request_email.to_string()); - local_var_req_builder = - local_var_req_builder.header("x-Device-Identifier", x_device_identifier.to_string()); - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_lost_trust_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/devices/lost-trust", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_post( - configuration: &configuration::Configuration, - device_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/devices", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn devices_update_trust_post( - configuration: &configuration::Configuration, - update_devices_trust_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/devices/update-trust", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_devices_trust_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/emergency_access_api.rs b/crates/bitwarden-api-api/src/apis/emergency_access_api.rs deleted file mode 100644 index 8a42a8432..000000000 --- a/crates/bitwarden-api-api/src/apis/emergency_access_api.rs +++ /dev/null @@ -1,1005 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`emergency_access_granted_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessGrantedGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_accept_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdAcceptPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_approve_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdApprovePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_cipher_id_attachment_attachment_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdCipherIdAttachmentAttachmentIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_confirm_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdConfirmPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_initiate_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdInitiatePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_password_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdPasswordPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_policies_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdPoliciesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_reinvite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdReinvitePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_reject_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdRejectPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_takeover_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdTakeoverPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_id_view_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessIdViewPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_invite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessInvitePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`emergency_access_trusted_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EmergencyAccessTrustedGetError { - UnknownValue(serde_json::Value), -} - -pub async fn emergency_access_granted_get( - configuration: &configuration::Configuration, -) -> Result< - models::EmergencyAccessGrantorDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/granted", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_accept_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_user_accept_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/accept", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_accept_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_approve_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/approve", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_cipher_id_attachment_attachment_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, - cipher_id: uuid::Uuid, - attachment_id: &str, -) -> Result< - models::AttachmentResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/{cipherId}/attachment/{attachmentId}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()), - cipherId = crate::apis::urlencode(cipher_id.to_string()), - attachmentId = crate::apis::urlencode(attachment_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_confirm_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_user_confirm_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/confirm", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_confirm_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_delete( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_delete_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_initiate_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/initiate", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_password_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - emergency_access_password_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/password", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&emergency_access_password_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_policies_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/policies", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - emergency_access_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&emergency_access_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - emergency_access_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&emergency_access_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_reinvite_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/reinvite", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_reject_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/reject", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_takeover_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/takeover", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_id_view_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/{id}/view", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_invite_post( - configuration: &configuration::Configuration, - emergency_access_invite_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/invite", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&emergency_access_invite_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn emergency_access_trusted_get( - configuration: &configuration::Configuration, -) -> Result< - models::EmergencyAccessGranteeDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/emergency-access/trusted", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/events_api.rs b/crates/bitwarden-api-api/src/apis/events_api.rs deleted file mode 100644 index 127bc835b..000000000 --- a/crates/bitwarden-api-api/src/apis/events_api.rs +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`ciphers_id_events_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersIdEventsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`events_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum EventsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_events_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdEventsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_events_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdEventsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_events_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdEventsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_events_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdEventsGetError { - UnknownValue(serde_json::Value), -} - -pub async fn ciphers_id_events_get( - configuration: &configuration::Configuration, - id: &str, - start: Option, - end: Option, - continuation_token: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/{id}/events", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = start { - local_var_req_builder = - local_var_req_builder.query(&[("start", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = end { - local_var_req_builder = local_var_req_builder.query(&[("end", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = continuation_token { - local_var_req_builder = - local_var_req_builder.query(&[("continuationToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn events_get( - configuration: &configuration::Configuration, - start: Option, - end: Option, - continuation_token: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/events", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = start { - local_var_req_builder = - local_var_req_builder.query(&[("start", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = end { - local_var_req_builder = local_var_req_builder.query(&[("end", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = continuation_token { - local_var_req_builder = - local_var_req_builder.query(&[("continuationToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_events_get( - configuration: &configuration::Configuration, - id: &str, - start: Option, - end: Option, - continuation_token: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/events", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = start { - local_var_req_builder = - local_var_req_builder.query(&[("start", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = end { - local_var_req_builder = local_var_req_builder.query(&[("end", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = continuation_token { - local_var_req_builder = - local_var_req_builder.query(&[("continuationToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_events_get( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, - start: Option, - end: Option, - continuation_token: Option<&str>, -) -> Result< - models::EventResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/events", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = start { - local_var_req_builder = - local_var_req_builder.query(&[("start", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = end { - local_var_req_builder = local_var_req_builder.query(&[("end", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = continuation_token { - local_var_req_builder = - local_var_req_builder.query(&[("continuationToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_events_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - start: Option, - end: Option, - continuation_token: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/events", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = start { - local_var_req_builder = - local_var_req_builder.query(&[("start", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = end { - local_var_req_builder = local_var_req_builder.query(&[("end", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = continuation_token { - local_var_req_builder = - local_var_req_builder.query(&[("continuationToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_events_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, - start: Option, - end: Option, - continuation_token: Option<&str>, -) -> Result< - models::EventResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}/events", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = start { - local_var_req_builder = - local_var_req_builder.query(&[("start", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = end { - local_var_req_builder = local_var_req_builder.query(&[("end", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = continuation_token { - local_var_req_builder = - local_var_req_builder.query(&[("continuationToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/folders_api.rs b/crates/bitwarden-api-api/src/apis/folders_api.rs deleted file mode 100644 index 4e5ff597a..000000000 --- a/crates/bitwarden-api-api/src/apis/folders_api.rs +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`folders_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum FoldersGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`folders_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum FoldersIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`folders_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum FoldersIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`folders_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum FoldersIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`folders_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum FoldersIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`folders_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum FoldersIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`folders_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum FoldersPostError { - UnknownValue(serde_json::Value), -} - -pub async fn folders_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/folders", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn folders_id_delete( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/folders/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn folders_id_delete_post( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/folders/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn folders_id_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/folders/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn folders_id_post( - configuration: &configuration::Configuration, - id: &str, - folder_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/folders/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&folder_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn folders_id_put( - configuration: &configuration::Configuration, - id: &str, - folder_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/folders/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&folder_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn folders_post( - configuration: &configuration::Configuration, - folder_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/folders", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&folder_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/groups_api.rs b/crates/bitwarden-api-api/src/apis/groups_api.rs deleted file mode 100644 index be59e4b83..000000000 --- a/crates/bitwarden-api-api/src/apis/groups_api.rs +++ /dev/null @@ -1,714 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_org_id_groups_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_org_id_groups_id_delete_user_org_user_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdDeleteUserOrgUserIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_details_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdDetailsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_user_org_user_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdUserOrgUserIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_id_users_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsIdUsersGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_groups_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdGroupsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_org_id_groups_delete( - configuration: &configuration::Configuration, - org_id: &str, - group_bulk_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&group_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_delete_post( - configuration: &configuration::Configuration, - org_id: &str, - group_bulk_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/delete", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&group_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, -) -> Result< - models::GroupDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_delete( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_delete_post( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}/delete", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_delete_user_org_user_id_post( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, - org_user_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}/delete-user/{orgUserId}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id), - orgUserId = crate::apis::urlencode(org_user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_details_get( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}/details", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_get( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - group_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&group_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - group_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&group_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_user_org_user_id_delete( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, - org_user_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}/user/{orgUserId}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id), - orgUserId = crate::apis::urlencode(org_user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_id_users_get( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups/{id}/users", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_groups_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - group_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/groups", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&group_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/hibp_api.rs b/crates/bitwarden-api-api/src/apis/hibp_api.rs deleted file mode 100644 index 4a20084cf..000000000 --- a/crates/bitwarden-api-api/src/apis/hibp_api.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`hibp_breach_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum HibpBreachGetError { - UnknownValue(serde_json::Value), -} - -pub async fn hibp_breach_get( - configuration: &configuration::Configuration, - username: Option<&str>, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/hibp/breach", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = username { - local_var_req_builder = - local_var_req_builder.query(&[("username", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/import_ciphers_api.rs b/crates/bitwarden-api-api/src/apis/import_ciphers_api.rs deleted file mode 100644 index 8044cfd17..000000000 --- a/crates/bitwarden-api-api/src/apis/import_ciphers_api.rs +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`ciphers_import_organization_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersImportOrganizationPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ciphers_import_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CiphersImportPostError { - UnknownValue(serde_json::Value), -} - -pub async fn ciphers_import_organization_post( - configuration: &configuration::Configuration, - organization_id: Option<&str>, - import_organization_ciphers_request_model: Option< - models::ImportOrganizationCiphersRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/ciphers/import-organization", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = organization_id { - local_var_req_builder = - local_var_req_builder.query(&[("organizationId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&import_organization_ciphers_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ciphers_import_post( - configuration: &configuration::Configuration, - import_ciphers_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ciphers/import", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&import_ciphers_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/info_api.rs b/crates/bitwarden-api-api/src/apis/info_api.rs deleted file mode 100644 index e59a4403b..000000000 --- a/crates/bitwarden-api-api/src/apis/info_api.rs +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`alive_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AliveGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`ip_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum IpGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`now_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum NowGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`version_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum VersionGetError { - UnknownValue(serde_json::Value), -} - -pub async fn alive_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/alive", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn ip_get(configuration: &configuration::Configuration) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/ip", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn now_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/now", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn version_get( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/version", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/installations_api.rs b/crates/bitwarden-api-api/src/apis/installations_api.rs deleted file mode 100644 index 9ba527a07..000000000 --- a/crates/bitwarden-api-api/src/apis/installations_api.rs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`installations_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum InstallationsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`installations_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum InstallationsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn installations_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/installations/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn installations_post( - configuration: &configuration::Configuration, - installation_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/installations", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&installation_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/licenses_api.rs b/crates/bitwarden-api-api/src/apis/licenses_api.rs deleted file mode 100644 index 2c4907223..000000000 --- a/crates/bitwarden-api-api/src/apis/licenses_api.rs +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`licenses_organization_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum LicensesOrganizationIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`licenses_user_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum LicensesUserIdGetError { - UnknownValue(serde_json::Value), -} - -pub async fn licenses_organization_id_get( - configuration: &configuration::Configuration, - id: &str, - self_hosted_organization_license_request_model: Option< - models::SelfHostedOrganizationLicenseRequestModel, - >, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/licenses/organization/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&self_hosted_organization_license_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn licenses_user_id_get( - configuration: &configuration::Configuration, - id: &str, - key: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/licenses/user/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = key { - local_var_req_builder = local_var_req_builder.query(&[("key", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/misc_api.rs b/crates/bitwarden-api-api/src/apis/misc_api.rs deleted file mode 100644 index 1468eb6f2..000000000 --- a/crates/bitwarden-api-api/src/apis/misc_api.rs +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`bitpay_invoice_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum BitpayInvoicePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`setup_payment_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SetupPaymentPostError { - UnknownValue(serde_json::Value), -} - -pub async fn bitpay_invoice_post( - configuration: &configuration::Configuration, - bit_pay_invoice_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/bitpay-invoice", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&bit_pay_invoice_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn setup_payment_post( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/setup-payment", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/mod.rs b/crates/bitwarden-api-api/src/apis/mod.rs deleted file mode 100644 index 0b0e68fde..000000000 --- a/crates/bitwarden-api-api/src/apis/mod.rs +++ /dev/null @@ -1,146 +0,0 @@ -use std::{error, fmt}; - -#[derive(Debug, Clone)] -pub struct ResponseContent { - pub status: reqwest::StatusCode, - pub content: String, - pub entity: Option, -} - -#[derive(Debug)] -pub enum Error { - Reqwest(reqwest::Error), - Serde(serde_json::Error), - Io(std::io::Error), - ResponseError(ResponseContent), -} - -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let (module, e) = match self { - Error::Reqwest(e) => ("reqwest", e.to_string()), - Error::Serde(e) => ("serde", e.to_string()), - Error::Io(e) => ("IO", e.to_string()), - Error::ResponseError(e) => ("response", format!("status code {}", e.status)), - }; - write!(f, "error in {}: {}", module, e) - } -} - -impl error::Error for Error { - fn source(&self) -> Option<&(dyn error::Error + 'static)> { - Some(match self { - Error::Reqwest(e) => e, - Error::Serde(e) => e, - Error::Io(e) => e, - Error::ResponseError(_) => return None, - }) - } -} - -impl From for Error { - fn from(e: reqwest::Error) -> Self { - Error::Reqwest(e) - } -} - -impl From for Error { - fn from(e: serde_json::Error) -> Self { - Error::Serde(e) - } -} - -impl From for Error { - fn from(e: std::io::Error) -> Self { - Error::Io(e) - } -} - -pub fn urlencode>(s: T) -> String { - ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() -} - -pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { - if let serde_json::Value::Object(object) = value { - let mut params = vec![]; - - for (key, value) in object { - match value { - serde_json::Value::Object(_) => params.append(&mut parse_deep_object( - &format!("{}[{}]", prefix, key), - value, - )), - serde_json::Value::Array(array) => { - for (i, value) in array.iter().enumerate() { - params.append(&mut parse_deep_object( - &format!("{}[{}][{}]", prefix, key, i), - value, - )); - } - } - serde_json::Value::String(s) => { - params.push((format!("{}[{}]", prefix, key), s.clone())) - } - _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), - } - } - - return params; - } - - unimplemented!("Only objects are supported with style=deepObject") -} - -pub mod access_policies_api; -pub mod accounts_api; -pub mod accounts_billing_api; -pub mod auth_requests_api; -pub mod ciphers_api; -pub mod collections_api; -pub mod config_api; -pub mod counts_api; -pub mod devices_api; -pub mod emergency_access_api; -pub mod events_api; -pub mod folders_api; -pub mod groups_api; -pub mod hibp_api; -pub mod import_ciphers_api; -pub mod info_api; -pub mod installations_api; -pub mod licenses_api; -pub mod misc_api; -pub mod organization_auth_requests_api; -pub mod organization_billing_api; -pub mod organization_connections_api; -pub mod organization_domain_api; -pub mod organization_export_api; -pub mod organization_sponsorships_api; -pub mod organization_users_api; -pub mod organizations_api; -pub mod plans_api; -pub mod policies_api; -pub mod projects_api; -pub mod provider_billing_api; -pub mod provider_clients_api; -pub mod provider_organizations_api; -pub mod provider_users_api; -pub mod providers_api; -pub mod push_api; -pub mod request_sm_access_api; -pub mod secrets_api; -pub mod secrets_manager_events_api; -pub mod secrets_manager_porting_api; -pub mod self_hosted_organization_licenses_api; -pub mod self_hosted_organization_sponsorships_api; -pub mod sends_api; -pub mod service_accounts_api; -pub mod settings_api; -pub mod stripe_api; -pub mod sync_api; -pub mod trash_api; -pub mod two_factor_api; -pub mod users_api; -pub mod web_authn_api; - -pub mod configuration; diff --git a/crates/bitwarden-api-api/src/apis/organization_auth_requests_api.rs b/crates/bitwarden-api-api/src/apis/organization_auth_requests_api.rs deleted file mode 100644 index 44e4ca9e9..000000000 --- a/crates/bitwarden-api-api/src/apis/organization_auth_requests_api.rs +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_org_id_auth_requests_deny_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdAuthRequestsDenyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_auth_requests_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdAuthRequestsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_auth_requests_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdAuthRequestsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_auth_requests_request_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdAuthRequestsRequestIdPostError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_org_id_auth_requests_deny_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - bulk_deny_admin_auth_request_request_model: Option< - models::BulkDenyAdminAuthRequestRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/auth-requests/deny", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&bulk_deny_admin_auth_request_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_auth_requests_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, -) -> Result< - models::PendingOrganizationAuthRequestResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/auth-requests", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_auth_requests_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_auth_request_update_many_request_model: Option< - Vec, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/auth-requests", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_auth_request_update_many_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_auth_requests_request_id_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - request_id: uuid::Uuid, - admin_auth_request_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/auth-requests/{requestId}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - requestId = crate::apis::urlencode(request_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&admin_auth_request_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/organization_billing_api.rs b/crates/bitwarden-api-api/src/apis/organization_billing_api.rs deleted file mode 100644 index 5ae42d921..000000000 --- a/crates/bitwarden-api-api/src/apis/organization_billing_api.rs +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_organization_id_billing_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdBillingGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_organization_id_billing_history_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdBillingHistoryGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_organization_id_billing_metadata_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdBillingMetadataGetError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_organization_id_billing_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/billing", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_organization_id_billing_history_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/billing/history", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_organization_id_billing_metadata_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/billing/metadata", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/organization_connections_api.rs b/crates/bitwarden-api-api/src/apis/organization_connections_api.rs deleted file mode 100644 index ca65dd754..000000000 --- a/crates/bitwarden-api-api/src/apis/organization_connections_api.rs +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_connections_enabled_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsConnectionsEnabledGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_connections_organization_connection_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsConnectionsOrganizationConnectionIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_connections_organization_connection_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsConnectionsOrganizationConnectionIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_connections_organization_connection_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsConnectionsOrganizationConnectionIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_connections_organization_id_type_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsConnectionsOrganizationIdTypeGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_connections_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsConnectionsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_connections_enabled_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/connections/enabled", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_connections_organization_connection_id_delete( - configuration: &configuration::Configuration, - organization_connection_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/connections/{organizationConnectionId}", - local_var_configuration.base_path, - organizationConnectionId = crate::apis::urlencode(organization_connection_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_connections_organization_connection_id_delete_post( - configuration: &configuration::Configuration, - organization_connection_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/connections/{organizationConnectionId}/delete", - local_var_configuration.base_path, - organizationConnectionId = crate::apis::urlencode(organization_connection_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option< - OrganizationsConnectionsOrganizationConnectionIdDeletePostError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_connections_organization_connection_id_put( - configuration: &configuration::Configuration, - organization_connection_id: uuid::Uuid, - organization_connection_request_model: Option, -) -> Result< - models::OrganizationConnectionResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/connections/{organizationConnectionId}", - local_var_configuration.base_path, - organizationConnectionId = crate::apis::urlencode(organization_connection_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_connection_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_connections_organization_id_type_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - r#type: models::OrganizationConnectionType, -) -> Result< - models::OrganizationConnectionResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/organizations/connections/{organizationId}/{type}", local_var_configuration.base_path, organizationId=crate::apis::urlencode(organization_id.to_string()), type=r#type.to_string()); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_connections_post( - configuration: &configuration::Configuration, - organization_connection_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/connections", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_connection_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/organization_domain_api.rs b/crates/bitwarden-api-api/src/apis/organization_domain_api.rs deleted file mode 100644 index 5d3f87055..000000000 --- a/crates/bitwarden-api-api/src/apis/organization_domain_api.rs +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_domain_sso_details_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsDomainSsoDetailsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_domain_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdDomainGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_domain_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdDomainIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_domain_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdDomainIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_domain_id_remove_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdDomainIdRemovePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_domain_id_verify_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdDomainIdVerifyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_domain_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdDomainPostError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_domain_sso_details_post( - configuration: &configuration::Configuration, - organization_domain_sso_details_request_model: Option< - models::OrganizationDomainSsoDetailsRequestModel, - >, -) -> Result< - models::OrganizationDomainSsoDetailsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/domain/sso/details", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_domain_sso_details_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_domain_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, -) -> Result< - models::OrganizationDomainResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/domain", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_domain_id_delete( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/domain/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_domain_id_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/domain/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_domain_id_remove_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/domain/{id}/remove", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_domain_id_verify_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/domain/{id}/verify", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_domain_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_domain_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/domain", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_domain_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/organization_export_api.rs b/crates/bitwarden-api-api/src/apis/organization_export_api.rs deleted file mode 100644 index e224c7b86..000000000 --- a/crates/bitwarden-api-api/src/apis/organization_export_api.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_organization_id_export_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdExportGetError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_organization_id_export_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/export", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/organization_sponsorships_api.rs b/crates/bitwarden-api-api/src/apis/organization_sponsorships_api.rs deleted file mode 100644 index dbf9c0f8c..000000000 --- a/crates/bitwarden-api-api/src/apis/organization_sponsorships_api.rs +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organization_sponsorship_redeem_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipRedeemPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organization_sponsorship_sponsored_sponsored_org_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSponsoredSponsoredOrgIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organization_sponsorship_sponsored_sponsored_org_id_remove_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSponsoredSponsoredOrgIdRemovePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organization_sponsorship_sponsoring_org_id_families_for_enterprise_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSponsoringOrgIdFamiliesForEnterprisePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organization_sponsorship_sponsoring_org_id_families_for_enterprise_resend_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSponsoringOrgIdFamiliesForEnterpriseResendPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organization_sponsorship_sponsoring_org_id_sync_status_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSponsoringOrgIdSyncStatusGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organization_sponsorship_sponsoring_organization_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSponsoringOrganizationIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organization_sponsorship_sponsoring_organization_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSponsoringOrganizationIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organization_sponsorship_sync_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSyncPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organization_sponsorship_validate_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipValidateTokenPostError { - UnknownValue(serde_json::Value), -} - -pub async fn organization_sponsorship_redeem_post( - configuration: &configuration::Configuration, - sponsorship_token: Option<&str>, - organization_sponsorship_redeem_request_model: Option< - models::OrganizationSponsorshipRedeemRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/redeem", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = sponsorship_token { - local_var_req_builder = - local_var_req_builder.query(&[("sponsorshipToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_sponsorship_redeem_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sponsored_sponsored_org_id_delete( - configuration: &configuration::Configuration, - sponsored_org_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/sponsored/{sponsoredOrgId}", - local_var_configuration.base_path, - sponsoredOrgId = crate::apis::urlencode(sponsored_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sponsored_sponsored_org_id_remove_post( - configuration: &configuration::Configuration, - sponsored_org_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/sponsored/{sponsoredOrgId}/remove", - local_var_configuration.base_path, - sponsoredOrgId = crate::apis::urlencode(sponsored_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option< - OrganizationSponsorshipSponsoredSponsoredOrgIdRemovePostError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sponsoring_org_id_families_for_enterprise_post( - configuration: &configuration::Configuration, - sponsoring_org_id: uuid::Uuid, - organization_sponsorship_create_request_model: Option< - models::OrganizationSponsorshipCreateRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/{sponsoringOrgId}/families-for-enterprise", - local_var_configuration.base_path, - sponsoringOrgId = crate::apis::urlencode(sponsoring_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_sponsorship_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option< - OrganizationSponsorshipSponsoringOrgIdFamiliesForEnterprisePostError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sponsoring_org_id_families_for_enterprise_resend_post( - configuration: &configuration::Configuration, - sponsoring_org_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/{sponsoringOrgId}/families-for-enterprise/resend", - local_var_configuration.base_path, - sponsoringOrgId = crate::apis::urlencode(sponsoring_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option< - OrganizationSponsorshipSponsoringOrgIdFamiliesForEnterpriseResendPostError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sponsoring_org_id_sync_status_get( - configuration: &configuration::Configuration, - sponsoring_org_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/{sponsoringOrgId}/sync-status", - local_var_configuration.base_path, - sponsoringOrgId = crate::apis::urlencode(sponsoring_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sponsoring_organization_id_delete( - configuration: &configuration::Configuration, - sponsoring_organization_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/{sponsoringOrganizationId}", - local_var_configuration.base_path, - sponsoringOrganizationId = crate::apis::urlencode(sponsoring_organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sponsoring_organization_id_delete_post( - configuration: &configuration::Configuration, - sponsoring_organization_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/{sponsoringOrganizationId}/delete", - local_var_configuration.base_path, - sponsoringOrganizationId = crate::apis::urlencode(sponsoring_organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option< - OrganizationSponsorshipSponsoringOrganizationIdDeletePostError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_sync_post( - configuration: &configuration::Configuration, - organization_sponsorship_sync_request_model: Option< - models::OrganizationSponsorshipSyncRequestModel, - >, -) -> Result< - models::OrganizationSponsorshipSyncResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/sync", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_sponsorship_sync_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_validate_token_post( - configuration: &configuration::Configuration, - sponsorship_token: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/validate-token", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = sponsorship_token { - local_var_req_builder = - local_var_req_builder.query(&[("sponsorshipToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/organization_users_api.rs b/crates/bitwarden-api-api/src/apis/organization_users_api.rs deleted file mode 100644 index c5eafb9c9..000000000 --- a/crates/bitwarden-api-api/src/apis/organization_users_api.rs +++ /dev/null @@ -1,1737 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_org_id_users_account_recovery_details_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersAccountRecoveryDetailsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_confirm_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersConfirmPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_enable_secrets_manager_patch`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersEnableSecretsManagerPatchError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_enable_secrets_manager_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersEnableSecretsManagerPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_confirm_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdConfirmPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_groups_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdGroupsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_reinvite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdReinvitePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_reset_password_details_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdResetPasswordDetailsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_reset_password_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdResetPasswordPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_restore_patch`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdRestorePatchError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_restore_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdRestorePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_revoke_patch`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdRevokePatchError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_id_revoke_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersIdRevokePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_invite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersInvitePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_org_id_users_organization_user_id_accept_init_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersOrganizationUserIdAcceptInitPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_org_id_users_organization_user_id_accept_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersOrganizationUserIdAcceptPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_public_keys_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersPublicKeysPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_reinvite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersReinvitePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_restore_patch`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersRestorePatchError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_restore_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersRestorePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_revoke_patch`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersRevokePatchError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_users_revoke_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersRevokePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organizations_org_id_users_user_id_reset_password_enrollment_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdUsersUserIdResetPasswordEnrollmentPutError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_org_id_users_account_recovery_details_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserResetPasswordDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/account-recovery-details", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_confirm_post( - configuration: &configuration::Configuration, - org_id: &str, - organization_user_bulk_confirm_request_model: Option< - models::OrganizationUserBulkConfirmRequestModel, - >, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/confirm", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_user_bulk_confirm_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_delete( - configuration: &configuration::Configuration, - org_id: &str, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_delete_post( - configuration: &configuration::Configuration, - org_id: &str, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/delete", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_enable_secrets_manager_patch( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_bulk_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/enable-secrets-manager", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_enable_secrets_manager_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_bulk_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/enable-secrets-manager", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - include_groups: Option, - include_collections: Option, -) -> Result< - models::OrganizationUserUserDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = include_groups { - local_var_req_builder = - local_var_req_builder.query(&[("includeGroups", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = include_collections { - local_var_req_builder = - local_var_req_builder.query(&[("includeCollections", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_confirm_post( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, - organization_user_confirm_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/confirm", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_confirm_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_delete( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_delete_post( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/delete", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_get( - configuration: &configuration::Configuration, - id: &str, - org_id: &str, - include_groups: Option, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id), - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = include_groups { - local_var_req_builder = - local_var_req_builder.query(&[("includeGroups", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_groups_get( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/groups", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - organization_user_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, - organization_user_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_reinvite_post( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/reinvite", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_reset_password_details_get( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, -) -> Result< - models::OrganizationUserResetPasswordDetailsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/reset-password-details", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_reset_password_put( - configuration: &configuration::Configuration, - org_id: &str, - id: &str, - organization_user_reset_password_request_model: Option< - models::OrganizationUserResetPasswordRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/reset-password", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id), - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_user_reset_password_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_restore_patch( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/restore", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_restore_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/restore", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_revoke_patch( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/revoke", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_id_revoke_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{id}/revoke", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_invite_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_invite_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/invite", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_invite_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_organization_user_id_accept_init_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_id: uuid::Uuid, - organization_user_accept_init_request_model: Option< - models::OrganizationUserAcceptInitRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{organizationUserId}/accept-init", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - organizationUserId = crate::apis::urlencode(organization_user_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_user_accept_init_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_organization_user_id_accept_post( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_id: uuid::Uuid, - organization_user_accept_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{organizationUserId}/accept", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - organizationUserId = crate::apis::urlencode(organization_user_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_accept_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_public_keys_post( - configuration: &configuration::Configuration, - org_id: &str, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserPublicKeyResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/public-keys", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_reinvite_post( - configuration: &configuration::Configuration, - org_id: &str, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/reinvite", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_restore_patch( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/restore", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_restore_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/restore", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_revoke_patch( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/revoke", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_revoke_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - organization_user_bulk_request_model: Option, -) -> Result< - models::OrganizationUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/revoke", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_users_user_id_reset_password_enrollment_put( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - user_id: uuid::Uuid, - organization_user_reset_password_enrollment_request_model: Option< - models::OrganizationUserResetPasswordEnrollmentRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/users/{userId}/reset-password-enrollment", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()), - userId = crate::apis::urlencode(user_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_user_reset_password_enrollment_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/organizations_api.rs b/crates/bitwarden-api-api/src/apis/organizations_api.rs deleted file mode 100644 index fd88331dd..000000000 --- a/crates/bitwarden-api-api/src/apis/organizations_api.rs +++ /dev/null @@ -1,1862 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_api_key_information_type_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdApiKeyInformationTypeGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_api_key_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdApiKeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_billing_status_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdBillingStatusGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_cancel_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdCancelPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_collection_management_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdCollectionManagementPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_delete_recover_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdDeleteRecoverTokenPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_import_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdImportPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_keys_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdKeysGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_keys_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdKeysPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_leave_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdLeavePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_license_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdLicenseGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_payment_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdPaymentPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_public_key_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdPublicKeyGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_reinstate_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdReinstatePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_rotate_api_key_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdRotateApiKeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_seat_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdSeatPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_sm_subscription_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdSmSubscriptionPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_sso_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdSsoGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_sso_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdSsoPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_storage_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdStoragePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_subscribe_secrets_manager_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdSubscribeSecretsManagerPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_subscription_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdSubscriptionGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_subscription_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdSubscriptionPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_tax_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTaxGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_tax_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTaxPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_upgrade_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdUpgradePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_verify_bank_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdVerifyBankPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_identifier_auto_enroll_status_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdentifierAutoEnrollStatusGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_get( - configuration: &configuration::Configuration, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/organizations", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_api_key_information_type_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, - r#type: models::OrganizationApiKeyType, -) -> Result< - models::OrganizationApiKeyInformationListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/organizations/{id}/api-key-information/{type}", local_var_configuration.base_path, id=crate::apis::urlencode(id.to_string()), type=r#type.to_string()); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_api_key_post( - configuration: &configuration::Configuration, - id: &str, - organization_api_key_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/api-key", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_api_key_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_billing_status_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::OrganizationBillingStatusResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/billing-status", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_cancel_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - subscription_cancellation_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/cancel", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&subscription_cancellation_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_collection_management_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_collection_management_update_request_model: Option< - models::OrganizationCollectionManagementUpdateRequestModel, - >, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/collection-management", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_collection_management_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_delete( - configuration: &configuration::Configuration, - id: &str, - secret_verification_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_delete_post( - configuration: &configuration::Configuration, - id: &str, - secret_verification_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_delete_recover_token_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_verify_delete_recover_request_model: Option< - models::OrganizationVerifyDeleteRecoverRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/delete-recover-token", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_verify_delete_recover_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_import_post( - configuration: &configuration::Configuration, - id: &str, - import_organization_users_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/import", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&import_organization_users_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_keys_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/keys", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_keys_post( - configuration: &configuration::Configuration, - id: &str, - organization_keys_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/keys", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_keys_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_leave_post( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/leave", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_license_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, - installation_id: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/license", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = installation_id { - local_var_req_builder = - local_var_req_builder.query(&[("installationId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_payment_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - payment_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/payment", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&payment_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_post( - configuration: &configuration::Configuration, - id: &str, - organization_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_public_key_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/public-key", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_put( - configuration: &configuration::Configuration, - id: &str, - organization_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_reinstate_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/reinstate", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_rotate_api_key_post( - configuration: &configuration::Configuration, - id: &str, - organization_api_key_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/rotate-api-key", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_api_key_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_seat_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_seat_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/seat", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_seat_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_sm_subscription_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - secrets_manager_subscription_update_request_model: Option< - models::SecretsManagerSubscriptionUpdateRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/sm-subscription", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&secrets_manager_subscription_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_sso_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/sso", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_sso_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_sso_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/sso", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_sso_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_storage_post( - configuration: &configuration::Configuration, - id: &str, - storage_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/storage", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&storage_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_subscribe_secrets_manager_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - secrets_manager_subscribe_request_model: Option, -) -> Result< - models::ProfileOrganizationResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/subscribe-secrets-manager", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secrets_manager_subscribe_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_subscription_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/subscription", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_subscription_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_subscription_update_request_model: Option< - models::OrganizationSubscriptionUpdateRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/subscription", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_subscription_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_tax_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/tax", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_tax_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - expanded_tax_info_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/tax", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&expanded_tax_info_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_upgrade_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_upgrade_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/upgrade", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_upgrade_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_verify_bank_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - organization_verify_bank_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/verify-bank", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_verify_bank_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_identifier_auto_enroll_status_get( - configuration: &configuration::Configuration, - identifier: &str, -) -> Result< - models::OrganizationAutoEnrollStatusResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{identifier}/auto-enroll-status", - local_var_configuration.base_path, - identifier = crate::apis::urlencode(identifier) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_post( - configuration: &configuration::Configuration, - organization_create_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/organizations", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&organization_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/plans_api.rs b/crates/bitwarden-api-api/src/apis/plans_api.rs deleted file mode 100644 index 6f3b1cced..000000000 --- a/crates/bitwarden-api-api/src/apis/plans_api.rs +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`plans_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PlansGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`plans_sales_tax_rates_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PlansSalesTaxRatesGetError { - UnknownValue(serde_json::Value), -} - -pub async fn plans_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/plans", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn plans_sales_tax_rates_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/plans/sales-tax-rates", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/policies_api.rs b/crates/bitwarden-api-api/src/apis/policies_api.rs deleted file mode 100644 index 131dbb127..000000000 --- a/crates/bitwarden-api-api/src/apis/policies_api.rs +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_org_id_policies_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdPoliciesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_policies_invited_user_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdPoliciesInvitedUserGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_policies_master_password_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdPoliciesMasterPasswordGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_policies_token_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdPoliciesTokenGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_policies_type_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdPoliciesTypeGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_org_id_policies_type_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrgIdPoliciesTypePutError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_org_id_policies_get( - configuration: &configuration::Configuration, - org_id: &str, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/policies", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_policies_invited_user_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - user_id: Option, -) -> Result< - models::PolicyResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/policies/invited-user", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = user_id { - local_var_req_builder = - local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_policies_master_password_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/policies/master-password", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_policies_token_get( - configuration: &configuration::Configuration, - org_id: uuid::Uuid, - email: Option<&str>, - token: Option<&str>, - organization_user_id: Option, -) -> Result< - models::PolicyResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{orgId}/policies/token", - local_var_configuration.base_path, - orgId = crate::apis::urlencode(org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = email { - local_var_req_builder = - local_var_req_builder.query(&[("email", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = token { - local_var_req_builder = - local_var_req_builder.query(&[("token", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = organization_user_id { - local_var_req_builder = - local_var_req_builder.query(&[("organizationUserId", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_policies_type_get( - configuration: &configuration::Configuration, - org_id: &str, - r#type: i32, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/organizations/{orgId}/policies/{type}", local_var_configuration.base_path, orgId=crate::apis::urlencode(org_id), type=r#type); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_org_id_policies_type_put( - configuration: &configuration::Configuration, - org_id: &str, - r#type: i32, - policy_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/organizations/{orgId}/policies/{type}", local_var_configuration.base_path, orgId=crate::apis::urlencode(org_id), type=r#type); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&policy_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/projects_api.rs b/crates/bitwarden-api-api/src/apis/projects_api.rs deleted file mode 100644 index 5ba76f6b9..000000000 --- a/crates/bitwarden-api-api/src/apis/projects_api.rs +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_organization_id_projects_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdProjectsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_organization_id_projects_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdProjectsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsIdPutError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_organization_id_projects_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result< - models::ProjectResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/projects", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_organization_id_projects_post( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - project_create_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/projects", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&project_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_delete_post( - configuration: &configuration::Configuration, - uuid_colon_colon_uuid: Option>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/projects/delete", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&uuid_colon_colon_uuid); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_id_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - project_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&project_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/provider_billing_api.rs b/crates/bitwarden-api-api/src/apis/provider_billing_api.rs deleted file mode 100644 index b34b885f8..000000000 --- a/crates/bitwarden-api-api/src/apis/provider_billing_api.rs +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`providers_provider_id_billing_invoices_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdBillingInvoicesGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_billing_invoices_invoice_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdBillingInvoicesInvoiceIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_billing_subscription_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdBillingSubscriptionGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_billing_tax_information_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdBillingTaxInformationPutError { - UnknownValue(serde_json::Value), -} - -pub async fn providers_provider_id_billing_invoices_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/billing/invoices", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_billing_invoices_invoice_id_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - invoice_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/billing/invoices/{invoiceId}", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - invoiceId = crate::apis::urlencode(invoice_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_billing_subscription_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/billing/subscription", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_billing_tax_information_put( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - tax_information_request_body: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/billing/tax-information", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&tax_information_request_body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/provider_clients_api.rs b/crates/bitwarden-api-api/src/apis/provider_clients_api.rs deleted file mode 100644 index 2d34784e0..000000000 --- a/crates/bitwarden-api-api/src/apis/provider_clients_api.rs +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`providers_provider_id_clients_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdClientsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_clients_provider_organization_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdClientsProviderOrganizationIdPutError { - UnknownValue(serde_json::Value), -} - -pub async fn providers_provider_id_clients_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - create_client_organization_request_body: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/clients", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&create_client_organization_request_body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_clients_provider_organization_id_put( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_organization_id: uuid::Uuid, - update_client_organization_request_body: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/clients/{providerOrganizationId}", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - providerOrganizationId = crate::apis::urlencode(provider_organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_client_organization_request_body); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/provider_organizations_api.rs b/crates/bitwarden-api-api/src/apis/provider_organizations_api.rs deleted file mode 100644 index 4ae80b17a..000000000 --- a/crates/bitwarden-api-api/src/apis/provider_organizations_api.rs +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`providers_provider_id_organizations_add_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdOrganizationsAddPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_organizations_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdOrganizationsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_organizations_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdOrganizationsIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_organizations_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdOrganizationsIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_organizations_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdOrganizationsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn providers_provider_id_organizations_add_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_organization_add_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/organizations/add", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_organization_add_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_organizations_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, -) -> Result< - models::ProviderOrganizationOrganizationDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/organizations", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_organizations_id_delete( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/organizations/{id}", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_organizations_id_delete_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/organizations/{id}/delete", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_organizations_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_organization_create_request_model: Option< - models::ProviderOrganizationCreateRequestModel, - >, -) -> Result< - models::ProviderOrganizationResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/organizations", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_organization_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/provider_users_api.rs b/crates/bitwarden-api-api/src/apis/provider_users_api.rs deleted file mode 100644 index fb6a31f02..000000000 --- a/crates/bitwarden-api-api/src/apis/provider_users_api.rs +++ /dev/null @@ -1,834 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`providers_provider_id_users_confirm_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersConfirmPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_accept_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdAcceptPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_confirm_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdConfirmPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_id_reinvite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersIdReinvitePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_invite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersInvitePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_public_keys_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersPublicKeysPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_provider_id_users_reinvite_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersProviderIdUsersReinvitePostError { - UnknownValue(serde_json::Value), -} - -pub async fn providers_provider_id_users_confirm_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_user_bulk_confirm_request_model: Option, -) -> Result< - models::ProviderUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/confirm", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_bulk_confirm_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_delete( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_user_bulk_request_model: Option, -) -> Result< - models::ProviderUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_delete_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_user_bulk_request_model: Option, -) -> Result< - models::ProviderUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/delete", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, -) -> Result< - models::ProviderUserUserDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_accept_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, - provider_user_accept_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}/accept", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_accept_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_confirm_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, - provider_user_confirm_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}/confirm", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_confirm_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_delete( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_delete_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}/delete", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_get( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, - provider_user_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_put( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, - provider_user_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_id_reinvite_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/{id}/reinvite", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()), - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_invite_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_user_invite_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/invite", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_invite_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_public_keys_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_user_bulk_request_model: Option, -) -> Result< - models::ProviderUserPublicKeyResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/public-keys", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_provider_id_users_reinvite_post( - configuration: &configuration::Configuration, - provider_id: uuid::Uuid, - provider_user_bulk_request_model: Option, -) -> Result< - models::ProviderUserBulkResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{providerId}/users/reinvite", - local_var_configuration.base_path, - providerId = crate::apis::urlencode(provider_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_user_bulk_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/providers_api.rs b/crates/bitwarden-api-api/src/apis/providers_api.rs deleted file mode 100644 index 2640b8e65..000000000 --- a/crates/bitwarden-api-api/src/apis/providers_api.rs +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`providers_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_id_delete_recover_token_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersIdDeleteRecoverTokenPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`providers_id_setup_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProvidersIdSetupPostError { - UnknownValue(serde_json::Value), -} - -pub async fn providers_id_delete( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_id_delete_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_id_delete_recover_token_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - provider_verify_delete_recover_request_model: Option< - models::ProviderVerifyDeleteRecoverRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{id}/delete-recover-token", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&provider_verify_delete_recover_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_id_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - provider_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_id_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - provider_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn providers_id_setup_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - provider_setup_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/providers/{id}/setup", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&provider_setup_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/push_api.rs b/crates/bitwarden-api-api/src/apis/push_api.rs deleted file mode 100644 index b4ba50f03..000000000 --- a/crates/bitwarden-api-api/src/apis/push_api.rs +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`push_add_organization_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PushAddOrganizationPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`push_delete_organization_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PushDeleteOrganizationPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`push_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PushDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`push_register_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PushRegisterPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`push_send_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PushSendPostError { - UnknownValue(serde_json::Value), -} - -pub async fn push_add_organization_put( - configuration: &configuration::Configuration, - push_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/push/add-organization", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&push_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn push_delete_organization_put( - configuration: &configuration::Configuration, - push_update_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/push/delete-organization", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&push_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn push_delete_post( - configuration: &configuration::Configuration, - push_device_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/push/delete", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&push_device_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn push_register_post( - configuration: &configuration::Configuration, - push_registration_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/push/register", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&push_registration_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn push_send_post( - configuration: &configuration::Configuration, - push_send_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/push/send", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&push_send_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/request_sm_access_api.rs b/crates/bitwarden-api-api/src/apis/request_sm_access_api.rs deleted file mode 100644 index c67de851d..000000000 --- a/crates/bitwarden-api-api/src/apis/request_sm_access_api.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`request_access_request_sm_access_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum RequestAccessRequestSmAccessPostError { - UnknownValue(serde_json::Value), -} - -pub async fn request_access_request_sm_access_post( - configuration: &configuration::Configuration, - request_sm_access_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/request-access/request-sm-access", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&request_sm_access_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/secrets_api.rs b/crates/bitwarden-api-api/src/apis/secrets_api.rs deleted file mode 100644 index 2a521c688..000000000 --- a/crates/bitwarden-api-api/src/apis/secrets_api.rs +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_organization_id_secrets_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdSecretsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_organization_id_secrets_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdSecretsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_organization_id_secrets_sync_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdSecretsSyncGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`projects_project_id_secrets_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ProjectsProjectIdSecretsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`secrets_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`secrets_get_by_ids_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsGetByIdsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`secrets_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`secrets_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsIdPutError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_organization_id_secrets_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result< - models::SecretWithProjectsListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/secrets", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_organization_id_secrets_post( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - secret_create_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/secrets", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_organization_id_secrets_sync_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - last_synced_date: Option, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/secrets/sync", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = last_synced_date { - local_var_req_builder = - local_var_req_builder.query(&[("lastSyncedDate", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn projects_project_id_secrets_get( - configuration: &configuration::Configuration, - project_id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/projects/{projectId}/secrets", - local_var_configuration.base_path, - projectId = crate::apis::urlencode(project_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn secrets_delete_post( - configuration: &configuration::Configuration, - uuid_colon_colon_uuid: Option>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/secrets/delete", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&uuid_colon_colon_uuid); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn secrets_get_by_ids_post( - configuration: &configuration::Configuration, - get_secrets_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/secrets/get-by-ids", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&get_secrets_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn secrets_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/secrets/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn secrets_id_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - secret_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/secrets/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/secrets_manager_events_api.rs b/crates/bitwarden-api-api/src/apis/secrets_manager_events_api.rs deleted file mode 100644 index 4d532fe84..000000000 --- a/crates/bitwarden-api-api/src/apis/secrets_manager_events_api.rs +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`sm_events_service_accounts_service_account_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SmEventsServiceAccountsServiceAccountIdGetError { - UnknownValue(serde_json::Value), -} - -pub async fn sm_events_service_accounts_service_account_id_get( - configuration: &configuration::Configuration, - service_account_id: uuid::Uuid, - start: Option, - end: Option, - continuation_token: Option<&str>, -) -> Result< - models::EventResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sm/events/service-accounts/{serviceAccountId}", - local_var_configuration.base_path, - serviceAccountId = crate::apis::urlencode(service_account_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = start { - local_var_req_builder = - local_var_req_builder.query(&[("start", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = end { - local_var_req_builder = local_var_req_builder.query(&[("end", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = continuation_token { - local_var_req_builder = - local_var_req_builder.query(&[("continuationToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/secrets_manager_porting_api.rs b/crates/bitwarden-api-api/src/apis/secrets_manager_porting_api.rs deleted file mode 100644 index 872f8db40..000000000 --- a/crates/bitwarden-api-api/src/apis/secrets_manager_porting_api.rs +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`sm_organization_id_export_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SmOrganizationIdExportGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sm_organization_id_import_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SmOrganizationIdImportPostError { - UnknownValue(serde_json::Value), -} - -pub async fn sm_organization_id_export_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sm/{organizationId}/export", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sm_organization_id_import_post( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - sm_import_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sm/{organizationId}/import", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&sm_import_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/self_hosted_organization_licenses_api.rs b/crates/bitwarden-api-api/src/apis/self_hosted_organization_licenses_api.rs deleted file mode 100644 index adb61b690..000000000 --- a/crates/bitwarden-api-api/src/apis/self_hosted_organization_licenses_api.rs +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_licenses_self_hosted_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsLicensesSelfHostedIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_licenses_self_hosted_id_sync_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsLicensesSelfHostedIdSyncPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_licenses_self_hosted_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsLicensesSelfHostedPostError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_licenses_self_hosted_id_post( - configuration: &configuration::Configuration, - id: &str, - license: std::path::PathBuf, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/licenses/self-hosted/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - let mut local_var_form = reqwest::multipart::Form::new(); - // TODO: support file upload for 'license' parameter - local_var_req_builder = local_var_req_builder.multipart(local_var_form); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_licenses_self_hosted_id_sync_post( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/licenses/self-hosted/{id}/sync", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_licenses_self_hosted_post( - configuration: &configuration::Configuration, - key: &str, - keys_period_public_key: &str, - keys_period_encrypted_private_key: &str, - license: std::path::PathBuf, - collection_name: Option<&str>, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/licenses/self-hosted", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - local_var_req_builder = local_var_req_builder.query(&[("key", &key.to_string())]); - if let Some(ref local_var_str) = collection_name { - local_var_req_builder = - local_var_req_builder.query(&[("collectionName", &local_var_str.to_string())]); - } - local_var_req_builder = - local_var_req_builder.query(&[("keys.publicKey", &keys_period_public_key.to_string())]); - local_var_req_builder = local_var_req_builder.query(&[( - "keys.encryptedPrivateKey", - &keys_period_encrypted_private_key.to_string(), - )]); - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - let mut local_var_form = reqwest::multipart::Form::new(); - // TODO: support file upload for 'license' parameter - local_var_req_builder = local_var_req_builder.multipart(local_var_form); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/self_hosted_organization_sponsorships_api.rs b/crates/bitwarden-api-api/src/apis/self_hosted_organization_sponsorships_api.rs deleted file mode 100644 index 89fc43b22..000000000 --- a/crates/bitwarden-api-api/src/apis/self_hosted_organization_sponsorships_api.rs +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method -/// [`organization_sponsorship_self_hosted_sponsoring_org_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSelfHostedSponsoringOrgIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organization_sponsorship_self_hosted_sponsoring_org_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSelfHostedSponsoringOrgIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method -/// [`organization_sponsorship_self_hosted_sponsoring_org_id_families_for_enterprise_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationSponsorshipSelfHostedSponsoringOrgIdFamiliesForEnterprisePostError { - UnknownValue(serde_json::Value), -} - -pub async fn organization_sponsorship_self_hosted_sponsoring_org_id_delete( - configuration: &configuration::Configuration, - sponsoring_org_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/self-hosted/{sponsoringOrgId}", - local_var_configuration.base_path, - sponsoringOrgId = crate::apis::urlencode(sponsoring_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_self_hosted_sponsoring_org_id_delete_post( - configuration: &configuration::Configuration, - sponsoring_org_id: uuid::Uuid, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/self-hosted/{sponsoringOrgId}/delete", - local_var_configuration.base_path, - sponsoringOrgId = crate::apis::urlencode(sponsoring_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option< - OrganizationSponsorshipSelfHostedSponsoringOrgIdDeletePostError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organization_sponsorship_self_hosted_sponsoring_org_id_families_for_enterprise_post( - configuration: &configuration::Configuration, - sponsoring_org_id: uuid::Uuid, - organization_sponsorship_create_request_model: Option< - models::OrganizationSponsorshipCreateRequestModel, - >, -) -> Result<(), Error> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organization/sponsorship/self-hosted/{sponsoringOrgId}/families-for-enterprise", - local_var_configuration.base_path, - sponsoringOrgId = crate::apis::urlencode(sponsoring_org_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&organization_sponsorship_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option< - OrganizationSponsorshipSelfHostedSponsoringOrgIdFamiliesForEnterprisePostError, - > = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/sends_api.rs b/crates/bitwarden-api-api/src/apis/sends_api.rs deleted file mode 100644 index 0cc73b146..000000000 --- a/crates/bitwarden-api-api/src/apis/sends_api.rs +++ /dev/null @@ -1,671 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`sends_access_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsAccessIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_encoded_send_id_access_file_file_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsEncodedSendIdAccessFileFileIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_file_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsFilePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_file_v2_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsFileV2PostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_file_validate_azure_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsFileValidateAzurePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_id_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsIdDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_id_file_file_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsIdFileFileIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_id_file_file_id_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsIdFileFileIdPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsIdPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_id_remove_password_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsIdRemovePasswordPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sends_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SendsPostError { - UnknownValue(serde_json::Value), -} - -pub async fn sends_access_id_post( - configuration: &configuration::Configuration, - id: &str, - send_access_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/access/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&send_access_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_encoded_send_id_access_file_file_id_post( - configuration: &configuration::Configuration, - encoded_send_id: &str, - file_id: &str, - send_access_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/{encodedSendId}/access/file/{fileId}", - local_var_configuration.base_path, - encodedSendId = crate::apis::urlencode(encoded_send_id), - fileId = crate::apis::urlencode(file_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&send_access_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_file_post( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sends/file", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_file_v2_post( - configuration: &configuration::Configuration, - send_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sends/file/v2", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&send_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_file_validate_azure_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/file/validate/azure", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sends", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_id_delete( - configuration: &configuration::Configuration, - id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_id_file_file_id_get( - configuration: &configuration::Configuration, - id: &str, - file_id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/{id}/file/{fileId}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id), - fileId = crate::apis::urlencode(file_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_id_file_file_id_post( - configuration: &configuration::Configuration, - id: &str, - file_id: &str, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/{id}/file/{fileId}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id), - fileId = crate::apis::urlencode(file_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_id_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_id_put( - configuration: &configuration::Configuration, - id: &str, - send_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&send_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_id_remove_password_put( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sends/{id}/remove-password", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sends_post( - configuration: &configuration::Configuration, - send_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sends", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&send_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/service_accounts_api.rs b/crates/bitwarden-api-api/src/apis/service_accounts_api.rs deleted file mode 100644 index 75b5f1329..000000000 --- a/crates/bitwarden-api-api/src/apis/service_accounts_api.rs +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_organization_id_service_accounts_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdServiceAccountsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_organization_id_service_accounts_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsOrganizationIdServiceAccountsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_access_tokens_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdAccessTokensGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_access_tokens_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdAccessTokensPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_access_tokens_revoke_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdAccessTokensRevokePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`service_accounts_id_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ServiceAccountsIdPutError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_organization_id_service_accounts_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - include_access_to_secrets: Option, -) -> Result< - models::ServiceAccountSecretsDetailsResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/service-accounts", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = include_access_to_secrets { - local_var_req_builder = - local_var_req_builder.query(&[("includeAccessToSecrets", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_organization_id_service_accounts_post( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - service_account_create_request_model: Option, -) -> Result< - models::ServiceAccountResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{organizationId}/service-accounts", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&service_account_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_delete_post( - configuration: &configuration::Configuration, - uuid_colon_colon_uuid: Option>, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/delete", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&uuid_colon_colon_uuid); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_access_tokens_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result< - models::AccessTokenResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}/access-tokens", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_access_tokens_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - access_token_create_request_model: Option, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}/access-tokens", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&access_token_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_access_tokens_revoke_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - revoke_access_tokens_request: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}/access-tokens/revoke", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&revoke_access_tokens_request); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_get( - configuration: &configuration::Configuration, - id: uuid::Uuid, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn service_accounts_id_put( - configuration: &configuration::Configuration, - id: uuid::Uuid, - service_account_update_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/service-accounts/{id}", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&service_account_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/settings_api.rs b/crates/bitwarden-api-api/src/apis/settings_api.rs deleted file mode 100644 index c4629e185..000000000 --- a/crates/bitwarden-api-api/src/apis/settings_api.rs +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`settings_domains_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SettingsDomainsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`settings_domains_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SettingsDomainsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`settings_domains_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SettingsDomainsPutError { - UnknownValue(serde_json::Value), -} - -pub async fn settings_domains_get( - configuration: &configuration::Configuration, - excluded: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/settings/domains", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = excluded { - local_var_req_builder = - local_var_req_builder.query(&[("excluded", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn settings_domains_post( - configuration: &configuration::Configuration, - update_domains_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/settings/domains", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_domains_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn settings_domains_put( - configuration: &configuration::Configuration, - update_domains_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/settings/domains", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_domains_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/stripe_api.rs b/crates/bitwarden-api-api/src/apis/stripe_api.rs deleted file mode 100644 index 8b186fbfb..000000000 --- a/crates/bitwarden-api-api/src/apis/stripe_api.rs +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`setup_intent_bank_account_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SetupIntentBankAccountPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`setup_intent_card_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SetupIntentCardPostError { - UnknownValue(serde_json::Value), -} - -pub async fn setup_intent_bank_account_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/setup-intent/bank-account", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn setup_intent_card_post( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/setup-intent/card", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/sync_api.rs b/crates/bitwarden-api-api/src/apis/sync_api.rs deleted file mode 100644 index 796c0076d..000000000 --- a/crates/bitwarden-api-api/src/apis/sync_api.rs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`sync_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SyncGetError { - UnknownValue(serde_json::Value), -} - -pub async fn sync_get( - configuration: &configuration::Configuration, - exclude_domains: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sync", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = exclude_domains { - local_var_req_builder = - local_var_req_builder.query(&[("excludeDomains", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/trash_api.rs b/crates/bitwarden-api-api/src/apis/trash_api.rs deleted file mode 100644 index 744a97d3a..000000000 --- a/crates/bitwarden-api-api/src/apis/trash_api.rs +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`secrets_organization_id_trash_empty_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsOrganizationIdTrashEmptyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`secrets_organization_id_trash_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsOrganizationIdTrashGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`secrets_organization_id_trash_restore_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SecretsOrganizationIdTrashRestorePostError { - UnknownValue(serde_json::Value), -} - -pub async fn secrets_organization_id_trash_empty_post( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - uuid_colon_colon_uuid: Option>, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/secrets/{organizationId}/trash/empty", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&uuid_colon_colon_uuid); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn secrets_organization_id_trash_get( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/secrets/{organizationId}/trash", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn secrets_organization_id_trash_restore_post( - configuration: &configuration::Configuration, - organization_id: uuid::Uuid, - uuid_colon_colon_uuid: Option>, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/secrets/{organizationId}/trash/restore", - local_var_configuration.base_path, - organizationId = crate::apis::urlencode(organization_id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&uuid_colon_colon_uuid); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/two_factor_api.rs b/crates/bitwarden-api-api/src/apis/two_factor_api.rs deleted file mode 100644 index f012036dc..000000000 --- a/crates/bitwarden-api-api/src/apis/two_factor_api.rs +++ /dev/null @@ -1,1633 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`organizations_id_two_factor_disable_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTwoFactorDisablePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_two_factor_disable_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTwoFactorDisablePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_two_factor_duo_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTwoFactorDuoPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_two_factor_duo_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTwoFactorDuoPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_two_factor_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTwoFactorGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`organizations_id_two_factor_get_duo_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum OrganizationsIdTwoFactorGetDuoPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_authenticator_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorAuthenticatorDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_authenticator_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorAuthenticatorPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_authenticator_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorAuthenticatorPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_device_verification_settings_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorDeviceVerificationSettingsPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_disable_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorDisablePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_disable_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorDisablePutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_duo_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorDuoPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_duo_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorDuoPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_email_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorEmailPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_email_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorEmailPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get_authenticator_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetAuthenticatorPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get_device_verification_settings_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetDeviceVerificationSettingsGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get_duo_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetDuoPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get_email_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetEmailPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get_recover_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetRecoverPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get_webauthn_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetWebauthnPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_get_yubikey_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorGetYubikeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_recover_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorRecoverPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_send_email_login_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorSendEmailLoginPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_send_email_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorSendEmailPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_webauthn_delete`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorWebauthnDeleteError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_webauthn_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorWebauthnPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_webauthn_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorWebauthnPutError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_yubikey_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorYubikeyPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`two_factor_yubikey_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TwoFactorYubikeyPutError { - UnknownValue(serde_json::Value), -} - -pub async fn organizations_id_two_factor_disable_post( - configuration: &configuration::Configuration, - id: &str, - two_factor_provider_request_model: Option, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/two-factor/disable", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_provider_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_two_factor_disable_put( - configuration: &configuration::Configuration, - id: &str, - two_factor_provider_request_model: Option, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/two-factor/disable", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_provider_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_two_factor_duo_post( - configuration: &configuration::Configuration, - id: &str, - update_two_factor_duo_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/two-factor/duo", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_duo_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_two_factor_duo_put( - configuration: &configuration::Configuration, - id: &str, - update_two_factor_duo_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/two-factor/duo", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_duo_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_two_factor_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result< - models::TwoFactorProviderResponseModelListResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/two-factor", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn organizations_id_two_factor_get_duo_post( - configuration: &configuration::Configuration, - id: &str, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/organizations/{id}/two-factor/get-duo", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_authenticator_delete( - configuration: &configuration::Configuration, - two_factor_authenticator_disable_request_model: Option< - models::TwoFactorAuthenticatorDisableRequestModel, - >, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/authenticator", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&two_factor_authenticator_disable_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_authenticator_post( - configuration: &configuration::Configuration, - update_two_factor_authenticator_request_model: Option< - models::UpdateTwoFactorAuthenticatorRequestModel, - >, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/authenticator", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&update_two_factor_authenticator_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_authenticator_put( - configuration: &configuration::Configuration, - update_two_factor_authenticator_request_model: Option< - models::UpdateTwoFactorAuthenticatorRequestModel, - >, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/authenticator", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&update_two_factor_authenticator_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_device_verification_settings_put( - configuration: &configuration::Configuration, - device_verification_request_model: Option, -) -> Result< - models::DeviceVerificationResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/device-verification-settings", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&device_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_disable_post( - configuration: &configuration::Configuration, - two_factor_provider_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/disable", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_provider_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_disable_put( - configuration: &configuration::Configuration, - two_factor_provider_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/disable", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_provider_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_duo_post( - configuration: &configuration::Configuration, - update_two_factor_duo_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/duo", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_duo_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_duo_put( - configuration: &configuration::Configuration, - update_two_factor_duo_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/duo", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_duo_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_email_post( - configuration: &configuration::Configuration, - update_two_factor_email_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/email", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_email_put( - configuration: &configuration::Configuration, - update_two_factor_email_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/email", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get_authenticator_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> -{ - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/get-authenticator", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get_device_verification_settings_get( - configuration: &configuration::Configuration, -) -> Result< - models::DeviceVerificationResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/get-device-verification-settings", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get_duo_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/get-duo", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get_email_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/get-email", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get_recover_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/get-recover", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get_webauthn_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/get-webauthn", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_get_yubikey_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/get-yubikey", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_recover_post( - configuration: &configuration::Configuration, - two_factor_recovery_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/recover", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_recovery_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_send_email_login_post( - configuration: &configuration::Configuration, - two_factor_email_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/send-email-login", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_send_email_post( - configuration: &configuration::Configuration, - two_factor_email_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/two-factor/send-email", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_webauthn_delete( - configuration: &configuration::Configuration, - two_factor_web_authn_delete_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/webauthn", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_web_authn_delete_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_webauthn_post( - configuration: &configuration::Configuration, - two_factor_web_authn_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/webauthn", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_web_authn_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_webauthn_put( - configuration: &configuration::Configuration, - two_factor_web_authn_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/webauthn", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&two_factor_web_authn_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_yubikey_post( - configuration: &configuration::Configuration, - update_two_factor_yubico_otp_request_model: Option< - models::UpdateTwoFactorYubicoOtpRequestModel, - >, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/yubikey", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_yubico_otp_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn two_factor_yubikey_put( - configuration: &configuration::Configuration, - update_two_factor_yubico_otp_request_model: Option< - models::UpdateTwoFactorYubicoOtpRequestModel, - >, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/two-factor/yubikey", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&update_two_factor_yubico_otp_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/users_api.rs b/crates/bitwarden-api-api/src/apis/users_api.rs deleted file mode 100644 index 5297c1f76..000000000 --- a/crates/bitwarden-api-api/src/apis/users_api.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`users_id_public_key_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum UsersIdPublicKeyGetError { - UnknownValue(serde_json::Value), -} - -pub async fn users_id_public_key_get( - configuration: &configuration::Configuration, - id: &str, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/users/{id}/public-key", - local_var_configuration.base_path, - id = crate::apis::urlencode(id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/apis/web_authn_api.rs b/crates/bitwarden-api-api/src/apis/web_authn_api.rs deleted file mode 100644 index b6b41b551..000000000 --- a/crates/bitwarden-api-api/src/apis/web_authn_api.rs +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`webauthn_assertion_options_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum WebauthnAssertionOptionsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`webauthn_attestation_options_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum WebauthnAttestationOptionsPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`webauthn_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum WebauthnGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`webauthn_id_delete_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum WebauthnIdDeletePostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`webauthn_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum WebauthnPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`webauthn_put`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum WebauthnPutError { - UnknownValue(serde_json::Value), -} - -pub async fn webauthn_assertion_options_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result< - models::WebAuthnLoginAssertionOptionsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/webauthn/assertion-options", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn webauthn_attestation_options_post( - configuration: &configuration::Configuration, - secret_verification_request_model: Option, -) -> Result< - models::WebAuthnCredentialCreateOptionsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/webauthn/attestation-options", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn webauthn_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/webauthn", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn webauthn_id_delete_post( - configuration: &configuration::Configuration, - id: uuid::Uuid, - secret_verification_request_model: Option, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/webauthn/{id}/delete", - local_var_configuration.base_path, - id = crate::apis::urlencode(id.to_string()) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&secret_verification_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn webauthn_post( - configuration: &configuration::Configuration, - web_authn_login_credential_create_request_model: Option< - models::WebAuthnLoginCredentialCreateRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/webauthn", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&web_authn_login_credential_create_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn webauthn_put( - configuration: &configuration::Configuration, - web_authn_login_credential_update_request_model: Option< - models::WebAuthnLoginCredentialUpdateRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/webauthn", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_token) = local_var_configuration.oauth_access_token { - local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned()); - }; - local_var_req_builder = - local_var_req_builder.json(&web_authn_login_credential_update_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-api/src/lib.rs b/crates/bitwarden-api-api/src/lib.rs deleted file mode 100644 index 3cf407d12..000000000 --- a/crates/bitwarden-api-api/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(unused_imports, unused_variables, unused_mut, non_camel_case_types)] -#![allow( - clippy::too_many_arguments, - clippy::empty_docs, - clippy::to_string_in_format_args -)] - -extern crate reqwest; -extern crate serde; -extern crate serde_json; -extern crate url; - -pub mod apis; -pub mod models; diff --git a/crates/bitwarden-api-api/src/models/access_policy_request.rs b/crates/bitwarden-api-api/src/models/access_policy_request.rs deleted file mode 100644 index 03ad36a40..000000000 --- a/crates/bitwarden-api-api/src/models/access_policy_request.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AccessPolicyRequest { - #[serde(rename = "granteeId")] - pub grantee_id: uuid::Uuid, - #[serde(rename = "read")] - pub read: bool, - #[serde(rename = "write")] - pub write: bool, -} - -impl AccessPolicyRequest { - pub fn new(grantee_id: uuid::Uuid, read: bool, write: bool) -> AccessPolicyRequest { - AccessPolicyRequest { - grantee_id, - read, - write, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/access_token_create_request_model.rs b/crates/bitwarden-api-api/src/models/access_token_create_request_model.rs deleted file mode 100644 index e04add642..000000000 --- a/crates/bitwarden-api-api/src/models/access_token_create_request_model.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AccessTokenCreateRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "encryptedPayload")] - pub encrypted_payload: String, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "expireAt", skip_serializing_if = "Option::is_none")] - pub expire_at: Option, -} - -impl AccessTokenCreateRequestModel { - pub fn new( - name: String, - encrypted_payload: String, - key: String, - ) -> AccessTokenCreateRequestModel { - AccessTokenCreateRequestModel { - name, - encrypted_payload, - key, - expire_at: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/access_token_creation_response_model.rs b/crates/bitwarden-api-api/src/models/access_token_creation_response_model.rs deleted file mode 100644 index 7cfb537d4..000000000 --- a/crates/bitwarden-api-api/src/models/access_token_creation_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AccessTokenCreationResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "clientSecret", skip_serializing_if = "Option::is_none")] - pub client_secret: Option, - #[serde(rename = "expireAt", skip_serializing_if = "Option::is_none")] - pub expire_at: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, -} - -impl AccessTokenCreationResponseModel { - pub fn new() -> AccessTokenCreationResponseModel { - AccessTokenCreationResponseModel { - object: None, - id: None, - name: None, - client_secret: None, - expire_at: None, - creation_date: None, - revision_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/access_token_response_model.rs b/crates/bitwarden-api-api/src/models/access_token_response_model.rs deleted file mode 100644 index 24e3b9757..000000000 --- a/crates/bitwarden-api-api/src/models/access_token_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AccessTokenResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "scopes", skip_serializing_if = "Option::is_none")] - pub scopes: Option>, - #[serde(rename = "expireAt", skip_serializing_if = "Option::is_none")] - pub expire_at: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, -} - -impl AccessTokenResponseModel { - pub fn new() -> AccessTokenResponseModel { - AccessTokenResponseModel { - object: None, - id: None, - name: None, - scopes: None, - expire_at: None, - creation_date: None, - revision_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/access_token_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/access_token_response_model_list_response_model.rs deleted file mode 100644 index 7445aad20..000000000 --- a/crates/bitwarden-api-api/src/models/access_token_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AccessTokenResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl AccessTokenResponseModelListResponseModel { - pub fn new() -> AccessTokenResponseModelListResponseModel { - AccessTokenResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/admin_auth_request_update_request_model.rs b/crates/bitwarden-api-api/src/models/admin_auth_request_update_request_model.rs deleted file mode 100644 index 91e28d30a..000000000 --- a/crates/bitwarden-api-api/src/models/admin_auth_request_update_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AdminAuthRequestUpdateRequestModel { - #[serde(rename = "encryptedUserKey", skip_serializing_if = "Option::is_none")] - pub encrypted_user_key: Option, - #[serde(rename = "requestApproved")] - pub request_approved: bool, -} - -impl AdminAuthRequestUpdateRequestModel { - pub fn new(request_approved: bool) -> AdminAuthRequestUpdateRequestModel { - AdminAuthRequestUpdateRequestModel { - encrypted_user_key: None, - request_approved, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/algorithm.rs b/crates/bitwarden-api-api/src/models/algorithm.rs deleted file mode 100644 index 6b1c4fb1c..000000000 --- a/crates/bitwarden-api-api/src/models/algorithm.rs +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum Algorithm { - RS1 = -65535, - RS512 = -259, - RS384 = -258, - RS256 = -257, - ES256K = -47, - PS512 = -39, - PS384 = -38, - PS256 = -37, - ES512 = -36, - ES384 = -35, - EdDSA = -8, - ES256 = -7, -} - -impl std::fmt::Display for Algorithm { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::RS1 => write!(f, "-65535"), - Self::RS512 => write!(f, "-259"), - Self::RS384 => write!(f, "-258"), - Self::RS256 => write!(f, "-257"), - Self::ES256K => write!(f, "-47"), - Self::PS512 => write!(f, "-39"), - Self::PS384 => write!(f, "-38"), - Self::PS256 => write!(f, "-37"), - Self::ES512 => write!(f, "-36"), - Self::ES384 => write!(f, "-35"), - Self::EdDSA => write!(f, "-8"), - Self::ES256 => write!(f, "-7"), - } - } -} - -impl Default for Algorithm { - fn default() -> Algorithm { - Self::RS1 - } -} diff --git a/crates/bitwarden-api-api/src/models/api_key_response_model.rs b/crates/bitwarden-api-api/src/models/api_key_response_model.rs deleted file mode 100644 index b7c862a63..000000000 --- a/crates/bitwarden-api-api/src/models/api_key_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ApiKeyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "apiKey", skip_serializing_if = "Option::is_none")] - pub api_key: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, -} - -impl ApiKeyResponseModel { - pub fn new() -> ApiKeyResponseModel { - ApiKeyResponseModel { - object: None, - api_key: None, - revision_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/assertion_options.rs b/crates/bitwarden-api-api/src/models/assertion_options.rs deleted file mode 100644 index 067e48055..000000000 --- a/crates/bitwarden-api-api/src/models/assertion_options.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AssertionOptions { - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde_as(as = "Option")] - #[serde(rename = "challenge", skip_serializing_if = "Option::is_none")] - pub challenge: Option>, - #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(rename = "rpId", skip_serializing_if = "Option::is_none")] - pub rp_id: Option, - #[serde(rename = "allowCredentials", skip_serializing_if = "Option::is_none")] - pub allow_credentials: Option>, - #[serde(rename = "userVerification", skip_serializing_if = "Option::is_none")] - pub user_verification: Option, - #[serde(rename = "extensions", skip_serializing_if = "Option::is_none")] - pub extensions: Option>, -} - -impl AssertionOptions { - pub fn new() -> AssertionOptions { - AssertionOptions { - status: None, - error_message: None, - challenge: None, - timeout: None, - rp_id: None, - allow_credentials: None, - user_verification: None, - extensions: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/assertion_response.rs b/crates/bitwarden-api-api/src/models/assertion_response.rs deleted file mode 100644 index ccd33fc1c..000000000 --- a/crates/bitwarden-api-api/src/models/assertion_response.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AssertionResponse { - #[serde_as(as = "Option")] - #[serde(rename = "authenticatorData", skip_serializing_if = "Option::is_none")] - pub authenticator_data: Option>, - #[serde_as(as = "Option")] - #[serde(rename = "signature", skip_serializing_if = "Option::is_none")] - pub signature: Option>, - #[serde_as(as = "Option")] - #[serde(rename = "clientDataJSON", skip_serializing_if = "Option::is_none")] - pub client_data_json: Option>, - #[serde_as(as = "Option")] - #[serde(rename = "userHandle", skip_serializing_if = "Option::is_none")] - pub user_handle: Option>, -} - -impl AssertionResponse { - pub fn new() -> AssertionResponse { - AssertionResponse { - authenticator_data: None, - signature: None, - client_data_json: None, - user_handle: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/attachment_request_model.rs b/crates/bitwarden-api-api/src/models/attachment_request_model.rs deleted file mode 100644 index 550ff1027..000000000 --- a/crates/bitwarden-api-api/src/models/attachment_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AttachmentRequestModel { - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "fileName", skip_serializing_if = "Option::is_none")] - pub file_name: Option, - #[serde(rename = "fileSize", skip_serializing_if = "Option::is_none")] - pub file_size: Option, - #[serde(rename = "adminRequest", skip_serializing_if = "Option::is_none")] - pub admin_request: Option, -} - -impl AttachmentRequestModel { - pub fn new() -> AttachmentRequestModel { - AttachmentRequestModel { - key: None, - file_name: None, - file_size: None, - admin_request: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/attachment_response_model.rs b/crates/bitwarden-api-api/src/models/attachment_response_model.rs deleted file mode 100644 index 818663095..000000000 --- a/crates/bitwarden-api-api/src/models/attachment_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AttachmentResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "url", skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "fileName", skip_serializing_if = "Option::is_none")] - pub file_name: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "size", skip_serializing_if = "Option::is_none")] - pub size: Option, - #[serde(rename = "sizeName", skip_serializing_if = "Option::is_none")] - pub size_name: Option, -} - -impl AttachmentResponseModel { - pub fn new() -> AttachmentResponseModel { - AttachmentResponseModel { - object: None, - id: None, - url: None, - file_name: None, - key: None, - size: None, - size_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/attachment_upload_data_response_model.rs b/crates/bitwarden-api-api/src/models/attachment_upload_data_response_model.rs deleted file mode 100644 index e82684628..000000000 --- a/crates/bitwarden-api-api/src/models/attachment_upload_data_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AttachmentUploadDataResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "attachmentId", skip_serializing_if = "Option::is_none")] - pub attachment_id: Option, - #[serde(rename = "url", skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "fileUploadType", skip_serializing_if = "Option::is_none")] - pub file_upload_type: Option, - #[serde(rename = "cipherResponse", skip_serializing_if = "Option::is_none")] - pub cipher_response: Option>, - #[serde(rename = "cipherMiniResponse", skip_serializing_if = "Option::is_none")] - pub cipher_mini_response: Option>, -} - -impl AttachmentUploadDataResponseModel { - pub fn new() -> AttachmentUploadDataResponseModel { - AttachmentUploadDataResponseModel { - object: None, - attachment_id: None, - url: None, - file_upload_type: None, - cipher_response: None, - cipher_mini_response: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/attestation_conveyance_preference.rs b/crates/bitwarden-api-api/src/models/attestation_conveyance_preference.rs deleted file mode 100644 index 8cb2fd202..000000000 --- a/crates/bitwarden-api-api/src/models/attestation_conveyance_preference.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum AttestationConveyancePreference { - #[serde(rename = "none")] - None, - #[serde(rename = "indirect")] - Indirect, - #[serde(rename = "direct")] - Direct, -} - -impl std::fmt::Display for AttestationConveyancePreference { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::None => write!(f, "none"), - Self::Indirect => write!(f, "indirect"), - Self::Direct => write!(f, "direct"), - } - } -} - -impl Default for AttestationConveyancePreference { - fn default() -> AttestationConveyancePreference { - Self::None - } -} diff --git a/crates/bitwarden-api-api/src/models/auth_request_create_request_model.rs b/crates/bitwarden-api-api/src/models/auth_request_create_request_model.rs deleted file mode 100644 index aba6b7cb2..000000000 --- a/crates/bitwarden-api-api/src/models/auth_request_create_request_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthRequestCreateRequestModel { - #[serde(rename = "email")] - pub email: String, - #[serde(rename = "publicKey")] - pub public_key: String, - #[serde(rename = "deviceIdentifier")] - pub device_identifier: String, - #[serde(rename = "accessCode")] - pub access_code: String, - #[serde(rename = "type")] - pub r#type: models::AuthRequestType, -} - -impl AuthRequestCreateRequestModel { - pub fn new( - email: String, - public_key: String, - device_identifier: String, - access_code: String, - r#type: models::AuthRequestType, - ) -> AuthRequestCreateRequestModel { - AuthRequestCreateRequestModel { - email, - public_key, - device_identifier, - access_code, - r#type, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/auth_request_response_model.rs b/crates/bitwarden-api-api/src/models/auth_request_response_model.rs deleted file mode 100644 index fcab1eabc..000000000 --- a/crates/bitwarden-api-api/src/models/auth_request_response_model.rs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthRequestResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, - #[serde(rename = "requestDeviceType", skip_serializing_if = "Option::is_none")] - pub request_device_type: Option, - #[serde(rename = "requestIpAddress", skip_serializing_if = "Option::is_none")] - pub request_ip_address: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "responseDate", skip_serializing_if = "Option::is_none")] - pub response_date: Option, - #[serde(rename = "requestApproved", skip_serializing_if = "Option::is_none")] - pub request_approved: Option, - #[serde(rename = "origin", skip_serializing_if = "Option::is_none")] - pub origin: Option, -} - -impl AuthRequestResponseModel { - pub fn new() -> AuthRequestResponseModel { - AuthRequestResponseModel { - object: None, - id: None, - public_key: None, - request_device_type: None, - request_ip_address: None, - key: None, - master_password_hash: None, - creation_date: None, - response_date: None, - request_approved: None, - origin: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/auth_request_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/auth_request_response_model_list_response_model.rs deleted file mode 100644 index d53c915bd..000000000 --- a/crates/bitwarden-api-api/src/models/auth_request_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthRequestResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl AuthRequestResponseModelListResponseModel { - pub fn new() -> AuthRequestResponseModelListResponseModel { - AuthRequestResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/auth_request_type.rs b/crates/bitwarden-api-api/src/models/auth_request_type.rs deleted file mode 100644 index c14ce889b..000000000 --- a/crates/bitwarden-api-api/src/models/auth_request_type.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum AuthRequestType { - AuthenticateAndUnlock = 0, - Unlock = 1, - AdminApproval = 2, -} - -impl std::fmt::Display for AuthRequestType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::AuthenticateAndUnlock => write!(f, "0"), - Self::Unlock => write!(f, "1"), - Self::AdminApproval => write!(f, "2"), - } - } -} - -impl Default for AuthRequestType { - fn default() -> AuthRequestType { - Self::AuthenticateAndUnlock - } -} diff --git a/crates/bitwarden-api-api/src/models/auth_request_update_request_model.rs b/crates/bitwarden-api-api/src/models/auth_request_update_request_model.rs deleted file mode 100644 index 0d1c5ac29..000000000 --- a/crates/bitwarden-api-api/src/models/auth_request_update_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthRequestUpdateRequestModel { - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "deviceIdentifier")] - pub device_identifier: String, - #[serde(rename = "requestApproved")] - pub request_approved: bool, -} - -impl AuthRequestUpdateRequestModel { - pub fn new(device_identifier: String, request_approved: bool) -> AuthRequestUpdateRequestModel { - AuthRequestUpdateRequestModel { - key: None, - master_password_hash: None, - device_identifier, - request_approved, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/authentication_extensions_client_inputs.rs b/crates/bitwarden-api-api/src/models/authentication_extensions_client_inputs.rs deleted file mode 100644 index 91a3d4d02..000000000 --- a/crates/bitwarden-api-api/src/models/authentication_extensions_client_inputs.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthenticationExtensionsClientInputs { - #[serde(rename = "example.extension", skip_serializing_if = "Option::is_none")] - pub example_period_extension: Option, - #[serde(rename = "appid", skip_serializing_if = "Option::is_none")] - pub appid: Option, - #[serde(rename = "authnSel", skip_serializing_if = "Option::is_none")] - pub authn_sel: Option>, - #[serde(rename = "exts", skip_serializing_if = "Option::is_none")] - pub exts: Option, - #[serde(rename = "uvm", skip_serializing_if = "Option::is_none")] - pub uvm: Option, -} - -impl AuthenticationExtensionsClientInputs { - pub fn new() -> AuthenticationExtensionsClientInputs { - AuthenticationExtensionsClientInputs { - example_period_extension: None, - appid: None, - authn_sel: None, - exts: None, - uvm: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/authentication_extensions_client_outputs.rs b/crates/bitwarden-api-api/src/models/authentication_extensions_client_outputs.rs deleted file mode 100644 index 083f2220d..000000000 --- a/crates/bitwarden-api-api/src/models/authentication_extensions_client_outputs.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthenticationExtensionsClientOutputs { - #[serde(rename = "example.extension", skip_serializing_if = "Option::is_none")] - pub example_period_extension: Option, - #[serde(rename = "appid", skip_serializing_if = "Option::is_none")] - pub appid: Option, - #[serde(rename = "authnSel", skip_serializing_if = "Option::is_none")] - pub authn_sel: Option, - #[serde(rename = "exts", skip_serializing_if = "Option::is_none")] - pub exts: Option>, - #[serde(rename = "uvm", skip_serializing_if = "Option::is_none")] - pub uvm: Option>>, -} - -impl AuthenticationExtensionsClientOutputs { - pub fn new() -> AuthenticationExtensionsClientOutputs { - AuthenticationExtensionsClientOutputs { - example_period_extension: None, - appid: None, - authn_sel: None, - exts: None, - uvm: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/authenticator_assertion_raw_response.rs b/crates/bitwarden-api-api/src/models/authenticator_assertion_raw_response.rs deleted file mode 100644 index 8a6ffaa62..000000000 --- a/crates/bitwarden-api-api/src/models/authenticator_assertion_raw_response.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthenticatorAssertionRawResponse { - #[serde_as(as = "Option")] - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option>, - #[serde_as(as = "Option")] - #[serde(rename = "rawId", skip_serializing_if = "Option::is_none")] - pub raw_id: Option>, - #[serde(rename = "response", skip_serializing_if = "Option::is_none")] - pub response: Option>, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "extensions", skip_serializing_if = "Option::is_none")] - pub extensions: Option>, -} - -impl AuthenticatorAssertionRawResponse { - pub fn new() -> AuthenticatorAssertionRawResponse { - AuthenticatorAssertionRawResponse { - id: None, - raw_id: None, - response: None, - r#type: None, - extensions: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/authenticator_attachment.rs b/crates/bitwarden-api-api/src/models/authenticator_attachment.rs deleted file mode 100644 index 2dfef06c8..000000000 --- a/crates/bitwarden-api-api/src/models/authenticator_attachment.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum AuthenticatorAttachment { - #[serde(rename = "platform")] - Platform, - #[serde(rename = "cross-platform")] - CrossPlatform, -} - -impl std::fmt::Display for AuthenticatorAttachment { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Platform => write!(f, "platform"), - Self::CrossPlatform => write!(f, "cross-platform"), - } - } -} - -impl Default for AuthenticatorAttachment { - fn default() -> AuthenticatorAttachment { - Self::Platform - } -} diff --git a/crates/bitwarden-api-api/src/models/authenticator_attestation_raw_response.rs b/crates/bitwarden-api-api/src/models/authenticator_attestation_raw_response.rs deleted file mode 100644 index 61f804bb2..000000000 --- a/crates/bitwarden-api-api/src/models/authenticator_attestation_raw_response.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthenticatorAttestationRawResponse { - #[serde_as(as = "Option")] - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option>, - #[serde_as(as = "Option")] - #[serde(rename = "rawId", skip_serializing_if = "Option::is_none")] - pub raw_id: Option>, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "response", skip_serializing_if = "Option::is_none")] - pub response: Option>, - #[serde(rename = "extensions", skip_serializing_if = "Option::is_none")] - pub extensions: Option>, -} - -impl AuthenticatorAttestationRawResponse { - pub fn new() -> AuthenticatorAttestationRawResponse { - AuthenticatorAttestationRawResponse { - id: None, - raw_id: None, - r#type: None, - response: None, - extensions: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/authenticator_selection.rs b/crates/bitwarden-api-api/src/models/authenticator_selection.rs deleted file mode 100644 index e5b19345b..000000000 --- a/crates/bitwarden-api-api/src/models/authenticator_selection.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthenticatorSelection { - #[serde( - rename = "authenticatorAttachment", - skip_serializing_if = "Option::is_none" - )] - pub authenticator_attachment: Option, - #[serde(rename = "requireResidentKey", skip_serializing_if = "Option::is_none")] - pub require_resident_key: Option, - #[serde(rename = "userVerification", skip_serializing_if = "Option::is_none")] - pub user_verification: Option, -} - -impl AuthenticatorSelection { - pub fn new() -> AuthenticatorSelection { - AuthenticatorSelection { - authenticator_attachment: None, - require_resident_key: None, - user_verification: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/authenticator_transport.rs b/crates/bitwarden-api-api/src/models/authenticator_transport.rs deleted file mode 100644 index 764d3cb52..000000000 --- a/crates/bitwarden-api-api/src/models/authenticator_transport.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum AuthenticatorTransport { - #[serde(rename = "usb")] - Usb, - #[serde(rename = "nfc")] - Nfc, - #[serde(rename = "ble")] - Ble, - #[serde(rename = "internal")] - Internal, -} - -impl std::fmt::Display for AuthenticatorTransport { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Usb => write!(f, "usb"), - Self::Nfc => write!(f, "nfc"), - Self::Ble => write!(f, "ble"), - Self::Internal => write!(f, "internal"), - } - } -} - -impl Default for AuthenticatorTransport { - fn default() -> AuthenticatorTransport { - Self::Usb - } -} diff --git a/crates/bitwarden-api-api/src/models/base_secret_response_model.rs b/crates/bitwarden-api-api/src/models/base_secret_response_model.rs deleted file mode 100644 index 7a0d350b4..000000000 --- a/crates/bitwarden-api-api/src/models/base_secret_response_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BaseSecretResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "value", skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "note", skip_serializing_if = "Option::is_none")] - pub note: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option>, -} - -impl BaseSecretResponseModel { - pub fn new() -> BaseSecretResponseModel { - BaseSecretResponseModel { - object: None, - id: None, - organization_id: None, - key: None, - value: None, - note: None, - creation_date: None, - revision_date: None, - projects: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/base_secret_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/base_secret_response_model_list_response_model.rs deleted file mode 100644 index cd1cbc61d..000000000 --- a/crates/bitwarden-api-api/src/models/base_secret_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BaseSecretResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl BaseSecretResponseModelListResponseModel { - pub fn new() -> BaseSecretResponseModelListResponseModel { - BaseSecretResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_customer_discount.rs b/crates/bitwarden-api-api/src/models/billing_customer_discount.rs deleted file mode 100644 index f38de2711..000000000 --- a/crates/bitwarden-api-api/src/models/billing_customer_discount.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingCustomerDiscount { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "active", skip_serializing_if = "Option::is_none")] - pub active: Option, - #[serde(rename = "percentOff", skip_serializing_if = "Option::is_none")] - pub percent_off: Option, - #[serde(rename = "appliesTo", skip_serializing_if = "Option::is_none")] - pub applies_to: Option>, -} - -impl BillingCustomerDiscount { - pub fn new() -> BillingCustomerDiscount { - BillingCustomerDiscount { - id: None, - active: None, - percent_off: None, - applies_to: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_history_response_model.rs b/crates/bitwarden-api-api/src/models/billing_history_response_model.rs deleted file mode 100644 index f3e847c0f..000000000 --- a/crates/bitwarden-api-api/src/models/billing_history_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingHistoryResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "invoices", skip_serializing_if = "Option::is_none")] - pub invoices: Option>, - #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")] - pub transactions: Option>, -} - -impl BillingHistoryResponseModel { - pub fn new() -> BillingHistoryResponseModel { - BillingHistoryResponseModel { - object: None, - invoices: None, - transactions: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_invoice.rs b/crates/bitwarden-api-api/src/models/billing_invoice.rs deleted file mode 100644 index ee488ea0e..000000000 --- a/crates/bitwarden-api-api/src/models/billing_invoice.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingInvoice { - #[serde(rename = "amount", skip_serializing_if = "Option::is_none")] - pub amount: Option, - #[serde(rename = "date", skip_serializing_if = "Option::is_none")] - pub date: Option, - #[serde(rename = "url", skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "pdfUrl", skip_serializing_if = "Option::is_none")] - pub pdf_url: Option, - #[serde(rename = "number", skip_serializing_if = "Option::is_none")] - pub number: Option, - #[serde(rename = "paid", skip_serializing_if = "Option::is_none")] - pub paid: Option, -} - -impl BillingInvoice { - pub fn new() -> BillingInvoice { - BillingInvoice { - amount: None, - date: None, - url: None, - pdf_url: None, - number: None, - paid: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_payment_response_model.rs b/crates/bitwarden-api-api/src/models/billing_payment_response_model.rs deleted file mode 100644 index a614ee1f9..000000000 --- a/crates/bitwarden-api-api/src/models/billing_payment_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingPaymentResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "balance", skip_serializing_if = "Option::is_none")] - pub balance: Option, - #[serde(rename = "paymentSource", skip_serializing_if = "Option::is_none")] - pub payment_source: Option>, -} - -impl BillingPaymentResponseModel { - pub fn new() -> BillingPaymentResponseModel { - BillingPaymentResponseModel { - object: None, - balance: None, - payment_source: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_source.rs b/crates/bitwarden-api-api/src/models/billing_source.rs deleted file mode 100644 index 4d710d069..000000000 --- a/crates/bitwarden-api-api/src/models/billing_source.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingSource { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "cardBrand", skip_serializing_if = "Option::is_none")] - pub card_brand: Option, - #[serde(rename = "description", skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(rename = "needsVerification", skip_serializing_if = "Option::is_none")] - pub needs_verification: Option, -} - -impl BillingSource { - pub fn new() -> BillingSource { - BillingSource { - r#type: None, - card_brand: None, - description: None, - needs_verification: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_subscription.rs b/crates/bitwarden-api-api/src/models/billing_subscription.rs deleted file mode 100644 index 214949597..000000000 --- a/crates/bitwarden-api-api/src/models/billing_subscription.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingSubscription { - #[serde(rename = "trialStartDate", skip_serializing_if = "Option::is_none")] - pub trial_start_date: Option, - #[serde(rename = "trialEndDate", skip_serializing_if = "Option::is_none")] - pub trial_end_date: Option, - #[serde(rename = "periodStartDate", skip_serializing_if = "Option::is_none")] - pub period_start_date: Option, - #[serde(rename = "periodEndDate", skip_serializing_if = "Option::is_none")] - pub period_end_date: Option, - #[serde(rename = "cancelledDate", skip_serializing_if = "Option::is_none")] - pub cancelled_date: Option, - #[serde(rename = "cancelAtEndDate", skip_serializing_if = "Option::is_none")] - pub cancel_at_end_date: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "cancelled", skip_serializing_if = "Option::is_none")] - pub cancelled: Option, - #[serde(rename = "items", skip_serializing_if = "Option::is_none")] - pub items: Option>, - #[serde(rename = "collectionMethod", skip_serializing_if = "Option::is_none")] - pub collection_method: Option, - #[serde(rename = "suspensionDate", skip_serializing_if = "Option::is_none")] - pub suspension_date: Option, - #[serde( - rename = "unpaidPeriodEndDate", - skip_serializing_if = "Option::is_none" - )] - pub unpaid_period_end_date: Option, - #[serde(rename = "gracePeriod", skip_serializing_if = "Option::is_none")] - pub grace_period: Option, -} - -impl BillingSubscription { - pub fn new() -> BillingSubscription { - BillingSubscription { - trial_start_date: None, - trial_end_date: None, - period_start_date: None, - period_end_date: None, - cancelled_date: None, - cancel_at_end_date: None, - status: None, - cancelled: None, - items: None, - collection_method: None, - suspension_date: None, - unpaid_period_end_date: None, - grace_period: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_subscription_item.rs b/crates/bitwarden-api-api/src/models/billing_subscription_item.rs deleted file mode 100644 index d21b20e63..000000000 --- a/crates/bitwarden-api-api/src/models/billing_subscription_item.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingSubscriptionItem { - #[serde(rename = "productId", skip_serializing_if = "Option::is_none")] - pub product_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "amount", skip_serializing_if = "Option::is_none")] - pub amount: Option, - #[serde(rename = "quantity", skip_serializing_if = "Option::is_none")] - pub quantity: Option, - #[serde(rename = "interval", skip_serializing_if = "Option::is_none")] - pub interval: Option, - #[serde( - rename = "sponsoredSubscriptionItem", - skip_serializing_if = "Option::is_none" - )] - pub sponsored_subscription_item: Option, - #[serde( - rename = "addonSubscriptionItem", - skip_serializing_if = "Option::is_none" - )] - pub addon_subscription_item: Option, -} - -impl BillingSubscriptionItem { - pub fn new() -> BillingSubscriptionItem { - BillingSubscriptionItem { - product_id: None, - name: None, - amount: None, - quantity: None, - interval: None, - sponsored_subscription_item: None, - addon_subscription_item: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_subscription_upcoming_invoice.rs b/crates/bitwarden-api-api/src/models/billing_subscription_upcoming_invoice.rs deleted file mode 100644 index 0607b1483..000000000 --- a/crates/bitwarden-api-api/src/models/billing_subscription_upcoming_invoice.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingSubscriptionUpcomingInvoice { - #[serde(rename = "amount", skip_serializing_if = "Option::is_none")] - pub amount: Option, - #[serde(rename = "date", skip_serializing_if = "Option::is_none")] - pub date: Option, -} - -impl BillingSubscriptionUpcomingInvoice { - pub fn new() -> BillingSubscriptionUpcomingInvoice { - BillingSubscriptionUpcomingInvoice { - amount: None, - date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/billing_transaction.rs b/crates/bitwarden-api-api/src/models/billing_transaction.rs deleted file mode 100644 index d3204d510..000000000 --- a/crates/bitwarden-api-api/src/models/billing_transaction.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BillingTransaction { - #[serde(rename = "createdDate", skip_serializing_if = "Option::is_none")] - pub created_date: Option, - #[serde(rename = "amount", skip_serializing_if = "Option::is_none")] - pub amount: Option, - #[serde(rename = "refunded", skip_serializing_if = "Option::is_none")] - pub refunded: Option, - #[serde(rename = "partiallyRefunded", skip_serializing_if = "Option::is_none")] - pub partially_refunded: Option, - #[serde(rename = "refundedAmount", skip_serializing_if = "Option::is_none")] - pub refunded_amount: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "paymentMethodType", skip_serializing_if = "Option::is_none")] - pub payment_method_type: Option, - #[serde(rename = "details", skip_serializing_if = "Option::is_none")] - pub details: Option, -} - -impl BillingTransaction { - pub fn new() -> BillingTransaction { - BillingTransaction { - created_date: None, - amount: None, - refunded: None, - partially_refunded: None, - refunded_amount: None, - r#type: None, - payment_method_type: None, - details: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/bit_pay_invoice_request_model.rs b/crates/bitwarden-api-api/src/models/bit_pay_invoice_request_model.rs deleted file mode 100644 index 42e71a66f..000000000 --- a/crates/bitwarden-api-api/src/models/bit_pay_invoice_request_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BitPayInvoiceRequestModel { - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "providerId", skip_serializing_if = "Option::is_none")] - pub provider_id: Option, - #[serde(rename = "credit", skip_serializing_if = "Option::is_none")] - pub credit: Option, - #[serde(rename = "amount")] - pub amount: f64, - #[serde(rename = "returnUrl", skip_serializing_if = "Option::is_none")] - pub return_url: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, -} - -impl BitPayInvoiceRequestModel { - pub fn new(amount: f64) -> BitPayInvoiceRequestModel { - BitPayInvoiceRequestModel { - user_id: None, - organization_id: None, - provider_id: None, - credit: None, - amount, - return_url: None, - name: None, - email: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/bulk_collection_access_request_model.rs b/crates/bitwarden-api-api/src/models/bulk_collection_access_request_model.rs deleted file mode 100644 index 78f32c3cf..000000000 --- a/crates/bitwarden-api-api/src/models/bulk_collection_access_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BulkCollectionAccessRequestModel { - #[serde(rename = "collectionIds", skip_serializing_if = "Option::is_none")] - pub collection_ids: Option>, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, - #[serde(rename = "users", skip_serializing_if = "Option::is_none")] - pub users: Option>, -} - -impl BulkCollectionAccessRequestModel { - pub fn new() -> BulkCollectionAccessRequestModel { - BulkCollectionAccessRequestModel { - collection_ids: None, - groups: None, - users: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/bulk_delete_response_model.rs b/crates/bitwarden-api-api/src/models/bulk_delete_response_model.rs deleted file mode 100644 index 43b1d6b8f..000000000 --- a/crates/bitwarden-api-api/src/models/bulk_delete_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BulkDeleteResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "error", skip_serializing_if = "Option::is_none")] - pub error: Option, -} - -impl BulkDeleteResponseModel { - pub fn new() -> BulkDeleteResponseModel { - BulkDeleteResponseModel { - object: None, - id: None, - error: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/bulk_delete_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/bulk_delete_response_model_list_response_model.rs deleted file mode 100644 index b93a7a0db..000000000 --- a/crates/bitwarden-api-api/src/models/bulk_delete_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BulkDeleteResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl BulkDeleteResponseModelListResponseModel { - pub fn new() -> BulkDeleteResponseModelListResponseModel { - BulkDeleteResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/bulk_deny_admin_auth_request_request_model.rs b/crates/bitwarden-api-api/src/models/bulk_deny_admin_auth_request_request_model.rs deleted file mode 100644 index 258d913f2..000000000 --- a/crates/bitwarden-api-api/src/models/bulk_deny_admin_auth_request_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct BulkDenyAdminAuthRequestRequestModel { - #[serde(rename = "ids", skip_serializing_if = "Option::is_none")] - pub ids: Option>, -} - -impl BulkDenyAdminAuthRequestRequestModel { - pub fn new() -> BulkDenyAdminAuthRequestRequestModel { - BulkDenyAdminAuthRequestRequestModel { ids: None } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_attachment_model.rs b/crates/bitwarden-api-api/src/models/cipher_attachment_model.rs deleted file mode 100644 index 645d1f81d..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_attachment_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherAttachmentModel { - #[serde(rename = "fileName", skip_serializing_if = "Option::is_none")] - pub file_name: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, -} - -impl CipherAttachmentModel { - pub fn new() -> CipherAttachmentModel { - CipherAttachmentModel { - file_name: None, - key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_bulk_delete_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_bulk_delete_request_model.rs deleted file mode 100644 index ca1365c9c..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_bulk_delete_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherBulkDeleteRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, -} - -impl CipherBulkDeleteRequestModel { - pub fn new(ids: Vec) -> CipherBulkDeleteRequestModel { - CipherBulkDeleteRequestModel { - ids, - organization_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_bulk_move_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_bulk_move_request_model.rs deleted file mode 100644 index 58ad9f99d..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_bulk_move_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherBulkMoveRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, - #[serde(rename = "folderId", skip_serializing_if = "Option::is_none")] - pub folder_id: Option, -} - -impl CipherBulkMoveRequestModel { - pub fn new(ids: Vec) -> CipherBulkMoveRequestModel { - CipherBulkMoveRequestModel { - ids, - folder_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_bulk_restore_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_bulk_restore_request_model.rs deleted file mode 100644 index 0cc1845ab..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_bulk_restore_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherBulkRestoreRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, -} - -impl CipherBulkRestoreRequestModel { - pub fn new(ids: Vec) -> CipherBulkRestoreRequestModel { - CipherBulkRestoreRequestModel { - ids, - organization_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_bulk_share_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_bulk_share_request_model.rs deleted file mode 100644 index 23e8004da..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_bulk_share_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherBulkShareRequestModel { - #[serde(rename = "collectionIds")] - pub collection_ids: Vec, - #[serde(rename = "ciphers")] - pub ciphers: Vec, -} - -impl CipherBulkShareRequestModel { - pub fn new( - collection_ids: Vec, - ciphers: Vec, - ) -> CipherBulkShareRequestModel { - CipherBulkShareRequestModel { - collection_ids, - ciphers, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_bulk_update_collections_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_bulk_update_collections_request_model.rs deleted file mode 100644 index 383824d6d..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_bulk_update_collections_request_model.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherBulkUpdateCollectionsRequestModel { - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "cipherIds", skip_serializing_if = "Option::is_none")] - pub cipher_ids: Option>, - #[serde(rename = "collectionIds", skip_serializing_if = "Option::is_none")] - pub collection_ids: Option>, - /// If true, the collections will be removed from the ciphers. Otherwise, they will be added. - #[serde(rename = "removeCollections", skip_serializing_if = "Option::is_none")] - pub remove_collections: Option, -} - -impl CipherBulkUpdateCollectionsRequestModel { - pub fn new() -> CipherBulkUpdateCollectionsRequestModel { - CipherBulkUpdateCollectionsRequestModel { - organization_id: None, - cipher_ids: None, - collection_ids: None, - remove_collections: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_card_model.rs b/crates/bitwarden-api-api/src/models/cipher_card_model.rs deleted file mode 100644 index 0143cf70f..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_card_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherCardModel { - #[serde(rename = "cardholderName", skip_serializing_if = "Option::is_none")] - pub cardholder_name: Option, - #[serde(rename = "brand", skip_serializing_if = "Option::is_none")] - pub brand: Option, - #[serde(rename = "number", skip_serializing_if = "Option::is_none")] - pub number: Option, - #[serde(rename = "expMonth", skip_serializing_if = "Option::is_none")] - pub exp_month: Option, - #[serde(rename = "expYear", skip_serializing_if = "Option::is_none")] - pub exp_year: Option, - #[serde(rename = "code", skip_serializing_if = "Option::is_none")] - pub code: Option, -} - -impl CipherCardModel { - pub fn new() -> CipherCardModel { - CipherCardModel { - cardholder_name: None, - brand: None, - number: None, - exp_month: None, - exp_year: None, - code: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_collections_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_collections_request_model.rs deleted file mode 100644 index d43bc11dd..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_collections_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherCollectionsRequestModel { - #[serde(rename = "collectionIds")] - pub collection_ids: Vec, -} - -impl CipherCollectionsRequestModel { - pub fn new(collection_ids: Vec) -> CipherCollectionsRequestModel { - CipherCollectionsRequestModel { collection_ids } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_create_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_create_request_model.rs deleted file mode 100644 index f8a7cbcb6..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_create_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherCreateRequestModel { - #[serde(rename = "collectionIds", skip_serializing_if = "Option::is_none")] - pub collection_ids: Option>, - #[serde(rename = "cipher")] - pub cipher: Box, -} - -impl CipherCreateRequestModel { - pub fn new(cipher: models::CipherRequestModel) -> CipherCreateRequestModel { - CipherCreateRequestModel { - collection_ids: None, - cipher: Box::new(cipher), - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_details_response_model.rs b/crates/bitwarden-api-api/src/models/cipher_details_response_model.rs deleted file mode 100644 index e37afbf2d..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_details_response_model.rs +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "login", skip_serializing_if = "Option::is_none")] - pub login: Option>, - #[serde(rename = "card", skip_serializing_if = "Option::is_none")] - pub card: Option>, - #[serde(rename = "identity", skip_serializing_if = "Option::is_none")] - pub identity: Option>, - #[serde(rename = "secureNote", skip_serializing_if = "Option::is_none")] - pub secure_note: Option>, - #[serde(rename = "fields", skip_serializing_if = "Option::is_none")] - pub fields: Option>, - #[serde(rename = "passwordHistory", skip_serializing_if = "Option::is_none")] - pub password_history: Option>, - #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - #[serde( - rename = "organizationUseTotp", - skip_serializing_if = "Option::is_none" - )] - pub organization_use_totp: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "deletedDate", skip_serializing_if = "Option::is_none")] - pub deleted_date: Option, - #[serde(rename = "reprompt", skip_serializing_if = "Option::is_none")] - pub reprompt: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "folderId", skip_serializing_if = "Option::is_none")] - pub folder_id: Option, - #[serde(rename = "favorite", skip_serializing_if = "Option::is_none")] - pub favorite: Option, - #[serde(rename = "edit", skip_serializing_if = "Option::is_none")] - pub edit: Option, - #[serde(rename = "viewPassword", skip_serializing_if = "Option::is_none")] - pub view_password: Option, - #[serde(rename = "collectionIds", skip_serializing_if = "Option::is_none")] - pub collection_ids: Option>, -} - -impl CipherDetailsResponseModel { - pub fn new() -> CipherDetailsResponseModel { - CipherDetailsResponseModel { - object: None, - id: None, - organization_id: None, - r#type: None, - data: None, - name: None, - notes: None, - login: None, - card: None, - identity: None, - secure_note: None, - fields: None, - password_history: None, - attachments: None, - organization_use_totp: None, - revision_date: None, - creation_date: None, - deleted_date: None, - reprompt: None, - key: None, - folder_id: None, - favorite: None, - edit: None, - view_password: None, - collection_ids: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/cipher_details_response_model_list_response_model.rs deleted file mode 100644 index ce8b588d5..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl CipherDetailsResponseModelListResponseModel { - pub fn new() -> CipherDetailsResponseModelListResponseModel { - CipherDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_fido2_credential_model.rs b/crates/bitwarden-api-api/src/models/cipher_fido2_credential_model.rs deleted file mode 100644 index 09e761b41..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_fido2_credential_model.rs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherFido2CredentialModel { - #[serde(rename = "credentialId", skip_serializing_if = "Option::is_none")] - pub credential_id: Option, - #[serde(rename = "keyType", skip_serializing_if = "Option::is_none")] - pub key_type: Option, - #[serde(rename = "keyAlgorithm", skip_serializing_if = "Option::is_none")] - pub key_algorithm: Option, - #[serde(rename = "keyCurve", skip_serializing_if = "Option::is_none")] - pub key_curve: Option, - #[serde(rename = "keyValue", skip_serializing_if = "Option::is_none")] - pub key_value: Option, - #[serde(rename = "rpId", skip_serializing_if = "Option::is_none")] - pub rp_id: Option, - #[serde(rename = "rpName", skip_serializing_if = "Option::is_none")] - pub rp_name: Option, - #[serde(rename = "userHandle", skip_serializing_if = "Option::is_none")] - pub user_handle: Option, - #[serde(rename = "userName", skip_serializing_if = "Option::is_none")] - pub user_name: Option, - #[serde(rename = "userDisplayName", skip_serializing_if = "Option::is_none")] - pub user_display_name: Option, - #[serde(rename = "counter", skip_serializing_if = "Option::is_none")] - pub counter: Option, - #[serde(rename = "discoverable", skip_serializing_if = "Option::is_none")] - pub discoverable: Option, - #[serde(rename = "creationDate")] - pub creation_date: String, -} - -impl CipherFido2CredentialModel { - pub fn new(creation_date: String) -> CipherFido2CredentialModel { - CipherFido2CredentialModel { - credential_id: None, - key_type: None, - key_algorithm: None, - key_curve: None, - key_value: None, - rp_id: None, - rp_name: None, - user_handle: None, - user_name: None, - user_display_name: None, - counter: None, - discoverable: None, - creation_date, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_field_model.rs b/crates/bitwarden-api-api/src/models/cipher_field_model.rs deleted file mode 100644 index 872fb2c0e..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_field_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherFieldModel { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "value", skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "linkedId", skip_serializing_if = "Option::is_none")] - pub linked_id: Option, -} - -impl CipherFieldModel { - pub fn new() -> CipherFieldModel { - CipherFieldModel { - r#type: None, - name: None, - value: None, - linked_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_identity_model.rs b/crates/bitwarden-api-api/src/models/cipher_identity_model.rs deleted file mode 100644 index 2d2c6923e..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_identity_model.rs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherIdentityModel { - #[serde(rename = "title", skip_serializing_if = "Option::is_none")] - pub title: Option, - #[serde(rename = "firstName", skip_serializing_if = "Option::is_none")] - pub first_name: Option, - #[serde(rename = "middleName", skip_serializing_if = "Option::is_none")] - pub middle_name: Option, - #[serde(rename = "lastName", skip_serializing_if = "Option::is_none")] - pub last_name: Option, - #[serde(rename = "address1", skip_serializing_if = "Option::is_none")] - pub address1: Option, - #[serde(rename = "address2", skip_serializing_if = "Option::is_none")] - pub address2: Option, - #[serde(rename = "address3", skip_serializing_if = "Option::is_none")] - pub address3: Option, - #[serde(rename = "city", skip_serializing_if = "Option::is_none")] - pub city: Option, - #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, - #[serde(rename = "postalCode", skip_serializing_if = "Option::is_none")] - pub postal_code: Option, - #[serde(rename = "country", skip_serializing_if = "Option::is_none")] - pub country: Option, - #[serde(rename = "company", skip_serializing_if = "Option::is_none")] - pub company: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "phone", skip_serializing_if = "Option::is_none")] - pub phone: Option, - #[serde(rename = "ssn", skip_serializing_if = "Option::is_none")] - pub ssn: Option, - #[serde(rename = "username", skip_serializing_if = "Option::is_none")] - pub username: Option, - #[serde(rename = "passportNumber", skip_serializing_if = "Option::is_none")] - pub passport_number: Option, - #[serde(rename = "licenseNumber", skip_serializing_if = "Option::is_none")] - pub license_number: Option, -} - -impl CipherIdentityModel { - pub fn new() -> CipherIdentityModel { - CipherIdentityModel { - title: None, - first_name: None, - middle_name: None, - last_name: None, - address1: None, - address2: None, - address3: None, - city: None, - state: None, - postal_code: None, - country: None, - company: None, - email: None, - phone: None, - ssn: None, - username: None, - passport_number: None, - license_number: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_login_model.rs b/crates/bitwarden-api-api/src/models/cipher_login_model.rs deleted file mode 100644 index 7b3bd1897..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_login_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherLoginModel { - #[serde(rename = "uri", skip_serializing_if = "Option::is_none")] - pub uri: Option, - #[serde(rename = "uris", skip_serializing_if = "Option::is_none")] - pub uris: Option>, - #[serde(rename = "username", skip_serializing_if = "Option::is_none")] - pub username: Option, - #[serde(rename = "password", skip_serializing_if = "Option::is_none")] - pub password: Option, - #[serde( - rename = "passwordRevisionDate", - skip_serializing_if = "Option::is_none" - )] - pub password_revision_date: Option, - #[serde(rename = "totp", skip_serializing_if = "Option::is_none")] - pub totp: Option, - #[serde(rename = "autofillOnPageLoad", skip_serializing_if = "Option::is_none")] - pub autofill_on_page_load: Option, - #[serde(rename = "fido2Credentials", skip_serializing_if = "Option::is_none")] - pub fido2_credentials: Option>, -} - -impl CipherLoginModel { - pub fn new() -> CipherLoginModel { - CipherLoginModel { - uri: None, - uris: None, - username: None, - password: None, - password_revision_date: None, - totp: None, - autofill_on_page_load: None, - fido2_credentials: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_login_uri_model.rs b/crates/bitwarden-api-api/src/models/cipher_login_uri_model.rs deleted file mode 100644 index cbb0dec55..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_login_uri_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherLoginUriModel { - #[serde(rename = "uri", skip_serializing_if = "Option::is_none")] - pub uri: Option, - #[serde(rename = "uriChecksum", skip_serializing_if = "Option::is_none")] - pub uri_checksum: Option, - #[serde(rename = "match", skip_serializing_if = "Option::is_none")] - pub r#match: Option, -} - -impl CipherLoginUriModel { - pub fn new() -> CipherLoginUriModel { - CipherLoginUriModel { - uri: None, - uri_checksum: None, - r#match: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_mini_details_response_model.rs b/crates/bitwarden-api-api/src/models/cipher_mini_details_response_model.rs deleted file mode 100644 index 011116ae0..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_mini_details_response_model.rs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherMiniDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "login", skip_serializing_if = "Option::is_none")] - pub login: Option>, - #[serde(rename = "card", skip_serializing_if = "Option::is_none")] - pub card: Option>, - #[serde(rename = "identity", skip_serializing_if = "Option::is_none")] - pub identity: Option>, - #[serde(rename = "secureNote", skip_serializing_if = "Option::is_none")] - pub secure_note: Option>, - #[serde(rename = "fields", skip_serializing_if = "Option::is_none")] - pub fields: Option>, - #[serde(rename = "passwordHistory", skip_serializing_if = "Option::is_none")] - pub password_history: Option>, - #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - #[serde( - rename = "organizationUseTotp", - skip_serializing_if = "Option::is_none" - )] - pub organization_use_totp: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "deletedDate", skip_serializing_if = "Option::is_none")] - pub deleted_date: Option, - #[serde(rename = "reprompt", skip_serializing_if = "Option::is_none")] - pub reprompt: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "collectionIds", skip_serializing_if = "Option::is_none")] - pub collection_ids: Option>, -} - -impl CipherMiniDetailsResponseModel { - pub fn new() -> CipherMiniDetailsResponseModel { - CipherMiniDetailsResponseModel { - object: None, - id: None, - organization_id: None, - r#type: None, - data: None, - name: None, - notes: None, - login: None, - card: None, - identity: None, - secure_note: None, - fields: None, - password_history: None, - attachments: None, - organization_use_totp: None, - revision_date: None, - creation_date: None, - deleted_date: None, - reprompt: None, - key: None, - collection_ids: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_mini_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/cipher_mini_details_response_model_list_response_model.rs deleted file mode 100644 index 8acd2a4b9..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_mini_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherMiniDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl CipherMiniDetailsResponseModelListResponseModel { - pub fn new() -> CipherMiniDetailsResponseModelListResponseModel { - CipherMiniDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_mini_response_model.rs b/crates/bitwarden-api-api/src/models/cipher_mini_response_model.rs deleted file mode 100644 index 8a27f70bd..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_mini_response_model.rs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherMiniResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "login", skip_serializing_if = "Option::is_none")] - pub login: Option>, - #[serde(rename = "card", skip_serializing_if = "Option::is_none")] - pub card: Option>, - #[serde(rename = "identity", skip_serializing_if = "Option::is_none")] - pub identity: Option>, - #[serde(rename = "secureNote", skip_serializing_if = "Option::is_none")] - pub secure_note: Option>, - #[serde(rename = "fields", skip_serializing_if = "Option::is_none")] - pub fields: Option>, - #[serde(rename = "passwordHistory", skip_serializing_if = "Option::is_none")] - pub password_history: Option>, - #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - #[serde( - rename = "organizationUseTotp", - skip_serializing_if = "Option::is_none" - )] - pub organization_use_totp: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "deletedDate", skip_serializing_if = "Option::is_none")] - pub deleted_date: Option, - #[serde(rename = "reprompt", skip_serializing_if = "Option::is_none")] - pub reprompt: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, -} - -impl CipherMiniResponseModel { - pub fn new() -> CipherMiniResponseModel { - CipherMiniResponseModel { - object: None, - id: None, - organization_id: None, - r#type: None, - data: None, - name: None, - notes: None, - login: None, - card: None, - identity: None, - secure_note: None, - fields: None, - password_history: None, - attachments: None, - organization_use_totp: None, - revision_date: None, - creation_date: None, - deleted_date: None, - reprompt: None, - key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_mini_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/cipher_mini_response_model_list_response_model.rs deleted file mode 100644 index 6509df390..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_mini_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherMiniResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl CipherMiniResponseModelListResponseModel { - pub fn new() -> CipherMiniResponseModelListResponseModel { - CipherMiniResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_partial_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_partial_request_model.rs deleted file mode 100644 index 390429d69..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_partial_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherPartialRequestModel { - #[serde(rename = "folderId", skip_serializing_if = "Option::is_none")] - pub folder_id: Option, - #[serde(rename = "favorite", skip_serializing_if = "Option::is_none")] - pub favorite: Option, -} - -impl CipherPartialRequestModel { - pub fn new() -> CipherPartialRequestModel { - CipherPartialRequestModel { - folder_id: None, - favorite: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_password_history_model.rs b/crates/bitwarden-api-api/src/models/cipher_password_history_model.rs deleted file mode 100644 index be5e69ee2..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_password_history_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherPasswordHistoryModel { - #[serde(rename = "password")] - pub password: String, - #[serde(rename = "lastUsedDate")] - pub last_used_date: String, -} - -impl CipherPasswordHistoryModel { - pub fn new(password: String, last_used_date: String) -> CipherPasswordHistoryModel { - CipherPasswordHistoryModel { - password, - last_used_date, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_reprompt_type.rs b/crates/bitwarden-api-api/src/models/cipher_reprompt_type.rs deleted file mode 100644 index e8c0c0352..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_reprompt_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum CipherRepromptType { - None = 0, - Password = 1, -} - -impl std::fmt::Display for CipherRepromptType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::None => write!(f, "0"), - Self::Password => write!(f, "1"), - } - } -} - -impl Default for CipherRepromptType { - fn default() -> CipherRepromptType { - Self::None - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_request_model.rs deleted file mode 100644 index d4222455c..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_request_model.rs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherRequestModel { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "folderId", skip_serializing_if = "Option::is_none")] - pub folder_id: Option, - #[serde(rename = "favorite", skip_serializing_if = "Option::is_none")] - pub favorite: Option, - #[serde(rename = "reprompt", skip_serializing_if = "Option::is_none")] - pub reprompt: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "fields", skip_serializing_if = "Option::is_none")] - pub fields: Option>, - #[serde(rename = "passwordHistory", skip_serializing_if = "Option::is_none")] - pub password_history: Option>, - #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - #[serde(rename = "attachments2", skip_serializing_if = "Option::is_none")] - pub attachments2: Option>, - #[serde(rename = "login", skip_serializing_if = "Option::is_none")] - pub login: Option>, - #[serde(rename = "card", skip_serializing_if = "Option::is_none")] - pub card: Option>, - #[serde(rename = "identity", skip_serializing_if = "Option::is_none")] - pub identity: Option>, - #[serde(rename = "secureNote", skip_serializing_if = "Option::is_none")] - pub secure_note: Option>, - #[serde( - rename = "lastKnownRevisionDate", - skip_serializing_if = "Option::is_none" - )] - pub last_known_revision_date: Option, -} - -impl CipherRequestModel { - pub fn new(name: String) -> CipherRequestModel { - CipherRequestModel { - r#type: None, - organization_id: None, - folder_id: None, - favorite: None, - reprompt: None, - key: None, - name, - notes: None, - fields: None, - password_history: None, - attachments: None, - attachments2: None, - login: None, - card: None, - identity: None, - secure_note: None, - last_known_revision_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_response_model.rs b/crates/bitwarden-api-api/src/models/cipher_response_model.rs deleted file mode 100644 index 4520b3534..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_response_model.rs +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "login", skip_serializing_if = "Option::is_none")] - pub login: Option>, - #[serde(rename = "card", skip_serializing_if = "Option::is_none")] - pub card: Option>, - #[serde(rename = "identity", skip_serializing_if = "Option::is_none")] - pub identity: Option>, - #[serde(rename = "secureNote", skip_serializing_if = "Option::is_none")] - pub secure_note: Option>, - #[serde(rename = "fields", skip_serializing_if = "Option::is_none")] - pub fields: Option>, - #[serde(rename = "passwordHistory", skip_serializing_if = "Option::is_none")] - pub password_history: Option>, - #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - #[serde( - rename = "organizationUseTotp", - skip_serializing_if = "Option::is_none" - )] - pub organization_use_totp: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "deletedDate", skip_serializing_if = "Option::is_none")] - pub deleted_date: Option, - #[serde(rename = "reprompt", skip_serializing_if = "Option::is_none")] - pub reprompt: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "folderId", skip_serializing_if = "Option::is_none")] - pub folder_id: Option, - #[serde(rename = "favorite", skip_serializing_if = "Option::is_none")] - pub favorite: Option, - #[serde(rename = "edit", skip_serializing_if = "Option::is_none")] - pub edit: Option, - #[serde(rename = "viewPassword", skip_serializing_if = "Option::is_none")] - pub view_password: Option, -} - -impl CipherResponseModel { - pub fn new() -> CipherResponseModel { - CipherResponseModel { - object: None, - id: None, - organization_id: None, - r#type: None, - data: None, - name: None, - notes: None, - login: None, - card: None, - identity: None, - secure_note: None, - fields: None, - password_history: None, - attachments: None, - organization_use_totp: None, - revision_date: None, - creation_date: None, - deleted_date: None, - reprompt: None, - key: None, - folder_id: None, - favorite: None, - edit: None, - view_password: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_secure_note_model.rs b/crates/bitwarden-api-api/src/models/cipher_secure_note_model.rs deleted file mode 100644 index 14d8b9837..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_secure_note_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherSecureNoteModel { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, -} - -impl CipherSecureNoteModel { - pub fn new() -> CipherSecureNoteModel { - CipherSecureNoteModel { r#type: None } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_share_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_share_request_model.rs deleted file mode 100644 index dfecc2630..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_share_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherShareRequestModel { - #[serde(rename = "collectionIds")] - pub collection_ids: Vec, - #[serde(rename = "cipher")] - pub cipher: Box, -} - -impl CipherShareRequestModel { - pub fn new( - collection_ids: Vec, - cipher: models::CipherRequestModel, - ) -> CipherShareRequestModel { - CipherShareRequestModel { - collection_ids, - cipher: Box::new(cipher), - } - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_type.rs b/crates/bitwarden-api-api/src/models/cipher_type.rs deleted file mode 100644 index 4a76d5a1d..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_type.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum CipherType { - Login = 1, - SecureNote = 2, - Card = 3, - Identity = 4, -} - -impl std::fmt::Display for CipherType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Login => write!(f, "1"), - Self::SecureNote => write!(f, "2"), - Self::Card => write!(f, "3"), - Self::Identity => write!(f, "4"), - } - } -} - -impl Default for CipherType { - fn default() -> CipherType { - Self::Login - } -} diff --git a/crates/bitwarden-api-api/src/models/cipher_with_id_request_model.rs b/crates/bitwarden-api-api/src/models/cipher_with_id_request_model.rs deleted file mode 100644 index c18ac4ecd..000000000 --- a/crates/bitwarden-api-api/src/models/cipher_with_id_request_model.rs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CipherWithIdRequestModel { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "folderId", skip_serializing_if = "Option::is_none")] - pub folder_id: Option, - #[serde(rename = "favorite", skip_serializing_if = "Option::is_none")] - pub favorite: Option, - #[serde(rename = "reprompt", skip_serializing_if = "Option::is_none")] - pub reprompt: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "fields", skip_serializing_if = "Option::is_none")] - pub fields: Option>, - #[serde(rename = "passwordHistory", skip_serializing_if = "Option::is_none")] - pub password_history: Option>, - #[serde(rename = "attachments", skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - #[serde(rename = "attachments2", skip_serializing_if = "Option::is_none")] - pub attachments2: Option>, - #[serde(rename = "login", skip_serializing_if = "Option::is_none")] - pub login: Option>, - #[serde(rename = "card", skip_serializing_if = "Option::is_none")] - pub card: Option>, - #[serde(rename = "identity", skip_serializing_if = "Option::is_none")] - pub identity: Option>, - #[serde(rename = "secureNote", skip_serializing_if = "Option::is_none")] - pub secure_note: Option>, - #[serde( - rename = "lastKnownRevisionDate", - skip_serializing_if = "Option::is_none" - )] - pub last_known_revision_date: Option, - #[serde(rename = "id")] - pub id: uuid::Uuid, -} - -impl CipherWithIdRequestModel { - pub fn new(name: String, id: uuid::Uuid) -> CipherWithIdRequestModel { - CipherWithIdRequestModel { - r#type: None, - organization_id: None, - folder_id: None, - favorite: None, - reprompt: None, - key: None, - name, - notes: None, - fields: None, - password_history: None, - attachments: None, - attachments2: None, - login: None, - card: None, - identity: None, - secure_note: None, - last_known_revision_date: None, - id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_access_details_response_model.rs b/crates/bitwarden-api-api/src/models/collection_access_details_response_model.rs deleted file mode 100644 index 0d6f53b9e..000000000 --- a/crates/bitwarden-api-api/src/models/collection_access_details_response_model.rs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionAccessDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, - #[serde(rename = "users", skip_serializing_if = "Option::is_none")] - pub users: Option>, - /// True if the acting user is explicitly assigned to the collection - #[serde(rename = "assigned", skip_serializing_if = "Option::is_none")] - pub assigned: Option, - #[serde(rename = "readOnly", skip_serializing_if = "Option::is_none")] - pub read_only: Option, - #[serde(rename = "hidePasswords", skip_serializing_if = "Option::is_none")] - pub hide_passwords: Option, - #[serde(rename = "manage", skip_serializing_if = "Option::is_none")] - pub manage: Option, - #[serde(rename = "unmanaged", skip_serializing_if = "Option::is_none")] - pub unmanaged: Option, -} - -impl CollectionAccessDetailsResponseModel { - pub fn new() -> CollectionAccessDetailsResponseModel { - CollectionAccessDetailsResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - external_id: None, - groups: None, - users: None, - assigned: None, - read_only: None, - hide_passwords: None, - manage: None, - unmanaged: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_access_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/collection_access_details_response_model_list_response_model.rs deleted file mode 100644 index fb925d416..000000000 --- a/crates/bitwarden-api-api/src/models/collection_access_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionAccessDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl CollectionAccessDetailsResponseModelListResponseModel { - pub fn new() -> CollectionAccessDetailsResponseModelListResponseModel { - CollectionAccessDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_bulk_delete_request_model.rs b/crates/bitwarden-api-api/src/models/collection_bulk_delete_request_model.rs deleted file mode 100644 index efda36f4a..000000000 --- a/crates/bitwarden-api-api/src/models/collection_bulk_delete_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionBulkDeleteRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, -} - -impl CollectionBulkDeleteRequestModel { - pub fn new(ids: Vec) -> CollectionBulkDeleteRequestModel { - CollectionBulkDeleteRequestModel { ids } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_details_response_model.rs b/crates/bitwarden-api-api/src/models/collection_details_response_model.rs deleted file mode 100644 index 3a3f0892a..000000000 --- a/crates/bitwarden-api-api/src/models/collection_details_response_model.rs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// CollectionDetailsResponseModel : Response model for a collection that is always assigned to the -/// requesting user, including permissions. -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde(rename = "readOnly", skip_serializing_if = "Option::is_none")] - pub read_only: Option, - #[serde(rename = "hidePasswords", skip_serializing_if = "Option::is_none")] - pub hide_passwords: Option, - #[serde(rename = "manage", skip_serializing_if = "Option::is_none")] - pub manage: Option, -} - -impl CollectionDetailsResponseModel { - /// Response model for a collection that is always assigned to the requesting user, including - /// permissions. - pub fn new() -> CollectionDetailsResponseModel { - CollectionDetailsResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - external_id: None, - read_only: None, - hide_passwords: None, - manage: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/collection_details_response_model_list_response_model.rs deleted file mode 100644 index 113a0ff5d..000000000 --- a/crates/bitwarden-api-api/src/models/collection_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl CollectionDetailsResponseModelListResponseModel { - pub fn new() -> CollectionDetailsResponseModelListResponseModel { - CollectionDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_request_model.rs b/crates/bitwarden-api-api/src/models/collection_request_model.rs deleted file mode 100644 index 7217fd160..000000000 --- a/crates/bitwarden-api-api/src/models/collection_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, - #[serde(rename = "users", skip_serializing_if = "Option::is_none")] - pub users: Option>, -} - -impl CollectionRequestModel { - pub fn new(name: String) -> CollectionRequestModel { - CollectionRequestModel { - name, - external_id: None, - groups: None, - users: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_response_model.rs b/crates/bitwarden-api-api/src/models/collection_response_model.rs deleted file mode 100644 index a8b0efb9f..000000000 --- a/crates/bitwarden-api-api/src/models/collection_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, -} - -impl CollectionResponseModel { - pub fn new() -> CollectionResponseModel { - CollectionResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - external_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/collection_response_model_list_response_model.rs deleted file mode 100644 index 219c3c6db..000000000 --- a/crates/bitwarden-api-api/src/models/collection_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl CollectionResponseModelListResponseModel { - pub fn new() -> CollectionResponseModelListResponseModel { - CollectionResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/collection_with_id_request_model.rs b/crates/bitwarden-api-api/src/models/collection_with_id_request_model.rs deleted file mode 100644 index 61eafe0b9..000000000 --- a/crates/bitwarden-api-api/src/models/collection_with_id_request_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CollectionWithIdRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, - #[serde(rename = "users", skip_serializing_if = "Option::is_none")] - pub users: Option>, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, -} - -impl CollectionWithIdRequestModel { - pub fn new(name: String) -> CollectionWithIdRequestModel { - CollectionWithIdRequestModel { - name, - external_id: None, - groups: None, - users: None, - id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/config_response_model.rs b/crates/bitwarden-api-api/src/models/config_response_model.rs deleted file mode 100644 index 5ac9b3084..000000000 --- a/crates/bitwarden-api-api/src/models/config_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ConfigResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "version", skip_serializing_if = "Option::is_none")] - pub version: Option, - #[serde(rename = "gitHash", skip_serializing_if = "Option::is_none")] - pub git_hash: Option, - #[serde(rename = "server", skip_serializing_if = "Option::is_none")] - pub server: Option>, - #[serde(rename = "environment", skip_serializing_if = "Option::is_none")] - pub environment: Option>, - #[serde(rename = "featureStates", skip_serializing_if = "Option::is_none")] - pub feature_states: Option>, -} - -impl ConfigResponseModel { - pub fn new() -> ConfigResponseModel { - ConfigResponseModel { - object: None, - version: None, - git_hash: None, - server: None, - environment: None, - feature_states: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/create_client_organization_request_body.rs b/crates/bitwarden-api-api/src/models/create_client_organization_request_body.rs deleted file mode 100644 index c3f2ad13a..000000000 --- a/crates/bitwarden-api-api/src/models/create_client_organization_request_body.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CreateClientOrganizationRequestBody { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "ownerEmail")] - pub owner_email: String, - #[serde(rename = "planType", skip_serializing_if = "Option::is_none")] - pub plan_type: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "keyPair")] - pub key_pair: Box, - #[serde(rename = "collectionName")] - pub collection_name: String, -} - -impl CreateClientOrganizationRequestBody { - pub fn new( - name: String, - owner_email: String, - key: String, - key_pair: models::KeyPairRequestBody, - collection_name: String, - ) -> CreateClientOrganizationRequestBody { - CreateClientOrganizationRequestBody { - name, - owner_email, - plan_type: None, - seats: None, - key, - key_pair: Box::new(key_pair), - collection_name, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/credential_create_options.rs b/crates/bitwarden-api-api/src/models/credential_create_options.rs deleted file mode 100644 index 4674f8a18..000000000 --- a/crates/bitwarden-api-api/src/models/credential_create_options.rs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CredentialCreateOptions { - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde(rename = "rp", skip_serializing_if = "Option::is_none")] - pub rp: Option>, - #[serde(rename = "user", skip_serializing_if = "Option::is_none")] - pub user: Option>, - #[serde_as(as = "Option")] - #[serde(rename = "challenge", skip_serializing_if = "Option::is_none")] - pub challenge: Option>, - #[serde(rename = "pubKeyCredParams", skip_serializing_if = "Option::is_none")] - pub pub_key_cred_params: Option>, - #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(rename = "attestation", skip_serializing_if = "Option::is_none")] - pub attestation: Option, - #[serde( - rename = "authenticatorSelection", - skip_serializing_if = "Option::is_none" - )] - pub authenticator_selection: Option>, - #[serde(rename = "excludeCredentials", skip_serializing_if = "Option::is_none")] - pub exclude_credentials: Option>, - #[serde(rename = "extensions", skip_serializing_if = "Option::is_none")] - pub extensions: Option>, -} - -impl CredentialCreateOptions { - pub fn new() -> CredentialCreateOptions { - CredentialCreateOptions { - status: None, - error_message: None, - rp: None, - user: None, - challenge: None, - pub_key_cred_params: None, - timeout: None, - attestation: None, - authenticator_selection: None, - exclude_credentials: None, - extensions: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/delete_recover_request_model.rs b/crates/bitwarden-api-api/src/models/delete_recover_request_model.rs deleted file mode 100644 index e053dcc6e..000000000 --- a/crates/bitwarden-api-api/src/models/delete_recover_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeleteRecoverRequestModel { - #[serde(rename = "email")] - pub email: String, -} - -impl DeleteRecoverRequestModel { - pub fn new(email: String) -> DeleteRecoverRequestModel { - DeleteRecoverRequestModel { email } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_keys_request_model.rs b/crates/bitwarden-api-api/src/models/device_keys_request_model.rs deleted file mode 100644 index ea4adfeda..000000000 --- a/crates/bitwarden-api-api/src/models/device_keys_request_model.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceKeysRequestModel { - #[serde(rename = "encryptedUserKey")] - pub encrypted_user_key: String, - #[serde(rename = "encryptedPublicKey")] - pub encrypted_public_key: String, - #[serde(rename = "encryptedPrivateKey")] - pub encrypted_private_key: String, -} - -impl DeviceKeysRequestModel { - pub fn new( - encrypted_user_key: String, - encrypted_public_key: String, - encrypted_private_key: String, - ) -> DeviceKeysRequestModel { - DeviceKeysRequestModel { - encrypted_user_key, - encrypted_public_key, - encrypted_private_key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_keys_update_request_model.rs b/crates/bitwarden-api-api/src/models/device_keys_update_request_model.rs deleted file mode 100644 index e32b1fada..000000000 --- a/crates/bitwarden-api-api/src/models/device_keys_update_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceKeysUpdateRequestModel { - #[serde(rename = "encryptedPublicKey")] - pub encrypted_public_key: String, - #[serde(rename = "encryptedUserKey")] - pub encrypted_user_key: String, -} - -impl DeviceKeysUpdateRequestModel { - pub fn new( - encrypted_public_key: String, - encrypted_user_key: String, - ) -> DeviceKeysUpdateRequestModel { - DeviceKeysUpdateRequestModel { - encrypted_public_key, - encrypted_user_key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_request_model.rs b/crates/bitwarden-api-api/src/models/device_request_model.rs deleted file mode 100644 index fd69dead6..000000000 --- a/crates/bitwarden-api-api/src/models/device_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceRequestModel { - #[serde(rename = "type")] - pub r#type: models::DeviceType, - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "identifier")] - pub identifier: String, - #[serde(rename = "pushToken", skip_serializing_if = "Option::is_none")] - pub push_token: Option, -} - -impl DeviceRequestModel { - pub fn new(r#type: models::DeviceType, name: String, identifier: String) -> DeviceRequestModel { - DeviceRequestModel { - r#type, - name, - identifier, - push_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_response_model.rs b/crates/bitwarden-api-api/src/models/device_response_model.rs deleted file mode 100644 index c9bc8f53a..000000000 --- a/crates/bitwarden-api-api/src/models/device_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")] - pub identifier: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "isTrusted", skip_serializing_if = "Option::is_none")] - pub is_trusted: Option, -} - -impl DeviceResponseModel { - pub fn new() -> DeviceResponseModel { - DeviceResponseModel { - object: None, - id: None, - name: None, - r#type: None, - identifier: None, - creation_date: None, - is_trusted: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/device_response_model_list_response_model.rs deleted file mode 100644 index ee01e7fd2..000000000 --- a/crates/bitwarden-api-api/src/models/device_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl DeviceResponseModelListResponseModel { - pub fn new() -> DeviceResponseModelListResponseModel { - DeviceResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_token_request_model.rs b/crates/bitwarden-api-api/src/models/device_token_request_model.rs deleted file mode 100644 index 1ec6f85dc..000000000 --- a/crates/bitwarden-api-api/src/models/device_token_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceTokenRequestModel { - #[serde(rename = "pushToken", skip_serializing_if = "Option::is_none")] - pub push_token: Option, -} - -impl DeviceTokenRequestModel { - pub fn new() -> DeviceTokenRequestModel { - DeviceTokenRequestModel { push_token: None } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_type.rs b/crates/bitwarden-api-api/src/models/device_type.rs deleted file mode 100644 index eeac7b34b..000000000 --- a/crates/bitwarden-api-api/src/models/device_type.rs +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum DeviceType { - Android = 0, - iOS = 1, - ChromeExtension = 2, - FirefoxExtension = 3, - OperaExtension = 4, - EdgeExtension = 5, - WindowsDesktop = 6, - MacOsDesktop = 7, - LinuxDesktop = 8, - ChromeBrowser = 9, - FirefoxBrowser = 10, - OperaBrowser = 11, - EdgeBrowser = 12, - IEBrowser = 13, - UnknownBrowser = 14, - AndroidAmazon = 15, - UWP = 16, - SafariBrowser = 17, - VivaldiBrowser = 18, - VivaldiExtension = 19, - SafariExtension = 20, - SDK = 21, - Server = 22, - WindowsCLI = 23, - MacOsCLI = 24, - LinuxCLI = 25, -} - -impl std::fmt::Display for DeviceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Android => write!(f, "0"), - Self::iOS => write!(f, "1"), - Self::ChromeExtension => write!(f, "2"), - Self::FirefoxExtension => write!(f, "3"), - Self::OperaExtension => write!(f, "4"), - Self::EdgeExtension => write!(f, "5"), - Self::WindowsDesktop => write!(f, "6"), - Self::MacOsDesktop => write!(f, "7"), - Self::LinuxDesktop => write!(f, "8"), - Self::ChromeBrowser => write!(f, "9"), - Self::FirefoxBrowser => write!(f, "10"), - Self::OperaBrowser => write!(f, "11"), - Self::EdgeBrowser => write!(f, "12"), - Self::IEBrowser => write!(f, "13"), - Self::UnknownBrowser => write!(f, "14"), - Self::AndroidAmazon => write!(f, "15"), - Self::UWP => write!(f, "16"), - Self::SafariBrowser => write!(f, "17"), - Self::VivaldiBrowser => write!(f, "18"), - Self::VivaldiExtension => write!(f, "19"), - Self::SafariExtension => write!(f, "20"), - Self::SDK => write!(f, "21"), - Self::Server => write!(f, "22"), - Self::WindowsCLI => write!(f, "23"), - Self::MacOsCLI => write!(f, "24"), - Self::LinuxCLI => write!(f, "25"), - } - } -} - -impl Default for DeviceType { - fn default() -> DeviceType { - Self::Android - } -} diff --git a/crates/bitwarden-api-api/src/models/device_verification_request_model.rs b/crates/bitwarden-api-api/src/models/device_verification_request_model.rs deleted file mode 100644 index facc28ece..000000000 --- a/crates/bitwarden-api-api/src/models/device_verification_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceVerificationRequestModel { - #[serde(rename = "unknownDeviceVerificationEnabled")] - pub unknown_device_verification_enabled: bool, -} - -impl DeviceVerificationRequestModel { - pub fn new(unknown_device_verification_enabled: bool) -> DeviceVerificationRequestModel { - DeviceVerificationRequestModel { - unknown_device_verification_enabled, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/device_verification_response_model.rs b/crates/bitwarden-api-api/src/models/device_verification_response_model.rs deleted file mode 100644 index cd46a1402..000000000 --- a/crates/bitwarden-api-api/src/models/device_verification_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeviceVerificationResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde( - rename = "isDeviceVerificationSectionEnabled", - skip_serializing_if = "Option::is_none" - )] - pub is_device_verification_section_enabled: Option, - #[serde( - rename = "unknownDeviceVerificationEnabled", - skip_serializing_if = "Option::is_none" - )] - pub unknown_device_verification_enabled: Option, -} - -impl DeviceVerificationResponseModel { - pub fn new() -> DeviceVerificationResponseModel { - DeviceVerificationResponseModel { - object: None, - is_device_verification_section_enabled: None, - unknown_device_verification_enabled: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/domains_response_model.rs b/crates/bitwarden-api-api/src/models/domains_response_model.rs deleted file mode 100644 index 30a9374a8..000000000 --- a/crates/bitwarden-api-api/src/models/domains_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct DomainsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "equivalentDomains", skip_serializing_if = "Option::is_none")] - pub equivalent_domains: Option>>, - #[serde( - rename = "globalEquivalentDomains", - skip_serializing_if = "Option::is_none" - )] - pub global_equivalent_domains: Option>, -} - -impl DomainsResponseModel { - pub fn new() -> DomainsResponseModel { - DomainsResponseModel { - object: None, - equivalent_domains: None, - global_equivalent_domains: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/email_request_model.rs b/crates/bitwarden-api-api/src/models/email_request_model.rs deleted file mode 100644 index 67b5c5b0f..000000000 --- a/crates/bitwarden-api-api/src/models/email_request_model.rs +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmailRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "newEmail")] - pub new_email: String, - #[serde(rename = "newMasterPasswordHash")] - pub new_master_password_hash: String, - #[serde(rename = "token")] - pub token: String, - #[serde(rename = "key")] - pub key: String, -} - -impl EmailRequestModel { - pub fn new( - new_email: String, - new_master_password_hash: String, - token: String, - key: String, - ) -> EmailRequestModel { - EmailRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - new_email, - new_master_password_hash, - token, - key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/email_token_request_model.rs b/crates/bitwarden-api-api/src/models/email_token_request_model.rs deleted file mode 100644 index 903913c52..000000000 --- a/crates/bitwarden-api-api/src/models/email_token_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmailTokenRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "newEmail")] - pub new_email: String, -} - -impl EmailTokenRequestModel { - pub fn new(new_email: String) -> EmailTokenRequestModel { - EmailTokenRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - new_email, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model.rs deleted file mode 100644 index 4176c9248..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessGranteeDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "waitTimeDays", skip_serializing_if = "Option::is_none")] - pub wait_time_days: Option, - #[serde(rename = "granteeId", skip_serializing_if = "Option::is_none")] - pub grantee_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "avatarColor", skip_serializing_if = "Option::is_none")] - pub avatar_color: Option, -} - -impl EmergencyAccessGranteeDetailsResponseModel { - pub fn new() -> EmergencyAccessGranteeDetailsResponseModel { - EmergencyAccessGranteeDetailsResponseModel { - object: None, - id: None, - status: None, - r#type: None, - wait_time_days: None, - grantee_id: None, - name: None, - email: None, - avatar_color: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model_list_response_model.rs deleted file mode 100644 index 978007da0..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_grantee_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessGranteeDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl EmergencyAccessGranteeDetailsResponseModelListResponseModel { - pub fn new() -> EmergencyAccessGranteeDetailsResponseModelListResponseModel { - EmergencyAccessGranteeDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model.rs deleted file mode 100644 index d5b65b493..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessGrantorDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "waitTimeDays", skip_serializing_if = "Option::is_none")] - pub wait_time_days: Option, - #[serde(rename = "grantorId", skip_serializing_if = "Option::is_none")] - pub grantor_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "avatarColor", skip_serializing_if = "Option::is_none")] - pub avatar_color: Option, -} - -impl EmergencyAccessGrantorDetailsResponseModel { - pub fn new() -> EmergencyAccessGrantorDetailsResponseModel { - EmergencyAccessGrantorDetailsResponseModel { - object: None, - id: None, - status: None, - r#type: None, - wait_time_days: None, - grantor_id: None, - name: None, - email: None, - avatar_color: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model_list_response_model.rs deleted file mode 100644 index e0fc31f69..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_grantor_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessGrantorDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl EmergencyAccessGrantorDetailsResponseModelListResponseModel { - pub fn new() -> EmergencyAccessGrantorDetailsResponseModelListResponseModel { - EmergencyAccessGrantorDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_invite_request_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_invite_request_model.rs deleted file mode 100644 index 76dfb6346..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_invite_request_model.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessInviteRequestModel { - #[serde(rename = "email")] - pub email: String, - #[serde(rename = "type")] - pub r#type: models::EmergencyAccessType, - #[serde(rename = "waitTimeDays")] - pub wait_time_days: i32, -} - -impl EmergencyAccessInviteRequestModel { - pub fn new( - email: String, - r#type: models::EmergencyAccessType, - wait_time_days: i32, - ) -> EmergencyAccessInviteRequestModel { - EmergencyAccessInviteRequestModel { - email, - r#type, - wait_time_days, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_password_request_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_password_request_model.rs deleted file mode 100644 index dbb6c493d..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_password_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessPasswordRequestModel { - #[serde(rename = "newMasterPasswordHash")] - pub new_master_password_hash: String, - #[serde(rename = "key")] - pub key: String, -} - -impl EmergencyAccessPasswordRequestModel { - pub fn new( - new_master_password_hash: String, - key: String, - ) -> EmergencyAccessPasswordRequestModel { - EmergencyAccessPasswordRequestModel { - new_master_password_hash, - key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_status_type.rs b/crates/bitwarden-api-api/src/models/emergency_access_status_type.rs deleted file mode 100644 index 6491a52cd..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_status_type.rs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum EmergencyAccessStatusType { - Invited = 0, - Accepted = 1, - Confirmed = 2, - RecoveryInitiated = 3, - RecoveryApproved = 4, -} - -impl std::fmt::Display for EmergencyAccessStatusType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Invited => write!(f, "0"), - Self::Accepted => write!(f, "1"), - Self::Confirmed => write!(f, "2"), - Self::RecoveryInitiated => write!(f, "3"), - Self::RecoveryApproved => write!(f, "4"), - } - } -} - -impl Default for EmergencyAccessStatusType { - fn default() -> EmergencyAccessStatusType { - Self::Invited - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_takeover_response_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_takeover_response_model.rs deleted file mode 100644 index 659b2c36d..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_takeover_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessTakeoverResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "kdfIterations", skip_serializing_if = "Option::is_none")] - pub kdf_iterations: Option, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, - #[serde(rename = "kdf", skip_serializing_if = "Option::is_none")] - pub kdf: Option, - #[serde(rename = "keyEncrypted", skip_serializing_if = "Option::is_none")] - pub key_encrypted: Option, -} - -impl EmergencyAccessTakeoverResponseModel { - pub fn new() -> EmergencyAccessTakeoverResponseModel { - EmergencyAccessTakeoverResponseModel { - object: None, - kdf_iterations: None, - kdf_memory: None, - kdf_parallelism: None, - kdf: None, - key_encrypted: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_type.rs b/crates/bitwarden-api-api/src/models/emergency_access_type.rs deleted file mode 100644 index ad6dc5a84..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum EmergencyAccessType { - View = 0, - Takeover = 1, -} - -impl std::fmt::Display for EmergencyAccessType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::View => write!(f, "0"), - Self::Takeover => write!(f, "1"), - } - } -} - -impl Default for EmergencyAccessType { - fn default() -> EmergencyAccessType { - Self::View - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_update_request_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_update_request_model.rs deleted file mode 100644 index 0f37a655a..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_update_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessUpdateRequestModel { - #[serde(rename = "type")] - pub r#type: models::EmergencyAccessType, - #[serde(rename = "waitTimeDays")] - pub wait_time_days: i32, - #[serde(rename = "keyEncrypted", skip_serializing_if = "Option::is_none")] - pub key_encrypted: Option, -} - -impl EmergencyAccessUpdateRequestModel { - pub fn new( - r#type: models::EmergencyAccessType, - wait_time_days: i32, - ) -> EmergencyAccessUpdateRequestModel { - EmergencyAccessUpdateRequestModel { - r#type, - wait_time_days, - key_encrypted: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_view_response_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_view_response_model.rs deleted file mode 100644 index 8103e8687..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_view_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessViewResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "keyEncrypted", skip_serializing_if = "Option::is_none")] - pub key_encrypted: Option, - #[serde(rename = "ciphers", skip_serializing_if = "Option::is_none")] - pub ciphers: Option>, -} - -impl EmergencyAccessViewResponseModel { - pub fn new() -> EmergencyAccessViewResponseModel { - EmergencyAccessViewResponseModel { - object: None, - key_encrypted: None, - ciphers: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/emergency_access_with_id_request_model.rs b/crates/bitwarden-api-api/src/models/emergency_access_with_id_request_model.rs deleted file mode 100644 index 50512b871..000000000 --- a/crates/bitwarden-api-api/src/models/emergency_access_with_id_request_model.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EmergencyAccessWithIdRequestModel { - #[serde(rename = "type")] - pub r#type: models::EmergencyAccessType, - #[serde(rename = "waitTimeDays")] - pub wait_time_days: i32, - #[serde(rename = "keyEncrypted", skip_serializing_if = "Option::is_none")] - pub key_encrypted: Option, - #[serde(rename = "id")] - pub id: uuid::Uuid, -} - -impl EmergencyAccessWithIdRequestModel { - pub fn new( - r#type: models::EmergencyAccessType, - wait_time_days: i32, - id: uuid::Uuid, - ) -> EmergencyAccessWithIdRequestModel { - EmergencyAccessWithIdRequestModel { - r#type, - wait_time_days, - key_encrypted: None, - id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/environment_config_response_model.rs b/crates/bitwarden-api-api/src/models/environment_config_response_model.rs deleted file mode 100644 index d32de4dd1..000000000 --- a/crates/bitwarden-api-api/src/models/environment_config_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EnvironmentConfigResponseModel { - #[serde(rename = "cloudRegion", skip_serializing_if = "Option::is_none")] - pub cloud_region: Option, - #[serde(rename = "vault", skip_serializing_if = "Option::is_none")] - pub vault: Option, - #[serde(rename = "api", skip_serializing_if = "Option::is_none")] - pub api: Option, - #[serde(rename = "identity", skip_serializing_if = "Option::is_none")] - pub identity: Option, - #[serde(rename = "notifications", skip_serializing_if = "Option::is_none")] - pub notifications: Option, - #[serde(rename = "sso", skip_serializing_if = "Option::is_none")] - pub sso: Option, -} - -impl EnvironmentConfigResponseModel { - pub fn new() -> EnvironmentConfigResponseModel { - EnvironmentConfigResponseModel { - cloud_region: None, - vault: None, - api: None, - identity: None, - notifications: None, - sso: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/event_response_model.rs b/crates/bitwarden-api-api/src/models/event_response_model.rs deleted file mode 100644 index 487e0f30f..000000000 --- a/crates/bitwarden-api-api/src/models/event_response_model.rs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EventResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "providerId", skip_serializing_if = "Option::is_none")] - pub provider_id: Option, - #[serde(rename = "cipherId", skip_serializing_if = "Option::is_none")] - pub cipher_id: Option, - #[serde(rename = "collectionId", skip_serializing_if = "Option::is_none")] - pub collection_id: Option, - #[serde(rename = "groupId", skip_serializing_if = "Option::is_none")] - pub group_id: Option, - #[serde(rename = "policyId", skip_serializing_if = "Option::is_none")] - pub policy_id: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde(rename = "providerUserId", skip_serializing_if = "Option::is_none")] - pub provider_user_id: Option, - #[serde( - rename = "providerOrganizationId", - skip_serializing_if = "Option::is_none" - )] - pub provider_organization_id: Option, - #[serde(rename = "actingUserId", skip_serializing_if = "Option::is_none")] - pub acting_user_id: Option, - #[serde(rename = "installationId", skip_serializing_if = "Option::is_none")] - pub installation_id: Option, - #[serde(rename = "date", skip_serializing_if = "Option::is_none")] - pub date: Option, - #[serde(rename = "deviceType", skip_serializing_if = "Option::is_none")] - pub device_type: Option, - #[serde(rename = "ipAddress", skip_serializing_if = "Option::is_none")] - pub ip_address: Option, - #[serde(rename = "systemUser", skip_serializing_if = "Option::is_none")] - pub system_user: Option, - #[serde(rename = "domainName", skip_serializing_if = "Option::is_none")] - pub domain_name: Option, - #[serde(rename = "secretId", skip_serializing_if = "Option::is_none")] - pub secret_id: Option, - #[serde(rename = "serviceAccountId", skip_serializing_if = "Option::is_none")] - pub service_account_id: Option, -} - -impl EventResponseModel { - pub fn new() -> EventResponseModel { - EventResponseModel { - object: None, - r#type: None, - user_id: None, - organization_id: None, - provider_id: None, - cipher_id: None, - collection_id: None, - group_id: None, - policy_id: None, - organization_user_id: None, - provider_user_id: None, - provider_organization_id: None, - acting_user_id: None, - installation_id: None, - date: None, - device_type: None, - ip_address: None, - system_user: None, - domain_name: None, - secret_id: None, - service_account_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/event_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/event_response_model_list_response_model.rs deleted file mode 100644 index c573980e8..000000000 --- a/crates/bitwarden-api-api/src/models/event_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct EventResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl EventResponseModelListResponseModel { - pub fn new() -> EventResponseModelListResponseModel { - EventResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/event_system_user.rs b/crates/bitwarden-api-api/src/models/event_system_user.rs deleted file mode 100644 index b7a70d769..000000000 --- a/crates/bitwarden-api-api/src/models/event_system_user.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum EventSystemUser { - SCIM = 1, - DomainVerification = 2, -} - -impl std::fmt::Display for EventSystemUser { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::SCIM => write!(f, "1"), - Self::DomainVerification => write!(f, "2"), - } - } -} - -impl Default for EventSystemUser { - fn default() -> EventSystemUser { - Self::SCIM - } -} diff --git a/crates/bitwarden-api-api/src/models/event_type.rs b/crates/bitwarden-api-api/src/models/event_type.rs deleted file mode 100644 index e4294452b..000000000 --- a/crates/bitwarden-api-api/src/models/event_type.rs +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum EventType { - User_LoggedIn = 1000, - User_ChangedPassword = 1001, - User_Updated2fa = 1002, - User_Disabled2fa = 1003, - User_Recovered2fa = 1004, - User_FailedLogIn = 1005, - User_FailedLogIn2fa = 1006, - User_ClientExportedVault = 1007, - User_UpdatedTempPassword = 1008, - User_MigratedKeyToKeyConnector = 1009, - User_RequestedDeviceApproval = 1010, - User_TdeOffboardingPasswordSet = 1011, - Cipher_Created = 1100, - Cipher_Updated = 1101, - Cipher_Deleted = 1102, - Cipher_AttachmentCreated = 1103, - Cipher_AttachmentDeleted = 1104, - Cipher_Shared = 1105, - Cipher_UpdatedCollections = 1106, - Cipher_ClientViewed = 1107, - Cipher_ClientToggledPasswordVisible = 1108, - Cipher_ClientToggledHiddenFieldVisible = 1109, - Cipher_ClientToggledCardCodeVisible = 1110, - Cipher_ClientCopiedPassword = 1111, - Cipher_ClientCopiedHiddenField = 1112, - Cipher_ClientCopiedCardCode = 1113, - Cipher_ClientAutofilled = 1114, - Cipher_SoftDeleted = 1115, - Cipher_Restored = 1116, - Cipher_ClientToggledCardNumberVisible = 1117, - Collection_Created = 1300, - Collection_Updated = 1301, - Collection_Deleted = 1302, - Group_Created = 1400, - Group_Updated = 1401, - Group_Deleted = 1402, - OrganizationUser_Invited = 1500, - OrganizationUser_Confirmed = 1501, - OrganizationUser_Updated = 1502, - OrganizationUser_Removed = 1503, - OrganizationUser_UpdatedGroups = 1504, - OrganizationUser_UnlinkedSso = 1505, - OrganizationUser_ResetPassword_Enroll = 1506, - OrganizationUser_ResetPassword_Withdraw = 1507, - OrganizationUser_AdminResetPassword = 1508, - OrganizationUser_ResetSsoLink = 1509, - OrganizationUser_FirstSsoLogin = 1510, - OrganizationUser_Revoked = 1511, - OrganizationUser_Restored = 1512, - OrganizationUser_ApprovedAuthRequest = 1513, - OrganizationUser_RejectedAuthRequest = 1514, - Organization_Updated = 1600, - Organization_PurgedVault = 1601, - Organization_ClientExportedVault = 1602, - Organization_VaultAccessed = 1603, - Organization_EnabledSso = 1604, - Organization_DisabledSso = 1605, - Organization_EnabledKeyConnector = 1606, - Organization_DisabledKeyConnector = 1607, - Organization_SponsorshipsSynced = 1608, - Organization_CollectionManagement_Updated = 1609, - Policy_Updated = 1700, - ProviderUser_Invited = 1800, - ProviderUser_Confirmed = 1801, - ProviderUser_Updated = 1802, - ProviderUser_Removed = 1803, - ProviderOrganization_Created = 1900, - ProviderOrganization_Added = 1901, - ProviderOrganization_Removed = 1902, - ProviderOrganization_VaultAccessed = 1903, - OrganizationDomain_Added = 2000, - OrganizationDomain_Removed = 2001, - OrganizationDomain_Verified = 2002, - OrganizationDomain_NotVerified = 2003, - Secret_Retrieved = 2100, -} - -impl std::fmt::Display for EventType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::User_LoggedIn => write!(f, "1000"), - Self::User_ChangedPassword => write!(f, "1001"), - Self::User_Updated2fa => write!(f, "1002"), - Self::User_Disabled2fa => write!(f, "1003"), - Self::User_Recovered2fa => write!(f, "1004"), - Self::User_FailedLogIn => write!(f, "1005"), - Self::User_FailedLogIn2fa => write!(f, "1006"), - Self::User_ClientExportedVault => write!(f, "1007"), - Self::User_UpdatedTempPassword => write!(f, "1008"), - Self::User_MigratedKeyToKeyConnector => write!(f, "1009"), - Self::User_RequestedDeviceApproval => write!(f, "1010"), - Self::User_TdeOffboardingPasswordSet => write!(f, "1011"), - Self::Cipher_Created => write!(f, "1100"), - Self::Cipher_Updated => write!(f, "1101"), - Self::Cipher_Deleted => write!(f, "1102"), - Self::Cipher_AttachmentCreated => write!(f, "1103"), - Self::Cipher_AttachmentDeleted => write!(f, "1104"), - Self::Cipher_Shared => write!(f, "1105"), - Self::Cipher_UpdatedCollections => write!(f, "1106"), - Self::Cipher_ClientViewed => write!(f, "1107"), - Self::Cipher_ClientToggledPasswordVisible => write!(f, "1108"), - Self::Cipher_ClientToggledHiddenFieldVisible => write!(f, "1109"), - Self::Cipher_ClientToggledCardCodeVisible => write!(f, "1110"), - Self::Cipher_ClientCopiedPassword => write!(f, "1111"), - Self::Cipher_ClientCopiedHiddenField => write!(f, "1112"), - Self::Cipher_ClientCopiedCardCode => write!(f, "1113"), - Self::Cipher_ClientAutofilled => write!(f, "1114"), - Self::Cipher_SoftDeleted => write!(f, "1115"), - Self::Cipher_Restored => write!(f, "1116"), - Self::Cipher_ClientToggledCardNumberVisible => write!(f, "1117"), - Self::Collection_Created => write!(f, "1300"), - Self::Collection_Updated => write!(f, "1301"), - Self::Collection_Deleted => write!(f, "1302"), - Self::Group_Created => write!(f, "1400"), - Self::Group_Updated => write!(f, "1401"), - Self::Group_Deleted => write!(f, "1402"), - Self::OrganizationUser_Invited => write!(f, "1500"), - Self::OrganizationUser_Confirmed => write!(f, "1501"), - Self::OrganizationUser_Updated => write!(f, "1502"), - Self::OrganizationUser_Removed => write!(f, "1503"), - Self::OrganizationUser_UpdatedGroups => write!(f, "1504"), - Self::OrganizationUser_UnlinkedSso => write!(f, "1505"), - Self::OrganizationUser_ResetPassword_Enroll => write!(f, "1506"), - Self::OrganizationUser_ResetPassword_Withdraw => write!(f, "1507"), - Self::OrganizationUser_AdminResetPassword => write!(f, "1508"), - Self::OrganizationUser_ResetSsoLink => write!(f, "1509"), - Self::OrganizationUser_FirstSsoLogin => write!(f, "1510"), - Self::OrganizationUser_Revoked => write!(f, "1511"), - Self::OrganizationUser_Restored => write!(f, "1512"), - Self::OrganizationUser_ApprovedAuthRequest => write!(f, "1513"), - Self::OrganizationUser_RejectedAuthRequest => write!(f, "1514"), - Self::Organization_Updated => write!(f, "1600"), - Self::Organization_PurgedVault => write!(f, "1601"), - Self::Organization_ClientExportedVault => write!(f, "1602"), - Self::Organization_VaultAccessed => write!(f, "1603"), - Self::Organization_EnabledSso => write!(f, "1604"), - Self::Organization_DisabledSso => write!(f, "1605"), - Self::Organization_EnabledKeyConnector => write!(f, "1606"), - Self::Organization_DisabledKeyConnector => write!(f, "1607"), - Self::Organization_SponsorshipsSynced => write!(f, "1608"), - Self::Organization_CollectionManagement_Updated => write!(f, "1609"), - Self::Policy_Updated => write!(f, "1700"), - Self::ProviderUser_Invited => write!(f, "1800"), - Self::ProviderUser_Confirmed => write!(f, "1801"), - Self::ProviderUser_Updated => write!(f, "1802"), - Self::ProviderUser_Removed => write!(f, "1803"), - Self::ProviderOrganization_Created => write!(f, "1900"), - Self::ProviderOrganization_Added => write!(f, "1901"), - Self::ProviderOrganization_Removed => write!(f, "1902"), - Self::ProviderOrganization_VaultAccessed => write!(f, "1903"), - Self::OrganizationDomain_Added => write!(f, "2000"), - Self::OrganizationDomain_Removed => write!(f, "2001"), - Self::OrganizationDomain_Verified => write!(f, "2002"), - Self::OrganizationDomain_NotVerified => write!(f, "2003"), - Self::Secret_Retrieved => write!(f, "2100"), - } - } -} - -impl Default for EventType { - fn default() -> EventType { - Self::User_LoggedIn - } -} diff --git a/crates/bitwarden-api-api/src/models/expanded_tax_info_update_request_model.rs b/crates/bitwarden-api-api/src/models/expanded_tax_info_update_request_model.rs deleted file mode 100644 index f30f4c474..000000000 --- a/crates/bitwarden-api-api/src/models/expanded_tax_info_update_request_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ExpandedTaxInfoUpdateRequestModel { - #[serde(rename = "country")] - pub country: String, - #[serde(rename = "postalCode", skip_serializing_if = "Option::is_none")] - pub postal_code: Option, - #[serde(rename = "taxId", skip_serializing_if = "Option::is_none")] - pub tax_id: Option, - #[serde(rename = "line1", skip_serializing_if = "Option::is_none")] - pub line1: Option, - #[serde(rename = "line2", skip_serializing_if = "Option::is_none")] - pub line2: Option, - #[serde(rename = "city", skip_serializing_if = "Option::is_none")] - pub city: Option, - #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, -} - -impl ExpandedTaxInfoUpdateRequestModel { - pub fn new(country: String) -> ExpandedTaxInfoUpdateRequestModel { - ExpandedTaxInfoUpdateRequestModel { - country, - postal_code: None, - tax_id: None, - line1: None, - line2: None, - city: None, - state: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/fido2_user.rs b/crates/bitwarden-api-api/src/models/fido2_user.rs deleted file mode 100644 index 8f2eb1712..000000000 --- a/crates/bitwarden-api-api/src/models/fido2_user.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct Fido2User { - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde_as(as = "Option")] - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option>, - #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] - pub display_name: Option, -} - -impl Fido2User { - pub fn new() -> Fido2User { - Fido2User { - name: None, - id: None, - display_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/field_type.rs b/crates/bitwarden-api-api/src/models/field_type.rs deleted file mode 100644 index f02b261d7..000000000 --- a/crates/bitwarden-api-api/src/models/field_type.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum FieldType { - Text = 0, - Hidden = 1, - Boolean = 2, - Linked = 3, -} - -impl std::fmt::Display for FieldType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Text => write!(f, "0"), - Self::Hidden => write!(f, "1"), - Self::Boolean => write!(f, "2"), - Self::Linked => write!(f, "3"), - } - } -} - -impl Default for FieldType { - fn default() -> FieldType { - Self::Text - } -} diff --git a/crates/bitwarden-api-api/src/models/file_upload_type.rs b/crates/bitwarden-api-api/src/models/file_upload_type.rs deleted file mode 100644 index 7b831cd7c..000000000 --- a/crates/bitwarden-api-api/src/models/file_upload_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum FileUploadType { - Direct = 0, - Azure = 1, -} - -impl std::fmt::Display for FileUploadType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Direct => write!(f, "0"), - Self::Azure => write!(f, "1"), - } - } -} - -impl Default for FileUploadType { - fn default() -> FileUploadType { - Self::Direct - } -} diff --git a/crates/bitwarden-api-api/src/models/folder_request_model.rs b/crates/bitwarden-api-api/src/models/folder_request_model.rs deleted file mode 100644 index 74831b75a..000000000 --- a/crates/bitwarden-api-api/src/models/folder_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct FolderRequestModel { - #[serde(rename = "name")] - pub name: String, -} - -impl FolderRequestModel { - pub fn new(name: String) -> FolderRequestModel { - FolderRequestModel { name } - } -} diff --git a/crates/bitwarden-api-api/src/models/folder_response_model.rs b/crates/bitwarden-api-api/src/models/folder_response_model.rs deleted file mode 100644 index c478e5469..000000000 --- a/crates/bitwarden-api-api/src/models/folder_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct FolderResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, -} - -impl FolderResponseModel { - pub fn new() -> FolderResponseModel { - FolderResponseModel { - object: None, - id: None, - name: None, - revision_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/folder_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/folder_response_model_list_response_model.rs deleted file mode 100644 index 473c6affd..000000000 --- a/crates/bitwarden-api-api/src/models/folder_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct FolderResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl FolderResponseModelListResponseModel { - pub fn new() -> FolderResponseModelListResponseModel { - FolderResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/folder_with_id_request_model.rs b/crates/bitwarden-api-api/src/models/folder_with_id_request_model.rs deleted file mode 100644 index b89ceec3f..000000000 --- a/crates/bitwarden-api-api/src/models/folder_with_id_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct FolderWithIdRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, -} - -impl FolderWithIdRequestModel { - pub fn new(name: String) -> FolderWithIdRequestModel { - FolderWithIdRequestModel { name, id: None } - } -} diff --git a/crates/bitwarden-api-api/src/models/get_secrets_request_model.rs b/crates/bitwarden-api-api/src/models/get_secrets_request_model.rs deleted file mode 100644 index 931e37fc0..000000000 --- a/crates/bitwarden-api-api/src/models/get_secrets_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GetSecretsRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, -} - -impl GetSecretsRequestModel { - pub fn new(ids: Vec) -> GetSecretsRequestModel { - GetSecretsRequestModel { ids } - } -} diff --git a/crates/bitwarden-api-api/src/models/global_domains.rs b/crates/bitwarden-api-api/src/models/global_domains.rs deleted file mode 100644 index db487f09d..000000000 --- a/crates/bitwarden-api-api/src/models/global_domains.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GlobalDomains { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "domains", skip_serializing_if = "Option::is_none")] - pub domains: Option>, - #[serde(rename = "excluded", skip_serializing_if = "Option::is_none")] - pub excluded: Option, -} - -impl GlobalDomains { - pub fn new() -> GlobalDomains { - GlobalDomains { - r#type: None, - domains: None, - excluded: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/global_equivalent_domains_type.rs b/crates/bitwarden-api-api/src/models/global_equivalent_domains_type.rs deleted file mode 100644 index edb7c5e21..000000000 --- a/crates/bitwarden-api-api/src/models/global_equivalent_domains_type.rs +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum GlobalEquivalentDomainsType { - Google = 0, - Apple = 1, - Ameritrade = 2, - BoA = 3, - Sprint = 4, - WellsFargo = 5, - Merrill = 6, - Citi = 7, - Cnet = 8, - Gap = 9, - Microsoft = 10, - United = 11, - Yahoo = 12, - Zonelabs = 13, - PayPal = 14, - Avon = 15, - Diapers = 16, - Contacts = 17, - Amazon = 18, - Cox = 19, - Norton = 20, - Verizon = 21, - Buy = 22, - Sirius = 23, - Ea = 24, - Basecamp = 25, - Steam = 26, - Chart = 27, - Gotomeeting = 28, - Gogo = 29, - Oracle = 30, - Discover = 31, - Dcu = 32, - Healthcare = 33, - Pepco = 34, - Century21 = 35, - Comcast = 36, - Cricket = 37, - Mtb = 38, - Dropbox = 39, - Snapfish = 40, - Alibaba = 41, - Playstation = 42, - Mercado = 43, - Zendesk = 44, - Autodesk = 45, - RailNation = 46, - Wpcu = 47, - Mathletics = 48, - Discountbank = 49, - Mi = 50, - Facebook = 51, - Postepay = 52, - Skysports = 53, - Disney = 54, - Pokemon = 55, - Uv = 56, - Yahavo = 57, - Mdsol = 58, - Sears = 59, - Xiami = 60, - Belkin = 61, - Turbotax = 62, - Shopify = 63, - Ebay = 64, - Techdata = 65, - Schwab = 66, - Mozilla = 67, - Tesla = 68, - MorganStanley = 69, - TaxAct = 70, - Wikimedia = 71, - Airbnb = 72, - Eventbrite = 73, - StackExchange = 74, - Docusign = 75, - Envato = 76, - X10Hosting = 77, - Cisco = 78, - CedarFair = 79, - Ubiquiti = 80, - Discord = 81, - Netcup = 82, - Yandex = 83, - Sony = 84, - Proton = 85, - Ubisoft = 86, - TransferWise = 87, - TakeawayEU = 88, - Atlassian = 89, - Pinterest = 90, -} - -impl std::fmt::Display for GlobalEquivalentDomainsType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Google => write!(f, "0"), - Self::Apple => write!(f, "1"), - Self::Ameritrade => write!(f, "2"), - Self::BoA => write!(f, "3"), - Self::Sprint => write!(f, "4"), - Self::WellsFargo => write!(f, "5"), - Self::Merrill => write!(f, "6"), - Self::Citi => write!(f, "7"), - Self::Cnet => write!(f, "8"), - Self::Gap => write!(f, "9"), - Self::Microsoft => write!(f, "10"), - Self::United => write!(f, "11"), - Self::Yahoo => write!(f, "12"), - Self::Zonelabs => write!(f, "13"), - Self::PayPal => write!(f, "14"), - Self::Avon => write!(f, "15"), - Self::Diapers => write!(f, "16"), - Self::Contacts => write!(f, "17"), - Self::Amazon => write!(f, "18"), - Self::Cox => write!(f, "19"), - Self::Norton => write!(f, "20"), - Self::Verizon => write!(f, "21"), - Self::Buy => write!(f, "22"), - Self::Sirius => write!(f, "23"), - Self::Ea => write!(f, "24"), - Self::Basecamp => write!(f, "25"), - Self::Steam => write!(f, "26"), - Self::Chart => write!(f, "27"), - Self::Gotomeeting => write!(f, "28"), - Self::Gogo => write!(f, "29"), - Self::Oracle => write!(f, "30"), - Self::Discover => write!(f, "31"), - Self::Dcu => write!(f, "32"), - Self::Healthcare => write!(f, "33"), - Self::Pepco => write!(f, "34"), - Self::Century21 => write!(f, "35"), - Self::Comcast => write!(f, "36"), - Self::Cricket => write!(f, "37"), - Self::Mtb => write!(f, "38"), - Self::Dropbox => write!(f, "39"), - Self::Snapfish => write!(f, "40"), - Self::Alibaba => write!(f, "41"), - Self::Playstation => write!(f, "42"), - Self::Mercado => write!(f, "43"), - Self::Zendesk => write!(f, "44"), - Self::Autodesk => write!(f, "45"), - Self::RailNation => write!(f, "46"), - Self::Wpcu => write!(f, "47"), - Self::Mathletics => write!(f, "48"), - Self::Discountbank => write!(f, "49"), - Self::Mi => write!(f, "50"), - Self::Facebook => write!(f, "51"), - Self::Postepay => write!(f, "52"), - Self::Skysports => write!(f, "53"), - Self::Disney => write!(f, "54"), - Self::Pokemon => write!(f, "55"), - Self::Uv => write!(f, "56"), - Self::Yahavo => write!(f, "57"), - Self::Mdsol => write!(f, "58"), - Self::Sears => write!(f, "59"), - Self::Xiami => write!(f, "60"), - Self::Belkin => write!(f, "61"), - Self::Turbotax => write!(f, "62"), - Self::Shopify => write!(f, "63"), - Self::Ebay => write!(f, "64"), - Self::Techdata => write!(f, "65"), - Self::Schwab => write!(f, "66"), - Self::Mozilla => write!(f, "67"), - Self::Tesla => write!(f, "68"), - Self::MorganStanley => write!(f, "69"), - Self::TaxAct => write!(f, "70"), - Self::Wikimedia => write!(f, "71"), - Self::Airbnb => write!(f, "72"), - Self::Eventbrite => write!(f, "73"), - Self::StackExchange => write!(f, "74"), - Self::Docusign => write!(f, "75"), - Self::Envato => write!(f, "76"), - Self::X10Hosting => write!(f, "77"), - Self::Cisco => write!(f, "78"), - Self::CedarFair => write!(f, "79"), - Self::Ubiquiti => write!(f, "80"), - Self::Discord => write!(f, "81"), - Self::Netcup => write!(f, "82"), - Self::Yandex => write!(f, "83"), - Self::Sony => write!(f, "84"), - Self::Proton => write!(f, "85"), - Self::Ubisoft => write!(f, "86"), - Self::TransferWise => write!(f, "87"), - Self::TakeawayEU => write!(f, "88"), - Self::Atlassian => write!(f, "89"), - Self::Pinterest => write!(f, "90"), - } - } -} - -impl Default for GlobalEquivalentDomainsType { - fn default() -> GlobalEquivalentDomainsType { - Self::Google - } -} diff --git a/crates/bitwarden-api-api/src/models/granted_access_policy_request.rs b/crates/bitwarden-api-api/src/models/granted_access_policy_request.rs deleted file mode 100644 index c9b67f855..000000000 --- a/crates/bitwarden-api-api/src/models/granted_access_policy_request.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GrantedAccessPolicyRequest { - #[serde(rename = "grantedId")] - pub granted_id: uuid::Uuid, - #[serde(rename = "read")] - pub read: bool, - #[serde(rename = "write")] - pub write: bool, -} - -impl GrantedAccessPolicyRequest { - pub fn new(granted_id: uuid::Uuid, read: bool, write: bool) -> GrantedAccessPolicyRequest { - GrantedAccessPolicyRequest { - granted_id, - read, - write, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/granted_project_access_policy_permission_details_response_model.rs b/crates/bitwarden-api-api/src/models/granted_project_access_policy_permission_details_response_model.rs deleted file mode 100644 index 0f957d42f..000000000 --- a/crates/bitwarden-api-api/src/models/granted_project_access_policy_permission_details_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GrantedProjectAccessPolicyPermissionDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "accessPolicy", skip_serializing_if = "Option::is_none")] - pub access_policy: Option>, - #[serde(rename = "hasPermission", skip_serializing_if = "Option::is_none")] - pub has_permission: Option, -} - -impl GrantedProjectAccessPolicyPermissionDetailsResponseModel { - pub fn new() -> GrantedProjectAccessPolicyPermissionDetailsResponseModel { - GrantedProjectAccessPolicyPermissionDetailsResponseModel { - object: None, - access_policy: None, - has_permission: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/granted_project_access_policy_response_model.rs b/crates/bitwarden-api-api/src/models/granted_project_access_policy_response_model.rs deleted file mode 100644 index d098fccea..000000000 --- a/crates/bitwarden-api-api/src/models/granted_project_access_policy_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GrantedProjectAccessPolicyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "read", skip_serializing_if = "Option::is_none")] - pub read: Option, - #[serde(rename = "write", skip_serializing_if = "Option::is_none")] - pub write: Option, - #[serde(rename = "grantedProjectId", skip_serializing_if = "Option::is_none")] - pub granted_project_id: Option, - #[serde(rename = "grantedProjectName", skip_serializing_if = "Option::is_none")] - pub granted_project_name: Option, -} - -impl GrantedProjectAccessPolicyResponseModel { - pub fn new() -> GrantedProjectAccessPolicyResponseModel { - GrantedProjectAccessPolicyResponseModel { - object: None, - read: None, - write: None, - granted_project_id: None, - granted_project_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/group.rs b/crates/bitwarden-api-api/src/models/group.rs deleted file mode 100644 index 6d9feb83c..000000000 --- a/crates/bitwarden-api-api/src/models/group.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct Group { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "externalId")] - pub external_id: String, - #[serde(rename = "users", skip_serializing_if = "Option::is_none")] - pub users: Option>, -} - -impl Group { - pub fn new(name: String, external_id: String) -> Group { - Group { - name, - external_id, - users: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/group_access_policy_response_model.rs b/crates/bitwarden-api-api/src/models/group_access_policy_response_model.rs deleted file mode 100644 index 943f2e11d..000000000 --- a/crates/bitwarden-api-api/src/models/group_access_policy_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GroupAccessPolicyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "read", skip_serializing_if = "Option::is_none")] - pub read: Option, - #[serde(rename = "write", skip_serializing_if = "Option::is_none")] - pub write: Option, - #[serde(rename = "groupId", skip_serializing_if = "Option::is_none")] - pub group_id: Option, - #[serde(rename = "groupName", skip_serializing_if = "Option::is_none")] - pub group_name: Option, - #[serde(rename = "currentUserInGroup", skip_serializing_if = "Option::is_none")] - pub current_user_in_group: Option, -} - -impl GroupAccessPolicyResponseModel { - pub fn new() -> GroupAccessPolicyResponseModel { - GroupAccessPolicyResponseModel { - object: None, - read: None, - write: None, - group_id: None, - group_name: None, - current_user_in_group: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/group_bulk_request_model.rs b/crates/bitwarden-api-api/src/models/group_bulk_request_model.rs deleted file mode 100644 index 75c0bff6d..000000000 --- a/crates/bitwarden-api-api/src/models/group_bulk_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GroupBulkRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, -} - -impl GroupBulkRequestModel { - pub fn new(ids: Vec) -> GroupBulkRequestModel { - GroupBulkRequestModel { ids } - } -} diff --git a/crates/bitwarden-api-api/src/models/group_details_response_model.rs b/crates/bitwarden-api-api/src/models/group_details_response_model.rs deleted file mode 100644 index e73cec876..000000000 --- a/crates/bitwarden-api-api/src/models/group_details_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GroupDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, -} - -impl GroupDetailsResponseModel { - pub fn new() -> GroupDetailsResponseModel { - GroupDetailsResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - external_id: None, - collections: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/group_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/group_details_response_model_list_response_model.rs deleted file mode 100644 index 202c026f2..000000000 --- a/crates/bitwarden-api-api/src/models/group_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GroupDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl GroupDetailsResponseModelListResponseModel { - pub fn new() -> GroupDetailsResponseModelListResponseModel { - GroupDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/group_request_model.rs b/crates/bitwarden-api-api/src/models/group_request_model.rs deleted file mode 100644 index e218a3fe6..000000000 --- a/crates/bitwarden-api-api/src/models/group_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GroupRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, - #[serde(rename = "users", skip_serializing_if = "Option::is_none")] - pub users: Option>, -} - -impl GroupRequestModel { - pub fn new(name: String) -> GroupRequestModel { - GroupRequestModel { - name, - collections: None, - users: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/group_response_model.rs b/crates/bitwarden-api-api/src/models/group_response_model.rs deleted file mode 100644 index a3d6d6fd3..000000000 --- a/crates/bitwarden-api-api/src/models/group_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct GroupResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, -} - -impl GroupResponseModel { - pub fn new() -> GroupResponseModel { - GroupResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - external_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/import_ciphers_request_model.rs b/crates/bitwarden-api-api/src/models/import_ciphers_request_model.rs deleted file mode 100644 index b7db0f430..000000000 --- a/crates/bitwarden-api-api/src/models/import_ciphers_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ImportCiphersRequestModel { - #[serde(rename = "folders", skip_serializing_if = "Option::is_none")] - pub folders: Option>, - #[serde(rename = "ciphers", skip_serializing_if = "Option::is_none")] - pub ciphers: Option>, - #[serde( - rename = "folderRelationships", - skip_serializing_if = "Option::is_none" - )] - pub folder_relationships: Option>, -} - -impl ImportCiphersRequestModel { - pub fn new() -> ImportCiphersRequestModel { - ImportCiphersRequestModel { - folders: None, - ciphers: None, - folder_relationships: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/import_organization_ciphers_request_model.rs b/crates/bitwarden-api-api/src/models/import_organization_ciphers_request_model.rs deleted file mode 100644 index fb893ebf7..000000000 --- a/crates/bitwarden-api-api/src/models/import_organization_ciphers_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ImportOrganizationCiphersRequestModel { - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, - #[serde(rename = "ciphers", skip_serializing_if = "Option::is_none")] - pub ciphers: Option>, - #[serde( - rename = "collectionRelationships", - skip_serializing_if = "Option::is_none" - )] - pub collection_relationships: Option>, -} - -impl ImportOrganizationCiphersRequestModel { - pub fn new() -> ImportOrganizationCiphersRequestModel { - ImportOrganizationCiphersRequestModel { - collections: None, - ciphers: None, - collection_relationships: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/import_organization_users_request_model.rs b/crates/bitwarden-api-api/src/models/import_organization_users_request_model.rs deleted file mode 100644 index f4f811193..000000000 --- a/crates/bitwarden-api-api/src/models/import_organization_users_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ImportOrganizationUsersRequestModel { - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, - #[serde(rename = "users", skip_serializing_if = "Option::is_none")] - pub users: Option>, - #[serde(rename = "overwriteExisting", skip_serializing_if = "Option::is_none")] - pub overwrite_existing: Option, - #[serde(rename = "largeImport", skip_serializing_if = "Option::is_none")] - pub large_import: Option, -} - -impl ImportOrganizationUsersRequestModel { - pub fn new() -> ImportOrganizationUsersRequestModel { - ImportOrganizationUsersRequestModel { - groups: None, - users: None, - overwrite_existing: None, - large_import: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/inner_project_export_response_model.rs b/crates/bitwarden-api-api/src/models/inner_project_export_response_model.rs deleted file mode 100644 index 1544b415b..000000000 --- a/crates/bitwarden-api-api/src/models/inner_project_export_response_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct InnerProjectExportResponseModel { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, -} - -impl InnerProjectExportResponseModel { - pub fn new() -> InnerProjectExportResponseModel { - InnerProjectExportResponseModel { - id: None, - name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/inner_project_import_request_model.rs b/crates/bitwarden-api-api/src/models/inner_project_import_request_model.rs deleted file mode 100644 index 469bba56f..000000000 --- a/crates/bitwarden-api-api/src/models/inner_project_import_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct InnerProjectImportRequestModel { - #[serde(rename = "id")] - pub id: uuid::Uuid, - #[serde(rename = "name")] - pub name: String, -} - -impl InnerProjectImportRequestModel { - pub fn new(id: uuid::Uuid, name: String) -> InnerProjectImportRequestModel { - InnerProjectImportRequestModel { id, name } - } -} diff --git a/crates/bitwarden-api-api/src/models/inner_secret_export_response_model.rs b/crates/bitwarden-api-api/src/models/inner_secret_export_response_model.rs deleted file mode 100644 index 54db0fd03..000000000 --- a/crates/bitwarden-api-api/src/models/inner_secret_export_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct InnerSecretExportResponseModel { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "value", skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "note", skip_serializing_if = "Option::is_none")] - pub note: Option, - #[serde(rename = "projectIds", skip_serializing_if = "Option::is_none")] - pub project_ids: Option>, -} - -impl InnerSecretExportResponseModel { - pub fn new() -> InnerSecretExportResponseModel { - InnerSecretExportResponseModel { - id: None, - key: None, - value: None, - note: None, - project_ids: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/inner_secret_import_request_model.rs b/crates/bitwarden-api-api/src/models/inner_secret_import_request_model.rs deleted file mode 100644 index 18531ba63..000000000 --- a/crates/bitwarden-api-api/src/models/inner_secret_import_request_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct InnerSecretImportRequestModel { - #[serde(rename = "id")] - pub id: uuid::Uuid, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "value")] - pub value: String, - #[serde(rename = "note")] - pub note: String, - #[serde(rename = "projectIds")] - pub project_ids: Vec, -} - -impl InnerSecretImportRequestModel { - pub fn new( - id: uuid::Uuid, - key: String, - value: String, - note: String, - project_ids: Vec, - ) -> InnerSecretImportRequestModel { - InnerSecretImportRequestModel { - id, - key, - value, - note, - project_ids, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/installation_request_model.rs b/crates/bitwarden-api-api/src/models/installation_request_model.rs deleted file mode 100644 index b1e54d9aa..000000000 --- a/crates/bitwarden-api-api/src/models/installation_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstallationRequestModel { - #[serde(rename = "email")] - pub email: String, -} - -impl InstallationRequestModel { - pub fn new(email: String) -> InstallationRequestModel { - InstallationRequestModel { email } - } -} diff --git a/crates/bitwarden-api-api/src/models/installation_response_model.rs b/crates/bitwarden-api-api/src/models/installation_response_model.rs deleted file mode 100644 index d78616cea..000000000 --- a/crates/bitwarden-api-api/src/models/installation_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct InstallationResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, -} - -impl InstallationResponseModel { - pub fn new() -> InstallationResponseModel { - InstallationResponseModel { - object: None, - id: None, - key: None, - enabled: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/int32_int32_key_value_pair.rs b/crates/bitwarden-api-api/src/models/int32_int32_key_value_pair.rs deleted file mode 100644 index aa0ae7615..000000000 --- a/crates/bitwarden-api-api/src/models/int32_int32_key_value_pair.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct Int32Int32KeyValuePair { - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "value", skip_serializing_if = "Option::is_none")] - pub value: Option, -} - -impl Int32Int32KeyValuePair { - pub fn new() -> Int32Int32KeyValuePair { - Int32Int32KeyValuePair { - key: None, - value: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/kdf_request_model.rs b/crates/bitwarden-api-api/src/models/kdf_request_model.rs deleted file mode 100644 index 948a3e89e..000000000 --- a/crates/bitwarden-api-api/src/models/kdf_request_model.rs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct KdfRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "newMasterPasswordHash")] - pub new_master_password_hash: String, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "kdf")] - pub kdf: models::KdfType, - #[serde(rename = "kdfIterations")] - pub kdf_iterations: i32, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, -} - -impl KdfRequestModel { - pub fn new( - new_master_password_hash: String, - key: String, - kdf: models::KdfType, - kdf_iterations: i32, - ) -> KdfRequestModel { - KdfRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - new_master_password_hash, - master_password_hint: None, - key, - kdf, - kdf_iterations, - kdf_memory: None, - kdf_parallelism: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/kdf_type.rs b/crates/bitwarden-api-api/src/models/kdf_type.rs deleted file mode 100644 index f2ee26664..000000000 --- a/crates/bitwarden-api-api/src/models/kdf_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum KdfType { - PBKDF2_SHA256 = 0, - Argon2id = 1, -} - -impl std::fmt::Display for KdfType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::PBKDF2_SHA256 => write!(f, "0"), - Self::Argon2id => write!(f, "1"), - } - } -} - -impl Default for KdfType { - fn default() -> KdfType { - Self::PBKDF2_SHA256 - } -} diff --git a/crates/bitwarden-api-api/src/models/key_model.rs b/crates/bitwarden-api-api/src/models/key_model.rs deleted file mode 100644 index 619f328a6..000000000 --- a/crates/bitwarden-api-api/src/models/key_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct KeyModel { - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "migrated", skip_serializing_if = "Option::is_none")] - pub migrated: Option, -} - -impl KeyModel { - pub fn new() -> KeyModel { - KeyModel { - name: None, - id: None, - migrated: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/key_pair_request_body.rs b/crates/bitwarden-api-api/src/models/key_pair_request_body.rs deleted file mode 100644 index 49b7167a6..000000000 --- a/crates/bitwarden-api-api/src/models/key_pair_request_body.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct KeyPairRequestBody { - #[serde(rename = "publicKey")] - pub public_key: String, - #[serde(rename = "encryptedPrivateKey")] - pub encrypted_private_key: String, -} - -impl KeyPairRequestBody { - pub fn new(public_key: String, encrypted_private_key: String) -> KeyPairRequestBody { - KeyPairRequestBody { - public_key, - encrypted_private_key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/keys_request_model.rs b/crates/bitwarden-api-api/src/models/keys_request_model.rs deleted file mode 100644 index e59fb31f3..000000000 --- a/crates/bitwarden-api-api/src/models/keys_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct KeysRequestModel { - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, - #[serde(rename = "encryptedPrivateKey")] - pub encrypted_private_key: String, -} - -impl KeysRequestModel { - pub fn new(encrypted_private_key: String) -> KeysRequestModel { - KeysRequestModel { - public_key: None, - encrypted_private_key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/keys_response_model.rs b/crates/bitwarden-api-api/src/models/keys_response_model.rs deleted file mode 100644 index bdef8adfb..000000000 --- a/crates/bitwarden-api-api/src/models/keys_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct KeysResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, - #[serde(rename = "privateKey", skip_serializing_if = "Option::is_none")] - pub private_key: Option, -} - -impl KeysResponseModel { - pub fn new() -> KeysResponseModel { - KeysResponseModel { - object: None, - key: None, - public_key: None, - private_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/license_type.rs b/crates/bitwarden-api-api/src/models/license_type.rs deleted file mode 100644 index d3e278629..000000000 --- a/crates/bitwarden-api-api/src/models/license_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum LicenseType { - User = 0, - Organization = 1, -} - -impl std::fmt::Display for LicenseType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::User => write!(f, "0"), - Self::Organization => write!(f, "1"), - } - } -} - -impl Default for LicenseType { - fn default() -> LicenseType { - Self::User - } -} diff --git a/crates/bitwarden-api-api/src/models/master_password_policy_response_model.rs b/crates/bitwarden-api-api/src/models/master_password_policy_response_model.rs deleted file mode 100644 index 7ffe3900a..000000000 --- a/crates/bitwarden-api-api/src/models/master_password_policy_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct MasterPasswordPolicyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "minComplexity", skip_serializing_if = "Option::is_none")] - pub min_complexity: Option, - #[serde(rename = "minLength", skip_serializing_if = "Option::is_none")] - pub min_length: Option, - #[serde(rename = "requireLower", skip_serializing_if = "Option::is_none")] - pub require_lower: Option, - #[serde(rename = "requireUpper", skip_serializing_if = "Option::is_none")] - pub require_upper: Option, - #[serde(rename = "requireNumbers", skip_serializing_if = "Option::is_none")] - pub require_numbers: Option, - #[serde(rename = "requireSpecial", skip_serializing_if = "Option::is_none")] - pub require_special: Option, - #[serde(rename = "enforceOnLogin", skip_serializing_if = "Option::is_none")] - pub enforce_on_login: Option, -} - -impl MasterPasswordPolicyResponseModel { - pub fn new() -> MasterPasswordPolicyResponseModel { - MasterPasswordPolicyResponseModel { - object: None, - min_complexity: None, - min_length: None, - require_lower: None, - require_upper: None, - require_numbers: None, - require_special: None, - enforce_on_login: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/member_decryption_type.rs b/crates/bitwarden-api-api/src/models/member_decryption_type.rs deleted file mode 100644 index 6aff7d383..000000000 --- a/crates/bitwarden-api-api/src/models/member_decryption_type.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum MemberDecryptionType { - MasterPassword = 0, - KeyConnector = 1, - TrustedDeviceEncryption = 2, -} - -impl std::fmt::Display for MemberDecryptionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::MasterPassword => write!(f, "0"), - Self::KeyConnector => write!(f, "1"), - Self::TrustedDeviceEncryption => write!(f, "2"), - } - } -} - -impl Default for MemberDecryptionType { - fn default() -> MemberDecryptionType { - Self::MasterPassword - } -} diff --git a/crates/bitwarden-api-api/src/models/mod.rs b/crates/bitwarden-api-api/src/models/mod.rs deleted file mode 100644 index 91998fb0c..000000000 --- a/crates/bitwarden-api-api/src/models/mod.rs +++ /dev/null @@ -1,786 +0,0 @@ -pub mod access_policy_request; -pub use self::access_policy_request::AccessPolicyRequest; -pub mod access_token_create_request_model; -pub use self::access_token_create_request_model::AccessTokenCreateRequestModel; -pub mod access_token_creation_response_model; -pub use self::access_token_creation_response_model::AccessTokenCreationResponseModel; -pub mod access_token_response_model; -pub use self::access_token_response_model::AccessTokenResponseModel; -pub mod access_token_response_model_list_response_model; -pub use self::access_token_response_model_list_response_model::AccessTokenResponseModelListResponseModel; -pub mod admin_auth_request_update_request_model; -pub use self::admin_auth_request_update_request_model::AdminAuthRequestUpdateRequestModel; -pub mod algorithm; -pub use self::algorithm::Algorithm; -pub mod api_key_response_model; -pub use self::api_key_response_model::ApiKeyResponseModel; -pub mod assertion_options; -pub use self::assertion_options::AssertionOptions; -pub mod assertion_response; -pub use self::assertion_response::AssertionResponse; -pub mod attachment_request_model; -pub use self::attachment_request_model::AttachmentRequestModel; -pub mod attachment_response_model; -pub use self::attachment_response_model::AttachmentResponseModel; -pub mod attachment_upload_data_response_model; -pub use self::attachment_upload_data_response_model::AttachmentUploadDataResponseModel; -pub mod attestation_conveyance_preference; -pub use self::attestation_conveyance_preference::AttestationConveyancePreference; -pub mod auth_request_create_request_model; -pub use self::auth_request_create_request_model::AuthRequestCreateRequestModel; -pub mod auth_request_response_model; -pub use self::auth_request_response_model::AuthRequestResponseModel; -pub mod auth_request_response_model_list_response_model; -pub use self::auth_request_response_model_list_response_model::AuthRequestResponseModelListResponseModel; -pub mod auth_request_type; -pub use self::auth_request_type::AuthRequestType; -pub mod auth_request_update_request_model; -pub use self::auth_request_update_request_model::AuthRequestUpdateRequestModel; -pub mod authentication_extensions_client_inputs; -pub use self::authentication_extensions_client_inputs::AuthenticationExtensionsClientInputs; -pub mod authentication_extensions_client_outputs; -pub use self::authentication_extensions_client_outputs::AuthenticationExtensionsClientOutputs; -pub mod authenticator_assertion_raw_response; -pub use self::authenticator_assertion_raw_response::AuthenticatorAssertionRawResponse; -pub mod authenticator_attachment; -pub use self::authenticator_attachment::AuthenticatorAttachment; -pub mod authenticator_attestation_raw_response; -pub use self::authenticator_attestation_raw_response::AuthenticatorAttestationRawResponse; -pub mod authenticator_selection; -pub use self::authenticator_selection::AuthenticatorSelection; -pub mod authenticator_transport; -pub use self::authenticator_transport::AuthenticatorTransport; -pub mod base_secret_response_model; -pub use self::base_secret_response_model::BaseSecretResponseModel; -pub mod base_secret_response_model_list_response_model; -pub use self::base_secret_response_model_list_response_model::BaseSecretResponseModelListResponseModel; -pub mod billing_customer_discount; -pub use self::billing_customer_discount::BillingCustomerDiscount; -pub mod billing_history_response_model; -pub use self::billing_history_response_model::BillingHistoryResponseModel; -pub mod billing_invoice; -pub use self::billing_invoice::BillingInvoice; -pub mod billing_payment_response_model; -pub use self::billing_payment_response_model::BillingPaymentResponseModel; -pub mod billing_source; -pub use self::billing_source::BillingSource; -pub mod billing_subscription; -pub use self::billing_subscription::BillingSubscription; -pub mod billing_subscription_item; -pub use self::billing_subscription_item::BillingSubscriptionItem; -pub mod billing_subscription_upcoming_invoice; -pub use self::billing_subscription_upcoming_invoice::BillingSubscriptionUpcomingInvoice; -pub mod billing_transaction; -pub use self::billing_transaction::BillingTransaction; -pub mod bit_pay_invoice_request_model; -pub use self::bit_pay_invoice_request_model::BitPayInvoiceRequestModel; -pub mod bulk_collection_access_request_model; -pub use self::bulk_collection_access_request_model::BulkCollectionAccessRequestModel; -pub mod bulk_delete_response_model; -pub use self::bulk_delete_response_model::BulkDeleteResponseModel; -pub mod bulk_delete_response_model_list_response_model; -pub use self::bulk_delete_response_model_list_response_model::BulkDeleteResponseModelListResponseModel; -pub mod bulk_deny_admin_auth_request_request_model; -pub use self::bulk_deny_admin_auth_request_request_model::BulkDenyAdminAuthRequestRequestModel; -pub mod cipher_attachment_model; -pub use self::cipher_attachment_model::CipherAttachmentModel; -pub mod cipher_bulk_delete_request_model; -pub use self::cipher_bulk_delete_request_model::CipherBulkDeleteRequestModel; -pub mod cipher_bulk_move_request_model; -pub use self::cipher_bulk_move_request_model::CipherBulkMoveRequestModel; -pub mod cipher_bulk_restore_request_model; -pub use self::cipher_bulk_restore_request_model::CipherBulkRestoreRequestModel; -pub mod cipher_bulk_share_request_model; -pub use self::cipher_bulk_share_request_model::CipherBulkShareRequestModel; -pub mod cipher_bulk_update_collections_request_model; -pub use self::cipher_bulk_update_collections_request_model::CipherBulkUpdateCollectionsRequestModel; -pub mod cipher_card_model; -pub use self::cipher_card_model::CipherCardModel; -pub mod cipher_collections_request_model; -pub use self::cipher_collections_request_model::CipherCollectionsRequestModel; -pub mod cipher_create_request_model; -pub use self::cipher_create_request_model::CipherCreateRequestModel; -pub mod cipher_details_response_model; -pub use self::cipher_details_response_model::CipherDetailsResponseModel; -pub mod cipher_details_response_model_list_response_model; -pub use self::cipher_details_response_model_list_response_model::CipherDetailsResponseModelListResponseModel; -pub mod cipher_fido2_credential_model; -pub use self::cipher_fido2_credential_model::CipherFido2CredentialModel; -pub mod cipher_field_model; -pub use self::cipher_field_model::CipherFieldModel; -pub mod cipher_identity_model; -pub use self::cipher_identity_model::CipherIdentityModel; -pub mod cipher_login_model; -pub use self::cipher_login_model::CipherLoginModel; -pub mod cipher_login_uri_model; -pub use self::cipher_login_uri_model::CipherLoginUriModel; -pub mod cipher_mini_details_response_model; -pub use self::cipher_mini_details_response_model::CipherMiniDetailsResponseModel; -pub mod cipher_mini_details_response_model_list_response_model; -pub use self::cipher_mini_details_response_model_list_response_model::CipherMiniDetailsResponseModelListResponseModel; -pub mod cipher_mini_response_model; -pub use self::cipher_mini_response_model::CipherMiniResponseModel; -pub mod cipher_mini_response_model_list_response_model; -pub use self::cipher_mini_response_model_list_response_model::CipherMiniResponseModelListResponseModel; -pub mod cipher_partial_request_model; -pub use self::cipher_partial_request_model::CipherPartialRequestModel; -pub mod cipher_password_history_model; -pub use self::cipher_password_history_model::CipherPasswordHistoryModel; -pub mod cipher_reprompt_type; -pub use self::cipher_reprompt_type::CipherRepromptType; -pub mod cipher_request_model; -pub use self::cipher_request_model::CipherRequestModel; -pub mod cipher_response_model; -pub use self::cipher_response_model::CipherResponseModel; -pub mod cipher_secure_note_model; -pub use self::cipher_secure_note_model::CipherSecureNoteModel; -pub mod cipher_share_request_model; -pub use self::cipher_share_request_model::CipherShareRequestModel; -pub mod cipher_type; -pub use self::cipher_type::CipherType; -pub mod cipher_with_id_request_model; -pub use self::cipher_with_id_request_model::CipherWithIdRequestModel; -pub mod collection_access_details_response_model; -pub use self::collection_access_details_response_model::CollectionAccessDetailsResponseModel; -pub mod collection_access_details_response_model_list_response_model; -pub use self::collection_access_details_response_model_list_response_model::CollectionAccessDetailsResponseModelListResponseModel; -pub mod collection_bulk_delete_request_model; -pub use self::collection_bulk_delete_request_model::CollectionBulkDeleteRequestModel; -pub mod collection_details_response_model; -pub use self::collection_details_response_model::CollectionDetailsResponseModel; -pub mod collection_details_response_model_list_response_model; -pub use self::collection_details_response_model_list_response_model::CollectionDetailsResponseModelListResponseModel; -pub mod collection_request_model; -pub use self::collection_request_model::CollectionRequestModel; -pub mod collection_response_model; -pub use self::collection_response_model::CollectionResponseModel; -pub mod collection_response_model_list_response_model; -pub use self::collection_response_model_list_response_model::CollectionResponseModelListResponseModel; -pub mod collection_with_id_request_model; -pub use self::collection_with_id_request_model::CollectionWithIdRequestModel; -pub mod config_response_model; -pub use self::config_response_model::ConfigResponseModel; -pub mod create_client_organization_request_body; -pub use self::create_client_organization_request_body::CreateClientOrganizationRequestBody; -pub mod credential_create_options; -pub use self::credential_create_options::CredentialCreateOptions; -pub mod delete_recover_request_model; -pub use self::delete_recover_request_model::DeleteRecoverRequestModel; -pub mod device_keys_request_model; -pub use self::device_keys_request_model::DeviceKeysRequestModel; -pub mod device_keys_update_request_model; -pub use self::device_keys_update_request_model::DeviceKeysUpdateRequestModel; -pub mod device_request_model; -pub use self::device_request_model::DeviceRequestModel; -pub mod device_response_model; -pub use self::device_response_model::DeviceResponseModel; -pub mod device_response_model_list_response_model; -pub use self::device_response_model_list_response_model::DeviceResponseModelListResponseModel; -pub mod device_token_request_model; -pub use self::device_token_request_model::DeviceTokenRequestModel; -pub mod device_type; -pub use self::device_type::DeviceType; -pub mod device_verification_request_model; -pub use self::device_verification_request_model::DeviceVerificationRequestModel; -pub mod device_verification_response_model; -pub use self::device_verification_response_model::DeviceVerificationResponseModel; -pub mod domains_response_model; -pub use self::domains_response_model::DomainsResponseModel; -pub mod email_request_model; -pub use self::email_request_model::EmailRequestModel; -pub mod email_token_request_model; -pub use self::email_token_request_model::EmailTokenRequestModel; -pub mod emergency_access_grantee_details_response_model; -pub use self::emergency_access_grantee_details_response_model::EmergencyAccessGranteeDetailsResponseModel; -pub mod emergency_access_grantee_details_response_model_list_response_model; -pub use self::emergency_access_grantee_details_response_model_list_response_model::EmergencyAccessGranteeDetailsResponseModelListResponseModel; -pub mod emergency_access_grantor_details_response_model; -pub use self::emergency_access_grantor_details_response_model::EmergencyAccessGrantorDetailsResponseModel; -pub mod emergency_access_grantor_details_response_model_list_response_model; -pub use self::emergency_access_grantor_details_response_model_list_response_model::EmergencyAccessGrantorDetailsResponseModelListResponseModel; -pub mod emergency_access_invite_request_model; -pub use self::emergency_access_invite_request_model::EmergencyAccessInviteRequestModel; -pub mod emergency_access_password_request_model; -pub use self::emergency_access_password_request_model::EmergencyAccessPasswordRequestModel; -pub mod emergency_access_status_type; -pub use self::emergency_access_status_type::EmergencyAccessStatusType; -pub mod emergency_access_takeover_response_model; -pub use self::emergency_access_takeover_response_model::EmergencyAccessTakeoverResponseModel; -pub mod emergency_access_type; -pub use self::emergency_access_type::EmergencyAccessType; -pub mod emergency_access_update_request_model; -pub use self::emergency_access_update_request_model::EmergencyAccessUpdateRequestModel; -pub mod emergency_access_view_response_model; -pub use self::emergency_access_view_response_model::EmergencyAccessViewResponseModel; -pub mod emergency_access_with_id_request_model; -pub use self::emergency_access_with_id_request_model::EmergencyAccessWithIdRequestModel; -pub mod environment_config_response_model; -pub use self::environment_config_response_model::EnvironmentConfigResponseModel; -pub mod event_response_model; -pub use self::event_response_model::EventResponseModel; -pub mod event_response_model_list_response_model; -pub use self::event_response_model_list_response_model::EventResponseModelListResponseModel; -pub mod event_system_user; -pub use self::event_system_user::EventSystemUser; -pub mod event_type; -pub use self::event_type::EventType; -pub mod expanded_tax_info_update_request_model; -pub use self::expanded_tax_info_update_request_model::ExpandedTaxInfoUpdateRequestModel; -pub mod fido2_user; -pub use self::fido2_user::Fido2User; -pub mod field_type; -pub use self::field_type::FieldType; -pub mod file_upload_type; -pub use self::file_upload_type::FileUploadType; -pub mod folder_request_model; -pub use self::folder_request_model::FolderRequestModel; -pub mod folder_response_model; -pub use self::folder_response_model::FolderResponseModel; -pub mod folder_response_model_list_response_model; -pub use self::folder_response_model_list_response_model::FolderResponseModelListResponseModel; -pub mod folder_with_id_request_model; -pub use self::folder_with_id_request_model::FolderWithIdRequestModel; -pub mod get_secrets_request_model; -pub use self::get_secrets_request_model::GetSecretsRequestModel; -pub mod global_domains; -pub use self::global_domains::GlobalDomains; -pub mod global_equivalent_domains_type; -pub use self::global_equivalent_domains_type::GlobalEquivalentDomainsType; -pub mod granted_access_policy_request; -pub use self::granted_access_policy_request::GrantedAccessPolicyRequest; -pub mod granted_project_access_policy_permission_details_response_model; -pub use self::granted_project_access_policy_permission_details_response_model::GrantedProjectAccessPolicyPermissionDetailsResponseModel; -pub mod granted_project_access_policy_response_model; -pub use self::granted_project_access_policy_response_model::GrantedProjectAccessPolicyResponseModel; -pub mod group; -pub use self::group::Group; -pub mod group_access_policy_response_model; -pub use self::group_access_policy_response_model::GroupAccessPolicyResponseModel; -pub mod group_bulk_request_model; -pub use self::group_bulk_request_model::GroupBulkRequestModel; -pub mod group_details_response_model; -pub use self::group_details_response_model::GroupDetailsResponseModel; -pub mod group_details_response_model_list_response_model; -pub use self::group_details_response_model_list_response_model::GroupDetailsResponseModelListResponseModel; -pub mod group_request_model; -pub use self::group_request_model::GroupRequestModel; -pub mod group_response_model; -pub use self::group_response_model::GroupResponseModel; -pub mod import_ciphers_request_model; -pub use self::import_ciphers_request_model::ImportCiphersRequestModel; -pub mod import_organization_ciphers_request_model; -pub use self::import_organization_ciphers_request_model::ImportOrganizationCiphersRequestModel; -pub mod import_organization_users_request_model; -pub use self::import_organization_users_request_model::ImportOrganizationUsersRequestModel; -pub mod inner_project_export_response_model; -pub use self::inner_project_export_response_model::InnerProjectExportResponseModel; -pub mod inner_project_import_request_model; -pub use self::inner_project_import_request_model::InnerProjectImportRequestModel; -pub mod inner_secret_export_response_model; -pub use self::inner_secret_export_response_model::InnerSecretExportResponseModel; -pub mod inner_secret_import_request_model; -pub use self::inner_secret_import_request_model::InnerSecretImportRequestModel; -pub mod installation_request_model; -pub use self::installation_request_model::InstallationRequestModel; -pub mod installation_response_model; -pub use self::installation_response_model::InstallationResponseModel; -pub mod int32_int32_key_value_pair; -pub use self::int32_int32_key_value_pair::Int32Int32KeyValuePair; -pub mod kdf_request_model; -pub use self::kdf_request_model::KdfRequestModel; -pub mod kdf_type; -pub use self::kdf_type::KdfType; -pub mod key_model; -pub use self::key_model::KeyModel; -pub mod key_pair_request_body; -pub use self::key_pair_request_body::KeyPairRequestBody; -pub mod keys_request_model; -pub use self::keys_request_model::KeysRequestModel; -pub mod keys_response_model; -pub use self::keys_response_model::KeysResponseModel; -pub mod license_type; -pub use self::license_type::LicenseType; -pub mod master_password_policy_response_model; -pub use self::master_password_policy_response_model::MasterPasswordPolicyResponseModel; -pub mod member_decryption_type; -pub use self::member_decryption_type::MemberDecryptionType; -pub mod open_id_connect_redirect_behavior; -pub use self::open_id_connect_redirect_behavior::OpenIdConnectRedirectBehavior; -pub mod optional_cipher_details_response_model; -pub use self::optional_cipher_details_response_model::OptionalCipherDetailsResponseModel; -pub mod organization_api_key_information; -pub use self::organization_api_key_information::OrganizationApiKeyInformation; -pub mod organization_api_key_information_list_response_model; -pub use self::organization_api_key_information_list_response_model::OrganizationApiKeyInformationListResponseModel; -pub mod organization_api_key_request_model; -pub use self::organization_api_key_request_model::OrganizationApiKeyRequestModel; -pub mod organization_api_key_type; -pub use self::organization_api_key_type::OrganizationApiKeyType; -pub mod organization_auth_request_update_many_request_model; -pub use self::organization_auth_request_update_many_request_model::OrganizationAuthRequestUpdateManyRequestModel; -pub mod organization_auto_enroll_status_response_model; -pub use self::organization_auto_enroll_status_response_model::OrganizationAutoEnrollStatusResponseModel; -pub mod organization_billing_status_response_model; -pub use self::organization_billing_status_response_model::OrganizationBillingStatusResponseModel; -pub mod organization_collection_management_update_request_model; -pub use self::organization_collection_management_update_request_model::OrganizationCollectionManagementUpdateRequestModel; -pub mod organization_connection_request_model; -pub use self::organization_connection_request_model::OrganizationConnectionRequestModel; -pub mod organization_connection_response_model; -pub use self::organization_connection_response_model::OrganizationConnectionResponseModel; -pub mod organization_connection_type; -pub use self::organization_connection_type::OrganizationConnectionType; -pub mod organization_counts_response_model; -pub use self::organization_counts_response_model::OrganizationCountsResponseModel; -pub mod organization_create_request_model; -pub use self::organization_create_request_model::OrganizationCreateRequestModel; -pub mod organization_domain_request_model; -pub use self::organization_domain_request_model::OrganizationDomainRequestModel; -pub mod organization_domain_response_model; -pub use self::organization_domain_response_model::OrganizationDomainResponseModel; -pub mod organization_domain_response_model_list_response_model; -pub use self::organization_domain_response_model_list_response_model::OrganizationDomainResponseModelListResponseModel; -pub mod organization_domain_sso_details_request_model; -pub use self::organization_domain_sso_details_request_model::OrganizationDomainSsoDetailsRequestModel; -pub mod organization_domain_sso_details_response_model; -pub use self::organization_domain_sso_details_response_model::OrganizationDomainSsoDetailsResponseModel; -pub mod organization_keys_request_model; -pub use self::organization_keys_request_model::OrganizationKeysRequestModel; -pub mod organization_keys_response_model; -pub use self::organization_keys_response_model::OrganizationKeysResponseModel; -pub mod organization_license; -pub use self::organization_license::OrganizationLicense; -pub mod organization_public_key_response_model; -pub use self::organization_public_key_response_model::OrganizationPublicKeyResponseModel; -pub mod organization_response_model; -pub use self::organization_response_model::OrganizationResponseModel; -pub mod organization_seat_request_model; -pub use self::organization_seat_request_model::OrganizationSeatRequestModel; -pub mod organization_sponsorship_create_request_model; -pub use self::organization_sponsorship_create_request_model::OrganizationSponsorshipCreateRequestModel; -pub mod organization_sponsorship_redeem_request_model; -pub use self::organization_sponsorship_redeem_request_model::OrganizationSponsorshipRedeemRequestModel; -pub mod organization_sponsorship_request_model; -pub use self::organization_sponsorship_request_model::OrganizationSponsorshipRequestModel; -pub mod organization_sponsorship_response_model; -pub use self::organization_sponsorship_response_model::OrganizationSponsorshipResponseModel; -pub mod organization_sponsorship_sync_request_model; -pub use self::organization_sponsorship_sync_request_model::OrganizationSponsorshipSyncRequestModel; -pub mod organization_sponsorship_sync_response_model; -pub use self::organization_sponsorship_sync_response_model::OrganizationSponsorshipSyncResponseModel; -pub mod organization_sso_request_model; -pub use self::organization_sso_request_model::OrganizationSsoRequestModel; -pub mod organization_sso_response_model; -pub use self::organization_sso_response_model::OrganizationSsoResponseModel; -pub mod organization_subscription_response_model; -pub use self::organization_subscription_response_model::OrganizationSubscriptionResponseModel; -pub mod organization_subscription_update_request_model; -pub use self::organization_subscription_update_request_model::OrganizationSubscriptionUpdateRequestModel; -pub mod organization_update_request_model; -pub use self::organization_update_request_model::OrganizationUpdateRequestModel; -pub mod organization_upgrade_request_model; -pub use self::organization_upgrade_request_model::OrganizationUpgradeRequestModel; -pub mod organization_user_accept_init_request_model; -pub use self::organization_user_accept_init_request_model::OrganizationUserAcceptInitRequestModel; -pub mod organization_user_accept_request_model; -pub use self::organization_user_accept_request_model::OrganizationUserAcceptRequestModel; -pub mod organization_user_bulk_confirm_request_model; -pub use self::organization_user_bulk_confirm_request_model::OrganizationUserBulkConfirmRequestModel; -pub mod organization_user_bulk_confirm_request_model_entry; -pub use self::organization_user_bulk_confirm_request_model_entry::OrganizationUserBulkConfirmRequestModelEntry; -pub mod organization_user_bulk_request_model; -pub use self::organization_user_bulk_request_model::OrganizationUserBulkRequestModel; -pub mod organization_user_bulk_response_model; -pub use self::organization_user_bulk_response_model::OrganizationUserBulkResponseModel; -pub mod organization_user_bulk_response_model_list_response_model; -pub use self::organization_user_bulk_response_model_list_response_model::OrganizationUserBulkResponseModelListResponseModel; -pub mod organization_user_confirm_request_model; -pub use self::organization_user_confirm_request_model::OrganizationUserConfirmRequestModel; -pub mod organization_user_details_response_model; -pub use self::organization_user_details_response_model::OrganizationUserDetailsResponseModel; -pub mod organization_user_invite_request_model; -pub use self::organization_user_invite_request_model::OrganizationUserInviteRequestModel; -pub mod organization_user_public_key_response_model; -pub use self::organization_user_public_key_response_model::OrganizationUserPublicKeyResponseModel; -pub mod organization_user_public_key_response_model_list_response_model; -pub use self::organization_user_public_key_response_model_list_response_model::OrganizationUserPublicKeyResponseModelListResponseModel; -pub mod organization_user_reset_password_details_response_model; -pub use self::organization_user_reset_password_details_response_model::OrganizationUserResetPasswordDetailsResponseModel; -pub mod organization_user_reset_password_details_response_model_list_response_model; -pub use self::organization_user_reset_password_details_response_model_list_response_model::OrganizationUserResetPasswordDetailsResponseModelListResponseModel; -pub mod organization_user_reset_password_enrollment_request_model; -pub use self::organization_user_reset_password_enrollment_request_model::OrganizationUserResetPasswordEnrollmentRequestModel; -pub mod organization_user_reset_password_request_model; -pub use self::organization_user_reset_password_request_model::OrganizationUserResetPasswordRequestModel; -pub mod organization_user_status_type; -pub use self::organization_user_status_type::OrganizationUserStatusType; -pub mod organization_user_type; -pub use self::organization_user_type::OrganizationUserType; -pub mod organization_user_update_request_model; -pub use self::organization_user_update_request_model::OrganizationUserUpdateRequestModel; -pub mod organization_user_user_details_response_model; -pub use self::organization_user_user_details_response_model::OrganizationUserUserDetailsResponseModel; -pub mod organization_user_user_details_response_model_list_response_model; -pub use self::organization_user_user_details_response_model_list_response_model::OrganizationUserUserDetailsResponseModelListResponseModel; -pub mod organization_verify_bank_request_model; -pub use self::organization_verify_bank_request_model::OrganizationVerifyBankRequestModel; -pub mod organization_verify_delete_recover_request_model; -pub use self::organization_verify_delete_recover_request_model::OrganizationVerifyDeleteRecoverRequestModel; -pub mod other_device_keys_update_request_model; -pub use self::other_device_keys_update_request_model::OtherDeviceKeysUpdateRequestModel; -pub mod password_hint_request_model; -pub use self::password_hint_request_model::PasswordHintRequestModel; -pub mod password_manager_plan_features_response_model; -pub use self::password_manager_plan_features_response_model::PasswordManagerPlanFeaturesResponseModel; -pub mod password_request_model; -pub use self::password_request_model::PasswordRequestModel; -pub mod payment_method_type; -pub use self::payment_method_type::PaymentMethodType; -pub mod payment_request_model; -pub use self::payment_request_model::PaymentRequestModel; -pub mod payment_response_model; -pub use self::payment_response_model::PaymentResponseModel; -pub mod pending_organization_auth_request_response_model; -pub use self::pending_organization_auth_request_response_model::PendingOrganizationAuthRequestResponseModel; -pub mod pending_organization_auth_request_response_model_list_response_model; -pub use self::pending_organization_auth_request_response_model_list_response_model::PendingOrganizationAuthRequestResponseModelListResponseModel; -pub mod people_access_policies_request_model; -pub use self::people_access_policies_request_model::PeopleAccessPoliciesRequestModel; -pub mod permissions; -pub use self::permissions::Permissions; -pub mod plan_response_model; -pub use self::plan_response_model::PlanResponseModel; -pub mod plan_response_model_list_response_model; -pub use self::plan_response_model_list_response_model::PlanResponseModelListResponseModel; -pub mod plan_sponsorship_type; -pub use self::plan_sponsorship_type::PlanSponsorshipType; -pub mod plan_type; -pub use self::plan_type::PlanType; -pub mod policy_request_model; -pub use self::policy_request_model::PolicyRequestModel; -pub mod policy_response_model; -pub use self::policy_response_model::PolicyResponseModel; -pub mod policy_response_model_list_response_model; -pub use self::policy_response_model_list_response_model::PolicyResponseModelListResponseModel; -pub mod policy_type; -pub use self::policy_type::PolicyType; -pub mod potential_grantee_response_model; -pub use self::potential_grantee_response_model::PotentialGranteeResponseModel; -pub mod potential_grantee_response_model_list_response_model; -pub use self::potential_grantee_response_model_list_response_model::PotentialGranteeResponseModelListResponseModel; -pub mod product_tier_type; -pub use self::product_tier_type::ProductTierType; -pub mod profile_organization_response_model; -pub use self::profile_organization_response_model::ProfileOrganizationResponseModel; -pub mod profile_organization_response_model_list_response_model; -pub use self::profile_organization_response_model_list_response_model::ProfileOrganizationResponseModelListResponseModel; -pub mod profile_provider_organization_response_model; -pub use self::profile_provider_organization_response_model::ProfileProviderOrganizationResponseModel; -pub mod profile_provider_response_model; -pub use self::profile_provider_response_model::ProfileProviderResponseModel; -pub mod profile_response_model; -pub use self::profile_response_model::ProfileResponseModel; -pub mod project_counts_response_model; -pub use self::project_counts_response_model::ProjectCountsResponseModel; -pub mod project_create_request_model; -pub use self::project_create_request_model::ProjectCreateRequestModel; -pub mod project_people_access_policies_response_model; -pub use self::project_people_access_policies_response_model::ProjectPeopleAccessPoliciesResponseModel; -pub mod project_response_model; -pub use self::project_response_model::ProjectResponseModel; -pub mod project_response_model_list_response_model; -pub use self::project_response_model_list_response_model::ProjectResponseModelListResponseModel; -pub mod project_service_accounts_access_policies_request_model; -pub use self::project_service_accounts_access_policies_request_model::ProjectServiceAccountsAccessPoliciesRequestModel; -pub mod project_service_accounts_access_policies_response_model; -pub use self::project_service_accounts_access_policies_response_model::ProjectServiceAccountsAccessPoliciesResponseModel; -pub mod project_update_request_model; -pub use self::project_update_request_model::ProjectUpdateRequestModel; -pub mod protected_device_response_model; -pub use self::protected_device_response_model::ProtectedDeviceResponseModel; -pub mod provider_organization_add_request_model; -pub use self::provider_organization_add_request_model::ProviderOrganizationAddRequestModel; -pub mod provider_organization_create_request_model; -pub use self::provider_organization_create_request_model::ProviderOrganizationCreateRequestModel; -pub mod provider_organization_organization_details_response_model; -pub use self::provider_organization_organization_details_response_model::ProviderOrganizationOrganizationDetailsResponseModel; -pub mod provider_organization_organization_details_response_model_list_response_model; -pub use self::provider_organization_organization_details_response_model_list_response_model::ProviderOrganizationOrganizationDetailsResponseModelListResponseModel; -pub mod provider_organization_response_model; -pub use self::provider_organization_response_model::ProviderOrganizationResponseModel; -pub mod provider_response_model; -pub use self::provider_response_model::ProviderResponseModel; -pub mod provider_setup_request_model; -pub use self::provider_setup_request_model::ProviderSetupRequestModel; -pub mod provider_status_type; -pub use self::provider_status_type::ProviderStatusType; -pub mod provider_type; -pub use self::provider_type::ProviderType; -pub mod provider_update_request_model; -pub use self::provider_update_request_model::ProviderUpdateRequestModel; -pub mod provider_user_accept_request_model; -pub use self::provider_user_accept_request_model::ProviderUserAcceptRequestModel; -pub mod provider_user_bulk_confirm_request_model; -pub use self::provider_user_bulk_confirm_request_model::ProviderUserBulkConfirmRequestModel; -pub mod provider_user_bulk_confirm_request_model_entry; -pub use self::provider_user_bulk_confirm_request_model_entry::ProviderUserBulkConfirmRequestModelEntry; -pub mod provider_user_bulk_request_model; -pub use self::provider_user_bulk_request_model::ProviderUserBulkRequestModel; -pub mod provider_user_bulk_response_model; -pub use self::provider_user_bulk_response_model::ProviderUserBulkResponseModel; -pub mod provider_user_bulk_response_model_list_response_model; -pub use self::provider_user_bulk_response_model_list_response_model::ProviderUserBulkResponseModelListResponseModel; -pub mod provider_user_confirm_request_model; -pub use self::provider_user_confirm_request_model::ProviderUserConfirmRequestModel; -pub mod provider_user_invite_request_model; -pub use self::provider_user_invite_request_model::ProviderUserInviteRequestModel; -pub mod provider_user_public_key_response_model; -pub use self::provider_user_public_key_response_model::ProviderUserPublicKeyResponseModel; -pub mod provider_user_public_key_response_model_list_response_model; -pub use self::provider_user_public_key_response_model_list_response_model::ProviderUserPublicKeyResponseModelListResponseModel; -pub mod provider_user_response_model; -pub use self::provider_user_response_model::ProviderUserResponseModel; -pub mod provider_user_status_type; -pub use self::provider_user_status_type::ProviderUserStatusType; -pub mod provider_user_type; -pub use self::provider_user_type::ProviderUserType; -pub mod provider_user_update_request_model; -pub use self::provider_user_update_request_model::ProviderUserUpdateRequestModel; -pub mod provider_user_user_details_response_model; -pub use self::provider_user_user_details_response_model::ProviderUserUserDetailsResponseModel; -pub mod provider_user_user_details_response_model_list_response_model; -pub use self::provider_user_user_details_response_model_list_response_model::ProviderUserUserDetailsResponseModelListResponseModel; -pub mod provider_verify_delete_recover_request_model; -pub use self::provider_verify_delete_recover_request_model::ProviderVerifyDeleteRecoverRequestModel; -pub mod pub_key_cred_param; -pub use self::pub_key_cred_param::PubKeyCredParam; -pub mod public_key_credential_descriptor; -pub use self::public_key_credential_descriptor::PublicKeyCredentialDescriptor; -pub mod public_key_credential_rp_entity; -pub use self::public_key_credential_rp_entity::PublicKeyCredentialRpEntity; -pub mod public_key_credential_type; -pub use self::public_key_credential_type::PublicKeyCredentialType; -pub mod push_device_request_model; -pub use self::push_device_request_model::PushDeviceRequestModel; -pub mod push_registration_request_model; -pub use self::push_registration_request_model::PushRegistrationRequestModel; -pub mod push_send_request_model; -pub use self::push_send_request_model::PushSendRequestModel; -pub mod push_type; -pub use self::push_type::PushType; -pub mod push_update_request_model; -pub use self::push_update_request_model::PushUpdateRequestModel; -pub mod request_sm_access_request_model; -pub use self::request_sm_access_request_model::RequestSmAccessRequestModel; -pub mod reset_password_with_org_id_request_model; -pub use self::reset_password_with_org_id_request_model::ResetPasswordWithOrgIdRequestModel; -pub mod response_data; -pub use self::response_data::ResponseData; -pub mod revoke_access_tokens_request; -pub use self::revoke_access_tokens_request::RevokeAccessTokensRequest; -pub mod saml2_binding_type; -pub use self::saml2_binding_type::Saml2BindingType; -pub mod saml2_name_id_format; -pub use self::saml2_name_id_format::Saml2NameIdFormat; -pub mod saml2_signing_behavior; -pub use self::saml2_signing_behavior::Saml2SigningBehavior; -pub mod secret_access_policies_requests_model; -pub use self::secret_access_policies_requests_model::SecretAccessPoliciesRequestsModel; -pub mod secret_access_policies_response_model; -pub use self::secret_access_policies_response_model::SecretAccessPoliciesResponseModel; -pub mod secret_create_request_model; -pub use self::secret_create_request_model::SecretCreateRequestModel; -pub mod secret_response_inner_project; -pub use self::secret_response_inner_project::SecretResponseInnerProject; -pub mod secret_response_model; -pub use self::secret_response_model::SecretResponseModel; -pub mod secret_update_request_model; -pub use self::secret_update_request_model::SecretUpdateRequestModel; -pub mod secret_verification_request_model; -pub use self::secret_verification_request_model::SecretVerificationRequestModel; -pub mod secret_with_projects_inner_project; -pub use self::secret_with_projects_inner_project::SecretWithProjectsInnerProject; -pub mod secret_with_projects_list_response_model; -pub use self::secret_with_projects_list_response_model::SecretWithProjectsListResponseModel; -pub mod secrets_manager_plan_features_response_model; -pub use self::secrets_manager_plan_features_response_model::SecretsManagerPlanFeaturesResponseModel; -pub mod secrets_manager_subscribe_request_model; -pub use self::secrets_manager_subscribe_request_model::SecretsManagerSubscribeRequestModel; -pub mod secrets_manager_subscription_update_request_model; -pub use self::secrets_manager_subscription_update_request_model::SecretsManagerSubscriptionUpdateRequestModel; -pub mod secrets_sync_response_model; -pub use self::secrets_sync_response_model::SecretsSyncResponseModel; -pub mod secrets_with_projects_inner_secret; -pub use self::secrets_with_projects_inner_secret::SecretsWithProjectsInnerSecret; -pub mod secure_note_type; -pub use self::secure_note_type::SecureNoteType; -pub mod selection_read_only_request_model; -pub use self::selection_read_only_request_model::SelectionReadOnlyRequestModel; -pub mod selection_read_only_response_model; -pub use self::selection_read_only_response_model::SelectionReadOnlyResponseModel; -pub mod self_hosted_organization_license_request_model; -pub use self::self_hosted_organization_license_request_model::SelfHostedOrganizationLicenseRequestModel; -pub mod send_access_request_model; -pub use self::send_access_request_model::SendAccessRequestModel; -pub mod send_file_model; -pub use self::send_file_model::SendFileModel; -pub mod send_file_upload_data_response_model; -pub use self::send_file_upload_data_response_model::SendFileUploadDataResponseModel; -pub mod send_request_model; -pub use self::send_request_model::SendRequestModel; -pub mod send_response_model; -pub use self::send_response_model::SendResponseModel; -pub mod send_response_model_list_response_model; -pub use self::send_response_model_list_response_model::SendResponseModelListResponseModel; -pub mod send_text_model; -pub use self::send_text_model::SendTextModel; -pub mod send_type; -pub use self::send_type::SendType; -pub mod send_with_id_request_model; -pub use self::send_with_id_request_model::SendWithIdRequestModel; -pub mod server_config_response_model; -pub use self::server_config_response_model::ServerConfigResponseModel; -pub mod service_account_access_policy_response_model; -pub use self::service_account_access_policy_response_model::ServiceAccountAccessPolicyResponseModel; -pub mod service_account_counts_response_model; -pub use self::service_account_counts_response_model::ServiceAccountCountsResponseModel; -pub mod service_account_create_request_model; -pub use self::service_account_create_request_model::ServiceAccountCreateRequestModel; -pub mod service_account_granted_policies_permission_details_response_model; -pub use self::service_account_granted_policies_permission_details_response_model::ServiceAccountGrantedPoliciesPermissionDetailsResponseModel; -pub mod service_account_granted_policies_request_model; -pub use self::service_account_granted_policies_request_model::ServiceAccountGrantedPoliciesRequestModel; -pub mod service_account_people_access_policies_response_model; -pub use self::service_account_people_access_policies_response_model::ServiceAccountPeopleAccessPoliciesResponseModel; -pub mod service_account_response_model; -pub use self::service_account_response_model::ServiceAccountResponseModel; -pub mod service_account_secrets_details_response_model; -pub use self::service_account_secrets_details_response_model::ServiceAccountSecretsDetailsResponseModel; -pub mod service_account_secrets_details_response_model_list_response_model; -pub use self::service_account_secrets_details_response_model_list_response_model::ServiceAccountSecretsDetailsResponseModelListResponseModel; -pub mod service_account_update_request_model; -pub use self::service_account_update_request_model::ServiceAccountUpdateRequestModel; -pub mod set_key_connector_key_request_model; -pub use self::set_key_connector_key_request_model::SetKeyConnectorKeyRequestModel; -pub mod set_password_request_model; -pub use self::set_password_request_model::SetPasswordRequestModel; -pub mod sm_export_response_model; -pub use self::sm_export_response_model::SmExportResponseModel; -pub mod sm_import_request_model; -pub use self::sm_import_request_model::SmImportRequestModel; -pub mod sso_configuration_data; -pub use self::sso_configuration_data::SsoConfigurationData; -pub mod sso_configuration_data_request; -pub use self::sso_configuration_data_request::SsoConfigurationDataRequest; -pub mod sso_type; -pub use self::sso_type::SsoType; -pub mod sso_urls; -pub use self::sso_urls::SsoUrls; -pub mod storage_request_model; -pub use self::storage_request_model::StorageRequestModel; -pub mod subscription_cancellation_request_model; -pub use self::subscription_cancellation_request_model::SubscriptionCancellationRequestModel; -pub mod subscription_response_model; -pub use self::subscription_response_model::SubscriptionResponseModel; -pub mod sync_response_model; -pub use self::sync_response_model::SyncResponseModel; -pub mod tax_info_response_model; -pub use self::tax_info_response_model::TaxInfoResponseModel; -pub mod tax_info_update_request_model; -pub use self::tax_info_update_request_model::TaxInfoUpdateRequestModel; -pub mod tax_information_request_body; -pub use self::tax_information_request_body::TaxInformationRequestBody; -pub mod tax_rate_response_model; -pub use self::tax_rate_response_model::TaxRateResponseModel; -pub mod tax_rate_response_model_list_response_model; -pub use self::tax_rate_response_model_list_response_model::TaxRateResponseModelListResponseModel; -pub mod transaction_type; -pub use self::transaction_type::TransactionType; -pub mod two_factor_authenticator_disable_request_model; -pub use self::two_factor_authenticator_disable_request_model::TwoFactorAuthenticatorDisableRequestModel; -pub mod two_factor_authenticator_response_model; -pub use self::two_factor_authenticator_response_model::TwoFactorAuthenticatorResponseModel; -pub mod two_factor_duo_response_model; -pub use self::two_factor_duo_response_model::TwoFactorDuoResponseModel; -pub mod two_factor_email_request_model; -pub use self::two_factor_email_request_model::TwoFactorEmailRequestModel; -pub mod two_factor_email_response_model; -pub use self::two_factor_email_response_model::TwoFactorEmailResponseModel; -pub mod two_factor_provider_request_model; -pub use self::two_factor_provider_request_model::TwoFactorProviderRequestModel; -pub mod two_factor_provider_response_model; -pub use self::two_factor_provider_response_model::TwoFactorProviderResponseModel; -pub mod two_factor_provider_response_model_list_response_model; -pub use self::two_factor_provider_response_model_list_response_model::TwoFactorProviderResponseModelListResponseModel; -pub mod two_factor_provider_type; -pub use self::two_factor_provider_type::TwoFactorProviderType; -pub mod two_factor_recover_response_model; -pub use self::two_factor_recover_response_model::TwoFactorRecoverResponseModel; -pub mod two_factor_recovery_request_model; -pub use self::two_factor_recovery_request_model::TwoFactorRecoveryRequestModel; -pub mod two_factor_web_authn_delete_request_model; -pub use self::two_factor_web_authn_delete_request_model::TwoFactorWebAuthnDeleteRequestModel; -pub mod two_factor_web_authn_request_model; -pub use self::two_factor_web_authn_request_model::TwoFactorWebAuthnRequestModel; -pub mod two_factor_web_authn_response_model; -pub use self::two_factor_web_authn_response_model::TwoFactorWebAuthnResponseModel; -pub mod two_factor_yubi_key_response_model; -pub use self::two_factor_yubi_key_response_model::TwoFactorYubiKeyResponseModel; -pub mod update_avatar_request_model; -pub use self::update_avatar_request_model::UpdateAvatarRequestModel; -pub mod update_client_organization_request_body; -pub use self::update_client_organization_request_body::UpdateClientOrganizationRequestBody; -pub mod update_devices_trust_request_model; -pub use self::update_devices_trust_request_model::UpdateDevicesTrustRequestModel; -pub mod update_domains_request_model; -pub use self::update_domains_request_model::UpdateDomainsRequestModel; -pub mod update_key_request_model; -pub use self::update_key_request_model::UpdateKeyRequestModel; -pub mod update_profile_request_model; -pub use self::update_profile_request_model::UpdateProfileRequestModel; -pub mod update_tde_offboarding_password_request_model; -pub use self::update_tde_offboarding_password_request_model::UpdateTdeOffboardingPasswordRequestModel; -pub mod update_temp_password_request_model; -pub use self::update_temp_password_request_model::UpdateTempPasswordRequestModel; -pub mod update_two_factor_authenticator_request_model; -pub use self::update_two_factor_authenticator_request_model::UpdateTwoFactorAuthenticatorRequestModel; -pub mod update_two_factor_duo_request_model; -pub use self::update_two_factor_duo_request_model::UpdateTwoFactorDuoRequestModel; -pub mod update_two_factor_email_request_model; -pub use self::update_two_factor_email_request_model::UpdateTwoFactorEmailRequestModel; -pub mod update_two_factor_yubico_otp_request_model; -pub use self::update_two_factor_yubico_otp_request_model::UpdateTwoFactorYubicoOtpRequestModel; -pub mod uri_match_type; -pub use self::uri_match_type::UriMatchType; -pub mod user; -pub use self::user::User; -pub mod user_access_policy_response_model; -pub use self::user_access_policy_response_model::UserAccessPolicyResponseModel; -pub mod user_key_response_model; -pub use self::user_key_response_model::UserKeyResponseModel; -pub mod user_license; -pub use self::user_license::UserLicense; -pub mod user_verification_requirement; -pub use self::user_verification_requirement::UserVerificationRequirement; -pub mod verify_delete_recover_request_model; -pub use self::verify_delete_recover_request_model::VerifyDeleteRecoverRequestModel; -pub mod verify_email_request_model; -pub use self::verify_email_request_model::VerifyEmailRequestModel; -pub mod verify_otp_request_model; -pub use self::verify_otp_request_model::VerifyOtpRequestModel; -pub mod web_authn_credential_create_options_response_model; -pub use self::web_authn_credential_create_options_response_model::WebAuthnCredentialCreateOptionsResponseModel; -pub mod web_authn_credential_response_model; -pub use self::web_authn_credential_response_model::WebAuthnCredentialResponseModel; -pub mod web_authn_credential_response_model_list_response_model; -pub use self::web_authn_credential_response_model_list_response_model::WebAuthnCredentialResponseModelListResponseModel; -pub mod web_authn_login_assertion_options_response_model; -pub use self::web_authn_login_assertion_options_response_model::WebAuthnLoginAssertionOptionsResponseModel; -pub mod web_authn_login_credential_create_request_model; -pub use self::web_authn_login_credential_create_request_model::WebAuthnLoginCredentialCreateRequestModel; -pub mod web_authn_login_credential_update_request_model; -pub use self::web_authn_login_credential_update_request_model::WebAuthnLoginCredentialUpdateRequestModel; -pub mod web_authn_login_rotate_key_request_model; -pub use self::web_authn_login_rotate_key_request_model::WebAuthnLoginRotateKeyRequestModel; -pub mod web_authn_prf_status; -pub use self::web_authn_prf_status::WebAuthnPrfStatus; diff --git a/crates/bitwarden-api-api/src/models/open_id_connect_redirect_behavior.rs b/crates/bitwarden-api-api/src/models/open_id_connect_redirect_behavior.rs deleted file mode 100644 index 5296427ff..000000000 --- a/crates/bitwarden-api-api/src/models/open_id_connect_redirect_behavior.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum OpenIdConnectRedirectBehavior { - RedirectGet = 0, - FormPost = 1, -} - -impl std::fmt::Display for OpenIdConnectRedirectBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::RedirectGet => write!(f, "0"), - Self::FormPost => write!(f, "1"), - } - } -} - -impl Default for OpenIdConnectRedirectBehavior { - fn default() -> OpenIdConnectRedirectBehavior { - Self::RedirectGet - } -} diff --git a/crates/bitwarden-api-api/src/models/optional_cipher_details_response_model.rs b/crates/bitwarden-api-api/src/models/optional_cipher_details_response_model.rs deleted file mode 100644 index c99428c87..000000000 --- a/crates/bitwarden-api-api/src/models/optional_cipher_details_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OptionalCipherDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "unavailable", skip_serializing_if = "Option::is_none")] - pub unavailable: Option, - #[serde(rename = "cipher", skip_serializing_if = "Option::is_none")] - pub cipher: Option>, -} - -impl OptionalCipherDetailsResponseModel { - pub fn new() -> OptionalCipherDetailsResponseModel { - OptionalCipherDetailsResponseModel { - object: None, - unavailable: None, - cipher: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_api_key_information.rs b/crates/bitwarden-api-api/src/models/organization_api_key_information.rs deleted file mode 100644 index 0916798d8..000000000 --- a/crates/bitwarden-api-api/src/models/organization_api_key_information.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationApiKeyInformation { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "keyType", skip_serializing_if = "Option::is_none")] - pub key_type: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, -} - -impl OrganizationApiKeyInformation { - pub fn new() -> OrganizationApiKeyInformation { - OrganizationApiKeyInformation { - object: None, - key_type: None, - revision_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_api_key_information_list_response_model.rs b/crates/bitwarden-api-api/src/models/organization_api_key_information_list_response_model.rs deleted file mode 100644 index 20850a34e..000000000 --- a/crates/bitwarden-api-api/src/models/organization_api_key_information_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationApiKeyInformationListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl OrganizationApiKeyInformationListResponseModel { - pub fn new() -> OrganizationApiKeyInformationListResponseModel { - OrganizationApiKeyInformationListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_api_key_request_model.rs b/crates/bitwarden-api-api/src/models/organization_api_key_request_model.rs deleted file mode 100644 index 955336ec6..000000000 --- a/crates/bitwarden-api-api/src/models/organization_api_key_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationApiKeyRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, -} - -impl OrganizationApiKeyRequestModel { - pub fn new() -> OrganizationApiKeyRequestModel { - OrganizationApiKeyRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - r#type: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_api_key_type.rs b/crates/bitwarden-api-api/src/models/organization_api_key_type.rs deleted file mode 100644 index 471f8ff39..000000000 --- a/crates/bitwarden-api-api/src/models/organization_api_key_type.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum OrganizationApiKeyType { - Default = 0, - BillingSync = 1, - Scim = 2, -} - -impl std::fmt::Display for OrganizationApiKeyType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Default => write!(f, "0"), - Self::BillingSync => write!(f, "1"), - Self::Scim => write!(f, "2"), - } - } -} - -impl Default for OrganizationApiKeyType { - fn default() -> OrganizationApiKeyType { - Self::Default - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_auth_request_update_many_request_model.rs b/crates/bitwarden-api-api/src/models/organization_auth_request_update_many_request_model.rs deleted file mode 100644 index cccb1b9ed..000000000 --- a/crates/bitwarden-api-api/src/models/organization_auth_request_update_many_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationAuthRequestUpdateManyRequestModel { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "approved", skip_serializing_if = "Option::is_none")] - pub approved: Option, -} - -impl OrganizationAuthRequestUpdateManyRequestModel { - pub fn new() -> OrganizationAuthRequestUpdateManyRequestModel { - OrganizationAuthRequestUpdateManyRequestModel { - id: None, - key: None, - approved: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_auto_enroll_status_response_model.rs b/crates/bitwarden-api-api/src/models/organization_auto_enroll_status_response_model.rs deleted file mode 100644 index ed89d457f..000000000 --- a/crates/bitwarden-api-api/src/models/organization_auto_enroll_status_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationAutoEnrollStatusResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde( - rename = "resetPasswordEnabled", - skip_serializing_if = "Option::is_none" - )] - pub reset_password_enabled: Option, -} - -impl OrganizationAutoEnrollStatusResponseModel { - pub fn new() -> OrganizationAutoEnrollStatusResponseModel { - OrganizationAutoEnrollStatusResponseModel { - object: None, - id: None, - reset_password_enabled: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_billing_status_response_model.rs b/crates/bitwarden-api-api/src/models/organization_billing_status_response_model.rs deleted file mode 100644 index d01af8694..000000000 --- a/crates/bitwarden-api-api/src/models/organization_billing_status_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationBillingStatusResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "organizationName", skip_serializing_if = "Option::is_none")] - pub organization_name: Option, - #[serde( - rename = "risksSubscriptionFailure", - skip_serializing_if = "Option::is_none" - )] - pub risks_subscription_failure: Option, -} - -impl OrganizationBillingStatusResponseModel { - pub fn new() -> OrganizationBillingStatusResponseModel { - OrganizationBillingStatusResponseModel { - object: None, - organization_id: None, - organization_name: None, - risks_subscription_failure: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_collection_management_update_request_model.rs b/crates/bitwarden-api-api/src/models/organization_collection_management_update_request_model.rs deleted file mode 100644 index 06f57e430..000000000 --- a/crates/bitwarden-api-api/src/models/organization_collection_management_update_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationCollectionManagementUpdateRequestModel { - #[serde( - rename = "limitCreateDeleteOwnerAdmin", - skip_serializing_if = "Option::is_none" - )] - pub limit_create_delete_owner_admin: Option, - #[serde( - rename = "allowAdminAccessToAllCollectionItems", - skip_serializing_if = "Option::is_none" - )] - pub allow_admin_access_to_all_collection_items: Option, -} - -impl OrganizationCollectionManagementUpdateRequestModel { - pub fn new() -> OrganizationCollectionManagementUpdateRequestModel { - OrganizationCollectionManagementUpdateRequestModel { - limit_create_delete_owner_admin: None, - allow_admin_access_to_all_collection_items: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_connection_request_model.rs b/crates/bitwarden-api-api/src/models/organization_connection_request_model.rs deleted file mode 100644 index 4901a3280..000000000 --- a/crates/bitwarden-api-api/src/models/organization_connection_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationConnectionRequestModel { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "config", skip_serializing_if = "Option::is_none")] - pub config: Option, -} - -impl OrganizationConnectionRequestModel { - pub fn new() -> OrganizationConnectionRequestModel { - OrganizationConnectionRequestModel { - r#type: None, - organization_id: None, - enabled: None, - config: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_connection_response_model.rs b/crates/bitwarden-api-api/src/models/organization_connection_response_model.rs deleted file mode 100644 index ec7654ca5..000000000 --- a/crates/bitwarden-api-api/src/models/organization_connection_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationConnectionResponseModel { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "config", skip_serializing_if = "Option::is_none")] - pub config: Option, -} - -impl OrganizationConnectionResponseModel { - pub fn new() -> OrganizationConnectionResponseModel { - OrganizationConnectionResponseModel { - id: None, - r#type: None, - organization_id: None, - enabled: None, - config: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_connection_type.rs b/crates/bitwarden-api-api/src/models/organization_connection_type.rs deleted file mode 100644 index 4f2a152e8..000000000 --- a/crates/bitwarden-api-api/src/models/organization_connection_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum OrganizationConnectionType { - CloudBillingSync = 1, - Scim = 2, -} - -impl std::fmt::Display for OrganizationConnectionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::CloudBillingSync => write!(f, "1"), - Self::Scim => write!(f, "2"), - } - } -} - -impl Default for OrganizationConnectionType { - fn default() -> OrganizationConnectionType { - Self::CloudBillingSync - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_counts_response_model.rs b/crates/bitwarden-api-api/src/models/organization_counts_response_model.rs deleted file mode 100644 index 4ba9203c0..000000000 --- a/crates/bitwarden-api-api/src/models/organization_counts_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationCountsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option, - #[serde(rename = "secrets", skip_serializing_if = "Option::is_none")] - pub secrets: Option, - #[serde(rename = "serviceAccounts", skip_serializing_if = "Option::is_none")] - pub service_accounts: Option, -} - -impl OrganizationCountsResponseModel { - pub fn new() -> OrganizationCountsResponseModel { - OrganizationCountsResponseModel { - object: None, - projects: None, - secrets: None, - service_accounts: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_create_request_model.rs b/crates/bitwarden-api-api/src/models/organization_create_request_model.rs deleted file mode 100644 index a419e36db..000000000 --- a/crates/bitwarden-api-api/src/models/organization_create_request_model.rs +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationCreateRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "billingEmail")] - pub billing_email: String, - #[serde(rename = "planType", skip_serializing_if = "Option::is_none")] - pub plan_type: Option, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "keys", skip_serializing_if = "Option::is_none")] - pub keys: Option>, - #[serde(rename = "paymentMethodType", skip_serializing_if = "Option::is_none")] - pub payment_method_type: Option, - #[serde(rename = "paymentToken", skip_serializing_if = "Option::is_none")] - pub payment_token: Option, - #[serde(rename = "additionalSeats", skip_serializing_if = "Option::is_none")] - pub additional_seats: Option, - #[serde( - rename = "additionalStorageGb", - skip_serializing_if = "Option::is_none" - )] - pub additional_storage_gb: Option, - #[serde(rename = "premiumAccessAddon", skip_serializing_if = "Option::is_none")] - pub premium_access_addon: Option, - #[serde(rename = "collectionName", skip_serializing_if = "Option::is_none")] - pub collection_name: Option, - #[serde(rename = "taxIdNumber", skip_serializing_if = "Option::is_none")] - pub tax_id_number: Option, - #[serde( - rename = "billingAddressLine1", - skip_serializing_if = "Option::is_none" - )] - pub billing_address_line1: Option, - #[serde( - rename = "billingAddressLine2", - skip_serializing_if = "Option::is_none" - )] - pub billing_address_line2: Option, - #[serde(rename = "billingAddressCity", skip_serializing_if = "Option::is_none")] - pub billing_address_city: Option, - #[serde( - rename = "billingAddressState", - skip_serializing_if = "Option::is_none" - )] - pub billing_address_state: Option, - #[serde( - rename = "billingAddressPostalCode", - skip_serializing_if = "Option::is_none" - )] - pub billing_address_postal_code: Option, - #[serde( - rename = "billingAddressCountry", - skip_serializing_if = "Option::is_none" - )] - pub billing_address_country: Option, - #[serde(rename = "maxAutoscaleSeats", skip_serializing_if = "Option::is_none")] - pub max_autoscale_seats: Option, - #[serde(rename = "additionalSmSeats", skip_serializing_if = "Option::is_none")] - pub additional_sm_seats: Option, - #[serde( - rename = "additionalServiceAccounts", - skip_serializing_if = "Option::is_none" - )] - pub additional_service_accounts: Option, - #[serde(rename = "useSecretsManager")] - pub use_secrets_manager: bool, - #[serde( - rename = "isFromSecretsManagerTrial", - skip_serializing_if = "Option::is_none" - )] - pub is_from_secrets_manager_trial: Option, - #[serde(rename = "initiationPath", skip_serializing_if = "Option::is_none")] - pub initiation_path: Option, -} - -impl OrganizationCreateRequestModel { - pub fn new( - name: String, - billing_email: String, - key: String, - use_secrets_manager: bool, - ) -> OrganizationCreateRequestModel { - OrganizationCreateRequestModel { - name, - business_name: None, - billing_email, - plan_type: None, - key, - keys: None, - payment_method_type: None, - payment_token: None, - additional_seats: None, - additional_storage_gb: None, - premium_access_addon: None, - collection_name: None, - tax_id_number: None, - billing_address_line1: None, - billing_address_line2: None, - billing_address_city: None, - billing_address_state: None, - billing_address_postal_code: None, - billing_address_country: None, - max_autoscale_seats: None, - additional_sm_seats: None, - additional_service_accounts: None, - use_secrets_manager, - is_from_secrets_manager_trial: None, - initiation_path: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_domain_request_model.rs b/crates/bitwarden-api-api/src/models/organization_domain_request_model.rs deleted file mode 100644 index a467fe90b..000000000 --- a/crates/bitwarden-api-api/src/models/organization_domain_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationDomainRequestModel { - #[serde(rename = "domainName")] - pub domain_name: String, -} - -impl OrganizationDomainRequestModel { - pub fn new(domain_name: String) -> OrganizationDomainRequestModel { - OrganizationDomainRequestModel { domain_name } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_domain_response_model.rs b/crates/bitwarden-api-api/src/models/organization_domain_response_model.rs deleted file mode 100644 index c57ae13f8..000000000 --- a/crates/bitwarden-api-api/src/models/organization_domain_response_model.rs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationDomainResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "txt", skip_serializing_if = "Option::is_none")] - pub txt: Option, - #[serde(rename = "domainName", skip_serializing_if = "Option::is_none")] - pub domain_name: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "nextRunDate", skip_serializing_if = "Option::is_none")] - pub next_run_date: Option, - #[serde(rename = "jobRunCount", skip_serializing_if = "Option::is_none")] - pub job_run_count: Option, - #[serde(rename = "verifiedDate", skip_serializing_if = "Option::is_none")] - pub verified_date: Option, - #[serde(rename = "lastCheckedDate", skip_serializing_if = "Option::is_none")] - pub last_checked_date: Option, -} - -impl OrganizationDomainResponseModel { - pub fn new() -> OrganizationDomainResponseModel { - OrganizationDomainResponseModel { - object: None, - id: None, - organization_id: None, - txt: None, - domain_name: None, - creation_date: None, - next_run_date: None, - job_run_count: None, - verified_date: None, - last_checked_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_domain_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/organization_domain_response_model_list_response_model.rs deleted file mode 100644 index 72256a83a..000000000 --- a/crates/bitwarden-api-api/src/models/organization_domain_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationDomainResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl OrganizationDomainResponseModelListResponseModel { - pub fn new() -> OrganizationDomainResponseModelListResponseModel { - OrganizationDomainResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_domain_sso_details_request_model.rs b/crates/bitwarden-api-api/src/models/organization_domain_sso_details_request_model.rs deleted file mode 100644 index 211d8cda5..000000000 --- a/crates/bitwarden-api-api/src/models/organization_domain_sso_details_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationDomainSsoDetailsRequestModel { - #[serde(rename = "email")] - pub email: String, -} - -impl OrganizationDomainSsoDetailsRequestModel { - pub fn new(email: String) -> OrganizationDomainSsoDetailsRequestModel { - OrganizationDomainSsoDetailsRequestModel { email } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_domain_sso_details_response_model.rs b/crates/bitwarden-api-api/src/models/organization_domain_sso_details_response_model.rs deleted file mode 100644 index 9e179faaa..000000000 --- a/crates/bitwarden-api-api/src/models/organization_domain_sso_details_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationDomainSsoDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "ssoAvailable", skip_serializing_if = "Option::is_none")] - pub sso_available: Option, - #[serde(rename = "domainName", skip_serializing_if = "Option::is_none")] - pub domain_name: Option, - #[serde( - rename = "organizationIdentifier", - skip_serializing_if = "Option::is_none" - )] - pub organization_identifier: Option, - #[serde(rename = "verifiedDate", skip_serializing_if = "Option::is_none")] - pub verified_date: Option, -} - -impl OrganizationDomainSsoDetailsResponseModel { - pub fn new() -> OrganizationDomainSsoDetailsResponseModel { - OrganizationDomainSsoDetailsResponseModel { - object: None, - sso_available: None, - domain_name: None, - organization_identifier: None, - verified_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_keys_request_model.rs b/crates/bitwarden-api-api/src/models/organization_keys_request_model.rs deleted file mode 100644 index b281941f4..000000000 --- a/crates/bitwarden-api-api/src/models/organization_keys_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationKeysRequestModel { - #[serde(rename = "publicKey")] - pub public_key: String, - #[serde(rename = "encryptedPrivateKey")] - pub encrypted_private_key: String, -} - -impl OrganizationKeysRequestModel { - pub fn new(public_key: String, encrypted_private_key: String) -> OrganizationKeysRequestModel { - OrganizationKeysRequestModel { - public_key, - encrypted_private_key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_keys_response_model.rs b/crates/bitwarden-api-api/src/models/organization_keys_response_model.rs deleted file mode 100644 index c68fe507a..000000000 --- a/crates/bitwarden-api-api/src/models/organization_keys_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationKeysResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, - #[serde(rename = "privateKey", skip_serializing_if = "Option::is_none")] - pub private_key: Option, -} - -impl OrganizationKeysResponseModel { - pub fn new() -> OrganizationKeysResponseModel { - OrganizationKeysResponseModel { - object: None, - public_key: None, - private_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_license.rs b/crates/bitwarden-api-api/src/models/organization_license.rs deleted file mode 100644 index c6b3dd2a1..000000000 --- a/crates/bitwarden-api-api/src/models/organization_license.rs +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationLicense { - #[serde(rename = "licenseKey", skip_serializing_if = "Option::is_none")] - pub license_key: Option, - #[serde(rename = "installationId", skip_serializing_if = "Option::is_none")] - pub installation_id: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "billingEmail", skip_serializing_if = "Option::is_none")] - pub billing_email: Option, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "plan", skip_serializing_if = "Option::is_none")] - pub plan: Option, - #[serde(rename = "planType", skip_serializing_if = "Option::is_none")] - pub plan_type: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "maxCollections", skip_serializing_if = "Option::is_none")] - pub max_collections: Option, - #[serde(rename = "usePolicies", skip_serializing_if = "Option::is_none")] - pub use_policies: Option, - #[serde(rename = "useSso", skip_serializing_if = "Option::is_none")] - pub use_sso: Option, - #[serde(rename = "useKeyConnector", skip_serializing_if = "Option::is_none")] - pub use_key_connector: Option, - #[serde(rename = "useScim", skip_serializing_if = "Option::is_none")] - pub use_scim: Option, - #[serde(rename = "useGroups", skip_serializing_if = "Option::is_none")] - pub use_groups: Option, - #[serde(rename = "useEvents", skip_serializing_if = "Option::is_none")] - pub use_events: Option, - #[serde(rename = "useDirectory", skip_serializing_if = "Option::is_none")] - pub use_directory: Option, - #[serde(rename = "useTotp", skip_serializing_if = "Option::is_none")] - pub use_totp: Option, - #[serde(rename = "use2fa", skip_serializing_if = "Option::is_none")] - pub use2fa: Option, - #[serde(rename = "useApi", skip_serializing_if = "Option::is_none")] - pub use_api: Option, - #[serde(rename = "useResetPassword", skip_serializing_if = "Option::is_none")] - pub use_reset_password: Option, - #[serde(rename = "maxStorageGb", skip_serializing_if = "Option::is_none")] - pub max_storage_gb: Option, - #[serde(rename = "selfHost", skip_serializing_if = "Option::is_none")] - pub self_host: Option, - #[serde(rename = "usersGetPremium", skip_serializing_if = "Option::is_none")] - pub users_get_premium: Option, - #[serde( - rename = "useCustomPermissions", - skip_serializing_if = "Option::is_none" - )] - pub use_custom_permissions: Option, - #[serde(rename = "version", skip_serializing_if = "Option::is_none")] - pub version: Option, - #[serde(rename = "issued", skip_serializing_if = "Option::is_none")] - pub issued: Option, - #[serde(rename = "refresh", skip_serializing_if = "Option::is_none")] - pub refresh: Option, - #[serde(rename = "expires", skip_serializing_if = "Option::is_none")] - pub expires: Option, - #[serde( - rename = "expirationWithoutGracePeriod", - skip_serializing_if = "Option::is_none" - )] - pub expiration_without_grace_period: Option, - #[serde(rename = "usePasswordManager", skip_serializing_if = "Option::is_none")] - pub use_password_manager: Option, - #[serde(rename = "useSecretsManager", skip_serializing_if = "Option::is_none")] - pub use_secrets_manager: Option, - #[serde(rename = "smSeats", skip_serializing_if = "Option::is_none")] - pub sm_seats: Option, - #[serde(rename = "smServiceAccounts", skip_serializing_if = "Option::is_none")] - pub sm_service_accounts: Option, - #[serde( - rename = "limitCollectionCreationDeletion", - skip_serializing_if = "Option::is_none" - )] - pub limit_collection_creation_deletion: Option, - #[serde( - rename = "allowAdminAccessToAllCollectionItems", - skip_serializing_if = "Option::is_none" - )] - pub allow_admin_access_to_all_collection_items: Option, - #[serde(rename = "trial", skip_serializing_if = "Option::is_none")] - pub trial: Option, - #[serde(rename = "licenseType", skip_serializing_if = "Option::is_none")] - pub license_type: Option, - #[serde(rename = "hash", skip_serializing_if = "Option::is_none")] - pub hash: Option, - #[serde(rename = "signature", skip_serializing_if = "Option::is_none")] - pub signature: Option, -} - -impl OrganizationLicense { - pub fn new() -> OrganizationLicense { - OrganizationLicense { - license_key: None, - installation_id: None, - id: None, - name: None, - billing_email: None, - business_name: None, - enabled: None, - plan: None, - plan_type: None, - seats: None, - max_collections: None, - use_policies: None, - use_sso: None, - use_key_connector: None, - use_scim: None, - use_groups: None, - use_events: None, - use_directory: None, - use_totp: None, - use2fa: None, - use_api: None, - use_reset_password: None, - max_storage_gb: None, - self_host: None, - users_get_premium: None, - use_custom_permissions: None, - version: None, - issued: None, - refresh: None, - expires: None, - expiration_without_grace_period: None, - use_password_manager: None, - use_secrets_manager: None, - sm_seats: None, - sm_service_accounts: None, - limit_collection_creation_deletion: None, - allow_admin_access_to_all_collection_items: None, - trial: None, - license_type: None, - hash: None, - signature: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_public_key_response_model.rs b/crates/bitwarden-api-api/src/models/organization_public_key_response_model.rs deleted file mode 100644 index bdf397126..000000000 --- a/crates/bitwarden-api-api/src/models/organization_public_key_response_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationPublicKeyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, -} - -impl OrganizationPublicKeyResponseModel { - pub fn new() -> OrganizationPublicKeyResponseModel { - OrganizationPublicKeyResponseModel { - object: None, - public_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_response_model.rs b/crates/bitwarden-api-api/src/models/organization_response_model.rs deleted file mode 100644 index 31aed69c4..000000000 --- a/crates/bitwarden-api-api/src/models/organization_response_model.rs +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "businessAddress1", skip_serializing_if = "Option::is_none")] - pub business_address1: Option, - #[serde(rename = "businessAddress2", skip_serializing_if = "Option::is_none")] - pub business_address2: Option, - #[serde(rename = "businessAddress3", skip_serializing_if = "Option::is_none")] - pub business_address3: Option, - #[serde(rename = "businessCountry", skip_serializing_if = "Option::is_none")] - pub business_country: Option, - #[serde(rename = "businessTaxNumber", skip_serializing_if = "Option::is_none")] - pub business_tax_number: Option, - #[serde(rename = "billingEmail", skip_serializing_if = "Option::is_none")] - pub billing_email: Option, - #[serde(rename = "plan", skip_serializing_if = "Option::is_none")] - pub plan: Option>, - #[serde(rename = "secretsManagerPlan", skip_serializing_if = "Option::is_none")] - pub secrets_manager_plan: Option>, - #[serde(rename = "planType", skip_serializing_if = "Option::is_none")] - pub plan_type: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "maxAutoscaleSeats", skip_serializing_if = "Option::is_none")] - pub max_autoscale_seats: Option, - #[serde(rename = "maxCollections", skip_serializing_if = "Option::is_none")] - pub max_collections: Option, - #[serde(rename = "maxStorageGb", skip_serializing_if = "Option::is_none")] - pub max_storage_gb: Option, - #[serde(rename = "usePolicies", skip_serializing_if = "Option::is_none")] - pub use_policies: Option, - #[serde(rename = "useSso", skip_serializing_if = "Option::is_none")] - pub use_sso: Option, - #[serde(rename = "useKeyConnector", skip_serializing_if = "Option::is_none")] - pub use_key_connector: Option, - #[serde(rename = "useScim", skip_serializing_if = "Option::is_none")] - pub use_scim: Option, - #[serde(rename = "useGroups", skip_serializing_if = "Option::is_none")] - pub use_groups: Option, - #[serde(rename = "useDirectory", skip_serializing_if = "Option::is_none")] - pub use_directory: Option, - #[serde(rename = "useEvents", skip_serializing_if = "Option::is_none")] - pub use_events: Option, - #[serde(rename = "useTotp", skip_serializing_if = "Option::is_none")] - pub use_totp: Option, - #[serde(rename = "use2fa", skip_serializing_if = "Option::is_none")] - pub use2fa: Option, - #[serde(rename = "useApi", skip_serializing_if = "Option::is_none")] - pub use_api: Option, - #[serde(rename = "useSecretsManager", skip_serializing_if = "Option::is_none")] - pub use_secrets_manager: Option, - #[serde(rename = "useResetPassword", skip_serializing_if = "Option::is_none")] - pub use_reset_password: Option, - #[serde(rename = "usersGetPremium", skip_serializing_if = "Option::is_none")] - pub users_get_premium: Option, - #[serde( - rename = "useCustomPermissions", - skip_serializing_if = "Option::is_none" - )] - pub use_custom_permissions: Option, - #[serde(rename = "selfHost", skip_serializing_if = "Option::is_none")] - pub self_host: Option, - #[serde( - rename = "hasPublicAndPrivateKeys", - skip_serializing_if = "Option::is_none" - )] - pub has_public_and_private_keys: Option, - #[serde(rename = "usePasswordManager", skip_serializing_if = "Option::is_none")] - pub use_password_manager: Option, - #[serde(rename = "smSeats", skip_serializing_if = "Option::is_none")] - pub sm_seats: Option, - #[serde(rename = "smServiceAccounts", skip_serializing_if = "Option::is_none")] - pub sm_service_accounts: Option, - #[serde( - rename = "maxAutoscaleSmSeats", - skip_serializing_if = "Option::is_none" - )] - pub max_autoscale_sm_seats: Option, - #[serde( - rename = "maxAutoscaleSmServiceAccounts", - skip_serializing_if = "Option::is_none" - )] - pub max_autoscale_sm_service_accounts: Option, - #[serde( - rename = "limitCollectionCreationDeletion", - skip_serializing_if = "Option::is_none" - )] - pub limit_collection_creation_deletion: Option, - #[serde( - rename = "allowAdminAccessToAllCollectionItems", - skip_serializing_if = "Option::is_none" - )] - pub allow_admin_access_to_all_collection_items: Option, -} - -impl OrganizationResponseModel { - pub fn new() -> OrganizationResponseModel { - OrganizationResponseModel { - object: None, - id: None, - name: None, - business_name: None, - business_address1: None, - business_address2: None, - business_address3: None, - business_country: None, - business_tax_number: None, - billing_email: None, - plan: None, - secrets_manager_plan: None, - plan_type: None, - seats: None, - max_autoscale_seats: None, - max_collections: None, - max_storage_gb: None, - use_policies: None, - use_sso: None, - use_key_connector: None, - use_scim: None, - use_groups: None, - use_directory: None, - use_events: None, - use_totp: None, - use2fa: None, - use_api: None, - use_secrets_manager: None, - use_reset_password: None, - users_get_premium: None, - use_custom_permissions: None, - self_host: None, - has_public_and_private_keys: None, - use_password_manager: None, - sm_seats: None, - sm_service_accounts: None, - max_autoscale_sm_seats: None, - max_autoscale_sm_service_accounts: None, - limit_collection_creation_deletion: None, - allow_admin_access_to_all_collection_items: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_seat_request_model.rs b/crates/bitwarden-api-api/src/models/organization_seat_request_model.rs deleted file mode 100644 index 79ff1721e..000000000 --- a/crates/bitwarden-api-api/src/models/organization_seat_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSeatRequestModel { - #[serde(rename = "seatAdjustment")] - pub seat_adjustment: i32, -} - -impl OrganizationSeatRequestModel { - pub fn new(seat_adjustment: i32) -> OrganizationSeatRequestModel { - OrganizationSeatRequestModel { seat_adjustment } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sponsorship_create_request_model.rs b/crates/bitwarden-api-api/src/models/organization_sponsorship_create_request_model.rs deleted file mode 100644 index e71186969..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sponsorship_create_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSponsorshipCreateRequestModel { - #[serde(rename = "planSponsorshipType")] - pub plan_sponsorship_type: models::PlanSponsorshipType, - #[serde(rename = "sponsoredEmail")] - pub sponsored_email: String, - #[serde(rename = "friendlyName", skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, -} - -impl OrganizationSponsorshipCreateRequestModel { - pub fn new( - plan_sponsorship_type: models::PlanSponsorshipType, - sponsored_email: String, - ) -> OrganizationSponsorshipCreateRequestModel { - OrganizationSponsorshipCreateRequestModel { - plan_sponsorship_type, - sponsored_email, - friendly_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sponsorship_redeem_request_model.rs b/crates/bitwarden-api-api/src/models/organization_sponsorship_redeem_request_model.rs deleted file mode 100644 index 9e559177d..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sponsorship_redeem_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSponsorshipRedeemRequestModel { - #[serde(rename = "planSponsorshipType")] - pub plan_sponsorship_type: models::PlanSponsorshipType, - #[serde(rename = "sponsoredOrganizationId")] - pub sponsored_organization_id: uuid::Uuid, -} - -impl OrganizationSponsorshipRedeemRequestModel { - pub fn new( - plan_sponsorship_type: models::PlanSponsorshipType, - sponsored_organization_id: uuid::Uuid, - ) -> OrganizationSponsorshipRedeemRequestModel { - OrganizationSponsorshipRedeemRequestModel { - plan_sponsorship_type, - sponsored_organization_id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sponsorship_request_model.rs b/crates/bitwarden-api-api/src/models/organization_sponsorship_request_model.rs deleted file mode 100644 index cc8117fd3..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sponsorship_request_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSponsorshipRequestModel { - #[serde( - rename = "sponsoringOrganizationUserId", - skip_serializing_if = "Option::is_none" - )] - pub sponsoring_organization_user_id: Option, - #[serde(rename = "friendlyName", skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "offeredToEmail", skip_serializing_if = "Option::is_none")] - pub offered_to_email: Option, - #[serde( - rename = "planSponsorshipType", - skip_serializing_if = "Option::is_none" - )] - pub plan_sponsorship_type: Option, - #[serde(rename = "lastSyncDate", skip_serializing_if = "Option::is_none")] - pub last_sync_date: Option, - #[serde(rename = "validUntil", skip_serializing_if = "Option::is_none")] - pub valid_until: Option, - #[serde(rename = "toDelete", skip_serializing_if = "Option::is_none")] - pub to_delete: Option, -} - -impl OrganizationSponsorshipRequestModel { - pub fn new() -> OrganizationSponsorshipRequestModel { - OrganizationSponsorshipRequestModel { - sponsoring_organization_user_id: None, - friendly_name: None, - offered_to_email: None, - plan_sponsorship_type: None, - last_sync_date: None, - valid_until: None, - to_delete: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sponsorship_response_model.rs b/crates/bitwarden-api-api/src/models/organization_sponsorship_response_model.rs deleted file mode 100644 index bfc44e52e..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sponsorship_response_model.rs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSponsorshipResponseModel { - #[serde( - rename = "sponsoringOrganizationUserId", - skip_serializing_if = "Option::is_none" - )] - pub sponsoring_organization_user_id: Option, - #[serde(rename = "friendlyName", skip_serializing_if = "Option::is_none")] - pub friendly_name: Option, - #[serde(rename = "offeredToEmail", skip_serializing_if = "Option::is_none")] - pub offered_to_email: Option, - #[serde( - rename = "planSponsorshipType", - skip_serializing_if = "Option::is_none" - )] - pub plan_sponsorship_type: Option, - #[serde(rename = "lastSyncDate", skip_serializing_if = "Option::is_none")] - pub last_sync_date: Option, - #[serde(rename = "validUntil", skip_serializing_if = "Option::is_none")] - pub valid_until: Option, - #[serde(rename = "toDelete", skip_serializing_if = "Option::is_none")] - pub to_delete: Option, - #[serde( - rename = "cloudSponsorshipRemoved", - skip_serializing_if = "Option::is_none" - )] - pub cloud_sponsorship_removed: Option, -} - -impl OrganizationSponsorshipResponseModel { - pub fn new() -> OrganizationSponsorshipResponseModel { - OrganizationSponsorshipResponseModel { - sponsoring_organization_user_id: None, - friendly_name: None, - offered_to_email: None, - plan_sponsorship_type: None, - last_sync_date: None, - valid_until: None, - to_delete: None, - cloud_sponsorship_removed: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sponsorship_sync_request_model.rs b/crates/bitwarden-api-api/src/models/organization_sponsorship_sync_request_model.rs deleted file mode 100644 index f1480a8d5..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sponsorship_sync_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSponsorshipSyncRequestModel { - #[serde(rename = "billingSyncKey", skip_serializing_if = "Option::is_none")] - pub billing_sync_key: Option, - #[serde( - rename = "sponsoringOrganizationCloudId", - skip_serializing_if = "Option::is_none" - )] - pub sponsoring_organization_cloud_id: Option, - #[serde(rename = "sponsorshipsBatch", skip_serializing_if = "Option::is_none")] - pub sponsorships_batch: Option>, -} - -impl OrganizationSponsorshipSyncRequestModel { - pub fn new() -> OrganizationSponsorshipSyncRequestModel { - OrganizationSponsorshipSyncRequestModel { - billing_sync_key: None, - sponsoring_organization_cloud_id: None, - sponsorships_batch: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sponsorship_sync_response_model.rs b/crates/bitwarden-api-api/src/models/organization_sponsorship_sync_response_model.rs deleted file mode 100644 index f4af518a3..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sponsorship_sync_response_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSponsorshipSyncResponseModel { - #[serde(rename = "sponsorshipsBatch", skip_serializing_if = "Option::is_none")] - pub sponsorships_batch: Option>, -} - -impl OrganizationSponsorshipSyncResponseModel { - pub fn new() -> OrganizationSponsorshipSyncResponseModel { - OrganizationSponsorshipSyncResponseModel { - sponsorships_batch: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sso_request_model.rs b/crates/bitwarden-api-api/src/models/organization_sso_request_model.rs deleted file mode 100644 index 249bb6a33..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sso_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSsoRequestModel { - #[serde(rename = "enabled")] - pub enabled: bool, - #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")] - pub identifier: Option, - #[serde(rename = "data")] - pub data: Box, -} - -impl OrganizationSsoRequestModel { - pub fn new( - enabled: bool, - data: models::SsoConfigurationDataRequest, - ) -> OrganizationSsoRequestModel { - OrganizationSsoRequestModel { - enabled, - identifier: None, - data: Box::new(data), - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_sso_response_model.rs b/crates/bitwarden-api-api/src/models/organization_sso_response_model.rs deleted file mode 100644 index 73eca734d..000000000 --- a/crates/bitwarden-api-api/src/models/organization_sso_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSsoResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")] - pub identifier: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "urls", skip_serializing_if = "Option::is_none")] - pub urls: Option>, -} - -impl OrganizationSsoResponseModel { - pub fn new() -> OrganizationSsoResponseModel { - OrganizationSsoResponseModel { - object: None, - enabled: None, - identifier: None, - data: None, - urls: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_subscription_response_model.rs b/crates/bitwarden-api-api/src/models/organization_subscription_response_model.rs deleted file mode 100644 index b2c3acb0a..000000000 --- a/crates/bitwarden-api-api/src/models/organization_subscription_response_model.rs +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSubscriptionResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "businessAddress1", skip_serializing_if = "Option::is_none")] - pub business_address1: Option, - #[serde(rename = "businessAddress2", skip_serializing_if = "Option::is_none")] - pub business_address2: Option, - #[serde(rename = "businessAddress3", skip_serializing_if = "Option::is_none")] - pub business_address3: Option, - #[serde(rename = "businessCountry", skip_serializing_if = "Option::is_none")] - pub business_country: Option, - #[serde(rename = "businessTaxNumber", skip_serializing_if = "Option::is_none")] - pub business_tax_number: Option, - #[serde(rename = "billingEmail", skip_serializing_if = "Option::is_none")] - pub billing_email: Option, - #[serde(rename = "plan", skip_serializing_if = "Option::is_none")] - pub plan: Option>, - #[serde(rename = "secretsManagerPlan", skip_serializing_if = "Option::is_none")] - pub secrets_manager_plan: Option>, - #[serde(rename = "planType", skip_serializing_if = "Option::is_none")] - pub plan_type: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "maxAutoscaleSeats", skip_serializing_if = "Option::is_none")] - pub max_autoscale_seats: Option, - #[serde(rename = "maxCollections", skip_serializing_if = "Option::is_none")] - pub max_collections: Option, - #[serde(rename = "maxStorageGb", skip_serializing_if = "Option::is_none")] - pub max_storage_gb: Option, - #[serde(rename = "usePolicies", skip_serializing_if = "Option::is_none")] - pub use_policies: Option, - #[serde(rename = "useSso", skip_serializing_if = "Option::is_none")] - pub use_sso: Option, - #[serde(rename = "useKeyConnector", skip_serializing_if = "Option::is_none")] - pub use_key_connector: Option, - #[serde(rename = "useScim", skip_serializing_if = "Option::is_none")] - pub use_scim: Option, - #[serde(rename = "useGroups", skip_serializing_if = "Option::is_none")] - pub use_groups: Option, - #[serde(rename = "useDirectory", skip_serializing_if = "Option::is_none")] - pub use_directory: Option, - #[serde(rename = "useEvents", skip_serializing_if = "Option::is_none")] - pub use_events: Option, - #[serde(rename = "useTotp", skip_serializing_if = "Option::is_none")] - pub use_totp: Option, - #[serde(rename = "use2fa", skip_serializing_if = "Option::is_none")] - pub use2fa: Option, - #[serde(rename = "useApi", skip_serializing_if = "Option::is_none")] - pub use_api: Option, - #[serde(rename = "useSecretsManager", skip_serializing_if = "Option::is_none")] - pub use_secrets_manager: Option, - #[serde(rename = "useResetPassword", skip_serializing_if = "Option::is_none")] - pub use_reset_password: Option, - #[serde(rename = "usersGetPremium", skip_serializing_if = "Option::is_none")] - pub users_get_premium: Option, - #[serde( - rename = "useCustomPermissions", - skip_serializing_if = "Option::is_none" - )] - pub use_custom_permissions: Option, - #[serde(rename = "selfHost", skip_serializing_if = "Option::is_none")] - pub self_host: Option, - #[serde( - rename = "hasPublicAndPrivateKeys", - skip_serializing_if = "Option::is_none" - )] - pub has_public_and_private_keys: Option, - #[serde(rename = "usePasswordManager", skip_serializing_if = "Option::is_none")] - pub use_password_manager: Option, - #[serde(rename = "smSeats", skip_serializing_if = "Option::is_none")] - pub sm_seats: Option, - #[serde(rename = "smServiceAccounts", skip_serializing_if = "Option::is_none")] - pub sm_service_accounts: Option, - #[serde( - rename = "maxAutoscaleSmSeats", - skip_serializing_if = "Option::is_none" - )] - pub max_autoscale_sm_seats: Option, - #[serde( - rename = "maxAutoscaleSmServiceAccounts", - skip_serializing_if = "Option::is_none" - )] - pub max_autoscale_sm_service_accounts: Option, - #[serde( - rename = "limitCollectionCreationDeletion", - skip_serializing_if = "Option::is_none" - )] - pub limit_collection_creation_deletion: Option, - #[serde( - rename = "allowAdminAccessToAllCollectionItems", - skip_serializing_if = "Option::is_none" - )] - pub allow_admin_access_to_all_collection_items: Option, - #[serde(rename = "storageName", skip_serializing_if = "Option::is_none")] - pub storage_name: Option, - #[serde(rename = "storageGb", skip_serializing_if = "Option::is_none")] - pub storage_gb: Option, - #[serde(rename = "customerDiscount", skip_serializing_if = "Option::is_none")] - pub customer_discount: Option>, - #[serde(rename = "subscription", skip_serializing_if = "Option::is_none")] - pub subscription: Option>, - #[serde(rename = "upcomingInvoice", skip_serializing_if = "Option::is_none")] - pub upcoming_invoice: Option>, - /// Date when a self-hosted organization's subscription expires, without any grace period. - #[serde( - rename = "expirationWithoutGracePeriod", - skip_serializing_if = "Option::is_none" - )] - pub expiration_without_grace_period: Option, - /// Date when a self-hosted organization expires (includes grace period). - #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")] - pub expiration: Option, -} - -impl OrganizationSubscriptionResponseModel { - pub fn new() -> OrganizationSubscriptionResponseModel { - OrganizationSubscriptionResponseModel { - object: None, - id: None, - name: None, - business_name: None, - business_address1: None, - business_address2: None, - business_address3: None, - business_country: None, - business_tax_number: None, - billing_email: None, - plan: None, - secrets_manager_plan: None, - plan_type: None, - seats: None, - max_autoscale_seats: None, - max_collections: None, - max_storage_gb: None, - use_policies: None, - use_sso: None, - use_key_connector: None, - use_scim: None, - use_groups: None, - use_directory: None, - use_events: None, - use_totp: None, - use2fa: None, - use_api: None, - use_secrets_manager: None, - use_reset_password: None, - users_get_premium: None, - use_custom_permissions: None, - self_host: None, - has_public_and_private_keys: None, - use_password_manager: None, - sm_seats: None, - sm_service_accounts: None, - max_autoscale_sm_seats: None, - max_autoscale_sm_service_accounts: None, - limit_collection_creation_deletion: None, - allow_admin_access_to_all_collection_items: None, - storage_name: None, - storage_gb: None, - customer_discount: None, - subscription: None, - upcoming_invoice: None, - expiration_without_grace_period: None, - expiration: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_subscription_update_request_model.rs b/crates/bitwarden-api-api/src/models/organization_subscription_update_request_model.rs deleted file mode 100644 index 59dcbd31a..000000000 --- a/crates/bitwarden-api-api/src/models/organization_subscription_update_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationSubscriptionUpdateRequestModel { - #[serde(rename = "seatAdjustment")] - pub seat_adjustment: i32, - #[serde(rename = "maxAutoscaleSeats", skip_serializing_if = "Option::is_none")] - pub max_autoscale_seats: Option, -} - -impl OrganizationSubscriptionUpdateRequestModel { - pub fn new(seat_adjustment: i32) -> OrganizationSubscriptionUpdateRequestModel { - OrganizationSubscriptionUpdateRequestModel { - seat_adjustment, - max_autoscale_seats: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_update_request_model.rs b/crates/bitwarden-api-api/src/models/organization_update_request_model.rs deleted file mode 100644 index f70b44669..000000000 --- a/crates/bitwarden-api-api/src/models/organization_update_request_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUpdateRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "billingEmail")] - pub billing_email: String, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde(rename = "keys", skip_serializing_if = "Option::is_none")] - pub keys: Option>, -} - -impl OrganizationUpdateRequestModel { - pub fn new(name: String, billing_email: String) -> OrganizationUpdateRequestModel { - OrganizationUpdateRequestModel { - name, - business_name: None, - billing_email, - permissions: None, - keys: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_upgrade_request_model.rs b/crates/bitwarden-api-api/src/models/organization_upgrade_request_model.rs deleted file mode 100644 index 7a9375d7e..000000000 --- a/crates/bitwarden-api-api/src/models/organization_upgrade_request_model.rs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUpgradeRequestModel { - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "planType", skip_serializing_if = "Option::is_none")] - pub plan_type: Option, - #[serde(rename = "additionalSeats", skip_serializing_if = "Option::is_none")] - pub additional_seats: Option, - #[serde( - rename = "additionalStorageGb", - skip_serializing_if = "Option::is_none" - )] - pub additional_storage_gb: Option, - #[serde(rename = "additionalSmSeats", skip_serializing_if = "Option::is_none")] - pub additional_sm_seats: Option, - #[serde( - rename = "additionalServiceAccounts", - skip_serializing_if = "Option::is_none" - )] - pub additional_service_accounts: Option, - #[serde(rename = "useSecretsManager")] - pub use_secrets_manager: bool, - #[serde(rename = "premiumAccessAddon", skip_serializing_if = "Option::is_none")] - pub premium_access_addon: Option, - #[serde( - rename = "billingAddressCountry", - skip_serializing_if = "Option::is_none" - )] - pub billing_address_country: Option, - #[serde( - rename = "billingAddressPostalCode", - skip_serializing_if = "Option::is_none" - )] - pub billing_address_postal_code: Option, - #[serde(rename = "keys", skip_serializing_if = "Option::is_none")] - pub keys: Option>, -} - -impl OrganizationUpgradeRequestModel { - pub fn new(use_secrets_manager: bool) -> OrganizationUpgradeRequestModel { - OrganizationUpgradeRequestModel { - business_name: None, - plan_type: None, - additional_seats: None, - additional_storage_gb: None, - additional_sm_seats: None, - additional_service_accounts: None, - use_secrets_manager, - premium_access_addon: None, - billing_address_country: None, - billing_address_postal_code: None, - keys: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_accept_init_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_accept_init_request_model.rs deleted file mode 100644 index ca714ca20..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_accept_init_request_model.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserAcceptInitRequestModel { - #[serde(rename = "token")] - pub token: String, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "keys")] - pub keys: Box, - #[serde(rename = "collectionName", skip_serializing_if = "Option::is_none")] - pub collection_name: Option, -} - -impl OrganizationUserAcceptInitRequestModel { - pub fn new( - token: String, - key: String, - keys: models::OrganizationKeysRequestModel, - ) -> OrganizationUserAcceptInitRequestModel { - OrganizationUserAcceptInitRequestModel { - token, - key, - keys: Box::new(keys), - collection_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_accept_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_accept_request_model.rs deleted file mode 100644 index 7d6c40e39..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_accept_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserAcceptRequestModel { - #[serde(rename = "token")] - pub token: String, - #[serde(rename = "resetPasswordKey", skip_serializing_if = "Option::is_none")] - pub reset_password_key: Option, -} - -impl OrganizationUserAcceptRequestModel { - pub fn new(token: String) -> OrganizationUserAcceptRequestModel { - OrganizationUserAcceptRequestModel { - token, - reset_password_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model.rs deleted file mode 100644 index 7b0383cb8..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserBulkConfirmRequestModel { - #[serde(rename = "keys")] - pub keys: Vec, -} - -impl OrganizationUserBulkConfirmRequestModel { - pub fn new( - keys: Vec, - ) -> OrganizationUserBulkConfirmRequestModel { - OrganizationUserBulkConfirmRequestModel { keys } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model_entry.rs b/crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model_entry.rs deleted file mode 100644 index f51d4ad33..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_bulk_confirm_request_model_entry.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserBulkConfirmRequestModelEntry { - #[serde(rename = "id")] - pub id: uuid::Uuid, - #[serde(rename = "key")] - pub key: String, -} - -impl OrganizationUserBulkConfirmRequestModelEntry { - pub fn new(id: uuid::Uuid, key: String) -> OrganizationUserBulkConfirmRequestModelEntry { - OrganizationUserBulkConfirmRequestModelEntry { id, key } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_bulk_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_bulk_request_model.rs deleted file mode 100644 index a6c6cef0f..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_bulk_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserBulkRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, -} - -impl OrganizationUserBulkRequestModel { - pub fn new(ids: Vec) -> OrganizationUserBulkRequestModel { - OrganizationUserBulkRequestModel { ids } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_bulk_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_bulk_response_model.rs deleted file mode 100644 index 4967c7820..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_bulk_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserBulkResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "error", skip_serializing_if = "Option::is_none")] - pub error: Option, -} - -impl OrganizationUserBulkResponseModel { - pub fn new() -> OrganizationUserBulkResponseModel { - OrganizationUserBulkResponseModel { - object: None, - id: None, - error: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_bulk_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_bulk_response_model_list_response_model.rs deleted file mode 100644 index d80d79b7d..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_bulk_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserBulkResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl OrganizationUserBulkResponseModelListResponseModel { - pub fn new() -> OrganizationUserBulkResponseModelListResponseModel { - OrganizationUserBulkResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_confirm_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_confirm_request_model.rs deleted file mode 100644 index de5a469b8..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_confirm_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserConfirmRequestModel { - #[serde(rename = "key")] - pub key: String, -} - -impl OrganizationUserConfirmRequestModel { - pub fn new(key: String) -> OrganizationUserConfirmRequestModel { - OrganizationUserConfirmRequestModel { key } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_details_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_details_response_model.rs deleted file mode 100644 index b9ea3c152..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_details_response_model.rs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde( - rename = "accessSecretsManager", - skip_serializing_if = "Option::is_none" - )] - pub access_secrets_manager: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde( - rename = "resetPasswordEnrolled", - skip_serializing_if = "Option::is_none" - )] - pub reset_password_enrolled: Option, - #[serde(rename = "usesKeyConnector", skip_serializing_if = "Option::is_none")] - pub uses_key_connector: Option, - #[serde(rename = "hasMasterPassword", skip_serializing_if = "Option::is_none")] - pub has_master_password: Option, - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, -} - -impl OrganizationUserDetailsResponseModel { - pub fn new() -> OrganizationUserDetailsResponseModel { - OrganizationUserDetailsResponseModel { - object: None, - id: None, - user_id: None, - r#type: None, - status: None, - external_id: None, - access_secrets_manager: None, - permissions: None, - reset_password_enrolled: None, - uses_key_connector: None, - has_master_password: None, - collections: None, - groups: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_invite_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_invite_request_model.rs deleted file mode 100644 index 0a6f2d4c7..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_invite_request_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserInviteRequestModel { - #[serde(rename = "emails")] - pub emails: Vec, - #[serde(rename = "type")] - pub r#type: models::OrganizationUserType, - #[serde( - rename = "accessSecretsManager", - skip_serializing_if = "Option::is_none" - )] - pub access_secrets_manager: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, -} - -impl OrganizationUserInviteRequestModel { - pub fn new( - emails: Vec, - r#type: models::OrganizationUserType, - ) -> OrganizationUserInviteRequestModel { - OrganizationUserInviteRequestModel { - emails, - r#type, - access_secrets_manager: None, - permissions: None, - collections: None, - groups: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_public_key_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_public_key_response_model.rs deleted file mode 100644 index 4e444cfbc..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_public_key_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserPublicKeyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, -} - -impl OrganizationUserPublicKeyResponseModel { - pub fn new() -> OrganizationUserPublicKeyResponseModel { - OrganizationUserPublicKeyResponseModel { - object: None, - id: None, - user_id: None, - key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_public_key_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_public_key_response_model_list_response_model.rs deleted file mode 100644 index f9c6f3965..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_public_key_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserPublicKeyResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl OrganizationUserPublicKeyResponseModelListResponseModel { - pub fn new() -> OrganizationUserPublicKeyResponseModelListResponseModel { - OrganizationUserPublicKeyResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model.rs deleted file mode 100644 index 1dabdd642..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserResetPasswordDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde(rename = "kdf", skip_serializing_if = "Option::is_none")] - pub kdf: Option, - #[serde(rename = "kdfIterations", skip_serializing_if = "Option::is_none")] - pub kdf_iterations: Option, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, - #[serde(rename = "resetPasswordKey", skip_serializing_if = "Option::is_none")] - pub reset_password_key: Option, - #[serde( - rename = "encryptedPrivateKey", - skip_serializing_if = "Option::is_none" - )] - pub encrypted_private_key: Option, -} - -impl OrganizationUserResetPasswordDetailsResponseModel { - pub fn new() -> OrganizationUserResetPasswordDetailsResponseModel { - OrganizationUserResetPasswordDetailsResponseModel { - object: None, - organization_user_id: None, - kdf: None, - kdf_iterations: None, - kdf_memory: None, - kdf_parallelism: None, - reset_password_key: None, - encrypted_private_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model_list_response_model.rs deleted file mode 100644 index 600973567..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_reset_password_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserResetPasswordDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl OrganizationUserResetPasswordDetailsResponseModelListResponseModel { - pub fn new() -> OrganizationUserResetPasswordDetailsResponseModelListResponseModel { - OrganizationUserResetPasswordDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_reset_password_enrollment_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_reset_password_enrollment_request_model.rs deleted file mode 100644 index a61256ca3..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_reset_password_enrollment_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserResetPasswordEnrollmentRequestModel { - #[serde(rename = "resetPasswordKey", skip_serializing_if = "Option::is_none")] - pub reset_password_key: Option, - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, -} - -impl OrganizationUserResetPasswordEnrollmentRequestModel { - pub fn new() -> OrganizationUserResetPasswordEnrollmentRequestModel { - OrganizationUserResetPasswordEnrollmentRequestModel { - reset_password_key: None, - master_password_hash: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_reset_password_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_reset_password_request_model.rs deleted file mode 100644 index a7ffa611e..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_reset_password_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserResetPasswordRequestModel { - #[serde(rename = "newMasterPasswordHash")] - pub new_master_password_hash: String, - #[serde(rename = "key")] - pub key: String, -} - -impl OrganizationUserResetPasswordRequestModel { - pub fn new( - new_master_password_hash: String, - key: String, - ) -> OrganizationUserResetPasswordRequestModel { - OrganizationUserResetPasswordRequestModel { - new_master_password_hash, - key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_status_type.rs b/crates/bitwarden-api-api/src/models/organization_user_status_type.rs deleted file mode 100644 index 5b2aa15b0..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_status_type.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum OrganizationUserStatusType { - Invited = 0, - Accepted = 1, - Confirmed = 2, - Revoked = -1, -} - -impl std::fmt::Display for OrganizationUserStatusType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Invited => write!(f, "0"), - Self::Accepted => write!(f, "1"), - Self::Confirmed => write!(f, "2"), - Self::Revoked => write!(f, "-1"), - } - } -} - -impl Default for OrganizationUserStatusType { - fn default() -> OrganizationUserStatusType { - Self::Invited - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_type.rs b/crates/bitwarden-api-api/src/models/organization_user_type.rs deleted file mode 100644 index cf79c2a38..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_type.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum OrganizationUserType { - Owner = 0, - Admin = 1, - User = 2, - Custom = 4, -} - -impl std::fmt::Display for OrganizationUserType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Owner => write!(f, "0"), - Self::Admin => write!(f, "1"), - Self::User => write!(f, "2"), - Self::Custom => write!(f, "4"), - } - } -} - -impl Default for OrganizationUserType { - fn default() -> OrganizationUserType { - Self::Owner - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_update_request_model.rs b/crates/bitwarden-api-api/src/models/organization_user_update_request_model.rs deleted file mode 100644 index 983177357..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_update_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserUpdateRequestModel { - #[serde(rename = "type")] - pub r#type: models::OrganizationUserType, - #[serde( - rename = "accessSecretsManager", - skip_serializing_if = "Option::is_none" - )] - pub access_secrets_manager: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, -} - -impl OrganizationUserUpdateRequestModel { - pub fn new(r#type: models::OrganizationUserType) -> OrganizationUserUpdateRequestModel { - OrganizationUserUpdateRequestModel { - r#type, - access_secrets_manager: None, - permissions: None, - collections: None, - groups: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_user_details_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_user_details_response_model.rs deleted file mode 100644 index 37b04edde..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_user_details_response_model.rs +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserUserDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "externalId", skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde( - rename = "accessSecretsManager", - skip_serializing_if = "Option::is_none" - )] - pub access_secrets_manager: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde( - rename = "resetPasswordEnrolled", - skip_serializing_if = "Option::is_none" - )] - pub reset_password_enrolled: Option, - #[serde(rename = "usesKeyConnector", skip_serializing_if = "Option::is_none")] - pub uses_key_connector: Option, - #[serde(rename = "hasMasterPassword", skip_serializing_if = "Option::is_none")] - pub has_master_password: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "avatarColor", skip_serializing_if = "Option::is_none")] - pub avatar_color: Option, - #[serde(rename = "twoFactorEnabled", skip_serializing_if = "Option::is_none")] - pub two_factor_enabled: Option, - #[serde(rename = "ssoBound", skip_serializing_if = "Option::is_none")] - pub sso_bound: Option, - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, - #[serde(rename = "groups", skip_serializing_if = "Option::is_none")] - pub groups: Option>, -} - -impl OrganizationUserUserDetailsResponseModel { - pub fn new() -> OrganizationUserUserDetailsResponseModel { - OrganizationUserUserDetailsResponseModel { - object: None, - id: None, - user_id: None, - r#type: None, - status: None, - external_id: None, - access_secrets_manager: None, - permissions: None, - reset_password_enrolled: None, - uses_key_connector: None, - has_master_password: None, - name: None, - email: None, - avatar_color: None, - two_factor_enabled: None, - sso_bound: None, - collections: None, - groups: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_user_user_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/organization_user_user_details_response_model_list_response_model.rs deleted file mode 100644 index 33b43f815..000000000 --- a/crates/bitwarden-api-api/src/models/organization_user_user_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationUserUserDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl OrganizationUserUserDetailsResponseModelListResponseModel { - pub fn new() -> OrganizationUserUserDetailsResponseModelListResponseModel { - OrganizationUserUserDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_verify_bank_request_model.rs b/crates/bitwarden-api-api/src/models/organization_verify_bank_request_model.rs deleted file mode 100644 index 58515ccc5..000000000 --- a/crates/bitwarden-api-api/src/models/organization_verify_bank_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationVerifyBankRequestModel { - #[serde(rename = "amount1")] - pub amount1: i32, - #[serde(rename = "amount2")] - pub amount2: i32, -} - -impl OrganizationVerifyBankRequestModel { - pub fn new(amount1: i32, amount2: i32) -> OrganizationVerifyBankRequestModel { - OrganizationVerifyBankRequestModel { amount1, amount2 } - } -} diff --git a/crates/bitwarden-api-api/src/models/organization_verify_delete_recover_request_model.rs b/crates/bitwarden-api-api/src/models/organization_verify_delete_recover_request_model.rs deleted file mode 100644 index 19db9826a..000000000 --- a/crates/bitwarden-api-api/src/models/organization_verify_delete_recover_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OrganizationVerifyDeleteRecoverRequestModel { - #[serde(rename = "token")] - pub token: String, -} - -impl OrganizationVerifyDeleteRecoverRequestModel { - pub fn new(token: String) -> OrganizationVerifyDeleteRecoverRequestModel { - OrganizationVerifyDeleteRecoverRequestModel { token } - } -} diff --git a/crates/bitwarden-api-api/src/models/other_device_keys_update_request_model.rs b/crates/bitwarden-api-api/src/models/other_device_keys_update_request_model.rs deleted file mode 100644 index 2ebcedb96..000000000 --- a/crates/bitwarden-api-api/src/models/other_device_keys_update_request_model.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct OtherDeviceKeysUpdateRequestModel { - #[serde(rename = "encryptedPublicKey")] - pub encrypted_public_key: String, - #[serde(rename = "encryptedUserKey")] - pub encrypted_user_key: String, - #[serde(rename = "deviceId")] - pub device_id: uuid::Uuid, -} - -impl OtherDeviceKeysUpdateRequestModel { - pub fn new( - encrypted_public_key: String, - encrypted_user_key: String, - device_id: uuid::Uuid, - ) -> OtherDeviceKeysUpdateRequestModel { - OtherDeviceKeysUpdateRequestModel { - encrypted_public_key, - encrypted_user_key, - device_id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/password_hint_request_model.rs b/crates/bitwarden-api-api/src/models/password_hint_request_model.rs deleted file mode 100644 index 70ae8cfc0..000000000 --- a/crates/bitwarden-api-api/src/models/password_hint_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PasswordHintRequestModel { - #[serde(rename = "email")] - pub email: String, -} - -impl PasswordHintRequestModel { - pub fn new(email: String) -> PasswordHintRequestModel { - PasswordHintRequestModel { email } - } -} diff --git a/crates/bitwarden-api-api/src/models/password_manager_plan_features_response_model.rs b/crates/bitwarden-api-api/src/models/password_manager_plan_features_response_model.rs deleted file mode 100644 index d7e9514dd..000000000 --- a/crates/bitwarden-api-api/src/models/password_manager_plan_features_response_model.rs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PasswordManagerPlanFeaturesResponseModel { - #[serde(rename = "stripePlanId", skip_serializing_if = "Option::is_none")] - pub stripe_plan_id: Option, - #[serde(rename = "stripeSeatPlanId", skip_serializing_if = "Option::is_none")] - pub stripe_seat_plan_id: Option, - #[serde( - rename = "stripeProviderPortalSeatPlanId", - skip_serializing_if = "Option::is_none" - )] - pub stripe_provider_portal_seat_plan_id: Option, - #[serde(rename = "basePrice", skip_serializing_if = "Option::is_none")] - pub base_price: Option, - #[serde(rename = "seatPrice", skip_serializing_if = "Option::is_none")] - pub seat_price: Option, - #[serde( - rename = "providerPortalSeatPrice", - skip_serializing_if = "Option::is_none" - )] - pub provider_portal_seat_price: Option, - #[serde(rename = "allowSeatAutoscale", skip_serializing_if = "Option::is_none")] - pub allow_seat_autoscale: Option, - #[serde( - rename = "hasAdditionalSeatsOption", - skip_serializing_if = "Option::is_none" - )] - pub has_additional_seats_option: Option, - #[serde(rename = "maxAdditionalSeats", skip_serializing_if = "Option::is_none")] - pub max_additional_seats: Option, - #[serde(rename = "baseSeats", skip_serializing_if = "Option::is_none")] - pub base_seats: Option, - #[serde( - rename = "hasPremiumAccessOption", - skip_serializing_if = "Option::is_none" - )] - pub has_premium_access_option: Option, - #[serde( - rename = "stripePremiumAccessPlanId", - skip_serializing_if = "Option::is_none" - )] - pub stripe_premium_access_plan_id: Option, - #[serde( - rename = "premiumAccessOptionPrice", - skip_serializing_if = "Option::is_none" - )] - pub premium_access_option_price: Option, - #[serde(rename = "maxSeats", skip_serializing_if = "Option::is_none")] - pub max_seats: Option, - #[serde(rename = "baseStorageGb", skip_serializing_if = "Option::is_none")] - pub base_storage_gb: Option, - #[serde( - rename = "hasAdditionalStorageOption", - skip_serializing_if = "Option::is_none" - )] - pub has_additional_storage_option: Option, - #[serde( - rename = "additionalStoragePricePerGb", - skip_serializing_if = "Option::is_none" - )] - pub additional_storage_price_per_gb: Option, - #[serde( - rename = "stripeStoragePlanId", - skip_serializing_if = "Option::is_none" - )] - pub stripe_storage_plan_id: Option, - #[serde( - rename = "maxAdditionalStorage", - skip_serializing_if = "Option::is_none" - )] - pub max_additional_storage: Option, - #[serde(rename = "maxCollections", skip_serializing_if = "Option::is_none")] - pub max_collections: Option, -} - -impl PasswordManagerPlanFeaturesResponseModel { - pub fn new() -> PasswordManagerPlanFeaturesResponseModel { - PasswordManagerPlanFeaturesResponseModel { - stripe_plan_id: None, - stripe_seat_plan_id: None, - stripe_provider_portal_seat_plan_id: None, - base_price: None, - seat_price: None, - provider_portal_seat_price: None, - allow_seat_autoscale: None, - has_additional_seats_option: None, - max_additional_seats: None, - base_seats: None, - has_premium_access_option: None, - stripe_premium_access_plan_id: None, - premium_access_option_price: None, - max_seats: None, - base_storage_gb: None, - has_additional_storage_option: None, - additional_storage_price_per_gb: None, - stripe_storage_plan_id: None, - max_additional_storage: None, - max_collections: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/password_request_model.rs b/crates/bitwarden-api-api/src/models/password_request_model.rs deleted file mode 100644 index a48f87284..000000000 --- a/crates/bitwarden-api-api/src/models/password_request_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PasswordRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "newMasterPasswordHash")] - pub new_master_password_hash: String, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, - #[serde(rename = "key")] - pub key: String, -} - -impl PasswordRequestModel { - pub fn new(new_master_password_hash: String, key: String) -> PasswordRequestModel { - PasswordRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - new_master_password_hash, - master_password_hint: None, - key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/payment_method_type.rs b/crates/bitwarden-api-api/src/models/payment_method_type.rs deleted file mode 100644 index 27b164261..000000000 --- a/crates/bitwarden-api-api/src/models/payment_method_type.rs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum PaymentMethodType { - Card = 0, - BankAccount = 1, - PayPal = 2, - BitPay = 3, - Credit = 4, - WireTransfer = 5, - Check = 8, - None = 255, -} - -impl std::fmt::Display for PaymentMethodType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Card => write!(f, "0"), - Self::BankAccount => write!(f, "1"), - Self::PayPal => write!(f, "2"), - Self::BitPay => write!(f, "3"), - Self::Credit => write!(f, "4"), - Self::WireTransfer => write!(f, "5"), - Self::Check => write!(f, "8"), - Self::None => write!(f, "255"), - } - } -} - -impl Default for PaymentMethodType { - fn default() -> PaymentMethodType { - Self::Card - } -} diff --git a/crates/bitwarden-api-api/src/models/payment_request_model.rs b/crates/bitwarden-api-api/src/models/payment_request_model.rs deleted file mode 100644 index dd75f792b..000000000 --- a/crates/bitwarden-api-api/src/models/payment_request_model.rs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PaymentRequestModel { - #[serde(rename = "country")] - pub country: String, - #[serde(rename = "postalCode", skip_serializing_if = "Option::is_none")] - pub postal_code: Option, - #[serde(rename = "taxId", skip_serializing_if = "Option::is_none")] - pub tax_id: Option, - #[serde(rename = "line1", skip_serializing_if = "Option::is_none")] - pub line1: Option, - #[serde(rename = "line2", skip_serializing_if = "Option::is_none")] - pub line2: Option, - #[serde(rename = "city", skip_serializing_if = "Option::is_none")] - pub city: Option, - #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, - #[serde(rename = "paymentMethodType")] - pub payment_method_type: models::PaymentMethodType, - #[serde(rename = "paymentToken")] - pub payment_token: String, -} - -impl PaymentRequestModel { - pub fn new( - country: String, - payment_method_type: models::PaymentMethodType, - payment_token: String, - ) -> PaymentRequestModel { - PaymentRequestModel { - country, - postal_code: None, - tax_id: None, - line1: None, - line2: None, - city: None, - state: None, - payment_method_type, - payment_token, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/payment_response_model.rs b/crates/bitwarden-api-api/src/models/payment_response_model.rs deleted file mode 100644 index 1ac49b66d..000000000 --- a/crates/bitwarden-api-api/src/models/payment_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PaymentResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "userProfile", skip_serializing_if = "Option::is_none")] - pub user_profile: Option>, - #[serde( - rename = "paymentIntentClientSecret", - skip_serializing_if = "Option::is_none" - )] - pub payment_intent_client_secret: Option, - #[serde(rename = "success", skip_serializing_if = "Option::is_none")] - pub success: Option, -} - -impl PaymentResponseModel { - pub fn new() -> PaymentResponseModel { - PaymentResponseModel { - object: None, - user_profile: None, - payment_intent_client_secret: None, - success: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model.rs b/crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model.rs deleted file mode 100644 index f87d025c6..000000000 --- a/crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model.rs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PendingOrganizationAuthRequestResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, - #[serde( - rename = "requestDeviceIdentifier", - skip_serializing_if = "Option::is_none" - )] - pub request_device_identifier: Option, - #[serde(rename = "requestDeviceType", skip_serializing_if = "Option::is_none")] - pub request_device_type: Option, - #[serde(rename = "requestIpAddress", skip_serializing_if = "Option::is_none")] - pub request_ip_address: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, -} - -impl PendingOrganizationAuthRequestResponseModel { - pub fn new() -> PendingOrganizationAuthRequestResponseModel { - PendingOrganizationAuthRequestResponseModel { - object: None, - id: None, - user_id: None, - organization_user_id: None, - email: None, - public_key: None, - request_device_identifier: None, - request_device_type: None, - request_ip_address: None, - creation_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model_list_response_model.rs deleted file mode 100644 index 5798a24e5..000000000 --- a/crates/bitwarden-api-api/src/models/pending_organization_auth_request_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PendingOrganizationAuthRequestResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl PendingOrganizationAuthRequestResponseModelListResponseModel { - pub fn new() -> PendingOrganizationAuthRequestResponseModelListResponseModel { - PendingOrganizationAuthRequestResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/people_access_policies_request_model.rs b/crates/bitwarden-api-api/src/models/people_access_policies_request_model.rs deleted file mode 100644 index c08eca935..000000000 --- a/crates/bitwarden-api-api/src/models/people_access_policies_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PeopleAccessPoliciesRequestModel { - #[serde( - rename = "userAccessPolicyRequests", - skip_serializing_if = "Option::is_none" - )] - pub user_access_policy_requests: Option>, - #[serde( - rename = "groupAccessPolicyRequests", - skip_serializing_if = "Option::is_none" - )] - pub group_access_policy_requests: Option>, -} - -impl PeopleAccessPoliciesRequestModel { - pub fn new() -> PeopleAccessPoliciesRequestModel { - PeopleAccessPoliciesRequestModel { - user_access_policy_requests: None, - group_access_policy_requests: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/permissions.rs b/crates/bitwarden-api-api/src/models/permissions.rs deleted file mode 100644 index 56246d661..000000000 --- a/crates/bitwarden-api-api/src/models/permissions.rs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct Permissions { - #[serde(rename = "accessEventLogs", skip_serializing_if = "Option::is_none")] - pub access_event_logs: Option, - #[serde(rename = "accessImportExport", skip_serializing_if = "Option::is_none")] - pub access_import_export: Option, - #[serde(rename = "accessReports", skip_serializing_if = "Option::is_none")] - pub access_reports: Option, - #[serde( - rename = "createNewCollections", - skip_serializing_if = "Option::is_none" - )] - pub create_new_collections: Option, - #[serde(rename = "editAnyCollection", skip_serializing_if = "Option::is_none")] - pub edit_any_collection: Option, - #[serde( - rename = "deleteAnyCollection", - skip_serializing_if = "Option::is_none" - )] - pub delete_any_collection: Option, - #[serde( - rename = "editAssignedCollections", - skip_serializing_if = "Option::is_none" - )] - pub edit_assigned_collections: Option, - #[serde( - rename = "deleteAssignedCollections", - skip_serializing_if = "Option::is_none" - )] - pub delete_assigned_collections: Option, - #[serde(rename = "manageGroups", skip_serializing_if = "Option::is_none")] - pub manage_groups: Option, - #[serde(rename = "managePolicies", skip_serializing_if = "Option::is_none")] - pub manage_policies: Option, - #[serde(rename = "manageSso", skip_serializing_if = "Option::is_none")] - pub manage_sso: Option, - #[serde(rename = "manageUsers", skip_serializing_if = "Option::is_none")] - pub manage_users: Option, - #[serde( - rename = "manageResetPassword", - skip_serializing_if = "Option::is_none" - )] - pub manage_reset_password: Option, - #[serde(rename = "manageScim", skip_serializing_if = "Option::is_none")] - pub manage_scim: Option, -} - -impl Permissions { - pub fn new() -> Permissions { - Permissions { - access_event_logs: None, - access_import_export: None, - access_reports: None, - create_new_collections: None, - edit_any_collection: None, - delete_any_collection: None, - edit_assigned_collections: None, - delete_assigned_collections: None, - manage_groups: None, - manage_policies: None, - manage_sso: None, - manage_users: None, - manage_reset_password: None, - manage_scim: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/plan_response_model.rs b/crates/bitwarden-api-api/src/models/plan_response_model.rs deleted file mode 100644 index e6d3a34d4..000000000 --- a/crates/bitwarden-api-api/src/models/plan_response_model.rs +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PlanResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "productTier", skip_serializing_if = "Option::is_none")] - pub product_tier: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "isAnnual", skip_serializing_if = "Option::is_none")] - pub is_annual: Option, - #[serde( - rename = "nameLocalizationKey", - skip_serializing_if = "Option::is_none" - )] - pub name_localization_key: Option, - #[serde( - rename = "descriptionLocalizationKey", - skip_serializing_if = "Option::is_none" - )] - pub description_localization_key: Option, - #[serde( - rename = "canBeUsedByBusiness", - skip_serializing_if = "Option::is_none" - )] - pub can_be_used_by_business: Option, - #[serde(rename = "trialPeriodDays", skip_serializing_if = "Option::is_none")] - pub trial_period_days: Option, - #[serde(rename = "hasSelfHost", skip_serializing_if = "Option::is_none")] - pub has_self_host: Option, - #[serde(rename = "hasPolicies", skip_serializing_if = "Option::is_none")] - pub has_policies: Option, - #[serde(rename = "hasGroups", skip_serializing_if = "Option::is_none")] - pub has_groups: Option, - #[serde(rename = "hasDirectory", skip_serializing_if = "Option::is_none")] - pub has_directory: Option, - #[serde(rename = "hasEvents", skip_serializing_if = "Option::is_none")] - pub has_events: Option, - #[serde(rename = "hasTotp", skip_serializing_if = "Option::is_none")] - pub has_totp: Option, - #[serde(rename = "has2fa", skip_serializing_if = "Option::is_none")] - pub has2fa: Option, - #[serde(rename = "hasApi", skip_serializing_if = "Option::is_none")] - pub has_api: Option, - #[serde(rename = "hasSso", skip_serializing_if = "Option::is_none")] - pub has_sso: Option, - #[serde(rename = "hasResetPassword", skip_serializing_if = "Option::is_none")] - pub has_reset_password: Option, - #[serde(rename = "usersGetPremium", skip_serializing_if = "Option::is_none")] - pub users_get_premium: Option, - #[serde(rename = "upgradeSortOrder", skip_serializing_if = "Option::is_none")] - pub upgrade_sort_order: Option, - #[serde(rename = "displaySortOrder", skip_serializing_if = "Option::is_none")] - pub display_sort_order: Option, - #[serde(rename = "legacyYear", skip_serializing_if = "Option::is_none")] - pub legacy_year: Option, - #[serde(rename = "disabled", skip_serializing_if = "Option::is_none")] - pub disabled: Option, - #[serde(rename = "secretsManager", skip_serializing_if = "Option::is_none")] - pub secrets_manager: Option>, - #[serde(rename = "passwordManager", skip_serializing_if = "Option::is_none")] - pub password_manager: Option>, -} - -impl PlanResponseModel { - pub fn new() -> PlanResponseModel { - PlanResponseModel { - object: None, - r#type: None, - product_tier: None, - name: None, - is_annual: None, - name_localization_key: None, - description_localization_key: None, - can_be_used_by_business: None, - trial_period_days: None, - has_self_host: None, - has_policies: None, - has_groups: None, - has_directory: None, - has_events: None, - has_totp: None, - has2fa: None, - has_api: None, - has_sso: None, - has_reset_password: None, - users_get_premium: None, - upgrade_sort_order: None, - display_sort_order: None, - legacy_year: None, - disabled: None, - secrets_manager: None, - password_manager: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/plan_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/plan_response_model_list_response_model.rs deleted file mode 100644 index 666b87961..000000000 --- a/crates/bitwarden-api-api/src/models/plan_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PlanResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl PlanResponseModelListResponseModel { - pub fn new() -> PlanResponseModelListResponseModel { - PlanResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/plan_sponsorship_type.rs b/crates/bitwarden-api-api/src/models/plan_sponsorship_type.rs deleted file mode 100644 index cd90a9617..000000000 --- a/crates/bitwarden-api-api/src/models/plan_sponsorship_type.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum PlanSponsorshipType { - FamiliesForEnterprise = 0, -} - -impl std::fmt::Display for PlanSponsorshipType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::FamiliesForEnterprise => write!(f, "0"), - } - } -} - -impl Default for PlanSponsorshipType { - fn default() -> PlanSponsorshipType { - Self::FamiliesForEnterprise - } -} diff --git a/crates/bitwarden-api-api/src/models/plan_type.rs b/crates/bitwarden-api-api/src/models/plan_type.rs deleted file mode 100644 index 38902b5d4..000000000 --- a/crates/bitwarden-api-api/src/models/plan_type.rs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum PlanType { - Free = 0, - FamiliesAnnually2019 = 1, - TeamsMonthly2019 = 2, - TeamsAnnually2019 = 3, - EnterpriseMonthly2019 = 4, - EnterpriseAnnually2019 = 5, - Custom = 6, - FamiliesAnnually = 7, - TeamsMonthly2020 = 8, - TeamsAnnually2020 = 9, - EnterpriseMonthly2020 = 10, - EnterpriseAnnually2020 = 11, - TeamsMonthly2023 = 12, - TeamsAnnually2023 = 13, - EnterpriseMonthly2023 = 14, - EnterpriseAnnually2023 = 15, - TeamsStarter2023 = 16, - TeamsMonthly = 17, - TeamsAnnually = 18, - EnterpriseMonthly = 19, - EnterpriseAnnually = 20, - TeamsStarter = 21, -} - -impl std::fmt::Display for PlanType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Free => write!(f, "0"), - Self::FamiliesAnnually2019 => write!(f, "1"), - Self::TeamsMonthly2019 => write!(f, "2"), - Self::TeamsAnnually2019 => write!(f, "3"), - Self::EnterpriseMonthly2019 => write!(f, "4"), - Self::EnterpriseAnnually2019 => write!(f, "5"), - Self::Custom => write!(f, "6"), - Self::FamiliesAnnually => write!(f, "7"), - Self::TeamsMonthly2020 => write!(f, "8"), - Self::TeamsAnnually2020 => write!(f, "9"), - Self::EnterpriseMonthly2020 => write!(f, "10"), - Self::EnterpriseAnnually2020 => write!(f, "11"), - Self::TeamsMonthly2023 => write!(f, "12"), - Self::TeamsAnnually2023 => write!(f, "13"), - Self::EnterpriseMonthly2023 => write!(f, "14"), - Self::EnterpriseAnnually2023 => write!(f, "15"), - Self::TeamsStarter2023 => write!(f, "16"), - Self::TeamsMonthly => write!(f, "17"), - Self::TeamsAnnually => write!(f, "18"), - Self::EnterpriseMonthly => write!(f, "19"), - Self::EnterpriseAnnually => write!(f, "20"), - Self::TeamsStarter => write!(f, "21"), - } - } -} - -impl Default for PlanType { - fn default() -> PlanType { - Self::Free - } -} diff --git a/crates/bitwarden-api-api/src/models/policy_request_model.rs b/crates/bitwarden-api-api/src/models/policy_request_model.rs deleted file mode 100644 index 2fd484351..000000000 --- a/crates/bitwarden-api-api/src/models/policy_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PolicyRequestModel { - #[serde(rename = "type")] - pub r#type: models::PolicyType, - #[serde(rename = "enabled")] - pub enabled: bool, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, -} - -impl PolicyRequestModel { - pub fn new(r#type: models::PolicyType, enabled: bool) -> PolicyRequestModel { - PolicyRequestModel { - r#type, - enabled, - data: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/policy_response_model.rs b/crates/bitwarden-api-api/src/models/policy_response_model.rs deleted file mode 100644 index 137b891a8..000000000 --- a/crates/bitwarden-api-api/src/models/policy_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PolicyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, -} - -impl PolicyResponseModel { - pub fn new() -> PolicyResponseModel { - PolicyResponseModel { - object: None, - id: None, - organization_id: None, - r#type: None, - data: None, - enabled: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/policy_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/policy_response_model_list_response_model.rs deleted file mode 100644 index 81a8dddef..000000000 --- a/crates/bitwarden-api-api/src/models/policy_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PolicyResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl PolicyResponseModelListResponseModel { - pub fn new() -> PolicyResponseModelListResponseModel { - PolicyResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/policy_type.rs b/crates/bitwarden-api-api/src/models/policy_type.rs deleted file mode 100644 index 75f35b0ca..000000000 --- a/crates/bitwarden-api-api/src/models/policy_type.rs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum PolicyType { - TwoFactorAuthentication = 0, - MasterPassword = 1, - PasswordGenerator = 2, - SingleOrg = 3, - RequireSso = 4, - PersonalOwnership = 5, - DisableSend = 6, - SendOptions = 7, - ResetPassword = 8, - MaximumVaultTimeout = 9, - DisablePersonalVaultExport = 10, - ActivateAutofill = 11, - AutomaticAppLogIn = 12, -} - -impl std::fmt::Display for PolicyType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::TwoFactorAuthentication => write!(f, "0"), - Self::MasterPassword => write!(f, "1"), - Self::PasswordGenerator => write!(f, "2"), - Self::SingleOrg => write!(f, "3"), - Self::RequireSso => write!(f, "4"), - Self::PersonalOwnership => write!(f, "5"), - Self::DisableSend => write!(f, "6"), - Self::SendOptions => write!(f, "7"), - Self::ResetPassword => write!(f, "8"), - Self::MaximumVaultTimeout => write!(f, "9"), - Self::DisablePersonalVaultExport => write!(f, "10"), - Self::ActivateAutofill => write!(f, "11"), - Self::AutomaticAppLogIn => write!(f, "12"), - } - } -} - -impl Default for PolicyType { - fn default() -> PolicyType { - Self::TwoFactorAuthentication - } -} diff --git a/crates/bitwarden-api-api/src/models/potential_grantee_response_model.rs b/crates/bitwarden-api-api/src/models/potential_grantee_response_model.rs deleted file mode 100644 index 1f5e7ee31..000000000 --- a/crates/bitwarden-api-api/src/models/potential_grantee_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PotentialGranteeResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "currentUserInGroup", skip_serializing_if = "Option::is_none")] - pub current_user_in_group: Option, - #[serde(rename = "currentUser", skip_serializing_if = "Option::is_none")] - pub current_user: Option, -} - -impl PotentialGranteeResponseModel { - pub fn new() -> PotentialGranteeResponseModel { - PotentialGranteeResponseModel { - object: None, - id: None, - name: None, - r#type: None, - email: None, - current_user_in_group: None, - current_user: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/potential_grantee_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/potential_grantee_response_model_list_response_model.rs deleted file mode 100644 index d6c099c33..000000000 --- a/crates/bitwarden-api-api/src/models/potential_grantee_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PotentialGranteeResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl PotentialGranteeResponseModelListResponseModel { - pub fn new() -> PotentialGranteeResponseModelListResponseModel { - PotentialGranteeResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/product_tier_type.rs b/crates/bitwarden-api-api/src/models/product_tier_type.rs deleted file mode 100644 index 825de4856..000000000 --- a/crates/bitwarden-api-api/src/models/product_tier_type.rs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum ProductTierType { - Free = 0, - Families = 1, - Teams = 2, - Enterprise = 3, - TeamsStarter = 4, -} - -impl std::fmt::Display for ProductTierType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Free => write!(f, "0"), - Self::Families => write!(f, "1"), - Self::Teams => write!(f, "2"), - Self::Enterprise => write!(f, "3"), - Self::TeamsStarter => write!(f, "4"), - } - } -} - -impl Default for ProductTierType { - fn default() -> ProductTierType { - Self::Free - } -} diff --git a/crates/bitwarden-api-api/src/models/profile_organization_response_model.rs b/crates/bitwarden-api-api/src/models/profile_organization_response_model.rs deleted file mode 100644 index 42c22f998..000000000 --- a/crates/bitwarden-api-api/src/models/profile_organization_response_model.rs +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProfileOrganizationResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "usePolicies", skip_serializing_if = "Option::is_none")] - pub use_policies: Option, - #[serde(rename = "useSso", skip_serializing_if = "Option::is_none")] - pub use_sso: Option, - #[serde(rename = "useKeyConnector", skip_serializing_if = "Option::is_none")] - pub use_key_connector: Option, - #[serde(rename = "useScim", skip_serializing_if = "Option::is_none")] - pub use_scim: Option, - #[serde(rename = "useGroups", skip_serializing_if = "Option::is_none")] - pub use_groups: Option, - #[serde(rename = "useDirectory", skip_serializing_if = "Option::is_none")] - pub use_directory: Option, - #[serde(rename = "useEvents", skip_serializing_if = "Option::is_none")] - pub use_events: Option, - #[serde(rename = "useTotp", skip_serializing_if = "Option::is_none")] - pub use_totp: Option, - #[serde(rename = "use2fa", skip_serializing_if = "Option::is_none")] - pub use2fa: Option, - #[serde(rename = "useApi", skip_serializing_if = "Option::is_none")] - pub use_api: Option, - #[serde(rename = "useResetPassword", skip_serializing_if = "Option::is_none")] - pub use_reset_password: Option, - #[serde(rename = "useSecretsManager", skip_serializing_if = "Option::is_none")] - pub use_secrets_manager: Option, - #[serde(rename = "usePasswordManager", skip_serializing_if = "Option::is_none")] - pub use_password_manager: Option, - #[serde(rename = "usersGetPremium", skip_serializing_if = "Option::is_none")] - pub users_get_premium: Option, - #[serde( - rename = "useCustomPermissions", - skip_serializing_if = "Option::is_none" - )] - pub use_custom_permissions: Option, - #[serde( - rename = "useActivateAutofillPolicy", - skip_serializing_if = "Option::is_none" - )] - pub use_activate_autofill_policy: Option, - #[serde(rename = "selfHost", skip_serializing_if = "Option::is_none")] - pub self_host: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "maxCollections", skip_serializing_if = "Option::is_none")] - pub max_collections: Option, - #[serde(rename = "maxStorageGb", skip_serializing_if = "Option::is_none")] - pub max_storage_gb: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "ssoBound", skip_serializing_if = "Option::is_none")] - pub sso_bound: Option, - #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")] - pub identifier: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde( - rename = "resetPasswordEnrolled", - skip_serializing_if = "Option::is_none" - )] - pub reset_password_enrolled: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde( - rename = "hasPublicAndPrivateKeys", - skip_serializing_if = "Option::is_none" - )] - pub has_public_and_private_keys: Option, - #[serde(rename = "providerId", skip_serializing_if = "Option::is_none")] - pub provider_id: Option, - #[serde(rename = "providerName", skip_serializing_if = "Option::is_none")] - pub provider_name: Option, - #[serde(rename = "providerType", skip_serializing_if = "Option::is_none")] - pub provider_type: Option, - #[serde( - rename = "familySponsorshipFriendlyName", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_friendly_name: Option, - #[serde( - rename = "familySponsorshipAvailable", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_available: Option, - #[serde(rename = "productTierType", skip_serializing_if = "Option::is_none")] - pub product_tier_type: Option, - #[serde( - rename = "keyConnectorEnabled", - skip_serializing_if = "Option::is_none" - )] - pub key_connector_enabled: Option, - #[serde(rename = "keyConnectorUrl", skip_serializing_if = "Option::is_none")] - pub key_connector_url: Option, - #[serde( - rename = "familySponsorshipLastSyncDate", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_last_sync_date: Option, - #[serde( - rename = "familySponsorshipValidUntil", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_valid_until: Option, - #[serde( - rename = "familySponsorshipToDelete", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_to_delete: Option, - #[serde( - rename = "accessSecretsManager", - skip_serializing_if = "Option::is_none" - )] - pub access_secrets_manager: Option, - #[serde( - rename = "limitCollectionCreationDeletion", - skip_serializing_if = "Option::is_none" - )] - pub limit_collection_creation_deletion: Option, - #[serde( - rename = "allowAdminAccessToAllCollectionItems", - skip_serializing_if = "Option::is_none" - )] - pub allow_admin_access_to_all_collection_items: Option, -} - -impl ProfileOrganizationResponseModel { - pub fn new() -> ProfileOrganizationResponseModel { - ProfileOrganizationResponseModel { - object: None, - id: None, - name: None, - use_policies: None, - use_sso: None, - use_key_connector: None, - use_scim: None, - use_groups: None, - use_directory: None, - use_events: None, - use_totp: None, - use2fa: None, - use_api: None, - use_reset_password: None, - use_secrets_manager: None, - use_password_manager: None, - users_get_premium: None, - use_custom_permissions: None, - use_activate_autofill_policy: None, - self_host: None, - seats: None, - max_collections: None, - max_storage_gb: None, - key: None, - status: None, - r#type: None, - enabled: None, - sso_bound: None, - identifier: None, - permissions: None, - reset_password_enrolled: None, - user_id: None, - organization_user_id: None, - has_public_and_private_keys: None, - provider_id: None, - provider_name: None, - provider_type: None, - family_sponsorship_friendly_name: None, - family_sponsorship_available: None, - product_tier_type: None, - key_connector_enabled: None, - key_connector_url: None, - family_sponsorship_last_sync_date: None, - family_sponsorship_valid_until: None, - family_sponsorship_to_delete: None, - access_secrets_manager: None, - limit_collection_creation_deletion: None, - allow_admin_access_to_all_collection_items: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/profile_organization_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/profile_organization_response_model_list_response_model.rs deleted file mode 100644 index 0d801dc6e..000000000 --- a/crates/bitwarden-api-api/src/models/profile_organization_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProfileOrganizationResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl ProfileOrganizationResponseModelListResponseModel { - pub fn new() -> ProfileOrganizationResponseModelListResponseModel { - ProfileOrganizationResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/profile_provider_organization_response_model.rs b/crates/bitwarden-api-api/src/models/profile_provider_organization_response_model.rs deleted file mode 100644 index 92cfbd46b..000000000 --- a/crates/bitwarden-api-api/src/models/profile_provider_organization_response_model.rs +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProfileProviderOrganizationResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "usePolicies", skip_serializing_if = "Option::is_none")] - pub use_policies: Option, - #[serde(rename = "useSso", skip_serializing_if = "Option::is_none")] - pub use_sso: Option, - #[serde(rename = "useKeyConnector", skip_serializing_if = "Option::is_none")] - pub use_key_connector: Option, - #[serde(rename = "useScim", skip_serializing_if = "Option::is_none")] - pub use_scim: Option, - #[serde(rename = "useGroups", skip_serializing_if = "Option::is_none")] - pub use_groups: Option, - #[serde(rename = "useDirectory", skip_serializing_if = "Option::is_none")] - pub use_directory: Option, - #[serde(rename = "useEvents", skip_serializing_if = "Option::is_none")] - pub use_events: Option, - #[serde(rename = "useTotp", skip_serializing_if = "Option::is_none")] - pub use_totp: Option, - #[serde(rename = "use2fa", skip_serializing_if = "Option::is_none")] - pub use2fa: Option, - #[serde(rename = "useApi", skip_serializing_if = "Option::is_none")] - pub use_api: Option, - #[serde(rename = "useResetPassword", skip_serializing_if = "Option::is_none")] - pub use_reset_password: Option, - #[serde(rename = "useSecretsManager", skip_serializing_if = "Option::is_none")] - pub use_secrets_manager: Option, - #[serde(rename = "usePasswordManager", skip_serializing_if = "Option::is_none")] - pub use_password_manager: Option, - #[serde(rename = "usersGetPremium", skip_serializing_if = "Option::is_none")] - pub users_get_premium: Option, - #[serde( - rename = "useCustomPermissions", - skip_serializing_if = "Option::is_none" - )] - pub use_custom_permissions: Option, - #[serde( - rename = "useActivateAutofillPolicy", - skip_serializing_if = "Option::is_none" - )] - pub use_activate_autofill_policy: Option, - #[serde(rename = "selfHost", skip_serializing_if = "Option::is_none")] - pub self_host: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "maxCollections", skip_serializing_if = "Option::is_none")] - pub max_collections: Option, - #[serde(rename = "maxStorageGb", skip_serializing_if = "Option::is_none")] - pub max_storage_gb: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "ssoBound", skip_serializing_if = "Option::is_none")] - pub sso_bound: Option, - #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")] - pub identifier: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde( - rename = "resetPasswordEnrolled", - skip_serializing_if = "Option::is_none" - )] - pub reset_password_enrolled: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde( - rename = "hasPublicAndPrivateKeys", - skip_serializing_if = "Option::is_none" - )] - pub has_public_and_private_keys: Option, - #[serde(rename = "providerId", skip_serializing_if = "Option::is_none")] - pub provider_id: Option, - #[serde(rename = "providerName", skip_serializing_if = "Option::is_none")] - pub provider_name: Option, - #[serde(rename = "providerType", skip_serializing_if = "Option::is_none")] - pub provider_type: Option, - #[serde( - rename = "familySponsorshipFriendlyName", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_friendly_name: Option, - #[serde( - rename = "familySponsorshipAvailable", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_available: Option, - #[serde(rename = "productTierType", skip_serializing_if = "Option::is_none")] - pub product_tier_type: Option, - #[serde( - rename = "keyConnectorEnabled", - skip_serializing_if = "Option::is_none" - )] - pub key_connector_enabled: Option, - #[serde(rename = "keyConnectorUrl", skip_serializing_if = "Option::is_none")] - pub key_connector_url: Option, - #[serde( - rename = "familySponsorshipLastSyncDate", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_last_sync_date: Option, - #[serde( - rename = "familySponsorshipValidUntil", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_valid_until: Option, - #[serde( - rename = "familySponsorshipToDelete", - skip_serializing_if = "Option::is_none" - )] - pub family_sponsorship_to_delete: Option, - #[serde( - rename = "accessSecretsManager", - skip_serializing_if = "Option::is_none" - )] - pub access_secrets_manager: Option, - #[serde( - rename = "limitCollectionCreationDeletion", - skip_serializing_if = "Option::is_none" - )] - pub limit_collection_creation_deletion: Option, - #[serde( - rename = "allowAdminAccessToAllCollectionItems", - skip_serializing_if = "Option::is_none" - )] - pub allow_admin_access_to_all_collection_items: Option, -} - -impl ProfileProviderOrganizationResponseModel { - pub fn new() -> ProfileProviderOrganizationResponseModel { - ProfileProviderOrganizationResponseModel { - object: None, - id: None, - name: None, - use_policies: None, - use_sso: None, - use_key_connector: None, - use_scim: None, - use_groups: None, - use_directory: None, - use_events: None, - use_totp: None, - use2fa: None, - use_api: None, - use_reset_password: None, - use_secrets_manager: None, - use_password_manager: None, - users_get_premium: None, - use_custom_permissions: None, - use_activate_autofill_policy: None, - self_host: None, - seats: None, - max_collections: None, - max_storage_gb: None, - key: None, - status: None, - r#type: None, - enabled: None, - sso_bound: None, - identifier: None, - permissions: None, - reset_password_enrolled: None, - user_id: None, - organization_user_id: None, - has_public_and_private_keys: None, - provider_id: None, - provider_name: None, - provider_type: None, - family_sponsorship_friendly_name: None, - family_sponsorship_available: None, - product_tier_type: None, - key_connector_enabled: None, - key_connector_url: None, - family_sponsorship_last_sync_date: None, - family_sponsorship_valid_until: None, - family_sponsorship_to_delete: None, - access_secrets_manager: None, - limit_collection_creation_deletion: None, - allow_admin_access_to_all_collection_items: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/profile_provider_response_model.rs b/crates/bitwarden-api-api/src/models/profile_provider_response_model.rs deleted file mode 100644 index 7520be8d1..000000000 --- a/crates/bitwarden-api-api/src/models/profile_provider_response_model.rs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProfileProviderResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "useEvents", skip_serializing_if = "Option::is_none")] - pub use_events: Option, - #[serde(rename = "providerStatus", skip_serializing_if = "Option::is_none")] - pub provider_status: Option, -} - -impl ProfileProviderResponseModel { - pub fn new() -> ProfileProviderResponseModel { - ProfileProviderResponseModel { - object: None, - id: None, - name: None, - key: None, - status: None, - r#type: None, - enabled: None, - permissions: None, - user_id: None, - use_events: None, - provider_status: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/profile_response_model.rs b/crates/bitwarden-api-api/src/models/profile_response_model.rs deleted file mode 100644 index 2ef3672d3..000000000 --- a/crates/bitwarden-api-api/src/models/profile_response_model.rs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProfileResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "emailVerified", skip_serializing_if = "Option::is_none")] - pub email_verified: Option, - #[serde(rename = "premium", skip_serializing_if = "Option::is_none")] - pub premium: Option, - #[serde( - rename = "premiumFromOrganization", - skip_serializing_if = "Option::is_none" - )] - pub premium_from_organization: Option, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, - #[serde(rename = "culture", skip_serializing_if = "Option::is_none")] - pub culture: Option, - #[serde(rename = "twoFactorEnabled", skip_serializing_if = "Option::is_none")] - pub two_factor_enabled: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "privateKey", skip_serializing_if = "Option::is_none")] - pub private_key: Option, - #[serde(rename = "securityStamp", skip_serializing_if = "Option::is_none")] - pub security_stamp: Option, - #[serde(rename = "forcePasswordReset", skip_serializing_if = "Option::is_none")] - pub force_password_reset: Option, - #[serde(rename = "usesKeyConnector", skip_serializing_if = "Option::is_none")] - pub uses_key_connector: Option, - #[serde(rename = "avatarColor", skip_serializing_if = "Option::is_none")] - pub avatar_color: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "organizations", skip_serializing_if = "Option::is_none")] - pub organizations: Option>, - #[serde(rename = "providers", skip_serializing_if = "Option::is_none")] - pub providers: Option>, - #[serde( - rename = "providerOrganizations", - skip_serializing_if = "Option::is_none" - )] - pub provider_organizations: Option>, -} - -impl ProfileResponseModel { - pub fn new() -> ProfileResponseModel { - ProfileResponseModel { - object: None, - id: None, - name: None, - email: None, - email_verified: None, - premium: None, - premium_from_organization: None, - master_password_hint: None, - culture: None, - two_factor_enabled: None, - key: None, - private_key: None, - security_stamp: None, - force_password_reset: None, - uses_key_connector: None, - avatar_color: None, - creation_date: None, - organizations: None, - providers: None, - provider_organizations: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_counts_response_model.rs b/crates/bitwarden-api-api/src/models/project_counts_response_model.rs deleted file mode 100644 index adcc97c82..000000000 --- a/crates/bitwarden-api-api/src/models/project_counts_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectCountsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "secrets", skip_serializing_if = "Option::is_none")] - pub secrets: Option, - #[serde(rename = "people", skip_serializing_if = "Option::is_none")] - pub people: Option, - #[serde(rename = "serviceAccounts", skip_serializing_if = "Option::is_none")] - pub service_accounts: Option, -} - -impl ProjectCountsResponseModel { - pub fn new() -> ProjectCountsResponseModel { - ProjectCountsResponseModel { - object: None, - secrets: None, - people: None, - service_accounts: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_create_request_model.rs b/crates/bitwarden-api-api/src/models/project_create_request_model.rs deleted file mode 100644 index 16c9fe6d0..000000000 --- a/crates/bitwarden-api-api/src/models/project_create_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectCreateRequestModel { - #[serde(rename = "name")] - pub name: String, -} - -impl ProjectCreateRequestModel { - pub fn new(name: String) -> ProjectCreateRequestModel { - ProjectCreateRequestModel { name } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_people_access_policies_response_model.rs b/crates/bitwarden-api-api/src/models/project_people_access_policies_response_model.rs deleted file mode 100644 index 83ba39e22..000000000 --- a/crates/bitwarden-api-api/src/models/project_people_access_policies_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectPeopleAccessPoliciesResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "userAccessPolicies", skip_serializing_if = "Option::is_none")] - pub user_access_policies: Option>, - #[serde( - rename = "groupAccessPolicies", - skip_serializing_if = "Option::is_none" - )] - pub group_access_policies: Option>, -} - -impl ProjectPeopleAccessPoliciesResponseModel { - pub fn new() -> ProjectPeopleAccessPoliciesResponseModel { - ProjectPeopleAccessPoliciesResponseModel { - object: None, - user_access_policies: None, - group_access_policies: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_response_model.rs b/crates/bitwarden-api-api/src/models/project_response_model.rs deleted file mode 100644 index f2222a939..000000000 --- a/crates/bitwarden-api-api/src/models/project_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "read", skip_serializing_if = "Option::is_none")] - pub read: Option, - #[serde(rename = "write", skip_serializing_if = "Option::is_none")] - pub write: Option, -} - -impl ProjectResponseModel { - pub fn new() -> ProjectResponseModel { - ProjectResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - creation_date: None, - revision_date: None, - read: None, - write: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/project_response_model_list_response_model.rs deleted file mode 100644 index 9b8bfe7c5..000000000 --- a/crates/bitwarden-api-api/src/models/project_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl ProjectResponseModelListResponseModel { - pub fn new() -> ProjectResponseModelListResponseModel { - ProjectResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_request_model.rs b/crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_request_model.rs deleted file mode 100644 index 3c54b4062..000000000 --- a/crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_request_model.rs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectServiceAccountsAccessPoliciesRequestModel { - #[serde(rename = "serviceAccountAccessPolicyRequests")] - pub service_account_access_policy_requests: Option>, -} - -impl ProjectServiceAccountsAccessPoliciesRequestModel { - pub fn new( - service_account_access_policy_requests: Option>, - ) -> ProjectServiceAccountsAccessPoliciesRequestModel { - ProjectServiceAccountsAccessPoliciesRequestModel { - service_account_access_policy_requests, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_response_model.rs b/crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_response_model.rs deleted file mode 100644 index e5899817f..000000000 --- a/crates/bitwarden-api-api/src/models/project_service_accounts_access_policies_response_model.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectServiceAccountsAccessPoliciesResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde( - rename = "serviceAccountAccessPolicies", - skip_serializing_if = "Option::is_none" - )] - pub service_account_access_policies: - Option>, -} - -impl ProjectServiceAccountsAccessPoliciesResponseModel { - pub fn new() -> ProjectServiceAccountsAccessPoliciesResponseModel { - ProjectServiceAccountsAccessPoliciesResponseModel { - object: None, - service_account_access_policies: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/project_update_request_model.rs b/crates/bitwarden-api-api/src/models/project_update_request_model.rs deleted file mode 100644 index 2eab13f22..000000000 --- a/crates/bitwarden-api-api/src/models/project_update_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProjectUpdateRequestModel { - #[serde(rename = "name")] - pub name: String, -} - -impl ProjectUpdateRequestModel { - pub fn new(name: String) -> ProjectUpdateRequestModel { - ProjectUpdateRequestModel { name } - } -} diff --git a/crates/bitwarden-api-api/src/models/protected_device_response_model.rs b/crates/bitwarden-api-api/src/models/protected_device_response_model.rs deleted file mode 100644 index eab023bc2..000000000 --- a/crates/bitwarden-api-api/src/models/protected_device_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProtectedDeviceResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")] - pub identifier: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "encryptedUserKey", skip_serializing_if = "Option::is_none")] - pub encrypted_user_key: Option, - #[serde(rename = "encryptedPublicKey", skip_serializing_if = "Option::is_none")] - pub encrypted_public_key: Option, -} - -impl ProtectedDeviceResponseModel { - pub fn new() -> ProtectedDeviceResponseModel { - ProtectedDeviceResponseModel { - object: None, - id: None, - name: None, - r#type: None, - identifier: None, - creation_date: None, - encrypted_user_key: None, - encrypted_public_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_organization_add_request_model.rs b/crates/bitwarden-api-api/src/models/provider_organization_add_request_model.rs deleted file mode 100644 index 8649a67d9..000000000 --- a/crates/bitwarden-api-api/src/models/provider_organization_add_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderOrganizationAddRequestModel { - #[serde(rename = "organizationId")] - pub organization_id: uuid::Uuid, - #[serde(rename = "key")] - pub key: String, -} - -impl ProviderOrganizationAddRequestModel { - pub fn new(organization_id: uuid::Uuid, key: String) -> ProviderOrganizationAddRequestModel { - ProviderOrganizationAddRequestModel { - organization_id, - key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_organization_create_request_model.rs b/crates/bitwarden-api-api/src/models/provider_organization_create_request_model.rs deleted file mode 100644 index 149847fb4..000000000 --- a/crates/bitwarden-api-api/src/models/provider_organization_create_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderOrganizationCreateRequestModel { - #[serde(rename = "clientOwnerEmail")] - pub client_owner_email: String, - #[serde(rename = "organizationCreateRequest")] - pub organization_create_request: Box, -} - -impl ProviderOrganizationCreateRequestModel { - pub fn new( - client_owner_email: String, - organization_create_request: models::OrganizationCreateRequestModel, - ) -> ProviderOrganizationCreateRequestModel { - ProviderOrganizationCreateRequestModel { - client_owner_email, - organization_create_request: Box::new(organization_create_request), - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model.rs b/crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model.rs deleted file mode 100644 index c721d02de..000000000 --- a/crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderOrganizationOrganizationDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "providerId", skip_serializing_if = "Option::is_none")] - pub provider_id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "settings", skip_serializing_if = "Option::is_none")] - pub settings: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "userCount", skip_serializing_if = "Option::is_none")] - pub user_count: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "occupiedSeats", skip_serializing_if = "Option::is_none")] - pub occupied_seats: Option, - #[serde(rename = "remainingSeats", skip_serializing_if = "Option::is_none")] - pub remaining_seats: Option, - #[serde(rename = "plan", skip_serializing_if = "Option::is_none")] - pub plan: Option, - #[serde(rename = "organizationName", skip_serializing_if = "Option::is_none")] - pub organization_name: Option, -} - -impl ProviderOrganizationOrganizationDetailsResponseModel { - pub fn new() -> ProviderOrganizationOrganizationDetailsResponseModel { - ProviderOrganizationOrganizationDetailsResponseModel { - object: None, - id: None, - provider_id: None, - organization_id: None, - key: None, - settings: None, - creation_date: None, - revision_date: None, - user_count: None, - seats: None, - occupied_seats: None, - remaining_seats: None, - plan: None, - organization_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model_list_response_model.rs deleted file mode 100644 index 6e2c3d30b..000000000 --- a/crates/bitwarden-api-api/src/models/provider_organization_organization_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderOrganizationOrganizationDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl ProviderOrganizationOrganizationDetailsResponseModelListResponseModel { - pub fn new() -> ProviderOrganizationOrganizationDetailsResponseModelListResponseModel { - ProviderOrganizationOrganizationDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_organization_response_model.rs b/crates/bitwarden-api-api/src/models/provider_organization_response_model.rs deleted file mode 100644 index 14342f584..000000000 --- a/crates/bitwarden-api-api/src/models/provider_organization_response_model.rs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderOrganizationResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "providerId", skip_serializing_if = "Option::is_none")] - pub provider_id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "settings", skip_serializing_if = "Option::is_none")] - pub settings: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "userCount", skip_serializing_if = "Option::is_none")] - pub user_count: Option, - #[serde(rename = "seats", skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(rename = "occupiedSeats", skip_serializing_if = "Option::is_none")] - pub occupied_seats: Option, - #[serde(rename = "remainingSeats", skip_serializing_if = "Option::is_none")] - pub remaining_seats: Option, - #[serde(rename = "plan", skip_serializing_if = "Option::is_none")] - pub plan: Option, -} - -impl ProviderOrganizationResponseModel { - pub fn new() -> ProviderOrganizationResponseModel { - ProviderOrganizationResponseModel { - object: None, - id: None, - provider_id: None, - organization_id: None, - key: None, - settings: None, - creation_date: None, - revision_date: None, - user_count: None, - seats: None, - occupied_seats: None, - remaining_seats: None, - plan: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_response_model.rs b/crates/bitwarden-api-api/src/models/provider_response_model.rs deleted file mode 100644 index 96980aead..000000000 --- a/crates/bitwarden-api-api/src/models/provider_response_model.rs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "businessAddress1", skip_serializing_if = "Option::is_none")] - pub business_address1: Option, - #[serde(rename = "businessAddress2", skip_serializing_if = "Option::is_none")] - pub business_address2: Option, - #[serde(rename = "businessAddress3", skip_serializing_if = "Option::is_none")] - pub business_address3: Option, - #[serde(rename = "businessCountry", skip_serializing_if = "Option::is_none")] - pub business_country: Option, - #[serde(rename = "businessTaxNumber", skip_serializing_if = "Option::is_none")] - pub business_tax_number: Option, - #[serde(rename = "billingEmail", skip_serializing_if = "Option::is_none")] - pub billing_email: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, -} - -impl ProviderResponseModel { - pub fn new() -> ProviderResponseModel { - ProviderResponseModel { - object: None, - id: None, - name: None, - business_name: None, - business_address1: None, - business_address2: None, - business_address3: None, - business_country: None, - business_tax_number: None, - billing_email: None, - creation_date: None, - r#type: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_setup_request_model.rs b/crates/bitwarden-api-api/src/models/provider_setup_request_model.rs deleted file mode 100644 index c50704a78..000000000 --- a/crates/bitwarden-api-api/src/models/provider_setup_request_model.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderSetupRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "billingEmail")] - pub billing_email: String, - #[serde(rename = "token")] - pub token: String, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "taxInfo", skip_serializing_if = "Option::is_none")] - pub tax_info: Option>, -} - -impl ProviderSetupRequestModel { - pub fn new( - name: String, - billing_email: String, - token: String, - key: String, - ) -> ProviderSetupRequestModel { - ProviderSetupRequestModel { - name, - business_name: None, - billing_email, - token, - key, - tax_info: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_status_type.rs b/crates/bitwarden-api-api/src/models/provider_status_type.rs deleted file mode 100644 index 538cc5f36..000000000 --- a/crates/bitwarden-api-api/src/models/provider_status_type.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum ProviderStatusType { - Pending = 0, - Created = 1, - Billable = 2, -} - -impl std::fmt::Display for ProviderStatusType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Pending => write!(f, "0"), - Self::Created => write!(f, "1"), - Self::Billable => write!(f, "2"), - } - } -} - -impl Default for ProviderStatusType { - fn default() -> ProviderStatusType { - Self::Pending - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_type.rs b/crates/bitwarden-api-api/src/models/provider_type.rs deleted file mode 100644 index 83b5e4c4d..000000000 --- a/crates/bitwarden-api-api/src/models/provider_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum ProviderType { - Msp = 0, - Reseller = 1, -} - -impl std::fmt::Display for ProviderType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Msp => write!(f, "0"), - Self::Reseller => write!(f, "1"), - } - } -} - -impl Default for ProviderType { - fn default() -> ProviderType { - Self::Msp - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_update_request_model.rs b/crates/bitwarden-api-api/src/models/provider_update_request_model.rs deleted file mode 100644 index 1c9fd5300..000000000 --- a/crates/bitwarden-api-api/src/models/provider_update_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUpdateRequestModel { - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "businessName", skip_serializing_if = "Option::is_none")] - pub business_name: Option, - #[serde(rename = "billingEmail")] - pub billing_email: String, -} - -impl ProviderUpdateRequestModel { - pub fn new(name: String, billing_email: String) -> ProviderUpdateRequestModel { - ProviderUpdateRequestModel { - name, - business_name: None, - billing_email, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_accept_request_model.rs b/crates/bitwarden-api-api/src/models/provider_user_accept_request_model.rs deleted file mode 100644 index 68f2f068e..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_accept_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserAcceptRequestModel { - #[serde(rename = "token")] - pub token: String, -} - -impl ProviderUserAcceptRequestModel { - pub fn new(token: String) -> ProviderUserAcceptRequestModel { - ProviderUserAcceptRequestModel { token } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model.rs b/crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model.rs deleted file mode 100644 index d260745d0..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserBulkConfirmRequestModel { - #[serde(rename = "keys")] - pub keys: Vec, -} - -impl ProviderUserBulkConfirmRequestModel { - pub fn new( - keys: Vec, - ) -> ProviderUserBulkConfirmRequestModel { - ProviderUserBulkConfirmRequestModel { keys } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model_entry.rs b/crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model_entry.rs deleted file mode 100644 index 101ff4f49..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_bulk_confirm_request_model_entry.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserBulkConfirmRequestModelEntry { - #[serde(rename = "id")] - pub id: uuid::Uuid, - #[serde(rename = "key")] - pub key: String, -} - -impl ProviderUserBulkConfirmRequestModelEntry { - pub fn new(id: uuid::Uuid, key: String) -> ProviderUserBulkConfirmRequestModelEntry { - ProviderUserBulkConfirmRequestModelEntry { id, key } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_bulk_request_model.rs b/crates/bitwarden-api-api/src/models/provider_user_bulk_request_model.rs deleted file mode 100644 index 525fcc1ce..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_bulk_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserBulkRequestModel { - #[serde(rename = "ids")] - pub ids: Vec, -} - -impl ProviderUserBulkRequestModel { - pub fn new(ids: Vec) -> ProviderUserBulkRequestModel { - ProviderUserBulkRequestModel { ids } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_bulk_response_model.rs b/crates/bitwarden-api-api/src/models/provider_user_bulk_response_model.rs deleted file mode 100644 index 04479834b..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_bulk_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserBulkResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "error", skip_serializing_if = "Option::is_none")] - pub error: Option, -} - -impl ProviderUserBulkResponseModel { - pub fn new() -> ProviderUserBulkResponseModel { - ProviderUserBulkResponseModel { - object: None, - id: None, - error: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_bulk_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/provider_user_bulk_response_model_list_response_model.rs deleted file mode 100644 index 8e7835b6d..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_bulk_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserBulkResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl ProviderUserBulkResponseModelListResponseModel { - pub fn new() -> ProviderUserBulkResponseModelListResponseModel { - ProviderUserBulkResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_confirm_request_model.rs b/crates/bitwarden-api-api/src/models/provider_user_confirm_request_model.rs deleted file mode 100644 index 3f878cf19..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_confirm_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserConfirmRequestModel { - #[serde(rename = "key")] - pub key: String, -} - -impl ProviderUserConfirmRequestModel { - pub fn new(key: String) -> ProviderUserConfirmRequestModel { - ProviderUserConfirmRequestModel { key } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_invite_request_model.rs b/crates/bitwarden-api-api/src/models/provider_user_invite_request_model.rs deleted file mode 100644 index 5ce044a21..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_invite_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserInviteRequestModel { - #[serde(rename = "emails")] - pub emails: Vec, - #[serde(rename = "type")] - pub r#type: models::ProviderUserType, -} - -impl ProviderUserInviteRequestModel { - pub fn new( - emails: Vec, - r#type: models::ProviderUserType, - ) -> ProviderUserInviteRequestModel { - ProviderUserInviteRequestModel { emails, r#type } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_public_key_response_model.rs b/crates/bitwarden-api-api/src/models/provider_user_public_key_response_model.rs deleted file mode 100644 index 66a6a057a..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_public_key_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserPublicKeyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, -} - -impl ProviderUserPublicKeyResponseModel { - pub fn new() -> ProviderUserPublicKeyResponseModel { - ProviderUserPublicKeyResponseModel { - object: None, - id: None, - user_id: None, - key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_public_key_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/provider_user_public_key_response_model_list_response_model.rs deleted file mode 100644 index e475601e4..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_public_key_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserPublicKeyResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl ProviderUserPublicKeyResponseModelListResponseModel { - pub fn new() -> ProviderUserPublicKeyResponseModelListResponseModel { - ProviderUserPublicKeyResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_response_model.rs b/crates/bitwarden-api-api/src/models/provider_user_response_model.rs deleted file mode 100644 index 001017982..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, -} - -impl ProviderUserResponseModel { - pub fn new() -> ProviderUserResponseModel { - ProviderUserResponseModel { - object: None, - id: None, - user_id: None, - r#type: None, - status: None, - permissions: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_status_type.rs b/crates/bitwarden-api-api/src/models/provider_user_status_type.rs deleted file mode 100644 index b45967eb5..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_status_type.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum ProviderUserStatusType { - Invited = 0, - Accepted = 1, - Confirmed = 2, -} - -impl std::fmt::Display for ProviderUserStatusType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Invited => write!(f, "0"), - Self::Accepted => write!(f, "1"), - Self::Confirmed => write!(f, "2"), - } - } -} - -impl Default for ProviderUserStatusType { - fn default() -> ProviderUserStatusType { - Self::Invited - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_type.rs b/crates/bitwarden-api-api/src/models/provider_user_type.rs deleted file mode 100644 index 831faa878..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum ProviderUserType { - ProviderAdmin = 0, - ServiceUser = 1, -} - -impl std::fmt::Display for ProviderUserType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::ProviderAdmin => write!(f, "0"), - Self::ServiceUser => write!(f, "1"), - } - } -} - -impl Default for ProviderUserType { - fn default() -> ProviderUserType { - Self::ProviderAdmin - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_update_request_model.rs b/crates/bitwarden-api-api/src/models/provider_user_update_request_model.rs deleted file mode 100644 index a57d7c02a..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_update_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserUpdateRequestModel { - #[serde(rename = "type")] - pub r#type: models::ProviderUserType, -} - -impl ProviderUserUpdateRequestModel { - pub fn new(r#type: models::ProviderUserType) -> ProviderUserUpdateRequestModel { - ProviderUserUpdateRequestModel { r#type } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_user_details_response_model.rs b/crates/bitwarden-api-api/src/models/provider_user_user_details_response_model.rs deleted file mode 100644 index 4c7bb5a06..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_user_details_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserUserDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] - pub permissions: Option>, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, -} - -impl ProviderUserUserDetailsResponseModel { - pub fn new() -> ProviderUserUserDetailsResponseModel { - ProviderUserUserDetailsResponseModel { - object: None, - id: None, - user_id: None, - r#type: None, - status: None, - permissions: None, - name: None, - email: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_user_user_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/provider_user_user_details_response_model_list_response_model.rs deleted file mode 100644 index 29a19db3d..000000000 --- a/crates/bitwarden-api-api/src/models/provider_user_user_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderUserUserDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl ProviderUserUserDetailsResponseModelListResponseModel { - pub fn new() -> ProviderUserUserDetailsResponseModelListResponseModel { - ProviderUserUserDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/provider_verify_delete_recover_request_model.rs b/crates/bitwarden-api-api/src/models/provider_verify_delete_recover_request_model.rs deleted file mode 100644 index 7bce920f0..000000000 --- a/crates/bitwarden-api-api/src/models/provider_verify_delete_recover_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProviderVerifyDeleteRecoverRequestModel { - #[serde(rename = "token")] - pub token: String, -} - -impl ProviderVerifyDeleteRecoverRequestModel { - pub fn new(token: String) -> ProviderVerifyDeleteRecoverRequestModel { - ProviderVerifyDeleteRecoverRequestModel { token } - } -} diff --git a/crates/bitwarden-api-api/src/models/pub_key_cred_param.rs b/crates/bitwarden-api-api/src/models/pub_key_cred_param.rs deleted file mode 100644 index 5a4099540..000000000 --- a/crates/bitwarden-api-api/src/models/pub_key_cred_param.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PubKeyCredParam { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] - pub alg: Option, -} - -impl PubKeyCredParam { - pub fn new() -> PubKeyCredParam { - PubKeyCredParam { - r#type: None, - alg: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/public_key_credential_descriptor.rs b/crates/bitwarden-api-api/src/models/public_key_credential_descriptor.rs deleted file mode 100644 index cf2ac567d..000000000 --- a/crates/bitwarden-api-api/src/models/public_key_credential_descriptor.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PublicKeyCredentialDescriptor { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde_as(as = "Option")] - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option>, - #[serde(rename = "transports", skip_serializing_if = "Option::is_none")] - pub transports: Option>, -} - -impl PublicKeyCredentialDescriptor { - pub fn new() -> PublicKeyCredentialDescriptor { - PublicKeyCredentialDescriptor { - r#type: None, - id: None, - transports: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/public_key_credential_rp_entity.rs b/crates/bitwarden-api-api/src/models/public_key_credential_rp_entity.rs deleted file mode 100644 index a64595325..000000000 --- a/crates/bitwarden-api-api/src/models/public_key_credential_rp_entity.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PublicKeyCredentialRpEntity { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "icon", skip_serializing_if = "Option::is_none")] - pub icon: Option, -} - -impl PublicKeyCredentialRpEntity { - pub fn new() -> PublicKeyCredentialRpEntity { - PublicKeyCredentialRpEntity { - id: None, - name: None, - icon: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/public_key_credential_type.rs b/crates/bitwarden-api-api/src/models/public_key_credential_type.rs deleted file mode 100644 index c4b0e831c..000000000 --- a/crates/bitwarden-api-api/src/models/public_key_credential_type.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum PublicKeyCredentialType { - #[serde(rename = "public-key")] - PublicKey, -} - -impl std::fmt::Display for PublicKeyCredentialType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::PublicKey => write!(f, "public-key"), - } - } -} - -impl Default for PublicKeyCredentialType { - fn default() -> PublicKeyCredentialType { - Self::PublicKey - } -} diff --git a/crates/bitwarden-api-api/src/models/push_device_request_model.rs b/crates/bitwarden-api-api/src/models/push_device_request_model.rs deleted file mode 100644 index b234a6fd7..000000000 --- a/crates/bitwarden-api-api/src/models/push_device_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PushDeviceRequestModel { - #[serde(rename = "id")] - pub id: String, - #[serde(rename = "type")] - pub r#type: models::DeviceType, -} - -impl PushDeviceRequestModel { - pub fn new(id: String, r#type: models::DeviceType) -> PushDeviceRequestModel { - PushDeviceRequestModel { id, r#type } - } -} diff --git a/crates/bitwarden-api-api/src/models/push_registration_request_model.rs b/crates/bitwarden-api-api/src/models/push_registration_request_model.rs deleted file mode 100644 index d24d2fe64..000000000 --- a/crates/bitwarden-api-api/src/models/push_registration_request_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PushRegistrationRequestModel { - #[serde(rename = "deviceId")] - pub device_id: String, - #[serde(rename = "pushToken")] - pub push_token: String, - #[serde(rename = "userId")] - pub user_id: String, - #[serde(rename = "type")] - pub r#type: models::DeviceType, - #[serde(rename = "identifier")] - pub identifier: String, -} - -impl PushRegistrationRequestModel { - pub fn new( - device_id: String, - push_token: String, - user_id: String, - r#type: models::DeviceType, - identifier: String, - ) -> PushRegistrationRequestModel { - PushRegistrationRequestModel { - device_id, - push_token, - user_id, - r#type, - identifier, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/push_send_request_model.rs b/crates/bitwarden-api-api/src/models/push_send_request_model.rs deleted file mode 100644 index 5d8d6e804..000000000 --- a/crates/bitwarden-api-api/src/models/push_send_request_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PushSendRequestModel { - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "deviceId", skip_serializing_if = "Option::is_none")] - pub device_id: Option, - #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")] - pub identifier: Option, - #[serde(rename = "type")] - pub r#type: models::PushType, - #[serde(rename = "payload")] - pub payload: Option, -} - -impl PushSendRequestModel { - pub fn new( - r#type: models::PushType, - payload: Option, - ) -> PushSendRequestModel { - PushSendRequestModel { - user_id: None, - organization_id: None, - device_id: None, - identifier: None, - r#type, - payload, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/push_type.rs b/crates/bitwarden-api-api/src/models/push_type.rs deleted file mode 100644 index aa8482450..000000000 --- a/crates/bitwarden-api-api/src/models/push_type.rs +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum PushType { - SyncCipherUpdate = 0, - SyncCipherCreate = 1, - SyncLoginDelete = 2, - SyncFolderDelete = 3, - SyncCiphers = 4, - SyncVault = 5, - SyncOrgKeys = 6, - SyncFolderCreate = 7, - SyncFolderUpdate = 8, - SyncCipherDelete = 9, - SyncSettings = 10, - LogOut = 11, - SyncSendCreate = 12, - SyncSendUpdate = 13, - SyncSendDelete = 14, - AuthRequest = 15, - AuthRequestResponse = 16, - SyncOrganizations = 17, -} - -impl std::fmt::Display for PushType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::SyncCipherUpdate => write!(f, "0"), - Self::SyncCipherCreate => write!(f, "1"), - Self::SyncLoginDelete => write!(f, "2"), - Self::SyncFolderDelete => write!(f, "3"), - Self::SyncCiphers => write!(f, "4"), - Self::SyncVault => write!(f, "5"), - Self::SyncOrgKeys => write!(f, "6"), - Self::SyncFolderCreate => write!(f, "7"), - Self::SyncFolderUpdate => write!(f, "8"), - Self::SyncCipherDelete => write!(f, "9"), - Self::SyncSettings => write!(f, "10"), - Self::LogOut => write!(f, "11"), - Self::SyncSendCreate => write!(f, "12"), - Self::SyncSendUpdate => write!(f, "13"), - Self::SyncSendDelete => write!(f, "14"), - Self::AuthRequest => write!(f, "15"), - Self::AuthRequestResponse => write!(f, "16"), - Self::SyncOrganizations => write!(f, "17"), - } - } -} - -impl Default for PushType { - fn default() -> PushType { - Self::SyncCipherUpdate - } -} diff --git a/crates/bitwarden-api-api/src/models/push_update_request_model.rs b/crates/bitwarden-api-api/src/models/push_update_request_model.rs deleted file mode 100644 index 9d32b5ec1..000000000 --- a/crates/bitwarden-api-api/src/models/push_update_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PushUpdateRequestModel { - #[serde(rename = "devices")] - pub devices: Vec, - #[serde(rename = "organizationId")] - pub organization_id: String, -} - -impl PushUpdateRequestModel { - pub fn new( - devices: Vec, - organization_id: String, - ) -> PushUpdateRequestModel { - PushUpdateRequestModel { - devices, - organization_id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/request_sm_access_request_model.rs b/crates/bitwarden-api-api/src/models/request_sm_access_request_model.rs deleted file mode 100644 index 6ff8811db..000000000 --- a/crates/bitwarden-api-api/src/models/request_sm_access_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct RequestSmAccessRequestModel { - #[serde(rename = "organizationId")] - pub organization_id: uuid::Uuid, - #[serde(rename = "emailContent")] - pub email_content: String, -} - -impl RequestSmAccessRequestModel { - pub fn new(organization_id: uuid::Uuid, email_content: String) -> RequestSmAccessRequestModel { - RequestSmAccessRequestModel { - organization_id, - email_content, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/reset_password_with_org_id_request_model.rs b/crates/bitwarden-api-api/src/models/reset_password_with_org_id_request_model.rs deleted file mode 100644 index a3ce5927f..000000000 --- a/crates/bitwarden-api-api/src/models/reset_password_with_org_id_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ResetPasswordWithOrgIdRequestModel { - #[serde(rename = "resetPasswordKey", skip_serializing_if = "Option::is_none")] - pub reset_password_key: Option, - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "organizationId")] - pub organization_id: uuid::Uuid, -} - -impl ResetPasswordWithOrgIdRequestModel { - pub fn new(organization_id: uuid::Uuid) -> ResetPasswordWithOrgIdRequestModel { - ResetPasswordWithOrgIdRequestModel { - reset_password_key: None, - master_password_hash: None, - organization_id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/response_data.rs b/crates/bitwarden-api-api/src/models/response_data.rs deleted file mode 100644 index e817bd72d..000000000 --- a/crates/bitwarden-api-api/src/models/response_data.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ResponseData { - #[serde_as(as = "Option")] - #[serde(rename = "attestationObject", skip_serializing_if = "Option::is_none")] - pub attestation_object: Option>, - #[serde_as(as = "Option")] - #[serde(rename = "clientDataJSON", skip_serializing_if = "Option::is_none")] - pub client_data_json: Option>, -} - -impl ResponseData { - pub fn new() -> ResponseData { - ResponseData { - attestation_object: None, - client_data_json: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/revoke_access_tokens_request.rs b/crates/bitwarden-api-api/src/models/revoke_access_tokens_request.rs deleted file mode 100644 index a9c6c7d86..000000000 --- a/crates/bitwarden-api-api/src/models/revoke_access_tokens_request.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct RevokeAccessTokensRequest { - #[serde(rename = "ids")] - pub ids: Vec, -} - -impl RevokeAccessTokensRequest { - pub fn new(ids: Vec) -> RevokeAccessTokensRequest { - RevokeAccessTokensRequest { ids } - } -} diff --git a/crates/bitwarden-api-api/src/models/saml2_binding_type.rs b/crates/bitwarden-api-api/src/models/saml2_binding_type.rs deleted file mode 100644 index e9e970207..000000000 --- a/crates/bitwarden-api-api/src/models/saml2_binding_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum Saml2BindingType { - HttpRedirect = 1, - HttpPost = 2, -} - -impl std::fmt::Display for Saml2BindingType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::HttpRedirect => write!(f, "1"), - Self::HttpPost => write!(f, "2"), - } - } -} - -impl Default for Saml2BindingType { - fn default() -> Saml2BindingType { - Self::HttpRedirect - } -} diff --git a/crates/bitwarden-api-api/src/models/saml2_name_id_format.rs b/crates/bitwarden-api-api/src/models/saml2_name_id_format.rs deleted file mode 100644 index 00d85c949..000000000 --- a/crates/bitwarden-api-api/src/models/saml2_name_id_format.rs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum Saml2NameIdFormat { - NotConfigured = 0, - Unspecified = 1, - EmailAddress = 2, - X509SubjectName = 3, - WindowsDomainQualifiedName = 4, - KerberosPrincipalName = 5, - EntityIdentifier = 6, - Persistent = 7, - Transient = 8, -} - -impl std::fmt::Display for Saml2NameIdFormat { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::NotConfigured => write!(f, "0"), - Self::Unspecified => write!(f, "1"), - Self::EmailAddress => write!(f, "2"), - Self::X509SubjectName => write!(f, "3"), - Self::WindowsDomainQualifiedName => write!(f, "4"), - Self::KerberosPrincipalName => write!(f, "5"), - Self::EntityIdentifier => write!(f, "6"), - Self::Persistent => write!(f, "7"), - Self::Transient => write!(f, "8"), - } - } -} - -impl Default for Saml2NameIdFormat { - fn default() -> Saml2NameIdFormat { - Self::NotConfigured - } -} diff --git a/crates/bitwarden-api-api/src/models/saml2_signing_behavior.rs b/crates/bitwarden-api-api/src/models/saml2_signing_behavior.rs deleted file mode 100644 index 9bbe79a85..000000000 --- a/crates/bitwarden-api-api/src/models/saml2_signing_behavior.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum Saml2SigningBehavior { - IfIdpWantAuthnRequestsSigned = 0, - Always = 1, - Never = 3, -} - -impl std::fmt::Display for Saml2SigningBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::IfIdpWantAuthnRequestsSigned => write!(f, "0"), - Self::Always => write!(f, "1"), - Self::Never => write!(f, "3"), - } - } -} - -impl Default for Saml2SigningBehavior { - fn default() -> Saml2SigningBehavior { - Self::IfIdpWantAuthnRequestsSigned - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_access_policies_requests_model.rs b/crates/bitwarden-api-api/src/models/secret_access_policies_requests_model.rs deleted file mode 100644 index 6eaf09b36..000000000 --- a/crates/bitwarden-api-api/src/models/secret_access_policies_requests_model.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretAccessPoliciesRequestsModel { - #[serde(rename = "userAccessPolicyRequests")] - pub user_access_policy_requests: Option>, - #[serde(rename = "groupAccessPolicyRequests")] - pub group_access_policy_requests: Option>, - #[serde(rename = "serviceAccountAccessPolicyRequests")] - pub service_account_access_policy_requests: Option>, -} - -impl SecretAccessPoliciesRequestsModel { - pub fn new( - user_access_policy_requests: Option>, - group_access_policy_requests: Option>, - service_account_access_policy_requests: Option>, - ) -> SecretAccessPoliciesRequestsModel { - SecretAccessPoliciesRequestsModel { - user_access_policy_requests, - group_access_policy_requests, - service_account_access_policy_requests, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_access_policies_response_model.rs b/crates/bitwarden-api-api/src/models/secret_access_policies_response_model.rs deleted file mode 100644 index 947926ad6..000000000 --- a/crates/bitwarden-api-api/src/models/secret_access_policies_response_model.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretAccessPoliciesResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "userAccessPolicies", skip_serializing_if = "Option::is_none")] - pub user_access_policies: Option>, - #[serde( - rename = "groupAccessPolicies", - skip_serializing_if = "Option::is_none" - )] - pub group_access_policies: Option>, - #[serde( - rename = "serviceAccountAccessPolicies", - skip_serializing_if = "Option::is_none" - )] - pub service_account_access_policies: - Option>, -} - -impl SecretAccessPoliciesResponseModel { - pub fn new() -> SecretAccessPoliciesResponseModel { - SecretAccessPoliciesResponseModel { - object: None, - user_access_policies: None, - group_access_policies: None, - service_account_access_policies: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_create_request_model.rs b/crates/bitwarden-api-api/src/models/secret_create_request_model.rs deleted file mode 100644 index 91b55cceb..000000000 --- a/crates/bitwarden-api-api/src/models/secret_create_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretCreateRequestModel { - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "value")] - pub value: String, - #[serde(rename = "note")] - pub note: String, - #[serde(rename = "projectIds", skip_serializing_if = "Option::is_none")] - pub project_ids: Option>, - #[serde( - rename = "accessPoliciesRequests", - skip_serializing_if = "Option::is_none" - )] - pub access_policies_requests: Option>, -} - -impl SecretCreateRequestModel { - pub fn new(key: String, value: String, note: String) -> SecretCreateRequestModel { - SecretCreateRequestModel { - key, - value, - note, - project_ids: None, - access_policies_requests: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_response_inner_project.rs b/crates/bitwarden-api-api/src/models/secret_response_inner_project.rs deleted file mode 100644 index a123ca901..000000000 --- a/crates/bitwarden-api-api/src/models/secret_response_inner_project.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretResponseInnerProject { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, -} - -impl SecretResponseInnerProject { - pub fn new() -> SecretResponseInnerProject { - SecretResponseInnerProject { - id: None, - name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_response_model.rs b/crates/bitwarden-api-api/src/models/secret_response_model.rs deleted file mode 100644 index 04e5355b3..000000000 --- a/crates/bitwarden-api-api/src/models/secret_response_model.rs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "value", skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(rename = "note", skip_serializing_if = "Option::is_none")] - pub note: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option>, - #[serde(rename = "read", skip_serializing_if = "Option::is_none")] - pub read: Option, - #[serde(rename = "write", skip_serializing_if = "Option::is_none")] - pub write: Option, -} - -impl SecretResponseModel { - pub fn new() -> SecretResponseModel { - SecretResponseModel { - object: None, - id: None, - organization_id: None, - key: None, - value: None, - note: None, - creation_date: None, - revision_date: None, - projects: None, - read: None, - write: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_update_request_model.rs b/crates/bitwarden-api-api/src/models/secret_update_request_model.rs deleted file mode 100644 index 878fb7875..000000000 --- a/crates/bitwarden-api-api/src/models/secret_update_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretUpdateRequestModel { - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "value")] - pub value: String, - #[serde(rename = "note")] - pub note: String, - #[serde(rename = "projectIds", skip_serializing_if = "Option::is_none")] - pub project_ids: Option>, - #[serde( - rename = "accessPoliciesRequests", - skip_serializing_if = "Option::is_none" - )] - pub access_policies_requests: Option>, -} - -impl SecretUpdateRequestModel { - pub fn new(key: String, value: String, note: String) -> SecretUpdateRequestModel { - SecretUpdateRequestModel { - key, - value, - note, - project_ids: None, - access_policies_requests: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_verification_request_model.rs b/crates/bitwarden-api-api/src/models/secret_verification_request_model.rs deleted file mode 100644 index bd699deb3..000000000 --- a/crates/bitwarden-api-api/src/models/secret_verification_request_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretVerificationRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, -} - -impl SecretVerificationRequestModel { - pub fn new() -> SecretVerificationRequestModel { - SecretVerificationRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_with_projects_inner_project.rs b/crates/bitwarden-api-api/src/models/secret_with_projects_inner_project.rs deleted file mode 100644 index 453cdf8c3..000000000 --- a/crates/bitwarden-api-api/src/models/secret_with_projects_inner_project.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretWithProjectsInnerProject { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, -} - -impl SecretWithProjectsInnerProject { - pub fn new() -> SecretWithProjectsInnerProject { - SecretWithProjectsInnerProject { - id: None, - name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secret_with_projects_list_response_model.rs b/crates/bitwarden-api-api/src/models/secret_with_projects_list_response_model.rs deleted file mode 100644 index b774fa713..000000000 --- a/crates/bitwarden-api-api/src/models/secret_with_projects_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretWithProjectsListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "secrets", skip_serializing_if = "Option::is_none")] - pub secrets: Option>, - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option>, -} - -impl SecretWithProjectsListResponseModel { - pub fn new() -> SecretWithProjectsListResponseModel { - SecretWithProjectsListResponseModel { - object: None, - secrets: None, - projects: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secrets_manager_plan_features_response_model.rs b/crates/bitwarden-api-api/src/models/secrets_manager_plan_features_response_model.rs deleted file mode 100644 index 7f46723bd..000000000 --- a/crates/bitwarden-api-api/src/models/secrets_manager_plan_features_response_model.rs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretsManagerPlanFeaturesResponseModel { - #[serde(rename = "maxServiceAccounts", skip_serializing_if = "Option::is_none")] - pub max_service_accounts: Option, - #[serde( - rename = "allowServiceAccountsAutoscale", - skip_serializing_if = "Option::is_none" - )] - pub allow_service_accounts_autoscale: Option, - #[serde( - rename = "stripeServiceAccountPlanId", - skip_serializing_if = "Option::is_none" - )] - pub stripe_service_account_plan_id: Option, - #[serde( - rename = "additionalPricePerServiceAccount", - skip_serializing_if = "Option::is_none" - )] - pub additional_price_per_service_account: Option, - #[serde(rename = "baseServiceAccount", skip_serializing_if = "Option::is_none")] - pub base_service_account: Option, - #[serde( - rename = "maxAdditionalServiceAccount", - skip_serializing_if = "Option::is_none" - )] - pub max_additional_service_account: Option, - #[serde( - rename = "hasAdditionalServiceAccountOption", - skip_serializing_if = "Option::is_none" - )] - pub has_additional_service_account_option: Option, - #[serde(rename = "stripeSeatPlanId", skip_serializing_if = "Option::is_none")] - pub stripe_seat_plan_id: Option, - #[serde( - rename = "hasAdditionalSeatsOption", - skip_serializing_if = "Option::is_none" - )] - pub has_additional_seats_option: Option, - #[serde(rename = "basePrice", skip_serializing_if = "Option::is_none")] - pub base_price: Option, - #[serde(rename = "seatPrice", skip_serializing_if = "Option::is_none")] - pub seat_price: Option, - #[serde(rename = "baseSeats", skip_serializing_if = "Option::is_none")] - pub base_seats: Option, - #[serde(rename = "maxSeats", skip_serializing_if = "Option::is_none")] - pub max_seats: Option, - #[serde(rename = "maxAdditionalSeats", skip_serializing_if = "Option::is_none")] - pub max_additional_seats: Option, - #[serde(rename = "allowSeatAutoscale", skip_serializing_if = "Option::is_none")] - pub allow_seat_autoscale: Option, - #[serde(rename = "maxProjects", skip_serializing_if = "Option::is_none")] - pub max_projects: Option, -} - -impl SecretsManagerPlanFeaturesResponseModel { - pub fn new() -> SecretsManagerPlanFeaturesResponseModel { - SecretsManagerPlanFeaturesResponseModel { - max_service_accounts: None, - allow_service_accounts_autoscale: None, - stripe_service_account_plan_id: None, - additional_price_per_service_account: None, - base_service_account: None, - max_additional_service_account: None, - has_additional_service_account_option: None, - stripe_seat_plan_id: None, - has_additional_seats_option: None, - base_price: None, - seat_price: None, - base_seats: None, - max_seats: None, - max_additional_seats: None, - allow_seat_autoscale: None, - max_projects: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secrets_manager_subscribe_request_model.rs b/crates/bitwarden-api-api/src/models/secrets_manager_subscribe_request_model.rs deleted file mode 100644 index 45861e984..000000000 --- a/crates/bitwarden-api-api/src/models/secrets_manager_subscribe_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretsManagerSubscribeRequestModel { - #[serde(rename = "additionalSmSeats")] - pub additional_sm_seats: i32, - #[serde(rename = "additionalServiceAccounts")] - pub additional_service_accounts: i32, -} - -impl SecretsManagerSubscribeRequestModel { - pub fn new( - additional_sm_seats: i32, - additional_service_accounts: i32, - ) -> SecretsManagerSubscribeRequestModel { - SecretsManagerSubscribeRequestModel { - additional_sm_seats, - additional_service_accounts, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secrets_manager_subscription_update_request_model.rs b/crates/bitwarden-api-api/src/models/secrets_manager_subscription_update_request_model.rs deleted file mode 100644 index 346c7e4eb..000000000 --- a/crates/bitwarden-api-api/src/models/secrets_manager_subscription_update_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretsManagerSubscriptionUpdateRequestModel { - #[serde(rename = "seatAdjustment")] - pub seat_adjustment: i32, - #[serde(rename = "maxAutoscaleSeats", skip_serializing_if = "Option::is_none")] - pub max_autoscale_seats: Option, - #[serde( - rename = "serviceAccountAdjustment", - skip_serializing_if = "Option::is_none" - )] - pub service_account_adjustment: Option, - #[serde( - rename = "maxAutoscaleServiceAccounts", - skip_serializing_if = "Option::is_none" - )] - pub max_autoscale_service_accounts: Option, -} - -impl SecretsManagerSubscriptionUpdateRequestModel { - pub fn new(seat_adjustment: i32) -> SecretsManagerSubscriptionUpdateRequestModel { - SecretsManagerSubscriptionUpdateRequestModel { - seat_adjustment, - max_autoscale_seats: None, - service_account_adjustment: None, - max_autoscale_service_accounts: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secrets_sync_response_model.rs b/crates/bitwarden-api-api/src/models/secrets_sync_response_model.rs deleted file mode 100644 index 23efafa1d..000000000 --- a/crates/bitwarden-api-api/src/models/secrets_sync_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretsSyncResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "hasChanges", skip_serializing_if = "Option::is_none")] - pub has_changes: Option, - #[serde(rename = "secrets", skip_serializing_if = "Option::is_none")] - pub secrets: Option>, -} - -impl SecretsSyncResponseModel { - pub fn new() -> SecretsSyncResponseModel { - SecretsSyncResponseModel { - object: None, - has_changes: None, - secrets: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secrets_with_projects_inner_secret.rs b/crates/bitwarden-api-api/src/models/secrets_with_projects_inner_secret.rs deleted file mode 100644 index a97fa1b54..000000000 --- a/crates/bitwarden-api-api/src/models/secrets_with_projects_inner_secret.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SecretsWithProjectsInnerSecret { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option>, - #[serde(rename = "read", skip_serializing_if = "Option::is_none")] - pub read: Option, - #[serde(rename = "write", skip_serializing_if = "Option::is_none")] - pub write: Option, -} - -impl SecretsWithProjectsInnerSecret { - pub fn new() -> SecretsWithProjectsInnerSecret { - SecretsWithProjectsInnerSecret { - id: None, - organization_id: None, - key: None, - creation_date: None, - revision_date: None, - projects: None, - read: None, - write: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/secure_note_type.rs b/crates/bitwarden-api-api/src/models/secure_note_type.rs deleted file mode 100644 index 8807b3517..000000000 --- a/crates/bitwarden-api-api/src/models/secure_note_type.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum SecureNoteType { - Generic = 0, -} - -impl std::fmt::Display for SecureNoteType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Generic => write!(f, "0"), - } - } -} - -impl Default for SecureNoteType { - fn default() -> SecureNoteType { - Self::Generic - } -} diff --git a/crates/bitwarden-api-api/src/models/selection_read_only_request_model.rs b/crates/bitwarden-api-api/src/models/selection_read_only_request_model.rs deleted file mode 100644 index 937bcbd1a..000000000 --- a/crates/bitwarden-api-api/src/models/selection_read_only_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SelectionReadOnlyRequestModel { - #[serde(rename = "id")] - pub id: uuid::Uuid, - #[serde(rename = "readOnly", skip_serializing_if = "Option::is_none")] - pub read_only: Option, - #[serde(rename = "hidePasswords", skip_serializing_if = "Option::is_none")] - pub hide_passwords: Option, - #[serde(rename = "manage", skip_serializing_if = "Option::is_none")] - pub manage: Option, -} - -impl SelectionReadOnlyRequestModel { - pub fn new(id: uuid::Uuid) -> SelectionReadOnlyRequestModel { - SelectionReadOnlyRequestModel { - id, - read_only: None, - hide_passwords: None, - manage: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/selection_read_only_response_model.rs b/crates/bitwarden-api-api/src/models/selection_read_only_response_model.rs deleted file mode 100644 index 6b269613b..000000000 --- a/crates/bitwarden-api-api/src/models/selection_read_only_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SelectionReadOnlyResponseModel { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "readOnly", skip_serializing_if = "Option::is_none")] - pub read_only: Option, - #[serde(rename = "hidePasswords", skip_serializing_if = "Option::is_none")] - pub hide_passwords: Option, - #[serde(rename = "manage", skip_serializing_if = "Option::is_none")] - pub manage: Option, -} - -impl SelectionReadOnlyResponseModel { - pub fn new() -> SelectionReadOnlyResponseModel { - SelectionReadOnlyResponseModel { - id: None, - read_only: None, - hide_passwords: None, - manage: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/self_hosted_organization_license_request_model.rs b/crates/bitwarden-api-api/src/models/self_hosted_organization_license_request_model.rs deleted file mode 100644 index afae19028..000000000 --- a/crates/bitwarden-api-api/src/models/self_hosted_organization_license_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SelfHostedOrganizationLicenseRequestModel { - #[serde(rename = "licenseKey", skip_serializing_if = "Option::is_none")] - pub license_key: Option, - #[serde(rename = "billingSyncKey", skip_serializing_if = "Option::is_none")] - pub billing_sync_key: Option, -} - -impl SelfHostedOrganizationLicenseRequestModel { - pub fn new() -> SelfHostedOrganizationLicenseRequestModel { - SelfHostedOrganizationLicenseRequestModel { - license_key: None, - billing_sync_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_access_request_model.rs b/crates/bitwarden-api-api/src/models/send_access_request_model.rs deleted file mode 100644 index 8fc407a4e..000000000 --- a/crates/bitwarden-api-api/src/models/send_access_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendAccessRequestModel { - #[serde(rename = "password", skip_serializing_if = "Option::is_none")] - pub password: Option, -} - -impl SendAccessRequestModel { - pub fn new() -> SendAccessRequestModel { - SendAccessRequestModel { password: None } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_file_model.rs b/crates/bitwarden-api-api/src/models/send_file_model.rs deleted file mode 100644 index a2d799d7b..000000000 --- a/crates/bitwarden-api-api/src/models/send_file_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendFileModel { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "fileName", skip_serializing_if = "Option::is_none")] - pub file_name: Option, - #[serde(rename = "size", skip_serializing_if = "Option::is_none")] - pub size: Option, - #[serde(rename = "sizeName", skip_serializing_if = "Option::is_none")] - pub size_name: Option, -} - -impl SendFileModel { - pub fn new() -> SendFileModel { - SendFileModel { - id: None, - file_name: None, - size: None, - size_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_file_upload_data_response_model.rs b/crates/bitwarden-api-api/src/models/send_file_upload_data_response_model.rs deleted file mode 100644 index ecfda00b2..000000000 --- a/crates/bitwarden-api-api/src/models/send_file_upload_data_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendFileUploadDataResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "url", skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(rename = "fileUploadType", skip_serializing_if = "Option::is_none")] - pub file_upload_type: Option, - #[serde(rename = "sendResponse", skip_serializing_if = "Option::is_none")] - pub send_response: Option>, -} - -impl SendFileUploadDataResponseModel { - pub fn new() -> SendFileUploadDataResponseModel { - SendFileUploadDataResponseModel { - object: None, - url: None, - file_upload_type: None, - send_response: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_request_model.rs b/crates/bitwarden-api-api/src/models/send_request_model.rs deleted file mode 100644 index 4fee2b8d4..000000000 --- a/crates/bitwarden-api-api/src/models/send_request_model.rs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendRequestModel { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "fileLength", skip_serializing_if = "Option::is_none")] - pub file_length: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "maxAccessCount", skip_serializing_if = "Option::is_none")] - pub max_access_count: Option, - #[serde(rename = "expirationDate", skip_serializing_if = "Option::is_none")] - pub expiration_date: Option, - #[serde(rename = "deletionDate")] - pub deletion_date: String, - #[serde(rename = "file", skip_serializing_if = "Option::is_none")] - pub file: Option>, - #[serde(rename = "text", skip_serializing_if = "Option::is_none")] - pub text: Option>, - #[serde(rename = "password", skip_serializing_if = "Option::is_none")] - pub password: Option, - #[serde(rename = "disabled")] - pub disabled: bool, - #[serde(rename = "hideEmail", skip_serializing_if = "Option::is_none")] - pub hide_email: Option, -} - -impl SendRequestModel { - pub fn new(key: String, deletion_date: String, disabled: bool) -> SendRequestModel { - SendRequestModel { - r#type: None, - file_length: None, - name: None, - notes: None, - key, - max_access_count: None, - expiration_date: None, - deletion_date, - file: None, - text: None, - password: None, - disabled, - hide_email: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_response_model.rs b/crates/bitwarden-api-api/src/models/send_response_model.rs deleted file mode 100644 index 34c6a71a7..000000000 --- a/crates/bitwarden-api-api/src/models/send_response_model.rs +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "accessId", skip_serializing_if = "Option::is_none")] - pub access_id: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "file", skip_serializing_if = "Option::is_none")] - pub file: Option>, - #[serde(rename = "text", skip_serializing_if = "Option::is_none")] - pub text: Option>, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "maxAccessCount", skip_serializing_if = "Option::is_none")] - pub max_access_count: Option, - #[serde(rename = "accessCount", skip_serializing_if = "Option::is_none")] - pub access_count: Option, - #[serde(rename = "password", skip_serializing_if = "Option::is_none")] - pub password: Option, - #[serde(rename = "disabled", skip_serializing_if = "Option::is_none")] - pub disabled: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "expirationDate", skip_serializing_if = "Option::is_none")] - pub expiration_date: Option, - #[serde(rename = "deletionDate", skip_serializing_if = "Option::is_none")] - pub deletion_date: Option, - #[serde(rename = "hideEmail", skip_serializing_if = "Option::is_none")] - pub hide_email: Option, -} - -impl SendResponseModel { - pub fn new() -> SendResponseModel { - SendResponseModel { - object: None, - id: None, - access_id: None, - r#type: None, - name: None, - notes: None, - file: None, - text: None, - key: None, - max_access_count: None, - access_count: None, - password: None, - disabled: None, - revision_date: None, - expiration_date: None, - deletion_date: None, - hide_email: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/send_response_model_list_response_model.rs deleted file mode 100644 index a2caa2205..000000000 --- a/crates/bitwarden-api-api/src/models/send_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl SendResponseModelListResponseModel { - pub fn new() -> SendResponseModelListResponseModel { - SendResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_text_model.rs b/crates/bitwarden-api-api/src/models/send_text_model.rs deleted file mode 100644 index e53dfe2d7..000000000 --- a/crates/bitwarden-api-api/src/models/send_text_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendTextModel { - #[serde(rename = "text", skip_serializing_if = "Option::is_none")] - pub text: Option, - #[serde(rename = "hidden", skip_serializing_if = "Option::is_none")] - pub hidden: Option, -} - -impl SendTextModel { - pub fn new() -> SendTextModel { - SendTextModel { - text: None, - hidden: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/send_type.rs b/crates/bitwarden-api-api/src/models/send_type.rs deleted file mode 100644 index 6568eb315..000000000 --- a/crates/bitwarden-api-api/src/models/send_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum SendType { - Text = 0, - File = 1, -} - -impl std::fmt::Display for SendType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Text => write!(f, "0"), - Self::File => write!(f, "1"), - } - } -} - -impl Default for SendType { - fn default() -> SendType { - Self::Text - } -} diff --git a/crates/bitwarden-api-api/src/models/send_with_id_request_model.rs b/crates/bitwarden-api-api/src/models/send_with_id_request_model.rs deleted file mode 100644 index 3ade1b0d3..000000000 --- a/crates/bitwarden-api-api/src/models/send_with_id_request_model.rs +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SendWithIdRequestModel { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde(rename = "fileLength", skip_serializing_if = "Option::is_none")] - pub file_length: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "notes", skip_serializing_if = "Option::is_none")] - pub notes: Option, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "maxAccessCount", skip_serializing_if = "Option::is_none")] - pub max_access_count: Option, - #[serde(rename = "expirationDate", skip_serializing_if = "Option::is_none")] - pub expiration_date: Option, - #[serde(rename = "deletionDate")] - pub deletion_date: String, - #[serde(rename = "file", skip_serializing_if = "Option::is_none")] - pub file: Option>, - #[serde(rename = "text", skip_serializing_if = "Option::is_none")] - pub text: Option>, - #[serde(rename = "password", skip_serializing_if = "Option::is_none")] - pub password: Option, - #[serde(rename = "disabled")] - pub disabled: bool, - #[serde(rename = "hideEmail", skip_serializing_if = "Option::is_none")] - pub hide_email: Option, - #[serde(rename = "id")] - pub id: uuid::Uuid, -} - -impl SendWithIdRequestModel { - pub fn new( - key: String, - deletion_date: String, - disabled: bool, - id: uuid::Uuid, - ) -> SendWithIdRequestModel { - SendWithIdRequestModel { - r#type: None, - file_length: None, - name: None, - notes: None, - key, - max_access_count: None, - expiration_date: None, - deletion_date, - file: None, - text: None, - password: None, - disabled, - hide_email: None, - id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/server_config_response_model.rs b/crates/bitwarden-api-api/src/models/server_config_response_model.rs deleted file mode 100644 index 61d916de7..000000000 --- a/crates/bitwarden-api-api/src/models/server_config_response_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServerConfigResponseModel { - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "url", skip_serializing_if = "Option::is_none")] - pub url: Option, -} - -impl ServerConfigResponseModel { - pub fn new() -> ServerConfigResponseModel { - ServerConfigResponseModel { - name: None, - url: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_access_policy_response_model.rs b/crates/bitwarden-api-api/src/models/service_account_access_policy_response_model.rs deleted file mode 100644 index 5418235f6..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_access_policy_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountAccessPolicyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "read", skip_serializing_if = "Option::is_none")] - pub read: Option, - #[serde(rename = "write", skip_serializing_if = "Option::is_none")] - pub write: Option, - #[serde(rename = "serviceAccountId", skip_serializing_if = "Option::is_none")] - pub service_account_id: Option, - #[serde(rename = "serviceAccountName", skip_serializing_if = "Option::is_none")] - pub service_account_name: Option, -} - -impl ServiceAccountAccessPolicyResponseModel { - pub fn new() -> ServiceAccountAccessPolicyResponseModel { - ServiceAccountAccessPolicyResponseModel { - object: None, - read: None, - write: None, - service_account_id: None, - service_account_name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_counts_response_model.rs b/crates/bitwarden-api-api/src/models/service_account_counts_response_model.rs deleted file mode 100644 index fd382406e..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_counts_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountCountsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option, - #[serde(rename = "people", skip_serializing_if = "Option::is_none")] - pub people: Option, - #[serde(rename = "accessTokens", skip_serializing_if = "Option::is_none")] - pub access_tokens: Option, -} - -impl ServiceAccountCountsResponseModel { - pub fn new() -> ServiceAccountCountsResponseModel { - ServiceAccountCountsResponseModel { - object: None, - projects: None, - people: None, - access_tokens: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_create_request_model.rs b/crates/bitwarden-api-api/src/models/service_account_create_request_model.rs deleted file mode 100644 index d90ba46cd..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_create_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountCreateRequestModel { - #[serde(rename = "name")] - pub name: String, -} - -impl ServiceAccountCreateRequestModel { - pub fn new(name: String) -> ServiceAccountCreateRequestModel { - ServiceAccountCreateRequestModel { name } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_granted_policies_permission_details_response_model.rs b/crates/bitwarden-api-api/src/models/service_account_granted_policies_permission_details_response_model.rs deleted file mode 100644 index 8d7458867..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_granted_policies_permission_details_response_model.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountGrantedPoliciesPermissionDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde( - rename = "grantedProjectPolicies", - skip_serializing_if = "Option::is_none" - )] - pub granted_project_policies: - Option>, -} - -impl ServiceAccountGrantedPoliciesPermissionDetailsResponseModel { - pub fn new() -> ServiceAccountGrantedPoliciesPermissionDetailsResponseModel { - ServiceAccountGrantedPoliciesPermissionDetailsResponseModel { - object: None, - granted_project_policies: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_granted_policies_request_model.rs b/crates/bitwarden-api-api/src/models/service_account_granted_policies_request_model.rs deleted file mode 100644 index 7fe6a0d26..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_granted_policies_request_model.rs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountGrantedPoliciesRequestModel { - #[serde(rename = "projectGrantedPolicyRequests")] - pub project_granted_policy_requests: Option>, -} - -impl ServiceAccountGrantedPoliciesRequestModel { - pub fn new( - project_granted_policy_requests: Option>, - ) -> ServiceAccountGrantedPoliciesRequestModel { - ServiceAccountGrantedPoliciesRequestModel { - project_granted_policy_requests, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_people_access_policies_response_model.rs b/crates/bitwarden-api-api/src/models/service_account_people_access_policies_response_model.rs deleted file mode 100644 index affba169a..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_people_access_policies_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountPeopleAccessPoliciesResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "userAccessPolicies", skip_serializing_if = "Option::is_none")] - pub user_access_policies: Option>, - #[serde( - rename = "groupAccessPolicies", - skip_serializing_if = "Option::is_none" - )] - pub group_access_policies: Option>, -} - -impl ServiceAccountPeopleAccessPoliciesResponseModel { - pub fn new() -> ServiceAccountPeopleAccessPoliciesResponseModel { - ServiceAccountPeopleAccessPoliciesResponseModel { - object: None, - user_access_policies: None, - group_access_policies: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_response_model.rs b/crates/bitwarden-api-api/src/models/service_account_response_model.rs deleted file mode 100644 index 4b2d3d3e8..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, -} - -impl ServiceAccountResponseModel { - pub fn new() -> ServiceAccountResponseModel { - ServiceAccountResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - creation_date: None, - revision_date: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model.rs b/crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model.rs deleted file mode 100644 index 0c3c6460a..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountSecretsDetailsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")] - pub organization_id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")] - pub creation_date: Option, - #[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")] - pub revision_date: Option, - #[serde(rename = "accessToSecrets", skip_serializing_if = "Option::is_none")] - pub access_to_secrets: Option, -} - -impl ServiceAccountSecretsDetailsResponseModel { - pub fn new() -> ServiceAccountSecretsDetailsResponseModel { - ServiceAccountSecretsDetailsResponseModel { - object: None, - id: None, - organization_id: None, - name: None, - creation_date: None, - revision_date: None, - access_to_secrets: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model_list_response_model.rs deleted file mode 100644 index ffe4a5cf2..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_secrets_details_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountSecretsDetailsResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl ServiceAccountSecretsDetailsResponseModelListResponseModel { - pub fn new() -> ServiceAccountSecretsDetailsResponseModelListResponseModel { - ServiceAccountSecretsDetailsResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/service_account_update_request_model.rs b/crates/bitwarden-api-api/src/models/service_account_update_request_model.rs deleted file mode 100644 index 968bc7a7e..000000000 --- a/crates/bitwarden-api-api/src/models/service_account_update_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServiceAccountUpdateRequestModel { - #[serde(rename = "name")] - pub name: String, -} - -impl ServiceAccountUpdateRequestModel { - pub fn new(name: String) -> ServiceAccountUpdateRequestModel { - ServiceAccountUpdateRequestModel { name } - } -} diff --git a/crates/bitwarden-api-api/src/models/set_key_connector_key_request_model.rs b/crates/bitwarden-api-api/src/models/set_key_connector_key_request_model.rs deleted file mode 100644 index d3a1ee448..000000000 --- a/crates/bitwarden-api-api/src/models/set_key_connector_key_request_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SetKeyConnectorKeyRequestModel { - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "keys")] - pub keys: Box, - #[serde(rename = "kdf")] - pub kdf: models::KdfType, - #[serde(rename = "kdfIterations")] - pub kdf_iterations: i32, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, - #[serde(rename = "orgIdentifier")] - pub org_identifier: String, -} - -impl SetKeyConnectorKeyRequestModel { - pub fn new( - key: String, - keys: models::KeysRequestModel, - kdf: models::KdfType, - kdf_iterations: i32, - org_identifier: String, - ) -> SetKeyConnectorKeyRequestModel { - SetKeyConnectorKeyRequestModel { - key, - keys: Box::new(keys), - kdf, - kdf_iterations, - kdf_memory: None, - kdf_parallelism: None, - org_identifier, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/set_password_request_model.rs b/crates/bitwarden-api-api/src/models/set_password_request_model.rs deleted file mode 100644 index daf250417..000000000 --- a/crates/bitwarden-api-api/src/models/set_password_request_model.rs +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SetPasswordRequestModel { - #[serde(rename = "masterPasswordHash")] - pub master_password_hash: String, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, - #[serde(rename = "keys", skip_serializing_if = "Option::is_none")] - pub keys: Option>, - #[serde(rename = "kdf")] - pub kdf: models::KdfType, - #[serde(rename = "kdfIterations")] - pub kdf_iterations: i32, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, - #[serde(rename = "orgIdentifier", skip_serializing_if = "Option::is_none")] - pub org_identifier: Option, -} - -impl SetPasswordRequestModel { - pub fn new( - master_password_hash: String, - key: String, - kdf: models::KdfType, - kdf_iterations: i32, - ) -> SetPasswordRequestModel { - SetPasswordRequestModel { - master_password_hash, - key, - master_password_hint: None, - keys: None, - kdf, - kdf_iterations, - kdf_memory: None, - kdf_parallelism: None, - org_identifier: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/sm_export_response_model.rs b/crates/bitwarden-api-api/src/models/sm_export_response_model.rs deleted file mode 100644 index e13d1a507..000000000 --- a/crates/bitwarden-api-api/src/models/sm_export_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SmExportResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option>, - #[serde(rename = "secrets", skip_serializing_if = "Option::is_none")] - pub secrets: Option>, -} - -impl SmExportResponseModel { - pub fn new() -> SmExportResponseModel { - SmExportResponseModel { - object: None, - projects: None, - secrets: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/sm_import_request_model.rs b/crates/bitwarden-api-api/src/models/sm_import_request_model.rs deleted file mode 100644 index 1a73c368d..000000000 --- a/crates/bitwarden-api-api/src/models/sm_import_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SmImportRequestModel { - #[serde(rename = "projects", skip_serializing_if = "Option::is_none")] - pub projects: Option>, - #[serde(rename = "secrets", skip_serializing_if = "Option::is_none")] - pub secrets: Option>, -} - -impl SmImportRequestModel { - pub fn new() -> SmImportRequestModel { - SmImportRequestModel { - projects: None, - secrets: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/sso_configuration_data.rs b/crates/bitwarden-api-api/src/models/sso_configuration_data.rs deleted file mode 100644 index 8bb1f3895..000000000 --- a/crates/bitwarden-api-api/src/models/sso_configuration_data.rs +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SsoConfigurationData { - #[serde(rename = "configType", skip_serializing_if = "Option::is_none")] - pub config_type: Option, - #[serde( - rename = "memberDecryptionType", - skip_serializing_if = "Option::is_none" - )] - pub member_decryption_type: Option, - /// Legacy property to determine if KeyConnector was enabled. Kept for backwards compatibility - /// with old configs that will not have the new - /// Bit.Core.Auth.Models.Data.SsoConfigurationData.MemberDecryptionType when deserialized from - /// the database. - #[serde( - rename = "keyConnectorEnabled", - skip_serializing_if = "Option::is_none" - )] - pub key_connector_enabled: Option, - #[serde(rename = "keyConnectorUrl", skip_serializing_if = "Option::is_none")] - pub key_connector_url: Option, - #[serde(rename = "authority", skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(rename = "clientSecret", skip_serializing_if = "Option::is_none")] - pub client_secret: Option, - #[serde(rename = "metadataAddress", skip_serializing_if = "Option::is_none")] - pub metadata_address: Option, - #[serde(rename = "redirectBehavior", skip_serializing_if = "Option::is_none")] - pub redirect_behavior: Option, - #[serde( - rename = "getClaimsFromUserInfoEndpoint", - skip_serializing_if = "Option::is_none" - )] - pub get_claims_from_user_info_endpoint: Option, - #[serde(rename = "additionalScopes", skip_serializing_if = "Option::is_none")] - pub additional_scopes: Option, - #[serde( - rename = "additionalUserIdClaimTypes", - skip_serializing_if = "Option::is_none" - )] - pub additional_user_id_claim_types: Option, - #[serde( - rename = "additionalEmailClaimTypes", - skip_serializing_if = "Option::is_none" - )] - pub additional_email_claim_types: Option, - #[serde( - rename = "additionalNameClaimTypes", - skip_serializing_if = "Option::is_none" - )] - pub additional_name_claim_types: Option, - #[serde(rename = "acrValues", skip_serializing_if = "Option::is_none")] - pub acr_values: Option, - #[serde( - rename = "expectedReturnAcrValue", - skip_serializing_if = "Option::is_none" - )] - pub expected_return_acr_value: Option, - #[serde(rename = "idpEntityId", skip_serializing_if = "Option::is_none")] - pub idp_entity_id: Option, - #[serde( - rename = "idpSingleSignOnServiceUrl", - skip_serializing_if = "Option::is_none" - )] - pub idp_single_sign_on_service_url: Option, - #[serde( - rename = "idpSingleLogoutServiceUrl", - skip_serializing_if = "Option::is_none" - )] - pub idp_single_logout_service_url: Option, - #[serde(rename = "idpX509PublicCert", skip_serializing_if = "Option::is_none")] - pub idp_x509_public_cert: Option, - #[serde(rename = "idpBindingType", skip_serializing_if = "Option::is_none")] - pub idp_binding_type: Option, - #[serde( - rename = "idpAllowUnsolicitedAuthnResponse", - skip_serializing_if = "Option::is_none" - )] - pub idp_allow_unsolicited_authn_response: Option, - #[serde( - rename = "idpArtifactResolutionServiceUrl", - skip_serializing_if = "Option::is_none" - )] - pub idp_artifact_resolution_service_url: Option, - #[serde( - rename = "idpDisableOutboundLogoutRequests", - skip_serializing_if = "Option::is_none" - )] - pub idp_disable_outbound_logout_requests: Option, - #[serde( - rename = "idpOutboundSigningAlgorithm", - skip_serializing_if = "Option::is_none" - )] - pub idp_outbound_signing_algorithm: Option, - #[serde( - rename = "idpWantAuthnRequestsSigned", - skip_serializing_if = "Option::is_none" - )] - pub idp_want_authn_requests_signed: Option, - #[serde(rename = "spUniqueEntityId", skip_serializing_if = "Option::is_none")] - pub sp_unique_entity_id: Option, - #[serde(rename = "spNameIdFormat", skip_serializing_if = "Option::is_none")] - pub sp_name_id_format: Option, - #[serde( - rename = "spOutboundSigningAlgorithm", - skip_serializing_if = "Option::is_none" - )] - pub sp_outbound_signing_algorithm: Option, - #[serde(rename = "spSigningBehavior", skip_serializing_if = "Option::is_none")] - pub sp_signing_behavior: Option, - #[serde( - rename = "spWantAssertionsSigned", - skip_serializing_if = "Option::is_none" - )] - pub sp_want_assertions_signed: Option, - #[serde( - rename = "spValidateCertificates", - skip_serializing_if = "Option::is_none" - )] - pub sp_validate_certificates: Option, - #[serde( - rename = "spMinIncomingSigningAlgorithm", - skip_serializing_if = "Option::is_none" - )] - pub sp_min_incoming_signing_algorithm: Option, -} - -impl SsoConfigurationData { - pub fn new() -> SsoConfigurationData { - SsoConfigurationData { - config_type: None, - member_decryption_type: None, - key_connector_enabled: None, - key_connector_url: None, - authority: None, - client_id: None, - client_secret: None, - metadata_address: None, - redirect_behavior: None, - get_claims_from_user_info_endpoint: None, - additional_scopes: None, - additional_user_id_claim_types: None, - additional_email_claim_types: None, - additional_name_claim_types: None, - acr_values: None, - expected_return_acr_value: None, - idp_entity_id: None, - idp_single_sign_on_service_url: None, - idp_single_logout_service_url: None, - idp_x509_public_cert: None, - idp_binding_type: None, - idp_allow_unsolicited_authn_response: None, - idp_artifact_resolution_service_url: None, - idp_disable_outbound_logout_requests: None, - idp_outbound_signing_algorithm: None, - idp_want_authn_requests_signed: None, - sp_unique_entity_id: None, - sp_name_id_format: None, - sp_outbound_signing_algorithm: None, - sp_signing_behavior: None, - sp_want_assertions_signed: None, - sp_validate_certificates: None, - sp_min_incoming_signing_algorithm: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/sso_configuration_data_request.rs b/crates/bitwarden-api-api/src/models/sso_configuration_data_request.rs deleted file mode 100644 index b1f3392c2..000000000 --- a/crates/bitwarden-api-api/src/models/sso_configuration_data_request.rs +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SsoConfigurationDataRequest { - #[serde(rename = "configType")] - pub config_type: models::SsoType, - #[serde( - rename = "memberDecryptionType", - skip_serializing_if = "Option::is_none" - )] - pub member_decryption_type: Option, - #[serde( - rename = "keyConnectorEnabled", - skip_serializing_if = "Option::is_none" - )] - pub key_connector_enabled: Option, - #[serde(rename = "keyConnectorUrl", skip_serializing_if = "Option::is_none")] - pub key_connector_url: Option, - #[serde(rename = "authority", skip_serializing_if = "Option::is_none")] - pub authority: Option, - #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(rename = "clientSecret", skip_serializing_if = "Option::is_none")] - pub client_secret: Option, - #[serde(rename = "metadataAddress", skip_serializing_if = "Option::is_none")] - pub metadata_address: Option, - #[serde(rename = "redirectBehavior", skip_serializing_if = "Option::is_none")] - pub redirect_behavior: Option, - #[serde( - rename = "getClaimsFromUserInfoEndpoint", - skip_serializing_if = "Option::is_none" - )] - pub get_claims_from_user_info_endpoint: Option, - #[serde(rename = "additionalScopes", skip_serializing_if = "Option::is_none")] - pub additional_scopes: Option, - #[serde( - rename = "additionalUserIdClaimTypes", - skip_serializing_if = "Option::is_none" - )] - pub additional_user_id_claim_types: Option, - #[serde( - rename = "additionalEmailClaimTypes", - skip_serializing_if = "Option::is_none" - )] - pub additional_email_claim_types: Option, - #[serde( - rename = "additionalNameClaimTypes", - skip_serializing_if = "Option::is_none" - )] - pub additional_name_claim_types: Option, - #[serde(rename = "acrValues", skip_serializing_if = "Option::is_none")] - pub acr_values: Option, - #[serde( - rename = "expectedReturnAcrValue", - skip_serializing_if = "Option::is_none" - )] - pub expected_return_acr_value: Option, - #[serde(rename = "spUniqueEntityId", skip_serializing_if = "Option::is_none")] - pub sp_unique_entity_id: Option, - #[serde(rename = "spNameIdFormat", skip_serializing_if = "Option::is_none")] - pub sp_name_id_format: Option, - #[serde( - rename = "spOutboundSigningAlgorithm", - skip_serializing_if = "Option::is_none" - )] - pub sp_outbound_signing_algorithm: Option, - #[serde(rename = "spSigningBehavior", skip_serializing_if = "Option::is_none")] - pub sp_signing_behavior: Option, - #[serde( - rename = "spWantAssertionsSigned", - skip_serializing_if = "Option::is_none" - )] - pub sp_want_assertions_signed: Option, - #[serde( - rename = "spValidateCertificates", - skip_serializing_if = "Option::is_none" - )] - pub sp_validate_certificates: Option, - #[serde( - rename = "spMinIncomingSigningAlgorithm", - skip_serializing_if = "Option::is_none" - )] - pub sp_min_incoming_signing_algorithm: Option, - #[serde(rename = "idpEntityId", skip_serializing_if = "Option::is_none")] - pub idp_entity_id: Option, - #[serde(rename = "idpBindingType", skip_serializing_if = "Option::is_none")] - pub idp_binding_type: Option, - #[serde( - rename = "idpSingleSignOnServiceUrl", - skip_serializing_if = "Option::is_none" - )] - pub idp_single_sign_on_service_url: Option, - #[serde( - rename = "idpSingleLogoutServiceUrl", - skip_serializing_if = "Option::is_none" - )] - pub idp_single_logout_service_url: Option, - #[serde( - rename = "idpArtifactResolutionServiceUrl", - skip_serializing_if = "Option::is_none" - )] - pub idp_artifact_resolution_service_url: Option, - #[serde(rename = "idpX509PublicCert", skip_serializing_if = "Option::is_none")] - pub idp_x509_public_cert: Option, - #[serde( - rename = "idpOutboundSigningAlgorithm", - skip_serializing_if = "Option::is_none" - )] - pub idp_outbound_signing_algorithm: Option, - #[serde( - rename = "idpAllowUnsolicitedAuthnResponse", - skip_serializing_if = "Option::is_none" - )] - pub idp_allow_unsolicited_authn_response: Option, - #[serde( - rename = "idpDisableOutboundLogoutRequests", - skip_serializing_if = "Option::is_none" - )] - pub idp_disable_outbound_logout_requests: Option, - #[serde( - rename = "idpWantAuthnRequestsSigned", - skip_serializing_if = "Option::is_none" - )] - pub idp_want_authn_requests_signed: Option, -} - -impl SsoConfigurationDataRequest { - pub fn new(config_type: models::SsoType) -> SsoConfigurationDataRequest { - SsoConfigurationDataRequest { - config_type, - member_decryption_type: None, - key_connector_enabled: None, - key_connector_url: None, - authority: None, - client_id: None, - client_secret: None, - metadata_address: None, - redirect_behavior: None, - get_claims_from_user_info_endpoint: None, - additional_scopes: None, - additional_user_id_claim_types: None, - additional_email_claim_types: None, - additional_name_claim_types: None, - acr_values: None, - expected_return_acr_value: None, - sp_unique_entity_id: None, - sp_name_id_format: None, - sp_outbound_signing_algorithm: None, - sp_signing_behavior: None, - sp_want_assertions_signed: None, - sp_validate_certificates: None, - sp_min_incoming_signing_algorithm: None, - idp_entity_id: None, - idp_binding_type: None, - idp_single_sign_on_service_url: None, - idp_single_logout_service_url: None, - idp_artifact_resolution_service_url: None, - idp_x509_public_cert: None, - idp_outbound_signing_algorithm: None, - idp_allow_unsolicited_authn_response: None, - idp_disable_outbound_logout_requests: None, - idp_want_authn_requests_signed: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/sso_type.rs b/crates/bitwarden-api-api/src/models/sso_type.rs deleted file mode 100644 index b7c4b3611..000000000 --- a/crates/bitwarden-api-api/src/models/sso_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum SsoType { - OpenIdConnect = 1, - Saml2 = 2, -} - -impl std::fmt::Display for SsoType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::OpenIdConnect => write!(f, "1"), - Self::Saml2 => write!(f, "2"), - } - } -} - -impl Default for SsoType { - fn default() -> SsoType { - Self::OpenIdConnect - } -} diff --git a/crates/bitwarden-api-api/src/models/sso_urls.rs b/crates/bitwarden-api-api/src/models/sso_urls.rs deleted file mode 100644 index e75495b76..000000000 --- a/crates/bitwarden-api-api/src/models/sso_urls.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SsoUrls { - #[serde(rename = "callbackPath", skip_serializing_if = "Option::is_none")] - pub callback_path: Option, - #[serde( - rename = "signedOutCallbackPath", - skip_serializing_if = "Option::is_none" - )] - pub signed_out_callback_path: Option, - #[serde(rename = "spEntityId", skip_serializing_if = "Option::is_none")] - pub sp_entity_id: Option, - #[serde(rename = "spEntityIdStatic", skip_serializing_if = "Option::is_none")] - pub sp_entity_id_static: Option, - #[serde(rename = "spMetadataUrl", skip_serializing_if = "Option::is_none")] - pub sp_metadata_url: Option, - #[serde(rename = "spAcsUrl", skip_serializing_if = "Option::is_none")] - pub sp_acs_url: Option, -} - -impl SsoUrls { - pub fn new() -> SsoUrls { - SsoUrls { - callback_path: None, - signed_out_callback_path: None, - sp_entity_id: None, - sp_entity_id_static: None, - sp_metadata_url: None, - sp_acs_url: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/storage_request_model.rs b/crates/bitwarden-api-api/src/models/storage_request_model.rs deleted file mode 100644 index a4c940357..000000000 --- a/crates/bitwarden-api-api/src/models/storage_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct StorageRequestModel { - #[serde(rename = "storageGbAdjustment")] - pub storage_gb_adjustment: i32, -} - -impl StorageRequestModel { - pub fn new(storage_gb_adjustment: i32) -> StorageRequestModel { - StorageRequestModel { - storage_gb_adjustment, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/subscription_cancellation_request_model.rs b/crates/bitwarden-api-api/src/models/subscription_cancellation_request_model.rs deleted file mode 100644 index cb0339991..000000000 --- a/crates/bitwarden-api-api/src/models/subscription_cancellation_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SubscriptionCancellationRequestModel { - #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] - pub reason: Option, - #[serde(rename = "feedback", skip_serializing_if = "Option::is_none")] - pub feedback: Option, -} - -impl SubscriptionCancellationRequestModel { - pub fn new() -> SubscriptionCancellationRequestModel { - SubscriptionCancellationRequestModel { - reason: None, - feedback: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/subscription_response_model.rs b/crates/bitwarden-api-api/src/models/subscription_response_model.rs deleted file mode 100644 index 7bb800d86..000000000 --- a/crates/bitwarden-api-api/src/models/subscription_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SubscriptionResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "storageName", skip_serializing_if = "Option::is_none")] - pub storage_name: Option, - #[serde(rename = "storageGb", skip_serializing_if = "Option::is_none")] - pub storage_gb: Option, - #[serde(rename = "maxStorageGb", skip_serializing_if = "Option::is_none")] - pub max_storage_gb: Option, - #[serde(rename = "upcomingInvoice", skip_serializing_if = "Option::is_none")] - pub upcoming_invoice: Option>, - #[serde(rename = "subscription", skip_serializing_if = "Option::is_none")] - pub subscription: Option>, - #[serde(rename = "license", skip_serializing_if = "Option::is_none")] - pub license: Option>, - #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")] - pub expiration: Option, -} - -impl SubscriptionResponseModel { - pub fn new() -> SubscriptionResponseModel { - SubscriptionResponseModel { - object: None, - storage_name: None, - storage_gb: None, - max_storage_gb: None, - upcoming_invoice: None, - subscription: None, - license: None, - expiration: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/sync_response_model.rs b/crates/bitwarden-api-api/src/models/sync_response_model.rs deleted file mode 100644 index 238013b39..000000000 --- a/crates/bitwarden-api-api/src/models/sync_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct SyncResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "profile", skip_serializing_if = "Option::is_none")] - pub profile: Option>, - #[serde(rename = "folders", skip_serializing_if = "Option::is_none")] - pub folders: Option>, - #[serde(rename = "collections", skip_serializing_if = "Option::is_none")] - pub collections: Option>, - #[serde(rename = "ciphers", skip_serializing_if = "Option::is_none")] - pub ciphers: Option>, - #[serde(rename = "domains", skip_serializing_if = "Option::is_none")] - pub domains: Option>, - #[serde(rename = "policies", skip_serializing_if = "Option::is_none")] - pub policies: Option>, - #[serde(rename = "sends", skip_serializing_if = "Option::is_none")] - pub sends: Option>, -} - -impl SyncResponseModel { - pub fn new() -> SyncResponseModel { - SyncResponseModel { - object: None, - profile: None, - folders: None, - collections: None, - ciphers: None, - domains: None, - policies: None, - sends: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/tax_info_response_model.rs b/crates/bitwarden-api-api/src/models/tax_info_response_model.rs deleted file mode 100644 index 624f7192c..000000000 --- a/crates/bitwarden-api-api/src/models/tax_info_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TaxInfoResponseModel { - #[serde(rename = "taxIdNumber", skip_serializing_if = "Option::is_none")] - pub tax_id_number: Option, - #[serde(rename = "taxIdType", skip_serializing_if = "Option::is_none")] - pub tax_id_type: Option, - #[serde(rename = "line1", skip_serializing_if = "Option::is_none")] - pub line1: Option, - #[serde(rename = "line2", skip_serializing_if = "Option::is_none")] - pub line2: Option, - #[serde(rename = "city", skip_serializing_if = "Option::is_none")] - pub city: Option, - #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, - #[serde(rename = "postalCode", skip_serializing_if = "Option::is_none")] - pub postal_code: Option, - #[serde(rename = "country", skip_serializing_if = "Option::is_none")] - pub country: Option, -} - -impl TaxInfoResponseModel { - pub fn new() -> TaxInfoResponseModel { - TaxInfoResponseModel { - tax_id_number: None, - tax_id_type: None, - line1: None, - line2: None, - city: None, - state: None, - postal_code: None, - country: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/tax_info_update_request_model.rs b/crates/bitwarden-api-api/src/models/tax_info_update_request_model.rs deleted file mode 100644 index 99346d18c..000000000 --- a/crates/bitwarden-api-api/src/models/tax_info_update_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TaxInfoUpdateRequestModel { - #[serde(rename = "country")] - pub country: String, - #[serde(rename = "postalCode", skip_serializing_if = "Option::is_none")] - pub postal_code: Option, -} - -impl TaxInfoUpdateRequestModel { - pub fn new(country: String) -> TaxInfoUpdateRequestModel { - TaxInfoUpdateRequestModel { - country, - postal_code: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/tax_information_request_body.rs b/crates/bitwarden-api-api/src/models/tax_information_request_body.rs deleted file mode 100644 index 539608881..000000000 --- a/crates/bitwarden-api-api/src/models/tax_information_request_body.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TaxInformationRequestBody { - #[serde(rename = "country")] - pub country: String, - #[serde(rename = "postalCode")] - pub postal_code: String, - #[serde(rename = "taxId", skip_serializing_if = "Option::is_none")] - pub tax_id: Option, - #[serde(rename = "line1", skip_serializing_if = "Option::is_none")] - pub line1: Option, - #[serde(rename = "line2", skip_serializing_if = "Option::is_none")] - pub line2: Option, - #[serde(rename = "city", skip_serializing_if = "Option::is_none")] - pub city: Option, - #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, -} - -impl TaxInformationRequestBody { - pub fn new(country: String, postal_code: String) -> TaxInformationRequestBody { - TaxInformationRequestBody { - country, - postal_code, - tax_id: None, - line1: None, - line2: None, - city: None, - state: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/tax_rate_response_model.rs b/crates/bitwarden-api-api/src/models/tax_rate_response_model.rs deleted file mode 100644 index 16f2eb27e..000000000 --- a/crates/bitwarden-api-api/src/models/tax_rate_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TaxRateResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "country", skip_serializing_if = "Option::is_none")] - pub country: Option, - #[serde(rename = "state", skip_serializing_if = "Option::is_none")] - pub state: Option, - #[serde(rename = "postalCode", skip_serializing_if = "Option::is_none")] - pub postal_code: Option, - #[serde(rename = "rate", skip_serializing_if = "Option::is_none")] - pub rate: Option, -} - -impl TaxRateResponseModel { - pub fn new() -> TaxRateResponseModel { - TaxRateResponseModel { - object: None, - id: None, - country: None, - state: None, - postal_code: None, - rate: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/tax_rate_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/tax_rate_response_model_list_response_model.rs deleted file mode 100644 index 8121be6b5..000000000 --- a/crates/bitwarden-api-api/src/models/tax_rate_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TaxRateResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl TaxRateResponseModelListResponseModel { - pub fn new() -> TaxRateResponseModelListResponseModel { - TaxRateResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/transaction_type.rs b/crates/bitwarden-api-api/src/models/transaction_type.rs deleted file mode 100644 index dd9edb2bc..000000000 --- a/crates/bitwarden-api-api/src/models/transaction_type.rs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum TransactionType { - Charge = 0, - Credit = 1, - PromotionalCredit = 2, - ReferralCredit = 3, - Refund = 4, -} - -impl std::fmt::Display for TransactionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Charge => write!(f, "0"), - Self::Credit => write!(f, "1"), - Self::PromotionalCredit => write!(f, "2"), - Self::ReferralCredit => write!(f, "3"), - Self::Refund => write!(f, "4"), - } - } -} - -impl Default for TransactionType { - fn default() -> TransactionType { - Self::Charge - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_authenticator_disable_request_model.rs b/crates/bitwarden-api-api/src/models/two_factor_authenticator_disable_request_model.rs deleted file mode 100644 index 6d05df555..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_authenticator_disable_request_model.rs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorAuthenticatorDisableRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "type")] - pub r#type: models::TwoFactorProviderType, - #[serde(rename = "userVerificationToken")] - pub user_verification_token: String, - #[serde(rename = "key")] - pub key: String, -} - -impl TwoFactorAuthenticatorDisableRequestModel { - pub fn new( - r#type: models::TwoFactorProviderType, - user_verification_token: String, - key: String, - ) -> TwoFactorAuthenticatorDisableRequestModel { - TwoFactorAuthenticatorDisableRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - r#type, - user_verification_token, - key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_authenticator_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_authenticator_response_model.rs deleted file mode 100644 index dba1dc0fa..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_authenticator_response_model.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorAuthenticatorResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde( - rename = "userVerificationToken", - skip_serializing_if = "Option::is_none" - )] - pub user_verification_token: Option, -} - -impl TwoFactorAuthenticatorResponseModel { - pub fn new() -> TwoFactorAuthenticatorResponseModel { - TwoFactorAuthenticatorResponseModel { - object: None, - enabled: None, - key: None, - user_verification_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_duo_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_duo_response_model.rs deleted file mode 100644 index 35574f821..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_duo_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorDuoResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "host", skip_serializing_if = "Option::is_none")] - pub host: Option, - #[serde(rename = "secretKey", skip_serializing_if = "Option::is_none")] - pub secret_key: Option, - #[serde(rename = "integrationKey", skip_serializing_if = "Option::is_none")] - pub integration_key: Option, - #[serde(rename = "clientSecret", skip_serializing_if = "Option::is_none")] - pub client_secret: Option, - #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")] - pub client_id: Option, -} - -impl TwoFactorDuoResponseModel { - pub fn new() -> TwoFactorDuoResponseModel { - TwoFactorDuoResponseModel { - object: None, - enabled: None, - host: None, - secret_key: None, - integration_key: None, - client_secret: None, - client_id: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_email_request_model.rs b/crates/bitwarden-api-api/src/models/two_factor_email_request_model.rs deleted file mode 100644 index cd946e28b..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_email_request_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorEmailRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "email")] - pub email: String, - #[serde(rename = "authRequestId", skip_serializing_if = "Option::is_none")] - pub auth_request_id: Option, - #[serde( - rename = "ssoEmail2FaSessionToken", - skip_serializing_if = "Option::is_none" - )] - pub sso_email2_fa_session_token: Option, -} - -impl TwoFactorEmailRequestModel { - pub fn new(email: String) -> TwoFactorEmailRequestModel { - TwoFactorEmailRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - email, - auth_request_id: None, - sso_email2_fa_session_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_email_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_email_response_model.rs deleted file mode 100644 index cbeac40a8..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_email_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorEmailResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, -} - -impl TwoFactorEmailResponseModel { - pub fn new() -> TwoFactorEmailResponseModel { - TwoFactorEmailResponseModel { - object: None, - enabled: None, - email: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_provider_request_model.rs b/crates/bitwarden-api-api/src/models/two_factor_provider_request_model.rs deleted file mode 100644 index 2d1cafeb0..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_provider_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorProviderRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "type")] - pub r#type: models::TwoFactorProviderType, -} - -impl TwoFactorProviderRequestModel { - pub fn new(r#type: models::TwoFactorProviderType) -> TwoFactorProviderRequestModel { - TwoFactorProviderRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - r#type, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_provider_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_provider_response_model.rs deleted file mode 100644 index afeb14cf8..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_provider_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorProviderResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, -} - -impl TwoFactorProviderResponseModel { - pub fn new() -> TwoFactorProviderResponseModel { - TwoFactorProviderResponseModel { - object: None, - enabled: None, - r#type: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_provider_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_provider_response_model_list_response_model.rs deleted file mode 100644 index 172f0502d..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_provider_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorProviderResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl TwoFactorProviderResponseModelListResponseModel { - pub fn new() -> TwoFactorProviderResponseModelListResponseModel { - TwoFactorProviderResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_provider_type.rs b/crates/bitwarden-api-api/src/models/two_factor_provider_type.rs deleted file mode 100644 index 11d34f8cb..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_provider_type.rs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum TwoFactorProviderType { - Authenticator = 0, - Email = 1, - Duo = 2, - YubiKey = 3, - U2f = 4, - Remember = 5, - OrganizationDuo = 6, - WebAuthn = 7, -} - -impl std::fmt::Display for TwoFactorProviderType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Authenticator => write!(f, "0"), - Self::Email => write!(f, "1"), - Self::Duo => write!(f, "2"), - Self::YubiKey => write!(f, "3"), - Self::U2f => write!(f, "4"), - Self::Remember => write!(f, "5"), - Self::OrganizationDuo => write!(f, "6"), - Self::WebAuthn => write!(f, "7"), - } - } -} - -impl Default for TwoFactorProviderType { - fn default() -> TwoFactorProviderType { - Self::Authenticator - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_recover_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_recover_response_model.rs deleted file mode 100644 index 5f3cdafa8..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_recover_response_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorRecoverResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "code", skip_serializing_if = "Option::is_none")] - pub code: Option, -} - -impl TwoFactorRecoverResponseModel { - pub fn new() -> TwoFactorRecoverResponseModel { - TwoFactorRecoverResponseModel { - object: None, - code: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_recovery_request_model.rs b/crates/bitwarden-api-api/src/models/two_factor_recovery_request_model.rs deleted file mode 100644 index f8c13fe1f..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_recovery_request_model.rs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorRecoveryRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "email")] - pub email: String, - #[serde(rename = "authRequestId", skip_serializing_if = "Option::is_none")] - pub auth_request_id: Option, - #[serde( - rename = "ssoEmail2FaSessionToken", - skip_serializing_if = "Option::is_none" - )] - pub sso_email2_fa_session_token: Option, - #[serde(rename = "recoveryCode")] - pub recovery_code: String, -} - -impl TwoFactorRecoveryRequestModel { - pub fn new(email: String, recovery_code: String) -> TwoFactorRecoveryRequestModel { - TwoFactorRecoveryRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - email, - auth_request_id: None, - sso_email2_fa_session_token: None, - recovery_code, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_web_authn_delete_request_model.rs b/crates/bitwarden-api-api/src/models/two_factor_web_authn_delete_request_model.rs deleted file mode 100644 index b0ca0fdb4..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_web_authn_delete_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorWebAuthnDeleteRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "id")] - pub id: i32, -} - -impl TwoFactorWebAuthnDeleteRequestModel { - pub fn new(id: i32) -> TwoFactorWebAuthnDeleteRequestModel { - TwoFactorWebAuthnDeleteRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_web_authn_request_model.rs b/crates/bitwarden-api-api/src/models/two_factor_web_authn_request_model.rs deleted file mode 100644 index 32429e737..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_web_authn_request_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorWebAuthnRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "id")] - pub id: i32, - #[serde(rename = "deviceResponse")] - pub device_response: Box, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, -} - -impl TwoFactorWebAuthnRequestModel { - pub fn new( - id: i32, - device_response: models::AuthenticatorAttestationRawResponse, - ) -> TwoFactorWebAuthnRequestModel { - TwoFactorWebAuthnRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - id, - device_response: Box::new(device_response), - name: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_web_authn_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_web_authn_response_model.rs deleted file mode 100644 index db083572f..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_web_authn_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorWebAuthnResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "keys", skip_serializing_if = "Option::is_none")] - pub keys: Option>, -} - -impl TwoFactorWebAuthnResponseModel { - pub fn new() -> TwoFactorWebAuthnResponseModel { - TwoFactorWebAuthnResponseModel { - object: None, - enabled: None, - keys: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/two_factor_yubi_key_response_model.rs b/crates/bitwarden-api-api/src/models/two_factor_yubi_key_response_model.rs deleted file mode 100644 index 673e6f3cf..000000000 --- a/crates/bitwarden-api-api/src/models/two_factor_yubi_key_response_model.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TwoFactorYubiKeyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(rename = "key1", skip_serializing_if = "Option::is_none")] - pub key1: Option, - #[serde(rename = "key2", skip_serializing_if = "Option::is_none")] - pub key2: Option, - #[serde(rename = "key3", skip_serializing_if = "Option::is_none")] - pub key3: Option, - #[serde(rename = "key4", skip_serializing_if = "Option::is_none")] - pub key4: Option, - #[serde(rename = "key5", skip_serializing_if = "Option::is_none")] - pub key5: Option, - #[serde(rename = "nfc", skip_serializing_if = "Option::is_none")] - pub nfc: Option, -} - -impl TwoFactorYubiKeyResponseModel { - pub fn new() -> TwoFactorYubiKeyResponseModel { - TwoFactorYubiKeyResponseModel { - object: None, - enabled: None, - key1: None, - key2: None, - key3: None, - key4: None, - key5: None, - nfc: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_avatar_request_model.rs b/crates/bitwarden-api-api/src/models/update_avatar_request_model.rs deleted file mode 100644 index d0f982247..000000000 --- a/crates/bitwarden-api-api/src/models/update_avatar_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateAvatarRequestModel { - #[serde(rename = "avatarColor", skip_serializing_if = "Option::is_none")] - pub avatar_color: Option, -} - -impl UpdateAvatarRequestModel { - pub fn new() -> UpdateAvatarRequestModel { - UpdateAvatarRequestModel { avatar_color: None } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_client_organization_request_body.rs b/crates/bitwarden-api-api/src/models/update_client_organization_request_body.rs deleted file mode 100644 index 993d2240e..000000000 --- a/crates/bitwarden-api-api/src/models/update_client_organization_request_body.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateClientOrganizationRequestBody { - #[serde(rename = "assignedSeats")] - pub assigned_seats: i32, - #[serde(rename = "name")] - pub name: String, -} - -impl UpdateClientOrganizationRequestBody { - pub fn new(assigned_seats: i32, name: String) -> UpdateClientOrganizationRequestBody { - UpdateClientOrganizationRequestBody { - assigned_seats, - name, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_devices_trust_request_model.rs b/crates/bitwarden-api-api/src/models/update_devices_trust_request_model.rs deleted file mode 100644 index 2b7aff81e..000000000 --- a/crates/bitwarden-api-api/src/models/update_devices_trust_request_model.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateDevicesTrustRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "currentDevice")] - pub current_device: Box, - #[serde(rename = "otherDevices", skip_serializing_if = "Option::is_none")] - pub other_devices: Option>, -} - -impl UpdateDevicesTrustRequestModel { - pub fn new( - current_device: models::DeviceKeysUpdateRequestModel, - ) -> UpdateDevicesTrustRequestModel { - UpdateDevicesTrustRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - current_device: Box::new(current_device), - other_devices: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_domains_request_model.rs b/crates/bitwarden-api-api/src/models/update_domains_request_model.rs deleted file mode 100644 index c0c1f017d..000000000 --- a/crates/bitwarden-api-api/src/models/update_domains_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateDomainsRequestModel { - #[serde(rename = "equivalentDomains", skip_serializing_if = "Option::is_none")] - pub equivalent_domains: Option>>, - #[serde( - rename = "excludedGlobalEquivalentDomains", - skip_serializing_if = "Option::is_none" - )] - pub excluded_global_equivalent_domains: Option>, -} - -impl UpdateDomainsRequestModel { - pub fn new() -> UpdateDomainsRequestModel { - UpdateDomainsRequestModel { - equivalent_domains: None, - excluded_global_equivalent_domains: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_key_request_model.rs b/crates/bitwarden-api-api/src/models/update_key_request_model.rs deleted file mode 100644 index 179c0fddd..000000000 --- a/crates/bitwarden-api-api/src/models/update_key_request_model.rs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateKeyRequestModel { - #[serde(rename = "masterPasswordHash")] - pub master_password_hash: String, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "privateKey")] - pub private_key: String, - #[serde(rename = "ciphers", skip_serializing_if = "Option::is_none")] - pub ciphers: Option>, - #[serde(rename = "folders", skip_serializing_if = "Option::is_none")] - pub folders: Option>, - #[serde(rename = "sends", skip_serializing_if = "Option::is_none")] - pub sends: Option>, - #[serde( - rename = "emergencyAccessKeys", - skip_serializing_if = "Option::is_none" - )] - pub emergency_access_keys: Option>, - #[serde(rename = "resetPasswordKeys", skip_serializing_if = "Option::is_none")] - pub reset_password_keys: Option>, - #[serde(rename = "webAuthnKeys", skip_serializing_if = "Option::is_none")] - pub web_authn_keys: Option>, -} - -impl UpdateKeyRequestModel { - pub fn new( - master_password_hash: String, - key: String, - private_key: String, - ) -> UpdateKeyRequestModel { - UpdateKeyRequestModel { - master_password_hash, - key, - private_key, - ciphers: None, - folders: None, - sends: None, - emergency_access_keys: None, - reset_password_keys: None, - web_authn_keys: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_profile_request_model.rs b/crates/bitwarden-api-api/src/models/update_profile_request_model.rs deleted file mode 100644 index 858cd7fb4..000000000 --- a/crates/bitwarden-api-api/src/models/update_profile_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateProfileRequestModel { - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, -} - -impl UpdateProfileRequestModel { - pub fn new() -> UpdateProfileRequestModel { - UpdateProfileRequestModel { - name: None, - master_password_hint: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_tde_offboarding_password_request_model.rs b/crates/bitwarden-api-api/src/models/update_tde_offboarding_password_request_model.rs deleted file mode 100644 index aeb1f424b..000000000 --- a/crates/bitwarden-api-api/src/models/update_tde_offboarding_password_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateTdeOffboardingPasswordRequestModel { - #[serde(rename = "newMasterPasswordHash")] - pub new_master_password_hash: String, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, -} - -impl UpdateTdeOffboardingPasswordRequestModel { - pub fn new( - new_master_password_hash: String, - key: String, - ) -> UpdateTdeOffboardingPasswordRequestModel { - UpdateTdeOffboardingPasswordRequestModel { - new_master_password_hash, - key, - master_password_hint: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_temp_password_request_model.rs b/crates/bitwarden-api-api/src/models/update_temp_password_request_model.rs deleted file mode 100644 index f7d8fa2ee..000000000 --- a/crates/bitwarden-api-api/src/models/update_temp_password_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateTempPasswordRequestModel { - #[serde(rename = "newMasterPasswordHash")] - pub new_master_password_hash: String, - #[serde(rename = "key")] - pub key: String, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, -} - -impl UpdateTempPasswordRequestModel { - pub fn new(new_master_password_hash: String, key: String) -> UpdateTempPasswordRequestModel { - UpdateTempPasswordRequestModel { - new_master_password_hash, - key, - master_password_hint: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_two_factor_authenticator_request_model.rs b/crates/bitwarden-api-api/src/models/update_two_factor_authenticator_request_model.rs deleted file mode 100644 index 314699a72..000000000 --- a/crates/bitwarden-api-api/src/models/update_two_factor_authenticator_request_model.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateTwoFactorAuthenticatorRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "token")] - pub token: String, - #[serde(rename = "key")] - pub key: String, - #[serde( - rename = "userVerificationToken", - skip_serializing_if = "Option::is_none" - )] - pub user_verification_token: Option, -} - -impl UpdateTwoFactorAuthenticatorRequestModel { - pub fn new(token: String, key: String) -> UpdateTwoFactorAuthenticatorRequestModel { - UpdateTwoFactorAuthenticatorRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - token, - key, - user_verification_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_two_factor_duo_request_model.rs b/crates/bitwarden-api-api/src/models/update_two_factor_duo_request_model.rs deleted file mode 100644 index 5a4989c52..000000000 --- a/crates/bitwarden-api-api/src/models/update_two_factor_duo_request_model.rs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateTwoFactorDuoRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(rename = "clientSecret", skip_serializing_if = "Option::is_none")] - pub client_secret: Option, - #[serde(rename = "integrationKey", skip_serializing_if = "Option::is_none")] - pub integration_key: Option, - #[serde(rename = "secretKey", skip_serializing_if = "Option::is_none")] - pub secret_key: Option, - #[serde(rename = "host")] - pub host: String, -} - -impl UpdateTwoFactorDuoRequestModel { - pub fn new(host: String) -> UpdateTwoFactorDuoRequestModel { - UpdateTwoFactorDuoRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - client_id: None, - client_secret: None, - integration_key: None, - secret_key: None, - host, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_two_factor_email_request_model.rs b/crates/bitwarden-api-api/src/models/update_two_factor_email_request_model.rs deleted file mode 100644 index 2296248a6..000000000 --- a/crates/bitwarden-api-api/src/models/update_two_factor_email_request_model.rs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateTwoFactorEmailRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "email")] - pub email: String, - #[serde(rename = "authRequestId", skip_serializing_if = "Option::is_none")] - pub auth_request_id: Option, - #[serde( - rename = "ssoEmail2FaSessionToken", - skip_serializing_if = "Option::is_none" - )] - pub sso_email2_fa_session_token: Option, - #[serde(rename = "token")] - pub token: String, -} - -impl UpdateTwoFactorEmailRequestModel { - pub fn new(email: String, token: String) -> UpdateTwoFactorEmailRequestModel { - UpdateTwoFactorEmailRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - email, - auth_request_id: None, - sso_email2_fa_session_token: None, - token, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/update_two_factor_yubico_otp_request_model.rs b/crates/bitwarden-api-api/src/models/update_two_factor_yubico_otp_request_model.rs deleted file mode 100644 index c3be61dd1..000000000 --- a/crates/bitwarden-api-api/src/models/update_two_factor_yubico_otp_request_model.rs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UpdateTwoFactorYubicoOtpRequestModel { - #[serde(rename = "masterPasswordHash", skip_serializing_if = "Option::is_none")] - pub master_password_hash: Option, - #[serde(rename = "otp", skip_serializing_if = "Option::is_none")] - pub otp: Option, - #[serde( - rename = "authRequestAccessCode", - skip_serializing_if = "Option::is_none" - )] - pub auth_request_access_code: Option, - #[serde(rename = "secret", skip_serializing_if = "Option::is_none")] - pub secret: Option, - #[serde(rename = "key1", skip_serializing_if = "Option::is_none")] - pub key1: Option, - #[serde(rename = "key2", skip_serializing_if = "Option::is_none")] - pub key2: Option, - #[serde(rename = "key3", skip_serializing_if = "Option::is_none")] - pub key3: Option, - #[serde(rename = "key4", skip_serializing_if = "Option::is_none")] - pub key4: Option, - #[serde(rename = "key5", skip_serializing_if = "Option::is_none")] - pub key5: Option, - #[serde(rename = "nfc")] - pub nfc: bool, -} - -impl UpdateTwoFactorYubicoOtpRequestModel { - pub fn new(nfc: bool) -> UpdateTwoFactorYubicoOtpRequestModel { - UpdateTwoFactorYubicoOtpRequestModel { - master_password_hash: None, - otp: None, - auth_request_access_code: None, - secret: None, - key1: None, - key2: None, - key3: None, - key4: None, - key5: None, - nfc, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/uri_match_type.rs b/crates/bitwarden-api-api/src/models/uri_match_type.rs deleted file mode 100644 index 221f110c9..000000000 --- a/crates/bitwarden-api-api/src/models/uri_match_type.rs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum UriMatchType { - Domain = 0, - Host = 1, - StartsWith = 2, - Exact = 3, - RegularExpression = 4, - Never = 5, -} - -impl std::fmt::Display for UriMatchType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Domain => write!(f, "0"), - Self::Host => write!(f, "1"), - Self::StartsWith => write!(f, "2"), - Self::Exact => write!(f, "3"), - Self::RegularExpression => write!(f, "4"), - Self::Never => write!(f, "5"), - } - } -} - -impl Default for UriMatchType { - fn default() -> UriMatchType { - Self::Domain - } -} diff --git a/crates/bitwarden-api-api/src/models/user.rs b/crates/bitwarden-api-api/src/models/user.rs deleted file mode 100644 index 7d387288a..000000000 --- a/crates/bitwarden-api-api/src/models/user.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct User { - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "deleted", skip_serializing_if = "Option::is_none")] - pub deleted: Option, - #[serde(rename = "externalId")] - pub external_id: String, -} - -impl User { - pub fn new(external_id: String) -> User { - User { - email: None, - deleted: None, - external_id, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/user_access_policy_response_model.rs b/crates/bitwarden-api-api/src/models/user_access_policy_response_model.rs deleted file mode 100644 index 5585a9c4f..000000000 --- a/crates/bitwarden-api-api/src/models/user_access_policy_response_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UserAccessPolicyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "read", skip_serializing_if = "Option::is_none")] - pub read: Option, - #[serde(rename = "write", skip_serializing_if = "Option::is_none")] - pub write: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde( - rename = "organizationUserName", - skip_serializing_if = "Option::is_none" - )] - pub organization_user_name: Option, - #[serde(rename = "currentUser", skip_serializing_if = "Option::is_none")] - pub current_user: Option, -} - -impl UserAccessPolicyResponseModel { - pub fn new() -> UserAccessPolicyResponseModel { - UserAccessPolicyResponseModel { - object: None, - read: None, - write: None, - organization_user_id: None, - organization_user_name: None, - current_user: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/user_key_response_model.rs b/crates/bitwarden-api-api/src/models/user_key_response_model.rs deleted file mode 100644 index cb06e2277..000000000 --- a/crates/bitwarden-api-api/src/models/user_key_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UserKeyResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] - pub user_id: Option, - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, -} - -impl UserKeyResponseModel { - pub fn new() -> UserKeyResponseModel { - UserKeyResponseModel { - object: None, - user_id: None, - public_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/user_license.rs b/crates/bitwarden-api-api/src/models/user_license.rs deleted file mode 100644 index 1b2c21704..000000000 --- a/crates/bitwarden-api-api/src/models/user_license.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct UserLicense { - #[serde(rename = "licenseKey", skip_serializing_if = "Option::is_none")] - pub license_key: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email", skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(rename = "premium", skip_serializing_if = "Option::is_none")] - pub premium: Option, - #[serde(rename = "maxStorageGb", skip_serializing_if = "Option::is_none")] - pub max_storage_gb: Option, - #[serde(rename = "version", skip_serializing_if = "Option::is_none")] - pub version: Option, - #[serde(rename = "issued", skip_serializing_if = "Option::is_none")] - pub issued: Option, - #[serde(rename = "refresh", skip_serializing_if = "Option::is_none")] - pub refresh: Option, - #[serde(rename = "expires", skip_serializing_if = "Option::is_none")] - pub expires: Option, - #[serde(rename = "trial", skip_serializing_if = "Option::is_none")] - pub trial: Option, - #[serde(rename = "licenseType", skip_serializing_if = "Option::is_none")] - pub license_type: Option, - #[serde(rename = "hash", skip_serializing_if = "Option::is_none")] - pub hash: Option, - #[serde(rename = "signature", skip_serializing_if = "Option::is_none")] - pub signature: Option, -} - -impl UserLicense { - pub fn new() -> UserLicense { - UserLicense { - license_key: None, - id: None, - name: None, - email: None, - premium: None, - max_storage_gb: None, - version: None, - issued: None, - refresh: None, - expires: None, - trial: None, - license_type: None, - hash: None, - signature: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/user_verification_requirement.rs b/crates/bitwarden-api-api/src/models/user_verification_requirement.rs deleted file mode 100644 index 684add6c4..000000000 --- a/crates/bitwarden-api-api/src/models/user_verification_requirement.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum UserVerificationRequirement { - #[serde(rename = "required")] - Required, - #[serde(rename = "preferred")] - Preferred, - #[serde(rename = "discouraged")] - Discouraged, -} - -impl std::fmt::Display for UserVerificationRequirement { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Required => write!(f, "required"), - Self::Preferred => write!(f, "preferred"), - Self::Discouraged => write!(f, "discouraged"), - } - } -} - -impl Default for UserVerificationRequirement { - fn default() -> UserVerificationRequirement { - Self::Required - } -} diff --git a/crates/bitwarden-api-api/src/models/verify_delete_recover_request_model.rs b/crates/bitwarden-api-api/src/models/verify_delete_recover_request_model.rs deleted file mode 100644 index 9bdaa3aae..000000000 --- a/crates/bitwarden-api-api/src/models/verify_delete_recover_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct VerifyDeleteRecoverRequestModel { - #[serde(rename = "userId")] - pub user_id: String, - #[serde(rename = "token")] - pub token: String, -} - -impl VerifyDeleteRecoverRequestModel { - pub fn new(user_id: String, token: String) -> VerifyDeleteRecoverRequestModel { - VerifyDeleteRecoverRequestModel { user_id, token } - } -} diff --git a/crates/bitwarden-api-api/src/models/verify_email_request_model.rs b/crates/bitwarden-api-api/src/models/verify_email_request_model.rs deleted file mode 100644 index b5876bf9c..000000000 --- a/crates/bitwarden-api-api/src/models/verify_email_request_model.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct VerifyEmailRequestModel { - #[serde(rename = "userId")] - pub user_id: String, - #[serde(rename = "token")] - pub token: String, -} - -impl VerifyEmailRequestModel { - pub fn new(user_id: String, token: String) -> VerifyEmailRequestModel { - VerifyEmailRequestModel { user_id, token } - } -} diff --git a/crates/bitwarden-api-api/src/models/verify_otp_request_model.rs b/crates/bitwarden-api-api/src/models/verify_otp_request_model.rs deleted file mode 100644 index f0ed5b3c5..000000000 --- a/crates/bitwarden-api-api/src/models/verify_otp_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct VerifyOtpRequestModel { - #[serde(rename = "otp")] - pub otp: String, -} - -impl VerifyOtpRequestModel { - pub fn new(otp: String) -> VerifyOtpRequestModel { - VerifyOtpRequestModel { otp } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_credential_create_options_response_model.rs b/crates/bitwarden-api-api/src/models/web_authn_credential_create_options_response_model.rs deleted file mode 100644 index 1af9af90f..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_credential_create_options_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnCredentialCreateOptionsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "options", skip_serializing_if = "Option::is_none")] - pub options: Option>, - #[serde(rename = "token", skip_serializing_if = "Option::is_none")] - pub token: Option, -} - -impl WebAuthnCredentialCreateOptionsResponseModel { - pub fn new() -> WebAuthnCredentialCreateOptionsResponseModel { - WebAuthnCredentialCreateOptionsResponseModel { - object: None, - options: None, - token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_credential_response_model.rs b/crates/bitwarden-api-api/src/models/web_authn_credential_response_model.rs deleted file mode 100644 index fb1f9004f..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_credential_response_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnCredentialResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "prfStatus", skip_serializing_if = "Option::is_none")] - pub prf_status: Option, - #[serde(rename = "encryptedUserKey", skip_serializing_if = "Option::is_none")] - pub encrypted_user_key: Option, - #[serde(rename = "encryptedPublicKey", skip_serializing_if = "Option::is_none")] - pub encrypted_public_key: Option, -} - -impl WebAuthnCredentialResponseModel { - pub fn new() -> WebAuthnCredentialResponseModel { - WebAuthnCredentialResponseModel { - object: None, - id: None, - name: None, - prf_status: None, - encrypted_user_key: None, - encrypted_public_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_credential_response_model_list_response_model.rs b/crates/bitwarden-api-api/src/models/web_authn_credential_response_model_list_response_model.rs deleted file mode 100644 index f03412c89..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_credential_response_model_list_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnCredentialResponseModelListResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "data", skip_serializing_if = "Option::is_none")] - pub data: Option>, - #[serde(rename = "continuationToken", skip_serializing_if = "Option::is_none")] - pub continuation_token: Option, -} - -impl WebAuthnCredentialResponseModelListResponseModel { - pub fn new() -> WebAuthnCredentialResponseModelListResponseModel { - WebAuthnCredentialResponseModelListResponseModel { - object: None, - data: None, - continuation_token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_login_assertion_options_response_model.rs b/crates/bitwarden-api-api/src/models/web_authn_login_assertion_options_response_model.rs deleted file mode 100644 index 0007add9a..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_login_assertion_options_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnLoginAssertionOptionsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "options", skip_serializing_if = "Option::is_none")] - pub options: Option>, - #[serde(rename = "token", skip_serializing_if = "Option::is_none")] - pub token: Option, -} - -impl WebAuthnLoginAssertionOptionsResponseModel { - pub fn new() -> WebAuthnLoginAssertionOptionsResponseModel { - WebAuthnLoginAssertionOptionsResponseModel { - object: None, - options: None, - token: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_login_credential_create_request_model.rs b/crates/bitwarden-api-api/src/models/web_authn_login_credential_create_request_model.rs deleted file mode 100644 index d37ee18c3..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_login_credential_create_request_model.rs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnLoginCredentialCreateRequestModel { - #[serde(rename = "deviceResponse")] - pub device_response: Box, - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "token")] - pub token: String, - #[serde(rename = "supportsPrf")] - pub supports_prf: bool, - #[serde(rename = "encryptedUserKey", skip_serializing_if = "Option::is_none")] - pub encrypted_user_key: Option, - #[serde(rename = "encryptedPublicKey", skip_serializing_if = "Option::is_none")] - pub encrypted_public_key: Option, - #[serde( - rename = "encryptedPrivateKey", - skip_serializing_if = "Option::is_none" - )] - pub encrypted_private_key: Option, -} - -impl WebAuthnLoginCredentialCreateRequestModel { - pub fn new( - device_response: models::AuthenticatorAttestationRawResponse, - name: String, - token: String, - supports_prf: bool, - ) -> WebAuthnLoginCredentialCreateRequestModel { - WebAuthnLoginCredentialCreateRequestModel { - device_response: Box::new(device_response), - name, - token, - supports_prf, - encrypted_user_key: None, - encrypted_public_key: None, - encrypted_private_key: None, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_login_credential_update_request_model.rs b/crates/bitwarden-api-api/src/models/web_authn_login_credential_update_request_model.rs deleted file mode 100644 index a03e3b6af..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_login_credential_update_request_model.rs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnLoginCredentialUpdateRequestModel { - #[serde(rename = "deviceResponse")] - pub device_response: Box, - #[serde(rename = "token")] - pub token: String, - #[serde(rename = "encryptedUserKey")] - pub encrypted_user_key: String, - #[serde(rename = "encryptedPublicKey")] - pub encrypted_public_key: String, - #[serde(rename = "encryptedPrivateKey")] - pub encrypted_private_key: String, -} - -impl WebAuthnLoginCredentialUpdateRequestModel { - pub fn new( - device_response: models::AuthenticatorAssertionRawResponse, - token: String, - encrypted_user_key: String, - encrypted_public_key: String, - encrypted_private_key: String, - ) -> WebAuthnLoginCredentialUpdateRequestModel { - WebAuthnLoginCredentialUpdateRequestModel { - device_response: Box::new(device_response), - token, - encrypted_user_key, - encrypted_public_key, - encrypted_private_key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_login_rotate_key_request_model.rs b/crates/bitwarden-api-api/src/models/web_authn_login_rotate_key_request_model.rs deleted file mode 100644 index b1beddeaa..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_login_rotate_key_request_model.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnLoginRotateKeyRequestModel { - #[serde(rename = "id")] - pub id: uuid::Uuid, - #[serde(rename = "encryptedUserKey")] - pub encrypted_user_key: String, - #[serde(rename = "encryptedPublicKey")] - pub encrypted_public_key: String, -} - -impl WebAuthnLoginRotateKeyRequestModel { - pub fn new( - id: uuid::Uuid, - encrypted_user_key: String, - encrypted_public_key: String, - ) -> WebAuthnLoginRotateKeyRequestModel { - WebAuthnLoginRotateKeyRequestModel { - id, - encrypted_user_key, - encrypted_public_key, - } - } -} diff --git a/crates/bitwarden-api-api/src/models/web_authn_prf_status.rs b/crates/bitwarden-api-api/src/models/web_authn_prf_status.rs deleted file mode 100644 index e6607fd61..000000000 --- a/crates/bitwarden-api-api/src/models/web_authn_prf_status.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Internal API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: latest - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum WebAuthnPrfStatus { - Enabled = 0, - Supported = 1, - Unsupported = 2, -} - -impl std::fmt::Display for WebAuthnPrfStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Enabled => write!(f, "0"), - Self::Supported => write!(f, "1"), - Self::Unsupported => write!(f, "2"), - } - } -} - -impl Default for WebAuthnPrfStatus { - fn default() -> WebAuthnPrfStatus { - Self::Enabled - } -} diff --git a/crates/bitwarden-api-identity/.gitignore b/crates/bitwarden-api-identity/.gitignore deleted file mode 100644 index 6aa106405..000000000 --- a/crates/bitwarden-api-identity/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/target/ -**/*.rs.bk -Cargo.lock diff --git a/crates/bitwarden-api-identity/.openapi-generator-ignore b/crates/bitwarden-api-identity/.openapi-generator-ignore deleted file mode 100644 index 0a3fec13f..000000000 --- a/crates/bitwarden-api-identity/.openapi-generator-ignore +++ /dev/null @@ -1,27 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md - -docs/*.md -.travis.yml -git_push.sh diff --git a/crates/bitwarden-api-identity/.openapi-generator/FILES b/crates/bitwarden-api-identity/.openapi-generator/FILES deleted file mode 100644 index 43c2edd75..000000000 --- a/crates/bitwarden-api-identity/.openapi-generator/FILES +++ /dev/null @@ -1,29 +0,0 @@ -.gitignore -Cargo.toml -README.md -src/apis/accounts_api.rs -src/apis/configuration.rs -src/apis/info_api.rs -src/apis/mod.rs -src/apis/sso_api.rs -src/lib.rs -src/models/assertion_options.rs -src/models/authentication_extensions_client_inputs.rs -src/models/authenticator_transport.rs -src/models/kdf_type.rs -src/models/keys_request_model.rs -src/models/mod.rs -src/models/prelogin_request_model.rs -src/models/prelogin_response_model.rs -src/models/product_tier_type.rs -src/models/product_type.rs -src/models/public_key_credential_descriptor.rs -src/models/public_key_credential_type.rs -src/models/register_finish_request_model.rs -src/models/register_request_model.rs -src/models/register_response_model.rs -src/models/register_send_verification_email_request_model.rs -src/models/register_verification_email_clicked_request_model.rs -src/models/trial_send_verification_email_request_model.rs -src/models/user_verification_requirement.rs -src/models/web_authn_login_assertion_options_response_model.rs diff --git a/crates/bitwarden-api-identity/.openapi-generator/VERSION b/crates/bitwarden-api-identity/.openapi-generator/VERSION deleted file mode 100644 index 93c8ddab9..000000000 --- a/crates/bitwarden-api-identity/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.6.0 diff --git a/crates/bitwarden-api-identity/Cargo.toml b/crates/bitwarden-api-identity/Cargo.toml deleted file mode 100644 index 9d4d81a0d..000000000 --- a/crates/bitwarden-api-identity/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "bitwarden-api-identity" -description = "Api bindings for the Bitwarden Identity API." -categories = ["api-bindings"] - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[dependencies] -serde = { workspace = true } -serde_with = { version = ">=3.8, <4", default-features = false, features = [ - "base64", - "std", - "macros", -] } -serde_json = { workspace = true } -serde_repr = { workspace = true } -url = ">=2.5, <3" -uuid = { workspace = true } -reqwest = { workspace = true } diff --git a/crates/bitwarden-api-identity/README.md b/crates/bitwarden-api-identity/README.md deleted file mode 100644 index ec789a3fb..000000000 --- a/crates/bitwarden-api-identity/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# Rust API client for bitwarden-api-identity - -No description provided (generated by Openapi Generator -https://github.com/openapitools/openapi-generator) - -## Overview - -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By -using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API -client. - -- API version: v1 -- Package version: 0.5.0 -- Generator version: 7.6.0 -- Build package: `org.openapitools.codegen.languages.RustClientCodegen` - -## Installation - -Put the package under your project folder in a directory named `bitwarden-api-identity` and add the -following to `Cargo.toml` under `[dependencies]`: - -``` -bitwarden-api-identity = { path = "./bitwarden-api-identity" } -``` - -## Documentation for API Endpoints - -All URIs are relative to _http://localhost_ - -| Class | Method | HTTP request | Description | -| ------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ | ----------- | -| _AccountsApi_ | [**accounts_prelogin_post**](docs/AccountsApi.md#accounts_prelogin_post) | **POST** /accounts/prelogin | -| _AccountsApi_ | [**accounts_register_finish_post**](docs/AccountsApi.md#accounts_register_finish_post) | **POST** /accounts/register/finish | -| _AccountsApi_ | [**accounts_register_post**](docs/AccountsApi.md#accounts_register_post) | **POST** /accounts/register | -| _AccountsApi_ | [**accounts_register_send_verification_email_post**](docs/AccountsApi.md#accounts_register_send_verification_email_post) | **POST** /accounts/register/send-verification-email | -| _AccountsApi_ | [**accounts_register_verification_email_clicked_post**](docs/AccountsApi.md#accounts_register_verification_email_clicked_post) | **POST** /accounts/register/verification-email-clicked | -| _AccountsApi_ | [**accounts_trial_send_verification_email_post**](docs/AccountsApi.md#accounts_trial_send_verification_email_post) | **POST** /accounts/trial/send-verification-email | -| _AccountsApi_ | [**accounts_webauthn_assertion_options_get**](docs/AccountsApi.md#accounts_webauthn_assertion_options_get) | **GET** /accounts/webauthn/assertion-options | -| _InfoApi_ | [**alive_get**](docs/InfoApi.md#alive_get) | **GET** /alive | -| _InfoApi_ | [**now_get**](docs/InfoApi.md#now_get) | **GET** /now | -| _InfoApi_ | [**version_get**](docs/InfoApi.md#version_get) | **GET** /version | -| _SsoApi_ | [**sso_external_callback_get**](docs/SsoApi.md#sso_external_callback_get) | **GET** /sso/ExternalCallback | -| _SsoApi_ | [**sso_external_challenge_get**](docs/SsoApi.md#sso_external_challenge_get) | **GET** /sso/ExternalChallenge | -| _SsoApi_ | [**sso_login_get**](docs/SsoApi.md#sso_login_get) | **GET** /sso/Login | -| _SsoApi_ | [**sso_pre_validate_get**](docs/SsoApi.md#sso_pre_validate_get) | **GET** /sso/PreValidate | - -## Documentation For Models - -- [AssertionOptions](docs/AssertionOptions.md) -- [AuthenticationExtensionsClientInputs](docs/AuthenticationExtensionsClientInputs.md) -- [AuthenticatorTransport](docs/AuthenticatorTransport.md) -- [KdfType](docs/KdfType.md) -- [KeysRequestModel](docs/KeysRequestModel.md) -- [PreloginRequestModel](docs/PreloginRequestModel.md) -- [PreloginResponseModel](docs/PreloginResponseModel.md) -- [ProductTierType](docs/ProductTierType.md) -- [ProductType](docs/ProductType.md) -- [PublicKeyCredentialDescriptor](docs/PublicKeyCredentialDescriptor.md) -- [PublicKeyCredentialType](docs/PublicKeyCredentialType.md) -- [RegisterFinishRequestModel](docs/RegisterFinishRequestModel.md) -- [RegisterRequestModel](docs/RegisterRequestModel.md) -- [RegisterResponseModel](docs/RegisterResponseModel.md) -- [RegisterSendVerificationEmailRequestModel](docs/RegisterSendVerificationEmailRequestModel.md) -- [RegisterVerificationEmailClickedRequestModel](docs/RegisterVerificationEmailClickedRequestModel.md) -- [TrialSendVerificationEmailRequestModel](docs/TrialSendVerificationEmailRequestModel.md) -- [UserVerificationRequirement](docs/UserVerificationRequirement.md) -- [WebAuthnLoginAssertionOptionsResponseModel](docs/WebAuthnLoginAssertionOptionsResponseModel.md) - -To get access to the crate's generated documentation, use: - -``` -cargo doc --open -``` - -## Author diff --git a/crates/bitwarden-api-identity/src/apis/accounts_api.rs b/crates/bitwarden-api-identity/src/apis/accounts_api.rs deleted file mode 100644 index 25474d97e..000000000 --- a/crates/bitwarden-api-identity/src/apis/accounts_api.rs +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`accounts_prelogin_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsPreloginPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_register_finish_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsRegisterFinishPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_register_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsRegisterPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_register_send_verification_email_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsRegisterSendVerificationEmailPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_register_verification_email_clicked_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsRegisterVerificationEmailClickedPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_trial_send_verification_email_post`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsTrialSendVerificationEmailPostError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`accounts_webauthn_assertion_options_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AccountsWebauthnAssertionOptionsGetError { - UnknownValue(serde_json::Value), -} - -pub async fn accounts_prelogin_post( - configuration: &configuration::Configuration, - prelogin_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/prelogin", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&prelogin_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_register_finish_post( - configuration: &configuration::Configuration, - register_finish_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/register/finish", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(®ister_finish_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_register_post( - configuration: &configuration::Configuration, - register_request_model: Option, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/accounts/register", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(®ister_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_register_send_verification_email_post( - configuration: &configuration::Configuration, - register_send_verification_email_request_model: Option< - models::RegisterSendVerificationEmailRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/register/send-verification-email", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = - local_var_req_builder.json(®ister_send_verification_email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_register_verification_email_clicked_post( - configuration: &configuration::Configuration, - register_verification_email_clicked_request_model: Option< - models::RegisterVerificationEmailClickedRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/register/verification-email-clicked", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = - local_var_req_builder.json(®ister_verification_email_clicked_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_trial_send_verification_email_post( - configuration: &configuration::Configuration, - trial_send_verification_email_request_model: Option< - models::TrialSendVerificationEmailRequestModel, - >, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/trial/send-verification-email", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = - local_var_req_builder.json(&trial_send_verification_email_request_model); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn accounts_webauthn_assertion_options_get( - configuration: &configuration::Configuration, -) -> Result< - models::WebAuthnLoginAssertionOptionsResponseModel, - Error, -> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/accounts/webauthn/assertion-options", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-identity/src/apis/configuration.rs b/crates/bitwarden-api-identity/src/apis/configuration.rs deleted file mode 100644 index 6ed785dc7..000000000 --- a/crates/bitwarden-api-identity/src/apis/configuration.rs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -#[derive(Debug, Clone)] -pub struct Configuration { - pub base_path: String, - pub user_agent: Option, - pub client: reqwest::Client, - pub basic_auth: Option, - pub oauth_access_token: Option, - pub bearer_access_token: Option, - pub api_key: Option, - // TODO: take an oauth2 token source, similar to the go one -} - -pub type BasicAuth = (String, Option); - -#[derive(Debug, Clone)] -pub struct ApiKey { - pub prefix: Option, - pub key: String, -} - -impl Configuration { - pub fn new() -> Configuration { - Configuration::default() - } -} - -impl Default for Configuration { - fn default() -> Self { - Configuration { - base_path: "http://localhost".to_owned(), - user_agent: Some("OpenAPI-Generator/v1/rust".to_owned()), - client: reqwest::Client::new(), - basic_auth: None, - oauth_access_token: None, - bearer_access_token: None, - api_key: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/apis/info_api.rs b/crates/bitwarden-api-identity/src/apis/info_api.rs deleted file mode 100644 index 89951e5e5..000000000 --- a/crates/bitwarden-api-identity/src/apis/info_api.rs +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`alive_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AliveGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`now_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum NowGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`version_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum VersionGetError { - UnknownValue(serde_json::Value), -} - -pub async fn alive_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/alive", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn now_get( - configuration: &configuration::Configuration, -) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/now", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn version_get( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/version", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-identity/src/apis/mod.rs b/crates/bitwarden-api-identity/src/apis/mod.rs deleted file mode 100644 index 907fffa89..000000000 --- a/crates/bitwarden-api-identity/src/apis/mod.rs +++ /dev/null @@ -1,98 +0,0 @@ -use std::{error, fmt}; - -#[derive(Debug, Clone)] -pub struct ResponseContent { - pub status: reqwest::StatusCode, - pub content: String, - pub entity: Option, -} - -#[derive(Debug)] -pub enum Error { - Reqwest(reqwest::Error), - Serde(serde_json::Error), - Io(std::io::Error), - ResponseError(ResponseContent), -} - -impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let (module, e) = match self { - Error::Reqwest(e) => ("reqwest", e.to_string()), - Error::Serde(e) => ("serde", e.to_string()), - Error::Io(e) => ("IO", e.to_string()), - Error::ResponseError(e) => ("response", format!("status code {}", e.status)), - }; - write!(f, "error in {}: {}", module, e) - } -} - -impl error::Error for Error { - fn source(&self) -> Option<&(dyn error::Error + 'static)> { - Some(match self { - Error::Reqwest(e) => e, - Error::Serde(e) => e, - Error::Io(e) => e, - Error::ResponseError(_) => return None, - }) - } -} - -impl From for Error { - fn from(e: reqwest::Error) -> Self { - Error::Reqwest(e) - } -} - -impl From for Error { - fn from(e: serde_json::Error) -> Self { - Error::Serde(e) - } -} - -impl From for Error { - fn from(e: std::io::Error) -> Self { - Error::Io(e) - } -} - -pub fn urlencode>(s: T) -> String { - ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() -} - -pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { - if let serde_json::Value::Object(object) = value { - let mut params = vec![]; - - for (key, value) in object { - match value { - serde_json::Value::Object(_) => params.append(&mut parse_deep_object( - &format!("{}[{}]", prefix, key), - value, - )), - serde_json::Value::Array(array) => { - for (i, value) in array.iter().enumerate() { - params.append(&mut parse_deep_object( - &format!("{}[{}][{}]", prefix, key, i), - value, - )); - } - } - serde_json::Value::String(s) => { - params.push((format!("{}[{}]", prefix, key), s.clone())) - } - _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), - } - } - - return params; - } - - unimplemented!("Only objects are supported with style=deepObject") -} - -pub mod accounts_api; -pub mod info_api; -pub mod sso_api; - -pub mod configuration; diff --git a/crates/bitwarden-api-identity/src/apis/sso_api.rs b/crates/bitwarden-api-identity/src/apis/sso_api.rs deleted file mode 100644 index 4ad81b061..000000000 --- a/crates/bitwarden-api-identity/src/apis/sso_api.rs +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use reqwest; -use serde::{Deserialize, Serialize}; - -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; - -/// struct for typed errors of method [`sso_external_callback_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SsoExternalCallbackGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sso_external_challenge_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SsoExternalChallengeGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sso_login_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SsoLoginGetError { - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`sso_pre_validate_get`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum SsoPreValidateGetError { - UnknownValue(serde_json::Value), -} - -pub async fn sso_external_callback_get( - configuration: &configuration::Configuration, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sso/ExternalCallback", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sso_external_challenge_get( - configuration: &configuration::Configuration, - domain_hint: Option<&str>, - return_url: Option<&str>, - user_identifier: Option<&str>, - sso_token: Option<&str>, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!( - "{}/sso/ExternalChallenge", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = domain_hint { - local_var_req_builder = - local_var_req_builder.query(&[("domainHint", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = return_url { - local_var_req_builder = - local_var_req_builder.query(&[("returnUrl", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = user_identifier { - local_var_req_builder = - local_var_req_builder.query(&[("userIdentifier", &local_var_str.to_string())]); - } - if let Some(ref local_var_str) = sso_token { - local_var_req_builder = - local_var_req_builder.query(&[("ssoToken", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sso_login_get( - configuration: &configuration::Configuration, - return_url: Option<&str>, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sso/Login", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = return_url { - local_var_req_builder = - local_var_req_builder.query(&[("returnUrl", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn sso_pre_validate_get( - configuration: &configuration::Configuration, - domain_hint: Option<&str>, -) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/sso/PreValidate", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_str) = domain_hint { - local_var_req_builder = - local_var_req_builder.query(&[("domainHint", &local_var_str.to_string())]); - } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; - Err(Error::ResponseError(local_var_error)) - } -} diff --git a/crates/bitwarden-api-identity/src/lib.rs b/crates/bitwarden-api-identity/src/lib.rs deleted file mode 100644 index 3cf407d12..000000000 --- a/crates/bitwarden-api-identity/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![allow(unused_imports, unused_variables, unused_mut, non_camel_case_types)] -#![allow( - clippy::too_many_arguments, - clippy::empty_docs, - clippy::to_string_in_format_args -)] - -extern crate reqwest; -extern crate serde; -extern crate serde_json; -extern crate url; - -pub mod apis; -pub mod models; diff --git a/crates/bitwarden-api-identity/src/models/assertion_options.rs b/crates/bitwarden-api-identity/src/models/assertion_options.rs deleted file mode 100644 index ef32e2311..000000000 --- a/crates/bitwarden-api-identity/src/models/assertion_options.rs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AssertionOptions { - #[serde(rename = "status", skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none")] - pub error_message: Option, - #[serde_as(as = "Option")] - #[serde(rename = "challenge", skip_serializing_if = "Option::is_none")] - pub challenge: Option>, - #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(rename = "rpId", skip_serializing_if = "Option::is_none")] - pub rp_id: Option, - #[serde(rename = "allowCredentials", skip_serializing_if = "Option::is_none")] - pub allow_credentials: Option>, - #[serde(rename = "userVerification", skip_serializing_if = "Option::is_none")] - pub user_verification: Option, - #[serde(rename = "extensions", skip_serializing_if = "Option::is_none")] - pub extensions: Option>, -} - -impl AssertionOptions { - pub fn new() -> AssertionOptions { - AssertionOptions { - status: None, - error_message: None, - challenge: None, - timeout: None, - rp_id: None, - allow_credentials: None, - user_verification: None, - extensions: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/authentication_extensions_client_inputs.rs b/crates/bitwarden-api-identity/src/models/authentication_extensions_client_inputs.rs deleted file mode 100644 index 4f500b87d..000000000 --- a/crates/bitwarden-api-identity/src/models/authentication_extensions_client_inputs.rs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct AuthenticationExtensionsClientInputs { - #[serde(rename = "example.extension", skip_serializing_if = "Option::is_none")] - pub example_period_extension: Option, - #[serde(rename = "appid", skip_serializing_if = "Option::is_none")] - pub appid: Option, - #[serde(rename = "authnSel", skip_serializing_if = "Option::is_none")] - pub authn_sel: Option>, - #[serde(rename = "exts", skip_serializing_if = "Option::is_none")] - pub exts: Option, - #[serde(rename = "uvm", skip_serializing_if = "Option::is_none")] - pub uvm: Option, -} - -impl AuthenticationExtensionsClientInputs { - pub fn new() -> AuthenticationExtensionsClientInputs { - AuthenticationExtensionsClientInputs { - example_period_extension: None, - appid: None, - authn_sel: None, - exts: None, - uvm: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/authenticator_transport.rs b/crates/bitwarden-api-identity/src/models/authenticator_transport.rs deleted file mode 100644 index cedc74f75..000000000 --- a/crates/bitwarden-api-identity/src/models/authenticator_transport.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum AuthenticatorTransport { - #[serde(rename = "usb")] - Usb, - #[serde(rename = "nfc")] - Nfc, - #[serde(rename = "ble")] - Ble, - #[serde(rename = "internal")] - Internal, -} - -impl std::fmt::Display for AuthenticatorTransport { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Usb => write!(f, "usb"), - Self::Nfc => write!(f, "nfc"), - Self::Ble => write!(f, "ble"), - Self::Internal => write!(f, "internal"), - } - } -} - -impl Default for AuthenticatorTransport { - fn default() -> AuthenticatorTransport { - Self::Usb - } -} diff --git a/crates/bitwarden-api-identity/src/models/kdf_type.rs b/crates/bitwarden-api-identity/src/models/kdf_type.rs deleted file mode 100644 index fd49d689d..000000000 --- a/crates/bitwarden-api-identity/src/models/kdf_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum KdfType { - PBKDF2_SHA256 = 0, - Argon2id = 1, -} - -impl std::fmt::Display for KdfType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::PBKDF2_SHA256 => write!(f, "0"), - Self::Argon2id => write!(f, "1"), - } - } -} - -impl Default for KdfType { - fn default() -> KdfType { - Self::PBKDF2_SHA256 - } -} diff --git a/crates/bitwarden-api-identity/src/models/keys_request_model.rs b/crates/bitwarden-api-identity/src/models/keys_request_model.rs deleted file mode 100644 index bb76c371b..000000000 --- a/crates/bitwarden-api-identity/src/models/keys_request_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct KeysRequestModel { - #[serde(rename = "publicKey", skip_serializing_if = "Option::is_none")] - pub public_key: Option, - #[serde(rename = "encryptedPrivateKey")] - pub encrypted_private_key: String, -} - -impl KeysRequestModel { - pub fn new(encrypted_private_key: String) -> KeysRequestModel { - KeysRequestModel { - public_key: None, - encrypted_private_key, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/mod.rs b/crates/bitwarden-api-identity/src/models/mod.rs deleted file mode 100644 index 00203b714..000000000 --- a/crates/bitwarden-api-identity/src/models/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -pub mod assertion_options; -pub use self::assertion_options::AssertionOptions; -pub mod authentication_extensions_client_inputs; -pub use self::authentication_extensions_client_inputs::AuthenticationExtensionsClientInputs; -pub mod authenticator_transport; -pub use self::authenticator_transport::AuthenticatorTransport; -pub mod kdf_type; -pub use self::kdf_type::KdfType; -pub mod keys_request_model; -pub use self::keys_request_model::KeysRequestModel; -pub mod prelogin_request_model; -pub use self::prelogin_request_model::PreloginRequestModel; -pub mod prelogin_response_model; -pub use self::prelogin_response_model::PreloginResponseModel; -pub mod product_tier_type; -pub use self::product_tier_type::ProductTierType; -pub mod product_type; -pub use self::product_type::ProductType; -pub mod public_key_credential_descriptor; -pub use self::public_key_credential_descriptor::PublicKeyCredentialDescriptor; -pub mod public_key_credential_type; -pub use self::public_key_credential_type::PublicKeyCredentialType; -pub mod register_finish_request_model; -pub use self::register_finish_request_model::RegisterFinishRequestModel; -pub mod register_request_model; -pub use self::register_request_model::RegisterRequestModel; -pub mod register_response_model; -pub use self::register_response_model::RegisterResponseModel; -pub mod register_send_verification_email_request_model; -pub use self::register_send_verification_email_request_model::RegisterSendVerificationEmailRequestModel; -pub mod register_verification_email_clicked_request_model; -pub use self::register_verification_email_clicked_request_model::RegisterVerificationEmailClickedRequestModel; -pub mod trial_send_verification_email_request_model; -pub use self::trial_send_verification_email_request_model::TrialSendVerificationEmailRequestModel; -pub mod user_verification_requirement; -pub use self::user_verification_requirement::UserVerificationRequirement; -pub mod web_authn_login_assertion_options_response_model; -pub use self::web_authn_login_assertion_options_response_model::WebAuthnLoginAssertionOptionsResponseModel; diff --git a/crates/bitwarden-api-identity/src/models/prelogin_request_model.rs b/crates/bitwarden-api-identity/src/models/prelogin_request_model.rs deleted file mode 100644 index d01d636ac..000000000 --- a/crates/bitwarden-api-identity/src/models/prelogin_request_model.rs +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreloginRequestModel { - #[serde(rename = "email")] - pub email: String, -} - -impl PreloginRequestModel { - pub fn new(email: String) -> PreloginRequestModel { - PreloginRequestModel { email } - } -} diff --git a/crates/bitwarden-api-identity/src/models/prelogin_response_model.rs b/crates/bitwarden-api-identity/src/models/prelogin_response_model.rs deleted file mode 100644 index 5a5df9cbd..000000000 --- a/crates/bitwarden-api-identity/src/models/prelogin_response_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PreloginResponseModel { - #[serde(rename = "kdf", skip_serializing_if = "Option::is_none")] - pub kdf: Option, - #[serde(rename = "kdfIterations", skip_serializing_if = "Option::is_none")] - pub kdf_iterations: Option, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, -} - -impl PreloginResponseModel { - pub fn new() -> PreloginResponseModel { - PreloginResponseModel { - kdf: None, - kdf_iterations: None, - kdf_memory: None, - kdf_parallelism: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/product_tier_type.rs b/crates/bitwarden-api-identity/src/models/product_tier_type.rs deleted file mode 100644 index 1673f0f68..000000000 --- a/crates/bitwarden-api-identity/src/models/product_tier_type.rs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum ProductTierType { - Free = 0, - Families = 1, - Teams = 2, - Enterprise = 3, - TeamsStarter = 4, -} - -impl std::fmt::Display for ProductTierType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Free => write!(f, "0"), - Self::Families => write!(f, "1"), - Self::Teams => write!(f, "2"), - Self::Enterprise => write!(f, "3"), - Self::TeamsStarter => write!(f, "4"), - } - } -} - -impl Default for ProductTierType { - fn default() -> ProductTierType { - Self::Free - } -} diff --git a/crates/bitwarden-api-identity/src/models/product_type.rs b/crates/bitwarden-api-identity/src/models/product_type.rs deleted file mode 100644 index ade8bd227..000000000 --- a/crates/bitwarden-api-identity/src/models/product_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[repr(i64)] -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - Ord, - PartialOrd, - Hash, - serde_repr::Serialize_repr, - serde_repr::Deserialize_repr, -)] -pub enum ProductType { - PasswordManager = 0, - SecretsManager = 1, -} - -impl std::fmt::Display for ProductType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::PasswordManager => write!(f, "0"), - Self::SecretsManager => write!(f, "1"), - } - } -} - -impl Default for ProductType { - fn default() -> ProductType { - Self::PasswordManager - } -} diff --git a/crates/bitwarden-api-identity/src/models/public_key_credential_descriptor.rs b/crates/bitwarden-api-identity/src/models/public_key_credential_descriptor.rs deleted file mode 100644 index 1a49a1610..000000000 --- a/crates/bitwarden-api-identity/src/models/public_key_credential_descriptor.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::models; - -#[serde_as] -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct PublicKeyCredentialDescriptor { - #[serde(rename = "type", skip_serializing_if = "Option::is_none")] - pub r#type: Option, - #[serde_as(as = "Option")] - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option>, - #[serde(rename = "transports", skip_serializing_if = "Option::is_none")] - pub transports: Option>, -} - -impl PublicKeyCredentialDescriptor { - pub fn new() -> PublicKeyCredentialDescriptor { - PublicKeyCredentialDescriptor { - r#type: None, - id: None, - transports: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/public_key_credential_type.rs b/crates/bitwarden-api-identity/src/models/public_key_credential_type.rs deleted file mode 100644 index 63312b6a5..000000000 --- a/crates/bitwarden-api-identity/src/models/public_key_credential_type.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum PublicKeyCredentialType { - #[serde(rename = "public-key")] - PublicKey, -} - -impl std::fmt::Display for PublicKeyCredentialType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::PublicKey => write!(f, "public-key"), - } - } -} - -impl Default for PublicKeyCredentialType { - fn default() -> PublicKeyCredentialType { - Self::PublicKey - } -} diff --git a/crates/bitwarden-api-identity/src/models/register_finish_request_model.rs b/crates/bitwarden-api-identity/src/models/register_finish_request_model.rs deleted file mode 100644 index d1afeea48..000000000 --- a/crates/bitwarden-api-identity/src/models/register_finish_request_model.rs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct RegisterFinishRequestModel { - #[serde(rename = "email")] - pub email: Option, - #[serde( - rename = "emailVerificationToken", - skip_serializing_if = "Option::is_none" - )] - pub email_verification_token: Option, - #[serde(rename = "masterPasswordHash")] - pub master_password_hash: Option, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, - #[serde(rename = "userSymmetricKey")] - pub user_symmetric_key: Option, - #[serde(rename = "userAsymmetricKeys")] - pub user_asymmetric_keys: Box, - #[serde(rename = "kdf")] - pub kdf: models::KdfType, - #[serde(rename = "kdfIterations")] - pub kdf_iterations: i32, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde(rename = "orgInviteToken", skip_serializing_if = "Option::is_none")] - pub org_invite_token: Option, -} - -impl RegisterFinishRequestModel { - pub fn new( - email: Option, - master_password_hash: Option, - user_symmetric_key: Option, - user_asymmetric_keys: models::KeysRequestModel, - kdf: models::KdfType, - kdf_iterations: i32, - ) -> RegisterFinishRequestModel { - RegisterFinishRequestModel { - email, - email_verification_token: None, - master_password_hash, - master_password_hint: None, - user_symmetric_key, - user_asymmetric_keys: Box::new(user_asymmetric_keys), - kdf, - kdf_iterations, - kdf_memory: None, - kdf_parallelism: None, - organization_user_id: None, - org_invite_token: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/register_request_model.rs b/crates/bitwarden-api-identity/src/models/register_request_model.rs deleted file mode 100644 index 27e6babe9..000000000 --- a/crates/bitwarden-api-identity/src/models/register_request_model.rs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct RegisterRequestModel { - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email")] - pub email: String, - #[serde(rename = "masterPasswordHash")] - pub master_password_hash: String, - #[serde(rename = "masterPasswordHint", skip_serializing_if = "Option::is_none")] - pub master_password_hint: Option, - #[serde(rename = "captchaResponse", skip_serializing_if = "Option::is_none")] - pub captcha_response: Option, - #[serde(rename = "key", skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(rename = "keys", skip_serializing_if = "Option::is_none")] - pub keys: Option>, - #[serde(rename = "token", skip_serializing_if = "Option::is_none")] - pub token: Option, - #[serde(rename = "organizationUserId", skip_serializing_if = "Option::is_none")] - pub organization_user_id: Option, - #[serde(rename = "kdf", skip_serializing_if = "Option::is_none")] - pub kdf: Option, - #[serde(rename = "kdfIterations", skip_serializing_if = "Option::is_none")] - pub kdf_iterations: Option, - #[serde(rename = "kdfMemory", skip_serializing_if = "Option::is_none")] - pub kdf_memory: Option, - #[serde(rename = "kdfParallelism", skip_serializing_if = "Option::is_none")] - pub kdf_parallelism: Option, - #[serde(rename = "referenceData", skip_serializing_if = "Option::is_none")] - pub reference_data: Option>, -} - -impl RegisterRequestModel { - pub fn new(email: String, master_password_hash: String) -> RegisterRequestModel { - RegisterRequestModel { - name: None, - email, - master_password_hash, - master_password_hint: None, - captcha_response: None, - key: None, - keys: None, - token: None, - organization_user_id: None, - kdf: None, - kdf_iterations: None, - kdf_memory: None, - kdf_parallelism: None, - reference_data: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/register_response_model.rs b/crates/bitwarden-api-identity/src/models/register_response_model.rs deleted file mode 100644 index 0f294a03b..000000000 --- a/crates/bitwarden-api-identity/src/models/register_response_model.rs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct RegisterResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "captchaBypassToken", skip_serializing_if = "Option::is_none")] - pub captcha_bypass_token: Option, -} - -impl RegisterResponseModel { - pub fn new() -> RegisterResponseModel { - RegisterResponseModel { - object: None, - captcha_bypass_token: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/register_send_verification_email_request_model.rs b/crates/bitwarden-api-identity/src/models/register_send_verification_email_request_model.rs deleted file mode 100644 index eca497c72..000000000 --- a/crates/bitwarden-api-identity/src/models/register_send_verification_email_request_model.rs +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct RegisterSendVerificationEmailRequestModel { - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email")] - pub email: Option, - #[serde( - rename = "receiveMarketingEmails", - skip_serializing_if = "Option::is_none" - )] - pub receive_marketing_emails: Option, -} - -impl RegisterSendVerificationEmailRequestModel { - pub fn new(email: Option) -> RegisterSendVerificationEmailRequestModel { - RegisterSendVerificationEmailRequestModel { - name: None, - email, - receive_marketing_emails: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/register_verification_email_clicked_request_model.rs b/crates/bitwarden-api-identity/src/models/register_verification_email_clicked_request_model.rs deleted file mode 100644 index 1c5dff25f..000000000 --- a/crates/bitwarden-api-identity/src/models/register_verification_email_clicked_request_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct RegisterVerificationEmailClickedRequestModel { - #[serde(rename = "email")] - pub email: Option, - #[serde(rename = "emailVerificationToken")] - pub email_verification_token: Option, -} - -impl RegisterVerificationEmailClickedRequestModel { - pub fn new( - email: Option, - email_verification_token: Option, - ) -> RegisterVerificationEmailClickedRequestModel { - RegisterVerificationEmailClickedRequestModel { - email, - email_verification_token, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/trial_send_verification_email_request_model.rs b/crates/bitwarden-api-identity/src/models/trial_send_verification_email_request_model.rs deleted file mode 100644 index 547bfc06b..000000000 --- a/crates/bitwarden-api-identity/src/models/trial_send_verification_email_request_model.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct TrialSendVerificationEmailRequestModel { - #[serde(rename = "name", skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(rename = "email")] - pub email: Option, - #[serde( - rename = "receiveMarketingEmails", - skip_serializing_if = "Option::is_none" - )] - pub receive_marketing_emails: Option, - #[serde(rename = "productTier", skip_serializing_if = "Option::is_none")] - pub product_tier: Option, - #[serde(rename = "products", skip_serializing_if = "Option::is_none")] - pub products: Option>, -} - -impl TrialSendVerificationEmailRequestModel { - pub fn new(email: Option) -> TrialSendVerificationEmailRequestModel { - TrialSendVerificationEmailRequestModel { - name: None, - email, - receive_marketing_emails: None, - product_tier: None, - products: None, - } - } -} diff --git a/crates/bitwarden-api-identity/src/models/user_verification_requirement.rs b/crates/bitwarden-api-identity/src/models/user_verification_requirement.rs deleted file mode 100644 index d66a0ffde..000000000 --- a/crates/bitwarden-api-identity/src/models/user_verification_requirement.rs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum UserVerificationRequirement { - #[serde(rename = "required")] - Required, - #[serde(rename = "preferred")] - Preferred, - #[serde(rename = "discouraged")] - Discouraged, -} - -impl std::fmt::Display for UserVerificationRequirement { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - Self::Required => write!(f, "required"), - Self::Preferred => write!(f, "preferred"), - Self::Discouraged => write!(f, "discouraged"), - } - } -} - -impl Default for UserVerificationRequirement { - fn default() -> UserVerificationRequirement { - Self::Required - } -} diff --git a/crates/bitwarden-api-identity/src/models/web_authn_login_assertion_options_response_model.rs b/crates/bitwarden-api-identity/src/models/web_authn_login_assertion_options_response_model.rs deleted file mode 100644 index 3655701ba..000000000 --- a/crates/bitwarden-api-identity/src/models/web_authn_login_assertion_options_response_model.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Bitwarden Identity - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v1 - * - * Generated by: https://openapi-generator.tech - */ - -use serde::{Deserialize, Serialize}; - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct WebAuthnLoginAssertionOptionsResponseModel { - #[serde(rename = "object", skip_serializing_if = "Option::is_none")] - pub object: Option, - #[serde(rename = "options", skip_serializing_if = "Option::is_none")] - pub options: Option>, - #[serde(rename = "token", skip_serializing_if = "Option::is_none")] - pub token: Option, -} - -impl WebAuthnLoginAssertionOptionsResponseModel { - pub fn new() -> WebAuthnLoginAssertionOptionsResponseModel { - WebAuthnLoginAssertionOptionsResponseModel { - object: None, - options: None, - token: None, - } - } -} diff --git a/crates/bitwarden-cli/Cargo.toml b/crates/bitwarden-cli/Cargo.toml deleted file mode 100644 index c74fe3991..000000000 --- a/crates/bitwarden-cli/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "bitwarden-cli" -description = """ -Internal crate for the bws crate. Do not use. -""" - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[dependencies] -clap = { version = "4.5.4", features = ["derive"] } -color-eyre = "0.6.3" -inquire = "0.7.0" -supports-color = "3.0.0" - -[lints] -workspace = true diff --git a/crates/bitwarden-cli/README.md b/crates/bitwarden-cli/README.md deleted file mode 100644 index 651de965b..000000000 --- a/crates/bitwarden-cli/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Cli - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-cli/src/color.rs b/crates/bitwarden-cli/src/color.rs deleted file mode 100644 index 2e3a2c007..000000000 --- a/crates/bitwarden-cli/src/color.rs +++ /dev/null @@ -1,35 +0,0 @@ -use clap::ValueEnum; - -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)] -pub enum Color { - No, - Yes, - Auto, -} - -impl Color { - /** - * Evaluate if colors are supported - */ - pub fn is_enabled(self) -> bool { - match self { - Color::No => false, - Color::Yes => true, - Color::Auto => supports_color::on(supports_color::Stream::Stdout).is_some(), - } - } -} - -/** - * Installs color_eyre, if Color is disabled we use an empty theme to disable error colors. - */ -pub fn install_color_eyre(color: Color) -> color_eyre::Result<(), color_eyre::Report> { - if color.is_enabled() { - color_eyre::install() - } else { - // Use an empty theme to disable error coloring - color_eyre::config::HookBuilder::new() - .theme(color_eyre::config::Theme::new()) - .install() - } -} diff --git a/crates/bitwarden-cli/src/lib.rs b/crates/bitwarden-cli/src/lib.rs deleted file mode 100644 index d0c6a836e..000000000 --- a/crates/bitwarden-cli/src/lib.rs +++ /dev/null @@ -1,15 +0,0 @@ -mod color; - -pub use color::{install_color_eyre, Color}; -use inquire::{error::InquireResult, Text}; - -/// Prompt the user for input if the value is None -/// -/// Typically used when the user can provide a value via CLI or prompt -pub fn text_prompt_when_none(prompt: &str, val: Option) -> InquireResult { - Ok(if let Some(val) = val { - val - } else { - Text::new(prompt).prompt()? - }) -} diff --git a/crates/bitwarden-core/Cargo.toml b/crates/bitwarden-core/Cargo.toml deleted file mode 100644 index d212afb7a..000000000 --- a/crates/bitwarden-core/Cargo.toml +++ /dev/null @@ -1,67 +0,0 @@ -[package] -name = "bitwarden-core" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" -keywords = ["bitwarden"] - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[features] -internal = ["dep:zxcvbn"] -no-memory-hardening = [ - "bitwarden-crypto/no-memory-hardening", -] # Disable memory hardening features -uniffi = ["bitwarden-crypto/uniffi", "dep:uniffi"] # Uniffi bindings -secrets = [] # Secrets manager API -wasm = ["dep:wasm-bindgen", "dep:tsify-next"] # WASM support - -[dependencies] -base64 = ">=0.22.1, <0.23" -bitwarden-api-api = { workspace = true } -bitwarden-api-identity = { workspace = true } -bitwarden-crypto = { workspace = true } -chrono = { workspace = true, features = ["std"] } -# We don't use this directly (it's used by rand), but we need it here to enable WASM support -getrandom = { version = ">=0.2.9, <0.3", features = ["js"] } -hmac = ">=0.12.1, <0.13" -log = ">=0.4.18, <0.5" -rand = ">=0.8.5, <0.9" -reqwest = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -serde_qs = { workspace = true } -serde_repr = { workspace = true } -sha1 = ">=0.10.5, <0.11" -sha2 = ">=0.10.6, <0.11" -thiserror = { workspace = true } -uniffi = { workspace = true, optional = true, features = ["tokio"] } -uuid = { workspace = true } -validator = { workspace = true } -wasm-bindgen = { workspace = true, optional = true } -zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } -zxcvbn = { version = ">=3.0.1, <4.0", optional = true } -tsify-next = { workspace = true, optional = true } - -[target.'cfg(not(target_arch="wasm32"))'.dependencies] -# By default, we use rustls as the TLS stack and rust-platform-verifier to support user-installed root certificates -# The only exception is WASM, as it just uses the browsers/node fetch -reqwest = { workspace = true, features = ["rustls-tls-manual-roots"] } -rustls-platform-verifier = "0.3.4" - -[dev-dependencies] -bitwarden-crypto = { workspace = true } -rand_chacha = "0.3.1" -tokio = { workspace = true, features = ["rt"] } -wiremock = "0.6.0" -zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } - -[lints] -workspace = true diff --git a/crates/bitwarden-core/README.md b/crates/bitwarden-core/README.md deleted file mode 100644 index baddb938e..000000000 --- a/crates/bitwarden-core/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Core - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-core/src/.gitignore b/crates/bitwarden-core/src/.gitignore deleted file mode 100644 index 38afe6e07..000000000 --- a/crates/bitwarden-core/src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!bin diff --git a/crates/bitwarden-core/src/admin_console/mod.rs b/crates/bitwarden-core/src/admin_console/mod.rs deleted file mode 100644 index e553456cf..000000000 --- a/crates/bitwarden-core/src/admin_console/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod policy; - -pub use policy::Policy; diff --git a/crates/bitwarden-core/src/admin_console/policy.rs b/crates/bitwarden-core/src/admin_console/policy.rs deleted file mode 100644 index 2cf6a5530..000000000 --- a/crates/bitwarden-core/src/admin_console/policy.rs +++ /dev/null @@ -1,87 +0,0 @@ -use std::collections::HashMap; - -use bitwarden_api_api::models::PolicyResponseModel; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; -use uuid::Uuid; - -use crate::{ - error::{Error, Result}, - require, -}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -pub struct Policy { - id: Uuid, - organization_id: Uuid, - r#type: PolicyType, - data: Option>, - enabled: bool, -} - -#[derive(Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u8)] -pub enum PolicyType { - TwoFactorAuthentication = 0, // Requires users to have 2fa enabled - MasterPassword = 1, // Sets minimum requirements for master password complexity - PasswordGenerator = 2, /* Sets minimum requirements/default type for generated - * passwords/passphrases */ - SingleOrg = 3, // Allows users to only be apart of one organization - RequireSso = 4, // Requires users to authenticate with SSO - PersonalOwnership = 5, // Disables personal vault ownership for adding/cloning items - DisableSend = 6, // Disables the ability to create and edit Bitwarden Sends - SendOptions = 7, // Sets restrictions or defaults for Bitwarden Sends - ResetPassword = 8, /* Allows orgs to use reset password : also can enable - * auto-enrollment during invite flow */ - MaximumVaultTimeout = 9, // Sets the maximum allowed vault timeout - DisablePersonalVaultExport = 10, // Disable personal vault export - ActivateAutofill = 11, // Activates autofill with page load on the browser extension - AutomaticAppLogIn = 12, -} - -impl TryFrom for Policy { - type Error = Error; - - fn try_from(policy: PolicyResponseModel) -> Result { - Ok(Self { - id: require!(policy.id), - organization_id: require!(policy.organization_id), - r#type: require!(policy.r#type).into(), - data: policy.data, - enabled: require!(policy.enabled), - }) - } -} - -impl From for PolicyType { - fn from(policy_type: bitwarden_api_api::models::PolicyType) -> Self { - match policy_type { - bitwarden_api_api::models::PolicyType::TwoFactorAuthentication => { - PolicyType::TwoFactorAuthentication - } - bitwarden_api_api::models::PolicyType::MasterPassword => PolicyType::MasterPassword, - bitwarden_api_api::models::PolicyType::PasswordGenerator => { - PolicyType::PasswordGenerator - } - bitwarden_api_api::models::PolicyType::SingleOrg => PolicyType::SingleOrg, - bitwarden_api_api::models::PolicyType::RequireSso => PolicyType::RequireSso, - bitwarden_api_api::models::PolicyType::PersonalOwnership => { - PolicyType::PersonalOwnership - } - bitwarden_api_api::models::PolicyType::DisableSend => PolicyType::DisableSend, - bitwarden_api_api::models::PolicyType::SendOptions => PolicyType::SendOptions, - bitwarden_api_api::models::PolicyType::ResetPassword => PolicyType::ResetPassword, - bitwarden_api_api::models::PolicyType::MaximumVaultTimeout => { - PolicyType::MaximumVaultTimeout - } - bitwarden_api_api::models::PolicyType::DisablePersonalVaultExport => { - PolicyType::DisablePersonalVaultExport - } - bitwarden_api_api::models::PolicyType::ActivateAutofill => PolicyType::ActivateAutofill, - bitwarden_api_api::models::PolicyType::AutomaticAppLogIn => { - PolicyType::AutomaticAppLogIn - } - } - } -} diff --git a/crates/bitwarden-core/src/auth/access_token.rs b/crates/bitwarden-core/src/auth/access_token.rs deleted file mode 100644 index fa9257725..000000000 --- a/crates/bitwarden-core/src/auth/access_token.rs +++ /dev/null @@ -1,110 +0,0 @@ -use std::{fmt::Debug, str::FromStr}; - -use base64::Engine; -use bitwarden_crypto::{derive_shareable_key, SymmetricCryptoKey}; -use uuid::Uuid; -use zeroize::Zeroizing; - -use crate::{error::AccessTokenInvalidError, util::STANDARD_INDIFFERENT}; - -pub struct AccessToken { - pub access_token_id: Uuid, - pub client_secret: String, - pub encryption_key: SymmetricCryptoKey, -} - -// We don't want to log the more sensitive fields from an AccessToken -impl Debug for AccessToken { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("AccessToken") - .field("access_token_id", &self.access_token_id) - .finish() - } -} - -impl FromStr for AccessToken { - type Err = crate::error::Error; - - fn from_str(key: &str) -> std::result::Result { - let (first_part, encryption_key) = - key.split_once(':').ok_or(AccessTokenInvalidError::NoKey)?; - - let [version, access_token_id, client_secret]: [&str; 3] = first_part - .split('.') - .collect::>() - .try_into() - .map_err(|_| AccessTokenInvalidError::WrongParts)?; - - if version != "0" { - return Err(AccessTokenInvalidError::WrongVersion.into()); - } - - let Ok(access_token_id) = access_token_id.parse() else { - return Err(AccessTokenInvalidError::InvalidUuid.into()); - }; - - let encryption_key = STANDARD_INDIFFERENT - .decode(encryption_key) - .map_err(AccessTokenInvalidError::InvalidBase64)?; - let encryption_key = Zeroizing::new(encryption_key.try_into().map_err(|e: Vec<_>| { - AccessTokenInvalidError::InvalidBase64Length { - expected: 16, - got: e.len(), - } - })?); - let encryption_key = - derive_shareable_key(encryption_key, "accesstoken", Some("sm-access-token")); - - Ok(AccessToken { - access_token_id, - client_secret: client_secret.to_owned(), - encryption_key, - }) - } -} - -#[cfg(test)] -mod tests { - - use super::AccessToken; - - #[test] - fn can_decode_access_token() { - use std::str::FromStr; - - let access_token = "0.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe/qrzIQQ=="; - let token = AccessToken::from_str(access_token).unwrap(); - - assert_eq!( - &token.access_token_id.to_string(), - "ec2c1d46-6a4b-4751-a310-af9601317f2d" - ); - assert_eq!(token.client_secret, "C2IgxjjLF7qSshsbwe8JGcbM075YXw"); - assert_eq!(token.encryption_key.to_base64(), "H9/oIRLtL9nGCQOVDjSMoEbJsjWXSOCb3qeyDt6ckzS3FhyboEDWyTP/CQfbIszNmAVg2ExFganG1FVFGXO/Jg=="); - } - - #[test] - fn malformed_tokens() { - use std::str::FromStr; - - // Encryption key without base64 padding, we generate it with padding but ignore it when - // decoding - let t = "0.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe/qrzIQQ"; - assert!(AccessToken::from_str(t).is_ok()); - - // Invalid version - let t = "1.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe/qrzIQQ=="; - assert!(AccessToken::from_str(t).is_err()); - - // Invalid splits - let t = "0.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw.X8vbvA0bduihIDe/qrzIQQ=="; - assert!(AccessToken::from_str(t).is_err()); - - let t = "ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe/qrzIQQ=="; - assert!(AccessToken::from_str(t).is_err()); - - // Invalid base64 - let t = "1.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe9qrzIQQ=="; - assert!(AccessToken::from_str(t).is_err()); - } -} diff --git a/crates/bitwarden-core/src/auth/api/mod.rs b/crates/bitwarden-core/src/auth/api/mod.rs deleted file mode 100644 index e0062185c..000000000 --- a/crates/bitwarden-core/src/auth/api/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod request; -pub mod response; diff --git a/crates/bitwarden-core/src/auth/api/request/access_token_request.rs b/crates/bitwarden-core/src/auth/api/request/access_token_request.rs deleted file mode 100644 index 9f41d6b40..000000000 --- a/crates/bitwarden-core/src/auth/api/request/access_token_request.rs +++ /dev/null @@ -1,33 +0,0 @@ -use log::debug; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use crate::{auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; - -#[derive(Serialize, Deserialize, Debug)] -pub struct AccessTokenRequest { - scope: String, - client_id: String, - client_secret: String, - grant_type: String, -} - -impl AccessTokenRequest { - pub fn new(access_token_id: Uuid, client_secret: &String) -> Self { - let obj = Self { - scope: "api.secrets".to_string(), - client_id: access_token_id.to_string(), - client_secret: client_secret.to_string(), - grant_type: "client_credentials".to_string(), - }; - debug!("initializing {:?}", obj); - obj - } - - pub(crate) async fn send( - &self, - configurations: &ApiConfigurations, - ) -> Result { - super::send_identity_connect_request(configurations, None, &self).await - } -} diff --git a/crates/bitwarden-core/src/auth/api/request/api_token_request.rs b/crates/bitwarden-core/src/auth/api/request/api_token_request.rs deleted file mode 100644 index 087dc7e96..000000000 --- a/crates/bitwarden-core/src/auth/api/request/api_token_request.rs +++ /dev/null @@ -1,41 +0,0 @@ -use log::debug; -use serde::{Deserialize, Serialize}; - -use crate::{auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; - -#[derive(Serialize, Deserialize, Debug)] -pub struct ApiTokenRequest { - scope: String, - client_id: String, - client_secret: String, - #[serde(rename = "deviceType")] - device_type: u8, - #[serde(rename = "deviceIdentifier")] - device_identifier: String, - #[serde(rename = "deviceName")] - device_name: String, - grant_type: String, -} - -impl ApiTokenRequest { - pub fn new(client_id: &String, client_secret: &String) -> Self { - let obj = Self { - scope: "api".to_string(), - client_id: client_id.to_string(), - client_secret: client_secret.to_string(), - device_type: 10, - device_identifier: "b86dd6ab-4265-4ddf-a7f1-eb28d5677f33".to_string(), - device_name: "firefox".to_string(), - grant_type: "client_credentials".to_string(), - }; - debug!("initializing {:?}", obj); - obj - } - - pub(crate) async fn send( - &self, - configurations: &ApiConfigurations, - ) -> Result { - super::send_identity_connect_request(configurations, None, &self).await - } -} diff --git a/crates/bitwarden-core/src/auth/api/request/auth_request_token_request.rs b/crates/bitwarden-core/src/auth/api/request/auth_request_token_request.rs deleted file mode 100644 index 2b2a47839..000000000 --- a/crates/bitwarden-core/src/auth/api/request/auth_request_token_request.rs +++ /dev/null @@ -1,59 +0,0 @@ -use log::debug; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use crate::{ - auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result, - DeviceType, -}; - -#[derive(Serialize, Deserialize, Debug)] -pub struct AuthRequestTokenRequest { - scope: String, - client_id: String, - #[serde(rename = "deviceType")] - device_type: u8, - #[serde(rename = "deviceIdentifier")] - device_identifier: String, - #[serde(rename = "deviceName")] - device_name: String, - grant_type: String, - #[serde(rename = "username")] - email: String, - #[serde(rename = "authRequest")] - auth_request_id: Uuid, - #[serde(rename = "password")] - access_code: String, -} - -#[allow(dead_code)] -impl AuthRequestTokenRequest { - pub fn new( - email: &str, - auth_request_id: &Uuid, - access_code: &str, - device_type: DeviceType, - device_identifier: &str, - ) -> Self { - let obj = Self { - scope: "api offline_access".to_string(), - client_id: "web".to_string(), - device_type: device_type as u8, - device_identifier: device_identifier.to_string(), - device_name: "chrome".to_string(), - grant_type: "password".to_string(), - email: email.to_string(), - auth_request_id: *auth_request_id, - access_code: access_code.to_string(), - }; - debug!("initializing {:?}", obj); - obj - } - - pub(crate) async fn send( - &self, - configurations: &ApiConfigurations, - ) -> Result { - super::send_identity_connect_request(configurations, Some(&self.email), &self).await - } -} diff --git a/crates/bitwarden-core/src/auth/api/request/mod.rs b/crates/bitwarden-core/src/auth/api/request/mod.rs deleted file mode 100644 index 0d9f39877..000000000 --- a/crates/bitwarden-core/src/auth/api/request/mod.rs +++ /dev/null @@ -1,64 +0,0 @@ -#[cfg(feature = "secrets")] -mod access_token_request; -#[cfg(feature = "secrets")] -pub(crate) use access_token_request::*; - -mod api_token_request; -pub(crate) use api_token_request::*; - -#[cfg(feature = "internal")] -mod password_token_request; -#[cfg(feature = "internal")] -pub(crate) use password_token_request::*; - -mod renew_token_request; -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; -pub(crate) use renew_token_request::*; - -mod auth_request_token_request; -#[cfg(feature = "internal")] -pub(crate) use auth_request_token_request::*; - -use crate::{ - auth::api::response::{parse_identity_response, IdentityTokenResponse}, - client::ApiConfigurations, - error::Result, -}; - -async fn send_identity_connect_request( - configurations: &ApiConfigurations, - email: Option<&str>, - body: impl serde::Serialize, -) -> Result { - let mut request = configurations - .identity - .client - .post(format!( - "{}/connect/token", - &configurations.identity.base_path - )) - .header( - reqwest::header::CONTENT_TYPE, - "application/x-www-form-urlencoded; charset=utf-8", - ) - .header(reqwest::header::ACCEPT, "application/json") - .header("Device-Type", configurations.device_type as usize); - - if let Some(ref user_agent) = configurations.identity.user_agent { - request = request.header(reqwest::header::USER_AGENT, user_agent.clone()); - } - - if let Some(email) = email { - request = request.header("Auth-Email", URL_SAFE_NO_PAD.encode(email.as_bytes())); - } - - let response = request - .body(serde_qs::to_string(&body).expect("Serialize should be infallible")) - .send() - .await?; - - let status = response.status(); - let text = response.text().await?; - - parse_identity_response(status, text) -} diff --git a/crates/bitwarden-core/src/auth/api/request/password_token_request.rs b/crates/bitwarden-core/src/auth/api/request/password_token_request.rs deleted file mode 100644 index f1482fab4..000000000 --- a/crates/bitwarden-core/src/auth/api/request/password_token_request.rs +++ /dev/null @@ -1,70 +0,0 @@ -use log::debug; -use serde::{Deserialize, Serialize}; - -use crate::{ - auth::{ - api::response::IdentityTokenResponse, - login::{TwoFactorProvider, TwoFactorRequest}, - }, - client::ApiConfigurations, - error::Result, - DeviceType, -}; - -#[derive(Serialize, Deserialize, Debug)] -pub struct PasswordTokenRequest { - scope: String, - client_id: String, - #[serde(rename = "deviceType")] - device_type: u8, - #[serde(rename = "deviceIdentifier")] - device_identifier: String, - #[serde(rename = "deviceName")] - device_name: String, - grant_type: String, - #[serde(rename = "username")] - email: String, - #[serde(rename = "password")] - master_password_hash: String, - - #[serde(rename = "twoFactorToken")] - two_factor_token: Option, - #[serde(rename = "twoFactorProvider")] - two_factor_provider: Option, - #[serde(rename = "twoFactorToken")] - two_factor_remember: Option, -} - -impl PasswordTokenRequest { - pub fn new( - email: &str, - password_hash: &str, - device_type: DeviceType, - device_identifier: &str, - two_factor: &Option, - ) -> Self { - let tf = two_factor.as_ref(); - let obj = Self { - scope: "api offline_access".to_string(), - client_id: "web".to_string(), - device_type: device_type as u8, - device_identifier: device_identifier.to_string(), - device_name: "firefox".to_string(), - grant_type: "password".to_string(), - master_password_hash: password_hash.to_string(), - email: email.to_string(), - two_factor_token: tf.map(|t| t.token.to_owned()), - two_factor_provider: tf.map(|t| t.provider.clone()), - two_factor_remember: tf.map(|t| t.remember), - }; - debug!("initializing {:?}", obj); - obj - } - - pub(crate) async fn send( - &self, - configurations: &ApiConfigurations, - ) -> Result { - super::send_identity_connect_request(configurations, Some(&self.email), &self).await - } -} diff --git a/crates/bitwarden-core/src/auth/api/request/renew_token_request.rs b/crates/bitwarden-core/src/auth/api/request/renew_token_request.rs deleted file mode 100644 index b5a91dca4..000000000 --- a/crates/bitwarden-core/src/auth/api/request/renew_token_request.rs +++ /dev/null @@ -1,27 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use crate::{auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; - -#[derive(Serialize, Deserialize, Debug)] -pub struct RenewTokenRequest { - grant_type: String, - refresh_token: String, - client_id: String, -} - -impl RenewTokenRequest { - pub fn new(refresh_token: String, client_id: String) -> Self { - Self { - refresh_token, - client_id, - grant_type: "refresh_token".to_string(), - } - } - - pub(crate) async fn send( - &self, - configurations: &ApiConfigurations, - ) -> Result { - super::send_identity_connect_request(configurations, None, &self).await - } -} diff --git a/crates/bitwarden-core/src/auth/api/response/identity_captcha_response.rs b/crates/bitwarden-core/src/auth/api/response/identity_captcha_response.rs deleted file mode 100644 index ceac6d398..000000000 --- a/crates/bitwarden-core/src/auth/api/response/identity_captcha_response.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct IdentityCaptchaResponse { - pub error: String, - pub error_description: String, - #[serde(rename = "HCaptcha_SiteKey")] - pub site_key: String, - - /// Stores unknown api response fields - extra: Option>, -} - -#[cfg(test)] -mod test { - use super::*; - - impl Default for IdentityCaptchaResponse { - fn default() -> Self { - Self { - error: "invalid_grant".into(), - error_description: "Captcha required.".into(), - site_key: Default::default(), - extra: Default::default(), - } - } - } -} diff --git a/crates/bitwarden-core/src/auth/api/response/identity_payload_response.rs b/crates/bitwarden-core/src/auth/api/response/identity_payload_response.rs deleted file mode 100644 index 47543510b..000000000 --- a/crates/bitwarden-core/src/auth/api/response/identity_payload_response.rs +++ /dev/null @@ -1,13 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, PartialEq)] -#[cfg_attr(test, derive(Default))] -pub struct IdentityTokenPayloadResponse { - pub access_token: String, - pub expires_in: u64, - pub refresh_token: Option, - token_type: String, - scope: String, - - pub(crate) encrypted_payload: String, -} diff --git a/crates/bitwarden-core/src/auth/api/response/identity_refresh_response.rs b/crates/bitwarden-core/src/auth/api/response/identity_refresh_response.rs deleted file mode 100644 index c5733bd36..000000000 --- a/crates/bitwarden-core/src/auth/api/response/identity_refresh_response.rs +++ /dev/null @@ -1,11 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, PartialEq)] -#[cfg_attr(test, derive(Default))] -pub struct IdentityTokenRefreshResponse { - pub access_token: String, - pub expires_in: u64, - pub refresh_token: Option, - token_type: String, - scope: String, -} diff --git a/crates/bitwarden-core/src/auth/api/response/identity_success_response.rs b/crates/bitwarden-core/src/auth/api/response/identity_success_response.rs deleted file mode 100644 index 94ebe9445..000000000 --- a/crates/bitwarden-core/src/auth/api/response/identity_success_response.rs +++ /dev/null @@ -1,68 +0,0 @@ -use std::{collections::HashMap, num::NonZeroU32}; - -use bitwarden_api_identity::models::KdfType; -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct IdentityTokenSuccessResponse { - pub access_token: String, - pub expires_in: u64, - pub refresh_token: Option, - token_type: String, - - #[serde(rename = "privateKey", alias = "PrivateKey")] - pub(crate) private_key: Option, - #[serde(alias = "Key")] - pub(crate) key: Option, - #[serde(rename = "twoFactorToken")] - two_factor_token: Option, - #[serde(alias = "Kdf")] - kdf: KdfType, - #[serde( - rename = "kdfIterations", - alias = "KdfIterations", - default = "bitwarden_crypto::default_pbkdf2_iterations" - )] - kdf_iterations: NonZeroU32, - - #[serde(rename = "resetMasterPassword", alias = "ResetMasterPassword")] - pub reset_master_password: bool, - #[serde(rename = "forcePasswordReset", alias = "ForcePasswordReset")] - pub force_password_reset: bool, - #[serde(rename = "apiUseKeyConnector", alias = "ApiUseKeyConnector")] - api_use_key_connector: Option, - #[serde(rename = "keyConnectorUrl", alias = "KeyConnectorUrl")] - key_connector_url: Option, - - /// Stores unknown api response fields - extra: Option>, -} - -#[cfg(test)] -mod test { - use bitwarden_crypto::default_pbkdf2_iterations; - - use super::*; - - impl Default for IdentityTokenSuccessResponse { - fn default() -> Self { - Self { - access_token: Default::default(), - expires_in: Default::default(), - refresh_token: Default::default(), - token_type: Default::default(), - private_key: Default::default(), - key: Default::default(), - two_factor_token: Default::default(), - kdf: KdfType::default(), - kdf_iterations: default_pbkdf2_iterations(), - reset_master_password: Default::default(), - force_password_reset: Default::default(), - api_use_key_connector: Default::default(), - key_connector_url: Default::default(), - extra: Default::default(), - } - } - } -} diff --git a/crates/bitwarden-core/src/auth/api/response/identity_token_fail_response.rs b/crates/bitwarden-core/src/auth/api/response/identity_token_fail_response.rs deleted file mode 100644 index 976ec0d8c..000000000 --- a/crates/bitwarden-core/src/auth/api/response/identity_token_fail_response.rs +++ /dev/null @@ -1,36 +0,0 @@ -use core::fmt; - -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] -pub struct IdentityTokenFailResponse { - pub error: String, - pub error_description: String, - #[serde(alias = "ErrorModel")] - pub error_model: ErrorModel, -} - -impl fmt::Display for IdentityTokenFailResponse { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let msg = match self.error_model.message.trim().is_empty() { - true => format!("{}: {}", self.error, self.error_description), - false => self.error_model.message.clone(), - }; - - write!(f, "{}", msg) - } -} - -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] -pub struct ErrorModel { - #[serde(alias = "Message")] - pub message: String, - #[serde(alias = "Object")] - object: String, -} - -impl fmt::Display for ErrorModel { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.message) - } -} diff --git a/crates/bitwarden-core/src/auth/api/response/identity_token_response.rs b/crates/bitwarden-core/src/auth/api/response/identity_token_response.rs deleted file mode 100644 index b22263bc5..000000000 --- a/crates/bitwarden-core/src/auth/api/response/identity_token_response.rs +++ /dev/null @@ -1,75 +0,0 @@ -use reqwest::StatusCode; -use serde::{Deserialize, Serialize}; - -use crate::{ - auth::api::response::{ - IdentityCaptchaResponse, IdentityTokenFailResponse, IdentityTokenPayloadResponse, - IdentityTokenRefreshResponse, IdentityTokenSuccessResponse, IdentityTwoFactorResponse, - }, - error::{Error, Result}, -}; - -#[derive(Debug, Serialize, Deserialize, PartialEq)] -pub enum IdentityTokenResponse { - Authenticated(IdentityTokenSuccessResponse), - Payload(IdentityTokenPayloadResponse), - Refreshed(IdentityTokenRefreshResponse), - TwoFactorRequired(Box), - CaptchaRequired(IdentityCaptchaResponse), -} - -pub fn parse_identity_response( - status: StatusCode, - response: String, -) -> Result { - if let Ok(r) = serde_json::from_str::(&response) { - Ok(IdentityTokenResponse::Authenticated(r)) - } else if let Ok(r) = serde_json::from_str::(&response) { - Ok(IdentityTokenResponse::Payload(r)) - } else if let Ok(r) = serde_json::from_str::(&response) { - Ok(IdentityTokenResponse::Refreshed(r)) - } else if let Ok(r) = serde_json::from_str::(&response) { - Ok(IdentityTokenResponse::TwoFactorRequired(Box::new(r))) - } else if let Ok(r) = serde_json::from_str::(&response) { - Ok(IdentityTokenResponse::CaptchaRequired(r)) - } else if let Ok(r) = serde_json::from_str::(&response) { - Err(Error::IdentityFail(r)) - } else { - Err(Error::ResponseContent { - status, - message: response, - }) - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn success() { - let expected = IdentityTokenSuccessResponse::default(); - let success = serde_json::to_string(&expected).unwrap(); - let expected = IdentityTokenResponse::Authenticated(expected); - let actual = parse_identity_response(StatusCode::OK, success).unwrap(); - assert_eq!(expected, actual); - } - - #[test] - fn two_factor() { - let expected = Box::::default(); - let two_factor = serde_json::to_string(&expected).unwrap(); - let expected = IdentityTokenResponse::TwoFactorRequired(expected); - let actual = parse_identity_response(StatusCode::BAD_REQUEST, two_factor).unwrap(); - assert_eq!(expected, actual); - } - - #[test] - fn captcha() { - let expected = IdentityCaptchaResponse::default(); - let captcha = serde_json::to_string(&expected).unwrap(); - let expected = IdentityTokenResponse::CaptchaRequired(expected); - let actual = parse_identity_response(StatusCode::BAD_REQUEST, captcha).unwrap(); - assert_eq!(expected, actual); - } -} diff --git a/crates/bitwarden-core/src/auth/api/response/identity_two_factor_response.rs b/crates/bitwarden-core/src/auth/api/response/identity_two_factor_response.rs deleted file mode 100644 index f4765cc3d..000000000 --- a/crates/bitwarden-core/src/auth/api/response/identity_two_factor_response.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -use crate::auth::api::response::two_factor_providers::TwoFactorProviders; - -#[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct IdentityTwoFactorResponse { - pub error: String, - pub error_description: String, - #[serde(rename = "twoFactorProviders2", alias = "TwoFactorProviders2")] - pub two_factor_providers: TwoFactorProviders, - #[serde(rename = "captchaBypassToken", alias = "CaptchaBypassToken")] - pub captcha_token: Option, - - /// Stores unknown api response fields - extra: Option>, -} - -#[cfg(test)] -mod test { - use super::*; - - impl Default for IdentityTwoFactorResponse { - fn default() -> Self { - Self { - error: "invalid_grant".into(), - error_description: "Two factor required.".into(), - two_factor_providers: Default::default(), - captcha_token: Default::default(), - extra: Default::default(), - } - } - } -} diff --git a/crates/bitwarden-core/src/auth/api/response/mod.rs b/crates/bitwarden-core/src/auth/api/response/mod.rs deleted file mode 100644 index 67d9d417d..000000000 --- a/crates/bitwarden-core/src/auth/api/response/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod identity_captcha_response; -mod identity_payload_response; -mod identity_refresh_response; -mod identity_success_response; -mod identity_token_fail_response; -mod identity_token_response; -mod identity_two_factor_response; -pub(crate) mod two_factor_provider_data; -mod two_factor_providers; - -pub(crate) use identity_captcha_response::*; -pub(crate) use identity_payload_response::*; -pub(crate) use identity_refresh_response::*; -pub(crate) use identity_success_response::*; -pub(crate) use identity_token_fail_response::*; -pub(crate) use identity_token_response::*; -pub(crate) use identity_two_factor_response::*; -pub(crate) use two_factor_providers::*; diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/authenticator.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/authenticator.rs deleted file mode 100644 index 242f80f24..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/authenticator.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] -pub struct Authenticator { - /// Stores unknown api response fields - extra: Option>, -} diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/duo.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/duo.rs deleted file mode 100644 index f533ef671..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/duo.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] -pub struct Duo { - #[serde(alias = "Host")] - pub host: String, - #[serde(alias = "Signature")] - pub signature: String, - - /// Stores unknown api response fields - extra: Option>, -} diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/email.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/email.rs deleted file mode 100644 index be200372e..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/email.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] -pub struct Email { - #[serde(alias = "Email")] - pub email: String, - - /// Stores unknown api response fields - extra: Option>, -} diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/mod.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/mod.rs deleted file mode 100644 index a5b36ae21..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod authenticator; -pub mod duo; -pub mod email; -pub mod organization_duo; -pub mod remember; -pub mod web_authn; -pub mod yubi_key; diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/organization_duo.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/organization_duo.rs deleted file mode 100644 index 8d8f8a7ae..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/organization_duo.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] -pub struct OrganizationDuo { - #[serde(alias = "Host")] - pub host: String, - #[serde(alias = "Signature")] - pub signature: String, - - /// Stores unknown api response fields - extra: Option>, -} diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/remember.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/remember.rs deleted file mode 100644 index 51748df2c..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/remember.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] -pub struct Remember { - /// Stores unknown api response fields - extra: Option>, -} diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/web_authn.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/web_authn.rs deleted file mode 100644 index ea42a818f..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/web_authn.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] -pub struct WebAuthn { - /// Stores unknown api response fields - extra: Option>, -} diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/yubi_key.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/yubi_key.rs deleted file mode 100644 index a703ed6e1..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_provider_data/yubi_key.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; -use serde_json::Value; - -#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] -pub struct YubiKey { - #[serde(alias = "Nfc")] - pub nfc: bool, - - /// Stores unknown api response fields - extra: Option>, -} diff --git a/crates/bitwarden-core/src/auth/api/response/two_factor_providers.rs b/crates/bitwarden-core/src/auth/api/response/two_factor_providers.rs deleted file mode 100644 index a0bbd52ff..000000000 --- a/crates/bitwarden-core/src/auth/api/response/two_factor_providers.rs +++ /dev/null @@ -1,57 +0,0 @@ -use std::collections::HashMap; - -use serde::{Deserialize, Deserializer, Serialize}; -use serde_json::Value; - -use crate::auth::api::response::two_factor_provider_data::{ - authenticator::Authenticator, duo::Duo, email::Email, organization_duo::OrganizationDuo, - remember::Remember, web_authn::WebAuthn, yubi_key::YubiKey, -}; - -#[derive(Serialize, Deserialize, Debug, PartialEq)] -pub struct TwoFactorProviders { - #[serde(rename = "0", default, deserialize_with = "double_option")] - pub authenticator: Option>, - #[serde(rename = "1")] - pub email: Option, - #[serde(rename = "2")] - pub duo: Option, - #[serde(rename = "3")] - pub yubi_key: Option, - // Deprecated - // #[serde(rename = "4")] - // u2f: Option, - #[serde(rename = "5")] - pub remember: Option, - #[serde(rename = "6")] - pub organization_duo: Option, - #[serde(rename = "7")] - pub web_authn: Option, - - /// Stores unknown api response fields - extra: Option>, -} - -impl Default for TwoFactorProviders { - fn default() -> Self { - Self { - authenticator: Some(Default::default()), - email: Some(Default::default()), - duo: Some(Default::default()), - yubi_key: Some(Default::default()), - remember: Some(Default::default()), - organization_duo: Some(Default::default()), - web_authn: Some(Default::default()), - - extra: Default::default(), - } - } -} - -pub fn double_option<'de, T, D>(de: D) -> Result>, D::Error> -where - T: Deserialize<'de>, - D: Deserializer<'de>, -{ - Deserialize::deserialize(de).map(Some) -} diff --git a/crates/bitwarden-core/src/auth/auth_request.rs b/crates/bitwarden-core/src/auth/auth_request.rs deleted file mode 100644 index 1d6ce1802..000000000 --- a/crates/bitwarden-core/src/auth/auth_request.rs +++ /dev/null @@ -1,255 +0,0 @@ -use base64::{engine::general_purpose::STANDARD, Engine}; -use bitwarden_crypto::{ - fingerprint, generate_random_alphanumeric, AsymmetricCryptoKey, AsymmetricEncString, - AsymmetricPublicCryptoKey, -}; -#[cfg(feature = "internal")] -use bitwarden_crypto::{EncString, KeyDecryptable, SymmetricCryptoKey}; - -#[cfg(feature = "internal")] -use crate::client::encryption_settings::EncryptionSettingsError; -use crate::{error::Error, Client}; - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct AuthRequestResponse { - /// Base64 encoded private key - /// This key is temporarily passed back and will most likely not be available in the future - pub private_key: String, - /// Base64 encoded public key - pub public_key: String, - /// Fingerprint of the public key - pub fingerprint: String, - /// Access code - pub access_code: String, -} - -/// Initiate a new auth request. -/// -/// Generates a private key and access code. The pulic key is uploaded to the server and transmitted -/// to another device. Where the user confirms the validity by confirming the fingerprint. The user -/// key is then encrypted using the public key and returned to the initiating device. -pub(crate) fn new_auth_request(email: &str) -> Result { - let mut rng = rand::thread_rng(); - - let key = AsymmetricCryptoKey::generate(&mut rng); - - let spki = key.to_public_der()?; - - let fingerprint = fingerprint(email, &spki)?; - let b64 = STANDARD.encode(&spki); - - Ok(AuthRequestResponse { - private_key: STANDARD.encode(key.to_der()?), - public_key: b64, - fingerprint, - access_code: generate_random_alphanumeric(25), - }) -} - -/// Decrypt the user key using the private key generated previously. -#[cfg(feature = "internal")] -pub(crate) fn auth_request_decrypt_user_key( - private_key: String, - user_key: AsymmetricEncString, -) -> Result { - let key = AsymmetricCryptoKey::from_der(&STANDARD.decode(private_key)?)?; - let mut key: Vec = user_key.decrypt_with_key(&key)?; - - Ok(SymmetricCryptoKey::try_from(key.as_mut_slice())?) -} - -/// Decrypt the user key using the private key generated previously. -#[cfg(feature = "internal")] -pub(crate) fn auth_request_decrypt_master_key( - private_key: String, - master_key: AsymmetricEncString, - user_key: EncString, -) -> Result { - use bitwarden_crypto::MasterKey; - - let key = AsymmetricCryptoKey::from_der(&STANDARD.decode(private_key)?)?; - let mut master_key: Vec = master_key.decrypt_with_key(&key)?; - let master_key = MasterKey::new(SymmetricCryptoKey::try_from(master_key.as_mut_slice())?); - - Ok(master_key.decrypt_user_key(user_key)?) -} - -/// Approve an auth request. -/// -/// Encrypts the user key with a public key. -pub(crate) fn approve_auth_request( - client: &Client, - public_key: String, -) -> Result { - let public_key = AsymmetricPublicCryptoKey::from_der(&STANDARD.decode(public_key)?)?; - - let enc = client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - Ok(AsymmetricEncString::encrypt_rsa2048_oaep_sha1( - &key.to_vec(), - &public_key, - )?) -} - -#[test] -fn test_auth_request() { - let request = new_auth_request("test@bitwarden.com").unwrap(); - - let secret: &[u8] = &[ - 111, 32, 97, 169, 4, 241, 174, 74, 239, 206, 113, 86, 174, 68, 216, 238, 52, 85, 156, 27, - 134, 149, 54, 55, 91, 147, 45, 130, 131, 237, 51, 31, 191, 106, 155, 14, 160, 82, 47, 40, - 96, 31, 114, 127, 212, 187, 167, 110, 205, 116, 198, 243, 218, 72, 137, 53, 248, 43, 255, - 67, 35, 61, 245, 93, - ]; - - let private_key = - AsymmetricCryptoKey::from_der(&STANDARD.decode(&request.private_key).unwrap()).unwrap(); - - let encrypted = AsymmetricEncString::encrypt_rsa2048_oaep_sha1(secret, &private_key).unwrap(); - - let decrypted = auth_request_decrypt_user_key(request.private_key, encrypted).unwrap(); - - assert_eq!(&decrypted.to_vec(), secret); -} - -#[cfg(test)] -mod tests { - use std::num::NonZeroU32; - - use bitwarden_crypto::{Kdf, MasterKey}; - - use super::*; - use crate::mobile::crypto::{AuthRequestMethod, InitUserCryptoMethod, InitUserCryptoRequest}; - - #[test] - fn test_approve() { - let client = Client::new(None); - - let master_key = MasterKey::derive( - "asdfasdfasdf", - "test@bitwarden.com", - &Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }, - ) - .unwrap(); - - let user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".parse().unwrap(); - let private_key ="2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=".parse().unwrap(); - client - .internal - .initialize_user_crypto_master_key(master_key, user_key, private_key) - .unwrap(); - - let public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyLRDUwXB4BfQ507D4meFPmwn5zwy3IqTPJO4plrrhnclWahXa240BzyFW9gHgYu+Jrgms5xBfRTBMcEsqqNm7+JpB6C1B6yvnik0DpJgWQw1rwvy4SUYidpR/AWbQi47n/hvnmzI/sQxGddVfvWu1iTKOlf5blbKYAXnUE5DZBGnrWfacNXwRRdtP06tFB0LwDgw+91CeLSJ9py6dm1qX5JIxoO8StJOQl65goLCdrTWlox+0Jh4xFUfCkb+s3px+OhSCzJbvG/hlrSRcUz5GnwlCEyF3v5lfUtV96MJD+78d8pmH6CfFAp2wxKRAbGdk+JccJYO6y6oIXd3Fm7twIDAQAB"; - - // Verify fingerprint - let pbkey = STANDARD.decode(public_key).unwrap(); - let fingerprint = fingerprint("test@bitwarden.com", &pbkey).unwrap(); - assert_eq!(fingerprint, "childless-unfair-prowler-dropbox-designate"); - - approve_auth_request(&client, public_key.to_owned()).unwrap(); - } - - #[tokio::test] - async fn test_decrypt_user_key() { - let private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCzLtEUdxfcLxDj84yaGFsVF5hZ8Hjlb08NMQDy1RnBma06I3ZESshLYzVz4r/gegMn9OOltfV/Yxlyvida8oW6qdlfJ7AVz6Oa8pV7BiL40C7b76+oqraQpyYw2HChANB1AhXL9SqWngKmLZwjA7qiCrmcc0kZHeOb4KnKtp9iVvPVs+8veFvKgYO4ba2AAOHKFdR0W55/agXfAy+fWUAkC8mc9ikyJdQWaPV6OZvC2XFkOseBQm9Rynudh3BQpoWiL6w620efe7t5k+02/EyOFJL9f/XEEjM/+Yo0t3LAfkuhHGeKiRST59Xc9hTEmyJTeVXROtz+0fjqOp3xkaObAgMBAAECggEACs4xhnO0HaZhh1/iH7zORMIRXKeyxP2LQiTR8xwN5JJ9wRWmGAR9VasS7EZFTDidIGVME2u/h4s5EqXnhxfO+0gGksVvgNXJ/qw87E8K2216g6ZNo6vSGA7H1GH2voWwejJ4/k/cJug6dz2S402rRAKh2Wong1arYHSkVlQp3diiMa5FHAOSE+Cy09O2ZsaF9IXQYUtlW6AVXFrBEPYH2kvkaPXchh8VETMijo6tbvoKLnUHe+wTaDMls7hy8exjtVyI59r3DNzjy1lNGaGb5QSnFMXR+eHhPZc844Wv02MxC15zKABADrl58gpJyjTl6XpDdHCYGsmGpVGH3X9TQQKBgQDz/9beFjzq59ve6rGwn+EtnQfSsyYT+jr7GN8lNEXb3YOFXBgPhfFIcHRh2R00Vm9w2ApfAx2cd8xm2I6HuvQ1Os7g26LWazvuWY0Qzb+KaCLQTEGH1RnTq6CCG+BTRq/a3J8M4t38GV5TWlzv8wr9U4dl6FR4efjb65HXs1GQ4QKBgQC7/uHfrOTEHrLeIeqEuSl0vWNqEotFKdKLV6xpOvNuxDGbgW4/r/zaxDqt0YBOXmRbQYSEhmO3oy9J6XfE1SUln0gbavZeW0HESCAmUIC88bDnspUwS9RxauqT5aF8ODKN/bNCWCnBM1xyonPOs1oT1nyparJVdQoG//Y7vkB3+wKBgBqLqPq8fKAp3XfhHLfUjREDVoiLyQa/YI9U42IOz9LdxKNLo6p8rgVthpvmnRDGnpUuS+KOWjhdqDVANjF6G3t3DG7WNl8Rh5Gk2H4NhFswfSkgQrjebFLlBy9gjQVCWXt8KSmjvPbiY6q52Aaa8IUjA0YJAregvXxfopxO+/7BAoGARicvEtDp7WWnSc1OPoj6N14VIxgYcI7SyrzE0d/1x3ffKzB5e7qomNpxKzvqrVP8DzG7ydh8jaKPmv1MfF8tpYRy3AhmN3/GYwCnPqT75YYrhcrWcVdax5gmQVqHkFtIQkRSCIftzPLlpMGKha/YBV8c1fvC4LD0NPh/Ynv0gtECgYEAyOZg95/kte0jpgUEgwuMrzkhY/AaUJULFuR5MkyvReEbtSBQwV5tx60+T95PHNiFooWWVXiLMsAgyI2IbkxVR1Pzdri3gWK5CTfqb7kLuaj/B7SGvBa2Sxo478KS5K8tBBBWkITqo+wLC0mn3uZi1dyMWO1zopTA+KtEGF2dtGQ="; - - let enc_user_key = "4.dxbd5OMwi/Avy7DQxvLV+Z7kDJgHBtg/jAbgYNO7QU0Zii4rLFNco2lS5aS9z42LTZHc2p5HYwn2ZwkZNfHsQ6//d5q40MDgGYJMKBXOZP62ZHhct1XsvYBmtcUtIOm5j2HSjt2pjEuGAc1LbyGIWRJJQ3Lp1ULbL2m71I+P23GF36JyOM8SUWvpvxE/3+qqVhRFPG2VqMCYa2kLLxwVfUmpV+KKjX1TXsrq6pfJIwHNwHw4h7MSfD8xTy2bx4MiBt638Z9Vt1pGsSQkh9RgPvCbnhuCpZQloUgJ8ByLVEcrlKx3yaaxiQXvte+ZhuOI7rGdjmoVoOzisooje4JgYw==".parse().unwrap(); - let dec = auth_request_decrypt_user_key(private_key.to_owned(), enc_user_key).unwrap(); - - assert_eq!( - &dec.to_vec(), - &[ - 201, 37, 234, 213, 21, 75, 40, 70, 149, 213, 234, 16, 19, 251, 162, 245, 161, 74, - 34, 245, 211, 151, 211, 192, 95, 10, 117, 50, 88, 223, 23, 157 - ] - ); - } - - #[tokio::test] - async fn test_decrypt_master_key() { - let private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCzLtEUdxfcLxDj84yaGFsVF5hZ8Hjlb08NMQDy1RnBma06I3ZESshLYzVz4r/gegMn9OOltfV/Yxlyvida8oW6qdlfJ7AVz6Oa8pV7BiL40C7b76+oqraQpyYw2HChANB1AhXL9SqWngKmLZwjA7qiCrmcc0kZHeOb4KnKtp9iVvPVs+8veFvKgYO4ba2AAOHKFdR0W55/agXfAy+fWUAkC8mc9ikyJdQWaPV6OZvC2XFkOseBQm9Rynudh3BQpoWiL6w620efe7t5k+02/EyOFJL9f/XEEjM/+Yo0t3LAfkuhHGeKiRST59Xc9hTEmyJTeVXROtz+0fjqOp3xkaObAgMBAAECggEACs4xhnO0HaZhh1/iH7zORMIRXKeyxP2LQiTR8xwN5JJ9wRWmGAR9VasS7EZFTDidIGVME2u/h4s5EqXnhxfO+0gGksVvgNXJ/qw87E8K2216g6ZNo6vSGA7H1GH2voWwejJ4/k/cJug6dz2S402rRAKh2Wong1arYHSkVlQp3diiMa5FHAOSE+Cy09O2ZsaF9IXQYUtlW6AVXFrBEPYH2kvkaPXchh8VETMijo6tbvoKLnUHe+wTaDMls7hy8exjtVyI59r3DNzjy1lNGaGb5QSnFMXR+eHhPZc844Wv02MxC15zKABADrl58gpJyjTl6XpDdHCYGsmGpVGH3X9TQQKBgQDz/9beFjzq59ve6rGwn+EtnQfSsyYT+jr7GN8lNEXb3YOFXBgPhfFIcHRh2R00Vm9w2ApfAx2cd8xm2I6HuvQ1Os7g26LWazvuWY0Qzb+KaCLQTEGH1RnTq6CCG+BTRq/a3J8M4t38GV5TWlzv8wr9U4dl6FR4efjb65HXs1GQ4QKBgQC7/uHfrOTEHrLeIeqEuSl0vWNqEotFKdKLV6xpOvNuxDGbgW4/r/zaxDqt0YBOXmRbQYSEhmO3oy9J6XfE1SUln0gbavZeW0HESCAmUIC88bDnspUwS9RxauqT5aF8ODKN/bNCWCnBM1xyonPOs1oT1nyparJVdQoG//Y7vkB3+wKBgBqLqPq8fKAp3XfhHLfUjREDVoiLyQa/YI9U42IOz9LdxKNLo6p8rgVthpvmnRDGnpUuS+KOWjhdqDVANjF6G3t3DG7WNl8Rh5Gk2H4NhFswfSkgQrjebFLlBy9gjQVCWXt8KSmjvPbiY6q52Aaa8IUjA0YJAregvXxfopxO+/7BAoGARicvEtDp7WWnSc1OPoj6N14VIxgYcI7SyrzE0d/1x3ffKzB5e7qomNpxKzvqrVP8DzG7ydh8jaKPmv1MfF8tpYRy3AhmN3/GYwCnPqT75YYrhcrWcVdax5gmQVqHkFtIQkRSCIftzPLlpMGKha/YBV8c1fvC4LD0NPh/Ynv0gtECgYEAyOZg95/kte0jpgUEgwuMrzkhY/AaUJULFuR5MkyvReEbtSBQwV5tx60+T95PHNiFooWWVXiLMsAgyI2IbkxVR1Pzdri3gWK5CTfqb7kLuaj/B7SGvBa2Sxo478KS5K8tBBBWkITqo+wLC0mn3uZi1dyMWO1zopTA+KtEGF2dtGQ="; - - let enc_master_key = "4.dxbd5OMwi/Avy7DQxvLV+Z7kDJgHBtg/jAbgYNO7QU0Zii4rLFNco2lS5aS9z42LTZHc2p5HYwn2ZwkZNfHsQ6//d5q40MDgGYJMKBXOZP62ZHhct1XsvYBmtcUtIOm5j2HSjt2pjEuGAc1LbyGIWRJJQ3Lp1ULbL2m71I+P23GF36JyOM8SUWvpvxE/3+qqVhRFPG2VqMCYa2kLLxwVfUmpV+KKjX1TXsrq6pfJIwHNwHw4h7MSfD8xTy2bx4MiBt638Z9Vt1pGsSQkh9RgPvCbnhuCpZQloUgJ8ByLVEcrlKx3yaaxiQXvte+ZhuOI7rGdjmoVoOzisooje4JgYw==".parse().unwrap(); - let enc_user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".parse().unwrap(); - let dec = - auth_request_decrypt_master_key(private_key.to_owned(), enc_master_key, enc_user_key) - .unwrap(); - - assert_eq!( - &dec.to_vec(), - &[ - 109, 128, 172, 147, 206, 123, 134, 95, 16, 36, 155, 113, 201, 18, 186, 230, 216, - 212, 173, 188, 74, 11, 134, 131, 137, 242, 105, 178, 105, 126, 52, 139, 248, 91, - 215, 21, 128, 91, 226, 222, 165, 67, 251, 34, 83, 81, 77, 147, 225, 76, 13, 41, - 102, 45, 183, 218, 106, 89, 254, 208, 251, 101, 130, 10, - ] - ); - } - - #[tokio::test] - async fn test_device_login() { - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }; - let email = "test@bitwarden.com"; - - let user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".parse().unwrap(); - let private_key = "2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4="; - - // Initialize an existing client which is unlocked - let existing_device = Client::new(None); - - let master_key = MasterKey::derive("asdfasdfasdf", email, &kdf).unwrap(); - - existing_device - .internal - .initialize_user_crypto_master_key(master_key, user_key, private_key.parse().unwrap()) - .unwrap(); - - // Initialize a new device which will request to be logged in - let new_device = Client::new(None); - - // Initialize an auth request, and approve it on the existing device - let auth_req = new_auth_request(email).unwrap(); - let approved_req = approve_auth_request(&existing_device, auth_req.public_key).unwrap(); - - // Unlock the vault using the approved request - new_device - .crypto() - .initialize_user_crypto(InitUserCryptoRequest { - kdf_params: kdf, - email: email.to_owned(), - private_key: private_key.to_owned(), - method: InitUserCryptoMethod::AuthRequest { - request_private_key: auth_req.private_key, - method: AuthRequestMethod::UserKey { - protected_user_key: approved_req, - }, - }, - }) - .await - .unwrap(); - - // We can validate that the vault is unlocked correctly by confirming the user key is the - // same - assert_eq!( - existing_device - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64(), - new_device - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64() - ); - } -} diff --git a/crates/bitwarden-core/src/auth/client_auth.rs b/crates/bitwarden-core/src/auth/client_auth.rs deleted file mode 100644 index 829868556..000000000 --- a/crates/bitwarden-core/src/auth/client_auth.rs +++ /dev/null @@ -1,277 +0,0 @@ -#[cfg(feature = "internal")] -use bitwarden_crypto::{ - AsymmetricEncString, CryptoError, DeviceKey, EncString, Kdf, TrustDeviceResponse, -}; - -#[cfg(feature = "secrets")] -use crate::auth::login::{login_access_token, AccessTokenLoginRequest, AccessTokenLoginResponse}; -#[cfg(feature = "internal")] -use crate::auth::{ - auth_request::{approve_auth_request, new_auth_request}, - key_connector::{make_key_connector_keys, KeyConnectorResponse}, - login::{ - login_api_key, login_password, send_two_factor_email, ApiKeyLoginRequest, - ApiKeyLoginResponse, NewAuthRequestResponse, PasswordLoginRequest, PasswordLoginResponse, - TwoFactorEmailRequest, - }, - password::{ - password_strength, satisfies_policy, validate_password, validate_password_user_key, - MasterPasswordPolicyOptions, - }, - pin::validate_pin, - register::{make_register_keys, register}, - tde::{make_register_tde_keys, RegisterTdeKeyResponse}, - AuthRequestResponse, RegisterKeyResponse, RegisterRequest, -}; -use crate::{auth::renew::renew_token, error::Result, Client}; - -pub struct ClientAuth<'a> { - pub(crate) client: &'a crate::Client, -} - -impl<'a> ClientAuth<'a> { - pub async fn renew_token(&self) -> Result<()> { - renew_token(&self.client.internal).await - } - - #[cfg(feature = "secrets")] - pub async fn login_access_token( - &self, - input: &AccessTokenLoginRequest, - ) -> Result { - login_access_token(self.client, input).await - } -} - -#[cfg(feature = "internal")] -impl<'a> ClientAuth<'a> { - pub fn password_strength( - &self, - password: String, - email: String, - additional_inputs: Vec, - ) -> u8 { - password_strength(password, email, additional_inputs) - } - - pub fn satisfies_policy( - &self, - password: String, - strength: u8, - policy: &MasterPasswordPolicyOptions, - ) -> bool { - satisfies_policy(password, strength, policy) - } - - pub fn make_register_keys( - &self, - email: String, - password: String, - kdf: Kdf, - ) -> Result { - make_register_keys(email, password, kdf) - } - - pub fn make_register_tde_keys( - &self, - email: String, - org_public_key: String, - remember_device: bool, - ) -> Result { - make_register_tde_keys(self.client, email, org_public_key, remember_device) - } - - pub fn make_key_connector_keys(&self) -> Result { - let mut rng = rand::thread_rng(); - make_key_connector_keys(&mut rng) - } - - pub async fn register(&self, input: &RegisterRequest) -> Result<()> { - register(self.client, input).await - } - - pub async fn prelogin(&self, email: String) -> Result { - use crate::auth::login::{parse_prelogin, request_prelogin}; - - let response = request_prelogin(self.client, email).await?; - parse_prelogin(response) - } - - pub async fn login_password( - &self, - input: &PasswordLoginRequest, - ) -> Result { - login_password(self.client, input).await - } - - pub async fn login_api_key(&self, input: &ApiKeyLoginRequest) -> Result { - login_api_key(self.client, input).await - } - - pub async fn send_two_factor_email(&self, tf: &TwoFactorEmailRequest) -> Result<()> { - send_two_factor_email(self.client, tf).await - } - - pub fn validate_password(&self, password: String, password_hash: String) -> Result { - validate_password(self.client, password, password_hash) - } - - pub fn validate_password_user_key( - &self, - password: String, - encrypted_user_key: String, - ) -> Result { - validate_password_user_key(self.client, password, encrypted_user_key) - } - - pub fn validate_pin(&self, pin: String, pin_protected_user_key: EncString) -> Result { - validate_pin(self.client, pin, pin_protected_user_key) - } - - pub fn new_auth_request(&self, email: &str) -> Result { - new_auth_request(email) - } - - pub fn approve_auth_request(&self, public_key: String) -> Result { - approve_auth_request(self.client, public_key) - } - - pub fn trust_device(&self) -> Result { - trust_device(self.client) - } -} - -#[cfg(feature = "internal")] -impl<'a> ClientAuth<'a> { - pub async fn login_device( - &self, - email: String, - device_identifier: String, - ) -> Result { - use crate::auth::login::send_new_auth_request; - - send_new_auth_request(self.client, email, device_identifier).await - } - - pub async fn login_device_complete(&self, auth_req: NewAuthRequestResponse) -> Result<()> { - use crate::auth::login::complete_auth_request; - - complete_auth_request(self.client, auth_req).await - } -} - -#[cfg(feature = "internal")] -fn trust_device(client: &Client) -> Result { - let enc = client.internal.get_encryption_settings()?; - - let user_key = enc.get_key(&None)?; - - Ok(DeviceKey::trust_device(user_key)?) -} - -impl<'a> Client { - pub fn auth(&'a self) -> ClientAuth<'a> { - ClientAuth { client: self } - } -} - -/* -#[cfg(test)] -mod tests { - - #[cfg(feature = "secrets")] - #[tokio::test] - async fn test_access_token_login() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - use crate::{auth::login::AccessTokenLoginRequest, secrets_manager::secrets::*}; - - // Create the mock server with the necessary routes for this test - let (_server, client) = crate::util::start_mock(vec![ - Mock::given(matchers::path("/identity/connect/token")) - .respond_with(ResponseTemplate::new(200).set_body_json( - serde_json::json!({ - "access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IjMwMURENkE1MEU4NEUxRDA5MUM4MUQzQjAwQkY5MDEwQzg1REJEOUFSUzI1NiIsInR5cCI6\ - ImF0K2p3dCIsIng1dCI6Ik1CM1dwUTZFNGRDUnlCMDdBTC1RRU1oZHZabyJ9.eyJuYmYiOjE2NzUxMDM3ODEsImV4cCI6MTY3NTEwNzM4MSwiaXNzIjo\ - iaHR0cDovL2xvY2FsaG9zdCIsImNsaWVudF9pZCI6ImVjMmMxZDQ2LTZhNGItNDc1MS1hMzEwLWFmOTYwMTMxN2YyZCIsInN1YiI6ImQzNDgwNGNhLTR\ - mNmMtNDM5Mi04NmI3LWFmOTYwMTMxNzVkMCIsIm9yZ2FuaXphdGlvbiI6ImY0ZTQ0YTdmLTExOTAtNDMyYS05ZDRhLWFmOTYwMTMxMjdjYiIsImp0aSI\ - 6IjU3QUU0NzQ0MzIwNzk1RThGQkQ4MUIxNDA2RDQyNTQyIiwiaWF0IjoxNjc1MTAzNzgxLCJzY29wZSI6WyJhcGkuc2VjcmV0cyJdfQ.GRKYzqgJZHEE\ - ZHsJkhVZH8zjYhY3hUvM4rhdV3FU10WlCteZdKHrPIadCUh-Oz9DxIAA2HfALLhj1chL4JgwPmZgPcVS2G8gk8XeBmZXowpVWJ11TXS1gYrM9syXbv9j\ - 0JUCdpeshH7e56WnlpVynyUwIum9hmYGZ_XJUfmGtlKLuNjYnawTwLEeR005uEjxq3qI1kti-WFnw8ciL4a6HLNulgiFw1dAvs4c7J0souShMfrnFO3g\ - SOHff5kKD3hBB9ynDBnJQSFYJ7dFWHIjhqs0Vj-9h0yXXCcHvu7dVGpaiNjNPxbh6YeXnY6UWcmHLDtFYsG2BWcNvVD4-VgGxXt3cMhrn7l3fSYuo32Z\ - Yk4Wop73XuxqF2fmfmBdZqGI1BafhENCcZw_bpPSfK2uHipfztrgYnrzwvzedz0rjFKbhDyrjzuRauX5dqVJ4ntPeT9g_I5n71gLxiP7eClyAx5RxdF6\ - He87NwC8i-hLBhugIvLTiDj-Sk9HvMth6zaD0ebxd56wDjq8-CMG_WcgusDqNzKFHqWNDHBXt8MLeTgZAR2rQMIMFZqFgsJlRflbig8YewmNUA9wAU74\ - TfxLY1foO7Xpg49vceB7C-PlvGi1VtX6F2i0tc_67lA5kWXnnKBPBUyspoIrmAUCwfms5nTTqA9xXAojMhRHAos_OdM", - "expires_in":3600, - "token_type":"Bearer", - "scope":"api.secrets", - "encrypted_payload":"2.E9fE8+M/VWMfhhim1KlCbQ==|eLsHR484S/tJbIkM6spnG/HP65tj9A6Tba7kAAvUp+rYuQmGLixiOCfMsqt5OvBctDfvvr/Aes\ - Bu7cZimPLyOEhqEAjn52jF0eaI38XZfeOG2VJl0LOf60Wkfh3ryAMvfvLj3G4ZCNYU8sNgoC2+IQ==|lNApuCQ4Pyakfo/wwuuajWNaEX/2MW8/3rjXB/V7n+k="}) - )), - Mock::given(matchers::path("/api/organizations/f4e44a7f-1190-432a-9d4a-af96013127cb/secrets")) - .respond_with(ResponseTemplate::new(200).set_body_json( - serde_json::json!({ - "secrets":[{ - "id":"15744a66-341a-4c62-af50-af960166b6bc", - "organizationId":"f4e44a7f-1190-432a-9d4a-af96013127cb", - "key":"2.pMS6/icTQABtulw52pq2lg==|XXbxKxDTh+mWiN1HjH2N1w==|Q6PkuT+KX/axrgN9ubD5Ajk2YNwxQkgs3WJM0S0wtG8=", - "creationDate":"2023-01-26T21:46:02.2182556Z", - "revisionDate":"2023-01-26T21:46:02.2182557Z" - }], - "projects":[], - "object":"SecretsWithProjectsList" - }) - )), - Mock::given(matchers::path("/api/secrets/15744a66-341a-4c62-af50-af960166b6bc")) - .respond_with(ResponseTemplate::new(200).set_body_json( - serde_json::json!({ - "id":"15744a66-341a-4c62-af50-af960166b6bc", - "organizationId":"f4e44a7f-1190-432a-9d4a-af96013127cb", - "key":"2.pMS6/icTQABtulw52pq2lg==|XXbxKxDTh+mWiN1HjH2N1w==|Q6PkuT+KX/axrgN9ubD5Ajk2YNwxQkgs3WJM0S0wtG8=", - "value":"2.Gl34n9JYABC7V21qHcBzHg==|c1Ds244pob7i+8+MXe4++w==|Shimz/qKMYZmzSFWdeBzFb9dFz7oF6Uv9oqkws7rEe0=", - "note":"2.Cn9ABJy7+WfR4uUHwdYepg==|+nbJyU/6hSknoa5dcEJEUg==|1DTp/ZbwGO3L3RN+VMsCHz8XDr8egn/M5iSitGGysPA=", - "creationDate":"2023-01-26T21:46:02.2182556Z", - "revisionDate":"2023-01-26T21:46:02.2182557Z", - "object":"secret" - }) - )) - ]).await; - - // Test the login is correct and we store the returned organization ID correctly - let res = client - .auth() - .login_access_token(&AccessTokenLoginRequest { - access_token: "0.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe/qrzIQQ==".into(), - state_file: None, - }) - .await - .unwrap(); - assert!(res.authenticated); - let organization_id = client.get_access_token_organization().unwrap(); - assert_eq!( - organization_id.to_string(), - "f4e44a7f-1190-432a-9d4a-af96013127cb" - ); - - // Test that we can retrieve the list of secrets correctly - let mut res = client - .secrets() - .list(&SecretIdentifiersRequest { organization_id }) - .await - .unwrap(); - assert_eq!(res.data.len(), 1); - - // Test that given a secret ID we can get it's data - let res = client - .secrets() - .get(&SecretGetRequest { - id: res.data.remove(0).id, - }) - .await - .unwrap(); - assert_eq!(res.key, "TEST"); - assert_eq!(res.note, "TEST"); - assert_eq!(res.value, "TEST"); - } -} - */ diff --git a/crates/bitwarden-core/src/auth/jwt_token.rs b/crates/bitwarden-core/src/auth/jwt_token.rs deleted file mode 100644 index f4d4692ee..000000000 --- a/crates/bitwarden-core/src/auth/jwt_token.rs +++ /dev/null @@ -1,71 +0,0 @@ -use std::str::FromStr; - -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; - -use crate::error::Result; - -/// A Bitwarden secrets manager JWT Token. -/// -/// References: -/// - -/// - -/// -/// TODO: We need to expand this to support user based JWT tokens. -#[derive(serde::Deserialize)] -pub struct JWTToken { - pub exp: u64, - pub sub: String, - pub email: Option, - pub organization: Option, - pub scope: Vec, -} - -impl FromStr for JWTToken { - type Err = crate::error::Error; - - /// Parses a JWT token from a string. - /// - /// **Note:** This function does not validate the token signature. - fn from_str(s: &str) -> Result { - let split = s.split('.').collect::>(); - if split.len() != 3 { - return Err("JWT token has an invalid number of parts".into()); - } - let decoded = URL_SAFE_NO_PAD.decode(split[1])?; - Ok(serde_json::from_slice(&decoded)?) - } -} - -#[cfg(test)] -mod tests { - use crate::auth::jwt_token::JWTToken; - - #[test] - fn can_decode_jwt() { - let jwt = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjMwMURENkE1MEU4NEUxRDA5MUM4MUQzQjAwQkY5MDEwQz\ - g1REJEOUFSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1dCI6Ik1CM1dwUTZFNGRDUnlCMDdBTC1RRU1oZHZabyJ9.eyJu\ - YmYiOjE2NzUxMDM1NzcsImV4cCI6MTY3NTEwNzE3NywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdCIsImNsaWVudF9pZCI\ - 6IndlYiIsInN1YiI6ImUyNWQzN2YzLWI2MDMtNDBkZS04NGJhLWFmOTYwMTJmNWE0MiIsImF1dGhfdGltZSI6MTY3NT\ - EwMzU0OSwiaWRwIjoiYml0d2FyZGVuIiwicHJlbWl1bSI6ZmFsc2UsImVtYWlsIjoidGVzdEBiaXR3YXJkZW4uY29tI\ - iwiZW1haWxfdmVyaWZpZWQiOnRydWUsInNzdGFtcCI6IkUzNElDWVhRUFRDS01EVldBREZDNktHNDJCQldJRDdJIiwi\ - bmFtZSI6IlRlc3QiLCJvcmdvd25lciI6ImY0ZTQ0YTdmLTExOTAtNDMyYS05ZDRhLWFmOTYwMTMxMjdjYiIsImRldml\ - jZSI6Ijg5Mjg5M2FiLWRkNDMtNDUwYS04NGI1LWFhOWM1YjdiYjJkOCIsImp0aSI6IkEzMkVFNjY5NDdEQzlDNUE2MT\ - IwRURBRTIwNzc5OUJFIiwiaWF0IjoxNjc1MTAzNTc3LCJzY29wZSI6WyJhcGkiLCJvZmZsaW5lX2FjY2VzcyJdLCJhb\ - XIiOlsiQXBwbGljYXRpb24iXX0.AyDkKvjmyaSPQViQSa2sGTKIkDGrUAtDmwpE57K4DDWT0QvwDe7FMktmwiF4LH36\ - wx_FnpH21VI1pzwJeTHXtaz3niANJtQZjzGFsNAna_95vrsxZC2YizgGlt6mX4YIGmAw9DiYrmaN0BvQOEm_caV_u6f\ - a30iz9Kvjxf7cpzeZvPEysxGpB3k3TRYTkFUdV43HiXdhXMBhyyOpFU6Fk6yA41y7-8bGYc5mYGknWktmPD9Yx-1xKL\ - ftFja1SnCoLPWvDeK60lqWZQiT4tZHCYJ7m0bBNCccYHc2Kk2Bo5-UoyDxazPwsqMxeNfjlaUuj3o5N_uQ-4n_gVbeA\ - qWV2wrel5UhYjWnczMSLBtt9p0W35kkBPt3ZAnRWMtQMPNH04p-_L6cG-Xu6lDksBTwaavcmtnCKG8V91826EiQ8MrF\ - wGWQRZV6tPKTDAYCgSAZGBY3QDmPGT5BeFcg5Ag_nYYIIifKP-kv10v_N-TOcT3NeGBOUlAZ-9m7iT7Rk3vC--SDZdA\ - U5turoBFiiPL2XXfAjM7P0r7J91gfXc0FaD6I2jDxOmym5h7Yn5phLsbC2NlIXkZp54dKHICenPl4ve6ndDIJacVeS5\ - f3LEddAPV8cAFza4DjA8pZJLFrMyRvMXcL_PjKF8qPVzqVWh03lfJ4clOIxR2gOuWIc902Y5E"; - - let token: JWTToken = jwt.parse().unwrap(); - assert_eq!(token.exp, 1675107177); - assert_eq!(token.sub, "e25d37f3-b603-40de-84ba-af96012f5a42"); - assert_eq!(token.email.as_deref(), Some("test@bitwarden.com")); - assert_eq!(token.organization.as_deref(), None); - assert_eq!(token.scope[0], "api"); - assert_eq!(token.scope[1], "offline_access"); - } -} diff --git a/crates/bitwarden-core/src/auth/key_connector.rs b/crates/bitwarden-core/src/auth/key_connector.rs deleted file mode 100644 index b4006b472..000000000 --- a/crates/bitwarden-core/src/auth/key_connector.rs +++ /dev/null @@ -1,42 +0,0 @@ -use bitwarden_crypto::{CryptoError, MasterKey, RsaKeyPair}; - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct KeyConnectorResponse { - pub master_key: String, - pub encrypted_user_key: String, - pub keys: RsaKeyPair, -} - -pub(super) fn make_key_connector_keys( - mut rng: impl rand::RngCore, -) -> Result { - let master_key = MasterKey::generate(&mut rng); - let (user_key, encrypted_user_key) = master_key.make_user_key()?; - let keys = user_key.make_key_pair()?; - - Ok(KeyConnectorResponse { - master_key: master_key.to_base64(), - encrypted_user_key: encrypted_user_key.to_string(), - keys, - }) -} - -#[cfg(test)] -mod tests { - use rand::SeedableRng; - use rand_chacha::ChaCha8Rng; - - use super::*; - - #[test] - fn test_make_key_connector_keys() { - let mut rng = ChaCha8Rng::from_seed([0u8; 32]); - - let result = make_key_connector_keys(&mut rng).unwrap(); - - assert_eq!( - result.master_key, - "PgDvL4lfQNZ/W7joHwmloSyEDsPOmn87GBvhiO9xGh4=" - ); - } -} diff --git a/crates/bitwarden-core/src/auth/login/access_token.rs b/crates/bitwarden-core/src/auth/login/access_token.rs deleted file mode 100644 index c445e43c7..000000000 --- a/crates/bitwarden-core/src/auth/login/access_token.rs +++ /dev/null @@ -1,178 +0,0 @@ -use std::path::{Path, PathBuf}; - -use base64::{engine::general_purpose::STANDARD, Engine}; -use bitwarden_crypto::{EncString, KeyDecryptable, SymmetricCryptoKey}; -use chrono::Utc; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use crate::{ - auth::{ - api::{request::AccessTokenRequest, response::IdentityTokenResponse}, - login::{response::two_factor::TwoFactorProviders, PasswordLoginResponse}, - AccessToken, JWTToken, - }, - client::{LoginMethod, ServiceAccountLoginMethod}, - error::{Error, Result}, - require, - secrets_manager::state::{self, ClientState}, - Client, -}; - -pub(crate) async fn login_access_token( - client: &Client, - input: &AccessTokenLoginRequest, -) -> Result { - //info!("api key logging in"); - //debug!("{:#?}, {:#?}", client, input); - - let access_token: AccessToken = input.access_token.parse()?; - - if let Some(state_file) = &input.state_file { - if let Ok(organization_id) = load_tokens_from_state(client, state_file, &access_token) { - client - .internal - .set_login_method(LoginMethod::ServiceAccount( - ServiceAccountLoginMethod::AccessToken { - access_token, - organization_id, - state_file: Some(state_file.to_path_buf()), - }, - )); - - return Ok(AccessTokenLoginResponse { - authenticated: true, - reset_master_password: false, - force_password_reset: false, - two_factor: None, - }); - } - } - - let response = request_access_token(client, &access_token).await?; - - if let IdentityTokenResponse::Payload(r) = &response { - // Extract the encrypted payload and use the access token encryption key to decrypt it - let payload: EncString = r.encrypted_payload.parse()?; - - let decrypted_payload: Vec = payload.decrypt_with_key(&access_token.encryption_key)?; - - // Once decrypted, we have to JSON decode to extract the organization encryption key - #[derive(serde::Deserialize)] - struct Payload { - #[serde(rename = "encryptionKey")] - encryption_key: String, - } - - let payload: Payload = serde_json::from_slice(&decrypted_payload)?; - let encryption_key = STANDARD.decode(&payload.encryption_key)?; - let encryption_key = SymmetricCryptoKey::try_from(encryption_key)?; - - let access_token_obj: JWTToken = r.access_token.parse()?; - - // This should always be Some() when logging in with an access token - let organization_id = require!(access_token_obj.organization) - .parse() - .map_err(|_| Error::InvalidResponse)?; - - if let Some(state_file) = &input.state_file { - let state = ClientState::new(r.access_token.clone(), payload.encryption_key); - _ = state::set(state_file, &access_token, state); - } - - client.internal.set_tokens( - r.access_token.clone(), - r.refresh_token.clone(), - r.expires_in, - ); - client - .internal - .set_login_method(LoginMethod::ServiceAccount( - ServiceAccountLoginMethod::AccessToken { - access_token, - organization_id, - state_file: input.state_file.clone(), - }, - )); - - client.internal.initialize_crypto_single_key(encryption_key); - } - - AccessTokenLoginResponse::process_response(response) -} - -async fn request_access_token( - client: &Client, - input: &AccessToken, -) -> Result { - let config = client.internal.get_api_configurations().await; - AccessTokenRequest::new(input.access_token_id, &input.client_secret) - .send(&config) - .await -} - -fn load_tokens_from_state( - client: &Client, - state_file: &Path, - access_token: &AccessToken, -) -> Result { - let client_state = state::get(state_file, access_token)?; - - let token: JWTToken = client_state.token.parse()?; - - if let Some(organization_id) = token.organization { - let time_till_expiration = (token.exp as i64) - Utc::now().timestamp(); - - if time_till_expiration > 0 { - let organization_id: Uuid = organization_id - .parse() - .map_err(|_| "Bad organization id.")?; - let encryption_key = SymmetricCryptoKey::try_from(client_state.encryption_key)?; - - client - .internal - .set_tokens(client_state.token, None, time_till_expiration as u64); - client.internal.initialize_crypto_single_key(encryption_key); - - return Ok(organization_id); - } - } - - Err(Error::InvalidStateFile) -} - -/// Login to Bitwarden with access token -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct AccessTokenLoginRequest { - /// Bitwarden service API access token - pub access_token: String, - pub state_file: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct AccessTokenLoginResponse { - pub authenticated: bool, - /// TODO: What does this do? - pub reset_master_password: bool, - /// Whether or not the user is required to update their master password - pub force_password_reset: bool, - two_factor: Option, -} - -impl AccessTokenLoginResponse { - pub(crate) fn process_response( - response: IdentityTokenResponse, - ) -> Result { - let password_response = PasswordLoginResponse::process_response(response)?; - - Ok(AccessTokenLoginResponse { - authenticated: password_response.authenticated, - reset_master_password: password_response.reset_master_password, - force_password_reset: password_response.force_password_reset, - two_factor: password_response.two_factor, - }) - } -} diff --git a/crates/bitwarden-core/src/auth/login/api_key.rs b/crates/bitwarden-core/src/auth/login/api_key.rs deleted file mode 100644 index cce246528..000000000 --- a/crates/bitwarden-core/src/auth/login/api_key.rs +++ /dev/null @@ -1,108 +0,0 @@ -use bitwarden_crypto::{EncString, MasterKey}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::{ - auth::{ - api::{request::ApiTokenRequest, response::IdentityTokenResponse}, - login::{response::two_factor::TwoFactorProviders, PasswordLoginResponse}, - JWTToken, - }, - client::{LoginMethod, UserLoginMethod}, - error::Result, - require, Client, -}; - -pub(crate) async fn login_api_key( - client: &Client, - input: &ApiKeyLoginRequest, -) -> Result { - //info!("api key logging in"); - //debug!("{:#?}, {:#?}", client, input); - - let response = request_api_identity_tokens(client, input).await?; - - if let IdentityTokenResponse::Authenticated(r) = &response { - let access_token_obj: JWTToken = r.access_token.parse()?; - - // This should always be Some() when logging in with an api key - let email = access_token_obj - .email - .ok_or("Access token doesn't contain email")?; - - let kdf = client.auth().prelogin(email.clone()).await?; - - client.internal.set_tokens( - r.access_token.clone(), - r.refresh_token.clone(), - r.expires_in, - ); - - let master_key = MasterKey::derive(&input.password, &email, &kdf)?; - - client - .internal - .set_login_method(LoginMethod::User(UserLoginMethod::ApiKey { - client_id: input.client_id.to_owned(), - client_secret: input.client_secret.to_owned(), - email, - kdf, - })); - - let user_key: EncString = require!(r.key.as_deref()).parse()?; - let private_key: EncString = require!(r.private_key.as_deref()).parse()?; - - client - .internal - .initialize_user_crypto_master_key(master_key, user_key, private_key)?; - } - - ApiKeyLoginResponse::process_response(response) -} - -async fn request_api_identity_tokens( - client: &Client, - input: &ApiKeyLoginRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - ApiTokenRequest::new(&input.client_id, &input.client_secret) - .send(&config) - .await -} - -/// Login to Bitwarden with Api Key -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ApiKeyLoginRequest { - /// Bitwarden account client_id - pub client_id: String, - /// Bitwarden account client_secret - pub client_secret: String, - - /// Bitwarden account master password - pub password: String, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ApiKeyLoginResponse { - pub authenticated: bool, - /// TODO: What does this do? - pub reset_master_password: bool, - /// Whether or not the user is required to update their master password - pub force_password_reset: bool, - two_factor: Option, -} - -impl ApiKeyLoginResponse { - pub(crate) fn process_response(response: IdentityTokenResponse) -> Result { - let password_response = PasswordLoginResponse::process_response(response)?; - - Ok(ApiKeyLoginResponse { - authenticated: password_response.authenticated, - reset_master_password: password_response.reset_master_password, - force_password_reset: password_response.force_password_reset, - two_factor: password_response.two_factor, - }) - } -} diff --git a/crates/bitwarden-core/src/auth/login/auth_request.rs b/crates/bitwarden-core/src/auth/login/auth_request.rs deleted file mode 100644 index 912105db0..000000000 --- a/crates/bitwarden-core/src/auth/login/auth_request.rs +++ /dev/null @@ -1,129 +0,0 @@ -use bitwarden_api_api::{ - apis::auth_requests_api::{auth_requests_id_response_get, auth_requests_post}, - models::{AuthRequestCreateRequestModel, AuthRequestType}, -}; -use bitwarden_crypto::Kdf; -use uuid::Uuid; - -use crate::{ - auth::{ - api::{request::AuthRequestTokenRequest, response::IdentityTokenResponse}, - auth_request::new_auth_request, - }, - client::{LoginMethod, UserLoginMethod}, - error::Result, - mobile::crypto::{AuthRequestMethod, InitUserCryptoMethod, InitUserCryptoRequest}, - require, Client, -}; - -pub struct NewAuthRequestResponse { - pub fingerprint: String, - email: String, - device_identifier: String, - auth_request_id: Uuid, - access_code: String, - private_key: String, -} - -pub(crate) async fn send_new_auth_request( - client: &Client, - email: String, - device_identifier: String, -) -> Result { - let config = client.internal.get_api_configurations().await; - - let auth = new_auth_request(&email)?; - - let req = AuthRequestCreateRequestModel { - email: email.clone(), - public_key: auth.public_key, - device_identifier: device_identifier.clone(), - access_code: auth.access_code.clone(), - r#type: AuthRequestType::AuthenticateAndUnlock, - }; - - let res = auth_requests_post(&config.api, Some(req)).await?; - - Ok(NewAuthRequestResponse { - fingerprint: auth.fingerprint, - email, - device_identifier, - auth_request_id: require!(res.id), - access_code: auth.access_code, - private_key: auth.private_key, - }) -} - -pub(crate) async fn complete_auth_request( - client: &Client, - auth_req: NewAuthRequestResponse, -) -> Result<()> { - let config = client.internal.get_api_configurations().await; - - let res = auth_requests_id_response_get( - &config.api, - auth_req.auth_request_id, - Some(&auth_req.access_code), - ) - .await?; - - let approved = res.request_approved.unwrap_or(false); - - if !approved { - return Err("Auth request was not approved".into()); - } - - let response = AuthRequestTokenRequest::new( - &auth_req.email, - &auth_req.auth_request_id, - &auth_req.access_code, - config.device_type, - &auth_req.device_identifier, - ) - .send(&config) - .await?; - - if let IdentityTokenResponse::Authenticated(r) = response { - let kdf = Kdf::default(); - - client.internal.set_tokens( - r.access_token.clone(), - r.refresh_token.clone(), - r.expires_in, - ); - client - .internal - .set_login_method(LoginMethod::User(UserLoginMethod::Username { - client_id: "web".to_owned(), - email: auth_req.email.to_owned(), - kdf: kdf.clone(), - })); - - let method = match res.master_password_hash { - Some(_) => AuthRequestMethod::MasterKey { - protected_master_key: require!(res.key).parse()?, - auth_request_key: require!(r.key).parse()?, - }, - None => AuthRequestMethod::UserKey { - protected_user_key: require!(res.key).parse()?, - }, - }; - - client - .crypto() - .initialize_user_crypto(InitUserCryptoRequest { - kdf_params: kdf, - email: auth_req.email, - private_key: require!(r.private_key), - method: InitUserCryptoMethod::AuthRequest { - request_private_key: auth_req.private_key, - method, - }, - }) - .await?; - - Ok(()) - } else { - Err("Failed to authenticate".into()) - } -} diff --git a/crates/bitwarden-core/src/auth/login/mod.rs b/crates/bitwarden-core/src/auth/login/mod.rs deleted file mode 100644 index 0c90dc973..000000000 --- a/crates/bitwarden-core/src/auth/login/mod.rs +++ /dev/null @@ -1,94 +0,0 @@ -#[cfg(feature = "internal")] -use bitwarden_crypto::Kdf; -#[cfg(feature = "internal")] -use { - crate::{error::Result, Client}, - bitwarden_api_identity::{ - apis::accounts_api::accounts_prelogin_post, - models::{PreloginRequestModel, PreloginResponseModel}, - }, -}; - -pub mod response; - -#[cfg(any(feature = "internal", feature = "secrets"))] -mod password; -#[cfg(feature = "internal")] -pub(crate) use password::login_password; -#[cfg(feature = "internal")] -pub use password::PasswordLoginRequest; -#[cfg(any(feature = "internal", feature = "secrets"))] -pub use password::PasswordLoginResponse; -#[cfg(feature = "internal")] -mod two_factor; -#[cfg(feature = "internal")] -pub(crate) use two_factor::send_two_factor_email; -#[cfg(feature = "internal")] -pub use two_factor::{TwoFactorEmailRequest, TwoFactorProvider, TwoFactorRequest}; - -#[cfg(feature = "internal")] -mod api_key; -#[cfg(feature = "internal")] -pub(crate) use api_key::login_api_key; -#[cfg(feature = "internal")] -pub use api_key::{ApiKeyLoginRequest, ApiKeyLoginResponse}; - -#[cfg(feature = "internal")] -mod auth_request; -#[cfg(feature = "internal")] -pub use auth_request::NewAuthRequestResponse; -#[cfg(feature = "internal")] -pub(crate) use auth_request::{complete_auth_request, send_new_auth_request}; - -#[cfg(feature = "secrets")] -mod access_token; -#[cfg(feature = "secrets")] -pub(super) use access_token::login_access_token; -#[cfg(feature = "secrets")] -pub use access_token::{AccessTokenLoginRequest, AccessTokenLoginResponse}; - -#[cfg(feature = "internal")] -pub(crate) async fn request_prelogin( - client: &Client, - email: String, -) -> Result { - let request_model = PreloginRequestModel::new(email); - let config = client.internal.get_api_configurations().await; - Ok(accounts_prelogin_post(&config.identity, Some(request_model)).await?) -} - -#[cfg(feature = "internal")] -pub(crate) fn parse_prelogin(response: PreloginResponseModel) -> Result { - use std::num::NonZeroU32; - - use bitwarden_api_identity::models::KdfType; - use bitwarden_crypto::{ - default_argon2_iterations, default_argon2_memory, default_argon2_parallelism, - default_pbkdf2_iterations, - }; - - let kdf = response.kdf.ok_or("KDF not found")?; - - Ok(match kdf { - KdfType::PBKDF2_SHA256 => Kdf::PBKDF2 { - iterations: response - .kdf_iterations - .and_then(|e| NonZeroU32::new(e as u32)) - .unwrap_or_else(default_pbkdf2_iterations), - }, - KdfType::Argon2id => Kdf::Argon2id { - iterations: response - .kdf_iterations - .and_then(|e| NonZeroU32::new(e as u32)) - .unwrap_or_else(default_argon2_iterations), - memory: response - .kdf_memory - .and_then(|e| NonZeroU32::new(e as u32)) - .unwrap_or_else(default_argon2_memory), - parallelism: response - .kdf_parallelism - .and_then(|e| NonZeroU32::new(e as u32)) - .unwrap_or_else(default_argon2_parallelism), - }, - }) -} diff --git a/crates/bitwarden-core/src/auth/login/password.rs b/crates/bitwarden-core/src/auth/login/password.rs deleted file mode 100644 index 0521c9d91..000000000 --- a/crates/bitwarden-core/src/auth/login/password.rs +++ /dev/null @@ -1,153 +0,0 @@ -#[cfg(feature = "internal")] -use bitwarden_crypto::Kdf; -#[cfg(feature = "internal")] -use log::info; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[cfg(feature = "internal")] -use crate::{ - auth::{api::request::PasswordTokenRequest, login::TwoFactorRequest}, - client::LoginMethod, - Client, -}; -use crate::{ - auth::{ - api::response::IdentityTokenResponse, - login::response::{captcha_response::CaptchaResponse, two_factor::TwoFactorProviders}, - }, - error::Result, -}; - -#[cfg(feature = "internal")] -pub(crate) async fn login_password( - client: &Client, - input: &PasswordLoginRequest, -) -> Result { - use bitwarden_crypto::{EncString, HashPurpose, MasterKey}; - - use crate::{client::UserLoginMethod, require}; - - info!("password logging in"); - - let master_key = MasterKey::derive(&input.password, &input.email, &input.kdf)?; - let password_hash = master_key - .derive_master_key_hash(input.password.as_bytes(), HashPurpose::ServerAuthorization)?; - - let response = request_identity_tokens(client, input, &password_hash).await?; - - if let IdentityTokenResponse::Authenticated(r) = &response { - client.internal.set_tokens( - r.access_token.clone(), - r.refresh_token.clone(), - r.expires_in, - ); - client - .internal - .set_login_method(LoginMethod::User(UserLoginMethod::Username { - client_id: "web".to_owned(), - email: input.email.to_owned(), - kdf: input.kdf.to_owned(), - })); - - let user_key: EncString = require!(r.key.as_deref()).parse()?; - let private_key: EncString = require!(r.private_key.as_deref()).parse()?; - - client - .internal - .initialize_user_crypto_master_key(master_key, user_key, private_key)?; - } - - PasswordLoginResponse::process_response(response) -} - -#[cfg(feature = "internal")] -async fn request_identity_tokens( - client: &Client, - input: &PasswordLoginRequest, - password_hash: &str, -) -> Result { - use crate::DeviceType; - - let config = client.internal.get_api_configurations().await; - PasswordTokenRequest::new( - &input.email, - password_hash, - DeviceType::ChromeBrowser, - "b86dd6ab-4265-4ddf-a7f1-eb28d5677f33", - &input.two_factor, - ) - .send(&config) - .await -} - -#[cfg(feature = "internal")] -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -/// Login to Bitwarden with Username and Password -pub struct PasswordLoginRequest { - /// Bitwarden account email address - pub email: String, - /// Bitwarden account master password - pub password: String, - // Two-factor authentication - pub two_factor: Option, - /// Kdf from prelogin - pub kdf: Kdf, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct PasswordLoginResponse { - pub authenticated: bool, - /// TODO: What does this do? - pub reset_master_password: bool, - /// Whether or not the user is required to update their master password - pub force_password_reset: bool, - /// The available two factor authentication options. Present only when authentication fails due - /// to requiring a second authentication factor. - pub two_factor: Option, - /// The information required to present the user with a captcha challenge. Only present when - /// authentication fails due to requiring validation of a captcha challenge. - pub captcha: Option, -} - -impl PasswordLoginResponse { - pub(crate) fn process_response( - response: IdentityTokenResponse, - ) -> Result { - match response { - IdentityTokenResponse::Authenticated(success) => Ok(PasswordLoginResponse { - authenticated: true, - reset_master_password: success.reset_master_password, - force_password_reset: success.force_password_reset, - two_factor: None, - captcha: None, - }), - IdentityTokenResponse::Payload(_) => Ok(PasswordLoginResponse { - authenticated: true, - reset_master_password: false, - force_password_reset: false, - two_factor: None, - captcha: None, - }), - IdentityTokenResponse::TwoFactorRequired(two_factor) => Ok(PasswordLoginResponse { - authenticated: false, - reset_master_password: false, - force_password_reset: false, - two_factor: Some(two_factor.two_factor_providers.into()), - captcha: two_factor.captcha_token.map(Into::into), - }), - IdentityTokenResponse::CaptchaRequired(captcha) => Ok(PasswordLoginResponse { - authenticated: false, - reset_master_password: false, - force_password_reset: false, - two_factor: None, - captcha: Some(captcha.site_key.into()), - }), - IdentityTokenResponse::Refreshed(_) => { - unreachable!("Got a `refresh_token` answer to a login request") - } - } - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/captcha_response.rs b/crates/bitwarden-core/src/auth/login/response/captcha_response.rs deleted file mode 100644 index fcd10994a..000000000 --- a/crates/bitwarden-core/src/auth/login/response/captcha_response.rs +++ /dev/null @@ -1,23 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct CaptchaResponse { - /// hcaptcha site key - pub site_key: String, -} - -impl From for CaptchaResponse { - fn from(api: crate::auth::api::response::IdentityCaptchaResponse) -> Self { - Self { - site_key: api.site_key, - } - } -} - -impl From for CaptchaResponse { - fn from(s: String) -> Self { - Self { site_key: s } - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/mod.rs b/crates/bitwarden-core/src/auth/login/response/mod.rs deleted file mode 100644 index 8fa4f729a..000000000 --- a/crates/bitwarden-core/src/auth/login/response/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod captcha_response; -pub mod two_factor; diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/authenticator.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/authenticator.rs deleted file mode 100644 index 609bd4d34..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/authenticator.rs +++ /dev/null @@ -1,16 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct Authenticator {} - -impl From - for Authenticator -{ - fn from( - _: crate::auth::api::response::two_factor_provider_data::authenticator::Authenticator, - ) -> Self { - Self {} - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/duo.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/duo.rs deleted file mode 100644 index 719f8a9ef..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/duo.rs +++ /dev/null @@ -1,31 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct Duo { - pub host: String, - pub signature: String, -} - -impl From for Duo { - fn from(api: crate::auth::api::response::two_factor_provider_data::duo::Duo) -> Self { - Self { - host: api.host, - signature: api.signature, - } - } -} - -impl From - for Duo -{ - fn from( - api: crate::auth::api::response::two_factor_provider_data::organization_duo::OrganizationDuo, - ) -> Self { - Self { - host: api.host, - signature: api.signature, - } - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/email.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/email.rs deleted file mode 100644 index 65ad184c2..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/email.rs +++ /dev/null @@ -1,15 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct Email { - /// The email to request a 2fa TOTP for - pub email: String, -} - -impl From for Email { - fn from(api: crate::auth::api::response::two_factor_provider_data::email::Email) -> Self { - Self { email: api.email } - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/mod.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/mod.rs deleted file mode 100644 index 269f76517..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -mod authenticator; -mod duo; -mod email; -mod remember; -mod two_factor_providers; -mod web_authn; -mod yubi_key; - -pub use authenticator::*; -pub use duo::*; -pub use email::*; -pub use remember::*; -pub use two_factor_providers::*; -pub use web_authn::*; -pub use yubi_key::*; diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/remember.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/remember.rs deleted file mode 100644 index 327504183..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/remember.rs +++ /dev/null @@ -1,12 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct Remember {} - -impl From for Remember { - fn from(_: crate::auth::api::response::two_factor_provider_data::remember::Remember) -> Self { - Self {} - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/two_factor_providers.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/two_factor_providers.rs deleted file mode 100644 index 98229a940..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/two_factor_providers.rs +++ /dev/null @@ -1,39 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::auth::login::response::two_factor::{ - authenticator::Authenticator, duo::Duo, email::Email, remember::Remember, web_authn::WebAuthn, - yubi_key::YubiKey, -}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct TwoFactorProviders { - pub authenticator: Option, - /// Email 2fa - pub email: Option, - /// Duo-backed 2fa - pub duo: Option, - /// Duo-backed 2fa operated by an organization the user is a member of - pub organization_duo: Option, - /// Yubikey-backed 2fa - pub yubi_key: Option, - /// Presence indicates the user has stored this device as bypassing 2fa - pub remember: Option, - /// WebAuthn-backed 2fa - pub web_authn: Option, -} - -impl From for TwoFactorProviders { - fn from(api: crate::auth::api::response::TwoFactorProviders) -> Self { - Self { - authenticator: api.authenticator.map(|_| Authenticator {}), - email: api.email.map(Into::into), - duo: api.duo.map(Into::into), - organization_duo: api.organization_duo.map(Into::into), - yubi_key: api.yubi_key.map(Into::into), - remember: api.remember.map(Into::into), - web_authn: api.web_authn.map(Into::into), - } - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/web_authn.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/web_authn.rs deleted file mode 100644 index 799fd2b23..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/web_authn.rs +++ /dev/null @@ -1,12 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct WebAuthn {} - -impl From for WebAuthn { - fn from(_: crate::auth::api::response::two_factor_provider_data::web_authn::WebAuthn) -> Self { - Self {} - } -} diff --git a/crates/bitwarden-core/src/auth/login/response/two_factor/yubi_key.rs b/crates/bitwarden-core/src/auth/login/response/two_factor/yubi_key.rs deleted file mode 100644 index d6021bd39..000000000 --- a/crates/bitwarden-core/src/auth/login/response/two_factor/yubi_key.rs +++ /dev/null @@ -1,15 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct YubiKey { - /// Whether the stored yubikey supports near field communication - pub nfc: bool, -} - -impl From for YubiKey { - fn from(api: crate::auth::api::response::two_factor_provider_data::yubi_key::YubiKey) -> Self { - Self { nfc: api.nfc } - } -} diff --git a/crates/bitwarden-core/src/auth/login/two_factor.rs b/crates/bitwarden-core/src/auth/login/two_factor.rs deleted file mode 100644 index c0a4c10ab..000000000 --- a/crates/bitwarden-core/src/auth/login/two_factor.rs +++ /dev/null @@ -1,71 +0,0 @@ -use bitwarden_api_api::models::TwoFactorEmailRequestModel; -use bitwarden_crypto::HashPurpose; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; - -use crate::{auth::determine_password_hash, error::Result, Client}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct TwoFactorEmailRequest { - /// User Password - pub password: String, - /// User email - pub email: String, -} - -pub(crate) async fn send_two_factor_email( - client: &Client, - input: &TwoFactorEmailRequest, -) -> Result<()> { - // TODO: This should be resolved from the client - let kdf = client.auth().prelogin(input.email.clone()).await?; - - let password_hash = determine_password_hash( - &input.email, - &kdf, - &input.password, - HashPurpose::ServerAuthorization, - )?; - - let config = client.internal.get_api_configurations().await; - bitwarden_api_api::apis::two_factor_api::two_factor_send_email_login_post( - &config.api, - Some(TwoFactorEmailRequestModel { - master_password_hash: Some(password_hash), - otp: None, - auth_request_access_code: None, - secret: None, - email: input.email.to_owned(), - auth_request_id: None, - sso_email2_fa_session_token: None, - }), - ) - .await?; - Ok(()) -} - -#[derive(Serialize_repr, Deserialize_repr, PartialEq, Debug, JsonSchema, Clone)] -#[repr(u8)] -pub enum TwoFactorProvider { - Authenticator = 0, - Email = 1, - Duo = 2, - Yubikey = 3, - U2f = 4, - Remember = 5, - OrganizationDuo = 6, - WebAuthn = 7, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct TwoFactorRequest { - /// Two-factor Token - pub token: String, - /// Two-factor provider - pub provider: TwoFactorProvider, - /// Two-factor remember - pub remember: bool, -} diff --git a/crates/bitwarden-core/src/auth/mod.rs b/crates/bitwarden-core/src/auth/mod.rs deleted file mode 100644 index 30babdc7d..000000000 --- a/crates/bitwarden-core/src/auth/mod.rs +++ /dev/null @@ -1,76 +0,0 @@ -#[cfg(feature = "internal")] -use bitwarden_crypto::{HashPurpose, Kdf, MasterKey}; - -mod access_token; -pub(super) mod api; -pub mod client_auth; -mod jwt_token; -pub mod login; -#[cfg(feature = "internal")] -pub mod password; -#[cfg(feature = "internal")] -pub mod pin; -pub mod renew; -pub use access_token::AccessToken; -pub use jwt_token::JWTToken; - -#[cfg(feature = "internal")] -mod auth_request; -#[cfg(feature = "internal")] -pub use auth_request::AuthRequestResponse; -#[cfg(feature = "internal")] -pub(crate) use auth_request::{auth_request_decrypt_master_key, auth_request_decrypt_user_key}; - -#[cfg(feature = "internal")] -mod register; -#[cfg(feature = "internal")] -pub use register::{RegisterKeyResponse, RegisterRequest}; - -#[cfg(feature = "internal")] -mod tde; -#[cfg(feature = "internal")] -pub use tde::RegisterTdeKeyResponse; -#[cfg(feature = "internal")] -mod key_connector; -#[cfg(feature = "internal")] -pub use key_connector::KeyConnectorResponse; - -#[cfg(feature = "internal")] -use crate::error::Result; - -#[cfg(feature = "internal")] -fn determine_password_hash( - email: &str, - kdf: &Kdf, - password: &str, - purpose: HashPurpose, -) -> Result { - let master_key = MasterKey::derive(password, email, kdf)?; - Ok(master_key.derive_master_key_hash(password.as_bytes(), purpose)?) -} - -#[cfg(test)] -mod tests { - #[cfg(feature = "internal")] - use std::num::NonZeroU32; - - #[cfg(feature = "internal")] - use super::*; - - #[cfg(feature = "internal")] - #[test] - fn test_determine_password_hash() { - use super::determine_password_hash; - - let password = "password123"; - let email = "test@bitwarden.com"; - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(100_000).unwrap(), - }; - let purpose = HashPurpose::LocalAuthorization; - - let result = determine_password_hash(email, &kdf, password, purpose).unwrap(); - - assert_eq!(result, "7kTqkF1pY/3JeOu73N9kR99fDDe9O1JOZaVc7KH3lsU="); - } -} diff --git a/crates/bitwarden-core/src/auth/password/mod.rs b/crates/bitwarden-core/src/auth/password/mod.rs deleted file mode 100644 index d0f3329f2..000000000 --- a/crates/bitwarden-core/src/auth/password/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -mod policy; -pub(crate) use policy::satisfies_policy; -pub use policy::MasterPasswordPolicyOptions; -mod validate; -pub(crate) use validate::validate_password; -#[cfg(feature = "internal")] -pub(crate) use validate::validate_password_user_key; -mod strength; -pub(crate) use strength::password_strength; diff --git a/crates/bitwarden-core/src/auth/password/policy.rs b/crates/bitwarden-core/src/auth/password/policy.rs deleted file mode 100644 index 851ac96e9..000000000 --- a/crates/bitwarden-core/src/auth/password/policy.rs +++ /dev/null @@ -1,176 +0,0 @@ -use schemars::JsonSchema; - -/// Validate the provided password passes the provided Master Password Requirements Policy. -pub(crate) fn satisfies_policy( - password: String, - strength: u8, - policy: &MasterPasswordPolicyOptions, -) -> bool { - if policy.min_complexity > 0 && policy.min_complexity > strength { - return false; - } - - if policy.min_length > 0 && usize::from(policy.min_length) > password.len() { - return false; - } - - if policy.require_upper && password.to_lowercase() == password { - return false; - } - - if policy.require_lower && password.to_uppercase() == password { - return false; - } - - if policy.require_numbers && !password.chars().any(|c| c.is_numeric()) { - return false; - } - - if policy.require_special && !password.chars().any(|c| "!@#$%^&*".contains(c)) { - return false; - } - - true -} - -#[derive(Debug, JsonSchema)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -#[allow(dead_code)] -pub struct MasterPasswordPolicyOptions { - min_complexity: u8, - min_length: u8, - require_upper: bool, - require_lower: bool, - require_numbers: bool, - require_special: bool, - - /// Flag to indicate if the policy should be enforced on login. - /// If true, and the user's password does not meet the policy requirements, - /// the user will be forced to update their password. - enforce_on_login: bool, -} - -#[cfg(test)] -mod tests { - - use super::{satisfies_policy, MasterPasswordPolicyOptions}; - - #[test] - fn satisfies_policy_gives_success() { - let password = "lkasfo!icbb$2323ALKJCO22".to_string(); - let options = MasterPasswordPolicyOptions { - min_complexity: 3, - min_length: 5, - require_upper: true, - require_lower: true, - require_numbers: true, - require_special: true, - enforce_on_login: false, - }; - - let result = satisfies_policy(password, 4, &options); - assert!(result); - } - - #[test] - fn satisfies_policy_evaluates_strength() { - let password = "password123".to_string(); - let options = MasterPasswordPolicyOptions { - min_complexity: 3, - min_length: 0, - require_upper: false, - require_lower: false, - require_numbers: false, - require_special: false, - enforce_on_login: false, - }; - - let result = satisfies_policy(password, 0, &options); - assert!(!result); - } - - #[test] - fn satisfies_policy_evaluates_length() { - let password = "password123".to_string(); - let options = MasterPasswordPolicyOptions { - min_complexity: 0, - min_length: 20, - require_upper: false, - require_lower: false, - require_numbers: false, - require_special: false, - enforce_on_login: false, - }; - - let result = satisfies_policy(password, 0, &options); - assert!(!result); - } - - #[test] - fn satisfies_policy_evaluates_upper() { - let password = "password123".to_string(); - let options = MasterPasswordPolicyOptions { - min_complexity: 0, - min_length: 0, - require_upper: true, - require_lower: false, - require_numbers: false, - require_special: false, - enforce_on_login: false, - }; - - let result = satisfies_policy(password, 0, &options); - assert!(!result); - } - - #[test] - fn satisfies_policy_evaluates_lower() { - let password = "ABCDEFG123".to_string(); - let options = MasterPasswordPolicyOptions { - min_complexity: 0, - min_length: 0, - require_upper: false, - require_lower: true, - require_numbers: false, - require_special: false, - enforce_on_login: false, - }; - - let result = satisfies_policy(password, 0, &options); - assert!(!result); - } - - #[test] - fn satisfies_policy_evaluates_numbers() { - let password = "password".to_string(); - let options = MasterPasswordPolicyOptions { - min_complexity: 0, - min_length: 0, - require_upper: false, - require_lower: false, - require_numbers: true, - require_special: false, - enforce_on_login: false, - }; - - let result = satisfies_policy(password, 0, &options); - assert!(!result); - } - - #[test] - fn satisfies_policy_evaluates_special() { - let password = "Password123".to_string(); - let options = MasterPasswordPolicyOptions { - min_complexity: 0, - min_length: 0, - require_upper: false, - require_lower: false, - require_numbers: false, - require_special: true, - enforce_on_login: false, - }; - - let result = satisfies_policy(password, 0, &options); - assert!(!result); - } -} diff --git a/crates/bitwarden-core/src/auth/password/strength.rs b/crates/bitwarden-core/src/auth/password/strength.rs deleted file mode 100644 index 6f1757fac..000000000 --- a/crates/bitwarden-core/src/auth/password/strength.rs +++ /dev/null @@ -1,78 +0,0 @@ -use zxcvbn::zxcvbn; - -const GLOBAL_INPUTS: [&str; 3] = ["bitwarden", "bit", "warden"]; - -pub(crate) fn password_strength( - password: String, - email: String, - additional_inputs: Vec, -) -> u8 { - let mut inputs = email_to_user_inputs(&email); - inputs.extend(additional_inputs); - - let mut arr: Vec<_> = inputs.iter().map(String::as_str).collect(); - arr.extend(GLOBAL_INPUTS); - - zxcvbn(&password, &arr).score().into() -} - -fn email_to_user_inputs(email: &str) -> Vec { - let parts = email.split_once('@'); - match parts { - Some((prefix, _)) => prefix - .trim() - .to_lowercase() - .split(|c: char| !c.is_alphanumeric()) - .map(str::to_owned) - .collect(), - None => vec![], - } -} - -#[cfg(test)] -mod tests { - use super::{email_to_user_inputs, password_strength}; - - #[test] - fn test_password_strength() { - let cases = vec![ - ("password", "random@bitwarden.com", 0), - ("password11", "random@bitwarden.com", 1), - ("Weakpass2", "random@bitwarden.com", 2), - ("GoodPass3!", "random@bitwarden.com", 3), - ("VeryStrong123@#", "random@bitwarden.com", 4), - ]; - - for (password, email, expected) in cases { - let result = password_strength(password.to_owned(), email.to_owned(), vec![]); - assert_eq!(expected, result, "{email}: {password}"); - } - } - - #[test] - fn test_penalize_email() { - let password = "asdfjkhkjwer!"; - - let result = password_strength( - password.to_owned(), - "random@bitwarden.com".to_owned(), - vec![], - ); - assert_eq!(result, 4); - - let result = password_strength( - password.to_owned(), - "asdfjkhkjwer@bitwarden.com".to_owned(), - vec![], - ); - assert_eq!(result, 1); - } - - #[test] - fn test_email_to_user_inputs() { - let email = "random@bitwarden.com"; - let result = email_to_user_inputs(email); - - assert_eq!(result, vec!["random"]); - } -} diff --git a/crates/bitwarden-core/src/auth/password/validate.rs b/crates/bitwarden-core/src/auth/password/validate.rs deleted file mode 100644 index b5f9ccfd2..000000000 --- a/crates/bitwarden-core/src/auth/password/validate.rs +++ /dev/null @@ -1,195 +0,0 @@ -use bitwarden_crypto::{HashPurpose, MasterKey}; - -use crate::{ - auth::determine_password_hash, - client::{LoginMethod, UserLoginMethod}, - error::{Error, Result}, - Client, -}; - -/// Validate if the provided password matches the password hash stored in the client. -pub(crate) fn validate_password( - client: &Client, - password: String, - password_hash: String, -) -> Result { - let login_method = client - .internal - .get_login_method() - .ok_or(Error::NotAuthenticated)?; - - #[allow(irrefutable_let_patterns)] - if let LoginMethod::User(login_method) = login_method.as_ref() { - match login_method { - UserLoginMethod::Username { email, kdf, .. } - | UserLoginMethod::ApiKey { email, kdf, .. } => { - let hash = determine_password_hash( - email, - kdf, - &password, - HashPurpose::LocalAuthorization, - )?; - - Ok(hash == password_hash) - } - } - } else { - Err(Error::NotAuthenticated) - } -} - -#[cfg(feature = "internal")] -pub(crate) fn validate_password_user_key( - client: &Client, - password: String, - encrypted_user_key: String, -) -> Result { - let login_method = client - .internal - .get_login_method() - .ok_or(Error::NotAuthenticated)?; - - #[allow(irrefutable_let_patterns)] - if let LoginMethod::User(login_method) = login_method.as_ref() { - match login_method { - UserLoginMethod::Username { email, kdf, .. } - | UserLoginMethod::ApiKey { email, kdf, .. } => { - let master_key = MasterKey::derive(&password, email, kdf)?; - let user_key = master_key - .decrypt_user_key(encrypted_user_key.parse()?) - .map_err(|_| "wrong password")?; - - let enc = client.internal.get_encryption_settings()?; - - let existing_key = enc.get_key(&None)?; - - if user_key.to_vec() != existing_key.to_vec() { - return Err("wrong user key".into()); - } - - Ok(master_key - .derive_master_key_hash(password.as_bytes(), HashPurpose::LocalAuthorization)?) - } - } - } else { - Err(Error::NotAuthenticated) - } -} - -#[cfg(test)] -mod tests { - use bitwarden_crypto::Kdf; - - use crate::auth::password::{validate::validate_password_user_key, validate_password}; - - #[test] - fn test_validate_password() { - use std::num::NonZeroU32; - - use crate::client::{Client, LoginMethod, UserLoginMethod}; - - let client = Client::new(None); - client - .internal - .set_login_method(LoginMethod::User(UserLoginMethod::Username { - email: "test@bitwarden.com".to_string(), - kdf: Kdf::PBKDF2 { - iterations: NonZeroU32::new(100_000).unwrap(), - }, - client_id: "1".to_string(), - })); - - let password = "password123".to_string(); - let password_hash = "7kTqkF1pY/3JeOu73N9kR99fDDe9O1JOZaVc7KH3lsU=".to_string(); - - let result = validate_password(&client, password, password_hash); - - assert!(result.unwrap()); - } - - #[cfg(feature = "internal")] - #[test] - fn test_validate_password_user_key() { - use std::num::NonZeroU32; - - use bitwarden_crypto::{Kdf, MasterKey}; - - use crate::client::{Client, LoginMethod, UserLoginMethod}; - - let client = Client::new(None); - - let password = "asdfasdfasdf"; - let email = "test@bitwarden.com"; - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }; - - client - .internal - .set_login_method(LoginMethod::User(UserLoginMethod::Username { - email: email.to_string(), - kdf: kdf.clone(), - client_id: "1".to_string(), - })); - - let master_key = MasterKey::derive(password, email, &kdf).unwrap(); - - let user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE="; - let private_key = "2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=".parse().unwrap(); - - client - .internal - .initialize_user_crypto_master_key(master_key, user_key.parse().unwrap(), private_key) - .unwrap(); - - let result = - validate_password_user_key(&client, "asdfasdfasdf".to_owned(), user_key.to_string()) - .unwrap(); - - assert_eq!(result, "aOvkBXFhSdgrBWR3hZCMRoML9+h5yRblU3lFphCdkeA="); - assert!(validate_password(&client, password.to_owned(), result).unwrap()) - } - - #[cfg(feature = "internal")] - #[test] - fn test_validate_password_user_key_wrong_password() { - use std::num::NonZeroU32; - - use bitwarden_crypto::{Kdf, MasterKey}; - - use crate::client::{Client, LoginMethod, UserLoginMethod}; - - let client = Client::new(None); - - let password = "asdfasdfasdf"; - let email = "test@bitwarden.com"; - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }; - - client - .internal - .set_login_method(LoginMethod::User(UserLoginMethod::Username { - email: email.to_string(), - kdf: kdf.clone(), - client_id: "1".to_string(), - })); - - let master_key = MasterKey::derive(password, email, &kdf).unwrap(); - - let user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE="; - let private_key = "2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=".parse().unwrap(); - - client - .internal - .initialize_user_crypto_master_key(master_key, user_key.parse().unwrap(), private_key) - .unwrap(); - - let result = - validate_password_user_key(&client, "asdfasdfasdf".to_string(), user_key.to_string()) - .unwrap(); - - assert_eq!(result, "aOvkBXFhSdgrBWR3hZCMRoML9+h5yRblU3lFphCdkeA="); - assert!(validate_password(&client, "asdfasdfasdf".to_string(), result.to_string()).unwrap()) - } -} diff --git a/crates/bitwarden-core/src/auth/pin.rs b/crates/bitwarden-core/src/auth/pin.rs deleted file mode 100644 index ee093bfa6..000000000 --- a/crates/bitwarden-core/src/auth/pin.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bitwarden_crypto::{EncString, PinKey}; - -use crate::{ - client::{LoginMethod, UserLoginMethod}, - error::{Error, Result}, - Client, -}; - -pub(crate) fn validate_pin( - client: &Client, - pin: String, - pin_protected_user_key: EncString, -) -> Result { - let login_method = client - .internal - .get_login_method() - .ok_or(Error::NotAuthenticated)?; - - #[allow(irrefutable_let_patterns)] - let LoginMethod::User(login_method) = login_method.as_ref() else { - return Err(Error::NotAuthenticated); - }; - - match login_method { - UserLoginMethod::Username { email, kdf, .. } - | UserLoginMethod::ApiKey { email, kdf, .. } => { - let enc = client.internal.get_encryption_settings()?; - let user_key = enc.get_key(&None)?; - - let pin_key = PinKey::derive(pin.as_bytes(), email.as_bytes(), kdf)?; - - let Ok(decrypted_key) = pin_key.decrypt_user_key(pin_protected_user_key) else { - return Ok(false); - }; - - Ok(user_key.to_vec() == decrypted_key.to_vec()) - } - } -} - -#[cfg(test)] -mod tests { - use std::num::NonZeroU32; - - use bitwarden_crypto::{Kdf, MasterKey}; - - use super::*; - use crate::client::{Client, LoginMethod, UserLoginMethod}; - - fn init_client() -> Client { - let client = Client::new(None); - - let password = "asdfasdfasdf"; - let email = "test@bitwarden.com"; - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }; - - client - .internal - .set_login_method(LoginMethod::User(UserLoginMethod::Username { - email: email.to_string(), - kdf: kdf.clone(), - client_id: "1".to_string(), - })); - - let master_key = MasterKey::derive(password, email, &kdf).unwrap(); - - let user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE="; - let private_key = "2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=".parse().unwrap(); - - client - .internal - .initialize_user_crypto_master_key(master_key, user_key.parse().unwrap(), private_key) - .unwrap(); - - client - } - - #[test] - fn test_validate_valid_pin() { - let pin = "1234".to_string(); - let pin_protected_user_key = "2.BXgvdBUeEMyvumqAJkAzPA==|JScDPoqOkVdrC1X755Ubt8tS9pC/thvrvNf5CyNcRg8HZtZ466EcRo7aCqwUzLyTVNRkbCYtFYT+09acGGHur8tGuS7Kmg/pYeaUo4K0UKI=|NpIFg5P9z0SN1MffbixD9OQE0l+NiNmnRQJs/kTsyoQ=" - .parse() - .unwrap(); - - let client = init_client(); - assert!(validate_pin(&client, pin.clone(), pin_protected_user_key).unwrap()); - } - - #[test] - fn test_validate_invalid_pin() { - let pin = "1234".to_string(); - let pin_protected_user_key = "2.BXgvdBUeEMyvumqAJkAyPA==|JScDPoqOkVdrC1X755Ubt8tS9pC/thvrvNf5CyNcRg8HZtZ466EcRo7aCqwUzLyTVNRkbCYtFYT+09acGGHur8tGuS7Kmg/pYeaUo4K0UKI=|NpIFg5P9z0SN1MffbixD9OQE0l+NiNmnRQJs/kTsyoQ=" - .parse() - .unwrap(); - - let client = init_client(); - assert!(!validate_pin(&client, pin.clone(), pin_protected_user_key).unwrap()); - } -} diff --git a/crates/bitwarden-core/src/auth/register.rs b/crates/bitwarden-core/src/auth/register.rs deleted file mode 100644 index 6a1c875fb..000000000 --- a/crates/bitwarden-core/src/auth/register.rs +++ /dev/null @@ -1,78 +0,0 @@ -use bitwarden_api_identity::{ - apis::accounts_api::accounts_register_post, - models::{KeysRequestModel, RegisterRequestModel}, -}; -use bitwarden_crypto::{default_pbkdf2_iterations, HashPurpose, Kdf, MasterKey, RsaKeyPair}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::{error::Result, Client}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct RegisterRequest { - pub email: String, - pub name: Option, - pub password: String, - pub password_hint: Option, -} - -/// Half baked implementation of user registration -pub(super) async fn register(client: &Client, req: &RegisterRequest) -> Result<()> { - let config = client.internal.get_api_configurations().await; - - let kdf = Kdf::default(); - - let keys = make_register_keys(req.email.to_owned(), req.password.to_owned(), kdf)?; - - accounts_register_post( - &config.identity, - Some(RegisterRequestModel { - name: req.name.to_owned(), - email: req.email.to_owned(), - master_password_hash: keys.master_password_hash, - master_password_hint: req.password_hint.to_owned(), - captcha_response: None, // TODO: Add - key: Some(keys.encrypted_user_key.to_string()), - keys: Some(Box::new(KeysRequestModel { - public_key: Some(keys.keys.public), - encrypted_private_key: keys.keys.private.to_string(), - })), - token: None, - organization_user_id: None, - kdf: Some(bitwarden_api_identity::models::KdfType::PBKDF2_SHA256), - kdf_iterations: Some(default_pbkdf2_iterations().get() as i32), - kdf_memory: None, - kdf_parallelism: None, - reference_data: None, // TODO: Add - }), - ) - .await?; - - Ok(()) -} - -pub(super) fn make_register_keys( - email: String, - password: String, - kdf: Kdf, -) -> Result { - let master_key = MasterKey::derive(&password, &email, &kdf)?; - let master_password_hash = - master_key.derive_master_key_hash(password.as_bytes(), HashPurpose::ServerAuthorization)?; - let (user_key, encrypted_user_key) = master_key.make_user_key()?; - let keys = user_key.make_key_pair()?; - - Ok(RegisterKeyResponse { - master_password_hash, - encrypted_user_key: encrypted_user_key.to_string(), - keys, - }) -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct RegisterKeyResponse { - pub master_password_hash: String, - pub encrypted_user_key: String, - pub keys: RsaKeyPair, -} diff --git a/crates/bitwarden-core/src/auth/renew.rs b/crates/bitwarden-core/src/auth/renew.rs deleted file mode 100644 index b35d71d6e..000000000 --- a/crates/bitwarden-core/src/auth/renew.rs +++ /dev/null @@ -1,109 +0,0 @@ -use chrono::Utc; - -#[cfg(feature = "secrets")] -use crate::{ - auth::api::request::AccessTokenRequest, - client::ServiceAccountLoginMethod, - secrets_manager::state::{self, ClientState}, -}; -use crate::{ - auth::api::{request::ApiTokenRequest, response::IdentityTokenResponse}, - client::{internal::InternalClient, LoginMethod, UserLoginMethod}, - error::{Error, Result}, -}; - -pub(crate) async fn renew_token(client: &InternalClient) -> Result<()> { - const TOKEN_RENEW_MARGIN_SECONDS: i64 = 5 * 60; - - let tokens = client - .tokens - .read() - .expect("RwLock is not poisoned") - .clone(); - let login_method = client - .login_method - .read() - .expect("RwLock is not poisoned") - .clone(); - - if let (Some(expires), Some(login_method)) = (tokens.expires_on, login_method) { - if Utc::now().timestamp() < expires - TOKEN_RENEW_MARGIN_SECONDS { - return Ok(()); - } - - let config = client - .__api_configurations - .read() - .expect("RwLock is not poisoned") - .clone(); - - let res = match login_method.as_ref() { - LoginMethod::User(u) => match u { - UserLoginMethod::Username { client_id, .. } => { - let refresh = tokens.refresh_token.ok_or(Error::NotAuthenticated)?; - - crate::auth::api::request::RenewTokenRequest::new(refresh, client_id.to_owned()) - .send(&config) - .await? - } - UserLoginMethod::ApiKey { - client_id, - client_secret, - .. - } => { - ApiTokenRequest::new(client_id, client_secret) - .send(&config) - .await? - } - }, - #[cfg(feature = "secrets")] - LoginMethod::ServiceAccount(s) => match s { - ServiceAccountLoginMethod::AccessToken { - access_token, - state_file, - .. - } => { - let result = AccessTokenRequest::new( - access_token.access_token_id, - &access_token.client_secret, - ) - .send(&config) - .await?; - - if let (IdentityTokenResponse::Payload(r), Some(state_file), Ok(enc_settings)) = - (&result, state_file, client.get_encryption_settings()) - { - if let Ok(enc_key) = enc_settings.get_key(&None) { - let state = - ClientState::new(r.access_token.clone(), enc_key.to_base64()); - _ = state::set(state_file, access_token, state); - } - } - - result - } - }, - }; - - match res { - IdentityTokenResponse::Refreshed(r) => { - client.set_tokens(r.access_token, r.refresh_token, r.expires_in); - return Ok(()); - } - IdentityTokenResponse::Authenticated(r) => { - client.set_tokens(r.access_token, r.refresh_token, r.expires_in); - return Ok(()); - } - IdentityTokenResponse::Payload(r) => { - client.set_tokens(r.access_token, r.refresh_token, r.expires_in); - return Ok(()); - } - _ => { - // We should never get here - return Err(Error::InvalidResponse); - } - } - } - - Err(Error::NotAuthenticated) -} diff --git a/crates/bitwarden-core/src/auth/tde.rs b/crates/bitwarden-core/src/auth/tde.rs deleted file mode 100644 index 8d99b50fe..000000000 --- a/crates/bitwarden-core/src/auth/tde.rs +++ /dev/null @@ -1,63 +0,0 @@ -use base64::{engine::general_purpose::STANDARD, Engine}; -use bitwarden_crypto::{ - AsymmetricEncString, AsymmetricPublicCryptoKey, DeviceKey, EncString, Kdf, SymmetricCryptoKey, - TrustDeviceResponse, UserKey, -}; - -use crate::{error::Result, Client}; - -/// This function generates a new user key and key pair, initializes the client's crypto with the -/// generated user key, and encrypts the user key with the organization public key for admin -/// password reset. If remember_device is true, it also generates a device key. -pub(super) fn make_register_tde_keys( - client: &Client, - email: String, - org_public_key: String, - remember_device: bool, -) -> Result { - let public_key = AsymmetricPublicCryptoKey::from_der(&STANDARD.decode(org_public_key)?)?; - - let mut rng = rand::thread_rng(); - - let user_key = UserKey::new(SymmetricCryptoKey::generate(&mut rng)); - let key_pair = user_key.make_key_pair()?; - - let admin_reset = - AsymmetricEncString::encrypt_rsa2048_oaep_sha1(&user_key.0.to_vec(), &public_key)?; - - let device_key = if remember_device { - Some(DeviceKey::trust_device(&user_key.0)?) - } else { - None - }; - - client - .internal - .set_login_method(crate::client::LoginMethod::User( - crate::client::UserLoginMethod::Username { - client_id: "".to_owned(), - email, - kdf: Kdf::default(), - }, - )); - client - .internal - .initialize_user_crypto_decrypted_key(user_key.0, key_pair.private.clone())?; - - Ok(RegisterTdeKeyResponse { - private_key: key_pair.private, - public_key: key_pair.public, - - admin_reset, - device_key, - }) -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct RegisterTdeKeyResponse { - pub private_key: EncString, - pub public_key: String, - - pub admin_reset: AsymmetricEncString, - pub device_key: Option, -} diff --git a/crates/bitwarden-core/src/client/client.rs b/crates/bitwarden-core/src/client/client.rs deleted file mode 100644 index b9bf4c516..000000000 --- a/crates/bitwarden-core/src/client/client.rs +++ /dev/null @@ -1,106 +0,0 @@ -use std::sync::{Arc, RwLock}; - -use reqwest::header::{self, HeaderValue}; - -use super::internal::InternalClient; -#[cfg(feature = "internal")] -use crate::client::flags::Flags; -use crate::client::{ - client_settings::ClientSettings, - internal::{ApiConfigurations, Tokens}, -}; - -/// The main struct to interact with the Bitwarden SDK. -#[derive(Debug)] -pub struct Client { - #[doc(hidden)] - pub internal: InternalClient, -} - -impl Client { - pub fn new(settings_input: Option) -> Self { - let settings = settings_input.unwrap_or_default(); - - fn new_client_builder() -> reqwest::ClientBuilder { - #[allow(unused_mut)] - let mut client_builder = reqwest::Client::builder(); - - #[cfg(not(target_arch = "wasm32"))] - { - client_builder = - client_builder.use_preconfigured_tls(rustls_platform_verifier::tls_config()); - } - - client_builder - } - - let external_client = new_client_builder().build().expect("Build should not fail"); - - let mut headers = header::HeaderMap::new(); - headers.append( - "Device-Type", - HeaderValue::from_str(&(settings.device_type as u8).to_string()) - .expect("All numbers are valid ASCII"), - ); - let client_builder = new_client_builder().default_headers(headers); - - let client = client_builder.build().expect("Build should not fail"); - - let identity = bitwarden_api_identity::apis::configuration::Configuration { - base_path: settings.identity_url, - user_agent: Some(settings.user_agent.clone()), - client: client.clone(), - basic_auth: None, - oauth_access_token: None, - bearer_access_token: None, - api_key: None, - }; - - let api = bitwarden_api_api::apis::configuration::Configuration { - base_path: settings.api_url, - user_agent: Some(settings.user_agent), - client, - basic_auth: None, - oauth_access_token: None, - bearer_access_token: None, - api_key: None, - }; - - Self { - internal: InternalClient { - tokens: RwLock::new(Tokens::default()), - login_method: RwLock::new(None), - #[cfg(feature = "internal")] - flags: RwLock::new(Flags::default()), - __api_configurations: RwLock::new(Arc::new(ApiConfigurations { - identity, - api, - device_type: settings.device_type, - })), - external_client, - encryption_settings: RwLock::new(None), - }, - } - } -} - -#[cfg(test)] -mod tests { - #[cfg(not(target_arch = "wasm32"))] - #[test] - fn test_reqwest_rustls_platform_verifier_are_compatible() { - // rustls-platform-verifier is generating a rustls::ClientConfig, - // which reqwest accepts as a &dyn Any and then downcasts it to a - // rustls::ClientConfig. - - // This means that if the rustls version of the two crates don't match, - // the downcast will fail and we will get a runtime error. - - // This tests is added to ensure that it doesn't happen. - - let _ = reqwest::ClientBuilder::new() - .use_preconfigured_tls(rustls_platform_verifier::tls_config()) - .build() - .unwrap(); - } -} diff --git a/crates/bitwarden-core/src/client/client_settings.rs b/crates/bitwarden-core/src/client/client_settings.rs deleted file mode 100644 index 70e2e6839..000000000 --- a/crates/bitwarden-core/src/client/client_settings.rs +++ /dev/null @@ -1,84 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -/// Basic client behavior settings. These settings specify the various targets and behavior of the -/// Bitwarden Client. They are optional and uneditable once the client is initialized. -/// -/// Defaults to -/// -/// ``` -/// # use bitwarden_core::{ClientSettings, DeviceType}; -/// let settings = ClientSettings { -/// identity_url: "https://identity.bitwarden.com".to_string(), -/// api_url: "https://api.bitwarden.com".to_string(), -/// user_agent: "Bitwarden Rust-SDK".to_string(), -/// device_type: DeviceType::SDK, -/// }; -/// let default = ClientSettings::default(); -/// ``` -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(default, rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -#[cfg_attr( - feature = "wasm", - derive(tsify_next::Tsify), - tsify(into_wasm_abi, from_wasm_abi) -)] -pub struct ClientSettings { - /// The identity url of the targeted Bitwarden instance. Defaults to `https://identity.bitwarden.com` - pub identity_url: String, - /// The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com` - pub api_url: String, - /// The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK` - pub user_agent: String, - /// Device type to send to Bitwarden. Defaults to SDK - pub device_type: DeviceType, -} - -impl Default for ClientSettings { - fn default() -> Self { - Self { - identity_url: "https://identity.bitwarden.com".into(), - api_url: "https://api.bitwarden.com".into(), - user_agent: "Bitwarden Rust-SDK".into(), - device_type: DeviceType::SDK, - } - } -} - -#[allow(non_camel_case_types)] -#[derive(Serialize, Deserialize, Copy, Clone, Debug, JsonSchema)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -#[cfg_attr( - feature = "wasm", - derive(tsify_next::Tsify), - tsify(into_wasm_abi, from_wasm_abi) -)] -pub enum DeviceType { - Android = 0, - iOS = 1, - ChromeExtension = 2, - FirefoxExtension = 3, - OperaExtension = 4, - EdgeExtension = 5, - WindowsDesktop = 6, - MacOsDesktop = 7, - LinuxDesktop = 8, - ChromeBrowser = 9, - FirefoxBrowser = 10, - OperaBrowser = 11, - EdgeBrowser = 12, - IEBrowser = 13, - UnknownBrowser = 14, - AndroidAmazon = 15, - UWP = 16, - SafariBrowser = 17, - VivaldiBrowser = 18, - VivaldiExtension = 19, - SafariExtension = 20, - SDK = 21, - Server = 22, - WindowsCLI = 23, - MacOsCLI = 24, - LinuxCLI = 25, -} diff --git a/crates/bitwarden-core/src/client/encryption_settings.rs b/crates/bitwarden-core/src/client/encryption_settings.rs deleted file mode 100644 index 9d9549021..000000000 --- a/crates/bitwarden-core/src/client/encryption_settings.rs +++ /dev/null @@ -1,158 +0,0 @@ -use std::collections::HashMap; - -use bitwarden_crypto::{AsymmetricCryptoKey, CryptoError, KeyContainer, SymmetricCryptoKey}; -#[cfg(feature = "internal")] -use bitwarden_crypto::{AsymmetricEncString, EncString, MasterKey}; -use thiserror::Error; -use uuid::Uuid; - -#[cfg(feature = "internal")] -use crate::error::Result; -use crate::VaultLocked; - -#[derive(Debug, Error)] -pub enum EncryptionSettingsError { - #[error("Cryptography error, {0}")] - Crypto(#[from] bitwarden_crypto::CryptoError), - - #[error(transparent)] - InvalidBase64(#[from] base64::DecodeError), - - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - - #[error("Invalid private key")] - InvalidPrivateKey, - - #[error("Missing private key")] - MissingPrivateKey, -} - -#[derive(Clone)] -pub struct EncryptionSettings { - user_key: SymmetricCryptoKey, - pub(crate) private_key: Option, - org_keys: HashMap, -} - -impl std::fmt::Debug for EncryptionSettings { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("EncryptionSettings").finish() - } -} - -impl EncryptionSettings { - /// Initialize the encryption settings with the master key and the encrypted user keys - #[cfg(feature = "internal")] - pub(crate) fn new( - master_key: MasterKey, - user_key: EncString, - private_key: EncString, - ) -> Result { - // Decrypt the user key - let user_key = master_key.decrypt_user_key(user_key)?; - Self::new_decrypted_key(user_key, private_key) - } - - /// Initialize the encryption settings with the decrypted user key and the encrypted user - /// private key This should only be used when unlocking the vault via biometrics or when the - /// vault is set to lock: "never" Otherwise handling the decrypted user key is dangerous and - /// discouraged - #[cfg(feature = "internal")] - pub(crate) fn new_decrypted_key( - user_key: SymmetricCryptoKey, - private_key: EncString, - ) -> Result { - use bitwarden_crypto::KeyDecryptable; - use log::warn; - - let private_key = { - let dec: Vec = private_key.decrypt_with_key(&user_key)?; - - // FIXME: [PM-11690] - Temporarily ignore invalid private keys until we have a recovery - // process in place. - AsymmetricCryptoKey::from_der(&dec) - .map_err(|_| { - warn!("Invalid private key"); - }) - .ok() - - // Some( - // AsymmetricCryptoKey::from_der(&dec) - // .map_err(|_| EncryptionSettingsError::InvalidPrivateKey)?, - // ) - }; - - Ok(EncryptionSettings { - user_key, - private_key, - org_keys: HashMap::new(), - }) - } - - /// Initialize the encryption settings with only a single decrypted key. - /// This is used only for logging in Secrets Manager with an access token - #[cfg(feature = "secrets")] - pub(crate) fn new_single_key(key: SymmetricCryptoKey) -> Self { - EncryptionSettings { - user_key: key, - private_key: None, - org_keys: HashMap::new(), - } - } - - #[cfg(feature = "internal")] - pub(crate) fn set_org_keys( - &mut self, - org_enc_keys: Vec<(Uuid, AsymmetricEncString)>, - ) -> Result<&Self, EncryptionSettingsError> { - use bitwarden_crypto::KeyDecryptable; - - // Make sure we only keep the keys given in the arguments and not any of the previous - // ones, which might be from organizations that the user is no longer a part of anymore - self.org_keys.clear(); - - // FIXME: [PM-11690] - Early abort to handle private key being corrupt - if org_enc_keys.is_empty() { - return Ok(self); - } - - let private_key = self - .private_key - .as_ref() - .ok_or(EncryptionSettingsError::MissingPrivateKey)?; - - // Decrypt the org keys with the private key - for (org_id, org_enc_key) in org_enc_keys { - let mut dec: Vec = org_enc_key.decrypt_with_key(private_key)?; - - let org_key = SymmetricCryptoKey::try_from(dec.as_mut_slice())?; - - self.org_keys.insert(org_id, org_key); - } - - Ok(self) - } - - pub fn get_key(&self, org_id: &Option) -> Result<&SymmetricCryptoKey, CryptoError> { - // If we don't have a private key set (to decode multiple org keys), we just use the main - // user key - if self.private_key.is_none() { - return Ok(&self.user_key); - } - - match org_id { - Some(org_id) => self - .org_keys - .get(org_id) - .ok_or(CryptoError::MissingKey(*org_id)), - None => Ok(&self.user_key), - } - } -} - -impl KeyContainer for EncryptionSettings { - fn get_key(&self, org_id: &Option) -> Result<&SymmetricCryptoKey, CryptoError> { - EncryptionSettings::get_key(self, org_id) - } -} diff --git a/crates/bitwarden-core/src/client/flags.rs b/crates/bitwarden-core/src/client/flags.rs deleted file mode 100644 index 0fc17534b..000000000 --- a/crates/bitwarden-core/src/client/flags.rs +++ /dev/null @@ -1,43 +0,0 @@ -#[derive(Debug, Default, Clone, serde::Deserialize)] -pub struct Flags { - #[serde(default, rename = "enableCipherKeyEncryption")] - pub enable_cipher_key_encryption: bool, -} - -impl Flags { - pub fn load_from_map(map: std::collections::HashMap) -> Self { - let map = map - .into_iter() - .map(|(k, v)| (k, serde_json::Value::Bool(v))) - .collect(); - serde_json::from_value(serde_json::Value::Object(map)).expect("Valid map") - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_load_empty_map() { - let map = std::collections::HashMap::new(); - let flags = Flags::load_from_map(map); - assert!(!flags.enable_cipher_key_encryption); - } - - #[test] - fn test_load_valid_map() { - let mut map = std::collections::HashMap::new(); - map.insert("enableCipherKeyEncryption".into(), true); - let flags = Flags::load_from_map(map); - assert!(flags.enable_cipher_key_encryption); - } - - #[test] - fn test_load_invalid_map() { - let mut map = std::collections::HashMap::new(); - map.insert("thisIsNotAFlag".into(), true); - let flags = Flags::load_from_map(map); - assert!(!flags.enable_cipher_key_encryption); - } -} diff --git a/crates/bitwarden-core/src/client/internal.rs b/crates/bitwarden-core/src/client/internal.rs deleted file mode 100644 index d64ac75be..000000000 --- a/crates/bitwarden-core/src/client/internal.rs +++ /dev/null @@ -1,252 +0,0 @@ -use std::sync::{Arc, RwLock}; - -#[cfg(any(feature = "internal", feature = "secrets"))] -use bitwarden_crypto::SymmetricCryptoKey; -#[cfg(feature = "internal")] -use bitwarden_crypto::{AsymmetricEncString, EncString, Kdf, MasterKey, PinKey}; -use chrono::Utc; -use uuid::Uuid; - -#[cfg(feature = "secrets")] -use super::login_method::ServiceAccountLoginMethod; -use crate::{ - auth::renew::renew_token, - client::{encryption_settings::EncryptionSettings, login_method::LoginMethod}, - error::{Result, VaultLocked}, - DeviceType, -}; -#[cfg(feature = "internal")] -use crate::{ - client::encryption_settings::EncryptionSettingsError, - client::{flags::Flags, login_method::UserLoginMethod}, - error::Error, -}; - -#[derive(Debug, Clone)] -pub struct ApiConfigurations { - pub identity: bitwarden_api_identity::apis::configuration::Configuration, - pub api: bitwarden_api_api::apis::configuration::Configuration, - pub device_type: DeviceType, -} - -#[derive(Debug, Default, Clone)] -pub(crate) struct Tokens { - // These two fields are always written to, but they are not read - // from the secrets manager SDK. - #[cfg_attr(not(feature = "internal"), allow(dead_code))] - access_token: Option, - pub(crate) expires_on: Option, - - #[cfg_attr(not(feature = "internal"), allow(dead_code))] - pub(crate) refresh_token: Option, -} - -#[derive(Debug)] -pub struct InternalClient { - pub(crate) tokens: RwLock, - pub(crate) login_method: RwLock>>, - - #[cfg(feature = "internal")] - pub(super) flags: RwLock, - - /// Use Client::get_api_configurations().await to access this. - /// It should only be used directly in renew_token - #[doc(hidden)] - pub(crate) __api_configurations: RwLock>, - - /// Reqwest client useable for external integrations like email forwarders, HIBP. - #[allow(unused)] - pub(crate) external_client: reqwest::Client, - - pub(super) encryption_settings: RwLock>>, -} - -impl InternalClient { - #[cfg(feature = "internal")] - pub fn load_flags(&self, flags: std::collections::HashMap) { - *self.flags.write().expect("RwLock is not poisoned") = Flags::load_from_map(flags); - } - - #[cfg(feature = "internal")] - pub fn get_flags(&self) -> Flags { - self.flags.read().expect("RwLock is not poisoned").clone() - } - - #[cfg(feature = "internal")] - pub(crate) fn get_login_method(&self) -> Option> { - self.login_method - .read() - .expect("RwLock is not poisoned") - .clone() - } - - pub fn get_access_token_organization(&self) -> Option { - match self - .login_method - .read() - .expect("RwLock is not poisoned") - .as_deref() - { - #[cfg(feature = "secrets")] - Some(LoginMethod::ServiceAccount(ServiceAccountLoginMethod::AccessToken { - organization_id, - .. - })) => Some(*organization_id), - _ => None, - } - } - - #[cfg(any(feature = "internal", feature = "secrets"))] - pub(crate) fn set_login_method(&self, login_method: LoginMethod) { - use log::debug; - - debug! {"setting login method: {:#?}", login_method} - *self.login_method.write().expect("RwLock is not poisoned") = Some(Arc::new(login_method)); - } - - pub(crate) fn set_tokens(&self, token: String, refresh_token: Option, expires_in: u64) { - *self.tokens.write().expect("RwLock is not poisoned") = Tokens { - access_token: Some(token.clone()), - expires_on: Some(Utc::now().timestamp() + expires_in as i64), - refresh_token, - }; - let mut guard = self - .__api_configurations - .write() - .expect("RwLock is not poisoned"); - - let inner = Arc::make_mut(&mut guard); - inner.identity.oauth_access_token = Some(token.clone()); - inner.api.oauth_access_token = Some(token); - } - - #[cfg(feature = "internal")] - pub fn is_authed(&self) -> bool { - let is_token_set = self - .tokens - .read() - .expect("RwLock is not poisoned") - .access_token - .is_some(); - let is_login_method_set = self - .login_method - .read() - .expect("RwLock is not poisoned") - .is_some(); - - is_token_set || is_login_method_set - } - - #[cfg(feature = "internal")] - pub fn get_kdf(&self) -> Result { - match self - .login_method - .read() - .expect("RwLock is not poisoned") - .as_deref() - { - Some(LoginMethod::User( - UserLoginMethod::Username { kdf, .. } | UserLoginMethod::ApiKey { kdf, .. }, - )) => Ok(kdf.clone()), - _ => Err(Error::NotAuthenticated), - } - } - - pub async fn get_api_configurations(&self) -> Arc { - // At the moment we ignore the error result from the token renewal, if it fails, - // the token will end up expiring and the next operation is going to fail anyway. - renew_token(self).await.ok(); - self.__api_configurations - .read() - .expect("RwLock is not poisoned") - .clone() - } - - #[cfg(feature = "internal")] - pub fn get_http_client(&self) -> &reqwest::Client { - &self.external_client - } - - pub fn get_encryption_settings(&self) -> Result, VaultLocked> { - self.encryption_settings - .read() - .expect("RwLock is not poisoned") - .clone() - .ok_or(VaultLocked) - } - - #[cfg(feature = "internal")] - pub(crate) fn initialize_user_crypto_master_key( - &self, - master_key: MasterKey, - user_key: EncString, - private_key: EncString, - ) -> Result<(), EncryptionSettingsError> { - *self - .encryption_settings - .write() - .expect("RwLock is not poisoned") = Some(Arc::new(EncryptionSettings::new( - master_key, - user_key, - private_key, - )?)); - - Ok(()) - } - - #[cfg(feature = "internal")] - pub(crate) fn initialize_user_crypto_decrypted_key( - &self, - user_key: SymmetricCryptoKey, - private_key: EncString, - ) -> Result<(), EncryptionSettingsError> { - *self - .encryption_settings - .write() - .expect("RwLock is not poisoned") = Some(Arc::new( - EncryptionSettings::new_decrypted_key(user_key, private_key)?, - )); - - Ok(()) - } - - #[cfg(feature = "internal")] - pub(crate) fn initialize_user_crypto_pin( - &self, - pin_key: PinKey, - pin_protected_user_key: EncString, - private_key: EncString, - ) -> Result<(), EncryptionSettingsError> { - let decrypted_user_key = pin_key.decrypt_user_key(pin_protected_user_key)?; - self.initialize_user_crypto_decrypted_key(decrypted_user_key, private_key) - } - - #[cfg(feature = "secrets")] - pub(crate) fn initialize_crypto_single_key(&self, key: SymmetricCryptoKey) { - *self - .encryption_settings - .write() - .expect("RwLock is not poisoned") = - Some(Arc::new(EncryptionSettings::new_single_key(key))); - } - - #[cfg(feature = "internal")] - pub fn initialize_org_crypto( - &self, - org_keys: Vec<(Uuid, AsymmetricEncString)>, - ) -> Result, EncryptionSettingsError> { - let mut guard = self - .encryption_settings - .write() - .expect("RwLock is not poisoned"); - - let Some(enc) = guard.as_mut() else { - return Err(VaultLocked.into()); - }; - - let inner = Arc::make_mut(enc); - inner.set_org_keys(org_keys)?; - - Ok(enc.clone()) - } -} diff --git a/crates/bitwarden-core/src/client/login_method.rs b/crates/bitwarden-core/src/client/login_method.rs deleted file mode 100644 index 67db15a71..000000000 --- a/crates/bitwarden-core/src/client/login_method.rs +++ /dev/null @@ -1,46 +0,0 @@ -#[cfg(feature = "secrets")] -use std::path::PathBuf; - -use bitwarden_crypto::Kdf; -#[cfg(feature = "secrets")] -use uuid::Uuid; - -#[cfg(feature = "secrets")] -use crate::auth::AccessToken; - -#[derive(Debug)] -pub(crate) enum LoginMethod { - #[allow(dead_code)] - User(UserLoginMethod), - // TODO: Organizations supports api key - // Organization(OrganizationLoginMethod), - #[cfg(feature = "secrets")] - ServiceAccount(ServiceAccountLoginMethod), -} - -#[allow(dead_code)] -#[derive(Debug)] -pub(crate) enum UserLoginMethod { - Username { - client_id: String, - email: String, - kdf: Kdf, - }, - ApiKey { - client_id: String, - client_secret: String, - - email: String, - kdf: Kdf, - }, -} - -#[cfg(feature = "secrets")] -#[derive(Debug)] -pub(crate) enum ServiceAccountLoginMethod { - AccessToken { - access_token: AccessToken, - organization_id: Uuid, - state_file: Option, - }, -} diff --git a/crates/bitwarden-core/src/client/mod.rs b/crates/bitwarden-core/src/client/mod.rs deleted file mode 100644 index 1ef7d9357..000000000 --- a/crates/bitwarden-core/src/client/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -//! Bitwarden SDK Client - -#[allow(clippy::module_inception)] -mod client; -pub mod client_settings; -pub mod encryption_settings; -pub mod internal; -pub use internal::ApiConfigurations; -pub mod login_method; -#[cfg(feature = "secrets")] -pub(crate) use login_method::ServiceAccountLoginMethod; -pub(crate) use login_method::{LoginMethod, UserLoginMethod}; -#[cfg(feature = "internal")] -mod flags; - -pub use client::Client; -pub use client_settings::{ClientSettings, DeviceType}; - -#[cfg(feature = "internal")] -pub mod test_accounts; diff --git a/crates/bitwarden-core/src/client/test_accounts.rs b/crates/bitwarden-core/src/client/test_accounts.rs deleted file mode 100644 index 858e1d2fa..000000000 --- a/crates/bitwarden-core/src/client/test_accounts.rs +++ /dev/null @@ -1,189 +0,0 @@ -#![allow(clippy::unwrap_used)] -use std::collections::HashMap; - -use bitwarden_crypto::Kdf; - -use crate::{ - mobile::crypto::{ - initialize_org_crypto, initialize_user_crypto, InitOrgCryptoRequest, InitUserCryptoMethod, - InitUserCryptoRequest, - }, - Client, -}; - -impl Client { - pub async fn init_test_account(account: TestAccount) -> Self { - let client = Client::new(None); - - client.internal.load_flags(HashMap::from([( - "enableCipherKeyEncryption".to_owned(), - true, - )])); - - initialize_user_crypto(&client, account.user).await.unwrap(); - - if let Some(org) = account.org { - initialize_org_crypto(&client, org).await.unwrap(); - } - - client - } -} - -/// Test Account -/// -/// Many of the SDK tests are based on encrypted data provided by the other Bitwarden clients. In -/// order to provide a consistent method of retrieving the data we provide a test account with user -/// keys. -/// -/// **Disclaimer:** The server typically encrypts and protects certain fields. In order to allow -/// accounts to be used on other servers this protection was explicitly removed from these data -/// dumps. -pub struct TestAccount { - user: InitUserCryptoRequest, - org: Option, -} - -/// ### `test@bitwarden.com` -/// -/// - Email: `test@bitwarden.com` -/// - Password: `asdfasdfasdf` -/// - PBKDF2: `600_000` iterations -/// -/// ```sql -/// INSERT INTO vault_dev.dbo.[User] ( -/// Id, Name, Email, EmailVerified, MasterPassword, MasterPasswordHint, Culture, SecurityStamp, -/// TwoFactorProviders, TwoFactorRecoveryCode, EquivalentDomains, -/// ExcludedGlobalEquivalentDomains, AccountRevisionDate, [Key], PublicKey, PrivateKey, Premium, -/// PremiumExpirationDate, Storage, MaxStorageGb, Gateway, GatewayCustomerId, -/// GatewaySubscriptionId, LicenseKey, CreationDate, RevisionDate, RenewalReminderDate, Kdf, -/// KdfIterations, ReferenceData, ApiKey, ForcePasswordReset, UsesKeyConnector, FailedLoginCount, -/// LastFailedLoginDate, AvatarColor, KdfMemory, KdfParallelism, LastPasswordChangeDate, -/// LastKdfChangeDate, LastKeyRotationDate, LastEmailChangeDate -/// ) -/// VALUES -/// ( -/// N 'b1fd4bf2-9643-4787-87f3-b0f00189c33b', -/// N 'Test', N 'test@bitwarden.com', -/// 0, N 'AQAAAAEAAYagAAAAEJ3ky9F/Zt5sy3/UAHVvBarMR+tBXYOM5IGgXy4/mx82uptgHgItauyCN+UZTvAqiA==', -/// null, N 'en-US', N 'F3KL7SCJKEXO4LJFVLGZITPEHM7SAVSZ', -/// null, null, null, null, N '2024-01-07 23:56:48.2600000', -/// N '2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=', -/// N 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Ww2chogqCpaAR7Uw448am4b7vDFXiM5kXjFlGfXBlrAdAqTTggEvTDlMNYqPlCo+mBM6iFmTTUY9rpZBvFskMnKvsvpJ47/fehAH2o2e3Ulv/5NFevaVCMCmpkBDtbMbO1A4a3btdRtCP8DsKWMefHauEpaoLxNTLWnOIZVfCMjsSgx2EvULHAZPTtbFwm4+UVKniM4ds4jvOsD85h4jn2aLs/jWJXFfxN8iVSqEqpC2TBvsPdyHb49xQoWWfF0Z6BiNqeNGKEU9Uos1pjL+kzhEzzSpH31PZT/ufJ/oo4+93wrUt57hb6f0jxiXhwd5yQ+9F6wVwpbfkq0IwhjOwIDAQAB', -/// N '2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=', -/// 0, null, null, null, null, null, null, -/// null, N '2024-01-07 23:53:38.5900000', -/// N '2024-01-07 23:53:38.5900000', -/// null, 0, 600000, N '{"id":null}', N '7gp59kKHt9kMlks0BuNC4IjNXYkljR', -/// 0, 0, 0, null, null, null, null, null, -/// null, null, null -/// ); -/// -/// INSERT INTO vault_dev.dbo.Organization ( -/// Id, Name, BusinessName, BillingEmail, [Plan], PlanType, Seats, MaxCollections, UseGroups, -/// UseDirectory, UseTotp, SelfHost, Storage, MaxStorageGb, Gateway, GatewayCustomerId, -/// GatewaySubscriptionId, Enabled, LicenseKey, ExpirationDate, CreationDate, RevisionDate, -/// BusinessAddress1, BusinessAddress2, BusinessAddress3, BusinessCountry, BusinessTaxNumber, -/// UsersGetPremium, UseEvents, Use2fa, TwoFactorProviders, UseApi, UsePolicies, Identifier, -/// ReferenceData, UseSso, UseResetPassword, PublicKey, PrivateKey, OwnersNotifiedOfAutoscaling, -/// MaxAutoscaleSeats, UseKeyConnector, UseScim, UseCustomPermissions, UseSecretsManager, Status, -/// UsePasswordManager, SmSeats, SmServiceAccounts, MaxAutoscaleSmSeats, -/// MaxAutoscaleSmServiceAccounts, SecretsManagerBeta, LimitCollectionCreationDeletion, -/// AllowAdminAccessToAllCollectionItems, FlexibleCollections -/// ) -/// VALUES -/// ( -/// N'1bc9ac1e-f5aa-45f2-94bf-b181009709b8', N'Test org', null, N'test@bitwarden.com', N'Free', -/// 0, 2, 2, 0, 0, 0, 0, null, null, null, null, null, 1, N'xrpfAYhMphI1ny6ks4aA', null, -/// N'2024-05-31 09:09:54.7466667', N'2024-05-31 09:09:54.7466667', null, null, null, null, -/// null, 0, 0, 0, null, 0, 0, null, N'{"id":null}', 0, 0, -/// N'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmIJbGMk6eZqVE7UxhZ46Weu2jKciqOiOkSVYtGvs61rfe9AXxtLaaZEKN4d4DmkZcF6dna2eXNxZmb7U4pwlttye8ksqISe6IUAZQox7auBpjopdCEPhKRg3BD/u8ks9UxSxgWe+fpebjt6gd5hsl1/5HOObn7SeU6EEU04cp3/eH7a4OTdXxB8oN62HGV9kM/ubM1goILgjoSJDbihMK0eb7b8hPHwcA/YOgKKiu/N3FighccdSMD5Pk+HfjacsFNZQa2EsqW09IvvSZ+iL6HQeZ1vwc/6TO1J7EOfJZFQcjoEL9LVI693efYoMZSmrPEWziZ4PvwpOOGo6OObyMQIDAQAB', N'2.6FggyKVyaKQsfohi5yqgbg==|UU2JeafOB41L5UscGmf4kq15JGDf3Bkf67KECiehTODzbWctVLTgyDk0Qco8/6CMN6nZGXjxR2A4r5ExhmwRNsNxd77G+MprkmiJz+7w33ROZ1ouQO5XjD3wbQ3ssqNiTKId6yAUPBvuAZRixVApauTuADc8QWGixqCQcqZzmU7YSBBIPf652/AEYr4Tk64YihoE39pHiK8MRbTLdRt3EF4LSMugPAPM24vCgUv3w1TD3Fj6sDg/6oi3flOV9SJZX4vCiUXbDNEuD/p2aQrEXVbaxweFOHjTe7F4iawjXw3nG3SO8rUBHcxbhDDVx5rjYactbW5QvHWiyla6uLb6o8WHBneg2EjTEwAHOZE/rBjcqmAJb2sVp1E0Kwq8ycGmL69vmqJPC1GqVTohAQvmEkaxIPpfq24Yb9ZPrADA7iEXBKuAQ1FphFUVgJBJGJbd60sOV1Rz1T+gUwS4wCNQ4l3LG1S22+wzUVlEku5DXFnT932tatqTyWEthqPqLCt6dL1+qa94XLpeHagXAx2VGe8n8IlcADtxqS+l8xQ4heT12WO9kC316vqvg1mnsI56faup9hb3eT9ZpKyxSBGYOphlTWfV1Y/v64f5PYvTo4aL0IYHyLY/9Qi72vFmOpPeHBYgD5t3j+H2CsiU1PkYsBggOmD7xW8FDuT6HWVvwhEJqeibVPK0Lhyj6tgvlSIAvFUaSMFPlmwFNmwfj/AHUhr9KuTfsBFTZ10yy9TZVgf+EofwnrxHBaWUgdD40aHoY1VjfG33iEuajb6buxG3pYFyPNhJNzeLZisUKIDRMQpUHrsE22EyrFFran3tZGdtcyIEK4Q1F0ULYzJ6T9iY25/ZgPy3pEAAMZCtqo3s+GjX295fWIHfMcnjMgNUHPjExjWBHa+ggK9iQXkFpBVyYB1ga/+0eiIhiek3PlgtvpDrqF7TsLK+ROiBw2GJ7uaO3EEXOj2GpNBuEJ5CdodhZkwzhwMcSatgDHkUuNVu0iVbF6/MxVdOxWXKO+jCYM6PZk/vAhLYqpPzu2T2Uyz4nkDs2Tiq61ez6FoCrzdHIiyIxVTzUQH8G9FgSmtaZ7GCbqlhnurYgcMciwPzxg0hpAQT+NZw1tVEii9vFSpJJbGJqNhORKfKh/Mu1P/9LOQq7Y0P2FIR3x/eUVEQ7CGv2jVtO5ryGSmKeq/P9Fr54wTPaNiqN2K+leACUznCdUWw8kZo/AsBcrOe4OkRX6k8LC3oeJXy06DEToatxEvPYemUauhxiXRw8nfNMqc4LyJq2bbT0zCgJHoqpozPdNg6AYWcoIobgAGu7ZQGq+oE1MT3GZxotMPe/NUJiAc5YE9Thb5Yf3gyno71pyqPTVl/6IQuh4SUz7rkgwF/aVHEnr4aUYNoc0PEzd2Me0jElsA3GAneq1I/wngutOWgTViTK4Nptr5uIzMVQs9H1rOMJNorP8b02t1NDu010rSsib9GaaJJq4r4iy46laQOxWoU0ex26arYnk+jw4833WSCTVBIprTgizZ+fKjoY0xwXvI2oOvGNEUCtGFvKFORTaQrlaXZIg1toa2BBVNicyONbwnI3KIu3MgGJ2SlCVXJn8oHFppVHFCdwgN1uDzGiKAhjvr0sZTUtXin2f2CszPTbbo=|fUhbVKrr8CSKE7TZJneXpDGraj5YhRrq9ESo206S+BY=', -/// null, null, 0, 0, 0, 0, 1, 1, null, null, null, null, 0, 1, 1, 0 -/// ); -/// -/// INSERT INTO vault_dev.dbo.OrganizationUser ( -/// Id, OrganizationId, UserId, Email, [Key], Status, Type, AccessAll, ExternalId, CreationDate, -/// RevisionDate, Permissions, ResetPasswordKey, AccessSecretsManager -/// ) -/// VALUES -/// ( -/// N'a5943f26-414f-4ecb-ba69-b181009709bc', N'1bc9ac1e-f5aa-45f2-94bf-b181009709b8', -/// N'b1fd4bf2-9643-4787-87f3-b0f00189c33b', null, -/// N'4.rY01mZFXHOsBAg5Fq4gyXuklWfm6mQASm42DJpx05a+e2mmp+P5W6r54WU2hlREX0uoTxyP91bKKwickSPdCQQ58J45LXHdr9t2uzOYyjVzpzebFcdMw1eElR9W2DW8wEk9+mvtWvKwu7yTebzND+46y1nRMoFydi5zPVLSlJEf81qZZ4Uh1UUMLwXz+NRWfixnGXgq2wRq1bH0n3mqDhayiG4LJKgGdDjWXC8W8MMXDYx24SIJrJu9KiNEMprJE+XVF9nQVNijNAjlWBqkDpsfaWTUfeVLRLctfAqW1blsmIv4RQ91PupYJZDNc8nO9ZTF3TEVM+2KHoxzDJrLs2Q==', -/// 2, 0, 1, null, N'2024-05-31 09:09:54.7466667', N'2024-05-31 09:09:54.7466667', -/// null, null, 0 -/// ); -/// ``` -pub fn test_bitwarden_com_account() -> TestAccount { - TestAccount { - user: InitUserCryptoRequest { - kdf_params: Kdf::PBKDF2 { - iterations: 600_000.try_into().unwrap(), - }, - email: "test@bitwarden.com".to_owned(), - private_key: "2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=".to_owned(), - - method: InitUserCryptoMethod::Password { - password: "asdfasdfasdf".to_owned(), - user_key: "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".to_owned(), - } - }, - org: Some(InitOrgCryptoRequest { - organization_keys: HashMap::from([( - "1bc9ac1e-f5aa-45f2-94bf-b181009709b8".parse().unwrap(), - "4.rY01mZFXHOsBAg5Fq4gyXuklWfm6mQASm42DJpx05a+e2mmp+P5W6r54WU2hlREX0uoTxyP91bKKwickSPdCQQ58J45LXHdr9t2uzOYyjVzpzebFcdMw1eElR9W2DW8wEk9+mvtWvKwu7yTebzND+46y1nRMoFydi5zPVLSlJEf81qZZ4Uh1UUMLwXz+NRWfixnGXgq2wRq1bH0n3mqDhayiG4LJKgGdDjWXC8W8MMXDYx24SIJrJu9KiNEMprJE+XVF9nQVNijNAjlWBqkDpsfaWTUfeVLRLctfAqW1blsmIv4RQ91PupYJZDNc8nO9ZTF3TEVM+2KHoxzDJrLs2Q==".parse().unwrap() - )]) - }), - } -} - -/// ### `legacy@bitwarden.com` -/// -/// Account which has a user_key of type `AesCbc256_B64` which is deprecated. -/// -/// - Email: `legacy@bitwarden.com` -/// - Password: `asdfasdfasdf` -/// - PBKDF2: `600_000` iterations -/// -/// ```sql -/// /// INSERT INTO vault_dev.dbo.[User] ( -/// Id, Name, Email, EmailVerified, MasterPassword, MasterPasswordHint, Culture, SecurityStamp, -/// TwoFactorProviders, TwoFactorRecoveryCode, EquivalentDomains, -/// ExcludedGlobalEquivalentDomains, AccountRevisionDate, [Key], PublicKey, PrivateKey, Premium, -/// PremiumExpirationDate, Storage, MaxStorageGb, Gateway, GatewayCustomerId, -/// GatewaySubscriptionId, LicenseKey, CreationDate, RevisionDate, RenewalReminderDate, Kdf, -/// KdfIterations, ReferenceData, ApiKey, ForcePasswordReset, UsesKeyConnector, FailedLoginCount, -/// LastFailedLoginDate, AvatarColor, KdfMemory, KdfParallelism, LastPasswordChangeDate, -/// LastKdfChangeDate, LastKeyRotationDate, LastEmailChangeDate -/// ) -/// VALUES -/// ( -/// N'764335ba-bb3b-4646-9c19-b1a301229eb2', N'Legacy', N'legacy@bitwarden.com', 1, -/// N'AQAAAAIAAYagAAAAEBPKHRNzY+8XTZGODQaa4hQUW/7qsW73v5O8WmqsS+xplghgtX/qXS1JTHT6PNWUFw==', -/// null, N'en-US', N'a1611dff-b383-4d7f-bb37-18c37507c11e', null, null, null, null, -/// N'2024-07-05 13:27:01.4033333', -/// N'0.8UClLa8IPE1iZT7chy5wzQ==|6PVfHnVk5S3XqEtQemnM5yb4JodxmPkkWzmDRdfyHtjORmvxqlLX40tBJZ+CKxQWmS8tpEB5w39rbgHg/gqs0haGdZG4cPbywsgGzxZ7uNI=', -/// N'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvbVTK0cY7j/9GD4UTIZVywT3vWNIiy5LuI1l9MIKbWh+PyVUB5ySR++Z1tDwx5R87AtXwjQS09j6a4X+uGHW4lRQR3Dngb2CpMutLqFjKk7NYWSj3MU5bKlvsCf2Z59ECJEFqo3eAsHYyrL3CixRsZg3LkQcYT+VT/qOOcI6UkMX50lpma2Cvdf3IAgPf6Enkg/WJ3d7D6aU5YtexTY03uKVbOb2UoO2ZJ29VyYEVEJ+0S6pqe9laeHz/oJ9SI3sRqdEYRmyDsbUWJHRJr7eAVesmiUBU/Ls7t4k/oXjfiJ7K5wqL5yCQ0HkqK8zQhi9wB4u7kHwEa8sDJE+cFQ5bQIDAQAB', -/// N'2.leBIE5u0aQUeXi++JzAnrA==|P8x+hs00RJx7epw+49qVtBhLJxE/JTL5dEHg6kq5pbZLdUY8ZvWK49v0EqgHbv1r298N9+msoO9hmdSIVIAZyycemYDSoc1rX4S1KpS/ZMA/Vd3VLFb+o13Ts62GFQ5ygHKgQZfzjU6jO5P/B/0igzFoxyJDomhW5NBC1P9+e/5qNRZN8loKvAaWc/7XtpRayPQqWx+AgYc2ntb1GF5hRVrW4M47bG5ZKllbJWtQKg2sXIy2lDBbKLRFWF4RFzNVcXQGMoPdWLY0f3uTwUH01dyGmFFMbOvfBEuYqmZyPdd93ve8zuFOEqkj46Ulpq2CVG8NvZARTwsdKl6XB0wGuHFoTsDJT2SJGl67pBBKsVRGxy059QW+9hAIB+emIV0T/7+0rvdeSXZ4AbG+oXGEXFTkHefwJKfeT0MBTAjYKr7ZRLgqvf7n39+nCEJU4l22kp8FmjcWIU7AgNipdGHC+UT2yfOcYlvgBgWDcMXcbVDMyus9105RgcW6PHozUj7yjbohI/A3XWmAFufP6BSnmEFCKoik78X/ry09xwiH2rN4KVXe/k9LpRNB2QBGIVsfgCrkxjeE8r0nA59Rvwrhny1z5BkvMW/N1KrGuafg/IYgegx72gJNuZPZlFu1Vs7HxySHmzYvm3DPV7bzCaAxxNtvZmQquNIEnsDQfjJO76iL1JCtDqNJVzGLHTMTr7S5hkOcydcH3kfKwZdA1ULVd2qu0SwOUEP/ECjU/cS5INy6WPYzNMAe/g2DISpQjNwBb5K17PIiGOR7/Q/A6E8pVnkHiAXuUFr9aLOYN9BWSu5Z+BPHH65na2FDmssix5WV09I2sUBfvdNCjkrUGdYgo8E+vOTn35x9GJHF45uhmgC1yAn/+/RSpORlrSVJ7NNP11dn3htUpSsIy/b7ituAu8Ry5mhicFU8CXJL4NeMlXThUt8P++wxs4wMkBvJ8J9NJAVKbAOA2o+GOdjbh6Ww3IRegkurWh4oL/dFSx0LpaXJuw6HFT/LzticPlSwHtUP11hZ81seMsXmkSZd8IugRFfwpPl7N6PVRWDOKxLf4gPqcnJ11TvfasXy1uolV2vZCPbrbbVzQMPdVwL/OzwfhqsIgQZI8rsDMK5D2EX8MaT8MDfGcsYcVTL9PmuZYLpOUnnHX0A1opAAa9iPw3d+eWB/GAyLvKPnMTUqVNos8HcCktXckCshihA8QuBJOwg3m0j2LPSZ5Jvf8gbXauBmt9I4IlJq0xfpgquYY1WNnO8IcWE4N9W+ASvOr9gnduA6CkDeAlyMUFmdpkeCjGMcsV741bTCPApSQlL3/TOT1cjK3iejWpz0OaVHXyg02hW2fNkOfYfr81GvnLvlHxIg4Prw89gKuWU+kQk82lFQo6QQpqbCbJC2FleurD8tYoSY0srhuioVInffvTxw2NMF7FQEqUcsK9AMKSEiDqzBi35Um/fiE3JL4XZBFw8Xzl7X3ab5nlg8X+xD5uSZY+oxD3sDVXjLaQ5JUoys+MCm0FkUj85l0zT6rvM4QLhU1RDK1U51T9HJhh8hsFJsqL4abRzwEWG7PSi859zN4UsgyuQfmBJv/n7QAFCbrJhVBlGB1TKLZRzvgmKoxTYTG3cJFkjetLcUTwrwC9naxAQRfF4=|ufHf73IzJ707dx44w4fjkuD7tDa50OwmmkxcypAT9uQ=', -/// 0, null, null, null, null, null, null, null, N'2024-07-04 17:38:06.7866667', -/// N'2024-07-05 13:27:01.4033333', null, 0, 600000, -/// N'{"id":null,"initiationPath":"Registration form"}', N'Yi9yvlPzvbOuilU0f0pFYuEuxcDy11', -/// 0, 0, 0, null, null, null, null, null, null, null, N'2024-07-05 13:27:01.4033333' -/// ); -/// ``` -pub fn test_legacy_user_key_account() -> TestAccount { - TestAccount { - user: InitUserCryptoRequest { - kdf_params: Kdf::PBKDF2 { - iterations: 600_000.try_into().unwrap(), - }, - email: "legacy@bitwarden.com".to_owned(), - private_key: "2.leBIE5u0aQUeXi++JzAnrA==|P8x+hs00RJx7epw+49qVtBhLJxE/JTL5dEHg6kq5pbZLdUY8ZvWK49v0EqgHbv1r298N9+msoO9hmdSIVIAZyycemYDSoc1rX4S1KpS/ZMA/Vd3VLFb+o13Ts62GFQ5ygHKgQZfzjU6jO5P/B/0igzFoxyJDomhW5NBC1P9+e/5qNRZN8loKvAaWc/7XtpRayPQqWx+AgYc2ntb1GF5hRVrW4M47bG5ZKllbJWtQKg2sXIy2lDBbKLRFWF4RFzNVcXQGMoPdWLY0f3uTwUH01dyGmFFMbOvfBEuYqmZyPdd93ve8zuFOEqkj46Ulpq2CVG8NvZARTwsdKl6XB0wGuHFoTsDJT2SJGl67pBBKsVRGxy059QW+9hAIB+emIV0T/7+0rvdeSXZ4AbG+oXGEXFTkHefwJKfeT0MBTAjYKr7ZRLgqvf7n39+nCEJU4l22kp8FmjcWIU7AgNipdGHC+UT2yfOcYlvgBgWDcMXcbVDMyus9105RgcW6PHozUj7yjbohI/A3XWmAFufP6BSnmEFCKoik78X/ry09xwiH2rN4KVXe/k9LpRNB2QBGIVsfgCrkxjeE8r0nA59Rvwrhny1z5BkvMW/N1KrGuafg/IYgegx72gJNuZPZlFu1Vs7HxySHmzYvm3DPV7bzCaAxxNtvZmQquNIEnsDQfjJO76iL1JCtDqNJVzGLHTMTr7S5hkOcydcH3kfKwZdA1ULVd2qu0SwOUEP/ECjU/cS5INy6WPYzNMAe/g2DISpQjNwBb5K17PIiGOR7/Q/A6E8pVnkHiAXuUFr9aLOYN9BWSu5Z+BPHH65na2FDmssix5WV09I2sUBfvdNCjkrUGdYgo8E+vOTn35x9GJHF45uhmgC1yAn/+/RSpORlrSVJ7NNP11dn3htUpSsIy/b7ituAu8Ry5mhicFU8CXJL4NeMlXThUt8P++wxs4wMkBvJ8J9NJAVKbAOA2o+GOdjbh6Ww3IRegkurWh4oL/dFSx0LpaXJuw6HFT/LzticPlSwHtUP11hZ81seMsXmkSZd8IugRFfwpPl7N6PVRWDOKxLf4gPqcnJ11TvfasXy1uolV2vZCPbrbbVzQMPdVwL/OzwfhqsIgQZI8rsDMK5D2EX8MaT8MDfGcsYcVTL9PmuZYLpOUnnHX0A1opAAa9iPw3d+eWB/GAyLvKPnMTUqVNos8HcCktXckCshihA8QuBJOwg3m0j2LPSZ5Jvf8gbXauBmt9I4IlJq0xfpgquYY1WNnO8IcWE4N9W+ASvOr9gnduA6CkDeAlyMUFmdpkeCjGMcsV741bTCPApSQlL3/TOT1cjK3iejWpz0OaVHXyg02hW2fNkOfYfr81GvnLvlHxIg4Prw89gKuWU+kQk82lFQo6QQpqbCbJC2FleurD8tYoSY0srhuioVInffvTxw2NMF7FQEqUcsK9AMKSEiDqzBi35Um/fiE3JL4XZBFw8Xzl7X3ab5nlg8X+xD5uSZY+oxD3sDVXjLaQ5JUoys+MCm0FkUj85l0zT6rvM4QLhU1RDK1U51T9HJhh8hsFJsqL4abRzwEWG7PSi859zN4UsgyuQfmBJv/n7QAFCbrJhVBlGB1TKLZRzvgmKoxTYTG3cJFkjetLcUTwrwC9naxAQRfF4=|ufHf73IzJ707dx44w4fjkuD7tDa50OwmmkxcypAT9uQ=".to_owned(), - method: InitUserCryptoMethod::Password { - password: "asdfasdfasdf".to_owned(), - user_key: "0.8UClLa8IPE1iZT7chy5wzQ==|6PVfHnVk5S3XqEtQemnM5yb4JodxmPkkWzmDRdfyHtjORmvxqlLX40tBJZ+CKxQWmS8tpEB5w39rbgHg/gqs0haGdZG4cPbywsgGzxZ7uNI=".to_owned(), - } - }, -org: None, - } -} diff --git a/crates/bitwarden-core/src/error.rs b/crates/bitwarden-core/src/error.rs deleted file mode 100644 index 697ca6c99..000000000 --- a/crates/bitwarden-core/src/error.rs +++ /dev/null @@ -1,213 +0,0 @@ -//! Errors that can occur when using this SDK - -use std::{borrow::Cow, fmt::Debug}; - -use bitwarden_api_api::apis::Error as ApiError; -use bitwarden_api_identity::apis::Error as IdentityError; -use log::debug; -use reqwest::StatusCode; -use thiserror::Error; -use validator::ValidationErrors; - -#[cfg(feature = "internal")] -use crate::client::encryption_settings::EncryptionSettingsError; - -#[derive(Debug, Error)] -pub enum Error { - #[error(transparent)] - MissingFieldError(#[from] MissingFieldError), - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - - #[error("The client is not authenticated or the session has expired")] - NotAuthenticated, - - #[error("Access token is not in a valid format: {0}")] - AccessTokenInvalid(#[from] AccessTokenInvalidError), - - #[error("The response received was invalid and could not be processed")] - InvalidResponse, - - #[error("Cryptography error, {0}")] - Crypto(#[from] bitwarden_crypto::CryptoError), - - #[error("Error parsing Identity response: {0}")] - IdentityFail(crate::auth::api::response::IdentityTokenFailResponse), - - #[error(transparent)] - Reqwest(#[from] reqwest::Error), - #[error(transparent)] - Serde(#[from] serde_json::Error), - #[error(transparent)] - Io(#[from] std::io::Error), - #[error(transparent)] - InvalidBase64(#[from] base64::DecodeError), - #[error(transparent)] - Chrono(#[from] chrono::ParseError), - - #[error("Received error message from server: [{}] {}", .status, .message)] - ResponseContent { status: StatusCode, message: String }, - - #[error(transparent)] - ValidationError(#[from] ValidationError), - - #[error("The state file version is invalid")] - InvalidStateFileVersion, - - #[error("The state file could not be read")] - InvalidStateFile, - - #[error("Internal error: {0}")] - Internal(Cow<'static, str>), - - #[cfg(feature = "internal")] - #[error(transparent)] - EncryptionSettings(#[from] EncryptionSettingsError), -} - -impl From for Error { - fn from(s: String) -> Self { - Self::Internal(s.into()) - } -} - -impl From<&'static str> for Error { - fn from(s: &'static str) -> Self { - Self::Internal(s.into()) - } -} - -#[derive(Debug, Error)] -pub enum AccessTokenInvalidError { - #[error("Doesn't contain a decryption key")] - NoKey, - #[error("Has the wrong number of parts")] - WrongParts, - #[error("Is the wrong version")] - WrongVersion, - #[error("Has an invalid identifier")] - InvalidUuid, - - #[error("Error decoding base64: {0}")] - InvalidBase64(#[from] base64::DecodeError), - - #[error("Invalid base64 length: expected {expected}, got {got}")] - InvalidBase64Length { expected: usize, got: usize }, -} - -// Ensure that the error messages implement Send and Sync -#[cfg(test)] -const _: () = { - fn assert_send() {} - fn assert_sync() {} - fn assert_all() { - assert_send::(); - assert_sync::(); - } -}; - -macro_rules! impl_bitwarden_error { - ($name:ident) => { - impl From<$name> for Error { - fn from(e: $name) -> Self { - match e { - $name::Reqwest(e) => Self::Reqwest(e), - $name::ResponseError(e) => Self::ResponseContent { - status: e.status, - message: e.content, - }, - $name::Serde(e) => Self::Serde(e), - $name::Io(e) => Self::Io(e), - } - } - } - }; -} -impl_bitwarden_error!(ApiError); -impl_bitwarden_error!(IdentityError); - -pub(crate) type Result = std::result::Result; - -#[derive(Debug, Error)] -#[error("The response received was missing a required field: {0}")] -pub struct MissingFieldError(pub &'static str); - -#[derive(Debug, Error)] -#[error("The client vault is locked and needs to be unlocked before use")] -pub struct VaultLocked; - -/// This macro is used to require that a value is present or return an error otherwise. -/// It is equivalent to using `val.ok_or(Error::MissingFields)?`, but easier to use and -/// with a more descriptive error message. -/// Note that this macro will return early from the function if the value is not present. -#[macro_export] -macro_rules! require { - ($val:expr) => { - match $val { - Some(val) => val, - None => return Err($crate::MissingFieldError(stringify!($val)).into()), - } - }; -} - -// Validation -#[derive(Debug, Error)] -pub enum ValidationError { - #[error("{0} must not be empty")] - Required(String), - #[error("{0} must not exceed {1} characters in length")] - ExceedsCharacterLength(String, u64), - #[error("{0} must not contain only whitespaces")] - OnlyWhitespaces(String), -} - -const VALIDATION_LENGTH_CODE: &str = "length"; -const VALIDATION_ONLY_WHITESPACES_CODE: &str = "only_whitespaces"; - -pub fn validate_only_whitespaces(value: &str) -> Result<(), validator::ValidationError> { - if !value.is_empty() && value.trim().is_empty() { - return Err(validator::ValidationError::new( - VALIDATION_ONLY_WHITESPACES_CODE, - )); - } - Ok(()) -} - -impl From for Error { - fn from(e: ValidationErrors) -> Self { - debug!("Validation errors: {:#?}", e); - for (field_name, errors) in e.field_errors() { - for error in errors { - match error.code.as_ref() { - VALIDATION_LENGTH_CODE => { - if error.params.contains_key("min") - && error.params["min"].as_u64().expect("Min provided") == 1 - && error.params["value"] - .as_str() - .expect("Value provided") - .is_empty() - { - return Error::ValidationError(ValidationError::Required( - field_name.to_string(), - )); - } else if error.params.contains_key("max") { - return Error::ValidationError( - ValidationError::ExceedsCharacterLength( - field_name.to_string(), - error.params["max"].as_u64().expect("Max provided"), - ), - ); - } - } - VALIDATION_ONLY_WHITESPACES_CODE => { - return Error::ValidationError(ValidationError::OnlyWhitespaces( - field_name.to_string(), - )); - } - _ => {} - } - } - } - format!("Unknown validation error: {:#?}", e).into() - } -} diff --git a/crates/bitwarden-core/src/lib.rs b/crates/bitwarden-core/src/lib.rs deleted file mode 100644 index 12b0df3c3..000000000 --- a/crates/bitwarden-core/src/lib.rs +++ /dev/null @@ -1,21 +0,0 @@ -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); -#[cfg(feature = "uniffi")] -mod uniffi_support; - -#[cfg(feature = "internal")] -pub mod admin_console; -pub mod auth; -pub mod client; -mod error; -pub use error::{validate_only_whitespaces, Error, MissingFieldError, VaultLocked}; -#[cfg(feature = "internal")] -pub mod mobile; -#[cfg(feature = "internal")] -pub mod platform; -#[cfg(feature = "secrets")] -pub mod secrets_manager; -mod util; - -pub use bitwarden_crypto::ZeroizingAllocator; -pub use client::{Client, ClientSettings, DeviceType}; diff --git a/crates/bitwarden-core/src/mobile/client_crypto.rs b/crates/bitwarden-core/src/mobile/client_crypto.rs deleted file mode 100644 index 0175f2712..000000000 --- a/crates/bitwarden-core/src/mobile/client_crypto.rs +++ /dev/null @@ -1,65 +0,0 @@ -#[cfg(feature = "internal")] -use bitwarden_crypto::{AsymmetricEncString, EncString}; - -use super::crypto::{derive_key_connector, DeriveKeyConnectorRequest}; -use crate::{client::encryption_settings::EncryptionSettingsError, Client}; -#[cfg(feature = "internal")] -use crate::{ - error::Result, - mobile::crypto::{ - derive_pin_key, derive_pin_user_key, enroll_admin_password_reset, get_user_encryption_key, - initialize_org_crypto, initialize_user_crypto, update_password, DerivePinKeyResponse, - InitOrgCryptoRequest, InitUserCryptoRequest, UpdatePasswordResponse, - }, -}; - -pub struct ClientCrypto<'a> { - pub(crate) client: &'a crate::Client, -} - -impl<'a> ClientCrypto<'a> { - pub async fn initialize_user_crypto( - &self, - req: InitUserCryptoRequest, - ) -> Result<(), EncryptionSettingsError> { - initialize_user_crypto(self.client, req).await - } - - pub async fn initialize_org_crypto( - &self, - req: InitOrgCryptoRequest, - ) -> Result<(), EncryptionSettingsError> { - initialize_org_crypto(self.client, req).await - } - - pub async fn get_user_encryption_key(&self) -> Result { - get_user_encryption_key(self.client).await - } - - pub fn update_password(&self, new_password: String) -> Result { - update_password(self.client, new_password) - } - - pub fn derive_pin_key(&self, pin: String) -> Result { - derive_pin_key(self.client, pin) - } - - pub fn derive_pin_user_key(&self, encrypted_pin: EncString) -> Result { - derive_pin_user_key(self.client, encrypted_pin) - } - - pub fn enroll_admin_password_reset(&self, public_key: String) -> Result { - enroll_admin_password_reset(self.client, public_key) - } - - /// Derive the master key for migrating to the key connector - pub fn derive_key_connector(&self, request: DeriveKeyConnectorRequest) -> Result { - derive_key_connector(request) - } -} - -impl<'a> Client { - pub fn crypto(&'a self) -> ClientCrypto<'a> { - ClientCrypto { client: self } - } -} diff --git a/crates/bitwarden-core/src/mobile/client_kdf.rs b/crates/bitwarden-core/src/mobile/client_kdf.rs deleted file mode 100644 index 8cbe38eab..000000000 --- a/crates/bitwarden-core/src/mobile/client_kdf.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bitwarden_crypto::{HashPurpose, Kdf}; - -use crate::{error::Result, mobile::kdf::hash_password, Client}; - -pub struct ClientKdf<'a> { - pub(crate) _client: &'a crate::Client, -} - -impl<'a> ClientKdf<'a> { - pub async fn hash_password( - &self, - email: String, - password: String, - kdf_params: Kdf, - purpose: HashPurpose, - ) -> Result { - hash_password(email, password, kdf_params, purpose).await - } -} - -impl<'a> Client { - pub fn kdf(&'a self) -> ClientKdf<'a> { - ClientKdf { _client: self } - } -} diff --git a/crates/bitwarden-core/src/mobile/crypto.rs b/crates/bitwarden-core/src/mobile/crypto.rs deleted file mode 100644 index 1b027df43..000000000 --- a/crates/bitwarden-core/src/mobile/crypto.rs +++ /dev/null @@ -1,588 +0,0 @@ -use std::collections::HashMap; - -use bitwarden_crypto::{ - AsymmetricEncString, EncString, Kdf, KeyDecryptable, KeyEncryptable, MasterKey, - SymmetricCryptoKey, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -#[cfg(feature = "wasm")] -use {tsify_next::Tsify, wasm_bindgen::prelude::*}; - -use crate::{ - client::{encryption_settings::EncryptionSettingsError, LoginMethod, UserLoginMethod}, - error::{Error, Result}, - Client, -}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] -pub struct InitUserCryptoRequest { - /// The user's KDF parameters, as received from the prelogin request - pub kdf_params: Kdf, - /// The user's email address - pub email: String, - /// The user's encrypted private key - pub private_key: String, - /// The initialization method to use - pub method: InitUserCryptoMethod, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] -pub enum InitUserCryptoMethod { - Password { - /// The user's master password - password: String, - /// The user's encrypted symmetric crypto key - user_key: String, - }, - DecryptedKey { - /// The user's decrypted encryption key, obtained using `get_user_encryption_key` - decrypted_user_key: String, - }, - Pin { - /// The user's PIN - pin: String, - /// The user's symmetric crypto key, encrypted with the PIN. Use `derive_pin_key` to obtain - /// this. - pin_protected_user_key: EncString, - }, - AuthRequest { - /// Private Key generated by the `crate::auth::new_auth_request`. - request_private_key: String, - - method: AuthRequestMethod, - }, - DeviceKey { - /// The device's DeviceKey - device_key: String, - /// The Device Private Key - protected_device_private_key: EncString, - /// The user's symmetric crypto key, encrypted with the Device Key. - device_protected_user_key: AsymmetricEncString, - }, - KeyConnector { - /// Base64 encoded master key, retrieved from the key connector. - master_key: String, - /// The user's encrypted symmetric crypto key - user_key: String, - }, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] -pub enum AuthRequestMethod { - UserKey { - /// User Key protected by the private key provided in `AuthRequestResponse`. - protected_user_key: AsymmetricEncString, - }, - MasterKey { - /// Master Key protected by the private key provided in `AuthRequestResponse`. - protected_master_key: AsymmetricEncString, - /// User Key protected by the MasterKey, provided by the auth response. - auth_request_key: EncString, - }, -} - -pub async fn initialize_user_crypto( - client: &Client, - req: InitUserCryptoRequest, -) -> Result<(), EncryptionSettingsError> { - use bitwarden_crypto::{DeviceKey, PinKey}; - - use crate::auth::{auth_request_decrypt_master_key, auth_request_decrypt_user_key}; - - let private_key: EncString = req.private_key.parse()?; - - match req.method { - InitUserCryptoMethod::Password { password, user_key } => { - let user_key: EncString = user_key.parse()?; - - let master_key = MasterKey::derive(&password, &req.email, &req.kdf_params)?; - client - .internal - .initialize_user_crypto_master_key(master_key, user_key, private_key)?; - } - InitUserCryptoMethod::DecryptedKey { decrypted_user_key } => { - let user_key = SymmetricCryptoKey::try_from(decrypted_user_key)?; - client - .internal - .initialize_user_crypto_decrypted_key(user_key, private_key)?; - } - InitUserCryptoMethod::Pin { - pin, - pin_protected_user_key, - } => { - let pin_key = PinKey::derive(pin.as_bytes(), req.email.as_bytes(), &req.kdf_params)?; - client.internal.initialize_user_crypto_pin( - pin_key, - pin_protected_user_key, - private_key, - )?; - } - InitUserCryptoMethod::AuthRequest { - request_private_key, - method, - } => { - let user_key = match method { - AuthRequestMethod::UserKey { protected_user_key } => { - auth_request_decrypt_user_key(request_private_key, protected_user_key)? - } - AuthRequestMethod::MasterKey { - protected_master_key, - auth_request_key, - } => auth_request_decrypt_master_key( - request_private_key, - protected_master_key, - auth_request_key, - )?, - }; - client - .internal - .initialize_user_crypto_decrypted_key(user_key, private_key)?; - } - InitUserCryptoMethod::DeviceKey { - device_key, - protected_device_private_key, - device_protected_user_key, - } => { - let device_key = DeviceKey::try_from(device_key)?; - let user_key = device_key - .decrypt_user_key(protected_device_private_key, device_protected_user_key)?; - - client - .internal - .initialize_user_crypto_decrypted_key(user_key, private_key)?; - } - InitUserCryptoMethod::KeyConnector { - master_key, - user_key, - } => { - let master_key = MasterKey::new(SymmetricCryptoKey::try_from(master_key)?); - let user_key: EncString = user_key.parse()?; - - client - .internal - .initialize_user_crypto_master_key(master_key, user_key, private_key)?; - } - } - - client - .internal - .set_login_method(crate::client::LoginMethod::User( - crate::client::UserLoginMethod::Username { - client_id: "".to_string(), - email: req.email, - kdf: req.kdf_params, - }, - )); - - Ok(()) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] -pub struct InitOrgCryptoRequest { - /// The encryption keys for all the organizations the user is a part of - pub organization_keys: HashMap, -} - -pub async fn initialize_org_crypto( - client: &Client, - req: InitOrgCryptoRequest, -) -> Result<(), EncryptionSettingsError> { - let organization_keys = req.organization_keys.into_iter().collect(); - client.internal.initialize_org_crypto(organization_keys)?; - Ok(()) -} - -pub async fn get_user_encryption_key(client: &Client) -> Result { - let enc = client.internal.get_encryption_settings()?; - let user_key = enc.get_key(&None)?; - - Ok(user_key.to_base64()) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct UpdatePasswordResponse { - /// Hash of the new password - password_hash: String, - /// User key, encrypted with the new password - new_key: EncString, -} - -pub fn update_password(client: &Client, new_password: String) -> Result { - let enc = client.internal.get_encryption_settings()?; - let user_key = enc.get_key(&None)?; - - let login_method = client - .internal - .get_login_method() - .ok_or(Error::NotAuthenticated)?; - - // Derive a new master key from password - let new_master_key = match login_method.as_ref() { - LoginMethod::User( - UserLoginMethod::Username { email, kdf, .. } - | UserLoginMethod::ApiKey { email, kdf, .. }, - ) => MasterKey::derive(&new_password, email, kdf)?, - #[cfg(feature = "secrets")] - LoginMethod::ServiceAccount(_) => return Err(Error::NotAuthenticated), - }; - - let new_key = new_master_key.encrypt_user_key(user_key)?; - - let password_hash = new_master_key.derive_master_key_hash( - new_password.as_bytes(), - bitwarden_crypto::HashPurpose::ServerAuthorization, - )?; - - Ok(UpdatePasswordResponse { - password_hash, - new_key, - }) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct DerivePinKeyResponse { - /// [UserKey](bitwarden_crypto::UserKey) protected by PIN - pin_protected_user_key: EncString, - /// PIN protected by [UserKey](bitwarden_crypto::UserKey) - encrypted_pin: EncString, -} - -pub fn derive_pin_key(client: &Client, pin: String) -> Result { - let enc = client.internal.get_encryption_settings()?; - let user_key = enc.get_key(&None)?; - - let login_method = client - .internal - .get_login_method() - .ok_or(Error::NotAuthenticated)?; - - let pin_protected_user_key = derive_pin_protected_user_key(&pin, &login_method, user_key)?; - - Ok(DerivePinKeyResponse { - pin_protected_user_key, - encrypted_pin: pin.encrypt_with_key(user_key)?, - }) -} - -pub fn derive_pin_user_key(client: &Client, encrypted_pin: EncString) -> Result { - let enc = client.internal.get_encryption_settings()?; - let user_key = enc.get_key(&None)?; - - let pin: String = encrypted_pin.decrypt_with_key(user_key)?; - let login_method = client - .internal - .get_login_method() - .ok_or(Error::NotAuthenticated)?; - - derive_pin_protected_user_key(&pin, &login_method, user_key) -} - -fn derive_pin_protected_user_key( - pin: &str, - login_method: &LoginMethod, - user_key: &SymmetricCryptoKey, -) -> Result { - use bitwarden_crypto::PinKey; - - let derived_key = match login_method { - LoginMethod::User( - UserLoginMethod::Username { email, kdf, .. } - | UserLoginMethod::ApiKey { email, kdf, .. }, - ) => PinKey::derive(pin.as_bytes(), email.as_bytes(), kdf)?, - #[cfg(feature = "secrets")] - LoginMethod::ServiceAccount(_) => return Err(Error::NotAuthenticated), - }; - - Ok(derived_key.encrypt_user_key(user_key)?) -} - -pub(super) fn enroll_admin_password_reset( - client: &Client, - public_key: String, -) -> Result { - use base64::{engine::general_purpose::STANDARD, Engine}; - use bitwarden_crypto::AsymmetricPublicCryptoKey; - - let public_key = AsymmetricPublicCryptoKey::from_der(&STANDARD.decode(public_key)?)?; - let enc = client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - Ok(AsymmetricEncString::encrypt_rsa2048_oaep_sha1( - &key.to_vec(), - &public_key, - )?) -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct DeriveKeyConnectorRequest { - /// Encrypted user key, used to validate the master key - pub user_key_encrypted: EncString, - - pub password: String, - pub kdf: Kdf, - pub email: String, -} - -/// Derive the master key for migrating to the key connector -pub(super) fn derive_key_connector(request: DeriveKeyConnectorRequest) -> Result { - let master_key = MasterKey::derive(&request.password, &request.email, &request.kdf)?; - master_key - .decrypt_user_key(request.user_key_encrypted) - .map_err(|_| "wrong password")?; - - Ok(master_key.to_base64()) -} - -#[cfg(test)] -mod tests { - use std::num::NonZeroU32; - - use super::*; - use crate::Client; - - #[tokio::test] - async fn test_update_password() { - let client = Client::new(None); - - let priv_key = "2.kmLY8NJVuiKBFJtNd/ZFpA==|qOodlRXER+9ogCe3yOibRHmUcSNvjSKhdDuztLlucs10jLiNoVVVAc+9KfNErLSpx5wmUF1hBOJM8zwVPjgQTrmnNf/wuDpwiaCxNYb/0v4FygPy7ccAHK94xP1lfqq7U9+tv+/yiZSwgcT+xF0wFpoxQeNdNRFzPTuD9o4134n8bzacD9DV/WjcrXfRjbBCzzuUGj1e78+A7BWN7/5IWLz87KWk8G7O/W4+8PtEzlwkru6Wd1xO19GYU18oArCWCNoegSmcGn7w7NDEXlwD403oY8Oa7ylnbqGE28PVJx+HLPNIdSC6YKXeIOMnVs7Mctd/wXC93zGxAWD6ooTCzHSPVV50zKJmWIG2cVVUS7j35H3rGDtUHLI+ASXMEux9REZB8CdVOZMzp2wYeiOpggebJy6MKOZqPT1R3X0fqF2dHtRFPXrNsVr1Qt6bS9qTyO4ag1/BCvXF3P1uJEsI812BFAne3cYHy5bIOxuozPfipJrTb5WH35bxhElqwT3y/o/6JWOGg3HLDun31YmiZ2HScAsUAcEkA4hhoTNnqy4O2s3yVbCcR7jF7NLsbQc0MDTbnjxTdI4VnqUIn8s2c9hIJy/j80pmO9Bjxp+LQ9a2hUkfHgFhgHxZUVaeGVth8zG2kkgGdrp5VHhxMVFfvB26Ka6q6qE/UcS2lONSv+4T8niVRJz57qwctj8MNOkA3PTEfe/DP/LKMefke31YfT0xogHsLhDkx+mS8FCc01HReTjKLktk/Jh9mXwC5oKwueWWwlxI935ecn+3I2kAuOfMsgPLkoEBlwgiREC1pM7VVX1x8WmzIQVQTHd4iwnX96QewYckGRfNYWz/zwvWnjWlfcg8kRSe+68EHOGeRtC5r27fWLqRc0HNcjwpgHkI/b6czerCe8+07TWql4keJxJxhBYj3iOH7r9ZS8ck51XnOb8tGL1isimAJXodYGzakwktqHAD7MZhS+P02O+6jrg7d+yPC2ZCuS/3TOplYOCHQIhnZtR87PXTUwr83zfOwAwCyv6KP84JUQ45+DItrXLap7nOVZKQ5QxYIlbThAO6eima6Zu5XHfqGPMNWv0bLf5+vAjIa5np5DJrSwz9no/hj6CUh0iyI+SJq4RGI60lKtypMvF6MR3nHLEHOycRUQbZIyTHWl4QQLdHzuwN9lv10ouTEvNr6sFflAX2yb6w3hlCo7oBytH3rJekjb3IIOzBpeTPIejxzVlh0N9OT5MZdh4sNKYHUoWJ8mnfjdM+L4j5Q2Kgk/XiGDgEebkUxiEOQUdVpePF5uSCE+TPav/9FIRGXGiFn6NJMaU7aBsDTFBLloffFLYDpd8/bTwoSvifkj7buwLYM+h/qcnfdy5FWau1cKav+Blq/ZC0qBpo658RTC8ZtseAFDgXoQZuksM10hpP9bzD04Bx30xTGX81QbaSTNwSEEVrOtIhbDrj9OI43KH4O6zLzK+t30QxAv5zjk10RZ4+5SAdYndIlld9Y62opCfPDzRy3ubdve4ZEchpIKWTQvIxq3T5ogOhGaWBVYnkMtM2GVqvWV//46gET5SH/MdcwhACUcZ9kCpMnWH9CyyUwYvTT3UlNyV+DlS27LMPvaw7tx7qa+GfNCoCBd8S4esZpQYK/WReiS8=|pc7qpD42wxyXemdNPuwxbh8iIaryrBPu8f/DGwYdHTw="; - - let kdf = Kdf::PBKDF2 { - iterations: 100_000.try_into().unwrap(), - }; - - initialize_user_crypto( - & client, - InitUserCryptoRequest { - kdf_params: kdf.clone(), - email: "test@bitwarden.com".into(), - private_key: priv_key.to_owned(), - method: InitUserCryptoMethod::Password { - password: "asdfasdfasdf".into(), - user_key: "2.u2HDQ/nH2J7f5tYHctZx6Q==|NnUKODz8TPycWJA5svexe1wJIz2VexvLbZh2RDfhj5VI3wP8ZkR0Vicvdv7oJRyLI1GyaZDBCf9CTBunRTYUk39DbZl42Rb+Xmzds02EQhc=|rwuo5wgqvTJf3rgwOUfabUyzqhguMYb3sGBjOYqjevc=".into(), - }, - }, - ) - .await - .unwrap(); - - let new_password_response = update_password(&client, "123412341234".into()).unwrap(); - - let client2 = Client::new(None); - - initialize_user_crypto( - &client2, - InitUserCryptoRequest { - kdf_params: kdf.clone(), - email: "test@bitwarden.com".into(), - private_key: priv_key.to_owned(), - method: InitUserCryptoMethod::Password { - password: "123412341234".into(), - user_key: new_password_response.new_key.to_string(), - }, - }, - ) - .await - .unwrap(); - - let new_hash = client2 - .kdf() - .hash_password( - "test@bitwarden.com".into(), - "123412341234".into(), - kdf.clone(), - bitwarden_crypto::HashPurpose::ServerAuthorization, - ) - .await - .unwrap(); - - assert_eq!(new_hash, new_password_response.password_hash); - - assert_eq!( - client - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64(), - client2 - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64() - ); - } - - #[tokio::test] - async fn test_initialize_user_crypto_pin() { - let client = Client::new(None); - - let priv_key = "2.kmLY8NJVuiKBFJtNd/ZFpA==|qOodlRXER+9ogCe3yOibRHmUcSNvjSKhdDuztLlucs10jLiNoVVVAc+9KfNErLSpx5wmUF1hBOJM8zwVPjgQTrmnNf/wuDpwiaCxNYb/0v4FygPy7ccAHK94xP1lfqq7U9+tv+/yiZSwgcT+xF0wFpoxQeNdNRFzPTuD9o4134n8bzacD9DV/WjcrXfRjbBCzzuUGj1e78+A7BWN7/5IWLz87KWk8G7O/W4+8PtEzlwkru6Wd1xO19GYU18oArCWCNoegSmcGn7w7NDEXlwD403oY8Oa7ylnbqGE28PVJx+HLPNIdSC6YKXeIOMnVs7Mctd/wXC93zGxAWD6ooTCzHSPVV50zKJmWIG2cVVUS7j35H3rGDtUHLI+ASXMEux9REZB8CdVOZMzp2wYeiOpggebJy6MKOZqPT1R3X0fqF2dHtRFPXrNsVr1Qt6bS9qTyO4ag1/BCvXF3P1uJEsI812BFAne3cYHy5bIOxuozPfipJrTb5WH35bxhElqwT3y/o/6JWOGg3HLDun31YmiZ2HScAsUAcEkA4hhoTNnqy4O2s3yVbCcR7jF7NLsbQc0MDTbnjxTdI4VnqUIn8s2c9hIJy/j80pmO9Bjxp+LQ9a2hUkfHgFhgHxZUVaeGVth8zG2kkgGdrp5VHhxMVFfvB26Ka6q6qE/UcS2lONSv+4T8niVRJz57qwctj8MNOkA3PTEfe/DP/LKMefke31YfT0xogHsLhDkx+mS8FCc01HReTjKLktk/Jh9mXwC5oKwueWWwlxI935ecn+3I2kAuOfMsgPLkoEBlwgiREC1pM7VVX1x8WmzIQVQTHd4iwnX96QewYckGRfNYWz/zwvWnjWlfcg8kRSe+68EHOGeRtC5r27fWLqRc0HNcjwpgHkI/b6czerCe8+07TWql4keJxJxhBYj3iOH7r9ZS8ck51XnOb8tGL1isimAJXodYGzakwktqHAD7MZhS+P02O+6jrg7d+yPC2ZCuS/3TOplYOCHQIhnZtR87PXTUwr83zfOwAwCyv6KP84JUQ45+DItrXLap7nOVZKQ5QxYIlbThAO6eima6Zu5XHfqGPMNWv0bLf5+vAjIa5np5DJrSwz9no/hj6CUh0iyI+SJq4RGI60lKtypMvF6MR3nHLEHOycRUQbZIyTHWl4QQLdHzuwN9lv10ouTEvNr6sFflAX2yb6w3hlCo7oBytH3rJekjb3IIOzBpeTPIejxzVlh0N9OT5MZdh4sNKYHUoWJ8mnfjdM+L4j5Q2Kgk/XiGDgEebkUxiEOQUdVpePF5uSCE+TPav/9FIRGXGiFn6NJMaU7aBsDTFBLloffFLYDpd8/bTwoSvifkj7buwLYM+h/qcnfdy5FWau1cKav+Blq/ZC0qBpo658RTC8ZtseAFDgXoQZuksM10hpP9bzD04Bx30xTGX81QbaSTNwSEEVrOtIhbDrj9OI43KH4O6zLzK+t30QxAv5zjk10RZ4+5SAdYndIlld9Y62opCfPDzRy3ubdve4ZEchpIKWTQvIxq3T5ogOhGaWBVYnkMtM2GVqvWV//46gET5SH/MdcwhACUcZ9kCpMnWH9CyyUwYvTT3UlNyV+DlS27LMPvaw7tx7qa+GfNCoCBd8S4esZpQYK/WReiS8=|pc7qpD42wxyXemdNPuwxbh8iIaryrBPu8f/DGwYdHTw="; - - initialize_user_crypto( - & client, - InitUserCryptoRequest { - kdf_params: Kdf::PBKDF2 { - iterations: 100_000.try_into().unwrap(), - }, - email: "test@bitwarden.com".into(), - private_key: priv_key.to_owned(), - method: InitUserCryptoMethod::Password { - password: "asdfasdfasdf".into(), - user_key: "2.u2HDQ/nH2J7f5tYHctZx6Q==|NnUKODz8TPycWJA5svexe1wJIz2VexvLbZh2RDfhj5VI3wP8ZkR0Vicvdv7oJRyLI1GyaZDBCf9CTBunRTYUk39DbZl42Rb+Xmzds02EQhc=|rwuo5wgqvTJf3rgwOUfabUyzqhguMYb3sGBjOYqjevc=".into(), - }, - }, - ) - .await - .unwrap(); - - let pin_key = derive_pin_key(&client, "1234".into()).unwrap(); - - // Verify we can unlock with the pin - let client2 = Client::new(None); - initialize_user_crypto( - &client2, - InitUserCryptoRequest { - kdf_params: Kdf::PBKDF2 { - iterations: 100_000.try_into().unwrap(), - }, - email: "test@bitwarden.com".into(), - private_key: priv_key.to_owned(), - method: InitUserCryptoMethod::Pin { - pin: "1234".into(), - pin_protected_user_key: pin_key.pin_protected_user_key, - }, - }, - ) - .await - .unwrap(); - - assert_eq!( - client - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64(), - client2 - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64() - ); - - // Verify we can derive the pin protected user key from the encrypted pin - let pin_protected_user_key = derive_pin_user_key(&client, pin_key.encrypted_pin).unwrap(); - - let client3 = Client::new(None); - - initialize_user_crypto( - &client3, - InitUserCryptoRequest { - kdf_params: Kdf::PBKDF2 { - iterations: 100_000.try_into().unwrap(), - }, - email: "test@bitwarden.com".into(), - private_key: priv_key.to_owned(), - method: InitUserCryptoMethod::Pin { - pin: "1234".into(), - pin_protected_user_key, - }, - }, - ) - .await - .unwrap(); - - assert_eq!( - client - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64(), - client3 - .internal - .get_encryption_settings() - .unwrap() - .get_key(&None) - .unwrap() - .to_base64() - ); - } - - #[test] - fn test_enroll_admin_password_reset() { - use base64::{engine::general_purpose::STANDARD, Engine}; - use bitwarden_crypto::AsymmetricCryptoKey; - - let client = Client::new(None); - - let master_key = MasterKey::derive( - "asdfasdfasdf", - "test@bitwarden.com", - &Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }, - ) - .unwrap(); - - let user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".parse().unwrap(); - let private_key ="2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S7mBZzhaAPidZvnuIhalE2qmTypDwHy22FyqV58T8MGGMchcASDi/QXI6kcdpJzPXSeU9o+NC68QDlOIrMVxKFeE7w7PvVmAaxEo0YwmuAzzKy9QpdlK0aab/xEi8V4iXj4hGepqAvHkXIQd+r3FNeiLfllkb61p6WTjr5urcmDQMR94/wYoilpG5OlybHdbhsYHvIzYoLrC7fzl630gcO6t4nM24vdB6Ymg9BVpEgKRAxSbE62Tqacxqnz9AcmgItb48NiR/He3n3ydGjPYuKk/ihZMgEwAEZvSlNxYONSbYrIGDtOY+8Nbt6KiH3l06wjZW8tcmFeVlWv+tWotnTY9IqlAfvNVTjtsobqtQnvsiDjdEVtNy/s2ci5TH+NdZluca2OVEr91Wayxh70kpM6ib4UGbfdmGgCo74gtKvKSJU0rTHakQ5L9JlaSDD5FamBRyI0qfL43Ad9qOUZ8DaffDCyuaVyuqk7cz9HwmEmvWU3VQ+5t06n/5kRDXttcw8w+3qClEEdGo1KeENcnXCB32dQe3tDTFpuAIMLqwXs6FhpawfZ5kPYvLPczGWaqftIs/RXJ/EltGc0ugw2dmTLpoQhCqrcKEBDoYVk0LDZKsnzitOGdi9mOWse7Se8798ib1UsHFUjGzISEt6upestxOeupSTOh0v4+AjXbDzRUyogHww3V+Bqg71bkcMxtB+WM+pn1XNbVTyl9NR040nhP7KEf6e9ruXAtmrBC2ah5cFEpLIot77VFZ9ilLuitSz+7T8n1yAh1IEG6xxXxninAZIzi2qGbH69O5RSpOJuJTv17zTLJQIIc781JwQ2TTwTGnx5wZLbffhCasowJKd2EVcyMJyhz6ru0PvXWJ4hUdkARJs3Xu8dus9a86N8Xk6aAPzBDqzYb1vyFIfBxP0oO8xFHgd30Cgmz8UrSE3qeWRrF8ftrI6xQnFjHBGWD/JWSvd6YMcQED0aVuQkuNW9ST/DzQThPzRfPUoiL10yAmV7Ytu4fR3x2sF0Yfi87YhHFuCMpV/DsqxmUizyiJuD938eRcH8hzR/VO53Qo3UIsqOLcyXtTv6THjSlTopQ+JOLOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=".parse().unwrap(); - client - .internal - .initialize_user_crypto_master_key(master_key, user_key, private_key) - .unwrap(); - - let public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsy7RFHcX3C8Q4/OMmhhbFReYWfB45W9PDTEA8tUZwZmtOiN2RErIS2M1c+K/4HoDJ/TjpbX1f2MZcr4nWvKFuqnZXyewFc+jmvKVewYi+NAu2++vqKq2kKcmMNhwoQDQdQIVy/Uqlp4Cpi2cIwO6ogq5nHNJGR3jm+CpyrafYlbz1bPvL3hbyoGDuG2tgADhyhXUdFuef2oF3wMvn1lAJAvJnPYpMiXUFmj1ejmbwtlxZDrHgUJvUcp7nYdwUKaFoi+sOttHn3u7eZPtNvxMjhSS/X/1xBIzP/mKNLdywH5LoRxniokUk+fV3PYUxJsiU3lV0Trc/tH46jqd8ZGjmwIDAQAB"; - - let encrypted = enroll_admin_password_reset(&client, public_key.to_owned()).unwrap(); - - let private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCzLtEUdxfcLxDj84yaGFsVF5hZ8Hjlb08NMQDy1RnBma06I3ZESshLYzVz4r/gegMn9OOltfV/Yxlyvida8oW6qdlfJ7AVz6Oa8pV7BiL40C7b76+oqraQpyYw2HChANB1AhXL9SqWngKmLZwjA7qiCrmcc0kZHeOb4KnKtp9iVvPVs+8veFvKgYO4ba2AAOHKFdR0W55/agXfAy+fWUAkC8mc9ikyJdQWaPV6OZvC2XFkOseBQm9Rynudh3BQpoWiL6w620efe7t5k+02/EyOFJL9f/XEEjM/+Yo0t3LAfkuhHGeKiRST59Xc9hTEmyJTeVXROtz+0fjqOp3xkaObAgMBAAECggEACs4xhnO0HaZhh1/iH7zORMIRXKeyxP2LQiTR8xwN5JJ9wRWmGAR9VasS7EZFTDidIGVME2u/h4s5EqXnhxfO+0gGksVvgNXJ/qw87E8K2216g6ZNo6vSGA7H1GH2voWwejJ4/k/cJug6dz2S402rRAKh2Wong1arYHSkVlQp3diiMa5FHAOSE+Cy09O2ZsaF9IXQYUtlW6AVXFrBEPYH2kvkaPXchh8VETMijo6tbvoKLnUHe+wTaDMls7hy8exjtVyI59r3DNzjy1lNGaGb5QSnFMXR+eHhPZc844Wv02MxC15zKABADrl58gpJyjTl6XpDdHCYGsmGpVGH3X9TQQKBgQDz/9beFjzq59ve6rGwn+EtnQfSsyYT+jr7GN8lNEXb3YOFXBgPhfFIcHRh2R00Vm9w2ApfAx2cd8xm2I6HuvQ1Os7g26LWazvuWY0Qzb+KaCLQTEGH1RnTq6CCG+BTRq/a3J8M4t38GV5TWlzv8wr9U4dl6FR4efjb65HXs1GQ4QKBgQC7/uHfrOTEHrLeIeqEuSl0vWNqEotFKdKLV6xpOvNuxDGbgW4/r/zaxDqt0YBOXmRbQYSEhmO3oy9J6XfE1SUln0gbavZeW0HESCAmUIC88bDnspUwS9RxauqT5aF8ODKN/bNCWCnBM1xyonPOs1oT1nyparJVdQoG//Y7vkB3+wKBgBqLqPq8fKAp3XfhHLfUjREDVoiLyQa/YI9U42IOz9LdxKNLo6p8rgVthpvmnRDGnpUuS+KOWjhdqDVANjF6G3t3DG7WNl8Rh5Gk2H4NhFswfSkgQrjebFLlBy9gjQVCWXt8KSmjvPbiY6q52Aaa8IUjA0YJAregvXxfopxO+/7BAoGARicvEtDp7WWnSc1OPoj6N14VIxgYcI7SyrzE0d/1x3ffKzB5e7qomNpxKzvqrVP8DzG7ydh8jaKPmv1MfF8tpYRy3AhmN3/GYwCnPqT75YYrhcrWcVdax5gmQVqHkFtIQkRSCIftzPLlpMGKha/YBV8c1fvC4LD0NPh/Ynv0gtECgYEAyOZg95/kte0jpgUEgwuMrzkhY/AaUJULFuR5MkyvReEbtSBQwV5tx60+T95PHNiFooWWVXiLMsAgyI2IbkxVR1Pzdri3gWK5CTfqb7kLuaj/B7SGvBa2Sxo478KS5K8tBBBWkITqo+wLC0mn3uZi1dyMWO1zopTA+KtEGF2dtGQ="; - let private_key = - AsymmetricCryptoKey::from_der(&STANDARD.decode(private_key).unwrap()).unwrap(); - let decrypted: Vec = encrypted.decrypt_with_key(&private_key).unwrap(); - - let enc = client.internal.get_encryption_settings().unwrap(); - let expected = enc.get_key(&None).unwrap(); - assert_eq!(&decrypted, &expected.to_vec()); - } - - #[test] - fn test_derive_key_connector() { - let request = DeriveKeyConnectorRequest { - password: "asdfasdfasdf".to_string(), - email: "test@bitwarden.com".to_string(), - kdf: Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }, - user_key_encrypted: "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".parse().unwrap(), - }; - - let result = derive_key_connector(request).unwrap(); - - assert_eq!(result, "ySXq1RVLKEaV1eoQE/ui9aFKIvXTl9PAXwp1MljfF50="); - } -} diff --git a/crates/bitwarden-core/src/mobile/kdf.rs b/crates/bitwarden-core/src/mobile/kdf.rs deleted file mode 100644 index e52328ed8..000000000 --- a/crates/bitwarden-core/src/mobile/kdf.rs +++ /dev/null @@ -1,14 +0,0 @@ -use bitwarden_crypto::{HashPurpose, Kdf, MasterKey}; - -use crate::error::Result; - -pub async fn hash_password( - email: String, - password: String, - kdf_params: Kdf, - purpose: HashPurpose, -) -> Result { - let master_key = MasterKey::derive(&password, &email, &kdf_params)?; - - Ok(master_key.derive_master_key_hash(password.as_bytes(), purpose)?) -} diff --git a/crates/bitwarden-core/src/mobile/mod.rs b/crates/bitwarden-core/src/mobile/mod.rs deleted file mode 100644 index 7c6a916a8..000000000 --- a/crates/bitwarden-core/src/mobile/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub mod crypto; -pub mod kdf; - -mod client_crypto; -mod client_kdf; - -pub use client_crypto::ClientCrypto; -pub use client_kdf::ClientKdf; diff --git a/crates/bitwarden-core/src/platform/client_platform.rs b/crates/bitwarden-core/src/platform/client_platform.rs deleted file mode 100644 index 1f117d5fe..000000000 --- a/crates/bitwarden-core/src/platform/client_platform.rs +++ /dev/null @@ -1,33 +0,0 @@ -use super::{ - generate_fingerprint::{generate_fingerprint, generate_user_fingerprint}, - get_user_api_key, FingerprintRequest, FingerprintResponse, SecretVerificationRequest, - UserApiKeyResponse, -}; -use crate::{error::Result, Client}; - -pub struct ClientPlatform<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> ClientPlatform<'a> { - pub fn fingerprint(&self, input: &FingerprintRequest) -> Result { - generate_fingerprint(input) - } - - pub fn user_fingerprint(self, fingerprint_material: String) -> Result { - generate_user_fingerprint(self.client, fingerprint_material) - } - - pub async fn get_user_api_key( - &mut self, - input: SecretVerificationRequest, - ) -> Result { - get_user_api_key(self.client, &input).await - } -} - -impl<'a> Client { - pub fn platform(&'a self) -> ClientPlatform<'a> { - ClientPlatform { client: self } - } -} diff --git a/crates/bitwarden-core/src/platform/generate_fingerprint.rs b/crates/bitwarden-core/src/platform/generate_fingerprint.rs deleted file mode 100644 index 5d31a1af1..000000000 --- a/crates/bitwarden-core/src/platform/generate_fingerprint.rs +++ /dev/null @@ -1,93 +0,0 @@ -use base64::{engine::general_purpose::STANDARD, Engine}; -use bitwarden_crypto::fingerprint; -use log::info; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::error::Result; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct FingerprintRequest { - /// The input material, used in the fingerprint generation process. - pub fingerprint_material: String, - /// The user's public key encoded with base64. - pub public_key: String, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct FingerprintResponse { - pub fingerprint: String, -} - -pub(crate) fn generate_fingerprint(input: &FingerprintRequest) -> Result { - info!("Generating fingerprint"); - - let key = STANDARD.decode(&input.public_key)?; - - Ok(FingerprintResponse { - fingerprint: fingerprint(&input.fingerprint_material, &key)?, - }) -} - -pub(crate) fn generate_user_fingerprint( - client: &crate::Client, - fingerprint_material: String, -) -> Result { - info!("Generating fingerprint"); - - let enc_settings = client.internal.get_encryption_settings()?; - let private_key = enc_settings - .private_key - .as_ref() - .ok_or("Missing private key")?; - - let public_key = private_key.to_public_der()?; - let fingerprint = fingerprint(&fingerprint_material, &public_key)?; - - Ok(fingerprint) -} - -#[cfg(test)] -mod tests { - use std::num::NonZeroU32; - - use bitwarden_crypto::{Kdf, MasterKey}; - - use super::*; - use crate::Client; - - #[test] - fn test_generate_user_fingerprint() { - let user_key = "2.oZg5RYpU2HjUAKI1DUQCkg==|PyRzI9kZpt66P2OedH8CHOeU0/lgKLkhIJiKDijdyFqIemBSIBoslhfQh/P1TK9xgZp0smgD6+5+yNbZfOpBaCVrsT3WWAO78xOWizduRe4=|xfDLDZSJ+yZAdh388flVg7SMDBJuMs0+CHTjutKs4uQ="; - let private_key = "2.tY6WsWKUbBwNU8wROuipiQ==|DNFL1d19xVojUKTTy2gxT+9J1VXbMQLcbMnx1HSeA6U3yZhsLR6DPaGibb3Bp8doIHtrsxzL/JeLb4gLDZ8RnDhFfE4iLRaPakX14kbBXrKH9/uW/zc7TqIVciWhI1PaeFlu8wnVuGt3e5Ysx6Y7Uw7RS8pRT5aE3sX3aDPGZTAdTutLn1VUfkShS5OK5HJl9CdiwV2wOcrf4w/WqtaNUUqGdsJ8C4ELlpBzHxqs+lEm+8pGPYmuGQIjVc0eOR9Tza9GTk3ih1XGc1znOCoKUZbtA29RfbwfmJy/yGi/3RLWZFQGCCij4cLC5OpldiX4JWL5Dhox44p/5IVF3rfxTVz3GCyDOoHevRG/06sUBq6nhbdCQf3lJvxwcQJhoQg4rsapM3rgol+u+TbXRiwWPbfswuLkRlvGFKtKUWMa4S57gj0CFYgSBPdTyhZTB44D7JQ2bd901Ur1dYWcDe4Kn3ZawpxL0cX2ZPlE3v8FXFJf2s8DJytL8yu73GasDzVmaGHxueWWVz7EHjh+pmB4oaAHARcY8d3LActAyl/+bcFRPYQJ68ae6DJhYYJGHIBWMImf2BifGgUX8vUFfUAYjne3D82lRyZQHs3xbl+ZxEPgWiPYRWUtxGXLLP4f9mbl+LeJdehtHNjC8kOduBL0CsP4gmugzNNUXI+Izc/9svno6kFr6SU0LA3MGrOU8ao7UCQbf/Pj/RKnG1gRmBDQqf7IMm6jOyTwdde9NpfQb32iH11PkuAKBvEtUuq9BeAKWjoZku+ycsN2jZH0hzd/QrU2c+E4+yHwX3wSxxorNOXt5EZkJbEDBlpRyE1zWoyy0wIYfcChYLvFN8QFHchlw5wmHxL+OOgdgndAtV/2DCx+NB6caY31qLictME+1GPPlQ7QvicMLgmpSWq83rs4ex/My6p3hCRSrJJiLvjEDZLYWKHHLd5tsPRAjX8ADNWB1VeIeiJrj1wpOCc1PbWpbljbbTsBmVPo6iKm/UDGAHBdQ//0j3FQg8f5w/j+McsoaMpDNHNTiLvjWERR+RBmsEA0lEL00wZz/DHlzOAYHLYYqFMT7GBCQD+Wk/l1TL+X2agUy7Irlk7QbZ4ivfdNIpSW8Ct9MGE6o4wV+nIpXURojgBBTcP85RTBLXXGrIprnK1G/VE8ONag3+nkqIyChjYyk5QMsxqOqSHsbiOxhCdXypbCbY4g9yKJtBJ/ADjxmELj0X7pqsTFqC0eRT7rk9qTBcYBBu6rwlAfq8AKjDB7WjNjzLaMi6lBoe4petBn1xcLkXD5hHra0TULxcYrq8MIb+Vk4CBZZdwwyVm/28SwSjHBIBpRysPAonDDsp3KlahwXEFvRDQR/oFww172GI7cx8SoPn93Qh0JfpTAAowsO3meR8bzUSyd7v3rmtaBPsWHE9zUXye/6nloMU5joEcD6uJaxd0kdaWWIoKLH++zHW1R776wJrS6u+TIWZgHqiIJoCd9fV25BnQcbZRKd6mnfNQkchJ6c6ozXKrFaa8DLdERdfh84+isw5mzW2zMJwHEwtKt6LUTyieC2exzPAwPxJT1+IMjuzuwiLnvGKOq+kwE/LWBSB0ZfGuCP/3jMM8OCfe7Hbpt1TfXcUxUzj6sSjkjQB6qBt+TINRdOFA=|fppguME86utsAOKrBYn6XU95q7daVbZ+3dD9OVkQlAw="; - let fingerprint_material = "a09726a0-9590-49d1-a5f5-afe300b6a515"; - - let client = Client::new(None); - - let master_key = MasterKey::derive( - "asdfasdfasdf", - "robb@stark.com", - &Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }, - ) - .unwrap(); - - client - .internal - .initialize_user_crypto_master_key( - master_key, - user_key.parse().unwrap(), - private_key.parse().unwrap(), - ) - .unwrap(); - - let fingerprint = - generate_user_fingerprint(&client, fingerprint_material.to_string()).unwrap(); - - assert_eq!(fingerprint, "turban-deftly-anime-chatroom-unselfish"); - } -} diff --git a/crates/bitwarden-core/src/platform/get_user_api_key.rs b/crates/bitwarden-core/src/platform/get_user_api_key.rs deleted file mode 100644 index 379707edd..000000000 --- a/crates/bitwarden-core/src/platform/get_user_api_key.rs +++ /dev/null @@ -1,83 +0,0 @@ -use std::sync::Arc; - -use bitwarden_api_api::{ - apis::accounts_api::accounts_api_key_post, - models::{ApiKeyResponseModel, SecretVerificationRequestModel}, -}; -use bitwarden_crypto::{HashPurpose, MasterKey}; -use log::{debug, info}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use super::SecretVerificationRequest; -use crate::{ - client::{LoginMethod, UserLoginMethod}, - error::{Error, Result}, - require, Client, -}; - -pub(crate) async fn get_user_api_key( - client: &Client, - input: &SecretVerificationRequest, -) -> Result { - info!("Getting Api Key"); - debug!("{:?}", input); - - let auth_settings = get_login_method(client)?; - let request = get_secret_verification_request(&auth_settings, input)?; - - let config = client.internal.get_api_configurations().await; - - let response = accounts_api_key_post(&config.api, Some(request)).await?; - UserApiKeyResponse::process_response(response) -} - -fn get_login_method(client: &Client) -> Result> { - if client.internal.is_authed() { - client - .internal - .get_login_method() - .ok_or(Error::NotAuthenticated) - } else { - Err(Error::NotAuthenticated) - } -} - -fn get_secret_verification_request( - login_method: &LoginMethod, - input: &SecretVerificationRequest, -) -> Result { - if let LoginMethod::User(UserLoginMethod::Username { email, kdf, .. }) = login_method { - let master_password_hash = input - .master_password - .as_ref() - .map(|p| { - let master_key = MasterKey::derive(p, email, kdf)?; - - master_key.derive_master_key_hash(p.as_bytes(), HashPurpose::ServerAuthorization) - }) - .transpose()?; - Ok(SecretVerificationRequestModel { - master_password_hash, - otp: input.otp.as_ref().cloned(), - secret: None, - auth_request_access_code: None, - }) - } else { - Err("Unsupported login method".into()) - } -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct UserApiKeyResponse { - /// The user's API key, which represents the client_secret portion of an oauth request. - api_key: String, -} - -impl UserApiKeyResponse { - pub(crate) fn process_response(response: ApiKeyResponseModel) -> Result { - let api_key = require!(response.api_key); - Ok(UserApiKeyResponse { api_key }) - } -} diff --git a/crates/bitwarden-core/src/platform/mod.rs b/crates/bitwarden-core/src/platform/mod.rs deleted file mode 100644 index 031554be0..000000000 --- a/crates/bitwarden-core/src/platform/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub mod client_platform; -mod generate_fingerprint; -mod get_user_api_key; -mod secret_verification_request; - -pub use generate_fingerprint::{FingerprintRequest, FingerprintResponse}; -pub(crate) use get_user_api_key::get_user_api_key; -pub use get_user_api_key::UserApiKeyResponse; -pub use secret_verification_request::SecretVerificationRequest; diff --git a/crates/bitwarden-core/src/platform/secret_verification_request.rs b/crates/bitwarden-core/src/platform/secret_verification_request.rs deleted file mode 100644 index e05926620..000000000 --- a/crates/bitwarden-core/src/platform/secret_verification_request.rs +++ /dev/null @@ -1,14 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretVerificationRequest { - /// The user's master password to use for user verification. If supplied, this will be used for - /// verification purposes. - pub master_password: Option, - /// Alternate user verification method through OTP. This is provided for users who have no - /// master password due to use of Customer Managed Encryption. Must be present and valid if - /// master_password is absent. - pub otp: Option, -} diff --git a/crates/bitwarden-core/src/secrets_manager/mod.rs b/crates/bitwarden-core/src/secrets_manager/mod.rs deleted file mode 100644 index 266c62acc..000000000 --- a/crates/bitwarden-core/src/secrets_manager/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod state; diff --git a/crates/bitwarden-core/src/secrets_manager/state.rs b/crates/bitwarden-core/src/secrets_manager/state.rs deleted file mode 100644 index b2b6f6a8e..000000000 --- a/crates/bitwarden-core/src/secrets_manager/state.rs +++ /dev/null @@ -1,53 +0,0 @@ -use std::{fmt::Debug, path::Path}; - -use bitwarden_crypto::{EncString, KeyDecryptable, KeyEncryptable}; -use serde::{Deserialize, Serialize}; - -use crate::{ - auth::AccessToken, - error::{Error, Result}, -}; - -const STATE_VERSION: u32 = 1; - -#[cfg(feature = "secrets")] -#[derive(Serialize, Deserialize, Debug)] -pub struct ClientState { - pub(crate) version: u32, - pub(crate) token: String, - pub(crate) encryption_key: String, -} - -impl ClientState { - pub fn new(token: String, encryption_key: String) -> Self { - Self { - version: STATE_VERSION, - token, - encryption_key, - } - } -} - -pub fn get(state_file: &Path, access_token: &AccessToken) -> Result { - let file_content = std::fs::read_to_string(state_file)?; - - let encrypted_state: EncString = file_content.parse()?; - let decrypted_state: String = encrypted_state.decrypt_with_key(&access_token.encryption_key)?; - let client_state: ClientState = serde_json::from_str(&decrypted_state)?; - - if client_state.version != STATE_VERSION { - return Err(Error::InvalidStateFileVersion); - } - - Ok(client_state) -} - -pub fn set(state_file: &Path, access_token: &AccessToken, state: ClientState) -> Result<()> { - let serialized_state: String = serde_json::to_string(&state)?; - let encrypted_state: EncString = - serialized_state.encrypt_with_key(&access_token.encryption_key)?; - let state_string: String = encrypted_state.to_string(); - - std::fs::write(state_file, state_string) - .map_err(|_| "Failure writing to the state file.".into()) -} diff --git a/crates/bitwarden-core/src/uniffi_support.rs b/crates/bitwarden-core/src/uniffi_support.rs deleted file mode 100644 index fcdd2aa78..000000000 --- a/crates/bitwarden-core/src/uniffi_support.rs +++ /dev/null @@ -1,52 +0,0 @@ -use std::num::NonZeroU32; - -use bitwarden_crypto::{AsymmetricEncString, EncString}; -use uuid::Uuid; - -use crate::UniffiCustomTypeConverter; - -uniffi::ffi_converter_forward!(NonZeroU32, bitwarden_crypto::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!(EncString, bitwarden_crypto::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!( - AsymmetricEncString, - bitwarden_crypto::UniFfiTag, - crate::UniFfiTag -); - -type DateTime = chrono::DateTime; -uniffi::custom_type!(DateTime, std::time::SystemTime); - -impl UniffiCustomTypeConverter for chrono::DateTime { - type Builtin = std::time::SystemTime; - - fn into_custom(val: Self::Builtin) -> uniffi::Result { - Ok(Self::from(val)) - } - - fn from_custom(obj: Self) -> Self::Builtin { - obj.into() - } -} - -uniffi::custom_type!(Uuid, String); - -impl UniffiCustomTypeConverter for Uuid { - type Builtin = String; - - fn into_custom(val: Self::Builtin) -> uniffi::Result { - Uuid::parse_str(val.as_str()).map_err(|e| e.into()) - } - - fn from_custom(obj: Self) -> Self::Builtin { - obj.to_string() - } -} - -// Uniffi doesn't emit unused types, this is a dummy record to ensure that the custom type -// converters are emitted -#[allow(dead_code)] -#[derive(uniffi::Record)] -struct UniffiConverterDummyRecord { - uuid: Uuid, - date: DateTime, -} diff --git a/crates/bitwarden-core/src/util.rs b/crates/bitwarden-core/src/util.rs deleted file mode 100644 index 59ef930d5..000000000 --- a/crates/bitwarden-core/src/util.rs +++ /dev/null @@ -1,28 +0,0 @@ -use base64::{ - alphabet, - engine::{DecodePaddingMode, GeneralPurpose, GeneralPurposeConfig}, -}; - -const INDIFFERENT: GeneralPurposeConfig = - GeneralPurposeConfig::new().with_decode_padding_mode(DecodePaddingMode::Indifferent); - -pub const STANDARD_INDIFFERENT: GeneralPurpose = - GeneralPurpose::new(&alphabet::STANDARD, INDIFFERENT); - -#[cfg(test)] -pub async fn start_mock(mocks: Vec) -> (wiremock::MockServer, crate::Client) { - let server = wiremock::MockServer::start().await; - - for mock in mocks { - server.register(mock).await; - } - - let settings = crate::ClientSettings { - identity_url: format!("http://{}/identity", server.address()), - api_url: format!("http://{}/api", server.address()), - user_agent: "Bitwarden Rust-SDK [TEST]".into(), - device_type: crate::DeviceType::SDK, - }; - - (server, crate::Client::new(Some(settings))) -} diff --git a/crates/bitwarden-core/tests/register.rs b/crates/bitwarden-core/tests/register.rs deleted file mode 100644 index 34f61ca3c..000000000 --- a/crates/bitwarden-core/tests/register.rs +++ /dev/null @@ -1,41 +0,0 @@ -/// Integration test for registering a new user and unlocking the vault -#[cfg(feature = "internal")] -#[tokio::test] -async fn test_register_initialize_crypto() { - use std::num::NonZeroU32; - - use bitwarden_core::{ - mobile::crypto::{InitUserCryptoMethod, InitUserCryptoRequest}, - Client, - }; - use bitwarden_crypto::Kdf; - - let client = Client::new(None); - - let email = "test@bitwarden.com"; - let password = "test123"; - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }; - - let register_response = client - .auth() - .make_register_keys(email.to_owned(), password.to_owned(), kdf.clone()) - .unwrap(); - - // Ensure we can initialize the crypto with the new keys - client - .crypto() - .initialize_user_crypto(InitUserCryptoRequest { - kdf_params: kdf, - email: email.to_owned(), - private_key: register_response.keys.private.to_string(), - - method: InitUserCryptoMethod::Password { - password: password.to_owned(), - user_key: register_response.encrypted_user_key, - }, - }) - .await - .unwrap(); -} diff --git a/crates/bitwarden-core/uniffi.toml b/crates/bitwarden-core/uniffi.toml deleted file mode 100644 index 7a804ef1d..000000000 --- a/crates/bitwarden-core/uniffi.toml +++ /dev/null @@ -1,9 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.core" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenCoreFFI" -module_name = "BitwardenCore" -generate_immutable_records = true diff --git a/crates/bitwarden-crypto/Cargo.toml b/crates/bitwarden-crypto/Cargo.toml deleted file mode 100644 index 7671a7762..000000000 --- a/crates/bitwarden-crypto/Cargo.toml +++ /dev/null @@ -1,68 +0,0 @@ -[package] -name = "bitwarden-crypto" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[features] -default = [] -wasm = ["dep:tsify-next", "dep:wasm-bindgen"] # WASM support - -uniffi = ["dep:uniffi"] # Uniffi bindings -no-memory-hardening = [] # Disable memory hardening features - -[dependencies] -aes = { version = ">=0.8.2, <0.9", features = ["zeroize"] } -argon2 = { version = ">=0.5.0, <0.6", features = [ - "std", - "zeroize", -], default-features = false } -base64 = ">=0.22.1, <0.23" -cbc = { version = ">=0.1.2, <0.2", features = ["alloc", "zeroize"] } -generic-array = { version = ">=0.14.7, <1.0", features = ["zeroize"] } -hkdf = ">=0.12.3, <0.13" -hmac = ">=0.12.1, <0.13" -num-bigint = ">=0.4, <0.5" -num-traits = ">=0.2.15, <0.3" -pbkdf2 = { version = ">=0.12.1, <0.13", default-features = false } -rand = ">=0.8.5, <0.9" -rayon = ">=1.8.1, <2.0" -rsa = ">=0.9.2, <0.10" -schemars = { workspace = true } -serde = { workspace = true } -sha1 = ">=0.10.5, <0.11" -sha2 = ">=0.10.6, <0.11" -subtle = ">=2.5.0, <3.0" -thiserror = { workspace = true } -tsify-next = { workspace = true, optional = true } -uniffi = { workspace = true, optional = true } -uuid = { workspace = true } -wasm-bindgen = { workspace = true, optional = true } -zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } - -[dev-dependencies] -criterion = "0.5.1" -rand_chacha = "0.3.1" -serde_json = { workspace = true } - -[[bench]] -name = "default_allocator" -harness = false -required-features = ["no-memory-hardening"] - -[[bench]] -name = "zeroizing_allocator" -harness = false -required-features = ["no-memory-hardening"] - -[lints] -workspace = true diff --git a/crates/bitwarden-crypto/README.md b/crates/bitwarden-crypto/README.md deleted file mode 100644 index fd697aa3c..000000000 --- a/crates/bitwarden-crypto/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Crypto - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-crypto/benches/default_allocator.rs b/crates/bitwarden-crypto/benches/default_allocator.rs deleted file mode 100644 index c03550b40..000000000 --- a/crates/bitwarden-crypto/benches/default_allocator.rs +++ /dev/null @@ -1,14 +0,0 @@ -use criterion::{black_box, criterion_group, criterion_main, Criterion}; - -fn allocate_string(s: &str) -> String { - s.to_owned() -} - -pub fn criterion_benchmark(c: &mut Criterion) { - c.bench_function("string abc", |b| { - b.iter(|| allocate_string(black_box("abc"))) - }); -} - -criterion_group!(benches, criterion_benchmark); -criterion_main!(benches); diff --git a/crates/bitwarden-crypto/benches/zeroizing_allocator.rs b/crates/bitwarden-crypto/benches/zeroizing_allocator.rs deleted file mode 100644 index 2f50d76d1..000000000 --- a/crates/bitwarden-crypto/benches/zeroizing_allocator.rs +++ /dev/null @@ -1,11 +0,0 @@ -use bitwarden_crypto::ZeroizingAllocator; -use criterion::{criterion_group, criterion_main}; -use default_allocator::criterion_benchmark; - -#[global_allocator] -static ALLOC: ZeroizingAllocator = ZeroizingAllocator(std::alloc::System); - -mod default_allocator; - -criterion_group!(benches, criterion_benchmark); -criterion_main!(benches); diff --git a/crates/bitwarden-crypto/src/aes.rs b/crates/bitwarden-crypto/src/aes.rs deleted file mode 100644 index 14393dfae..000000000 --- a/crates/bitwarden-crypto/src/aes.rs +++ /dev/null @@ -1,250 +0,0 @@ -//! # AES operations -//! -//! Contains low level AES operations used by the rest of the library. -//! -//! In most cases you should use the [EncString][crate::EncString] with -//! [KeyEncryptable][crate::KeyEncryptable] & [KeyDecryptable][crate::KeyDecryptable] instead. - -use aes::cipher::{ - block_padding::Pkcs7, - typenum::{U16, U32}, - BlockDecryptMut, BlockEncryptMut, KeyIvInit, -}; -use generic_array::GenericArray; -use hmac::Mac; -use subtle::ConstantTimeEq; - -use crate::{ - error::{CryptoError, Result}, - util::{PbkdfSha256Hmac, PBKDF_SHA256_HMAC_OUT_SIZE}, -}; - -/// Decrypt using AES-256 in CBC mode. -/// -/// Behaves similar to [decrypt_aes256_hmac], but does not validate the MAC. -pub(crate) fn decrypt_aes256( - iv: &[u8; 16], - data: Vec, - key: &GenericArray, -) -> Result> { - // Decrypt data - let iv = GenericArray::from_slice(iv); - let mut data = data; - let decrypted_key_slice = cbc::Decryptor::::new(key, iv) - .decrypt_padded_mut::(&mut data) - .map_err(|_| CryptoError::KeyDecrypt)?; - - // Data is decrypted in place and returns a subslice of the original Vec, to avoid cloning it, - // we truncate to the subslice length - let decrypted_len = decrypted_key_slice.len(); - data.truncate(decrypted_len); - - Ok(data) -} - -/// Decrypt using AES-256 in CBC mode with MAC. -/// -/// Behaves similar to [decrypt_aes256], but also validates the MAC. -pub(crate) fn decrypt_aes256_hmac( - iv: &[u8; 16], - mac: &[u8; 32], - data: Vec, - mac_key: &GenericArray, - key: &GenericArray, -) -> Result> { - let res = generate_mac(mac_key, iv, &data)?; - if res.ct_ne(mac).into() { - return Err(CryptoError::InvalidMac); - } - decrypt_aes256(iv, data, key) -} - -/// Encrypt using AES-256 in CBC mode. -/// -/// Behaves similar to [encrypt_aes256_hmac], but does't generate a MAC. -/// -/// ## Returns -/// -/// A AesCbc256_B64 EncString -#[allow(unused)] -pub(crate) fn encrypt_aes256(data_dec: &[u8], key: &GenericArray) -> ([u8; 16], Vec) { - let rng = rand::thread_rng(); - let (iv, data) = encrypt_aes256_internal(rng, data_dec, key); - - (iv, data) -} - -/// Encrypt using AES-256 in CBC mode with MAC. -/// -/// Behaves similar to [encrypt_aes256], but also generate a MAC. -/// -/// ## Returns -/// -/// A AesCbc256_HmacSha256_B64 EncString -pub(crate) fn encrypt_aes256_hmac( - data_dec: &[u8], - mac_key: &GenericArray, - key: &GenericArray, -) -> Result<([u8; 16], [u8; 32], Vec)> { - let rng = rand::thread_rng(); - let (iv, data) = encrypt_aes256_internal(rng, data_dec, key); - let mac = generate_mac(mac_key, &iv, &data)?; - - Ok((iv, mac, data)) -} - -/// Encrypt using AES-256 in CBC mode. -/// -/// Used internally by: -/// - [encrypt_aes256] -/// - [encrypt_aes256_hmac] -fn encrypt_aes256_internal( - mut rng: impl rand::RngCore, - data_dec: &[u8], - key: &GenericArray, -) -> ([u8; 16], Vec) { - let mut iv = [0u8; 16]; - rng.fill_bytes(&mut iv); - let data = cbc::Encryptor::::new(key, &iv.into()) - .encrypt_padded_vec_mut::(data_dec); - - (iv, data) -} - -/// Decrypt using AES-128 in CBC mode. -/// -/// Behaves similar to [decrypt_aes128_hmac], but does not validate the MAC. -fn decrypt_aes128(iv: &[u8; 16], data: Vec, key: &GenericArray) -> Result> { - // Decrypt data - let iv = GenericArray::from_slice(iv); - let mut data = data; - let decrypted_key_slice = cbc::Decryptor::::new(key, iv) - .decrypt_padded_mut::(&mut data) - .map_err(|_| CryptoError::KeyDecrypt)?; - - // Data is decrypted in place and returns a subslice of the original Vec, to avoid cloning it, - // we truncate to the subslice length - let decrypted_len = decrypted_key_slice.len(); - data.truncate(decrypted_len); - - Ok(data) -} - -/// Decrypt using AES-128 in CBC mode with MAC. -/// -/// Behaves similar to [decrypt_aes128], but also validates the MAC. -pub(crate) fn decrypt_aes128_hmac( - iv: &[u8; 16], - mac: &[u8; 32], - data: Vec, - mac_key: &GenericArray, - key: &GenericArray, -) -> Result> { - let res = generate_mac(mac_key, iv, &data)?; - if res.ct_ne(mac).into() { - return Err(CryptoError::InvalidMac); - } - decrypt_aes128(iv, data, key) -} - -/// Generate a MAC using HMAC-SHA256. -fn generate_mac(mac_key: &[u8], iv: &[u8], data: &[u8]) -> Result<[u8; 32]> { - let mut hmac = - PbkdfSha256Hmac::new_from_slice(mac_key).expect("hmac new_from_slice should not fail"); - hmac.update(iv); - hmac.update(data); - let mac: [u8; PBKDF_SHA256_HMAC_OUT_SIZE] = (*hmac.finalize().into_bytes()) - .try_into() - .map_err(|_| CryptoError::InvalidMac)?; - - Ok(mac) -} - -#[cfg(test)] -mod tests { - use base64::{engine::general_purpose::STANDARD, Engine}; - use generic_array::{sequence::GenericSequence, ArrayLength}; - use rand::SeedableRng; - - use super::*; - - /// Helper function for generating a `GenericArray` of size 32 with each element being - /// a multiple of a given increment, starting from a given offset. - fn generate_generic_array>( - offset: u8, - increment: u8, - ) -> GenericArray { - GenericArray::generate(|i| offset + i as u8 * increment) - } - - /// Helper function for generating a vector of a given size with each element being - /// a multiple of a given increment, starting from a given offset. - fn generate_vec(length: usize, offset: u8, increment: u8) -> Vec { - (0..length).map(|i| offset + i as u8 * increment).collect() - } - - #[test] - fn test_encrypt_aes256_internal() { - let key = generate_generic_array(0, 1); - - let rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - let result = encrypt_aes256_internal(rng, "EncryptMe!".as_bytes(), &key); - assert_eq!( - result, - ( - [62, 0, 239, 47, 137, 95, 64, 214, 127, 91, 184, 232, 31, 9, 165, 161], - vec![214, 76, 187, 97, 58, 146, 212, 140, 95, 164, 177, 204, 179, 133, 172, 148] - ) - ); - } - - #[test] - fn test_generate_mac() { - let mac_key = generate_vec(16, 0, 16); - - let iv = generate_vec(16, 0, 16); - let data = generate_vec(16, 0, 16); - - let result = generate_mac(&mac_key, &iv, &data); - - assert!(result.is_ok()); - let mac = result.unwrap(); - assert_eq!(mac.len(), 32); - } - - #[test] - fn test_decrypt_aes128() { - let iv = generate_vec(16, 0, 1); - let iv: &[u8; 16] = iv.as_slice().try_into().unwrap(); - let key = generate_generic_array(0, 1); - - let data = STANDARD.decode("dC0X+2IjFbeL4WLLg2jX7Q==").unwrap(); - - let decrypted = decrypt_aes128(iv, data, &key).unwrap(); - - assert_eq!(String::from_utf8(decrypted).unwrap(), "EncryptMe!"); - } - - #[test] - fn test_decrypt_aes256() { - let iv = generate_vec(16, 0, 1); - let iv: &[u8; 16] = iv.as_slice().try_into().unwrap(); - let key = generate_generic_array(0, 1); - let data = STANDARD.decode("ByUF8vhyX4ddU9gcooznwA==").unwrap(); - - let decrypted = decrypt_aes256(iv, data, &key).unwrap(); - - assert_eq!(String::from_utf8(decrypted).unwrap(), "EncryptMe!"); - } - - #[test] - fn test_encrypt_decrypt_aes256() { - let key = generate_generic_array(0, 1); - let data = "EncryptMe!"; - - let (iv, encrypted) = encrypt_aes256(data.as_bytes(), &key); - let decrypted = decrypt_aes256(&iv, encrypted, &key).unwrap(); - - assert_eq!(String::from_utf8(decrypted).unwrap(), "EncryptMe!"); - } -} diff --git a/crates/bitwarden-crypto/src/allocator.rs b/crates/bitwarden-crypto/src/allocator.rs deleted file mode 100644 index 525b150dd..000000000 --- a/crates/bitwarden-crypto/src/allocator.rs +++ /dev/null @@ -1,167 +0,0 @@ -use core::slice; -use std::alloc::{GlobalAlloc, Layout}; - -use zeroize::Zeroize; - -/// Custom allocator that zeroizes memory before deallocating it -/// -/// This is highly recommended to be enabled when using the Bitwarden crates to avoid sensitive data -/// persisting in memory after it has been deallocated. -/// -/// This allocator is a decorator around another allocator. -/// -/// # Example -/// -/// This example shows how to use the `ZeroizingAllocator` with the system allocator. -/// -/// ```rust,ignore -/// #[global_allocator] -/// static ALLOC: bitwarden_crypto::ZeroizingAllocator = -/// bitwarden_crypto::ZeroizingAllocator(std::alloc::System); -/// ``` -pub struct ZeroizingAllocator(pub Alloc); - -unsafe impl GlobalAlloc for ZeroizingAllocator { - unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - self.0.alloc(layout) - } - - unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { - slice::from_raw_parts_mut(ptr, layout.size()).zeroize(); - - self.0.dealloc(ptr, layout); - } - - unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { - self.0.alloc_zeroed(layout) - } -} - -#[cfg(test)] -mod tests { - #[test] - #[ignore = "It produces inconsistent results on some platforms"] - fn string() { - let s = String::from("hello"); - - let p1 = s.as_str().as_ptr(); - let c1 = s.capacity(); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p1, c1) }, - b"hello", - "String is not at the expected memory location" - ); - - drop(s); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p1, c1) }, - [0, 0, 0, 0, 0], - "memory was not zeroized after dropping the string" - ); - } - - #[test] - #[ignore = "It produces inconsistent results on some platforms"] - fn string_expand() { - let mut s = String::from("hello"); - - let p1 = s.as_str().as_ptr(); - let c1 = s.capacity(); - - assert_eq!(unsafe { std::slice::from_raw_parts(p1, c1) }, b"hello"); - - s.push_str(" world"); - - let p2 = s.as_str().as_ptr(); - let c2 = s.capacity(); - - // We allocated a new string - assert_ne!(p1, p2); - assert_eq!( - unsafe { std::slice::from_raw_parts(p1, c1) }, - [0, 0, 0, 0, 0], - "old string was not zeroized" - ); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p2, c2) }, - b"hello world" - ); - - // Drop the expanded string - drop(s); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p2, c2) }, - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "expanded string was not zeroized" - ); - } - - #[test] - #[ignore = "It produces inconsistent results on some platforms"] - fn vec() { - let v = vec![1, 2, 3, 4, 5]; - - let p1 = v.as_slice().as_ptr(); - let c1 = v.capacity(); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p1, c1) }, - [1, 2, 3, 4, 5], - "vec is not at the expected memory location" - ); - - drop(v); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p1, c1) }, - [0, 0, 0, 0, 0], - "vec was not zeroized after dropping" - ); - } - - #[test] - #[ignore = "It produces inconsistent results on some platforms"] - fn vec_expand() { - let mut v = vec![1, 2, 3, 4, 5]; - - let p1 = v.as_slice().as_ptr(); - let c1 = v.capacity(); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p1, c1) }, - [1, 2, 3, 4, 5], - "vec is not at the expected memory location" - ); - - v.extend_from_slice(&[6, 7, 8, 9, 10]); - - let p2 = v.as_slice().as_ptr(); - let c2 = v.capacity(); - - // We allocated a new vector - assert_ne!(p1, p2); - assert_eq!( - unsafe { std::slice::from_raw_parts(p1, c1) }, - [0, 0, 0, 0, 0], - "old vec was not zeroized" - ); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p2, c2) }, - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - ); - - // Drop the expanded vector - drop(v); - - assert_eq!( - unsafe { std::slice::from_raw_parts(p2, c2) }, - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "expanded vec was not zeroized" - ); - } -} diff --git a/crates/bitwarden-crypto/src/enc_string/asymmetric.rs b/crates/bitwarden-crypto/src/enc_string/asymmetric.rs deleted file mode 100644 index 9d4f0d635..000000000 --- a/crates/bitwarden-crypto/src/enc_string/asymmetric.rs +++ /dev/null @@ -1,329 +0,0 @@ -use std::{fmt::Display, str::FromStr}; - -use base64::{engine::general_purpose::STANDARD, Engine}; -pub use internal::AsymmetricEncString; -use rsa::Oaep; -use serde::Deserialize; - -use super::{from_b64_vec, split_enc_string}; -use crate::{ - error::{CryptoError, EncStringParseError, Result}, - rsa::encrypt_rsa2048_oaep_sha1, - AsymmetricCryptoKey, AsymmetricEncryptable, KeyDecryptable, -}; -// This module is a workaround to avoid deprecated warnings that come from the ZeroizeOnDrop -// macro expansion -#[allow(deprecated)] -mod internal { - #[cfg(feature = "wasm")] - #[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] - const TS_CUSTOM_TYPES: &'static str = r#" - export type AsymmetricEncString = string; - "#; - - /// # Encrypted string primitive - /// - /// [AsymmetricEncString] is a Bitwarden specific primitive that represents an asymmetrically - /// encrypted string. They are used together with the KeyDecryptable and KeyEncryptable - /// traits to encrypt and decrypt data using [crate::AsymmetricCryptoKey]s. - /// - /// The flexibility of the [AsymmetricEncString] type allows for different encryption algorithms - /// to be used which is represented by the different variants of the enum. - /// - /// ## Note - /// - /// For backwards compatibility we will rarely if ever be able to remove support for decrypting - /// old variants, but we should be opinionated in which variants are used for encrypting. - /// - /// ## Variants - /// - [Rsa2048_OaepSha256_B64](AsymmetricEncString::Rsa2048_OaepSha256_B64) - /// - [Rsa2048_OaepSha1_B64](AsymmetricEncString::Rsa2048_OaepSha1_B64) - /// - /// ## Serialization - /// - /// [AsymmetricEncString] implements [std::fmt::Display] and [std::str::FromStr] to allow for - /// easy serialization and uses a custom scheme to represent the different variants. - /// - /// The scheme is one of the following schemes: - /// - `[type].[data]` - /// - /// Where: - /// - `[type]`: is a digit number representing the variant. - /// - `[data]`: is the encrypted data. - #[derive(Clone, zeroize::ZeroizeOnDrop)] - #[allow(unused, non_camel_case_types)] - pub enum AsymmetricEncString { - /// 3 - Rsa2048_OaepSha256_B64 { data: Vec }, - /// 4 - Rsa2048_OaepSha1_B64 { data: Vec }, - /// 5 - #[deprecated] - Rsa2048_OaepSha256_HmacSha256_B64 { data: Vec, mac: Vec }, - /// 6 - #[deprecated] - Rsa2048_OaepSha1_HmacSha256_B64 { data: Vec, mac: Vec }, - } -} - -/// To avoid printing sensitive information, [AsymmetricEncString] debug prints to -/// `AsymmetricEncString`. -impl std::fmt::Debug for AsymmetricEncString { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("AsymmetricEncString").finish() - } -} - -/// Deserializes an [AsymmetricEncString] from a string. -impl FromStr for AsymmetricEncString { - type Err = CryptoError; - - fn from_str(s: &str) -> Result { - let (enc_type, parts) = split_enc_string(s); - match (enc_type, parts.len()) { - ("3", 1) => { - let data = from_b64_vec(parts[0])?; - Ok(AsymmetricEncString::Rsa2048_OaepSha256_B64 { data }) - } - ("4", 1) => { - let data = from_b64_vec(parts[0])?; - Ok(AsymmetricEncString::Rsa2048_OaepSha1_B64 { data }) - } - #[allow(deprecated)] - ("5", 2) => { - let data = from_b64_vec(parts[0])?; - let mac: Vec = from_b64_vec(parts[1])?; - Ok(AsymmetricEncString::Rsa2048_OaepSha256_HmacSha256_B64 { data, mac }) - } - #[allow(deprecated)] - ("6", 2) => { - let data = from_b64_vec(parts[0])?; - let mac: Vec = from_b64_vec(parts[1])?; - Ok(AsymmetricEncString::Rsa2048_OaepSha1_HmacSha256_B64 { data, mac }) - } - - (enc_type, parts) => Err(EncStringParseError::InvalidTypeAsymm { - enc_type: enc_type.to_string(), - parts, - } - .into()), - } - } -} - -impl Display for AsymmetricEncString { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let parts: Vec<&[u8]> = match self { - AsymmetricEncString::Rsa2048_OaepSha256_B64 { data } => vec![data], - AsymmetricEncString::Rsa2048_OaepSha1_B64 { data } => vec![data], - #[allow(deprecated)] - AsymmetricEncString::Rsa2048_OaepSha256_HmacSha256_B64 { data, mac } => vec![data, mac], - #[allow(deprecated)] - AsymmetricEncString::Rsa2048_OaepSha1_HmacSha256_B64 { data, mac } => vec![data, mac], - }; - - let encoded_parts: Vec = parts.iter().map(|part| STANDARD.encode(part)).collect(); - - write!(f, "{}.{}", self.enc_type(), encoded_parts.join("|"))?; - - Ok(()) - } -} - -impl<'de> Deserialize<'de> for AsymmetricEncString { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - deserializer.deserialize_str(super::FromStrVisitor::new()) - } -} - -impl serde::Serialize for AsymmetricEncString { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(&self.to_string()) - } -} - -impl AsymmetricEncString { - /// Encrypt and produce a [AsymmetricEncString::Rsa2048_OaepSha1_B64] variant. - pub fn encrypt_rsa2048_oaep_sha1( - data_dec: &[u8], - key: &dyn AsymmetricEncryptable, - ) -> Result { - let enc = encrypt_rsa2048_oaep_sha1(key.to_public_key(), data_dec)?; - Ok(AsymmetricEncString::Rsa2048_OaepSha1_B64 { data: enc }) - } - - /// The numerical representation of the encryption type of the [AsymmetricEncString]. - const fn enc_type(&self) -> u8 { - match self { - AsymmetricEncString::Rsa2048_OaepSha256_B64 { .. } => 3, - AsymmetricEncString::Rsa2048_OaepSha1_B64 { .. } => 4, - #[allow(deprecated)] - AsymmetricEncString::Rsa2048_OaepSha256_HmacSha256_B64 { .. } => 5, - #[allow(deprecated)] - AsymmetricEncString::Rsa2048_OaepSha1_HmacSha256_B64 { .. } => 6, - } - } -} - -impl KeyDecryptable> for AsymmetricEncString { - fn decrypt_with_key(&self, key: &AsymmetricCryptoKey) -> Result> { - use AsymmetricEncString::*; - match self { - Rsa2048_OaepSha256_B64 { data } => key.key.decrypt(Oaep::new::(), data), - Rsa2048_OaepSha1_B64 { data } => key.key.decrypt(Oaep::new::(), data), - #[allow(deprecated)] - Rsa2048_OaepSha256_HmacSha256_B64 { data, .. } => { - key.key.decrypt(Oaep::new::(), data) - } - #[allow(deprecated)] - Rsa2048_OaepSha1_HmacSha256_B64 { data, .. } => { - key.key.decrypt(Oaep::new::(), data) - } - } - .map_err(|_| CryptoError::KeyDecrypt) - } -} - -impl KeyDecryptable for AsymmetricEncString { - fn decrypt_with_key(&self, key: &AsymmetricCryptoKey) -> Result { - let dec: Vec = self.decrypt_with_key(key)?; - String::from_utf8(dec).map_err(|_| CryptoError::InvalidUtf8String) - } -} - -/// Usually we wouldn't want to expose AsymmetricEncStrings in the API or the schemas. -/// But during the transition phase we will expose endpoints using the AsymmetricEncString type. -impl schemars::JsonSchema for AsymmetricEncString { - fn schema_name() -> String { - "AsymmetricEncString".to_string() - } - - fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - gen.subschema_for::() - } -} - -#[cfg(test)] -mod tests { - use schemars::schema_for; - - use super::{AsymmetricCryptoKey, AsymmetricEncString, KeyDecryptable}; - - const RSA_PRIVATE_KEY: &str = "-----BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXRVrCX+2hfOQS -8HzYUS2oc/jGVTZpv+/Ryuoh9d8ihYX9dd0cYh2tl6KWdFc88lPUH11Oxqy20Rk2 -e5r/RF6T9yM0Me3NPnaKt+hlhLtfoc0h86LnhD56A9FDUfuI0dVnPcrwNv0YJIo9 -4LwxtbqBULNvXl6wJ7WAbODrCQy5ZgMVg+iH+gGpwiqsZqHt+KuoHWcN53MSPDfa -F4/YMB99U3TziJMOOJask1TEEnakMPln11PczNDazT17DXIxYrbPfutPdh6sLs6A -QOajdZijfEvepgnOe7cQ7aeatiOJFrjTApKPGxOVRzEMX4XS4xbyhH0QxQeB6l16 -l8C0uxIBAgMBAAECggEASaWfeVDA3cVzOPFSpvJm20OTE+R6uGOU+7vh36TX/POq -92qBuwbd0h0oMD32FxsXywd2IxtBDUSiFM9699qufTVuM0Q3tZw6lHDTOVG08+tP -dr8qSbMtw7PGFxN79fHLBxejjO4IrM9lapjWpxEF+11x7r+wM+0xRZQ8sNFYG46a -PfIaty4BGbL0I2DQ2y8I57iBCAy69eht59NLMm27fRWGJIWCuBIjlpfzET1j2HLX -UIh5bTBNzqaN039WH49HczGE3mQKVEJZc/efk3HaVd0a1Sjzyn0QY+N1jtZN3jTR -buDWA1AknkX1LX/0tUhuS3/7C3ejHxjw4Dk1ZLo5/QKBgQDIWvqFn0+IKRSu6Ua2 -hDsufIHHUNLelbfLUMmFthxabcUn4zlvIscJO00Tq/ezopSRRvbGiqnxjv/mYxuc -vOUBeZtlus0Q9RTACBtw9TGoNTmQbEunJ2FOSlqbQxkBBAjgGEppRPt30iGj/VjA -hCATq2MYOa/X4dVR51BqQAFIEwKBgQDBSIfTFKC/hDk6FKZlgwvupWYJyU9Rkyfs -tPErZFmzoKhPkQ3YORo2oeAYmVUbS9I2iIYpYpYQJHX8jMuCbCz4ONxTCuSIXYQY -UcUq4PglCKp31xBAE6TN8SvhfME9/MvuDssnQinAHuF0GDAhF646T3LLS1not6Vs -zv7brwSoGwKBgQC88v/8cGfi80ssQZeMnVvq1UTXIeQcQnoY5lGHJl3K8mbS3TnX -E6c9j417Fdz+rj8KWzBzwWXQB5pSPflWcdZO886Xu/mVGmy9RWgLuVFhXwCwsVEP -jNX5ramRb0/vY0yzenUCninBsIxFSbIfrPtLUYCc4hpxr+sr2Mg/y6jpvQKBgBez -MRRs3xkcuXepuI2R+BCXL1/b02IJTUf1F+1eLLGd7YV0H+J3fgNc7gGWK51hOrF9 -JBZHBGeOUPlaukmPwiPdtQZpu4QNE3l37VlIpKTF30E6mb+BqR+nht3rUjarnMXg -AoEZ18y6/KIjpSMpqC92Nnk/EBM9EYe6Cf4eA9ApAoGAeqEUg46UTlJySkBKURGp -Is3v1kkf5I0X8DnOhwb+HPxNaiEdmO7ckm8+tPVgppLcG0+tMdLjigFQiDUQk2y3 -WjyxP5ZvXu7U96jaJRI8PFMoE06WeVYcdIzrID2HvqH+w0UQJFrLJ/0Mn4stFAEz -XKZBokBGnjFnTnKcs7nv/O8= ------END PRIVATE KEY-----"; - - #[test] - fn test_enc_string_rsa2048_oaep_sha256_b64() { - let private_key = AsymmetricCryptoKey::from_pem(RSA_PRIVATE_KEY).unwrap(); - let enc_str: &str = "3.YFqzW9LL/uLjCnl0RRLtndzGJ1FV27mcwQwGjfJPOVrgCX9nJSUYCCDd0iTIyOZ/zRxG47b6L1Z3qgkEfcxjmrSBq60gijc3E2TBMAg7OCLVcjORZ+i1sOVOudmOPWro6uA8refMrg4lqbieDlbLMzjVEwxfi5WpcL876cD0vYyRwvLO3bzFrsE7x33HHHtZeOPW79RqMn5efsB5Dj9wVheC9Ix9AYDjbo+rjg9qR6guwKmS7k2MSaIQlrDR7yu8LP+ePtiSjx+gszJV5jQGfcx60dtiLQzLS/mUD+RmU7B950Bpx0H7x56lT5yXZbWK5YkoP6qd8B8D2aKbP68Ywg=="; - let enc_string: AsymmetricEncString = enc_str.parse().unwrap(); - - assert_eq!(enc_string.enc_type(), 3); - - let res: String = enc_string.decrypt_with_key(&private_key).unwrap(); - assert_eq!(res, "EncryptMe!"); - } - - #[test] - fn test_enc_string_rsa2048_oaep_sha1_b64() { - let private_key = AsymmetricCryptoKey::from_pem(RSA_PRIVATE_KEY).unwrap(); - let enc_str: &str = "4.ZheRb3PCfAunyFdQYPfyrFqpuvmln9H9w5nDjt88i5A7ug1XE0LJdQHCIYJl0YOZ1gCOGkhFu/CRY2StiLmT3iRKrrVBbC1+qRMjNNyDvRcFi91LWsmRXhONVSPjywzrJJXglsztDqGkLO93dKXNhuKpcmtBLsvgkphk/aFvxbaOvJ/FHdK/iV0dMGNhc/9tbys8laTdwBlI5xIChpRcrfH+XpSFM88+Bu03uK67N9G6eU1UmET+pISJwJvMuIDMqH+qkT7OOzgL3t6I0H2LDj+CnsumnQmDsvQzDiNfTR0IgjpoE9YH2LvPXVP2wVUkiTwXD9cG/E7XeoiduHyHjw=="; - let enc_string: AsymmetricEncString = enc_str.parse().unwrap(); - - assert_eq!(enc_string.enc_type(), 4); - - let res: String = enc_string.decrypt_with_key(&private_key).unwrap(); - assert_eq!(res, "EncryptMe!"); - } - - #[test] - fn test_enc_string_rsa2048_oaep_sha1_hmac_sha256_b64() { - let private_key = AsymmetricCryptoKey::from_pem(RSA_PRIVATE_KEY).unwrap(); - let enc_str: &str = "6.ThnNc67nNr7GELyuhGGfsXNP2zJnNqhrIsjntEQ27r2qmn8vwdHbTbfO0cwt6YgSibDN0PjiCZ1O3Wb/IFq+vwvyRwFqF9145wBF8CQCbkhV+M0XvO99kh0daovtt120Nve/5ETI5PbPag9VdalKRQWZypJaqQHm5TAQVf4F5wtLlCLMBkzqTk+wkFe7BPMTGn07T+O3eJbTxXvyMZewQ7icJF0MZVA7VyWX9qElmZ89FCKowbf1BMr5pbcQ+0KdXcSVW3to43VkTp7k7COwsuH3M/i1AuVP5YN8ixjyRpvaeGqX/ap2nCHK2Wj5VxgCGT7XEls6ZknnAp9nB9qVjQ==|s3ntw5H/KKD/qsS0lUghTHl5Sm9j6m7YEdNHf0OeAFQ="; - let enc_string: AsymmetricEncString = enc_str.parse().unwrap(); - - assert_eq!(enc_string.enc_type(), 6); - - let res: String = enc_string.decrypt_with_key(&private_key).unwrap(); - assert_eq!(res, "EncryptMe!"); - } - - #[test] - fn test_enc_string_serialization() { - #[derive(serde::Serialize, serde::Deserialize)] - struct Test { - key: AsymmetricEncString, - } - - let cipher = "6.ThnNc67nNr7GELyuhGGfsXNP2zJnNqhrIsjntEQ27r2qmn8vwdHbTbfO0cwt6YgSibDN0PjiCZ1O3Wb/IFq+vwvyRwFqF9145wBF8CQCbkhV+M0XvO99kh0daovtt120Nve/5ETI5PbPag9VdalKRQWZypJaqQHm5TAQVf4F5wtLlCLMBkzqTk+wkFe7BPMTGn07T+O3eJbTxXvyMZewQ7icJF0MZVA7VyWX9qElmZ89FCKowbf1BMr5pbcQ+0KdXcSVW3to43VkTp7k7COwsuH3M/i1AuVP5YN8ixjyRpvaeGqX/ap2nCHK2Wj5VxgCGT7XEls6ZknnAp9nB9qVjQ==|s3ntw5H/KKD/qsS0lUghTHl5Sm9j6m7YEdNHf0OeAFQ="; - let serialized = format!("{{\"key\":\"{cipher}\"}}"); - - let t = serde_json::from_str::(&serialized).unwrap(); - assert_eq!(t.key.enc_type(), 6); - assert_eq!(t.key.to_string(), cipher); - assert_eq!(serde_json::to_string(&t).unwrap(), serialized); - } - - #[test] - fn test_from_str_invalid() { - let enc_str = "7.ABC"; - let enc_string: Result = enc_str.parse(); - - let err = enc_string.unwrap_err(); - assert_eq!( - err.to_string(), - "EncString error, Invalid asymmetric type, got type 7 with 1 parts" - ); - } - - #[test] - fn test_debug_format() { - let enc_str: &str = "4.ZheRb3PCfAunyFdQYPfyrFqpuvmln9H9w5nDjt88i5A7ug1XE0LJdQHCIYJl0YOZ1gCOGkhFu/CRY2StiLmT3iRKrrVBbC1+qRMjNNyDvRcFi91LWsmRXhONVSPjywzrJJXglsztDqGkLO93dKXNhuKpcmtBLsvgkphk/aFvxbaOvJ/FHdK/iV0dMGNhc/9tbys8laTdwBlI5xIChpRcrfH+XpSFM88+Bu03uK67N9G6eU1UmET+pISJwJvMuIDMqH+qkT7OOzgL3t6I0H2LDj+CnsumnQmDsvQzDiNfTR0IgjpoE9YH2LvPXVP2wVUkiTwXD9cG/E7XeoiduHyHjw=="; - let enc_string: AsymmetricEncString = enc_str.parse().unwrap(); - - let debug_string = format!("{:?}", enc_string); - assert_eq!(debug_string, "AsymmetricEncString"); - } - - #[test] - fn test_json_schema() { - let schema = schema_for!(AsymmetricEncString); - - assert_eq!( - serde_json::to_string(&schema).unwrap(), - r#"{"$schema":"http://json-schema.org/draft-07/schema#","title":"AsymmetricEncString","type":"string"}"# - ); - } -} diff --git a/crates/bitwarden-crypto/src/enc_string/mod.rs b/crates/bitwarden-crypto/src/enc_string/mod.rs deleted file mode 100644 index 3278b8064..000000000 --- a/crates/bitwarden-crypto/src/enc_string/mod.rs +++ /dev/null @@ -1,137 +0,0 @@ -//! Encrypted string types -//! -//! [EncString] and [AsymmetricEncString] are Bitwarden specific primitive that represents a -//! encrypted string. They are are used together with the [KeyDecryptable][crate::KeyDecryptable] -//! and [KeyEncryptable][crate::KeyEncryptable] traits to encrypt and decrypt data using -//! [SymmetricCryptoKey][crate::SymmetricCryptoKey] and -//! [AsymmetricCryptoKey][crate::AsymmetricCryptoKey]s. - -mod asymmetric; -mod symmetric; - -use std::str::FromStr; - -pub use asymmetric::AsymmetricEncString; -use base64::{engine::general_purpose::STANDARD, Engine}; -pub use symmetric::EncString; - -use crate::error::{EncStringParseError, Result}; - -fn check_length(buf: &[u8], expected: usize) -> Result<()> { - if buf.len() < expected { - return Err(EncStringParseError::InvalidLength { - expected, - got: buf.len(), - } - .into()); - } - Ok(()) -} - -fn from_b64_vec(s: &str) -> Result> { - Ok(STANDARD - .decode(s) - .map_err(EncStringParseError::InvalidBase64)?) -} - -fn from_b64(s: &str) -> Result<[u8; N]> { - Ok(from_b64_vec(s)? - .try_into() - .map_err(|e: Vec<_>| EncStringParseError::InvalidLength { - expected: N, - got: e.len(), - })?) -} - -fn split_enc_string(s: &str) -> (&str, Vec<&str>) { - let header_parts: Vec<_> = s.split('.').collect(); - - if header_parts.len() == 2 { - (header_parts[0], header_parts[1].split('|').collect()) - } else { - // Support legacy format with no header - let parts: Vec<_> = s.split('|').collect(); - if parts.len() == 3 { - ("1", parts) // AesCbc128_HmacSha256_B64 - } else { - ("0", parts) // AesCbc256_B64 - } - } -} - -struct FromStrVisitor(std::marker::PhantomData); -impl FromStrVisitor { - fn new() -> Self { - Self(Default::default()) - } -} -impl serde::de::Visitor<'_> for FromStrVisitor -where - T::Err: std::fmt::Debug, -{ - type Value = T; - - fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "a valid string") - } - - fn visit_str(self, v: &str) -> Result - where - E: serde::de::Error, - { - T::from_str(v).map_err(|e| E::custom(format!("{:?}", e))) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_check_length_less_than_expected() { - let buf = [1, 2, 3]; - let expected = 5; - let result = check_length(&buf, expected); - assert!(result.is_err()); - } - - #[test] - fn test_check_length_equal_to_expected() { - let buf = [1, 2, 3, 4, 5]; - let expected = 5; - let result = check_length(&buf, expected); - assert!(result.is_ok()); - } - - #[test] - fn test_check_length_greater_than_expected() { - let buf = [1, 2, 3, 4, 5, 6]; - let expected = 5; - let result = check_length(&buf, expected); - assert!(result.is_ok()); - } - - #[test] - fn test_split_enc_string_new_format() { - let s = "2.abc|def|ghi"; - let (header, parts) = split_enc_string(s); - assert_eq!(header, "2"); - assert_eq!(parts, vec!["abc", "def", "ghi"]); - } - - #[test] - fn test_split_enc_string_old_format_three_parts() { - let s = "abc|def|ghi"; - let (header, parts) = split_enc_string(s); - assert_eq!(header, "1"); - assert_eq!(parts, vec!["abc", "def", "ghi"]); - } - - #[test] - fn test_split_enc_string_old_format_fewer_parts() { - let s = "abc|def"; - let (header, parts) = split_enc_string(s); - assert_eq!(header, "0"); - assert_eq!(parts, vec!["abc", "def"]); - } -} diff --git a/crates/bitwarden-crypto/src/enc_string/symmetric.rs b/crates/bitwarden-crypto/src/enc_string/symmetric.rs deleted file mode 100644 index 69711f74a..000000000 --- a/crates/bitwarden-crypto/src/enc_string/symmetric.rs +++ /dev/null @@ -1,494 +0,0 @@ -use std::{fmt::Display, str::FromStr}; - -use aes::cipher::typenum::U32; -use base64::{engine::general_purpose::STANDARD, Engine}; -use generic_array::GenericArray; -use serde::Deserialize; - -use super::{check_length, from_b64, from_b64_vec, split_enc_string}; -use crate::{ - error::{CryptoError, EncStringParseError, Result}, - KeyDecryptable, KeyEncryptable, LocateKey, SymmetricCryptoKey, -}; - -#[cfg(feature = "wasm")] -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_CUSTOM_TYPES: &'static str = r#" -export type EncString = string; -"#; - -/// # Encrypted string primitive -/// -/// [EncString] is a Bitwarden specific primitive that represents a symmetrically encrypted string. -/// They are are used together with the [KeyDecryptable] and [KeyEncryptable] traits to encrypt and -/// decrypt data using [SymmetricCryptoKey]s. -/// -/// The flexibility of the [EncString] type allows for different encryption algorithms to be used -/// which is represented by the different variants of the enum. -/// -/// ## Note -/// -/// For backwards compatibility we will rarely if ever be able to remove support for decrypting old -/// variants, but we should be opinionated in which variants are used for encrypting. -/// -/// ## Variants -/// - [AesCbc256_B64](EncString::AesCbc256_B64) -/// - [AesCbc128_HmacSha256_B64](EncString::AesCbc128_HmacSha256_B64) -/// - [AesCbc256_HmacSha256_B64](EncString::AesCbc256_HmacSha256_B64) -/// -/// ## Serialization -/// -/// [EncString] implements [Display] and [FromStr] to allow for easy serialization and uses a -/// custom scheme to represent the different variants. -/// -/// The scheme is one of the following schemes: -/// - `[type].[iv]|[data]` -/// - `[type].[iv]|[data]|[mac]` -/// -/// Where: -/// - `[type]`: is a digit number representing the variant. -/// - `[iv]`: (optional) is the initialization vector used for encryption. -/// - `[data]`: is the encrypted data. -/// - `[mac]`: (optional) is the MAC used to validate the integrity of the data. -#[derive(Clone, zeroize::ZeroizeOnDrop, PartialEq)] -#[allow(unused, non_camel_case_types)] -pub enum EncString { - /// 0 - AesCbc256_B64 { iv: [u8; 16], data: Vec }, - /// 1 - AesCbc128_HmacSha256_B64 { - iv: [u8; 16], - mac: [u8; 32], - data: Vec, - }, - /// 2 - AesCbc256_HmacSha256_B64 { - iv: [u8; 16], - mac: [u8; 32], - data: Vec, - }, -} - -/// To avoid printing sensitive information, [EncString] debug prints to `EncString`. -impl std::fmt::Debug for EncString { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("EncString").finish() - } -} - -/// Deserializes an [EncString] from a string. -impl FromStr for EncString { - type Err = CryptoError; - - fn from_str(s: &str) -> Result { - let (enc_type, parts) = split_enc_string(s); - match (enc_type, parts.len()) { - ("0", 2) => { - let iv = from_b64(parts[0])?; - let data = from_b64_vec(parts[1])?; - - Ok(EncString::AesCbc256_B64 { iv, data }) - } - ("1" | "2", 3) => { - let iv = from_b64(parts[0])?; - let data = from_b64_vec(parts[1])?; - let mac = from_b64(parts[2])?; - - if enc_type == "1" { - Ok(EncString::AesCbc128_HmacSha256_B64 { iv, mac, data }) - } else { - Ok(EncString::AesCbc256_HmacSha256_B64 { iv, mac, data }) - } - } - - (enc_type, parts) => Err(EncStringParseError::InvalidTypeSymm { - enc_type: enc_type.to_string(), - parts, - } - .into()), - } - } -} - -impl EncString { - /// Synthetic sugar for mapping `Option` to `Result>` - pub fn try_from_optional(s: Option) -> Result, CryptoError> { - s.map(|s| s.parse()).transpose() - } - - pub fn from_buffer(buf: &[u8]) -> Result { - if buf.is_empty() { - return Err(EncStringParseError::NoType.into()); - } - let enc_type = buf[0]; - - match enc_type { - 0 => { - check_length(buf, 18)?; - let iv = buf[1..17].try_into().expect("Valid length"); - let data = buf[17..].to_vec(); - - Ok(EncString::AesCbc256_B64 { iv, data }) - } - 1 | 2 => { - check_length(buf, 50)?; - let iv = buf[1..17].try_into().expect("Valid length"); - let mac = buf[17..49].try_into().expect("Valid length"); - let data = buf[49..].to_vec(); - - if enc_type == 1 { - Ok(EncString::AesCbc128_HmacSha256_B64 { iv, mac, data }) - } else { - Ok(EncString::AesCbc256_HmacSha256_B64 { iv, mac, data }) - } - } - _ => Err(EncStringParseError::InvalidTypeSymm { - enc_type: enc_type.to_string(), - parts: 1, - } - .into()), - } - } - - pub fn to_buffer(&self) -> Result> { - let mut buf; - - match self { - EncString::AesCbc256_B64 { iv, data } => { - buf = Vec::with_capacity(1 + 16 + data.len()); - buf.push(self.enc_type()); - buf.extend_from_slice(iv); - buf.extend_from_slice(data); - } - EncString::AesCbc128_HmacSha256_B64 { iv, mac, data } - | EncString::AesCbc256_HmacSha256_B64 { iv, mac, data } => { - buf = Vec::with_capacity(1 + 16 + 32 + data.len()); - buf.push(self.enc_type()); - buf.extend_from_slice(iv); - buf.extend_from_slice(mac); - buf.extend_from_slice(data); - } - } - - Ok(buf) - } -} - -impl Display for EncString { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let parts: Vec<&[u8]> = match self { - EncString::AesCbc256_B64 { iv, data } => vec![iv, data], - EncString::AesCbc128_HmacSha256_B64 { iv, mac, data } => vec![iv, data, mac], - EncString::AesCbc256_HmacSha256_B64 { iv, mac, data } => vec![iv, data, mac], - }; - - let encoded_parts: Vec = parts.iter().map(|part| STANDARD.encode(part)).collect(); - - write!(f, "{}.{}", self.enc_type(), encoded_parts.join("|"))?; - - Ok(()) - } -} - -impl<'de> Deserialize<'de> for EncString { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - deserializer.deserialize_str(super::FromStrVisitor::new()) - } -} - -impl serde::Serialize for EncString { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(&self.to_string()) - } -} - -impl EncString { - pub(crate) fn encrypt_aes256_hmac( - data_dec: &[u8], - mac_key: &GenericArray, - key: &GenericArray, - ) -> Result { - let (iv, mac, data) = crate::aes::encrypt_aes256_hmac(data_dec, mac_key, key)?; - Ok(EncString::AesCbc256_HmacSha256_B64 { iv, mac, data }) - } - - /// The numerical representation of the encryption type of the [EncString]. - const fn enc_type(&self) -> u8 { - match self { - EncString::AesCbc256_B64 { .. } => 0, - EncString::AesCbc128_HmacSha256_B64 { .. } => 1, - EncString::AesCbc256_HmacSha256_B64 { .. } => 2, - } - } -} - -impl LocateKey for EncString {} -impl KeyEncryptable for &[u8] { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - EncString::encrypt_aes256_hmac( - self, - key.mac_key.as_ref().ok_or(CryptoError::InvalidMac)?, - &key.key, - ) - } -} - -impl KeyDecryptable> for EncString { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result> { - match self { - EncString::AesCbc256_B64 { iv, data } => { - if key.mac_key.is_some() { - return Err(CryptoError::MacNotProvided); - } - - let dec = crate::aes::decrypt_aes256(iv, data.clone(), &key.key)?; - Ok(dec) - } - EncString::AesCbc128_HmacSha256_B64 { iv, mac, data } => { - // TODO: SymmetricCryptoKey is designed to handle 32 byte keys only, but this - // variant uses a 16 byte key This means the key+mac are going to be - // parsed as a single 32 byte key, at the moment we split it manually - // When refactoring the key handling, this should be fixed. - let enc_key = key.key[0..16].into(); - let mac_key = key.key[16..32].into(); - let dec = crate::aes::decrypt_aes128_hmac(iv, mac, data.clone(), mac_key, enc_key)?; - Ok(dec) - } - EncString::AesCbc256_HmacSha256_B64 { iv, mac, data } => { - let mac_key = key.mac_key.as_ref().ok_or(CryptoError::InvalidMac)?; - let dec = - crate::aes::decrypt_aes256_hmac(iv, mac, data.clone(), mac_key, &key.key)?; - Ok(dec) - } - } - } -} - -impl KeyEncryptable for String { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - self.as_bytes().encrypt_with_key(key) - } -} - -impl KeyEncryptable for &str { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - self.as_bytes().encrypt_with_key(key) - } -} - -impl KeyDecryptable for EncString { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - let dec: Vec = self.decrypt_with_key(key)?; - String::from_utf8(dec).map_err(|_| CryptoError::InvalidUtf8String) - } -} - -/// Usually we wouldn't want to expose EncStrings in the API or the schemas. -/// But during the transition phase we will expose endpoints using the EncString type. -impl schemars::JsonSchema for EncString { - fn schema_name() -> String { - "EncString".to_string() - } - - fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - gen.subschema_for::() - } -} - -#[cfg(test)] -mod tests { - use schemars::schema_for; - - use super::EncString; - use crate::{ - derive_symmetric_key, CryptoError, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, - }; - - #[test] - fn test_enc_string_roundtrip() { - let key = derive_symmetric_key("test"); - - let test_string = "encrypted_test_string"; - let cipher = test_string.to_owned().encrypt_with_key(&key).unwrap(); - - let decrypted_str: String = cipher.decrypt_with_key(&key).unwrap(); - assert_eq!(decrypted_str, test_string); - } - - #[test] - fn test_enc_string_ref_roundtrip() { - let key = derive_symmetric_key("test"); - - let test_string = "encrypted_test_string"; - let cipher = test_string.encrypt_with_key(&key).unwrap(); - - let decrypted_str: String = cipher.decrypt_with_key(&key).unwrap(); - assert_eq!(decrypted_str, test_string); - } - - #[test] - fn test_enc_string_serialization() { - #[derive(serde::Serialize, serde::Deserialize)] - struct Test { - key: EncString, - } - - let cipher = "2.pMS6/icTQABtulw52pq2lg==|XXbxKxDTh+mWiN1HjH2N1w==|Q6PkuT+KX/axrgN9ubD5Ajk2YNwxQkgs3WJM0S0wtG8="; - let serialized = format!("{{\"key\":\"{cipher}\"}}"); - - let t = serde_json::from_str::(&serialized).unwrap(); - assert_eq!(t.key.enc_type(), 2); - assert_eq!(t.key.to_string(), cipher); - assert_eq!(serde_json::to_string(&t).unwrap(), serialized); - } - - #[test] - fn test_enc_from_to_buffer() { - let enc_str: &str = "2.pMS6/icTQABtulw52pq2lg==|XXbxKxDTh+mWiN1HjH2N1w==|Q6PkuT+KX/axrgN9ubD5Ajk2YNwxQkgs3WJM0S0wtG8="; - let enc_string: EncString = enc_str.parse().unwrap(); - - let enc_buf = enc_string.to_buffer().unwrap(); - - assert_eq!( - enc_buf, - vec![ - 2, 164, 196, 186, 254, 39, 19, 64, 0, 109, 186, 92, 57, 218, 154, 182, 150, 67, - 163, 228, 185, 63, 138, 95, 246, 177, 174, 3, 125, 185, 176, 249, 2, 57, 54, 96, - 220, 49, 66, 72, 44, 221, 98, 76, 209, 45, 48, 180, 111, 93, 118, 241, 43, 16, 211, - 135, 233, 150, 136, 221, 71, 140, 125, 141, 215 - ] - ); - - let enc_string_new = EncString::from_buffer(&enc_buf).unwrap(); - - assert_eq!(enc_string_new.to_string(), enc_str) - } - - #[test] - fn test_from_str_cbc256() { - let enc_str = "0.pMS6/icTQABtulw52pq2lg==|XXbxKxDTh+mWiN1HjH2N1w=="; - let enc_string: EncString = enc_str.parse().unwrap(); - - assert_eq!(enc_string.enc_type(), 0); - if let EncString::AesCbc256_B64 { iv, data } = &enc_string { - assert_eq!( - iv, - &[164, 196, 186, 254, 39, 19, 64, 0, 109, 186, 92, 57, 218, 154, 182, 150] - ); - assert_eq!( - data, - &[93, 118, 241, 43, 16, 211, 135, 233, 150, 136, 221, 71, 140, 125, 141, 215] - ); - } else { - panic!("Invalid variant") - }; - } - - #[test] - fn test_from_str_cbc128_hmac() { - let enc_str = "1.Hh8gISIjJCUmJygpKissLQ==|MjM0NTY3ODk6Ozw9Pj9AQUJDREU=|KCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkc="; - let enc_string: EncString = enc_str.parse().unwrap(); - - assert_eq!(enc_string.enc_type(), 1); - if let EncString::AesCbc128_HmacSha256_B64 { iv, mac, data } = &enc_string { - assert_eq!( - iv, - &[30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45] - ); - assert_eq!( - mac, - &[ - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71 - ] - ); - assert_eq!( - data, - &[50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69] - ); - } else { - panic!("Invalid variant") - }; - } - - #[test] - fn test_decrypt_cbc256() { - let key = "hvBMMb1t79YssFZkpetYsM3deyVuQv4r88Uj9gvYe08=".to_string(); - let key = SymmetricCryptoKey::try_from(key).unwrap(); - - let enc_str = "0.NQfjHLr6za7VQVAbrpL81w==|wfrjmyJ0bfwkQlySrhw8dA=="; - let enc_string: EncString = enc_str.parse().unwrap(); - assert_eq!(enc_string.enc_type(), 0); - - let dec_str: String = enc_string.decrypt_with_key(&key).unwrap(); - assert_eq!(dec_str, "EncryptMe!"); - } - - #[test] - fn test_decrypt_downgrade_encstring_prevention() { - // Simulate a potential downgrade attack by removing the mac portion of the `EncString` and - // attempt to decrypt it using a `SymmetricCryptoKey` with a mac key. - let key = "hvBMMb1t79YssFZkpetYsM3deyVuQv4r88Uj9gvYe0+G8EwxvW3v1iywVmSl61iwzd17JW5C/ivzxSP2C9h7Tw==".to_string(); - let key = SymmetricCryptoKey::try_from(key).unwrap(); - - // A "downgraded" `EncString` from `EncString::AesCbc256_HmacSha256_B64` (2) to - // `EncString::AesCbc256_B64` (0), with the mac portion removed. - // - let enc_str = "0.NQfjHLr6za7VQVAbrpL81w==|wfrjmyJ0bfwkQlySrhw8dA=="; - let enc_string: EncString = enc_str.parse().unwrap(); - assert_eq!(enc_string.enc_type(), 0); - - let result: Result = enc_string.decrypt_with_key(&key); - assert!(matches!(result, Err(CryptoError::MacNotProvided))); - } - - #[test] - fn test_decrypt_cbc128_hmac() { - let key = "Gt1aZ8kTTgkF80bLtb7LiMZBcxEA2FA5mbvV4x7K208=".to_string(); - let key = SymmetricCryptoKey::try_from(key).unwrap(); - - let enc_str = "1.CU/oG4VZuxbHoZSDZjCLQw==|kb1HGwAk+fQ275ORfLf5Ew==|8UaEYHyqRZcG37JWhYBOBdEatEXd1u1/wN7OuImolcM="; - let enc_string: EncString = enc_str.parse().unwrap(); - assert_eq!(enc_string.enc_type(), 1); - - let dec_str: String = enc_string.decrypt_with_key(&key).unwrap(); - assert_eq!(dec_str, "EncryptMe!"); - } - - #[test] - fn test_from_str_invalid() { - let enc_str = "7.ABC"; - let enc_string: Result = enc_str.parse(); - - let err = enc_string.unwrap_err(); - assert_eq!( - err.to_string(), - "EncString error, Invalid symmetric type, got type 7 with 1 parts" - ); - } - - #[test] - fn test_debug_format() { - let enc_str = "2.pMS6/icTQABtulw52pq2lg==|XXbxKxDTh+mWiN1HjH2N1w==|Q6PkuT+KX/axrgN9ubD5Ajk2YNwxQkgs3WJM0S0wtG8="; - let enc_string: EncString = enc_str.parse().unwrap(); - - let debug_string = format!("{:?}", enc_string); - assert_eq!(debug_string, "EncString"); - } - - #[test] - fn test_json_schema() { - let schema = schema_for!(EncString); - - assert_eq!( - serde_json::to_string(&schema).unwrap(), - r#"{"$schema":"http://json-schema.org/draft-07/schema#","title":"EncString","type":"string"}"# - ); - } -} diff --git a/crates/bitwarden-crypto/src/error.rs b/crates/bitwarden-crypto/src/error.rs deleted file mode 100644 index 2f9a58b8b..000000000 --- a/crates/bitwarden-crypto/src/error.rs +++ /dev/null @@ -1,71 +0,0 @@ -use std::fmt::Debug; - -use thiserror::Error; -use uuid::Uuid; - -use crate::fingerprint::FingerprintError; - -#[derive(Debug, Error)] -pub enum CryptoError { - #[error("The provided key is not the expected type")] - InvalidKey, - #[error("The cipher's MAC doesn't match the expected value")] - InvalidMac, - #[error("The key provided expects mac protected encstrings, but the mac is missing")] - MacNotProvided, - #[error("Error while decrypting EncString")] - KeyDecrypt, - #[error("The cipher key has an invalid length")] - InvalidKeyLen, - #[error("The value is not a valid UTF8 String")] - InvalidUtf8String, - #[error("Missing Key for organization with ID {0}")] - MissingKey(Uuid), - #[error("The item was missing a required field: {0}")] - MissingField(&'static str), - - #[error("Insufficient KDF parameters")] - InsufficientKdfParameters, - - #[error("EncString error, {0}")] - EncString(#[from] EncStringParseError), - - #[error("Rsa error, {0}")] - RsaError(#[from] RsaError), - - #[error("Fingerprint error, {0}")] - FingerprintError(#[from] FingerprintError), - - #[error("Argon2 error, {0}")] - ArgonError(#[from] argon2::Error), - - #[error("Number is zero")] - ZeroNumber, -} - -#[derive(Debug, Error)] -pub enum EncStringParseError { - #[error("No type detected, missing '.' separator")] - NoType, - #[error("Invalid symmetric type, got type {enc_type} with {parts} parts")] - InvalidTypeSymm { enc_type: String, parts: usize }, - #[error("Invalid asymmetric type, got type {enc_type} with {parts} parts")] - InvalidTypeAsymm { enc_type: String, parts: usize }, - #[error("Error decoding base64: {0}")] - InvalidBase64(#[from] base64::DecodeError), - #[error("Invalid length: expected {expected}, got {got}")] - InvalidLength { expected: usize, got: usize }, -} - -#[derive(Debug, Error)] -pub enum RsaError { - #[error("Unable to create public key")] - CreatePublicKey, - #[error("Unable to create private key")] - CreatePrivateKey, - #[error("Rsa error, {0}")] - Rsa(#[from] rsa::Error), -} - -/// Alias for `Result`. -pub(crate) type Result = std::result::Result; diff --git a/crates/bitwarden-crypto/src/fingerprint.rs b/crates/bitwarden-crypto/src/fingerprint.rs deleted file mode 100644 index 2e7200344..000000000 --- a/crates/bitwarden-crypto/src/fingerprint.rs +++ /dev/null @@ -1,95 +0,0 @@ -//! # Fingerprint -//! -//! Provides a way to derive fingerprints from fingerprint material and public keys. This is most -//! commonly used for account fingerprints, where the fingerprint material is the user's id and the -//! public key is the user's public key. - -use num_bigint::BigUint; -use num_traits::cast::ToPrimitive; -use thiserror::Error; - -use crate::{error::Result, wordlist::EFF_LONG_WORD_LIST, CryptoError}; - -/// Computes a fingerprint of the given `fingerprint_material` using the given `public_key`. -/// -/// This is commonly used for account fingerprints. With the following arguments: -/// - `fingerprint_material`: user's id. -/// - `public_key`: user's public key. -pub fn fingerprint(fingerprint_material: &str, public_key: &[u8]) -> Result { - let hkdf = - hkdf::Hkdf::::from_prk(public_key).map_err(|_| CryptoError::InvalidKeyLen)?; - - let mut user_fingerprint = [0u8; 32]; - hkdf.expand(fingerprint_material.as_bytes(), &mut user_fingerprint) - .map_err(|_| CryptoError::InvalidKeyLen)?; - - hash_word(user_fingerprint) -} - -/// Derive a 5 word phrase from a 32 byte hash. -fn hash_word(hash: [u8; 32]) -> Result { - let minimum_entropy = 64; - - let entropy_per_word = (EFF_LONG_WORD_LIST.len() as f64).log2(); - let num_words = ((minimum_entropy as f64 / entropy_per_word).ceil()).to_owned() as i64; - - let hash_arr: Vec = hash.to_vec(); - let entropy_available = hash_arr.len() * 4; - if num_words as f64 * entropy_per_word > entropy_available as f64 { - return Err(FingerprintError::EntropyTooSmall.into()); - } - - let mut phrase = Vec::new(); - - let mut hash_number = BigUint::from_bytes_be(&hash_arr); - for _ in 0..num_words { - let remainder = hash_number.clone() % EFF_LONG_WORD_LIST.len(); - hash_number /= EFF_LONG_WORD_LIST.len(); - - let index = remainder - .to_usize() - .expect("Remainder is less than EFF_LONG_WORD_LIST.len()"); - phrase.push(EFF_LONG_WORD_LIST[index].to_string()); - } - - Ok(phrase.join("-")) -} - -#[derive(Debug, Error)] -pub enum FingerprintError { - #[error("Entropy is too small")] - EntropyTooSmall, -} - -#[cfg(test)] -mod tests { - use super::fingerprint; - - #[test] - fn test_fingerprint() { - let user_id = "a09726a0-9590-49d1-a5f5-afe300b6a515"; - let key: &[u8] = &[ - 48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, - 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 187, 38, 44, 241, 110, 205, 89, 253, 25, 191, 126, - 84, 121, 202, 61, 223, 189, 244, 118, 212, 74, 139, 130, 97, 115, 164, 167, 106, 191, - 188, 233, 218, 196, 250, 187, 146, 125, 160, 150, 49, 198, 224, 176, 10, 0, 143, 99, - 230, 232, 160, 51, 104, 154, 211, 33, 80, 170, 4, 68, 80, 219, 115, 167, 114, 156, 227, - 125, 193, 128, 123, 39, 254, 191, 124, 63, 129, 44, 63, 18, 56, 161, 48, 158, 0, 27, - 146, 2, 99, 136, 75, 21, 135, 6, 118, 12, 26, 251, 184, 172, 249, 53, 78, 210, 46, 143, - 17, 104, 202, 65, 173, 229, 219, 233, 144, 163, 101, 216, 238, 152, 54, 158, 1, 195, - 50, 203, 21, 226, 12, 82, 170, 175, 170, 160, 21, 247, 248, 80, 97, 123, 0, 152, 116, - 229, 126, 221, 199, 155, 194, 192, 51, 207, 177, 240, 160, 84, 241, 41, 88, 176, 53, - 111, 28, 173, 177, 232, 158, 22, 79, 133, 152, 31, 32, 12, 196, 147, 58, 57, 50, 252, - 208, 131, 150, 179, 132, 178, 150, 234, 251, 143, 125, 163, 144, 20, 46, 71, 168, 252, - 164, 86, 120, 124, 56, 252, 206, 210, 236, 212, 139, 127, 189, 236, 40, 46, 2, 238, 13, - 216, 40, 48, 85, 133, 229, 181, 155, 176, 217, 241, 154, 153, 213, 112, 222, 72, 219, - 197, 3, 219, 56, 77, 109, 47, 72, 251, 131, 36, 240, 96, 169, 31, 82, 93, 166, 242, 3, - 33, 213, 2, 3, 1, 0, 1, - ]; - - assert_eq!( - "turban-deftly-anime-chatroom-unselfish", - fingerprint(user_id, key).unwrap() - ); - } -} diff --git a/crates/bitwarden-crypto/src/keys/asymmetric_crypto_key.rs b/crates/bitwarden-crypto/src/keys/asymmetric_crypto_key.rs deleted file mode 100644 index a00a1f842..000000000 --- a/crates/bitwarden-crypto/src/keys/asymmetric_crypto_key.rs +++ /dev/null @@ -1,226 +0,0 @@ -use std::pin::Pin; - -use rsa::{pkcs8::DecodePublicKey, RsaPrivateKey, RsaPublicKey}; - -use super::key_encryptable::CryptoKey; -use crate::error::{CryptoError, Result}; - -/// Trait to allow both [`AsymmetricCryptoKey`] and [`AsymmetricPublicCryptoKey`] to be used to -/// encrypt [AsymmetricEncString](crate::AsymmetricEncString). -pub trait AsymmetricEncryptable { - fn to_public_key(&self) -> &RsaPublicKey; -} - -/// An asymmetric public encryption key. Can only encrypt -/// [AsymmetricEncString](crate::AsymmetricEncString), usually accompanied by a -/// [AsymmetricCryptoKey] -pub struct AsymmetricPublicCryptoKey { - key: RsaPublicKey, -} - -impl AsymmetricPublicCryptoKey { - /// Build a public key from the SubjectPublicKeyInfo DER. - pub fn from_der(der: &[u8]) -> Result { - Ok(Self { - key: rsa::RsaPublicKey::from_public_key_der(der) - .map_err(|_| CryptoError::InvalidKey)?, - }) - } -} - -impl AsymmetricEncryptable for AsymmetricPublicCryptoKey { - fn to_public_key(&self) -> &RsaPublicKey { - &self.key - } -} - -/// An asymmetric encryption key. Contains both the public and private key. Can be used to both -/// encrypt and decrypt [`AsymmetricEncString`](crate::AsymmetricEncString). -#[derive(Clone)] -pub struct AsymmetricCryptoKey { - // RsaPrivateKey is not a Copy type so this isn't completely necessary, but - // to keep the compiler from making stack copies when moving this struct around, - // we use a Box to keep the values on the heap. We also pin the box to make sure - // that the contents can't be pulled out of the box and moved - pub(crate) key: Pin>, -} - -// Note that RsaPrivateKey already implements ZeroizeOnDrop, so we don't need to do anything -// We add this assertion to make sure that this is still true in the future -const _: () = { - fn assert_zeroize_on_drop() {} - fn assert_all() { - assert_zeroize_on_drop::(); - } -}; - -impl zeroize::ZeroizeOnDrop for AsymmetricCryptoKey {} - -impl AsymmetricCryptoKey { - /// Generate a random AsymmetricCryptoKey (RSA-2048). - pub fn generate(rng: &mut R) -> Self { - let bits = 2048; - - Self { - key: Box::pin(RsaPrivateKey::new(rng, bits).expect("failed to generate a key")), - } - } - - pub fn from_pem(pem: &str) -> Result { - use rsa::pkcs8::DecodePrivateKey; - Ok(Self { - key: Box::pin(RsaPrivateKey::from_pkcs8_pem(pem).map_err(|_| CryptoError::InvalidKey)?), - }) - } - - pub fn from_der(der: &[u8]) -> Result { - use rsa::pkcs8::DecodePrivateKey; - Ok(Self { - key: Box::pin(RsaPrivateKey::from_pkcs8_der(der).map_err(|_| CryptoError::InvalidKey)?), - }) - } - - pub fn to_der(&self) -> Result> { - use rsa::pkcs8::EncodePrivateKey; - Ok(self - .key - .to_pkcs8_der() - .map_err(|_| CryptoError::InvalidKey)? - .as_bytes() - .to_owned()) - } - - pub fn to_public_der(&self) -> Result> { - use rsa::pkcs8::EncodePublicKey; - Ok(self - .to_public_key() - .to_public_key_der() - .map_err(|_| CryptoError::InvalidKey)? - .as_bytes() - .to_owned()) - } -} - -impl AsymmetricEncryptable for AsymmetricCryptoKey { - fn to_public_key(&self) -> &RsaPublicKey { - (*self.key).as_ref() - } -} - -impl CryptoKey for AsymmetricCryptoKey {} - -// We manually implement these to make sure we don't print any sensitive data -impl std::fmt::Debug for AsymmetricCryptoKey { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("AsymmetricCryptoKey").finish() - } -} - -#[cfg(test)] -mod tests { - use base64::{engine::general_purpose::STANDARD, Engine}; - - use crate::{ - AsymmetricCryptoKey, AsymmetricEncString, AsymmetricPublicCryptoKey, KeyDecryptable, - }; - - #[test] - fn test_asymmetric_crypto_key() { - let pem_key_str = "-----BEGIN PRIVATE KEY----- -MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDiTQVuzhdygFz5 -qv14i+XFDGTnDravzUQT1hPKPGUZOUSZ1gwdNgkWqOIaOnR65BHEnL0sp4bnuiYc -afeK2JAW5Sc8Z7IxBNSuAwhQmuKx3RochMIiuCkI2/p+JvUQoJu6FBNm8OoJ4Cwm -qqHGZESMfnpQDCuDrB3JdJEdXhtmnl0C48sGjOk3WaBMcgGqn8LbJDUlyu1zdqyv -b0waJf0iV4PJm2fkUl7+57D/2TkpbCqURVnZK1FFIEg8mr6FzSN1F2pOfktkNYZw -P7MSNR7o81CkRSCMr7EkIVa+MZYMBx106BMK7FXgWB7nbSpsWKxBk7ZDHkID2fam -rEcVtrzDAgMBAAECggEBAKwq9OssGGKgjhvUnyrLJHAZ0dqIMyzk+dotkLjX4gKi -szJmyqiep6N5sStLNbsZMPtoU/RZMCW0VbJgXFhiEp2YkZU/Py5UAoqw++53J+kx -0d/IkPphKbb3xUec0+1mg5O6GljDCQuiZXS1dIa/WfeZcezclW6Dz9WovY6ePjJ+ -8vEBR1icbNKzyeINd6MtPtpcgQPHtDwHvhPyUDbKDYGbLvjh9nui8h4+ZUlXKuVR -jB0ChxiKV1xJRjkrEVoulOOicd5r597WfB2ghax3pvRZ4MdXemCXm3gQYqPVKach -vGU+1cPQR/MBJZpxT+EZA97xwtFS3gqwbxJaNFcoE8ECgYEA9OaeYZhQPDo485tI -1u/Z7L/3PNape9hBQIXoW7+MgcQ5NiWqYh8Jnj43EIYa0wM/ECQINr1Za8Q5e6KR -J30FcU+kfyjuQ0jeXdNELGU/fx5XXNg/vV8GevHwxRlwzqZTCg6UExUZzbYEQqd7 -l+wPyETGeua5xCEywA1nX/D101kCgYEA7I6aMFjhEjO71RmzNhqjKJt6DOghoOfQ -TjhaaanNEhLYSbenFz1mlb21mW67ulmz162saKdIYLxQNJIP8ZPmxh4ummOJI8w9 -ClHfo8WuCI2hCjJ19xbQJocSbTA5aJg6lA1IDVZMDbQwsnAByPRGpaLHBT/Q9Bye -KvCMB+9amXsCgYEAx65yXSkP4sumPBrVHUub6MntERIGRxBgw/drKcPZEMWp0FiN -wEuGUBxyUWrG3F69QK/gcqGZE6F/LSu0JvptQaKqgXQiMYJsrRvhbkFvsHpQyUcZ -UZL1ebFjm5HOxPAgrQaN/bEqxOwwNRjSUWEMzUImg3c06JIZCzbinvudtKECgYEA -kY3JF/iIPI/yglP27lKDlCfeeHSYxI3+oTKRhzSAxx8rUGidenJAXeDGDauR/T7W -pt3pGNfddBBK9Z3uC4Iq3DqUCFE4f/taj7ADAJ1Q0Vh7/28/IJM77ojr8J1cpZwN -Zy2o6PPxhfkagaDjqEeN9Lrs5LD4nEvDkr5CG1vOjmMCgYEAvIBFKRm31NyF8jLi -CVuPwC5PzrW5iThDmsWTaXFpB3esUsbICO2pEz872oeQS+Em4GO5vXUlpbbFPzup -PFhA8iMJ8TAvemhvc7oM0OZqpU6p3K4seHf6BkwLxumoA3vDJfovu9RuXVcJVOnf -DnqOsltgPomWZ7xVfMkm9niL2OA= ------END PRIVATE KEY-----"; - - let der_key_vec = STANDARD.decode("MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDiTQVuzhdygFz5qv14i+XFDGTnDravzUQT1hPKPGUZOUSZ1gwdNgkWqOIaOnR65BHEnL0sp4bnuiYcafeK2JAW5Sc8Z7IxBNSuAwhQmuKx3RochMIiuCkI2/p+JvUQoJu6FBNm8OoJ4CwmqqHGZESMfnpQDCuDrB3JdJEdXhtmnl0C48sGjOk3WaBMcgGqn8LbJDUlyu1zdqyvb0waJf0iV4PJm2fkUl7+57D/2TkpbCqURVnZK1FFIEg8mr6FzSN1F2pOfktkNYZwP7MSNR7o81CkRSCMr7EkIVa+MZYMBx106BMK7FXgWB7nbSpsWKxBk7ZDHkID2famrEcVtrzDAgMBAAECggEBAKwq9OssGGKgjhvUnyrLJHAZ0dqIMyzk+dotkLjX4gKiszJmyqiep6N5sStLNbsZMPtoU/RZMCW0VbJgXFhiEp2YkZU/Py5UAoqw++53J+kx0d/IkPphKbb3xUec0+1mg5O6GljDCQuiZXS1dIa/WfeZcezclW6Dz9WovY6ePjJ+8vEBR1icbNKzyeINd6MtPtpcgQPHtDwHvhPyUDbKDYGbLvjh9nui8h4+ZUlXKuVRjB0ChxiKV1xJRjkrEVoulOOicd5r597WfB2ghax3pvRZ4MdXemCXm3gQYqPVKachvGU+1cPQR/MBJZpxT+EZA97xwtFS3gqwbxJaNFcoE8ECgYEA9OaeYZhQPDo485tI1u/Z7L/3PNape9hBQIXoW7+MgcQ5NiWqYh8Jnj43EIYa0wM/ECQINr1Za8Q5e6KRJ30FcU+kfyjuQ0jeXdNELGU/fx5XXNg/vV8GevHwxRlwzqZTCg6UExUZzbYEQqd7l+wPyETGeua5xCEywA1nX/D101kCgYEA7I6aMFjhEjO71RmzNhqjKJt6DOghoOfQTjhaaanNEhLYSbenFz1mlb21mW67ulmz162saKdIYLxQNJIP8ZPmxh4ummOJI8w9ClHfo8WuCI2hCjJ19xbQJocSbTA5aJg6lA1IDVZMDbQwsnAByPRGpaLHBT/Q9ByeKvCMB+9amXsCgYEAx65yXSkP4sumPBrVHUub6MntERIGRxBgw/drKcPZEMWp0FiNwEuGUBxyUWrG3F69QK/gcqGZE6F/LSu0JvptQaKqgXQiMYJsrRvhbkFvsHpQyUcZUZL1ebFjm5HOxPAgrQaN/bEqxOwwNRjSUWEMzUImg3c06JIZCzbinvudtKECgYEAkY3JF/iIPI/yglP27lKDlCfeeHSYxI3+oTKRhzSAxx8rUGidenJAXeDGDauR/T7Wpt3pGNfddBBK9Z3uC4Iq3DqUCFE4f/taj7ADAJ1Q0Vh7/28/IJM77ojr8J1cpZwNZy2o6PPxhfkagaDjqEeN9Lrs5LD4nEvDkr5CG1vOjmMCgYEAvIBFKRm31NyF8jLiCVuPwC5PzrW5iThDmsWTaXFpB3esUsbICO2pEz872oeQS+Em4GO5vXUlpbbFPzupPFhA8iMJ8TAvemhvc7oM0OZqpU6p3K4seHf6BkwLxumoA3vDJfovu9RuXVcJVOnfDnqOsltgPomWZ7xVfMkm9niL2OA=").unwrap(); - - // Load the two different formats and check they are the same key - let pem_key = AsymmetricCryptoKey::from_pem(pem_key_str).unwrap(); - let der_key = AsymmetricCryptoKey::from_der(&der_key_vec).unwrap(); - assert_eq!(pem_key.key, der_key.key); - - // Check that the keys can be converted back to DER - assert_eq!(der_key.to_der().unwrap(), der_key_vec); - assert_eq!(pem_key.to_der().unwrap(), der_key_vec); - } - - #[test] - fn test_encrypt_public_decrypt_private() { - let private_key = STANDARD - .decode(concat!( - "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCu9xd+vmkIPoqH", - "NejsFZzkd1xuCn1TqGTT7ANhAEnbI/yaVt3caI30kwUC2WIToFpNgu7Ej0x2TteY", - "OgrLrdcC4jy1SifmKYv/v3ZZxrd/eqttmH2k588panseRwHK3LVk7xA+URhQ/bjL", - "gPM59V0uR1l+z1fmooeJPFz5WSXNObc9Jqnh45FND+U/UYHXTLSomTn7jgZFxJBK", - "veS7q6Lat7wAnYZCF2dnPmhZoJv+SKPltA8HAGsgQGWBF1p5qxV1HrAUk8kBBnG2", - "paj0w8p5UM6RpDdCuvKH7j1LiuWffn3b9Z4dgzmE7jsMmvzoQtypzIKaSxhqzvFO", - "od9V8dJdAgMBAAECggEAGGIYjOIB1rOKkDHP4ljXutI0mCRPl3FMDemiBeppoIfZ", - "G/Q3qpAKmndDt0Quwh/yfcNdvZhf1kwCCTWri/uPz5fSUIyDV3TaTRu0ZWoHaBVj", - "Hxylg+4HRZUQj+Vi50/PWr/jQmAAVMcrMfcoTl82q2ynmP/R1vM3EsXOCjTliv5B", - "XlMPRjj/9PDBH0dnnVcAPDOpflzOTL2f4HTFEMlmg9/tZBnd96J/cmfhjAv9XpFL", - "FBAFZzs5pz0rwCNSR8QZNonnK7pngVUlGDLORK58y84tGmxZhGdne3CtCWey/sJ4", - "7QF0Pe8YqWBU56926IY6DcSVBuQGZ6vMCNlU7J8D2QKBgQDXyh3t2TicM/n1QBLk", - "zLoGmVUmxUGziHgl2dnJiGDtyOAU3+yCorPgFaCie29s5qm4b0YEGxUxPIrRrEro", - "h0FfKn9xmr8CdmTPTcjJW1+M7bxxq7oBoU/QzKXgIHlpeCjjnvPJt0PcNkNTjCXv", - "shsrINh2rENoe/x79eEfM/N5eQKBgQDPkYSmYyALoNq8zq0A4BdR+F5lb5Fj5jBH", - "Jk68l6Uti+0hRbJ2d1tQTLkU+eCPQLGBl6fuc1i4K5FV7v14jWtRPdD7wxrkRi3j", - "ilqQwLBOU6Bj3FK4DvlLF+iYTuBWj2/KcxflXECmsjitKHLK6H7kFEiuJql+NAHU", - "U9EFXepLBQKBgQDQ+HCnZ1bFHiiP8m7Zl9EGlvK5SwlnPV9s+F1KJ4IGhCNM09UM", - "ZVfgR9F5yCONyIrPiyK40ylgtwqQJlOcf281I8irUXpsfg7+Gou5Q31y0r9NLUpC", - "Td8niyePtqMdGjouxD2+OHXFCd+FRxFt4IMi7vnxYr0csAVAXkqWlw7PsQKBgH/G", - "/PnQm7GM3BrOwAGB8dksJDAddkshMScblezTDYP0V43b8firkTLliCo5iNum357/", - "VQmdSEhXyag07yR/Kklg3H2fpbZQ3X7tdMMXW3FcWagfwWw9C4oGtdDM/Z1Lv23J", - "XDR9je8QV4OBGul+Jl8RfYx3kG94ZIfo8Qt0vP5hAoGARjAzdCGYz42NwaUk8n94", - "W2RuKHtTV9vtjaAbfPFbZoGkT7sXNJVlrA0C+9f+H9rOTM3mX59KrjmLVzde4Vhs", - "avWMShuK4vpAiDQLU7GyABvi5CR6Ld+AT+LSzxHhVe0ASOQPNCA2SOz3RQvgPi7R", - "GDgRMUB6cL3IRVzcR0dC6cY=", - )) - .unwrap(); - - let public_key = STANDARD - .decode(concat!( - "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArvcXfr5pCD6KhzXo7BWc", - "5Hdcbgp9U6hk0+wDYQBJ2yP8mlbd3GiN9JMFAtliE6BaTYLuxI9Mdk7XmDoKy63X", - "AuI8tUon5imL/792Wca3f3qrbZh9pOfPKWp7HkcByty1ZO8QPlEYUP24y4DzOfVd", - "LkdZfs9X5qKHiTxc+VklzTm3PSap4eORTQ/lP1GB10y0qJk5+44GRcSQSr3ku6ui", - "2re8AJ2GQhdnZz5oWaCb/kij5bQPBwBrIEBlgRdaeasVdR6wFJPJAQZxtqWo9MPK", - "eVDOkaQ3Qrryh+49S4rln3592/WeHYM5hO47DJr86ELcqcyCmksYas7xTqHfVfHS", - "XQIDAQAB", - )) - .unwrap(); - - let private_key = AsymmetricCryptoKey::from_der(&private_key).unwrap(); - let public_key = AsymmetricPublicCryptoKey::from_der(&public_key).unwrap(); - - let plaintext = "Hello, world!"; - let encrypted = - AsymmetricEncString::encrypt_rsa2048_oaep_sha1(plaintext.as_bytes(), &public_key) - .unwrap(); - let decrypted: String = encrypted.decrypt_with_key(&private_key).unwrap(); - - assert_eq!(plaintext, decrypted); - } -} diff --git a/crates/bitwarden-crypto/src/keys/device_key.rs b/crates/bitwarden-crypto/src/keys/device_key.rs deleted file mode 100644 index c1c0ff0ff..000000000 --- a/crates/bitwarden-crypto/src/keys/device_key.rs +++ /dev/null @@ -1,140 +0,0 @@ -use crate::{ - error::Result, AsymmetricCryptoKey, AsymmetricEncString, CryptoError, EncString, - KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; - -/// Device Key -/// -/// Encrypts the DevicePrivateKey -/// Allows the device to decrypt the UserKey, via the DevicePrivateKey. -#[derive(Debug)] -pub struct DeviceKey(SymmetricCryptoKey); - -#[derive(Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct TrustDeviceResponse { - /// Base64 encoded device key - pub device_key: String, - /// UserKey encrypted with DevicePublicKey - pub protected_user_key: AsymmetricEncString, - /// DevicePrivateKey encrypted with [DeviceKey] - pub protected_device_private_key: EncString, - /// DevicePublicKey encrypted with [UserKey](super::UserKey) - pub protected_device_public_key: EncString, -} - -impl DeviceKey { - /// Generate a new device key - /// - /// Note: Input has to be a SymmetricCryptoKey instead of UserKey because that's what we get - /// from EncSettings. - pub fn trust_device(user_key: &SymmetricCryptoKey) -> Result { - let mut rng = rand::thread_rng(); - let device_key = DeviceKey(SymmetricCryptoKey::generate(&mut rng)); - - let device_private_key = AsymmetricCryptoKey::generate(&mut rng); - - // Encrypt both the key and mac_key of the user key - let data = user_key.to_vec(); - - let protected_user_key = - AsymmetricEncString::encrypt_rsa2048_oaep_sha1(&data, &device_private_key)?; - - let protected_device_public_key = device_private_key - .to_public_der()? - .encrypt_with_key(user_key)?; - - let protected_device_private_key = device_private_key - .to_der()? - .encrypt_with_key(&device_key.0)?; - - Ok(TrustDeviceResponse { - device_key: device_key.to_base64(), - protected_user_key, - protected_device_private_key, - protected_device_public_key, - }) - } - - /// Decrypt the user key using the device key - pub fn decrypt_user_key( - &self, - protected_device_private_key: EncString, - protected_user_key: AsymmetricEncString, - ) -> Result { - let device_private_key: Vec = protected_device_private_key.decrypt_with_key(&self.0)?; - let device_private_key = AsymmetricCryptoKey::from_der(&device_private_key)?; - - let dec: Vec = protected_user_key.decrypt_with_key(&device_private_key)?; - let user_key = SymmetricCryptoKey::try_from(dec)?; - - Ok(user_key) - } - - fn to_base64(&self) -> String { - self.0.to_base64() - } -} - -impl TryFrom for DeviceKey { - type Error = CryptoError; - - fn try_from(value: String) -> Result { - SymmetricCryptoKey::try_from(value).map(DeviceKey) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::derive_symmetric_key; - - #[test] - fn test_trust_device() { - let key = derive_symmetric_key("test"); - - let result = DeviceKey::trust_device(&key).unwrap(); - - let device_key = DeviceKey::try_from(result.device_key).unwrap(); - let decrypted = device_key - .decrypt_user_key( - result.protected_device_private_key, - result.protected_user_key, - ) - .unwrap(); - - assert_eq!(key.key, decrypted.key); - assert_eq!(key.mac_key, decrypted.mac_key); - } - - #[test] - fn test_decrypt_user_key() { - // Example keys from desktop app - let user_key: &mut [u8] = &mut [ - 109, 128, 172, 147, 206, 123, 134, 95, 16, 36, 155, 113, 201, 18, 186, 230, 216, 212, - 173, 188, 74, 11, 134, 131, 137, 242, 105, 178, 105, 126, 52, 139, 248, 91, 215, 21, - 128, 91, 226, 222, 165, 67, 251, 34, 83, 81, 77, 147, 225, 76, 13, 41, 102, 45, 183, - 218, 106, 89, 254, 208, 251, 101, 130, 10, - ]; - let user_key = SymmetricCryptoKey::try_from(user_key).unwrap(); - - let key_data: &mut [u8] = &mut [ - 114, 235, 60, 115, 172, 156, 203, 145, 195, 130, 215, 250, 88, 146, 215, 230, 12, 109, - 245, 222, 54, 217, 255, 211, 221, 105, 230, 236, 65, 52, 209, 133, 76, 208, 113, 254, - 194, 216, 156, 19, 230, 62, 32, 93, 87, 7, 144, 156, 117, 142, 250, 32, 182, 118, 187, - 8, 247, 7, 203, 201, 65, 147, 206, 247, - ]; - let device_key = DeviceKey(key_data.try_into().unwrap()); - - let protected_user_key: AsymmetricEncString = "4.f+VbbacRhO2q4MOUSdt1AIjQ2FuLAvg4aDxJMXAh3VxvbmUADj8Ct/R7XEpPUqApmbRS566jS0eRVy8Sk08ogoCdj1IFN9VsIky2i2X1WHK1fUnr3UBmXE3tl2NPBbx56U+h73S2jNTSyet2W18Jg2q7/w8KIhR3J41QrG9aGoOTN93to3hb5W4z6rdrSI0e7GkizbwcIA0NH7Z1JyAhrjPm9+tjRjg060YbEbGaWTAOkZWfgbLjr8bY455DteO2xxG139cOx7EBo66N+YhjsLi0ozkeUyPQkoWBdKMcQllS7jCfB4fDyJA05ALTbk74syKkvqFxqwmQbg+aVn+dcw==".parse().unwrap(); - - let protected_device_private_key: EncString = "2.GyQfUYWW6Byy4UV5icFLxg==|EMiU7OTF79N6tfv3+YUs5zJhBAgqv6sa5YCoPl6yAETh7Tfk+JmbeizxXFPj5Q1X/tcVpDZl/3fGcxtnIxg1YtvDFn7j8uPnoApOWhCKmwcvJSIkt+qvX3lELNBwZXozSiy7PbQ0JbCMe2d4MkimR5k8+lE9FB3208yYK7nOJhlrsUCnOekCYEU9/4NCMA8tz8SpITx/MN4JJ1TQ/KjPJYLt+3JNUxK47QlgREWQvyVzCRt7ZGtcgIJ/U1qycAWMpEg9NkuV8j5QRA1S7VBsA6qliJwys5+dmTuIOmOMwdKFZDc4ZvWoRkPp2TSJBu7L8sSAgU6mmDWac8iQ+9Ka/drdfwYLrH8GAZvURk79tSpRrT7+PAFe2QdUtliUIyiqkh8iJVjZube4hRnEsRuX9V9b+UdtAr6zAj7mugO/VAu5T9J38V79V2ohG3NtXysDeKLXpAlkhjllWXeq/wret2fD4WiwqEDj0G2A/PY3F3OziIgp0UKc00AfqrPq8OVK3A+aowwVqdYadgxyoVCKWJ8unJeAXG7MrMQ9tHpzF6COoaEy7Wwoc17qko33zazwLZbfAjB4oc8Ea26jRKnJZP56sVZAjOSQQMziAsA08MRaa/DQhgRea1+Ygba0gMft8Dww8anN2gQBveTZRBWyqXYgN3U0Ity5gNauT8RnFk9faqVFt2Qxnp0JgJ+PsqEt5Hn4avBRZQQ7o8VvPnxYLDKFe3I2m6HFYFWRhOGeDYxexIuaiF2iIAYFVUmnDuWpgnUiL4XJ3KHDsjkPzcV3z4D2Knr/El2VVXve8jhDjETfovmmN28+i2e29PXvKIymTskMFpFCQPc7wBY/Id7pmgb3SujKYNpkAS2sByDoRir0my49DDGfta0dENssJhFd3x+87fZbEj3cMiikg2pBwpTLgmfIUa5cVZU2s8JZ9wu7gaioYzvX+elHa3EHLcnEUoJTtSf9kjb+Nbq4ktMgYAO2wIC96t1LvmqK4Qn2cOdw5QNlRqALhqe5V31kyIcwRMK0AyIoOPhnSqtpYdFiR3LDTvZA8dU0vSsuchCwHNMeRUtKvdzN/tk+oeznyY/mpakUESN501lEKd/QFLtJZsDZTtNlcA8fU3kDtws4ZIMR0O5+PFmgQFSU8OMobf9ClUzy/wHTvYGyDuSwbOoPeS955QKkUKXCNMj33yrPr+ioHQ1BNwLX3VmMF4bNRBY/vr+CG0/EZi0Gwl0kyHGl0yWEtpQuu+/PaROJeOraWy5D1UoZZhY4n0zJZBt1eg3FZ2rhKv4gdUc50nZpeNWE8pIqZ6RQ7qPJuqfF1Z+G73iOSnLYCHDiiFmhD5ivf9IGkTAcWcBsQ/2wcSj9bFJr4DrKfsbQ4CkSWICWVn/W+InKkO6BTsBbYmvte5SvbaN+UOtiUSkHLBCCr8273VNgcB/hgtbUires3noxYZJxoczr+i7vdlEgQnWEKrpo0CifsFxGwYS3Yy2K79iwvDMaLPDf73zLSbuoUl6602F2Mzcjnals67f+gSpaDvWt7Kg9c/ZfGjq8oNxVaXJnX3gSDsO+fhwVAtnDApL+tL8cFfxGerW4KGi9/74woH+C3MMIViBtNnrpEuvxUW97Dg5nd40oGDeyi/q+8HdcxkneyFY=|JYdol19Yi+n1r7M+06EwK5JCi2s/CWqKui2Cy6hEb3k=".parse().unwrap(); - - let decrypted = device_key - .decrypt_user_key(protected_device_private_key, protected_user_key) - .unwrap(); - - assert_eq!(decrypted.key, user_key.key); - assert_eq!(decrypted.mac_key, user_key.mac_key); - } -} diff --git a/crates/bitwarden-crypto/src/keys/key_encryptable.rs b/crates/bitwarden-crypto/src/keys/key_encryptable.rs deleted file mode 100644 index 044be9fcb..000000000 --- a/crates/bitwarden-crypto/src/keys/key_encryptable.rs +++ /dev/null @@ -1,122 +0,0 @@ -use std::{collections::HashMap, hash::Hash, sync::Arc}; - -use rayon::prelude::*; -use uuid::Uuid; - -use crate::{error::Result, CryptoError, SymmetricCryptoKey}; - -pub trait KeyContainer: Send + Sync { - fn get_key(&self, org_id: &Option) -> Result<&SymmetricCryptoKey, CryptoError>; -} - -impl KeyContainer for Arc { - fn get_key(&self, org_id: &Option) -> Result<&SymmetricCryptoKey, CryptoError> { - self.as_ref().get_key(org_id) - } -} - -pub trait LocateKey { - fn locate_key<'a>( - &self, - enc: &'a dyn KeyContainer, - org_id: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - enc.get_key(org_id) - } -} - -pub trait CryptoKey {} - -pub trait KeyEncryptable { - fn encrypt_with_key(self, key: &Key) -> Result; -} - -pub trait KeyDecryptable { - fn decrypt_with_key(&self, key: &Key) -> Result; -} - -impl, Key: CryptoKey, Output> KeyEncryptable> - for Option -{ - fn encrypt_with_key(self, key: &Key) -> Result> { - self.map(|e| e.encrypt_with_key(key)).transpose() - } -} - -impl, Key: CryptoKey, Output> KeyDecryptable> - for Option -{ - fn decrypt_with_key(&self, key: &Key) -> Result> { - self.as_ref().map(|e| e.decrypt_with_key(key)).transpose() - } -} - -impl, Key: CryptoKey, Output> KeyEncryptable - for Box -{ - fn encrypt_with_key(self, key: &Key) -> Result { - (*self).encrypt_with_key(key) - } -} - -impl, Key: CryptoKey, Output> KeyDecryptable - for Box -{ - fn decrypt_with_key(&self, key: &Key) -> Result { - (**self).decrypt_with_key(key) - } -} - -impl< - T: KeyEncryptable + Send + Sync, - Key: CryptoKey + Send + Sync, - Output: Send + Sync, - > KeyEncryptable> for Vec -{ - fn encrypt_with_key(self, key: &Key) -> Result> { - self.into_par_iter() - .map(|e| e.encrypt_with_key(key)) - .collect() - } -} - -impl< - T: KeyDecryptable + Send + Sync, - Key: CryptoKey + Send + Sync, - Output: Send + Sync, - > KeyDecryptable> for Vec -{ - fn decrypt_with_key(&self, key: &Key) -> Result> { - self.into_par_iter() - .map(|e| e.decrypt_with_key(key)) - .collect() - } -} - -impl< - T: KeyEncryptable + Send + Sync, - Key: CryptoKey + Send + Sync, - Output: Send + Sync, - Id: Hash + Eq + Send + Sync, - > KeyEncryptable> for HashMap -{ - fn encrypt_with_key(self, key: &Key) -> Result> { - self.into_par_iter() - .map(|(id, e)| Ok((id, e.encrypt_with_key(key)?))) - .collect() - } -} - -impl< - T: KeyDecryptable + Send + Sync, - Key: CryptoKey + Send + Sync, - Output: Send + Sync, - Id: Hash + Eq + Copy + Send + Sync, - > KeyDecryptable> for HashMap -{ - fn decrypt_with_key(&self, key: &Key) -> Result> { - self.into_par_iter() - .map(|(id, e)| Ok((*id, e.decrypt_with_key(key)?))) - .collect() - } -} diff --git a/crates/bitwarden-crypto/src/keys/master_key.rs b/crates/bitwarden-crypto/src/keys/master_key.rs deleted file mode 100644 index 7a1e49596..000000000 --- a/crates/bitwarden-crypto/src/keys/master_key.rs +++ /dev/null @@ -1,361 +0,0 @@ -use std::num::NonZeroU32; - -use base64::{engine::general_purpose::STANDARD, Engine}; -use generic_array::{typenum::U32, GenericArray}; -use rand::Rng; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -#[cfg(feature = "wasm")] -use {tsify_next::Tsify, wasm_bindgen::prelude::*}; - -use super::utils::{derive_kdf_key, stretch_kdf_key}; -use crate::{util, CryptoError, EncString, KeyDecryptable, Result, SymmetricCryptoKey, UserKey}; - -/// Key Derivation Function for Bitwarden Account -/// -/// In Bitwarden accounts can use multiple KDFs to derive their master key from their password. This -/// Enum represents all the possible KDFs. -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] -pub enum Kdf { - PBKDF2 { - iterations: NonZeroU32, - }, - Argon2id { - iterations: NonZeroU32, - memory: NonZeroU32, - parallelism: NonZeroU32, - }, -} - -impl Default for Kdf { - /// Default KDF for new accounts. - fn default() -> Self { - Kdf::PBKDF2 { - iterations: default_pbkdf2_iterations(), - } - } -} - -/// Default PBKDF2 iterations -pub fn default_pbkdf2_iterations() -> NonZeroU32 { - NonZeroU32::new(600_000).expect("Non-zero number") -} -/// Default Argon2 iterations -pub fn default_argon2_iterations() -> NonZeroU32 { - NonZeroU32::new(3).expect("Non-zero number") -} -/// Default Argon2 memory -pub fn default_argon2_memory() -> NonZeroU32 { - NonZeroU32::new(64).expect("Non-zero number") -} -/// Default Argon2 parallelism -pub fn default_argon2_parallelism() -> NonZeroU32 { - NonZeroU32::new(4).expect("Non-zero number") -} - -#[derive(Copy, Clone, JsonSchema)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum HashPurpose { - ServerAuthorization = 1, - LocalAuthorization = 2, -} - -/// Master Key. -/// -/// Derived from the users master password, used to protect the [UserKey]. -pub struct MasterKey(SymmetricCryptoKey); - -impl MasterKey { - pub fn new(key: SymmetricCryptoKey) -> Self { - Self(key) - } - - /// Generate a new random master key. Primarily used for KeyConnector. - pub fn generate(mut rng: impl rand::RngCore) -> Self { - let mut key = Box::pin(GenericArray::::default()); - - rng.fill(key.as_mut_slice()); - - // Master Keys never contains a mac_key. - Self::new(SymmetricCryptoKey { key, mac_key: None }) - } - - /// Derives a users master key from their password, email and KDF. - /// - /// Note: the email is trimmed and converted to lowercase before being used. - pub fn derive(password: &str, email: &str, kdf: &Kdf) -> Result { - derive_kdf_key( - password.as_bytes(), - email.trim().to_lowercase().as_bytes(), - kdf, - ) - .map(Self) - } - - /// Derive the master key hash, used for local and remote password validation. - pub fn derive_master_key_hash(&self, password: &[u8], purpose: HashPurpose) -> Result { - let hash = util::pbkdf2(&self.0.key, password, purpose as u32); - - Ok(STANDARD.encode(hash)) - } - - /// Generate a new random user key and encrypt it with the master key. - pub fn make_user_key(&self) -> Result<(UserKey, EncString)> { - make_user_key(rand::thread_rng(), self) - } - - /// Encrypt the users user key - pub fn encrypt_user_key(&self, user_key: &SymmetricCryptoKey) -> Result { - encrypt_user_key(&self.0, user_key) - } - - /// Decrypt the users user key - pub fn decrypt_user_key(&self, user_key: EncString) -> Result { - decrypt_user_key(&self.0, user_key) - } - - pub fn to_base64(&self) -> String { - self.0.to_base64() - } -} - -/// Helper function to encrypt a user key with a master or pin key. -pub(super) fn encrypt_user_key( - key: &SymmetricCryptoKey, - user_key: &SymmetricCryptoKey, -) -> Result { - let stretched_key = stretch_kdf_key(key)?; - - EncString::encrypt_aes256_hmac( - &user_key.to_vec(), - stretched_key - .mac_key - .as_ref() - .ok_or(CryptoError::InvalidMac)?, - &stretched_key.key, - ) -} - -/// Helper function to decrypt a user key with a master or pin key. -pub(super) fn decrypt_user_key( - key: &SymmetricCryptoKey, - user_key: EncString, -) -> Result { - let mut dec: Vec = match user_key { - // Legacy. user_keys were encrypted using `AesCbc256_B64` a long time ago. We've since - // moved to using `AesCbc256_HmacSha256_B64`. However, we still need to support - // decrypting these old keys. - EncString::AesCbc256_B64 { .. } => user_key.decrypt_with_key(key)?, - _ => { - let stretched_key = stretch_kdf_key(key)?; - user_key.decrypt_with_key(&stretched_key)? - } - }; - - SymmetricCryptoKey::try_from(dec.as_mut_slice()) -} - -/// Generate a new random user key and encrypt it with the master key. -fn make_user_key( - mut rng: impl rand::RngCore, - master_key: &MasterKey, -) -> Result<(UserKey, EncString)> { - let user_key = SymmetricCryptoKey::generate(&mut rng); - let protected = master_key.encrypt_user_key(&user_key)?; - Ok((UserKey::new(user_key), protected)) -} - -#[cfg(test)] -mod tests { - use std::num::NonZeroU32; - - use rand::SeedableRng; - - use super::{make_user_key, HashPurpose, Kdf, MasterKey}; - use crate::{keys::symmetric_crypto_key::derive_symmetric_key, EncString, SymmetricCryptoKey}; - - #[test] - fn test_master_key_derive_pbkdf2() { - let master_key = MasterKey::derive( - "67t9b5g67$%Dh89n", - "test_key", - &Kdf::PBKDF2 { - iterations: NonZeroU32::new(10000).unwrap(), - }, - ) - .unwrap(); - - assert_eq!( - [ - 31, 79, 104, 226, 150, 71, 177, 90, 194, 80, 172, 209, 17, 129, 132, 81, 138, 167, - 69, 167, 254, 149, 2, 27, 39, 197, 64, 42, 22, 195, 86, 75 - ], - master_key.0.key.as_slice() - ); - assert_eq!(None, master_key.0.mac_key); - } - - #[test] - fn test_master_key_derive_argon2() { - let master_key = MasterKey::derive( - "67t9b5g67$%Dh89n", - "test_key", - &Kdf::Argon2id { - iterations: NonZeroU32::new(4).unwrap(), - memory: NonZeroU32::new(32).unwrap(), - parallelism: NonZeroU32::new(2).unwrap(), - }, - ) - .unwrap(); - - assert_eq!( - [ - 207, 240, 225, 177, 162, 19, 163, 76, 98, 106, 179, 175, 224, 9, 17, 240, 20, 147, - 237, 47, 246, 150, 141, 184, 62, 225, 131, 242, 51, 53, 225, 242 - ], - master_key.0.key.as_slice() - ); - assert_eq!(None, master_key.0.mac_key); - } - - #[test] - fn test_password_hash_pbkdf2() { - let password = "asdfasdf"; - let salts = [ - "test@bitwarden.com", - "TEST@bitwarden.com", - " test@bitwarden.com", - ]; - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(100_000).unwrap(), - }; - - for salt in salts.iter() { - let master_key = MasterKey::derive(password, salt, &kdf).unwrap(); - - assert_eq!( - "wmyadRMyBZOH7P/a/ucTCbSghKgdzDpPqUnu/DAVtSw=", - master_key - .derive_master_key_hash(password.as_bytes(), HashPurpose::ServerAuthorization) - .unwrap(), - ); - } - } - - #[test] - fn test_password_hash_argon2id() { - let password = "asdfasdf"; - let salt = "test_salt"; - let kdf = Kdf::Argon2id { - iterations: NonZeroU32::new(4).unwrap(), - memory: NonZeroU32::new(32).unwrap(), - parallelism: NonZeroU32::new(2).unwrap(), - }; - - let master_key = MasterKey::derive(password, salt, &kdf).unwrap(); - - assert_eq!( - "PR6UjYmjmppTYcdyTiNbAhPJuQQOmynKbdEl1oyi/iQ=", - master_key - .derive_master_key_hash(password.as_bytes(), HashPurpose::ServerAuthorization) - .unwrap(), - ); - } - - #[test] - fn test_make_user_key() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let master_key = MasterKey(SymmetricCryptoKey::new( - Box::pin( - [ - 31, 79, 104, 226, 150, 71, 177, 90, 194, 80, 172, 209, 17, 129, 132, 81, 138, - 167, 69, 167, 254, 149, 2, 27, 39, 197, 64, 42, 22, 195, 86, 75, - ] - .into(), - ), - None, - )); - - let (user_key, protected) = make_user_key(&mut rng, &master_key).unwrap(); - - assert_eq!( - user_key.0.key.as_slice(), - [ - 62, 0, 239, 47, 137, 95, 64, 214, 127, 91, 184, 232, 31, 9, 165, 161, 44, 132, 14, - 195, 206, 154, 127, 59, 24, 27, 225, 136, 239, 113, 26, 30 - ] - ); - assert_eq!( - user_key.0.mac_key.as_ref().unwrap().as_slice(), - [ - 152, 76, 225, 114, 185, 33, 111, 65, 159, 68, 83, 103, 69, 109, 86, 25, 49, 74, 66, - 163, 218, 134, 176, 1, 56, 123, 253, 184, 14, 12, 254, 66 - ] - ); - - // Ensure we can decrypt the key and get back the same key - let decrypted = master_key.decrypt_user_key(protected).unwrap(); - - assert_eq!( - decrypted.key, user_key.0.key, - "Decrypted key doesn't match user key" - ); - assert_eq!( - decrypted.mac_key, user_key.0.mac_key, - "Decrypted key doesn't match user key" - ); - } - - #[test] - fn test_make_user_key2() { - let master_key = MasterKey(derive_symmetric_key("test1")); - - let user_key = derive_symmetric_key("test2"); - - let encrypted = master_key.encrypt_user_key(&user_key).unwrap(); - let decrypted = master_key.decrypt_user_key(encrypted).unwrap(); - - assert_eq!( - decrypted.key, user_key.key, - "Decrypted key doesn't match user key" - ); - assert_eq!( - decrypted.mac_key, user_key.mac_key, - "Decrypted key doesn't match user key" - ); - } - - #[test] - fn test_decrypt_user_key_aes_cbc256_b64() { - let password = "asdfasdfasdf"; - let salt = "legacy@bitwarden.com"; - let kdf = Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }; - - let master_key = MasterKey::derive(password, salt, &kdf).unwrap(); - - let user_key: EncString = "0.8UClLa8IPE1iZT7chy5wzQ==|6PVfHnVk5S3XqEtQemnM5yb4JodxmPkkWzmDRdfyHtjORmvxqlLX40tBJZ+CKxQWmS8tpEB5w39rbgHg/gqs0haGdZG4cPbywsgGzxZ7uNI=".parse().unwrap(); - - let decrypted = master_key.decrypt_user_key(user_key).unwrap(); - - assert_eq!( - decrypted.key.as_slice(), - [ - 12, 95, 151, 203, 37, 4, 236, 67, 137, 97, 90, 58, 6, 127, 242, 28, 209, 168, 125, - 29, 118, 24, 213, 44, 117, 202, 2, 115, 132, 165, 125, 148 - ] - ); - assert_eq!( - decrypted.mac_key.as_ref().unwrap().as_slice(), - [ - 186, 215, 234, 137, 24, 169, 227, 29, 218, 57, 180, 237, 73, 91, 189, 51, 253, 26, - 17, 52, 226, 4, 134, 75, 194, 208, 178, 133, 128, 224, 140, 167 - ] - ); - } -} diff --git a/crates/bitwarden-crypto/src/keys/mod.rs b/crates/bitwarden-crypto/src/keys/mod.rs deleted file mode 100644 index ac1732966..000000000 --- a/crates/bitwarden-crypto/src/keys/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -mod key_encryptable; -pub use key_encryptable::{CryptoKey, KeyContainer, KeyDecryptable, KeyEncryptable, LocateKey}; -mod master_key; -pub use master_key::{ - default_argon2_iterations, default_argon2_memory, default_argon2_parallelism, - default_pbkdf2_iterations, HashPurpose, Kdf, MasterKey, -}; -mod shareable_key; -pub use shareable_key::derive_shareable_key; -mod symmetric_crypto_key; -#[cfg(test)] -pub use symmetric_crypto_key::derive_symmetric_key; -pub use symmetric_crypto_key::SymmetricCryptoKey; -mod asymmetric_crypto_key; -pub use asymmetric_crypto_key::{ - AsymmetricCryptoKey, AsymmetricEncryptable, AsymmetricPublicCryptoKey, -}; -mod user_key; -pub use user_key::UserKey; -mod device_key; -pub use device_key::{DeviceKey, TrustDeviceResponse}; -mod pin_key; -pub use pin_key::PinKey; -mod utils; diff --git a/crates/bitwarden-crypto/src/keys/pin_key.rs b/crates/bitwarden-crypto/src/keys/pin_key.rs deleted file mode 100644 index 9e6c02db5..000000000 --- a/crates/bitwarden-crypto/src/keys/pin_key.rs +++ /dev/null @@ -1,50 +0,0 @@ -use super::master_key::{decrypt_user_key, encrypt_user_key}; -use crate::{ - keys::{ - key_encryptable::CryptoKey, - utils::{derive_kdf_key, stretch_kdf_key}, - }, - EncString, Kdf, KeyEncryptable, Result, SymmetricCryptoKey, -}; - -/// Pin Key. -/// -/// Derived from a specific password, used for pin encryption and exports. -pub struct PinKey(SymmetricCryptoKey); - -impl PinKey { - pub fn new(key: SymmetricCryptoKey) -> Self { - Self(key) - } - - /// Derives a users pin key from their password, email and KDF. - pub fn derive(password: &[u8], email: &[u8], kdf: &Kdf) -> Result { - derive_kdf_key(password, email, kdf).map(Self) - } - - /// Encrypt the users user key - pub fn encrypt_user_key(&self, user_key: &SymmetricCryptoKey) -> Result { - encrypt_user_key(&self.0, user_key) - } - - /// Decrypt the users user key - pub fn decrypt_user_key(&self, user_key: EncString) -> Result { - decrypt_user_key(&self.0, user_key) - } -} - -impl CryptoKey for PinKey {} - -impl KeyEncryptable for &[u8] { - fn encrypt_with_key(self, key: &PinKey) -> Result { - let stretched_key = stretch_kdf_key(&key.0)?; - - self.encrypt_with_key(&stretched_key) - } -} - -impl KeyEncryptable for String { - fn encrypt_with_key(self, key: &PinKey) -> Result { - self.as_bytes().encrypt_with_key(key) - } -} diff --git a/crates/bitwarden-crypto/src/keys/shareable_key.rs b/crates/bitwarden-crypto/src/keys/shareable_key.rs deleted file mode 100644 index c6a44405c..000000000 --- a/crates/bitwarden-crypto/src/keys/shareable_key.rs +++ /dev/null @@ -1,55 +0,0 @@ -use std::pin::Pin; - -use aes::cipher::typenum::U64; -use generic_array::GenericArray; -use hmac::Mac; -use zeroize::Zeroizing; - -use crate::{ - keys::SymmetricCryptoKey, - util::{hkdf_expand, PbkdfSha256Hmac}, -}; - -/// Derive a shareable key using hkdf from secret and name. -/// -/// A specialized variant of this function was called `CryptoService.makeSendKey` in the Bitwarden -/// `clients` repository. -pub fn derive_shareable_key( - secret: Zeroizing<[u8; 16]>, - name: &str, - info: Option<&str>, -) -> SymmetricCryptoKey { - // Because all inputs are fixed size, we can unwrap all errors here without issue - let res = Zeroizing::new( - PbkdfSha256Hmac::new_from_slice(format!("bitwarden-{}", name).as_bytes()) - .expect("hmac new_from_slice should not fail") - .chain_update(secret) - .finalize() - .into_bytes(), - ); - - let mut key: Pin>> = - hkdf_expand(&res, info).expect("Input is a valid size"); - - SymmetricCryptoKey::try_from(key.as_mut_slice()).expect("Key is a valid size") -} - -#[cfg(test)] -mod tests { - use zeroize::Zeroizing; - - use super::derive_shareable_key; - - #[test] - fn test_derive_shareable_key() { - let key = derive_shareable_key(Zeroizing::new(*b"&/$%F1a895g67HlX"), "test_key", None); - assert_eq!(key.to_base64(), "4PV6+PcmF2w7YHRatvyMcVQtI7zvCyssv/wFWmzjiH6Iv9altjmDkuBD1aagLVaLezbthbSe+ktR+U6qswxNnQ=="); - - let key = derive_shareable_key( - Zeroizing::new(*b"67t9b5g67$%Dh89n"), - "test_key", - Some("test"), - ); - assert_eq!(key.to_base64(), "F9jVQmrACGx9VUPjuzfMYDjr726JtL300Y3Yg+VYUnVQtQ1s8oImJ5xtp1KALC9h2nav04++1LDW4iFD+infng=="); - } -} diff --git a/crates/bitwarden-crypto/src/keys/symmetric_crypto_key.rs b/crates/bitwarden-crypto/src/keys/symmetric_crypto_key.rs deleted file mode 100644 index 971564b07..000000000 --- a/crates/bitwarden-crypto/src/keys/symmetric_crypto_key.rs +++ /dev/null @@ -1,163 +0,0 @@ -use std::pin::Pin; - -use aes::cipher::typenum::U32; -use base64::{engine::general_purpose::STANDARD, Engine}; -use generic_array::GenericArray; -use rand::Rng; -use zeroize::Zeroize; - -use super::key_encryptable::CryptoKey; -use crate::CryptoError; - -/// A symmetric encryption key. Used to encrypt and decrypt [`EncString`](crate::EncString) -#[derive(Clone)] -pub struct SymmetricCryptoKey { - // GenericArray is equivalent to [u8; N], which is a Copy type placed on the stack. - // To keep the compiler from making stack copies when moving this struct around, - // we use a Box to keep the values on the heap. We also pin the box to make sure - // that the contents can't be pulled out of the box and moved - pub(crate) key: Pin>>, - pub(crate) mac_key: Option>>>, -} - -impl Drop for SymmetricCryptoKey { - fn drop(&mut self) { - self.key.zeroize(); - if let Some(mac_key) = &mut self.mac_key { - mac_key.zeroize(); - } - } -} - -impl zeroize::ZeroizeOnDrop for SymmetricCryptoKey {} - -impl SymmetricCryptoKey { - const KEY_LEN: usize = 32; - const MAC_LEN: usize = 32; - - /// Generate a new random [SymmetricCryptoKey] - pub fn generate(mut rng: impl rand::RngCore) -> Self { - let mut key = Box::pin(GenericArray::::default()); - let mut mac_key = Box::pin(GenericArray::::default()); - - rng.fill(key.as_mut_slice()); - rng.fill(mac_key.as_mut_slice()); - - SymmetricCryptoKey { - key, - mac_key: Some(mac_key), - } - } - - pub(crate) fn new( - key: Pin>>, - mac_key: Option>>>, - ) -> Self { - Self { key, mac_key } - } - - fn total_len(&self) -> usize { - self.key.len() + self.mac_key.as_ref().map_or(0, |mac| mac.len()) - } - - pub fn to_base64(&self) -> String { - STANDARD.encode(self.to_vec()) - } - - pub fn to_vec(&self) -> Vec { - let mut buf = Vec::with_capacity(self.total_len()); - - buf.extend_from_slice(&self.key); - if let Some(mac) = &self.mac_key { - buf.extend_from_slice(mac); - } - buf - } -} - -impl TryFrom for SymmetricCryptoKey { - type Error = CryptoError; - - fn try_from(value: String) -> Result { - let b = STANDARD - .decode(value) - .map_err(|_| CryptoError::InvalidKey)?; - SymmetricCryptoKey::try_from(b) - } -} - -impl TryFrom> for SymmetricCryptoKey { - type Error = CryptoError; - - fn try_from(mut value: Vec) -> Result { - SymmetricCryptoKey::try_from(value.as_mut_slice()) - } -} - -impl TryFrom<&mut [u8]> for SymmetricCryptoKey { - type Error = CryptoError; - - /// Note: This function takes the byte slice by mutable reference and will zero out all - /// the data in it. This is to prevent the key from being left in memory. - fn try_from(value: &mut [u8]) -> Result { - let result = if value.len() == Self::KEY_LEN + Self::MAC_LEN { - let mut key = Box::pin(GenericArray::::default()); - let mut mac_key = Box::pin(GenericArray::::default()); - - key.copy_from_slice(&value[..Self::KEY_LEN]); - mac_key.copy_from_slice(&value[Self::KEY_LEN..]); - - Ok(SymmetricCryptoKey { - key, - mac_key: Some(mac_key), - }) - } else if value.len() == Self::KEY_LEN { - let mut key = Box::pin(GenericArray::::default()); - - key.copy_from_slice(&value[..Self::KEY_LEN]); - - Ok(SymmetricCryptoKey { key, mac_key: None }) - } else { - Err(CryptoError::InvalidKeyLen) - }; - - value.zeroize(); - result - } -} - -impl CryptoKey for SymmetricCryptoKey {} - -// We manually implement these to make sure we don't print any sensitive data -impl std::fmt::Debug for SymmetricCryptoKey { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("SymmetricCryptoKey").finish() - } -} - -#[cfg(test)] -pub fn derive_symmetric_key(name: &str) -> SymmetricCryptoKey { - use zeroize::Zeroizing; - - use crate::{derive_shareable_key, generate_random_bytes}; - - let secret: Zeroizing<[u8; 16]> = generate_random_bytes(); - derive_shareable_key(secret, name, None) -} - -#[cfg(test)] -mod tests { - use super::{derive_symmetric_key, SymmetricCryptoKey}; - - #[test] - fn test_symmetric_crypto_key() { - let key = derive_symmetric_key("test"); - let key2 = SymmetricCryptoKey::try_from(key.to_base64()).unwrap(); - assert_eq!(key.key, key2.key); - assert_eq!(key.mac_key, key2.mac_key); - - let key = "UY4B5N4DA4UisCNClgZtRr6VLy9ZF5BXXC7cDZRqourKi4ghEMgISbCsubvgCkHf5DZctQjVot11/vVvN9NNHQ==".to_string(); - let key2 = SymmetricCryptoKey::try_from(key.clone()).unwrap(); - assert_eq!(key, key2.to_base64()); - } -} diff --git a/crates/bitwarden-crypto/src/keys/user_key.rs b/crates/bitwarden-crypto/src/keys/user_key.rs deleted file mode 100644 index 6620236ec..000000000 --- a/crates/bitwarden-crypto/src/keys/user_key.rs +++ /dev/null @@ -1,19 +0,0 @@ -use crate::{ - rsa::{make_key_pair, RsaKeyPair}, - Result, SymmetricCryptoKey, -}; - -/// User Key -/// -/// The User Key is the symmetric encryption key used to decrypt the user's vault. -pub struct UserKey(pub SymmetricCryptoKey); - -impl UserKey { - pub fn new(key: SymmetricCryptoKey) -> Self { - Self(key) - } - - pub fn make_key_pair(&self) -> Result { - make_key_pair(&self.0) - } -} diff --git a/crates/bitwarden-crypto/src/keys/utils.rs b/crates/bitwarden-crypto/src/keys/utils.rs deleted file mode 100644 index 4b2c4c8cd..000000000 --- a/crates/bitwarden-crypto/src/keys/utils.rs +++ /dev/null @@ -1,147 +0,0 @@ -use std::pin::Pin; - -use generic_array::{typenum::U32, GenericArray}; -use sha2::Digest; - -use crate::{util::hkdf_expand, CryptoError, Kdf, Result, SymmetricCryptoKey}; - -const PBKDF2_MIN_ITERATIONS: u32 = 5000; - -const ARGON2ID_MIN_MEMORY: u32 = 16 * 1024; -const ARGON2ID_MIN_ITERATIONS: u32 = 2; -const ARGON2ID_MIN_PARALLELISM: u32 = 1; - -/// Derive a generic key from a secret and salt using the provided KDF. -pub(super) fn derive_kdf_key(secret: &[u8], salt: &[u8], kdf: &Kdf) -> Result { - let mut hash = match kdf { - Kdf::PBKDF2 { iterations } => { - let iterations = iterations.get(); - if iterations < PBKDF2_MIN_ITERATIONS { - return Err(CryptoError::InsufficientKdfParameters); - } - - crate::util::pbkdf2(secret, salt, iterations) - } - Kdf::Argon2id { - iterations, - memory, - parallelism, - } => { - let memory = memory.get() * 1024; // Convert MiB to KiB; - let iterations = iterations.get(); - let parallelism = parallelism.get(); - - if memory < ARGON2ID_MIN_MEMORY - || iterations < ARGON2ID_MIN_ITERATIONS - || parallelism < ARGON2ID_MIN_PARALLELISM - { - return Err(CryptoError::InsufficientKdfParameters); - } - - use argon2::*; - - let params = Params::new(memory, iterations, parallelism, Some(32))?; - let argon = Argon2::new(Algorithm::Argon2id, Version::V0x13, params); - - let salt_sha = sha2::Sha256::new().chain_update(salt).finalize(); - - let mut hash = [0u8; 32]; - argon.hash_password_into(secret, &salt_sha, &mut hash)?; - - // Argon2 is using some stack memory that is not zeroed. Eventually some function will - // overwrite the stack, but we use this trick to force the used stack to be zeroed. - #[inline(never)] - fn clear_stack() { - std::hint::black_box([0u8; 4096]); - } - clear_stack(); - - hash - } - }; - SymmetricCryptoKey::try_from(hash.as_mut_slice()) -} - -/// Stretch the given key using HKDF. -pub(super) fn stretch_kdf_key(k: &SymmetricCryptoKey) -> Result { - let key: Pin>> = hkdf_expand(&k.key, Some("enc"))?; - let mac_key: Pin>> = hkdf_expand(&k.key, Some("mac"))?; - - Ok(SymmetricCryptoKey::new(key, Some(mac_key))) -} - -#[cfg(test)] -mod tests { - use std::num::NonZero; - - use super::*; - - #[test] - fn test_stretch_kdf_key() { - let key = SymmetricCryptoKey::new( - Box::pin( - [ - 31, 79, 104, 226, 150, 71, 177, 90, 194, 80, 172, 209, 17, 129, 132, 81, 138, - 167, 69, 167, 254, 149, 2, 27, 39, 197, 64, 42, 22, 195, 86, 75, - ] - .into(), - ), - None, - ); - - let stretched = stretch_kdf_key(&key).unwrap(); - - assert_eq!( - [ - 111, 31, 178, 45, 238, 152, 37, 114, 143, 215, 124, 83, 135, 173, 195, 23, 142, - 134, 120, 249, 61, 132, 163, 182, 113, 197, 189, 204, 188, 21, 237, 96 - ], - stretched.key.as_slice() - ); - assert_eq!( - [ - 221, 127, 206, 234, 101, 27, 202, 38, 86, 52, 34, 28, 78, 28, 185, 16, 48, 61, 127, - 166, 209, 247, 194, 87, 232, 26, 48, 85, 193, 249, 179, 155 - ], - stretched.mac_key.as_ref().unwrap().as_slice() - ); - } - - #[test] - fn test_derive_kdf_minimums() { - fn nz(n: u32) -> NonZero { - NonZero::new(n).unwrap() - } - - let secret = [0u8; 32]; - let salt = [0u8; 32]; - - for kdf in [ - Kdf::PBKDF2 { - iterations: nz(4999), - }, - Kdf::Argon2id { - iterations: nz(1), - memory: nz(16), - parallelism: nz(1), - }, - Kdf::Argon2id { - iterations: nz(2), - memory: nz(15), - parallelism: nz(1), - }, - Kdf::Argon2id { - iterations: nz(1), - memory: nz(15), - parallelism: nz(1), - }, - ] { - assert_eq!( - derive_kdf_key(&secret, &salt, &kdf) - .unwrap_err() - .to_string(), - "Insufficient KDF parameters" - ); - } - } -} diff --git a/crates/bitwarden-crypto/src/lib.rs b/crates/bitwarden-crypto/src/lib.rs deleted file mode 100644 index 44efaac30..000000000 --- a/crates/bitwarden-crypto/src/lib.rs +++ /dev/null @@ -1,90 +0,0 @@ -//! # Bitwarden Cryptographic primitives -//! -//! This crate contains the cryptographic primitives used throughout the SDK. The general -//! aspiration is for this crate to handle all the difficult cryptographic operations and expose -//! higher level concepts to the rest of the SDK. -//! -//!
-//! Generally you should not find yourself needing to edit this crate! Everything written -//! here requires additional care and attention to ensure that the cryptographic primitives are -//! secure.
-//! -//! ## Example: -//! -//! ```rust -//! use bitwarden_crypto::{SymmetricCryptoKey, KeyEncryptable, KeyDecryptable, CryptoError}; -//! -//! async fn example() -> Result<(), CryptoError> { -//! let key = SymmetricCryptoKey::generate(rand::thread_rng()); -//! -//! let data = "Hello, World!".to_owned(); -//! let encrypted = data.clone().encrypt_with_key(&key)?; -//! let decrypted: String = encrypted.decrypt_with_key(&key)?; -//! -//! assert_eq!(data, decrypted); -//! Ok(()) -//! } -//! ``` -//! -//! ## Development considerations -//! -//! This crate is expected to provide long term support for cryptographic operations. To that end, -//! the following considerations should be taken into account when making changes to this crate: -//! -//! - Limit public interfaces to the bare minimum. -//! - Breaking changes should be rare and well communicated. -//! - Serializable representation of keys and encrypted data must be supported indefinitely as we -//! have no way to update all data. -//! -//! ### Conventions: -//! -//! - Pure Functions that deterministically "derive" keys from input are prefixed with `derive_`. -//! - Functions that generate non deterministically keys are prefixed with `make_`. -//! -//! ### Differences from `clients` -//! -//! There are some noteworthy differences compared to the other Bitwarden -//! [clients](https://github.com/bitwarden/clients). These changes are made in an effort to -//! introduce conventions in how we name things, improve best practices and abstracting away -//! internal complexity. -//! -//! - `CryptoService.makeSendKey` & `AccessService.createAccessToken` are replaced by the generic -//! `derive_shareable_key` -//! - MasterKey operations such as `makeMasterKey` and `hashMasterKey` are moved to the MasterKey -//! struct. -//! -//! ## Crate features -//! -//! - `no-memory-hardening` - Disables memory hardening which ensures that allocated memory is -//! zeroed on drop. This feature primarily exists in case you do not want to use the standard -//! allocator, and we advise to still define a `global_allocator` using the -//! [`ZeroizingAllocator`]. - -#[cfg(not(feature = "no-memory-hardening"))] -#[global_allocator] -static ALLOC: ZeroizingAllocator = ZeroizingAllocator(std::alloc::System); - -mod aes; -mod enc_string; -pub use enc_string::{AsymmetricEncString, EncString}; -mod error; -pub use error::CryptoError; -pub(crate) use error::Result; -mod fingerprint; -pub use fingerprint::fingerprint; -mod keys; -pub use keys::*; -mod rsa; -pub use crate::rsa::RsaKeyPair; -mod util; -pub use util::{generate_random_alphanumeric, generate_random_bytes, pbkdf2}; -mod wordlist; -pub use wordlist::EFF_LONG_WORD_LIST; -mod allocator; -pub use allocator::ZeroizingAllocator; - -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); - -#[cfg(feature = "uniffi")] -mod uniffi_support; diff --git a/crates/bitwarden-crypto/src/rsa.rs b/crates/bitwarden-crypto/src/rsa.rs deleted file mode 100644 index e9cc2e5fd..000000000 --- a/crates/bitwarden-crypto/src/rsa.rs +++ /dev/null @@ -1,60 +0,0 @@ -use base64::{engine::general_purpose::STANDARD, Engine}; -use rsa::{ - pkcs8::{EncodePrivateKey, EncodePublicKey}, - Oaep, RsaPrivateKey, RsaPublicKey, -}; -use sha1::Sha1; - -use crate::{ - error::{Result, RsaError}, - CryptoError, EncString, SymmetricCryptoKey, -}; - -/// RSA Key Pair -/// -/// Consists of a public key and an encrypted private key. -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct RsaKeyPair { - /// Base64 encoded DER representation of the public key - pub public: String, - /// Encrypted PKCS8 private key - pub private: EncString, -} - -/// Generate a new RSA key pair of 2048 bits -pub(crate) fn make_key_pair(key: &SymmetricCryptoKey) -> Result { - let mut rng = rand::thread_rng(); - let bits = 2048; - let priv_key = RsaPrivateKey::new(&mut rng, bits).expect("failed to generate a key"); - let pub_key = RsaPublicKey::from(&priv_key); - - let spki = pub_key - .to_public_key_der() - .map_err(|_| RsaError::CreatePublicKey)?; - - let b64 = STANDARD.encode(spki.as_bytes()); - let pkcs = priv_key - .to_pkcs8_der() - .map_err(|_| RsaError::CreatePrivateKey)?; - - let protected = EncString::encrypt_aes256_hmac( - pkcs.as_bytes(), - key.mac_key.as_ref().ok_or(CryptoError::InvalidMac)?, - &key.key, - )?; - - Ok(RsaKeyPair { - public: b64, - private: protected, - }) -} - -/// Encrypt data using RSA-OAEP-SHA1 with a 2048 bit key -pub(super) fn encrypt_rsa2048_oaep_sha1(public_key: &RsaPublicKey, data: &[u8]) -> Result> { - let mut rng = rand::thread_rng(); - - let padding = Oaep::new::(); - public_key - .encrypt(&mut rng, padding, data) - .map_err(|e| CryptoError::RsaError(e.into())) -} diff --git a/crates/bitwarden-crypto/src/uniffi_support.rs b/crates/bitwarden-crypto/src/uniffi_support.rs deleted file mode 100644 index 7f1249da0..000000000 --- a/crates/bitwarden-crypto/src/uniffi_support.rs +++ /dev/null @@ -1,45 +0,0 @@ -use std::{num::NonZeroU32, str::FromStr}; - -use crate::{AsymmetricEncString, CryptoError, EncString, UniffiCustomTypeConverter}; - -uniffi::custom_type!(NonZeroU32, u32); - -impl UniffiCustomTypeConverter for NonZeroU32 { - type Builtin = u32; - - fn into_custom(val: Self::Builtin) -> uniffi::Result { - Self::new(val).ok_or(CryptoError::ZeroNumber.into()) - } - - fn from_custom(obj: Self) -> Self::Builtin { - obj.get() - } -} - -uniffi::custom_type!(EncString, String); - -impl UniffiCustomTypeConverter for EncString { - type Builtin = String; - - fn into_custom(val: Self::Builtin) -> uniffi::Result { - val.parse().map_err(|e: CryptoError| e.into()) - } - - fn from_custom(obj: Self) -> Self::Builtin { - obj.to_string() - } -} - -uniffi::custom_type!(AsymmetricEncString, String); - -impl UniffiCustomTypeConverter for AsymmetricEncString { - type Builtin = String; - - fn into_custom(val: Self::Builtin) -> uniffi::Result { - Self::from_str(&val).map_err(|e| e.into()) - } - - fn from_custom(obj: Self) -> Self::Builtin { - obj.to_string() - } -} diff --git a/crates/bitwarden-crypto/src/util.rs b/crates/bitwarden-crypto/src/util.rs deleted file mode 100644 index d1ba5cdad..000000000 --- a/crates/bitwarden-crypto/src/util.rs +++ /dev/null @@ -1,81 +0,0 @@ -use std::pin::Pin; - -use ::aes::cipher::{ArrayLength, Unsigned}; -use generic_array::GenericArray; -use hmac::digest::OutputSizeUser; -use rand::{ - distributions::{Alphanumeric, DistString, Distribution, Standard}, - Rng, -}; -use zeroize::{Zeroize, Zeroizing}; - -use crate::{CryptoError, Result}; - -pub(crate) type PbkdfSha256Hmac = hmac::Hmac; -pub(crate) const PBKDF_SHA256_HMAC_OUT_SIZE: usize = - <::OutputSize as Unsigned>::USIZE; - -/// [RFC5869](https://datatracker.ietf.org/doc/html/rfc5869) HKDF-Expand operation -pub(crate) fn hkdf_expand>( - prk: &[u8], - info: Option<&str>, -) -> Result>>> { - let hkdf = hkdf::Hkdf::::from_prk(prk).map_err(|_| CryptoError::InvalidKeyLen)?; - let mut key = Box::>::default(); - - let i = info.map(|i| i.as_bytes()).unwrap_or(&[]); - hkdf.expand(i, &mut key) - .map_err(|_| CryptoError::InvalidKeyLen)?; - - Ok(Box::into_pin(key)) -} - -/// Generate random bytes that are cryptographically secure -pub fn generate_random_bytes() -> Zeroizing -where - Standard: Distribution, - T: Zeroize, -{ - Zeroizing::new(rand::thread_rng().gen::()) -} - -/// Generate a random alphanumeric string of a given length -/// -/// Note: Do not use this generating user facing passwords. Use the `bitwarden-generator` crate for -/// that. -pub fn generate_random_alphanumeric(len: usize) -> String { - Alphanumeric.sample_string(&mut rand::thread_rng(), len) -} - -/// Derive pbkdf2 of a given password and salt -pub fn pbkdf2(password: &[u8], salt: &[u8], rounds: u32) -> [u8; PBKDF_SHA256_HMAC_OUT_SIZE] { - pbkdf2::pbkdf2_array::(password, salt, rounds) - .expect("hash is a valid fixed size") -} - -#[cfg(test)] -mod tests { - use aes::cipher::typenum::U64; - - use super::*; - - #[test] - fn test_hkdf_expand() { - let prk = &[ - 23, 152, 120, 41, 214, 16, 156, 133, 71, 226, 178, 135, 208, 255, 66, 101, 189, 70, - 173, 30, 39, 215, 175, 236, 38, 180, 180, 62, 196, 4, 159, 70, - ]; - let info = Some("info"); - - let result: Pin>> = hkdf_expand(prk, info).unwrap(); - - let expected_output: [u8; 64] = [ - 6, 114, 42, 38, 87, 231, 30, 109, 30, 255, 104, 129, 255, 94, 92, 108, 124, 145, 215, - 208, 17, 60, 135, 22, 70, 158, 40, 53, 45, 182, 8, 63, 65, 87, 239, 234, 185, 227, 153, - 122, 115, 205, 144, 56, 102, 149, 92, 139, 217, 102, 119, 57, 37, 57, 251, 178, 18, 52, - 94, 77, 132, 215, 239, 100, - ]; - - assert_eq!(result.as_slice(), expected_output); - } -} diff --git a/crates/bitwarden-crypto/src/wordlist.rs b/crates/bitwarden-crypto/src/wordlist.rs deleted file mode 100644 index f1e7a59c0..000000000 --- a/crates/bitwarden-crypto/src/wordlist.rs +++ /dev/null @@ -1,7779 +0,0 @@ -/// EFF's Long Wordlist from -pub const EFF_LONG_WORD_LIST: &[&str] = &[ - "abacus", - "abdomen", - "abdominal", - "abide", - "abiding", - "ability", - "ablaze", - "able", - "abnormal", - "abrasion", - "abrasive", - "abreast", - "abridge", - "abroad", - "abruptly", - "absence", - "absentee", - "absently", - "absinthe", - "absolute", - "absolve", - "abstain", - "abstract", - "absurd", - "accent", - "acclaim", - "acclimate", - "accompany", - "account", - "accuracy", - "accurate", - "accustom", - "acetone", - "achiness", - "aching", - "acid", - "acorn", - "acquaint", - "acquire", - "acre", - "acrobat", - "acronym", - "acting", - "action", - "activate", - "activator", - "active", - "activism", - "activist", - "activity", - "actress", - "acts", - "acutely", - "acuteness", - "aeration", - "aerobics", - "aerosol", - "aerospace", - "afar", - "affair", - "affected", - "affecting", - "affection", - "affidavit", - "affiliate", - "affirm", - "affix", - "afflicted", - "affluent", - "afford", - "affront", - "aflame", - "afloat", - "aflutter", - "afoot", - "afraid", - "afterglow", - "afterlife", - "aftermath", - "aftermost", - "afternoon", - "aged", - "ageless", - "agency", - "agenda", - "agent", - "aggregate", - "aghast", - "agile", - "agility", - "aging", - "agnostic", - "agonize", - "agonizing", - "agony", - "agreeable", - "agreeably", - "agreed", - "agreeing", - "agreement", - "aground", - "ahead", - "ahoy", - "aide", - "aids", - "aim", - "ajar", - "alabaster", - "alarm", - "albatross", - "album", - "alfalfa", - "algebra", - "algorithm", - "alias", - "alibi", - "alienable", - "alienate", - "aliens", - "alike", - "alive", - "alkaline", - "alkalize", - "almanac", - "almighty", - "almost", - "aloe", - "aloft", - "aloha", - "alone", - "alongside", - "aloof", - "alphabet", - "alright", - "although", - "altitude", - "alto", - "aluminum", - "alumni", - "always", - "amaretto", - "amaze", - "amazingly", - "amber", - "ambiance", - "ambiguity", - "ambiguous", - "ambition", - "ambitious", - "ambulance", - "ambush", - "amendable", - "amendment", - "amends", - "amenity", - "amiable", - "amicably", - "amid", - "amigo", - "amino", - "amiss", - "ammonia", - "ammonium", - "amnesty", - "amniotic", - "among", - "amount", - "amperage", - "ample", - "amplifier", - "amplify", - "amply", - "amuck", - "amulet", - "amusable", - "amused", - "amusement", - "amuser", - "amusing", - "anaconda", - "anaerobic", - "anagram", - "anatomist", - "anatomy", - "anchor", - "anchovy", - "ancient", - "android", - "anemia", - "anemic", - "aneurism", - "anew", - "angelfish", - "angelic", - "anger", - "angled", - "angler", - "angles", - "angling", - "angrily", - "angriness", - "anguished", - "angular", - "animal", - "animate", - "animating", - "animation", - "animator", - "anime", - "animosity", - "ankle", - "annex", - "annotate", - "announcer", - "annoying", - "annually", - "annuity", - "anointer", - "another", - "answering", - "antacid", - "antarctic", - "anteater", - "antelope", - "antennae", - "anthem", - "anthill", - "anthology", - "antibody", - "antics", - "antidote", - "antihero", - "antiquely", - "antiques", - "antiquity", - "antirust", - "antitoxic", - "antitrust", - "antiviral", - "antivirus", - "antler", - "antonym", - "antsy", - "anvil", - "anybody", - "anyhow", - "anymore", - "anyone", - "anyplace", - "anything", - "anytime", - "anyway", - "anywhere", - "aorta", - "apache", - "apostle", - "appealing", - "appear", - "appease", - "appeasing", - "appendage", - "appendix", - "appetite", - "appetizer", - "applaud", - "applause", - "apple", - "appliance", - "applicant", - "applied", - "apply", - "appointee", - "appraisal", - "appraiser", - "apprehend", - "approach", - "approval", - "approve", - "apricot", - "april", - "apron", - "aptitude", - "aptly", - "aqua", - "aqueduct", - "arbitrary", - "arbitrate", - "ardently", - "area", - "arena", - "arguable", - "arguably", - "argue", - "arise", - "armadillo", - "armband", - "armchair", - "armed", - "armful", - "armhole", - "arming", - "armless", - "armoire", - "armored", - "armory", - "armrest", - "army", - "aroma", - "arose", - "around", - "arousal", - "arrange", - "array", - "arrest", - "arrival", - "arrive", - "arrogance", - "arrogant", - "arson", - "art", - "ascend", - "ascension", - "ascent", - "ascertain", - "ashamed", - "ashen", - "ashes", - "ashy", - "aside", - "askew", - "asleep", - "asparagus", - "aspect", - "aspirate", - "aspire", - "aspirin", - "astonish", - "astound", - "astride", - "astrology", - "astronaut", - "astronomy", - "astute", - "atlantic", - "atlas", - "atom", - "atonable", - "atop", - "atrium", - "atrocious", - "atrophy", - "attach", - "attain", - "attempt", - "attendant", - "attendee", - "attention", - "attentive", - "attest", - "attic", - "attire", - "attitude", - "attractor", - "attribute", - "atypical", - "auction", - "audacious", - "audacity", - "audible", - "audibly", - "audience", - "audio", - "audition", - "augmented", - "august", - "authentic", - "author", - "autism", - "autistic", - "autograph", - "automaker", - "automated", - "automatic", - "autopilot", - "available", - "avalanche", - "avatar", - "avenge", - "avenging", - "avenue", - "average", - "aversion", - "avert", - "aviation", - "aviator", - "avid", - "avoid", - "await", - "awaken", - "award", - "aware", - "awhile", - "awkward", - "awning", - "awoke", - "awry", - "axis", - "babble", - "babbling", - "babied", - "baboon", - "backache", - "backboard", - "backboned", - "backdrop", - "backed", - "backer", - "backfield", - "backfire", - "backhand", - "backing", - "backlands", - "backlash", - "backless", - "backlight", - "backlit", - "backlog", - "backpack", - "backpedal", - "backrest", - "backroom", - "backshift", - "backside", - "backslid", - "backspace", - "backspin", - "backstab", - "backstage", - "backtalk", - "backtrack", - "backup", - "backward", - "backwash", - "backwater", - "backyard", - "bacon", - "bacteria", - "bacterium", - "badass", - "badge", - "badland", - "badly", - "badness", - "baffle", - "baffling", - "bagel", - "bagful", - "baggage", - "bagged", - "baggie", - "bagginess", - "bagging", - "baggy", - "bagpipe", - "baguette", - "baked", - "bakery", - "bakeshop", - "baking", - "balance", - "balancing", - "balcony", - "balmy", - "balsamic", - "bamboo", - "banana", - "banish", - "banister", - "banjo", - "bankable", - "bankbook", - "banked", - "banker", - "banking", - "banknote", - "bankroll", - "banner", - "bannister", - "banshee", - "banter", - "barbecue", - "barbed", - "barbell", - "barber", - "barcode", - "barge", - "bargraph", - "barista", - "baritone", - "barley", - "barmaid", - "barman", - "barn", - "barometer", - "barrack", - "barracuda", - "barrel", - "barrette", - "barricade", - "barrier", - "barstool", - "bartender", - "barterer", - "bash", - "basically", - "basics", - "basil", - "basin", - "basis", - "basket", - "batboy", - "batch", - "bath", - "baton", - "bats", - "battalion", - "battered", - "battering", - "battery", - "batting", - "battle", - "bauble", - "bazooka", - "blabber", - "bladder", - "blade", - "blah", - "blame", - "blaming", - "blanching", - "blandness", - "blank", - "blaspheme", - "blasphemy", - "blast", - "blatancy", - "blatantly", - "blazer", - "blazing", - "bleach", - "bleak", - "bleep", - "blemish", - "blend", - "bless", - "blighted", - "blimp", - "bling", - "blinked", - "blinker", - "blinking", - "blinks", - "blip", - "blissful", - "blitz", - "blizzard", - "bloated", - "bloating", - "blob", - "blog", - "bloomers", - "blooming", - "blooper", - "blot", - "blouse", - "blubber", - "bluff", - "bluish", - "blunderer", - "blunt", - "blurb", - "blurred", - "blurry", - "blurt", - "blush", - "blustery", - "boaster", - "boastful", - "boasting", - "boat", - "bobbed", - "bobbing", - "bobble", - "bobcat", - "bobsled", - "bobtail", - "bodacious", - "body", - "bogged", - "boggle", - "bogus", - "boil", - "bok", - "bolster", - "bolt", - "bonanza", - "bonded", - "bonding", - "bondless", - "boned", - "bonehead", - "boneless", - "bonelike", - "boney", - "bonfire", - "bonnet", - "bonsai", - "bonus", - "bony", - "boogeyman", - "boogieman", - "book", - "boondocks", - "booted", - "booth", - "bootie", - "booting", - "bootlace", - "bootleg", - "boots", - "boozy", - "borax", - "boring", - "borough", - "borrower", - "borrowing", - "boss", - "botanical", - "botanist", - "botany", - "botch", - "both", - "bottle", - "bottling", - "bottom", - "bounce", - "bouncing", - "bouncy", - "bounding", - "boundless", - "bountiful", - "bovine", - "boxcar", - "boxer", - "boxing", - "boxlike", - "boxy", - "breach", - "breath", - "breeches", - "breeching", - "breeder", - "breeding", - "breeze", - "breezy", - "brethren", - "brewery", - "brewing", - "briar", - "bribe", - "brick", - "bride", - "bridged", - "brigade", - "bright", - "brilliant", - "brim", - "bring", - "brink", - "brisket", - "briskly", - "briskness", - "bristle", - "brittle", - "broadband", - "broadcast", - "broaden", - "broadly", - "broadness", - "broadside", - "broadways", - "broiler", - "broiling", - "broken", - "broker", - "bronchial", - "bronco", - "bronze", - "bronzing", - "brook", - "broom", - "brought", - "browbeat", - "brownnose", - "browse", - "browsing", - "bruising", - "brunch", - "brunette", - "brunt", - "brush", - "brussels", - "brute", - "brutishly", - "bubble", - "bubbling", - "bubbly", - "buccaneer", - "bucked", - "bucket", - "buckle", - "buckshot", - "buckskin", - "bucktooth", - "buckwheat", - "buddhism", - "buddhist", - "budding", - "buddy", - "budget", - "buffalo", - "buffed", - "buffer", - "buffing", - "buffoon", - "buggy", - "bulb", - "bulge", - "bulginess", - "bulgur", - "bulk", - "bulldog", - "bulldozer", - "bullfight", - "bullfrog", - "bullhorn", - "bullion", - "bullish", - "bullpen", - "bullring", - "bullseye", - "bullwhip", - "bully", - "bunch", - "bundle", - "bungee", - "bunion", - "bunkbed", - "bunkhouse", - "bunkmate", - "bunny", - "bunt", - "busboy", - "bush", - "busily", - "busload", - "bust", - "busybody", - "buzz", - "cabana", - "cabbage", - "cabbie", - "cabdriver", - "cable", - "caboose", - "cache", - "cackle", - "cacti", - "cactus", - "caddie", - "caddy", - "cadet", - "cadillac", - "cadmium", - "cage", - "cahoots", - "cake", - "calamari", - "calamity", - "calcium", - "calculate", - "calculus", - "caliber", - "calibrate", - "calm", - "caloric", - "calorie", - "calzone", - "camcorder", - "cameo", - "camera", - "camisole", - "camper", - "campfire", - "camping", - "campsite", - "campus", - "canal", - "canary", - "cancel", - "candied", - "candle", - "candy", - "cane", - "canine", - "canister", - "cannabis", - "canned", - "canning", - "cannon", - "cannot", - "canola", - "canon", - "canopener", - "canopy", - "canteen", - "canyon", - "capable", - "capably", - "capacity", - "cape", - "capillary", - "capital", - "capitol", - "capped", - "capricorn", - "capsize", - "capsule", - "caption", - "captivate", - "captive", - "captivity", - "capture", - "caramel", - "carat", - "caravan", - "carbon", - "cardboard", - "carded", - "cardiac", - "cardigan", - "cardinal", - "cardstock", - "carefully", - "caregiver", - "careless", - "caress", - "caretaker", - "cargo", - "caring", - "carless", - "carload", - "carmaker", - "carnage", - "carnation", - "carnival", - "carnivore", - "carol", - "carpenter", - "carpentry", - "carpool", - "carport", - "carried", - "carrot", - "carrousel", - "carry", - "cartel", - "cartload", - "carton", - "cartoon", - "cartridge", - "cartwheel", - "carve", - "carving", - "carwash", - "cascade", - "case", - "cash", - "casing", - "casino", - "casket", - "cassette", - "casually", - "casualty", - "catacomb", - "catalog", - "catalyst", - "catalyze", - "catapult", - "cataract", - "catatonic", - "catcall", - "catchable", - "catcher", - "catching", - "catchy", - "caterer", - "catering", - "catfight", - "catfish", - "cathedral", - "cathouse", - "catlike", - "catnap", - "catnip", - "catsup", - "cattail", - "cattishly", - "cattle", - "catty", - "catwalk", - "caucasian", - "caucus", - "causal", - "causation", - "cause", - "causing", - "cauterize", - "caution", - "cautious", - "cavalier", - "cavalry", - "caviar", - "cavity", - "cedar", - "celery", - "celestial", - "celibacy", - "celibate", - "celtic", - "cement", - "census", - "ceramics", - "ceremony", - "certainly", - "certainty", - "certified", - "certify", - "cesarean", - "cesspool", - "chafe", - "chaffing", - "chain", - "chair", - "chalice", - "challenge", - "chamber", - "chamomile", - "champion", - "chance", - "change", - "channel", - "chant", - "chaos", - "chaperone", - "chaplain", - "chapped", - "chaps", - "chapter", - "character", - "charbroil", - "charcoal", - "charger", - "charging", - "chariot", - "charity", - "charm", - "charred", - "charter", - "charting", - "chase", - "chasing", - "chaste", - "chastise", - "chastity", - "chatroom", - "chatter", - "chatting", - "chatty", - "cheating", - "cheddar", - "cheek", - "cheer", - "cheese", - "cheesy", - "chef", - "chemicals", - "chemist", - "chemo", - "cherisher", - "cherub", - "chess", - "chest", - "chevron", - "chevy", - "chewable", - "chewer", - "chewing", - "chewy", - "chief", - "chihuahua", - "childcare", - "childhood", - "childish", - "childless", - "childlike", - "chili", - "chill", - "chimp", - "chip", - "chirping", - "chirpy", - "chitchat", - "chivalry", - "chive", - "chloride", - "chlorine", - "choice", - "chokehold", - "choking", - "chomp", - "chooser", - "choosing", - "choosy", - "chop", - "chosen", - "chowder", - "chowtime", - "chrome", - "chubby", - "chuck", - "chug", - "chummy", - "chump", - "chunk", - "churn", - "chute", - "cider", - "cilantro", - "cinch", - "cinema", - "cinnamon", - "circle", - "circling", - "circular", - "circulate", - "circus", - "citable", - "citadel", - "citation", - "citizen", - "citric", - "citrus", - "city", - "civic", - "civil", - "clad", - "claim", - "clambake", - "clammy", - "clamor", - "clamp", - "clamshell", - "clang", - "clanking", - "clapped", - "clapper", - "clapping", - "clarify", - "clarinet", - "clarity", - "clash", - "clasp", - "class", - "clatter", - "clause", - "clavicle", - "claw", - "clay", - "clean", - "clear", - "cleat", - "cleaver", - "cleft", - "clench", - "clergyman", - "clerical", - "clerk", - "clever", - "clicker", - "client", - "climate", - "climatic", - "cling", - "clinic", - "clinking", - "clip", - "clique", - "cloak", - "clobber", - "clock", - "clone", - "cloning", - "closable", - "closure", - "clothes", - "clothing", - "cloud", - "clover", - "clubbed", - "clubbing", - "clubhouse", - "clump", - "clumsily", - "clumsy", - "clunky", - "clustered", - "clutch", - "clutter", - "coach", - "coagulant", - "coastal", - "coaster", - "coasting", - "coastland", - "coastline", - "coat", - "coauthor", - "cobalt", - "cobbler", - "cobweb", - "cocoa", - "coconut", - "cod", - "coeditor", - "coerce", - "coexist", - "coffee", - "cofounder", - "cognition", - "cognitive", - "cogwheel", - "coherence", - "coherent", - "cohesive", - "coil", - "coke", - "cola", - "cold", - "coleslaw", - "coliseum", - "collage", - "collapse", - "collar", - "collected", - "collector", - "collide", - "collie", - "collision", - "colonial", - "colonist", - "colonize", - "colony", - "colossal", - "colt", - "coma", - "come", - "comfort", - "comfy", - "comic", - "coming", - "comma", - "commence", - "commend", - "comment", - "commerce", - "commode", - "commodity", - "commodore", - "common", - "commotion", - "commute", - "commuting", - "compacted", - "compacter", - "compactly", - "compactor", - "companion", - "company", - "compare", - "compel", - "compile", - "comply", - "component", - "composed", - "composer", - "composite", - "compost", - "composure", - "compound", - "compress", - "comprised", - "computer", - "computing", - "comrade", - "concave", - "conceal", - "conceded", - "concept", - "concerned", - "concert", - "conch", - "concierge", - "concise", - "conclude", - "concrete", - "concur", - "condense", - "condiment", - "condition", - "condone", - "conducive", - "conductor", - "conduit", - "cone", - "confess", - "confetti", - "confidant", - "confident", - "confider", - "confiding", - "configure", - "confined", - "confining", - "confirm", - "conflict", - "conform", - "confound", - "confront", - "confused", - "confusing", - "confusion", - "congenial", - "congested", - "congrats", - "congress", - "conical", - "conjoined", - "conjure", - "conjuror", - "connected", - "connector", - "consensus", - "consent", - "console", - "consoling", - "consonant", - "constable", - "constant", - "constrain", - "constrict", - "construct", - "consult", - "consumer", - "consuming", - "contact", - "container", - "contempt", - "contend", - "contented", - "contently", - "contents", - "contest", - "context", - "contort", - "contour", - "contrite", - "control", - "contusion", - "convene", - "convent", - "copartner", - "cope", - "copied", - "copier", - "copilot", - "coping", - "copious", - "copper", - "copy", - "coral", - "cork", - "cornball", - "cornbread", - "corncob", - "cornea", - "corned", - "corner", - "cornfield", - "cornflake", - "cornhusk", - "cornmeal", - "cornstalk", - "corny", - "coronary", - "coroner", - "corporal", - "corporate", - "corral", - "correct", - "corridor", - "corrode", - "corroding", - "corrosive", - "corsage", - "corset", - "cortex", - "cosigner", - "cosmetics", - "cosmic", - "cosmos", - "cosponsor", - "cost", - "cottage", - "cotton", - "couch", - "cough", - "could", - "countable", - "countdown", - "counting", - "countless", - "country", - "county", - "courier", - "covenant", - "cover", - "coveted", - "coveting", - "coyness", - "cozily", - "coziness", - "cozy", - "crabbing", - "crabgrass", - "crablike", - "crabmeat", - "cradle", - "cradling", - "crafter", - "craftily", - "craftsman", - "craftwork", - "crafty", - "cramp", - "cranberry", - "crane", - "cranial", - "cranium", - "crank", - "crate", - "crave", - "craving", - "crawfish", - "crawlers", - "crawling", - "crayfish", - "crayon", - "crazed", - "crazily", - "craziness", - "crazy", - "creamed", - "creamer", - "creamlike", - "crease", - "creasing", - "creatable", - "create", - "creation", - "creative", - "creature", - "credible", - "credibly", - "credit", - "creed", - "creme", - "creole", - "crepe", - "crept", - "crescent", - "crested", - "cresting", - "crestless", - "crevice", - "crewless", - "crewman", - "crewmate", - "crib", - "cricket", - "cried", - "crier", - "crimp", - "crimson", - "cringe", - "cringing", - "crinkle", - "crinkly", - "crisped", - "crisping", - "crisply", - "crispness", - "crispy", - "criteria", - "critter", - "croak", - "crock", - "crook", - "croon", - "crop", - "cross", - "crouch", - "crouton", - "crowbar", - "crowd", - "crown", - "crucial", - "crudely", - "crudeness", - "cruelly", - "cruelness", - "cruelty", - "crumb", - "crummiest", - "crummy", - "crumpet", - "crumpled", - "cruncher", - "crunching", - "crunchy", - "crusader", - "crushable", - "crushed", - "crusher", - "crushing", - "crust", - "crux", - "crying", - "cryptic", - "crystal", - "cubbyhole", - "cube", - "cubical", - "cubicle", - "cucumber", - "cuddle", - "cuddly", - "cufflink", - "culinary", - "culminate", - "culpable", - "culprit", - "cultivate", - "cultural", - "culture", - "cupbearer", - "cupcake", - "cupid", - "cupped", - "cupping", - "curable", - "curator", - "curdle", - "cure", - "curfew", - "curing", - "curled", - "curler", - "curliness", - "curling", - "curly", - "curry", - "curse", - "cursive", - "cursor", - "curtain", - "curtly", - "curtsy", - "curvature", - "curve", - "curvy", - "cushy", - "cusp", - "cussed", - "custard", - "custodian", - "custody", - "customary", - "customer", - "customize", - "customs", - "cut", - "cycle", - "cyclic", - "cycling", - "cyclist", - "cylinder", - "cymbal", - "cytoplasm", - "cytoplast", - "dab", - "dad", - "daffodil", - "dagger", - "daily", - "daintily", - "dainty", - "dairy", - "daisy", - "dallying", - "dance", - "dancing", - "dandelion", - "dander", - "dandruff", - "dandy", - "danger", - "dangle", - "dangling", - "daredevil", - "dares", - "daringly", - "darkened", - "darkening", - "darkish", - "darkness", - "darkroom", - "darling", - "darn", - "dart", - "darwinism", - "dash", - "dastardly", - "data", - "datebook", - "dating", - "daughter", - "daunting", - "dawdler", - "dawn", - "daybed", - "daybreak", - "daycare", - "daydream", - "daylight", - "daylong", - "dayroom", - "daytime", - "dazzler", - "dazzling", - "deacon", - "deafening", - "deafness", - "dealer", - "dealing", - "dealmaker", - "dealt", - "dean", - "debatable", - "debate", - "debating", - "debit", - "debrief", - "debtless", - "debtor", - "debug", - "debunk", - "decade", - "decaf", - "decal", - "decathlon", - "decay", - "deceased", - "deceit", - "deceiver", - "deceiving", - "december", - "decency", - "decent", - "deception", - "deceptive", - "decibel", - "decidable", - "decimal", - "decimeter", - "decipher", - "deck", - "declared", - "decline", - "decode", - "decompose", - "decorated", - "decorator", - "decoy", - "decrease", - "decree", - "dedicate", - "dedicator", - "deduce", - "deduct", - "deed", - "deem", - "deepen", - "deeply", - "deepness", - "deface", - "defacing", - "defame", - "default", - "defeat", - "defection", - "defective", - "defendant", - "defender", - "defense", - "defensive", - "deferral", - "deferred", - "defiance", - "defiant", - "defile", - "defiling", - "define", - "definite", - "deflate", - "deflation", - "deflator", - "deflected", - "deflector", - "defog", - "deforest", - "defraud", - "defrost", - "deftly", - "defuse", - "defy", - "degraded", - "degrading", - "degrease", - "degree", - "dehydrate", - "deity", - "dejected", - "delay", - "delegate", - "delegator", - "delete", - "deletion", - "delicacy", - "delicate", - "delicious", - "delighted", - "delirious", - "delirium", - "deliverer", - "delivery", - "delouse", - "delta", - "deluge", - "delusion", - "deluxe", - "demanding", - "demeaning", - "demeanor", - "demise", - "democracy", - "democrat", - "demote", - "demotion", - "demystify", - "denatured", - "deniable", - "denial", - "denim", - "denote", - "dense", - "density", - "dental", - "dentist", - "denture", - "deny", - "deodorant", - "deodorize", - "departed", - "departure", - "depict", - "deplete", - "depletion", - "deplored", - "deploy", - "deport", - "depose", - "depraved", - "depravity", - "deprecate", - "depress", - "deprive", - "depth", - "deputize", - "deputy", - "derail", - "deranged", - "derby", - "derived", - "desecrate", - "deserve", - "deserving", - "designate", - "designed", - "designer", - "designing", - "deskbound", - "desktop", - "deskwork", - "desolate", - "despair", - "despise", - "despite", - "destiny", - "destitute", - "destruct", - "detached", - "detail", - "detection", - "detective", - "detector", - "detention", - "detergent", - "detest", - "detonate", - "detonator", - "detoxify", - "detract", - "deuce", - "devalue", - "deviancy", - "deviant", - "deviate", - "deviation", - "deviator", - "device", - "devious", - "devotedly", - "devotee", - "devotion", - "devourer", - "devouring", - "devoutly", - "dexterity", - "dexterous", - "diabetes", - "diabetic", - "diabolic", - "diagnoses", - "diagnosis", - "diagram", - "dial", - "diameter", - "diaper", - "diaphragm", - "diary", - "dice", - "dicing", - "dictate", - "dictation", - "dictator", - "difficult", - "diffused", - "diffuser", - "diffusion", - "diffusive", - "dig", - "dilation", - "diligence", - "diligent", - "dill", - "dilute", - "dime", - "diminish", - "dimly", - "dimmed", - "dimmer", - "dimness", - "dimple", - "diner", - "dingbat", - "dinghy", - "dinginess", - "dingo", - "dingy", - "dining", - "dinner", - "diocese", - "dioxide", - "diploma", - "dipped", - "dipper", - "dipping", - "directed", - "direction", - "directive", - "directly", - "directory", - "direness", - "dirtiness", - "disabled", - "disagree", - "disallow", - "disarm", - "disarray", - "disaster", - "disband", - "disbelief", - "disburse", - "discard", - "discern", - "discharge", - "disclose", - "discolor", - "discount", - "discourse", - "discover", - "discuss", - "disdain", - "disengage", - "disfigure", - "disgrace", - "dish", - "disinfect", - "disjoin", - "disk", - "dislike", - "disliking", - "dislocate", - "dislodge", - "disloyal", - "dismantle", - "dismay", - "dismiss", - "dismount", - "disobey", - "disorder", - "disown", - "disparate", - "disparity", - "dispatch", - "dispense", - "dispersal", - "dispersed", - "disperser", - "displace", - "display", - "displease", - "disposal", - "dispose", - "disprove", - "dispute", - "disregard", - "disrupt", - "dissuade", - "distance", - "distant", - "distaste", - "distill", - "distinct", - "distort", - "distract", - "distress", - "district", - "distrust", - "ditch", - "ditto", - "ditzy", - "dividable", - "divided", - "dividend", - "dividers", - "dividing", - "divinely", - "diving", - "divinity", - "divisible", - "divisibly", - "division", - "divisive", - "divorcee", - "dizziness", - "dizzy", - "doable", - "docile", - "dock", - "doctrine", - "document", - "dodge", - "dodgy", - "doily", - "doing", - "dole", - "dollar", - "dollhouse", - "dollop", - "dolly", - "dolphin", - "domain", - "domelike", - "domestic", - "dominion", - "dominoes", - "donated", - "donation", - "donator", - "donor", - "donut", - "doodle", - "doorbell", - "doorframe", - "doorknob", - "doorman", - "doormat", - "doornail", - "doorpost", - "doorstep", - "doorstop", - "doorway", - "doozy", - "dork", - "dormitory", - "dorsal", - "dosage", - "dose", - "dotted", - "doubling", - "douche", - "dove", - "down", - "dowry", - "doze", - "drab", - "dragging", - "dragonfly", - "dragonish", - "dragster", - "drainable", - "drainage", - "drained", - "drainer", - "drainpipe", - "dramatic", - "dramatize", - "drank", - "drapery", - "drastic", - "draw", - "dreaded", - "dreadful", - "dreadlock", - "dreamboat", - "dreamily", - "dreamland", - "dreamless", - "dreamlike", - "dreamt", - "dreamy", - "drearily", - "dreary", - "drench", - "dress", - "drew", - "dribble", - "dried", - "drier", - "drift", - "driller", - "drilling", - "drinkable", - "drinking", - "dripping", - "drippy", - "drivable", - "driven", - "driver", - "driveway", - "driving", - "drizzle", - "drizzly", - "drone", - "drool", - "droop", - "drop-down", - "dropbox", - "dropkick", - "droplet", - "dropout", - "dropper", - "drove", - "drown", - "drowsily", - "drudge", - "drum", - "dry", - "dubbed", - "dubiously", - "duchess", - "duckbill", - "ducking", - "duckling", - "ducktail", - "ducky", - "duct", - "dude", - "duffel", - "dugout", - "duh", - "duke", - "duller", - "dullness", - "duly", - "dumping", - "dumpling", - "dumpster", - "duo", - "dupe", - "duplex", - "duplicate", - "duplicity", - "durable", - "durably", - "duration", - "duress", - "during", - "dusk", - "dust", - "dutiful", - "duty", - "duvet", - "dwarf", - "dweeb", - "dwelled", - "dweller", - "dwelling", - "dwindle", - "dwindling", - "dynamic", - "dynamite", - "dynasty", - "dyslexia", - "dyslexic", - "each", - "eagle", - "earache", - "eardrum", - "earflap", - "earful", - "earlobe", - "early", - "earmark", - "earmuff", - "earphone", - "earpiece", - "earplugs", - "earring", - "earshot", - "earthen", - "earthlike", - "earthling", - "earthly", - "earthworm", - "earthy", - "earwig", - "easeful", - "easel", - "easiest", - "easily", - "easiness", - "easing", - "eastbound", - "eastcoast", - "easter", - "eastward", - "eatable", - "eaten", - "eatery", - "eating", - "eats", - "ebay", - "ebony", - "ebook", - "ecard", - "eccentric", - "echo", - "eclair", - "eclipse", - "ecologist", - "ecology", - "economic", - "economist", - "economy", - "ecosphere", - "ecosystem", - "edge", - "edginess", - "edging", - "edgy", - "edition", - "editor", - "educated", - "education", - "educator", - "eel", - "effective", - "effects", - "efficient", - "effort", - "eggbeater", - "egging", - "eggnog", - "eggplant", - "eggshell", - "egomaniac", - "egotism", - "egotistic", - "either", - "eject", - "elaborate", - "elastic", - "elated", - "elbow", - "eldercare", - "elderly", - "eldest", - "electable", - "election", - "elective", - "elephant", - "elevate", - "elevating", - "elevation", - "elevator", - "eleven", - "elf", - "eligible", - "eligibly", - "eliminate", - "elite", - "elitism", - "elixir", - "elk", - "ellipse", - "elliptic", - "elm", - "elongated", - "elope", - "eloquence", - "eloquent", - "elsewhere", - "elude", - "elusive", - "elves", - "email", - "embargo", - "embark", - "embassy", - "embattled", - "embellish", - "ember", - "embezzle", - "emblaze", - "emblem", - "embody", - "embolism", - "emboss", - "embroider", - "emcee", - "emerald", - "emergency", - "emission", - "emit", - "emote", - "emoticon", - "emotion", - "empathic", - "empathy", - "emperor", - "emphases", - "emphasis", - "emphasize", - "emphatic", - "empirical", - "employed", - "employee", - "employer", - "emporium", - "empower", - "emptier", - "emptiness", - "empty", - "emu", - "enable", - "enactment", - "enamel", - "enchanted", - "enchilada", - "encircle", - "enclose", - "enclosure", - "encode", - "encore", - "encounter", - "encourage", - "encroach", - "encrust", - "encrypt", - "endanger", - "endeared", - "endearing", - "ended", - "ending", - "endless", - "endnote", - "endocrine", - "endorphin", - "endorse", - "endowment", - "endpoint", - "endurable", - "endurance", - "enduring", - "energetic", - "energize", - "energy", - "enforced", - "enforcer", - "engaged", - "engaging", - "engine", - "engorge", - "engraved", - "engraver", - "engraving", - "engross", - "engulf", - "enhance", - "enigmatic", - "enjoyable", - "enjoyably", - "enjoyer", - "enjoying", - "enjoyment", - "enlarged", - "enlarging", - "enlighten", - "enlisted", - "enquirer", - "enrage", - "enrich", - "enroll", - "enslave", - "ensnare", - "ensure", - "entail", - "entangled", - "entering", - "entertain", - "enticing", - "entire", - "entitle", - "entity", - "entomb", - "entourage", - "entrap", - "entree", - "entrench", - "entrust", - "entryway", - "entwine", - "enunciate", - "envelope", - "enviable", - "enviably", - "envious", - "envision", - "envoy", - "envy", - "enzyme", - "epic", - "epidemic", - "epidermal", - "epidermis", - "epidural", - "epilepsy", - "epileptic", - "epilogue", - "epiphany", - "episode", - "equal", - "equate", - "equation", - "equator", - "equinox", - "equipment", - "equity", - "equivocal", - "eradicate", - "erasable", - "erased", - "eraser", - "erasure", - "ergonomic", - "errand", - "errant", - "erratic", - "error", - "erupt", - "escalate", - "escalator", - "escapable", - "escapade", - "escapist", - "escargot", - "eskimo", - "esophagus", - "espionage", - "espresso", - "esquire", - "essay", - "essence", - "essential", - "establish", - "estate", - "esteemed", - "estimate", - "estimator", - "estranged", - "estrogen", - "etching", - "eternal", - "eternity", - "ethanol", - "ether", - "ethically", - "ethics", - "euphemism", - "evacuate", - "evacuee", - "evade", - "evaluate", - "evaluator", - "evaporate", - "evasion", - "evasive", - "even", - "everglade", - "evergreen", - "everybody", - "everyday", - "everyone", - "evict", - "evidence", - "evident", - "evil", - "evoke", - "evolution", - "evolve", - "exact", - "exalted", - "example", - "excavate", - "excavator", - "exceeding", - "exception", - "excess", - "exchange", - "excitable", - "exciting", - "exclaim", - "exclude", - "excluding", - "exclusion", - "exclusive", - "excretion", - "excretory", - "excursion", - "excusable", - "excusably", - "excuse", - "exemplary", - "exemplify", - "exemption", - "exerciser", - "exert", - "exes", - "exfoliate", - "exhale", - "exhaust", - "exhume", - "exile", - "existing", - "exit", - "exodus", - "exonerate", - "exorcism", - "exorcist", - "expand", - "expanse", - "expansion", - "expansive", - "expectant", - "expedited", - "expediter", - "expel", - "expend", - "expenses", - "expensive", - "expert", - "expire", - "expiring", - "explain", - "expletive", - "explicit", - "explode", - "exploit", - "explore", - "exploring", - "exponent", - "exporter", - "exposable", - "expose", - "exposure", - "express", - "expulsion", - "exquisite", - "extended", - "extending", - "extent", - "extenuate", - "exterior", - "external", - "extinct", - "extortion", - "extradite", - "extras", - "extrovert", - "extrude", - "extruding", - "exuberant", - "fable", - "fabric", - "fabulous", - "facebook", - "facecloth", - "facedown", - "faceless", - "facelift", - "faceplate", - "faceted", - "facial", - "facility", - "facing", - "facsimile", - "faction", - "factoid", - "factor", - "factsheet", - "factual", - "faculty", - "fade", - "fading", - "failing", - "falcon", - "fall", - "false", - "falsify", - "fame", - "familiar", - "family", - "famine", - "famished", - "fanatic", - "fancied", - "fanciness", - "fancy", - "fanfare", - "fang", - "fanning", - "fantasize", - "fantastic", - "fantasy", - "fascism", - "fastball", - "faster", - "fasting", - "fastness", - "faucet", - "favorable", - "favorably", - "favored", - "favoring", - "favorite", - "fax", - "feast", - "federal", - "fedora", - "feeble", - "feed", - "feel", - "feisty", - "feline", - "felt-tip", - "feminine", - "feminism", - "feminist", - "feminize", - "femur", - "fence", - "fencing", - "fender", - "ferment", - "fernlike", - "ferocious", - "ferocity", - "ferret", - "ferris", - "ferry", - "fervor", - "fester", - "festival", - "festive", - "festivity", - "fetal", - "fetch", - "fever", - "fiber", - "fiction", - "fiddle", - "fiddling", - "fidelity", - "fidgeting", - "fidgety", - "fifteen", - "fifth", - "fiftieth", - "fifty", - "figment", - "figure", - "figurine", - "filing", - "filled", - "filler", - "filling", - "film", - "filter", - "filth", - "filtrate", - "finale", - "finalist", - "finalize", - "finally", - "finance", - "financial", - "finch", - "fineness", - "finer", - "finicky", - "finished", - "finisher", - "finishing", - "finite", - "finless", - "finlike", - "fiscally", - "fit", - "five", - "flaccid", - "flagman", - "flagpole", - "flagship", - "flagstick", - "flagstone", - "flail", - "flakily", - "flaky", - "flame", - "flammable", - "flanked", - "flanking", - "flannels", - "flap", - "flaring", - "flashback", - "flashbulb", - "flashcard", - "flashily", - "flashing", - "flashy", - "flask", - "flatbed", - "flatfoot", - "flatly", - "flatness", - "flatten", - "flattered", - "flatterer", - "flattery", - "flattop", - "flatware", - "flatworm", - "flavored", - "flavorful", - "flavoring", - "flaxseed", - "fled", - "fleshed", - "fleshy", - "flick", - "flier", - "flight", - "flinch", - "fling", - "flint", - "flip", - "flirt", - "float", - "flock", - "flogging", - "flop", - "floral", - "florist", - "floss", - "flounder", - "flyable", - "flyaway", - "flyer", - "flying", - "flyover", - "flypaper", - "foam", - "foe", - "fog", - "foil", - "folic", - "folk", - "follicle", - "follow", - "fondling", - "fondly", - "fondness", - "fondue", - "font", - "food", - "fool", - "footage", - "football", - "footbath", - "footboard", - "footer", - "footgear", - "foothill", - "foothold", - "footing", - "footless", - "footman", - "footnote", - "footpad", - "footpath", - "footprint", - "footrest", - "footsie", - "footsore", - "footwear", - "footwork", - "fossil", - "foster", - "founder", - "founding", - "fountain", - "fox", - "foyer", - "fraction", - "fracture", - "fragile", - "fragility", - "fragment", - "fragrance", - "fragrant", - "frail", - "frame", - "framing", - "frantic", - "fraternal", - "frayed", - "fraying", - "frays", - "freckled", - "freckles", - "freebase", - "freebee", - "freebie", - "freedom", - "freefall", - "freehand", - "freeing", - "freeload", - "freely", - "freemason", - "freeness", - "freestyle", - "freeware", - "freeway", - "freewill", - "freezable", - "freezing", - "freight", - "french", - "frenzied", - "frenzy", - "frequency", - "frequent", - "fresh", - "fretful", - "fretted", - "friction", - "friday", - "fridge", - "fried", - "friend", - "frighten", - "frightful", - "frigidity", - "frigidly", - "frill", - "fringe", - "frisbee", - "frisk", - "fritter", - "frivolous", - "frolic", - "from", - "front", - "frostbite", - "frosted", - "frostily", - "frosting", - "frostlike", - "frosty", - "froth", - "frown", - "frozen", - "fructose", - "frugality", - "frugally", - "fruit", - "frustrate", - "frying", - "gab", - "gaffe", - "gag", - "gainfully", - "gaining", - "gains", - "gala", - "gallantly", - "galleria", - "gallery", - "galley", - "gallon", - "gallows", - "gallstone", - "galore", - "galvanize", - "gambling", - "game", - "gaming", - "gamma", - "gander", - "gangly", - "gangrene", - "gangway", - "gap", - "garage", - "garbage", - "garden", - "gargle", - "garland", - "garlic", - "garment", - "garnet", - "garnish", - "garter", - "gas", - "gatherer", - "gathering", - "gating", - "gauging", - "gauntlet", - "gauze", - "gave", - "gawk", - "gazing", - "gear", - "gecko", - "geek", - "geiger", - "gem", - "gender", - "generic", - "generous", - "genetics", - "genre", - "gentile", - "gentleman", - "gently", - "gents", - "geography", - "geologic", - "geologist", - "geology", - "geometric", - "geometry", - "geranium", - "gerbil", - "geriatric", - "germicide", - "germinate", - "germless", - "germproof", - "gestate", - "gestation", - "gesture", - "getaway", - "getting", - "getup", - "giant", - "gibberish", - "giblet", - "giddily", - "giddiness", - "giddy", - "gift", - "gigabyte", - "gigahertz", - "gigantic", - "giggle", - "giggling", - "giggly", - "gigolo", - "gilled", - "gills", - "gimmick", - "girdle", - "giveaway", - "given", - "giver", - "giving", - "gizmo", - "gizzard", - "glacial", - "glacier", - "glade", - "gladiator", - "gladly", - "glamorous", - "glamour", - "glance", - "glancing", - "glandular", - "glare", - "glaring", - "glass", - "glaucoma", - "glazing", - "gleaming", - "gleeful", - "glider", - "gliding", - "glimmer", - "glimpse", - "glisten", - "glitch", - "glitter", - "glitzy", - "gloater", - "gloating", - "gloomily", - "gloomy", - "glorified", - "glorifier", - "glorify", - "glorious", - "glory", - "gloss", - "glove", - "glowing", - "glowworm", - "glucose", - "glue", - "gluten", - "glutinous", - "glutton", - "gnarly", - "gnat", - "goal", - "goatskin", - "goes", - "goggles", - "going", - "goldfish", - "goldmine", - "goldsmith", - "golf", - "goliath", - "gonad", - "gondola", - "gone", - "gong", - "good", - "gooey", - "goofball", - "goofiness", - "goofy", - "google", - "goon", - "gopher", - "gore", - "gorged", - "gorgeous", - "gory", - "gosling", - "gossip", - "gothic", - "gotten", - "gout", - "gown", - "grab", - "graceful", - "graceless", - "gracious", - "gradation", - "graded", - "grader", - "gradient", - "grading", - "gradually", - "graduate", - "graffiti", - "grafted", - "grafting", - "grain", - "granddad", - "grandkid", - "grandly", - "grandma", - "grandpa", - "grandson", - "granite", - "granny", - "granola", - "grant", - "granular", - "grape", - "graph", - "grapple", - "grappling", - "grasp", - "grass", - "gratified", - "gratify", - "grating", - "gratitude", - "gratuity", - "gravel", - "graveness", - "graves", - "graveyard", - "gravitate", - "gravity", - "gravy", - "gray", - "grazing", - "greasily", - "greedily", - "greedless", - "greedy", - "green", - "greeter", - "greeting", - "grew", - "greyhound", - "grid", - "grief", - "grievance", - "grieving", - "grievous", - "grill", - "grimace", - "grimacing", - "grime", - "griminess", - "grimy", - "grinch", - "grinning", - "grip", - "gristle", - "grit", - "groggily", - "groggy", - "groin", - "groom", - "groove", - "grooving", - "groovy", - "grope", - "ground", - "grouped", - "grout", - "grove", - "grower", - "growing", - "growl", - "grub", - "grudge", - "grudging", - "grueling", - "gruffly", - "grumble", - "grumbling", - "grumbly", - "grumpily", - "grunge", - "grunt", - "guacamole", - "guidable", - "guidance", - "guide", - "guiding", - "guileless", - "guise", - "gulf", - "gullible", - "gully", - "gulp", - "gumball", - "gumdrop", - "gumminess", - "gumming", - "gummy", - "gurgle", - "gurgling", - "guru", - "gush", - "gusto", - "gusty", - "gutless", - "guts", - "gutter", - "guy", - "guzzler", - "gyration", - "habitable", - "habitant", - "habitat", - "habitual", - "hacked", - "hacker", - "hacking", - "hacksaw", - "had", - "haggler", - "haiku", - "half", - "halogen", - "halt", - "halved", - "halves", - "hamburger", - "hamlet", - "hammock", - "hamper", - "hamster", - "hamstring", - "handbag", - "handball", - "handbook", - "handbrake", - "handcart", - "handclap", - "handclasp", - "handcraft", - "handcuff", - "handed", - "handful", - "handgrip", - "handgun", - "handheld", - "handiness", - "handiwork", - "handlebar", - "handled", - "handler", - "handling", - "handmade", - "handoff", - "handpick", - "handprint", - "handrail", - "handsaw", - "handset", - "handsfree", - "handshake", - "handstand", - "handwash", - "handwork", - "handwoven", - "handwrite", - "handyman", - "hangnail", - "hangout", - "hangover", - "hangup", - "hankering", - "hankie", - "hanky", - "haphazard", - "happening", - "happier", - "happiest", - "happily", - "happiness", - "happy", - "harbor", - "hardcopy", - "hardcore", - "hardcover", - "harddisk", - "hardened", - "hardener", - "hardening", - "hardhat", - "hardhead", - "hardiness", - "hardly", - "hardness", - "hardship", - "hardware", - "hardwired", - "hardwood", - "hardy", - "harmful", - "harmless", - "harmonica", - "harmonics", - "harmonize", - "harmony", - "harness", - "harpist", - "harsh", - "harvest", - "hash", - "hassle", - "haste", - "hastily", - "hastiness", - "hasty", - "hatbox", - "hatchback", - "hatchery", - "hatchet", - "hatching", - "hatchling", - "hate", - "hatless", - "hatred", - "haunt", - "haven", - "hazard", - "hazelnut", - "hazily", - "haziness", - "hazing", - "hazy", - "headache", - "headband", - "headboard", - "headcount", - "headdress", - "headed", - "header", - "headfirst", - "headgear", - "heading", - "headlamp", - "headless", - "headlock", - "headphone", - "headpiece", - "headrest", - "headroom", - "headscarf", - "headset", - "headsman", - "headstand", - "headstone", - "headway", - "headwear", - "heap", - "heat", - "heave", - "heavily", - "heaviness", - "heaving", - "hedge", - "hedging", - "heftiness", - "hefty", - "helium", - "helmet", - "helper", - "helpful", - "helping", - "helpless", - "helpline", - "hemlock", - "hemstitch", - "hence", - "henchman", - "henna", - "herald", - "herbal", - "herbicide", - "herbs", - "heritage", - "hermit", - "heroics", - "heroism", - "herring", - "herself", - "hertz", - "hesitancy", - "hesitant", - "hesitate", - "hexagon", - "hexagram", - "hubcap", - "huddle", - "huddling", - "huff", - "hug", - "hula", - "hulk", - "hull", - "human", - "humble", - "humbling", - "humbly", - "humid", - "humiliate", - "humility", - "humming", - "hummus", - "humongous", - "humorist", - "humorless", - "humorous", - "humpback", - "humped", - "humvee", - "hunchback", - "hundredth", - "hunger", - "hungrily", - "hungry", - "hunk", - "hunter", - "hunting", - "huntress", - "huntsman", - "hurdle", - "hurled", - "hurler", - "hurling", - "hurray", - "hurricane", - "hurried", - "hurry", - "hurt", - "husband", - "hush", - "husked", - "huskiness", - "hut", - "hybrid", - "hydrant", - "hydrated", - "hydration", - "hydrogen", - "hydroxide", - "hyperlink", - "hypertext", - "hyphen", - "hypnoses", - "hypnosis", - "hypnotic", - "hypnotism", - "hypnotist", - "hypnotize", - "hypocrisy", - "hypocrite", - "ibuprofen", - "ice", - "iciness", - "icing", - "icky", - "icon", - "icy", - "idealism", - "idealist", - "idealize", - "ideally", - "idealness", - "identical", - "identify", - "identity", - "ideology", - "idiocy", - "idiom", - "idly", - "igloo", - "ignition", - "ignore", - "iguana", - "illicitly", - "illusion", - "illusive", - "image", - "imaginary", - "imagines", - "imaging", - "imbecile", - "imitate", - "imitation", - "immature", - "immerse", - "immersion", - "imminent", - "immobile", - "immodest", - "immorally", - "immortal", - "immovable", - "immovably", - "immunity", - "immunize", - "impaired", - "impale", - "impart", - "impatient", - "impeach", - "impeding", - "impending", - "imperfect", - "imperial", - "impish", - "implant", - "implement", - "implicate", - "implicit", - "implode", - "implosion", - "implosive", - "imply", - "impolite", - "important", - "importer", - "impose", - "imposing", - "impotence", - "impotency", - "impotent", - "impound", - "imprecise", - "imprint", - "imprison", - "impromptu", - "improper", - "improve", - "improving", - "improvise", - "imprudent", - "impulse", - "impulsive", - "impure", - "impurity", - "iodine", - "iodize", - "ion", - "ipad", - "iphone", - "ipod", - "irate", - "irk", - "iron", - "irregular", - "irrigate", - "irritable", - "irritably", - "irritant", - "irritate", - "islamic", - "islamist", - "isolated", - "isolating", - "isolation", - "isotope", - "issue", - "issuing", - "italicize", - "italics", - "item", - "itinerary", - "itunes", - "ivory", - "ivy", - "jab", - "jackal", - "jacket", - "jackknife", - "jackpot", - "jailbird", - "jailbreak", - "jailer", - "jailhouse", - "jalapeno", - "jam", - "janitor", - "january", - "jargon", - "jarring", - "jasmine", - "jaundice", - "jaunt", - "java", - "jawed", - "jawless", - "jawline", - "jaws", - "jaybird", - "jaywalker", - "jazz", - "jeep", - "jeeringly", - "jellied", - "jelly", - "jersey", - "jester", - "jet", - "jiffy", - "jigsaw", - "jimmy", - "jingle", - "jingling", - "jinx", - "jitters", - "jittery", - "job", - "jockey", - "jockstrap", - "jogger", - "jogging", - "john", - "joining", - "jokester", - "jokingly", - "jolliness", - "jolly", - "jolt", - "jot", - "jovial", - "joyfully", - "joylessly", - "joyous", - "joyride", - "joystick", - "jubilance", - "jubilant", - "judge", - "judgingly", - "judicial", - "judiciary", - "judo", - "juggle", - "juggling", - "jugular", - "juice", - "juiciness", - "juicy", - "jujitsu", - "jukebox", - "july", - "jumble", - "jumbo", - "jump", - "junction", - "juncture", - "june", - "junior", - "juniper", - "junkie", - "junkman", - "junkyard", - "jurist", - "juror", - "jury", - "justice", - "justifier", - "justify", - "justly", - "justness", - "juvenile", - "kabob", - "kangaroo", - "karaoke", - "karate", - "karma", - "kebab", - "keenly", - "keenness", - "keep", - "keg", - "kelp", - "kennel", - "kept", - "kerchief", - "kerosene", - "kettle", - "kick", - "kiln", - "kilobyte", - "kilogram", - "kilometer", - "kilowatt", - "kilt", - "kimono", - "kindle", - "kindling", - "kindly", - "kindness", - "kindred", - "kinetic", - "kinfolk", - "king", - "kinship", - "kinsman", - "kinswoman", - "kissable", - "kisser", - "kissing", - "kitchen", - "kite", - "kitten", - "kitty", - "kiwi", - "kleenex", - "knapsack", - "knee", - "knelt", - "knickers", - "knoll", - "koala", - "kooky", - "kosher", - "krypton", - "kudos", - "kung", - "labored", - "laborer", - "laboring", - "laborious", - "labrador", - "ladder", - "ladies", - "ladle", - "ladybug", - "ladylike", - "lagged", - "lagging", - "lagoon", - "lair", - "lake", - "lance", - "landed", - "landfall", - "landfill", - "landing", - "landlady", - "landless", - "landline", - "landlord", - "landmark", - "landmass", - "landmine", - "landowner", - "landscape", - "landside", - "landslide", - "language", - "lankiness", - "lanky", - "lantern", - "lapdog", - "lapel", - "lapped", - "lapping", - "laptop", - "lard", - "large", - "lark", - "lash", - "lasso", - "last", - "latch", - "late", - "lather", - "latitude", - "latrine", - "latter", - "latticed", - "launch", - "launder", - "laundry", - "laurel", - "lavender", - "lavish", - "laxative", - "lazily", - "laziness", - "lazy", - "lecturer", - "left", - "legacy", - "legal", - "legend", - "legged", - "leggings", - "legible", - "legibly", - "legislate", - "lego", - "legroom", - "legume", - "legwarmer", - "legwork", - "lemon", - "lend", - "length", - "lens", - "lent", - "leotard", - "lesser", - "letdown", - "lethargic", - "lethargy", - "letter", - "lettuce", - "level", - "leverage", - "levers", - "levitate", - "levitator", - "liability", - "liable", - "liberty", - "librarian", - "library", - "licking", - "licorice", - "lid", - "life", - "lifter", - "lifting", - "liftoff", - "ligament", - "likely", - "likeness", - "likewise", - "liking", - "lilac", - "lilly", - "lily", - "limb", - "limeade", - "limelight", - "limes", - "limit", - "limping", - "limpness", - "line", - "lingo", - "linguini", - "linguist", - "lining", - "linked", - "linoleum", - "linseed", - "lint", - "lion", - "lip", - "liquefy", - "liqueur", - "liquid", - "lisp", - "list", - "litigate", - "litigator", - "litmus", - "litter", - "little", - "livable", - "lived", - "lively", - "liver", - "livestock", - "lividly", - "living", - "lizard", - "lubricant", - "lubricate", - "lucid", - "luckily", - "luckiness", - "luckless", - "lucrative", - "ludicrous", - "lugged", - "lukewarm", - "lullaby", - "lumber", - "luminance", - "luminous", - "lumpiness", - "lumping", - "lumpish", - "lunacy", - "lunar", - "lunchbox", - "luncheon", - "lunchroom", - "lunchtime", - "lung", - "lurch", - "lure", - "luridness", - "lurk", - "lushly", - "lushness", - "luster", - "lustfully", - "lustily", - "lustiness", - "lustrous", - "lusty", - "luxurious", - "luxury", - "lying", - "lyrically", - "lyricism", - "lyricist", - "lyrics", - "macarena", - "macaroni", - "macaw", - "mace", - "machine", - "machinist", - "magazine", - "magenta", - "maggot", - "magical", - "magician", - "magma", - "magnesium", - "magnetic", - "magnetism", - "magnetize", - "magnifier", - "magnify", - "magnitude", - "magnolia", - "mahogany", - "maimed", - "majestic", - "majesty", - "majorette", - "majority", - "makeover", - "maker", - "makeshift", - "making", - "malformed", - "malt", - "mama", - "mammal", - "mammary", - "mammogram", - "manager", - "managing", - "manatee", - "mandarin", - "mandate", - "mandatory", - "mandolin", - "manger", - "mangle", - "mango", - "mangy", - "manhandle", - "manhole", - "manhood", - "manhunt", - "manicotti", - "manicure", - "manifesto", - "manila", - "mankind", - "manlike", - "manliness", - "manly", - "manmade", - "manned", - "mannish", - "manor", - "manpower", - "mantis", - "mantra", - "manual", - "many", - "map", - "marathon", - "marauding", - "marbled", - "marbles", - "marbling", - "march", - "mardi", - "margarine", - "margarita", - "margin", - "marigold", - "marina", - "marine", - "marital", - "maritime", - "marlin", - "marmalade", - "maroon", - "married", - "marrow", - "marry", - "marshland", - "marshy", - "marsupial", - "marvelous", - "marxism", - "mascot", - "masculine", - "mashed", - "mashing", - "massager", - "masses", - "massive", - "mastiff", - "matador", - "matchbook", - "matchbox", - "matcher", - "matching", - "matchless", - "material", - "maternal", - "maternity", - "math", - "mating", - "matriarch", - "matrimony", - "matrix", - "matron", - "matted", - "matter", - "maturely", - "maturing", - "maturity", - "mauve", - "maverick", - "maximize", - "maximum", - "maybe", - "mayday", - "mayflower", - "moaner", - "moaning", - "mobile", - "mobility", - "mobilize", - "mobster", - "mocha", - "mocker", - "mockup", - "modified", - "modify", - "modular", - "modulator", - "module", - "moisten", - "moistness", - "moisture", - "molar", - "molasses", - "mold", - "molecular", - "molecule", - "molehill", - "mollusk", - "mom", - "monastery", - "monday", - "monetary", - "monetize", - "moneybags", - "moneyless", - "moneywise", - "mongoose", - "mongrel", - "monitor", - "monkhood", - "monogamy", - "monogram", - "monologue", - "monopoly", - "monorail", - "monotone", - "monotype", - "monoxide", - "monsieur", - "monsoon", - "monstrous", - "monthly", - "monument", - "moocher", - "moodiness", - "moody", - "mooing", - "moonbeam", - "mooned", - "moonlight", - "moonlike", - "moonlit", - "moonrise", - "moonscape", - "moonshine", - "moonstone", - "moonwalk", - "mop", - "morale", - "morality", - "morally", - "morbidity", - "morbidly", - "morphine", - "morphing", - "morse", - "mortality", - "mortally", - "mortician", - "mortified", - "mortify", - "mortuary", - "mosaic", - "mossy", - "most", - "mothball", - "mothproof", - "motion", - "motivate", - "motivator", - "motive", - "motocross", - "motor", - "motto", - "mountable", - "mountain", - "mounted", - "mounting", - "mourner", - "mournful", - "mouse", - "mousiness", - "moustache", - "mousy", - "mouth", - "movable", - "move", - "movie", - "moving", - "mower", - "mowing", - "much", - "muck", - "mud", - "mug", - "mulberry", - "mulch", - "mule", - "mulled", - "mullets", - "multiple", - "multiply", - "multitask", - "multitude", - "mumble", - "mumbling", - "mumbo", - "mummified", - "mummify", - "mummy", - "mumps", - "munchkin", - "mundane", - "municipal", - "muppet", - "mural", - "murkiness", - "murky", - "murmuring", - "muscular", - "museum", - "mushily", - "mushiness", - "mushroom", - "mushy", - "music", - "musket", - "muskiness", - "musky", - "mustang", - "mustard", - "muster", - "mustiness", - "musty", - "mutable", - "mutate", - "mutation", - "mute", - "mutilated", - "mutilator", - "mutiny", - "mutt", - "mutual", - "muzzle", - "myself", - "myspace", - "mystified", - "mystify", - "myth", - "nacho", - "nag", - "nail", - "name", - "naming", - "nanny", - "nanometer", - "nape", - "napkin", - "napped", - "napping", - "nappy", - "narrow", - "nastily", - "nastiness", - "national", - "native", - "nativity", - "natural", - "nature", - "naturist", - "nautical", - "navigate", - "navigator", - "navy", - "nearby", - "nearest", - "nearly", - "nearness", - "neatly", - "neatness", - "nebula", - "nebulizer", - "nectar", - "negate", - "negation", - "negative", - "neglector", - "negligee", - "negligent", - "negotiate", - "nemeses", - "nemesis", - "neon", - "nephew", - "nerd", - "nervous", - "nervy", - "nest", - "net", - "neurology", - "neuron", - "neurosis", - "neurotic", - "neuter", - "neutron", - "never", - "next", - "nibble", - "nickname", - "nicotine", - "niece", - "nifty", - "nimble", - "nimbly", - "nineteen", - "ninetieth", - "ninja", - "nintendo", - "ninth", - "nuclear", - "nuclei", - "nucleus", - "nugget", - "nullify", - "number", - "numbing", - "numbly", - "numbness", - "numeral", - "numerate", - "numerator", - "numeric", - "numerous", - "nuptials", - "nursery", - "nursing", - "nurture", - "nutcase", - "nutlike", - "nutmeg", - "nutrient", - "nutshell", - "nuttiness", - "nutty", - "nuzzle", - "nylon", - "oaf", - "oak", - "oasis", - "oat", - "obedience", - "obedient", - "obituary", - "object", - "obligate", - "obliged", - "oblivion", - "oblivious", - "oblong", - "obnoxious", - "oboe", - "obscure", - "obscurity", - "observant", - "observer", - "observing", - "obsessed", - "obsession", - "obsessive", - "obsolete", - "obstacle", - "obstinate", - "obstruct", - "obtain", - "obtrusive", - "obtuse", - "obvious", - "occultist", - "occupancy", - "occupant", - "occupier", - "occupy", - "ocean", - "ocelot", - "octagon", - "octane", - "october", - "octopus", - "ogle", - "oil", - "oink", - "ointment", - "okay", - "old", - "olive", - "olympics", - "omega", - "omen", - "ominous", - "omission", - "omit", - "omnivore", - "onboard", - "oncoming", - "ongoing", - "onion", - "online", - "onlooker", - "only", - "onscreen", - "onset", - "onshore", - "onslaught", - "onstage", - "onto", - "onward", - "onyx", - "oops", - "ooze", - "oozy", - "opacity", - "opal", - "open", - "operable", - "operate", - "operating", - "operation", - "operative", - "operator", - "opium", - "opossum", - "opponent", - "oppose", - "opposing", - "opposite", - "oppressed", - "oppressor", - "opt", - "opulently", - "osmosis", - "other", - "otter", - "ouch", - "ought", - "ounce", - "outage", - "outback", - "outbid", - "outboard", - "outbound", - "outbreak", - "outburst", - "outcast", - "outclass", - "outcome", - "outdated", - "outdoors", - "outer", - "outfield", - "outfit", - "outflank", - "outgoing", - "outgrow", - "outhouse", - "outing", - "outlast", - "outlet", - "outline", - "outlook", - "outlying", - "outmatch", - "outmost", - "outnumber", - "outplayed", - "outpost", - "outpour", - "output", - "outrage", - "outrank", - "outreach", - "outright", - "outscore", - "outsell", - "outshine", - "outshoot", - "outsider", - "outskirts", - "outsmart", - "outsource", - "outspoken", - "outtakes", - "outthink", - "outward", - "outweigh", - "outwit", - "oval", - "ovary", - "oven", - "overact", - "overall", - "overarch", - "overbid", - "overbill", - "overbite", - "overblown", - "overboard", - "overbook", - "overbuilt", - "overcast", - "overcoat", - "overcome", - "overcook", - "overcrowd", - "overdraft", - "overdrawn", - "overdress", - "overdrive", - "overdue", - "overeager", - "overeater", - "overexert", - "overfed", - "overfeed", - "overfill", - "overflow", - "overfull", - "overgrown", - "overhand", - "overhang", - "overhaul", - "overhead", - "overhear", - "overheat", - "overhung", - "overjoyed", - "overkill", - "overlabor", - "overlaid", - "overlap", - "overlay", - "overload", - "overlook", - "overlord", - "overlying", - "overnight", - "overpass", - "overpay", - "overplant", - "overplay", - "overpower", - "overprice", - "overrate", - "overreach", - "overreact", - "override", - "overripe", - "overrule", - "overrun", - "overshoot", - "overshot", - "oversight", - "oversized", - "oversleep", - "oversold", - "overspend", - "overstate", - "overstay", - "overstep", - "overstock", - "overstuff", - "oversweet", - "overtake", - "overthrow", - "overtime", - "overtly", - "overtone", - "overture", - "overturn", - "overuse", - "overvalue", - "overview", - "overwrite", - "owl", - "oxford", - "oxidant", - "oxidation", - "oxidize", - "oxidizing", - "oxygen", - "oxymoron", - "oyster", - "ozone", - "paced", - "pacemaker", - "pacific", - "pacifier", - "pacifism", - "pacifist", - "pacify", - "padded", - "padding", - "paddle", - "paddling", - "padlock", - "pagan", - "pager", - "paging", - "pajamas", - "palace", - "palatable", - "palm", - "palpable", - "palpitate", - "paltry", - "pampered", - "pamperer", - "pampers", - "pamphlet", - "panama", - "pancake", - "pancreas", - "panda", - "pandemic", - "pang", - "panhandle", - "panic", - "panning", - "panorama", - "panoramic", - "panther", - "pantomime", - "pantry", - "pants", - "pantyhose", - "paparazzi", - "papaya", - "paper", - "paprika", - "papyrus", - "parabola", - "parachute", - "parade", - "paradox", - "paragraph", - "parakeet", - "paralegal", - "paralyses", - "paralysis", - "paralyze", - "paramedic", - "parameter", - "paramount", - "parasail", - "parasite", - "parasitic", - "parcel", - "parched", - "parchment", - "pardon", - "parish", - "parka", - "parking", - "parkway", - "parlor", - "parmesan", - "parole", - "parrot", - "parsley", - "parsnip", - "partake", - "parted", - "parting", - "partition", - "partly", - "partner", - "partridge", - "party", - "passable", - "passably", - "passage", - "passcode", - "passenger", - "passerby", - "passing", - "passion", - "passive", - "passivism", - "passover", - "passport", - "password", - "pasta", - "pasted", - "pastel", - "pastime", - "pastor", - "pastrami", - "pasture", - "pasty", - "patchwork", - "patchy", - "paternal", - "paternity", - "path", - "patience", - "patient", - "patio", - "patriarch", - "patriot", - "patrol", - "patronage", - "patronize", - "pauper", - "pavement", - "paver", - "pavestone", - "pavilion", - "paving", - "pawing", - "payable", - "payback", - "paycheck", - "payday", - "payee", - "payer", - "paying", - "payment", - "payphone", - "payroll", - "pebble", - "pebbly", - "pecan", - "pectin", - "peculiar", - "peddling", - "pediatric", - "pedicure", - "pedigree", - "pedometer", - "pegboard", - "pelican", - "pellet", - "pelt", - "pelvis", - "penalize", - "penalty", - "pencil", - "pendant", - "pending", - "penholder", - "penknife", - "pennant", - "penniless", - "penny", - "penpal", - "pension", - "pentagon", - "pentagram", - "pep", - "perceive", - "percent", - "perch", - "percolate", - "perennial", - "perfected", - "perfectly", - "perfume", - "periscope", - "perish", - "perjurer", - "perjury", - "perkiness", - "perky", - "perm", - "peroxide", - "perpetual", - "perplexed", - "persecute", - "persevere", - "persuaded", - "persuader", - "pesky", - "peso", - "pessimism", - "pessimist", - "pester", - "pesticide", - "petal", - "petite", - "petition", - "petri", - "petroleum", - "petted", - "petticoat", - "pettiness", - "petty", - "petunia", - "phantom", - "phobia", - "phoenix", - "phonebook", - "phoney", - "phonics", - "phoniness", - "phony", - "phosphate", - "photo", - "phrase", - "phrasing", - "placard", - "placate", - "placidly", - "plank", - "planner", - "plant", - "plasma", - "plaster", - "plastic", - "plated", - "platform", - "plating", - "platinum", - "platonic", - "platter", - "platypus", - "plausible", - "plausibly", - "playable", - "playback", - "player", - "playful", - "playgroup", - "playhouse", - "playing", - "playlist", - "playmaker", - "playmate", - "playoff", - "playpen", - "playroom", - "playset", - "plaything", - "playtime", - "plaza", - "pleading", - "pleat", - "pledge", - "plentiful", - "plenty", - "plethora", - "plexiglas", - "pliable", - "plod", - "plop", - "plot", - "plow", - "ploy", - "pluck", - "plug", - "plunder", - "plunging", - "plural", - "plus", - "plutonium", - "plywood", - "poach", - "pod", - "poem", - "poet", - "pogo", - "pointed", - "pointer", - "pointing", - "pointless", - "pointy", - "poise", - "poison", - "poker", - "poking", - "polar", - "police", - "policy", - "polio", - "polish", - "politely", - "polka", - "polo", - "polyester", - "polygon", - "polygraph", - "polymer", - "poncho", - "pond", - "pony", - "popcorn", - "pope", - "poplar", - "popper", - "poppy", - "popsicle", - "populace", - "popular", - "populate", - "porcupine", - "pork", - "porous", - "porridge", - "portable", - "portal", - "portfolio", - "porthole", - "portion", - "portly", - "portside", - "poser", - "posh", - "posing", - "possible", - "possibly", - "possum", - "postage", - "postal", - "postbox", - "postcard", - "posted", - "poster", - "posting", - "postnasal", - "posture", - "postwar", - "pouch", - "pounce", - "pouncing", - "pound", - "pouring", - "pout", - "powdered", - "powdering", - "powdery", - "power", - "powwow", - "pox", - "praising", - "prance", - "prancing", - "pranker", - "prankish", - "prankster", - "prayer", - "praying", - "preacher", - "preaching", - "preachy", - "preamble", - "precinct", - "precise", - "precision", - "precook", - "precut", - "predator", - "predefine", - "predict", - "preface", - "prefix", - "preflight", - "preformed", - "pregame", - "pregnancy", - "pregnant", - "preheated", - "prelaunch", - "prelaw", - "prelude", - "premiere", - "premises", - "premium", - "prenatal", - "preoccupy", - "preorder", - "prepaid", - "prepay", - "preplan", - "preppy", - "preschool", - "prescribe", - "preseason", - "preset", - "preshow", - "president", - "presoak", - "press", - "presume", - "presuming", - "preteen", - "pretended", - "pretender", - "pretense", - "pretext", - "pretty", - "pretzel", - "prevail", - "prevalent", - "prevent", - "preview", - "previous", - "prewar", - "prewashed", - "prideful", - "pried", - "primal", - "primarily", - "primary", - "primate", - "primer", - "primp", - "princess", - "print", - "prior", - "prism", - "prison", - "prissy", - "pristine", - "privacy", - "private", - "privatize", - "prize", - "proactive", - "probable", - "probably", - "probation", - "probe", - "probing", - "probiotic", - "problem", - "procedure", - "process", - "proclaim", - "procreate", - "procurer", - "prodigal", - "prodigy", - "produce", - "product", - "profane", - "profanity", - "professed", - "professor", - "profile", - "profound", - "profusely", - "progeny", - "prognosis", - "program", - "progress", - "projector", - "prologue", - "prolonged", - "promenade", - "prominent", - "promoter", - "promotion", - "prompter", - "promptly", - "prone", - "prong", - "pronounce", - "pronto", - "proofing", - "proofread", - "proofs", - "propeller", - "properly", - "property", - "proponent", - "proposal", - "propose", - "props", - "prorate", - "protector", - "protegee", - "proton", - "prototype", - "protozoan", - "protract", - "protrude", - "proud", - "provable", - "proved", - "proven", - "provided", - "provider", - "providing", - "province", - "proving", - "provoke", - "provoking", - "provolone", - "prowess", - "prowler", - "prowling", - "proximity", - "proxy", - "prozac", - "prude", - "prudishly", - "prune", - "pruning", - "pry", - "psychic", - "public", - "publisher", - "pucker", - "pueblo", - "pug", - "pull", - "pulmonary", - "pulp", - "pulsate", - "pulse", - "pulverize", - "puma", - "pumice", - "pummel", - "punch", - "punctual", - "punctuate", - "punctured", - "pungent", - "punisher", - "punk", - "pupil", - "puppet", - "puppy", - "purchase", - "pureblood", - "purebred", - "purely", - "pureness", - "purgatory", - "purge", - "purging", - "purifier", - "purify", - "purist", - "puritan", - "purity", - "purple", - "purplish", - "purposely", - "purr", - "purse", - "pursuable", - "pursuant", - "pursuit", - "purveyor", - "pushcart", - "pushchair", - "pusher", - "pushiness", - "pushing", - "pushover", - "pushpin", - "pushup", - "pushy", - "putdown", - "putt", - "puzzle", - "puzzling", - "pyramid", - "pyromania", - "python", - "quack", - "quadrant", - "quail", - "quaintly", - "quake", - "quaking", - "qualified", - "qualifier", - "qualify", - "quality", - "qualm", - "quantum", - "quarrel", - "quarry", - "quartered", - "quarterly", - "quarters", - "quartet", - "quench", - "query", - "quicken", - "quickly", - "quickness", - "quicksand", - "quickstep", - "quiet", - "quill", - "quilt", - "quintet", - "quintuple", - "quirk", - "quit", - "quiver", - "quizzical", - "quotable", - "quotation", - "quote", - "rabid", - "race", - "racing", - "racism", - "rack", - "racoon", - "radar", - "radial", - "radiance", - "radiantly", - "radiated", - "radiation", - "radiator", - "radio", - "radish", - "raffle", - "raft", - "rage", - "ragged", - "raging", - "ragweed", - "raider", - "railcar", - "railing", - "railroad", - "railway", - "raisin", - "rake", - "raking", - "rally", - "ramble", - "rambling", - "ramp", - "ramrod", - "ranch", - "rancidity", - "random", - "ranged", - "ranger", - "ranging", - "ranked", - "ranking", - "ransack", - "ranting", - "rants", - "rare", - "rarity", - "rascal", - "rash", - "rasping", - "ravage", - "raven", - "ravine", - "raving", - "ravioli", - "ravishing", - "reabsorb", - "reach", - "reacquire", - "reaction", - "reactive", - "reactor", - "reaffirm", - "ream", - "reanalyze", - "reappear", - "reapply", - "reappoint", - "reapprove", - "rearrange", - "rearview", - "reason", - "reassign", - "reassure", - "reattach", - "reawake", - "rebalance", - "rebate", - "rebel", - "rebirth", - "reboot", - "reborn", - "rebound", - "rebuff", - "rebuild", - "rebuilt", - "reburial", - "rebuttal", - "recall", - "recant", - "recapture", - "recast", - "recede", - "recent", - "recess", - "recharger", - "recipient", - "recital", - "recite", - "reckless", - "reclaim", - "recliner", - "reclining", - "recluse", - "reclusive", - "recognize", - "recoil", - "recollect", - "recolor", - "reconcile", - "reconfirm", - "reconvene", - "recopy", - "record", - "recount", - "recoup", - "recovery", - "recreate", - "rectal", - "rectangle", - "rectified", - "rectify", - "recycled", - "recycler", - "recycling", - "reemerge", - "reenact", - "reenter", - "reentry", - "reexamine", - "referable", - "referee", - "reference", - "refill", - "refinance", - "refined", - "refinery", - "refining", - "refinish", - "reflected", - "reflector", - "reflex", - "reflux", - "refocus", - "refold", - "reforest", - "reformat", - "reformed", - "reformer", - "reformist", - "refract", - "refrain", - "refreeze", - "refresh", - "refried", - "refueling", - "refund", - "refurbish", - "refurnish", - "refusal", - "refuse", - "refusing", - "refutable", - "refute", - "regain", - "regalia", - "regally", - "reggae", - "regime", - "region", - "register", - "registrar", - "registry", - "regress", - "regretful", - "regroup", - "regular", - "regulate", - "regulator", - "rehab", - "reheat", - "rehire", - "rehydrate", - "reimburse", - "reissue", - "reiterate", - "rejoice", - "rejoicing", - "rejoin", - "rekindle", - "relapse", - "relapsing", - "relatable", - "related", - "relation", - "relative", - "relax", - "relay", - "relearn", - "release", - "relenting", - "reliable", - "reliably", - "reliance", - "reliant", - "relic", - "relieve", - "relieving", - "relight", - "relish", - "relive", - "reload", - "relocate", - "relock", - "reluctant", - "rely", - "remake", - "remark", - "remarry", - "rematch", - "remedial", - "remedy", - "remember", - "reminder", - "remindful", - "remission", - "remix", - "remnant", - "remodeler", - "remold", - "remorse", - "remote", - "removable", - "removal", - "removed", - "remover", - "removing", - "rename", - "renderer", - "rendering", - "rendition", - "renegade", - "renewable", - "renewably", - "renewal", - "renewed", - "renounce", - "renovate", - "renovator", - "rentable", - "rental", - "rented", - "renter", - "reoccupy", - "reoccur", - "reopen", - "reorder", - "repackage", - "repacking", - "repaint", - "repair", - "repave", - "repaying", - "repayment", - "repeal", - "repeated", - "repeater", - "repent", - "rephrase", - "replace", - "replay", - "replica", - "reply", - "reporter", - "repose", - "repossess", - "repost", - "repressed", - "reprimand", - "reprint", - "reprise", - "reproach", - "reprocess", - "reproduce", - "reprogram", - "reps", - "reptile", - "reptilian", - "repugnant", - "repulsion", - "repulsive", - "repurpose", - "reputable", - "reputably", - "request", - "require", - "requisite", - "reroute", - "rerun", - "resale", - "resample", - "rescuer", - "reseal", - "research", - "reselect", - "reseller", - "resemble", - "resend", - "resent", - "reset", - "reshape", - "reshoot", - "reshuffle", - "residence", - "residency", - "resident", - "residual", - "residue", - "resigned", - "resilient", - "resistant", - "resisting", - "resize", - "resolute", - "resolved", - "resonant", - "resonate", - "resort", - "resource", - "respect", - "resubmit", - "result", - "resume", - "resupply", - "resurface", - "resurrect", - "retail", - "retainer", - "retaining", - "retake", - "retaliate", - "retention", - "rethink", - "retinal", - "retired", - "retiree", - "retiring", - "retold", - "retool", - "retorted", - "retouch", - "retrace", - "retract", - "retrain", - "retread", - "retreat", - "retrial", - "retrieval", - "retriever", - "retry", - "return", - "retying", - "retype", - "reunion", - "reunite", - "reusable", - "reuse", - "reveal", - "reveler", - "revenge", - "revenue", - "reverb", - "revered", - "reverence", - "reverend", - "reversal", - "reverse", - "reversing", - "reversion", - "revert", - "revisable", - "revise", - "revision", - "revisit", - "revivable", - "revival", - "reviver", - "reviving", - "revocable", - "revoke", - "revolt", - "revolver", - "revolving", - "reward", - "rewash", - "rewind", - "rewire", - "reword", - "rework", - "rewrap", - "rewrite", - "rhyme", - "ribbon", - "ribcage", - "rice", - "riches", - "richly", - "richness", - "rickety", - "ricotta", - "riddance", - "ridden", - "ride", - "riding", - "rifling", - "rift", - "rigging", - "rigid", - "rigor", - "rimless", - "rimmed", - "rind", - "rink", - "rinse", - "rinsing", - "riot", - "ripcord", - "ripeness", - "ripening", - "ripping", - "ripple", - "rippling", - "riptide", - "rise", - "rising", - "risk", - "risotto", - "ritalin", - "ritzy", - "rival", - "riverbank", - "riverbed", - "riverboat", - "riverside", - "riveter", - "riveting", - "roamer", - "roaming", - "roast", - "robbing", - "robe", - "robin", - "robotics", - "robust", - "rockband", - "rocker", - "rocket", - "rockfish", - "rockiness", - "rocking", - "rocklike", - "rockslide", - "rockstar", - "rocky", - "rogue", - "roman", - "romp", - "rope", - "roping", - "roster", - "rosy", - "rotten", - "rotting", - "rotunda", - "roulette", - "rounding", - "roundish", - "roundness", - "roundup", - "roundworm", - "routine", - "routing", - "rover", - "roving", - "royal", - "rubbed", - "rubber", - "rubbing", - "rubble", - "rubdown", - "ruby", - "ruckus", - "rudder", - "rug", - "ruined", - "rule", - "rumble", - "rumbling", - "rummage", - "rumor", - "runaround", - "rundown", - "runner", - "running", - "runny", - "runt", - "runway", - "rupture", - "rural", - "ruse", - "rush", - "rust", - "rut", - "sabbath", - "sabotage", - "sacrament", - "sacred", - "sacrifice", - "sadden", - "saddlebag", - "saddled", - "saddling", - "sadly", - "sadness", - "safari", - "safeguard", - "safehouse", - "safely", - "safeness", - "saffron", - "saga", - "sage", - "sagging", - "saggy", - "said", - "saint", - "sake", - "salad", - "salami", - "salaried", - "salary", - "saline", - "salon", - "saloon", - "salsa", - "salt", - "salutary", - "salute", - "salvage", - "salvaging", - "salvation", - "same", - "sample", - "sampling", - "sanction", - "sanctity", - "sanctuary", - "sandal", - "sandbag", - "sandbank", - "sandbar", - "sandblast", - "sandbox", - "sanded", - "sandfish", - "sanding", - "sandlot", - "sandpaper", - "sandpit", - "sandstone", - "sandstorm", - "sandworm", - "sandy", - "sanitary", - "sanitizer", - "sank", - "santa", - "sapling", - "sappiness", - "sappy", - "sarcasm", - "sarcastic", - "sardine", - "sash", - "sasquatch", - "sassy", - "satchel", - "satiable", - "satin", - "satirical", - "satisfied", - "satisfy", - "saturate", - "saturday", - "sauciness", - "saucy", - "sauna", - "savage", - "savanna", - "saved", - "savings", - "savior", - "savor", - "saxophone", - "say", - "scabbed", - "scabby", - "scalded", - "scalding", - "scale", - "scaling", - "scallion", - "scallop", - "scalping", - "scam", - "scandal", - "scanner", - "scanning", - "scant", - "scapegoat", - "scarce", - "scarcity", - "scarecrow", - "scared", - "scarf", - "scarily", - "scariness", - "scarring", - "scary", - "scavenger", - "scenic", - "schedule", - "schematic", - "scheme", - "scheming", - "schilling", - "schnapps", - "scholar", - "science", - "scientist", - "scion", - "scoff", - "scolding", - "scone", - "scoop", - "scooter", - "scope", - "scorch", - "scorebook", - "scorecard", - "scored", - "scoreless", - "scorer", - "scoring", - "scorn", - "scorpion", - "scotch", - "scoundrel", - "scoured", - "scouring", - "scouting", - "scouts", - "scowling", - "scrabble", - "scraggly", - "scrambled", - "scrambler", - "scrap", - "scratch", - "scrawny", - "screen", - "scribble", - "scribe", - "scribing", - "scrimmage", - "script", - "scroll", - "scrooge", - "scrounger", - "scrubbed", - "scrubber", - "scruffy", - "scrunch", - "scrutiny", - "scuba", - "scuff", - "sculptor", - "sculpture", - "scurvy", - "scuttle", - "secluded", - "secluding", - "seclusion", - "second", - "secrecy", - "secret", - "sectional", - "sector", - "secular", - "securely", - "security", - "sedan", - "sedate", - "sedation", - "sedative", - "sediment", - "seduce", - "seducing", - "segment", - "seismic", - "seizing", - "seldom", - "selected", - "selection", - "selective", - "selector", - "self", - "seltzer", - "semantic", - "semester", - "semicolon", - "semifinal", - "seminar", - "semisoft", - "semisweet", - "senate", - "senator", - "send", - "senior", - "senorita", - "sensation", - "sensitive", - "sensitize", - "sensually", - "sensuous", - "sepia", - "september", - "septic", - "septum", - "sequel", - "sequence", - "sequester", - "series", - "sermon", - "serotonin", - "serpent", - "serrated", - "serve", - "service", - "serving", - "sesame", - "sessions", - "setback", - "setting", - "settle", - "settling", - "setup", - "sevenfold", - "seventeen", - "seventh", - "seventy", - "severity", - "shabby", - "shack", - "shaded", - "shadily", - "shadiness", - "shading", - "shadow", - "shady", - "shaft", - "shakable", - "shakily", - "shakiness", - "shaking", - "shaky", - "shale", - "shallot", - "shallow", - "shame", - "shampoo", - "shamrock", - "shank", - "shanty", - "shape", - "shaping", - "share", - "sharpener", - "sharper", - "sharpie", - "sharply", - "sharpness", - "shawl", - "sheath", - "shed", - "sheep", - "sheet", - "shelf", - "shell", - "shelter", - "shelve", - "shelving", - "sherry", - "shield", - "shifter", - "shifting", - "shiftless", - "shifty", - "shimmer", - "shimmy", - "shindig", - "shine", - "shingle", - "shininess", - "shining", - "shiny", - "ship", - "shirt", - "shivering", - "shock", - "shone", - "shoplift", - "shopper", - "shopping", - "shoptalk", - "shore", - "shortage", - "shortcake", - "shortcut", - "shorten", - "shorter", - "shorthand", - "shortlist", - "shortly", - "shortness", - "shorts", - "shortwave", - "shorty", - "shout", - "shove", - "showbiz", - "showcase", - "showdown", - "shower", - "showgirl", - "showing", - "showman", - "shown", - "showoff", - "showpiece", - "showplace", - "showroom", - "showy", - "shrank", - "shrapnel", - "shredder", - "shredding", - "shrewdly", - "shriek", - "shrill", - "shrimp", - "shrine", - "shrink", - "shrivel", - "shrouded", - "shrubbery", - "shrubs", - "shrug", - "shrunk", - "shucking", - "shudder", - "shuffle", - "shuffling", - "shun", - "shush", - "shut", - "shy", - "siamese", - "siberian", - "sibling", - "siding", - "sierra", - "siesta", - "sift", - "sighing", - "silenced", - "silencer", - "silent", - "silica", - "silicon", - "silk", - "silliness", - "silly", - "silo", - "silt", - "silver", - "similarly", - "simile", - "simmering", - "simple", - "simplify", - "simply", - "sincere", - "sincerity", - "singer", - "singing", - "single", - "singular", - "sinister", - "sinless", - "sinner", - "sinuous", - "sip", - "siren", - "sister", - "sitcom", - "sitter", - "sitting", - "situated", - "situation", - "sixfold", - "sixteen", - "sixth", - "sixties", - "sixtieth", - "sixtyfold", - "sizable", - "sizably", - "size", - "sizing", - "sizzle", - "sizzling", - "skater", - "skating", - "skedaddle", - "skeletal", - "skeleton", - "skeptic", - "sketch", - "skewed", - "skewer", - "skid", - "skied", - "skier", - "skies", - "skiing", - "skilled", - "skillet", - "skillful", - "skimmed", - "skimmer", - "skimming", - "skimpily", - "skincare", - "skinhead", - "skinless", - "skinning", - "skinny", - "skintight", - "skipper", - "skipping", - "skirmish", - "skirt", - "skittle", - "skydiver", - "skylight", - "skyline", - "skype", - "skyrocket", - "skyward", - "slab", - "slacked", - "slacker", - "slacking", - "slackness", - "slacks", - "slain", - "slam", - "slander", - "slang", - "slapping", - "slapstick", - "slashed", - "slashing", - "slate", - "slather", - "slaw", - "sled", - "sleek", - "sleep", - "sleet", - "sleeve", - "slept", - "sliceable", - "sliced", - "slicer", - "slicing", - "slick", - "slider", - "slideshow", - "sliding", - "slighted", - "slighting", - "slightly", - "slimness", - "slimy", - "slinging", - "slingshot", - "slinky", - "slip", - "slit", - "sliver", - "slobbery", - "slogan", - "sloped", - "sloping", - "sloppily", - "sloppy", - "slot", - "slouching", - "slouchy", - "sludge", - "slug", - "slum", - "slurp", - "slush", - "sly", - "small", - "smartly", - "smartness", - "smasher", - "smashing", - "smashup", - "smell", - "smelting", - "smile", - "smilingly", - "smirk", - "smite", - "smith", - "smitten", - "smock", - "smog", - "smoked", - "smokeless", - "smokiness", - "smoking", - "smoky", - "smolder", - "smooth", - "smother", - "smudge", - "smudgy", - "smuggler", - "smuggling", - "smugly", - "smugness", - "snack", - "snagged", - "snaking", - "snap", - "snare", - "snarl", - "snazzy", - "sneak", - "sneer", - "sneeze", - "sneezing", - "snide", - "sniff", - "snippet", - "snipping", - "snitch", - "snooper", - "snooze", - "snore", - "snoring", - "snorkel", - "snort", - "snout", - "snowbird", - "snowboard", - "snowbound", - "snowcap", - "snowdrift", - "snowdrop", - "snowfall", - "snowfield", - "snowflake", - "snowiness", - "snowless", - "snowman", - "snowplow", - "snowshoe", - "snowstorm", - "snowsuit", - "snowy", - "snub", - "snuff", - "snuggle", - "snugly", - "snugness", - "speak", - "spearfish", - "spearhead", - "spearman", - "spearmint", - "species", - "specimen", - "specked", - "speckled", - "specks", - "spectacle", - "spectator", - "spectrum", - "speculate", - "speech", - "speed", - "spellbind", - "speller", - "spelling", - "spendable", - "spender", - "spending", - "spent", - "spew", - "sphere", - "spherical", - "sphinx", - "spider", - "spied", - "spiffy", - "spill", - "spilt", - "spinach", - "spinal", - "spindle", - "spinner", - "spinning", - "spinout", - "spinster", - "spiny", - "spiral", - "spirited", - "spiritism", - "spirits", - "spiritual", - "splashed", - "splashing", - "splashy", - "splatter", - "spleen", - "splendid", - "splendor", - "splice", - "splicing", - "splinter", - "splotchy", - "splurge", - "spoilage", - "spoiled", - "spoiler", - "spoiling", - "spoils", - "spoken", - "spokesman", - "sponge", - "spongy", - "sponsor", - "spoof", - "spookily", - "spooky", - "spool", - "spoon", - "spore", - "sporting", - "sports", - "sporty", - "spotless", - "spotlight", - "spotted", - "spotter", - "spotting", - "spotty", - "spousal", - "spouse", - "spout", - "sprain", - "sprang", - "sprawl", - "spray", - "spree", - "sprig", - "spring", - "sprinkled", - "sprinkler", - "sprint", - "sprite", - "sprout", - "spruce", - "sprung", - "spry", - "spud", - "spur", - "sputter", - "spyglass", - "squabble", - "squad", - "squall", - "squander", - "squash", - "squatted", - "squatter", - "squatting", - "squeak", - "squealer", - "squealing", - "squeamish", - "squeegee", - "squeeze", - "squeezing", - "squid", - "squiggle", - "squiggly", - "squint", - "squire", - "squirt", - "squishier", - "squishy", - "stability", - "stabilize", - "stable", - "stack", - "stadium", - "staff", - "stage", - "staging", - "stagnant", - "stagnate", - "stainable", - "stained", - "staining", - "stainless", - "stalemate", - "staleness", - "stalling", - "stallion", - "stamina", - "stammer", - "stamp", - "stand", - "stank", - "staple", - "stapling", - "starboard", - "starch", - "stardom", - "stardust", - "starfish", - "stargazer", - "staring", - "stark", - "starless", - "starlet", - "starlight", - "starlit", - "starring", - "starry", - "starship", - "starter", - "starting", - "startle", - "startling", - "startup", - "starved", - "starving", - "stash", - "state", - "static", - "statistic", - "statue", - "stature", - "status", - "statute", - "statutory", - "staunch", - "stays", - "steadfast", - "steadier", - "steadily", - "steadying", - "steam", - "steed", - "steep", - "steerable", - "steering", - "steersman", - "stegosaur", - "stellar", - "stem", - "stench", - "stencil", - "step", - "stereo", - "sterile", - "sterility", - "sterilize", - "sterling", - "sternness", - "sternum", - "stew", - "stick", - "stiffen", - "stiffly", - "stiffness", - "stifle", - "stifling", - "stillness", - "stilt", - "stimulant", - "stimulate", - "stimuli", - "stimulus", - "stinger", - "stingily", - "stinging", - "stingray", - "stingy", - "stinking", - "stinky", - "stipend", - "stipulate", - "stir", - "stitch", - "stock", - "stoic", - "stoke", - "stole", - "stomp", - "stonewall", - "stoneware", - "stonework", - "stoning", - "stony", - "stood", - "stooge", - "stool", - "stoop", - "stoplight", - "stoppable", - "stoppage", - "stopped", - "stopper", - "stopping", - "stopwatch", - "storable", - "storage", - "storeroom", - "storewide", - "storm", - "stout", - "stove", - "stowaway", - "stowing", - "straddle", - "straggler", - "strained", - "strainer", - "straining", - "strangely", - "stranger", - "strangle", - "strategic", - "strategy", - "stratus", - "straw", - "stray", - "streak", - "stream", - "street", - "strength", - "strenuous", - "strep", - "stress", - "stretch", - "strewn", - "stricken", - "strict", - "stride", - "strife", - "strike", - "striking", - "strive", - "striving", - "strobe", - "strode", - "stroller", - "strongbox", - "strongly", - "strongman", - "struck", - "structure", - "strudel", - "struggle", - "strum", - "strung", - "strut", - "stubbed", - "stubble", - "stubbly", - "stubborn", - "stucco", - "stuck", - "student", - "studied", - "studio", - "study", - "stuffed", - "stuffing", - "stuffy", - "stumble", - "stumbling", - "stump", - "stung", - "stunned", - "stunner", - "stunning", - "stunt", - "stupor", - "sturdily", - "sturdy", - "styling", - "stylishly", - "stylist", - "stylized", - "stylus", - "suave", - "subarctic", - "subatomic", - "subdivide", - "subdued", - "subduing", - "subfloor", - "subgroup", - "subheader", - "subject", - "sublease", - "sublet", - "sublevel", - "sublime", - "submarine", - "submerge", - "submersed", - "submitter", - "subpanel", - "subpar", - "subplot", - "subprime", - "subscribe", - "subscript", - "subsector", - "subside", - "subsiding", - "subsidize", - "subsidy", - "subsoil", - "subsonic", - "substance", - "subsystem", - "subtext", - "subtitle", - "subtly", - "subtotal", - "subtract", - "subtype", - "suburb", - "subway", - "subwoofer", - "subzero", - "succulent", - "such", - "suction", - "sudden", - "sudoku", - "suds", - "sufferer", - "suffering", - "suffice", - "suffix", - "suffocate", - "suffrage", - "sugar", - "suggest", - "suing", - "suitable", - "suitably", - "suitcase", - "suitor", - "sulfate", - "sulfide", - "sulfite", - "sulfur", - "sulk", - "sullen", - "sulphate", - "sulphuric", - "sultry", - "superbowl", - "superglue", - "superhero", - "superior", - "superjet", - "superman", - "supermom", - "supernova", - "supervise", - "supper", - "supplier", - "supply", - "support", - "supremacy", - "supreme", - "surcharge", - "surely", - "sureness", - "surface", - "surfacing", - "surfboard", - "surfer", - "surgery", - "surgical", - "surging", - "surname", - "surpass", - "surplus", - "surprise", - "surreal", - "surrender", - "surrogate", - "surround", - "survey", - "survival", - "survive", - "surviving", - "survivor", - "sushi", - "suspect", - "suspend", - "suspense", - "sustained", - "sustainer", - "swab", - "swaddling", - "swagger", - "swampland", - "swan", - "swapping", - "swarm", - "sway", - "swear", - "sweat", - "sweep", - "swell", - "swept", - "swerve", - "swifter", - "swiftly", - "swiftness", - "swimmable", - "swimmer", - "swimming", - "swimsuit", - "swimwear", - "swinger", - "swinging", - "swipe", - "swirl", - "switch", - "swivel", - "swizzle", - "swooned", - "swoop", - "swoosh", - "swore", - "sworn", - "swung", - "sycamore", - "sympathy", - "symphonic", - "symphony", - "symptom", - "synapse", - "syndrome", - "synergy", - "synopses", - "synopsis", - "synthesis", - "synthetic", - "syrup", - "system", - "t-shirt", - "tabasco", - "tabby", - "tableful", - "tables", - "tablet", - "tableware", - "tabloid", - "tackiness", - "tacking", - "tackle", - "tackling", - "tacky", - "taco", - "tactful", - "tactical", - "tactics", - "tactile", - "tactless", - "tadpole", - "taekwondo", - "tag", - "tainted", - "take", - "taking", - "talcum", - "talisman", - "tall", - "talon", - "tamale", - "tameness", - "tamer", - "tamper", - "tank", - "tanned", - "tannery", - "tanning", - "tantrum", - "tapeless", - "tapered", - "tapering", - "tapestry", - "tapioca", - "tapping", - "taps", - "tarantula", - "target", - "tarmac", - "tarnish", - "tarot", - "tartar", - "tartly", - "tartness", - "task", - "tassel", - "taste", - "tastiness", - "tasting", - "tasty", - "tattered", - "tattle", - "tattling", - "tattoo", - "taunt", - "tavern", - "thank", - "that", - "thaw", - "theater", - "theatrics", - "thee", - "theft", - "theme", - "theology", - "theorize", - "thermal", - "thermos", - "thesaurus", - "these", - "thesis", - "thespian", - "thicken", - "thicket", - "thickness", - "thieving", - "thievish", - "thigh", - "thimble", - "thing", - "think", - "thinly", - "thinner", - "thinness", - "thinning", - "thirstily", - "thirsting", - "thirsty", - "thirteen", - "thirty", - "thong", - "thorn", - "those", - "thousand", - "thrash", - "thread", - "threaten", - "threefold", - "thrift", - "thrill", - "thrive", - "thriving", - "throat", - "throbbing", - "throng", - "throttle", - "throwaway", - "throwback", - "thrower", - "throwing", - "thud", - "thumb", - "thumping", - "thursday", - "thus", - "thwarting", - "thyself", - "tiara", - "tibia", - "tidal", - "tidbit", - "tidiness", - "tidings", - "tidy", - "tiger", - "tighten", - "tightly", - "tightness", - "tightrope", - "tightwad", - "tigress", - "tile", - "tiling", - "till", - "tilt", - "timid", - "timing", - "timothy", - "tinderbox", - "tinfoil", - "tingle", - "tingling", - "tingly", - "tinker", - "tinkling", - "tinsel", - "tinsmith", - "tint", - "tinwork", - "tiny", - "tipoff", - "tipped", - "tipper", - "tipping", - "tiptoeing", - "tiptop", - "tiring", - "tissue", - "trace", - "tracing", - "track", - "traction", - "tractor", - "trade", - "trading", - "tradition", - "traffic", - "tragedy", - "trailing", - "trailside", - "train", - "traitor", - "trance", - "tranquil", - "transfer", - "transform", - "translate", - "transpire", - "transport", - "transpose", - "trapdoor", - "trapeze", - "trapezoid", - "trapped", - "trapper", - "trapping", - "traps", - "trash", - "travel", - "traverse", - "travesty", - "tray", - "treachery", - "treading", - "treadmill", - "treason", - "treat", - "treble", - "tree", - "trekker", - "tremble", - "trembling", - "tremor", - "trench", - "trend", - "trespass", - "triage", - "trial", - "triangle", - "tribesman", - "tribunal", - "tribune", - "tributary", - "tribute", - "triceps", - "trickery", - "trickily", - "tricking", - "trickle", - "trickster", - "tricky", - "tricolor", - "tricycle", - "trident", - "tried", - "trifle", - "trifocals", - "trillion", - "trilogy", - "trimester", - "trimmer", - "trimming", - "trimness", - "trinity", - "trio", - "tripod", - "tripping", - "triumph", - "trivial", - "trodden", - "trolling", - "trombone", - "trophy", - "tropical", - "tropics", - "trouble", - "troubling", - "trough", - "trousers", - "trout", - "trowel", - "truce", - "truck", - "truffle", - "trump", - "trunks", - "trustable", - "trustee", - "trustful", - "trusting", - "trustless", - "truth", - "try", - "tubby", - "tubeless", - "tubular", - "tucking", - "tuesday", - "tug", - "tuition", - "tulip", - "tumble", - "tumbling", - "tummy", - "turban", - "turbine", - "turbofan", - "turbojet", - "turbulent", - "turf", - "turkey", - "turmoil", - "turret", - "turtle", - "tusk", - "tutor", - "tutu", - "tux", - "tweak", - "tweed", - "tweet", - "tweezers", - "twelve", - "twentieth", - "twenty", - "twerp", - "twice", - "twiddle", - "twiddling", - "twig", - "twilight", - "twine", - "twins", - "twirl", - "twistable", - "twisted", - "twister", - "twisting", - "twisty", - "twitch", - "twitter", - "tycoon", - "tying", - "tyke", - "udder", - "ultimate", - "ultimatum", - "ultra", - "umbilical", - "umbrella", - "umpire", - "unabashed", - "unable", - "unadorned", - "unadvised", - "unafraid", - "unaired", - "unaligned", - "unaltered", - "unarmored", - "unashamed", - "unaudited", - "unawake", - "unaware", - "unbaked", - "unbalance", - "unbeaten", - "unbend", - "unbent", - "unbiased", - "unbitten", - "unblended", - "unblessed", - "unblock", - "unbolted", - "unbounded", - "unboxed", - "unbraided", - "unbridle", - "unbroken", - "unbuckled", - "unbundle", - "unburned", - "unbutton", - "uncanny", - "uncapped", - "uncaring", - "uncertain", - "unchain", - "unchanged", - "uncharted", - "uncheck", - "uncivil", - "unclad", - "unclaimed", - "unclamped", - "unclasp", - "uncle", - "unclip", - "uncloak", - "unclog", - "unclothed", - "uncoated", - "uncoiled", - "uncolored", - "uncombed", - "uncommon", - "uncooked", - "uncork", - "uncorrupt", - "uncounted", - "uncouple", - "uncouth", - "uncover", - "uncross", - "uncrown", - "uncrushed", - "uncured", - "uncurious", - "uncurled", - "uncut", - "undamaged", - "undated", - "undaunted", - "undead", - "undecided", - "undefined", - "underage", - "underarm", - "undercoat", - "undercook", - "undercut", - "underdog", - "underdone", - "underfed", - "underfeed", - "underfoot", - "undergo", - "undergrad", - "underhand", - "underline", - "underling", - "undermine", - "undermost", - "underpaid", - "underpass", - "underpay", - "underrate", - "undertake", - "undertone", - "undertook", - "undertow", - "underuse", - "underwear", - "underwent", - "underwire", - "undesired", - "undiluted", - "undivided", - "undocked", - "undoing", - "undone", - "undrafted", - "undress", - "undrilled", - "undusted", - "undying", - "unearned", - "unearth", - "unease", - "uneasily", - "uneasy", - "uneatable", - "uneaten", - "unedited", - "unelected", - "unending", - "unengaged", - "unenvied", - "unequal", - "unethical", - "uneven", - "unexpired", - "unexposed", - "unfailing", - "unfair", - "unfasten", - "unfazed", - "unfeeling", - "unfiled", - "unfilled", - "unfitted", - "unfitting", - "unfixable", - "unfixed", - "unflawed", - "unfocused", - "unfold", - "unfounded", - "unframed", - "unfreeze", - "unfrosted", - "unfrozen", - "unfunded", - "unglazed", - "ungloved", - "unglue", - "ungodly", - "ungraded", - "ungreased", - "unguarded", - "unguided", - "unhappily", - "unhappy", - "unharmed", - "unhealthy", - "unheard", - "unhearing", - "unheated", - "unhelpful", - "unhidden", - "unhinge", - "unhitched", - "unholy", - "unhook", - "unicorn", - "unicycle", - "unified", - "unifier", - "uniformed", - "uniformly", - "unify", - "unimpeded", - "uninjured", - "uninstall", - "uninsured", - "uninvited", - "union", - "uniquely", - "unisexual", - "unison", - "unissued", - "unit", - "universal", - "universe", - "unjustly", - "unkempt", - "unkind", - "unknotted", - "unknowing", - "unknown", - "unlaced", - "unlatch", - "unlawful", - "unleaded", - "unlearned", - "unleash", - "unless", - "unleveled", - "unlighted", - "unlikable", - "unlimited", - "unlined", - "unlinked", - "unlisted", - "unlit", - "unlivable", - "unloaded", - "unloader", - "unlocked", - "unlocking", - "unlovable", - "unloved", - "unlovely", - "unloving", - "unluckily", - "unlucky", - "unmade", - "unmanaged", - "unmanned", - "unmapped", - "unmarked", - "unmasked", - "unmasking", - "unmatched", - "unmindful", - "unmixable", - "unmixed", - "unmolded", - "unmoral", - "unmovable", - "unmoved", - "unmoving", - "unnamable", - "unnamed", - "unnatural", - "unneeded", - "unnerve", - "unnerving", - "unnoticed", - "unopened", - "unopposed", - "unpack", - "unpadded", - "unpaid", - "unpainted", - "unpaired", - "unpaved", - "unpeeled", - "unpicked", - "unpiloted", - "unpinned", - "unplanned", - "unplanted", - "unpleased", - "unpledged", - "unplowed", - "unplug", - "unpopular", - "unproven", - "unquote", - "unranked", - "unrated", - "unraveled", - "unreached", - "unread", - "unreal", - "unreeling", - "unrefined", - "unrelated", - "unrented", - "unrest", - "unretired", - "unrevised", - "unrigged", - "unripe", - "unrivaled", - "unroasted", - "unrobed", - "unroll", - "unruffled", - "unruly", - "unrushed", - "unsaddle", - "unsafe", - "unsaid", - "unsalted", - "unsaved", - "unsavory", - "unscathed", - "unscented", - "unscrew", - "unsealed", - "unseated", - "unsecured", - "unseeing", - "unseemly", - "unseen", - "unselect", - "unselfish", - "unsent", - "unsettled", - "unshackle", - "unshaken", - "unshaved", - "unshaven", - "unsheathe", - "unshipped", - "unsightly", - "unsigned", - "unskilled", - "unsliced", - "unsmooth", - "unsnap", - "unsocial", - "unsoiled", - "unsold", - "unsolved", - "unsorted", - "unspoiled", - "unspoken", - "unstable", - "unstaffed", - "unstamped", - "unsteady", - "unsterile", - "unstirred", - "unstitch", - "unstopped", - "unstuck", - "unstuffed", - "unstylish", - "unsubtle", - "unsubtly", - "unsuited", - "unsure", - "unsworn", - "untagged", - "untainted", - "untaken", - "untamed", - "untangled", - "untapped", - "untaxed", - "unthawed", - "unthread", - "untidy", - "untie", - "until", - "untimed", - "untimely", - "untitled", - "untoasted", - "untold", - "untouched", - "untracked", - "untrained", - "untreated", - "untried", - "untrimmed", - "untrue", - "untruth", - "unturned", - "untwist", - "untying", - "unusable", - "unused", - "unusual", - "unvalued", - "unvaried", - "unvarying", - "unveiled", - "unveiling", - "unvented", - "unviable", - "unvisited", - "unvocal", - "unwanted", - "unwarlike", - "unwary", - "unwashed", - "unwatched", - "unweave", - "unwed", - "unwelcome", - "unwell", - "unwieldy", - "unwilling", - "unwind", - "unwired", - "unwitting", - "unwomanly", - "unworldly", - "unworn", - "unworried", - "unworthy", - "unwound", - "unwoven", - "unwrapped", - "unwritten", - "unzip", - "upbeat", - "upchuck", - "upcoming", - "upcountry", - "update", - "upfront", - "upgrade", - "upheaval", - "upheld", - "uphill", - "uphold", - "uplifted", - "uplifting", - "upload", - "upon", - "upper", - "upright", - "uprising", - "upriver", - "uproar", - "uproot", - "upscale", - "upside", - "upstage", - "upstairs", - "upstart", - "upstate", - "upstream", - "upstroke", - "upswing", - "uptake", - "uptight", - "uptown", - "upturned", - "upward", - "upwind", - "uranium", - "urban", - "urchin", - "urethane", - "urgency", - "urgent", - "urging", - "urologist", - "urology", - "usable", - "usage", - "useable", - "used", - "uselessly", - "user", - "usher", - "usual", - "utensil", - "utility", - "utilize", - "utmost", - "utopia", - "utter", - "vacancy", - "vacant", - "vacate", - "vacation", - "vagabond", - "vagrancy", - "vagrantly", - "vaguely", - "vagueness", - "valiant", - "valid", - "valium", - "valley", - "valuables", - "value", - "vanilla", - "vanish", - "vanity", - "vanquish", - "vantage", - "vaporizer", - "variable", - "variably", - "varied", - "variety", - "various", - "varmint", - "varnish", - "varsity", - "varying", - "vascular", - "vaseline", - "vastly", - "vastness", - "veal", - "vegan", - "veggie", - "vehicular", - "velcro", - "velocity", - "velvet", - "vendetta", - "vending", - "vendor", - "veneering", - "vengeful", - "venomous", - "ventricle", - "venture", - "venue", - "venus", - "verbalize", - "verbally", - "verbose", - "verdict", - "verify", - "verse", - "version", - "versus", - "vertebrae", - "vertical", - "vertigo", - "very", - "vessel", - "vest", - "veteran", - "veto", - "vexingly", - "viability", - "viable", - "vibes", - "vice", - "vicinity", - "victory", - "video", - "viewable", - "viewer", - "viewing", - "viewless", - "viewpoint", - "vigorous", - "village", - "villain", - "vindicate", - "vineyard", - "vintage", - "violate", - "violation", - "violator", - "violet", - "violin", - "viper", - "viral", - "virtual", - "virtuous", - "virus", - "visa", - "viscosity", - "viscous", - "viselike", - "visible", - "visibly", - "vision", - "visiting", - "visitor", - "visor", - "vista", - "vitality", - "vitalize", - "vitally", - "vitamins", - "vivacious", - "vividly", - "vividness", - "vixen", - "vocalist", - "vocalize", - "vocally", - "vocation", - "voice", - "voicing", - "void", - "volatile", - "volley", - "voltage", - "volumes", - "voter", - "voting", - "voucher", - "vowed", - "vowel", - "voyage", - "wackiness", - "wad", - "wafer", - "waffle", - "waged", - "wager", - "wages", - "waggle", - "wagon", - "wake", - "waking", - "walk", - "walmart", - "walnut", - "walrus", - "waltz", - "wand", - "wannabe", - "wanted", - "wanting", - "wasabi", - "washable", - "washbasin", - "washboard", - "washbowl", - "washcloth", - "washday", - "washed", - "washer", - "washhouse", - "washing", - "washout", - "washroom", - "washstand", - "washtub", - "wasp", - "wasting", - "watch", - "water", - "waviness", - "waving", - "wavy", - "whacking", - "whacky", - "wham", - "wharf", - "wheat", - "whenever", - "whiff", - "whimsical", - "whinny", - "whiny", - "whisking", - "whoever", - "whole", - "whomever", - "whoopee", - "whooping", - "whoops", - "why", - "wick", - "widely", - "widen", - "widget", - "widow", - "width", - "wieldable", - "wielder", - "wife", - "wifi", - "wikipedia", - "wildcard", - "wildcat", - "wilder", - "wildfire", - "wildfowl", - "wildland", - "wildlife", - "wildly", - "wildness", - "willed", - "willfully", - "willing", - "willow", - "willpower", - "wilt", - "wimp", - "wince", - "wincing", - "wind", - "wing", - "winking", - "winner", - "winnings", - "winter", - "wipe", - "wired", - "wireless", - "wiring", - "wiry", - "wisdom", - "wise", - "wish", - "wisplike", - "wispy", - "wistful", - "wizard", - "wobble", - "wobbling", - "wobbly", - "wok", - "wolf", - "wolverine", - "womanhood", - "womankind", - "womanless", - "womanlike", - "womanly", - "womb", - "woof", - "wooing", - "wool", - "woozy", - "word", - "work", - "worried", - "worrier", - "worrisome", - "worry", - "worsening", - "worshiper", - "worst", - "wound", - "woven", - "wow", - "wrangle", - "wrath", - "wreath", - "wreckage", - "wrecker", - "wrecking", - "wrench", - "wriggle", - "wriggly", - "wrinkle", - "wrinkly", - "wrist", - "writing", - "written", - "wrongdoer", - "wronged", - "wrongful", - "wrongly", - "wrongness", - "wrought", - "xbox", - "xerox", - "yahoo", - "yam", - "yanking", - "yapping", - "yard", - "yarn", - "yeah", - "yearbook", - "yearling", - "yearly", - "yearning", - "yeast", - "yelling", - "yelp", - "yen", - "yesterday", - "yiddish", - "yield", - "yin", - "yippee", - "yo-yo", - "yodel", - "yoga", - "yogurt", - "yonder", - "yoyo", - "yummy", - "zap", - "zealous", - "zebra", - "zen", - "zeppelin", - "zero", - "zestfully", - "zesty", - "zigzagged", - "zipfile", - "zipping", - "zippy", - "zips", - "zit", - "zodiac", - "zombie", - "zone", - "zoning", - "zookeeper", - "zoologist", - "zoology", - "zoom", -]; diff --git a/crates/bitwarden-crypto/uniffi.toml b/crates/bitwarden-crypto/uniffi.toml deleted file mode 100644 index 3cac32ecc..000000000 --- a/crates/bitwarden-crypto/uniffi.toml +++ /dev/null @@ -1,9 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.crypto" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenCryptoFFI" -module_name = "BitwardenCrypto" -generate_immutable_records = true diff --git a/crates/bitwarden-exporters/Cargo.toml b/crates/bitwarden-exporters/Cargo.toml deleted file mode 100644 index 38cf49953..000000000 --- a/crates/bitwarden-exporters/Cargo.toml +++ /dev/null @@ -1,35 +0,0 @@ -[package] -name = "bitwarden-exporters" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" -exclude = ["/resources"] - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[features] -uniffi = ["dep:uniffi"] # Uniffi bindings - -[dependencies] -base64 = ">=0.22.1, <0.23" -bitwarden-core = { workspace = true } -bitwarden-crypto = { workspace = true } -bitwarden-vault = { workspace = true } -chrono = { workspace = true, features = ["std"] } -csv = "1.3.0" -schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } -uniffi = { workspace = true, optional = true } -uuid = { workspace = true } - -[lints] -workspace = true diff --git a/crates/bitwarden-exporters/README.md b/crates/bitwarden-exporters/README.md deleted file mode 100644 index 59936680f..000000000 --- a/crates/bitwarden-exporters/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Exporters - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-exporters/resources/json_export.json b/crates/bitwarden-exporters/resources/json_export.json deleted file mode 100644 index ad5380550..000000000 --- a/crates/bitwarden-exporters/resources/json_export.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "encrypted": false, - "folders": [ - { - "id": "942e2984-1b9a-453b-b039-b107012713b9", - "name": "Important" - } - ], - "items": [ - { - "id": "25c8c414-b446-48e9-a1bd-b10700bbd740", - "folderId": "942e2984-1b9a-453b-b039-b107012713b9", - "organizationId": null, - "collectionIds": null, - "name": "Bitwarden", - "notes": "My note", - "type": 1, - "login": { - "username": "test@bitwarden.com", - "password": "asdfasdfasdf", - "uris": [ - { - "uri": "https://vault.bitwarden.com", - "match": null - } - ], - "totp": "ABC", - "fido2Credentials": [] - }, - "favorite": true, - "reprompt": 0, - "fields": [ - { - "name": "Text", - "value": "A", - "type": 0, - "linkedId": null - }, - { - "name": "Hidden", - "value": "B", - "type": 1, - "linkedId": null - }, - { - "name": "Boolean (true)", - "value": "true", - "type": 2, - "linkedId": null - }, - { - "name": "Boolean (false)", - "value": "false", - "type": 2, - "linkedId": null - }, - { - "name": "Linked", - "value": null, - "type": 3, - "linkedId": 101 - } - ], - "passwordHistory": null, - "revisionDate": "2024-01-30T14:09:33.753Z", - "creationDate": "2024-01-30T11:23:54.416Z", - "deletedDate": null - }, - { - "id": "23f0f877-42b1-4820-a850-b10700bc41eb", - "folderId": null, - "organizationId": null, - "collectionIds": null, - "name": "My secure note", - "notes": "Very secure!", - "type": 2, - "secureNote": { - "type": 0 - }, - "favorite": false, - "reprompt": 0, - "passwordHistory": null, - "revisionDate": "2024-01-30T11:25:25.466Z", - "creationDate": "2024-01-30T11:25:25.466Z", - "deletedDate": null - }, - { - "id": "3ed8de45-48ee-4e26-a2dc-b10701276c53", - "folderId": null, - "organizationId": null, - "collectionIds": null, - "name": "My card", - "notes": null, - "type": 3, - "card": { - "cardholderName": "John Doe", - "expMonth": "1", - "expYear": "2032", - "code": "123", - "brand": "Visa", - "number": "4111111111111111" - }, - "favorite": false, - "reprompt": 0, - "passwordHistory": null, - "revisionDate": "2024-01-30T17:55:36.150Z", - "creationDate": "2024-01-30T17:55:36.150Z", - "deletedDate": null - }, - { - "id": "41cc3bc1-c3d9-4637-876c-b10701273712", - "folderId": "942e2984-1b9a-453b-b039-b107012713b9", - "organizationId": null, - "collectionIds": null, - "name": "My identity", - "notes": null, - "type": 4, - "identity": { - "title": "Mr", - "firstName": "John", - "middleName": null, - "lastName": "Doe", - "address1": null, - "address2": null, - "address3": null, - "city": null, - "state": null, - "postalCode": null, - "country": null, - "company": "Bitwarden", - "email": null, - "phone": null, - "ssn": null, - "username": "JDoe", - "passportNumber": null, - "licenseNumber": null - }, - "favorite": false, - "reprompt": 0, - "passwordHistory": null, - "revisionDate": "2024-01-30T17:54:50.706Z", - "creationDate": "2024-01-30T17:54:50.706Z", - "deletedDate": null - } - ] -} \ No newline at end of file diff --git a/crates/bitwarden-exporters/src/client_exporter.rs b/crates/bitwarden-exporters/src/client_exporter.rs deleted file mode 100644 index ffc9963c1..000000000 --- a/crates/bitwarden-exporters/src/client_exporter.rs +++ /dev/null @@ -1,45 +0,0 @@ -use bitwarden_core::Client; -use bitwarden_vault::{Cipher, Collection, Folder}; - -use crate::{ - export::{export_organization_vault, export_vault}, - ExportError, ExportFormat, -}; - -pub struct ClientExporters<'a> { - client: &'a Client, -} - -impl<'a> ClientExporters<'a> { - fn new(client: &'a Client) -> Self { - Self { client } - } - - pub fn export_vault( - &self, - folders: Vec, - ciphers: Vec, - format: ExportFormat, - ) -> Result { - export_vault(self.client, folders, ciphers, format) - } - - pub fn export_organization_vault( - &self, - collections: Vec, - ciphers: Vec, - format: ExportFormat, - ) -> Result { - export_organization_vault(collections, ciphers, format) - } -} - -pub trait ClientExportersExt<'a> { - fn exporters(&'a self) -> ClientExporters<'a>; -} - -impl<'a> ClientExportersExt<'a> for Client { - fn exporters(&'a self) -> ClientExporters<'a> { - ClientExporters::new(self) - } -} diff --git a/crates/bitwarden-exporters/src/csv.rs b/crates/bitwarden-exporters/src/csv.rs deleted file mode 100644 index a0dcd1040..000000000 --- a/crates/bitwarden-exporters/src/csv.rs +++ /dev/null @@ -1,266 +0,0 @@ -use std::collections::HashMap; - -use csv::Writer; -use serde::Serializer; -use thiserror::Error; -use uuid::Uuid; - -use crate::{Cipher, CipherType, Field, Folder}; - -#[derive(Debug, Error)] -pub enum CsvError { - #[error("CSV error")] - Csv, -} - -pub(crate) fn export_csv(folders: Vec, ciphers: Vec) -> Result { - let folders: HashMap = folders.into_iter().map(|f| (f.id, f.name)).collect(); - - let rows = ciphers - .into_iter() - .filter(|c| matches!(c.r#type, CipherType::Login(_) | CipherType::SecureNote(_))) - .map(|c| { - let login = if let CipherType::Login(l) = &c.r#type { - Some(l) - } else { - None - }; - - CsvRow { - folder: c - .folder_id - .and_then(|f| folders.get(&f)) - .map(|f| f.to_owned()), - favorite: c.favorite, - r#type: c.r#type.to_string(), - name: c.name.to_owned(), - notes: c.notes.to_owned(), - fields: c.fields, - reprompt: c.reprompt, - login_uri: login - .map(|l| l.login_uris.iter().flat_map(|l| l.uri.clone()).collect()) - .unwrap_or_default(), - login_username: login.and_then(|l| l.username.clone()), - login_password: login.and_then(|l| l.password.clone()), - login_totp: login.and_then(|l| l.totp.clone()), - } - }); - - let mut wtr = Writer::from_writer(vec![]); - for row in rows { - wtr.serialize(row).expect("Serialize should be infallible"); - } - - String::from_utf8(wtr.into_inner().map_err(|_| CsvError::Csv)?).map_err(|_| CsvError::Csv) -} - -/// CSV export format. See -/// -/// Be careful when changing this struct to maintain compatibility with old exports. -#[derive(serde::Serialize)] -struct CsvRow { - folder: Option, - #[serde(serialize_with = "bool_serialize")] - favorite: bool, - r#type: String, - name: String, - notes: Option, - #[serde(serialize_with = "fields_serialize")] - fields: Vec, - reprompt: u8, - #[serde(serialize_with = "vec_serialize")] - login_uri: Vec, - login_username: Option, - login_password: Option, - login_totp: Option, -} - -fn vec_serialize(x: &[String], s: S) -> Result -where - S: Serializer, -{ - s.serialize_str(x.join(",").as_str()) -} - -fn bool_serialize(x: &bool, s: S) -> Result -where - S: Serializer, -{ - s.serialize_str(if *x { "1" } else { "" }) -} - -fn fields_serialize(x: &[Field], s: S) -> Result -where - S: Serializer, -{ - s.serialize_str( - x.iter() - .map(|f| { - format!( - "{}: {}", - f.name.to_owned().unwrap_or_default(), - f.value.to_owned().unwrap_or_default() - ) - }) - .collect::>() - .join("\n") - .as_str(), - ) -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::{Card, Identity, Login, LoginUri}; - - #[test] - fn test_export_csv() { - let folders = vec![ - Folder { - id: "d55d65d7-c161-40a4-94ca-b0d20184d91a".parse().unwrap(), - name: "Test Folder A".to_string(), - }, - Folder { - id: "583e7665-0126-4d37-9139-b0d20184dd86".parse().unwrap(), - name: "Test Folder B".to_string(), - }, - ]; - let ciphers = vec![ - Cipher { - id: "d55d65d7-c161-40a4-94ca-b0d20184d91a".parse().unwrap(), - folder_id: None, - name: "test@bitwarden.com".to_string(), - notes: None, - r#type: CipherType::Login(Box::new(Login { - username: Some("test@bitwarden.com".to_string()), - password: Some("Abc123".to_string()), - login_uris: vec![LoginUri { - uri: Some("https://google.com".to_string()), - r#match: None, - }], - totp: None, - })), - favorite: false, - reprompt: 0, - fields: vec![], - revision_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - creation_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - deleted_date: None, - }, - Cipher { - id: "7dd81bd0-cc72-4f42-96e7-b0fc014e71a3".parse().unwrap(), - folder_id: Some("583e7665-0126-4d37-9139-b0d20184dd86".parse().unwrap()), - name: "Steam Account".to_string(), - notes: None, - r#type: CipherType::Login(Box::new(Login { - username: Some("steam".to_string()), - password: Some("3Pvb8u7EfbV*nJ".to_string()), - login_uris: vec![LoginUri { - uri: Some("https://steampowered.com".to_string()), - r#match: None, - }], - totp: Some("steam://ABCD123".to_string()), - })), - favorite: true, - reprompt: 0, - fields: vec![ - Field { - name: Some("Test".to_string()), - value: Some("v".to_string()), - r#type: 0, - linked_id: None, - }, - Field { - name: Some("Hidden".to_string()), - value: Some("asdfer".to_string()), - r#type: 1, - linked_id: None, - }, - ], - revision_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - creation_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - deleted_date: None, - }, - ]; - - let csv = export_csv(folders, ciphers).unwrap(); - let expected = [ - "folder,favorite,type,name,notes,fields,reprompt,login_uri,login_username,login_password,login_totp", - ",,login,test@bitwarden.com,,,0,https://google.com,test@bitwarden.com,Abc123,", - "Test Folder B,1,login,Steam Account,,\"Test: v\nHidden: asdfer\",0,https://steampowered.com,steam,3Pvb8u7EfbV*nJ,steam://ABCD123", - "", - ].join("\n"); - - assert_eq!(csv, expected); - } - - #[test] - fn test_export_ignore_card() { - let folders = vec![]; - let ciphers = vec![Cipher { - id: "d55d65d7-c161-40a4-94ca-b0d20184d91a".parse().unwrap(), - folder_id: None, - name: "My Card".to_string(), - notes: None, - r#type: CipherType::Card(Box::new(Card { - cardholder_name: None, - exp_month: None, - exp_year: None, - code: None, - brand: None, - number: None, - })), - favorite: false, - reprompt: 0, - fields: vec![], - revision_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - creation_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - deleted_date: None, - }]; - - let csv = export_csv(folders, ciphers).unwrap(); - - assert_eq!(csv, ""); - } - - #[test] - fn test_export_ignore_identity() { - let folders = vec![]; - let ciphers = vec![Cipher { - id: "d55d65d7-c161-40a4-94ca-b0d20184d91a".parse().unwrap(), - folder_id: None, - name: "My Identity".to_string(), - notes: None, - r#type: CipherType::Identity(Box::new(Identity { - title: None, - first_name: None, - middle_name: None, - last_name: None, - address1: None, - address2: None, - address3: None, - city: None, - state: None, - postal_code: None, - country: None, - company: None, - email: None, - phone: None, - ssn: None, - username: None, - passport_number: None, - license_number: None, - })), - favorite: false, - reprompt: 0, - fields: vec![], - revision_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - creation_date: "2024-01-30T11:28:20.036Z".parse().unwrap(), - deleted_date: None, - }]; - - let csv = export_csv(folders, ciphers).unwrap(); - - assert_eq!(csv, ""); - } -} diff --git a/crates/bitwarden-exporters/src/encrypted_json.rs b/crates/bitwarden-exporters/src/encrypted_json.rs deleted file mode 100644 index 0378bd9f3..000000000 --- a/crates/bitwarden-exporters/src/encrypted_json.rs +++ /dev/null @@ -1,246 +0,0 @@ -use base64::{engine::general_purpose::STANDARD, Engine}; -use bitwarden_crypto::{generate_random_bytes, Kdf, KeyEncryptable, PinKey}; -use serde::Serialize; -use thiserror::Error; -use uuid::Uuid; - -use crate::{ - json::{self, export_json}, - Cipher, Folder, -}; - -#[derive(Error, Debug)] -pub enum EncryptedJsonError { - #[error(transparent)] - JsonExport(#[from] json::JsonError), - - #[error("JSON error: {0}")] - Serde(#[from] serde_json::Error), - - #[error("Cryptography error, {0}")] - Crypto(#[from] bitwarden_crypto::CryptoError), -} - -pub(crate) fn export_encrypted_json( - folders: Vec, - ciphers: Vec, - password: String, - kdf: Kdf, -) -> Result { - let decrypted_export = export_json(folders, ciphers)?; - - let (kdf_type, kdf_iterations, kdf_memory, kdf_parallelism) = match kdf { - Kdf::PBKDF2 { iterations } => (0, iterations.get(), None, None), - Kdf::Argon2id { - iterations, - memory, - parallelism, - } => ( - 1, - iterations.get(), - Some(memory.get()), - Some(parallelism.get()), - ), - }; - - let salt = generate_random_bytes::<[u8; 16]>(); - let salt = STANDARD.encode(salt); - let key = PinKey::derive(password.as_bytes(), salt.as_bytes(), &kdf)?; - - let enc_key_validation = Uuid::new_v4().to_string(); - - let encrypted_export = EncryptedJsonExport { - encrypted: true, - password_protected: true, - salt, - kdf_type, - kdf_iterations, - kdf_memory, - kdf_parallelism, - enc_key_validation: enc_key_validation.encrypt_with_key(&key)?.to_string(), - data: decrypted_export.encrypt_with_key(&key)?.to_string(), - }; - - Ok(serde_json::to_string_pretty(&encrypted_export)?) -} - -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub(crate) struct EncryptedJsonExport { - encrypted: bool, - password_protected: bool, - salt: String, - kdf_type: u32, - kdf_iterations: u32, - kdf_memory: Option, - kdf_parallelism: Option, - #[serde(rename = "encKeyValidation_DO_NOT_EDIT")] - enc_key_validation: String, - data: String, -} - -#[cfg(test)] -mod tests { - use std::num::NonZeroU32; - - use super::*; - use crate::{ - Card, Cipher, CipherType, Field, Identity, Login, LoginUri, SecureNote, SecureNoteType, - }; - - #[test] - pub fn test_export() { - let _export = export_encrypted_json( - vec![Folder { - id: "942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap(), - name: "Important".to_string(), - }], - vec![ - Cipher { - id: "25c8c414-b446-48e9-a1bd-b10700bbd740".parse().unwrap(), - folder_id: Some("942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap()), - - name: "Bitwarden".to_string(), - notes: Some("My note".to_string()), - - r#type: CipherType::Login(Box::new(Login { - username: Some("test@bitwarden.com".to_string()), - password: Some("asdfasdfasdf".to_string()), - login_uris: vec![LoginUri { - uri: Some("https://vault.bitwarden.com".to_string()), - r#match: None, - }], - totp: Some("ABC".to_string()), - })), - - favorite: true, - reprompt: 0, - - fields: vec![ - Field { - name: Some("Text".to_string()), - value: Some("A".to_string()), - r#type: 0, - linked_id: None, - }, - Field { - name: Some("Hidden".to_string()), - value: Some("B".to_string()), - r#type: 1, - linked_id: None, - }, - Field { - name: Some("Boolean (true)".to_string()), - value: Some("true".to_string()), - r#type: 2, - linked_id: None, - }, - Field { - name: Some("Boolean (false)".to_string()), - value: Some("false".to_string()), - r#type: 2, - linked_id: None, - }, - Field { - name: Some("Linked".to_string()), - value: None, - r#type: 3, - linked_id: Some(101), - }, - ], - - revision_date: "2024-01-30T14:09:33.753Z".parse().unwrap(), - creation_date: "2024-01-30T11:23:54.416Z".parse().unwrap(), - deleted_date: None, - }, - Cipher { - id: "23f0f877-42b1-4820-a850-b10700bc41eb".parse().unwrap(), - folder_id: None, - - name: "My secure note".to_string(), - notes: Some("Very secure!".to_string()), - - r#type: CipherType::SecureNote(Box::new(SecureNote { - r#type: SecureNoteType::Generic, - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T11:25:25.466Z".parse().unwrap(), - creation_date: "2024-01-30T11:25:25.466Z".parse().unwrap(), - deleted_date: None, - }, - Cipher { - id: "3ed8de45-48ee-4e26-a2dc-b10701276c53".parse().unwrap(), - folder_id: None, - - name: "My card".to_string(), - notes: None, - - r#type: CipherType::Card(Box::new(Card { - cardholder_name: Some("John Doe".to_string()), - exp_month: Some("1".to_string()), - exp_year: Some("2032".to_string()), - code: Some("123".to_string()), - brand: Some("Visa".to_string()), - number: Some("4111111111111111".to_string()), - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - creation_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - deleted_date: None, - }, - Cipher { - id: "41cc3bc1-c3d9-4637-876c-b10701273712".parse().unwrap(), - folder_id: Some("942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap()), - - name: "My identity".to_string(), - notes: None, - - r#type: CipherType::Identity(Box::new(Identity { - title: Some("Mr".to_string()), - first_name: Some("John".to_string()), - middle_name: None, - last_name: Some("Doe".to_string()), - address1: None, - address2: None, - address3: None, - city: None, - state: None, - postal_code: None, - country: None, - company: Some("Bitwarden".to_string()), - email: None, - phone: None, - ssn: None, - username: Some("JDoe".to_string()), - passport_number: None, - license_number: None, - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T17:54:50.706Z".parse().unwrap(), - creation_date: "2024-01-30T17:54:50.706Z".parse().unwrap(), - deleted_date: None, - }, - ], - "password".to_string(), - Kdf::PBKDF2 { - iterations: NonZeroU32::new(600_000).unwrap(), - }, - ) - .unwrap(); - } -} diff --git a/crates/bitwarden-exporters/src/error.rs b/crates/bitwarden-exporters/src/error.rs deleted file mode 100644 index d23819696..000000000 --- a/crates/bitwarden-exporters/src/error.rs +++ /dev/null @@ -1,21 +0,0 @@ -use thiserror::Error; - -#[derive(Error, Debug)] -pub enum ExportError { - #[error(transparent)] - MissingField(#[from] bitwarden_core::MissingFieldError), - #[error(transparent)] - VaultLocked(#[from] bitwarden_core::VaultLocked), - - #[error("CSV error: {0}")] - Csv(#[from] crate::csv::CsvError), - #[error("JSON error: {0}")] - Json(#[from] crate::json::JsonError), - #[error("Encrypted JSON error: {0}")] - EncryptedJsonError(#[from] crate::encrypted_json::EncryptedJsonError), - - #[error(transparent)] - BitwardenError(#[from] bitwarden_core::Error), - #[error(transparent)] - BitwardenCryptoError(#[from] bitwarden_crypto::CryptoError), -} diff --git a/crates/bitwarden-exporters/src/export.rs b/crates/bitwarden-exporters/src/export.rs deleted file mode 100644 index 7fa05413d..000000000 --- a/crates/bitwarden-exporters/src/export.rs +++ /dev/null @@ -1,43 +0,0 @@ -use bitwarden_core::Client; -use bitwarden_crypto::KeyDecryptable; -use bitwarden_vault::{Cipher, CipherView, Collection, Folder, FolderView}; - -use crate::{ - csv::export_csv, encrypted_json::export_encrypted_json, json::export_json, ExportError, - ExportFormat, -}; - -pub(crate) fn export_vault( - client: &Client, - folders: Vec, - ciphers: Vec, - format: ExportFormat, -) -> Result { - let enc = client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let folders: Vec = folders.decrypt_with_key(key)?; - let folders: Vec = folders.into_iter().flat_map(|f| f.try_into()).collect(); - - let ciphers: Vec = ciphers.decrypt_with_key(key)?; - let ciphers: Vec = ciphers.into_iter().flat_map(|c| c.try_into()).collect(); - - match format { - ExportFormat::Csv => Ok(export_csv(folders, ciphers)?), - ExportFormat::Json => Ok(export_json(folders, ciphers)?), - ExportFormat::EncryptedJson { password } => Ok(export_encrypted_json( - folders, - ciphers, - password, - client.internal.get_kdf()?, - )?), - } -} - -pub(crate) fn export_organization_vault( - _collections: Vec, - _ciphers: Vec, - _format: ExportFormat, -) -> Result { - todo!(); -} diff --git a/crates/bitwarden-exporters/src/json.rs b/crates/bitwarden-exporters/src/json.rs deleted file mode 100644 index 3f6c72c1f..000000000 --- a/crates/bitwarden-exporters/src/json.rs +++ /dev/null @@ -1,762 +0,0 @@ -use chrono::{DateTime, Utc}; -use thiserror::Error; -use uuid::Uuid; - -use crate::{Card, Cipher, CipherType, Field, Folder, Identity, Login, LoginUri, SecureNote}; - -#[derive(Error, Debug)] -pub enum JsonError { - #[error("JSON error: {0}")] - Serde(#[from] serde_json::Error), -} - -pub(crate) fn export_json(folders: Vec, ciphers: Vec) -> Result { - let export = JsonExport { - encrypted: false, - folders: folders.into_iter().map(|f| f.into()).collect(), - items: ciphers.into_iter().map(|c| c.into()).collect(), - }; - - Ok(serde_json::to_string_pretty(&export)?) -} - -/// JSON export format. These are intentionally decoupled from the internal data structures to -/// ensure internal changes are not reflected in the public exports. -/// -/// Be careful about changing these structs to maintain compatibility with old exporters/importers. -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonExport { - encrypted: bool, - folders: Vec, - items: Vec, -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonFolder { - id: Uuid, - name: String, -} - -impl From for JsonFolder { - fn from(folder: Folder) -> Self { - JsonFolder { - id: folder.id, - name: folder.name, - } - } -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonCipher { - id: Uuid, - folder_id: Option, - // Organizational IDs which are always empty in personal exports - organization_id: Option, - collection_ids: Option>, - - name: String, - notes: Option, - - r#type: u8, - #[serde(skip_serializing_if = "Option::is_none")] - login: Option, - #[serde(skip_serializing_if = "Option::is_none")] - identity: Option, - #[serde(skip_serializing_if = "Option::is_none")] - card: Option, - #[serde(skip_serializing_if = "Option::is_none")] - secure_note: Option, - - favorite: bool, - reprompt: u8, - - #[serde(skip_serializing_if = "Vec::is_empty")] - fields: Vec, - password_history: Option>, - - revision_date: DateTime, - creation_date: DateTime, - deleted_date: Option>, -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonLogin { - username: Option, - password: Option, - uris: Vec, - totp: Option, - fido2_credentials: Vec, -} - -impl From for JsonLogin { - fn from(login: Login) -> Self { - JsonLogin { - username: login.username, - password: login.password, - uris: login.login_uris.into_iter().map(|u| u.into()).collect(), - totp: login.totp, - fido2_credentials: vec![], - } - } -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonLoginUri { - uri: Option, - r#match: Option, -} - -impl From for JsonLoginUri { - fn from(login_uri: LoginUri) -> Self { - JsonLoginUri { - uri: login_uri.uri, - r#match: login_uri.r#match, - } - } -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonSecureNote { - r#type: u8, -} - -impl From for JsonSecureNote { - fn from(note: SecureNote) -> Self { - JsonSecureNote { - r#type: note.r#type as u8, - } - } -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonCard { - cardholder_name: Option, - exp_month: Option, - exp_year: Option, - code: Option, - brand: Option, - number: Option, -} - -impl From for JsonCard { - fn from(card: Card) -> Self { - JsonCard { - cardholder_name: card.cardholder_name, - exp_month: card.exp_month, - exp_year: card.exp_year, - code: card.code, - brand: card.brand, - number: card.number, - } - } -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonIdentity { - title: Option, - first_name: Option, - middle_name: Option, - last_name: Option, - address1: Option, - address2: Option, - address3: Option, - city: Option, - state: Option, - postal_code: Option, - country: Option, - company: Option, - email: Option, - phone: Option, - ssn: Option, - username: Option, - passport_number: Option, - license_number: Option, -} - -impl From for JsonIdentity { - fn from(identity: Identity) -> Self { - JsonIdentity { - title: identity.title, - first_name: identity.first_name, - middle_name: identity.middle_name, - last_name: identity.last_name, - address1: identity.address1, - address2: identity.address2, - address3: identity.address3, - city: identity.city, - state: identity.state, - postal_code: identity.postal_code, - country: identity.country, - company: identity.company, - email: identity.email, - phone: identity.phone, - ssn: identity.ssn, - username: identity.username, - passport_number: identity.passport_number, - license_number: identity.license_number, - } - } -} - -#[derive(serde::Serialize)] -#[serde(rename_all = "camelCase")] -struct JsonField { - name: Option, - value: Option, - r#type: u8, - linked_id: Option, -} - -impl From for JsonField { - fn from(field: Field) -> Self { - JsonField { - name: field.name, - value: field.value, - r#type: field.r#type, - linked_id: field.linked_id, - } - } -} - -impl From for JsonCipher { - fn from(cipher: Cipher) -> Self { - let r#type = match cipher.r#type { - CipherType::Login(_) => 1, - CipherType::SecureNote(_) => 2, - CipherType::Card(_) => 3, - CipherType::Identity(_) => 4, - }; - - let (login, secure_note, card, identity) = match cipher.r#type { - CipherType::Login(l) => (Some((*l).into()), None, None, None), - CipherType::SecureNote(s) => (None, Some((*s).into()), None, None), - CipherType::Card(c) => (None, None, Some((*c).into()), None), - CipherType::Identity(i) => (None, None, None, Some((*i).into())), - }; - - JsonCipher { - id: cipher.id, - folder_id: cipher.folder_id, - organization_id: None, - collection_ids: None, - name: cipher.name, - notes: cipher.notes, - r#type, - login, - identity, - card, - secure_note, - favorite: cipher.favorite, - reprompt: cipher.reprompt, - fields: cipher.fields.into_iter().map(|f| f.into()).collect(), - password_history: None, - revision_date: cipher.revision_date, - creation_date: cipher.creation_date, - deleted_date: cipher.deleted_date, - } - } -} - -#[cfg(test)] -mod tests { - use std::{fs, io::Read, path::PathBuf}; - - use super::*; - use crate::{Cipher, Field, LoginUri, SecureNoteType}; - - #[test] - fn test_convert_login() { - let cipher = Cipher { - id: "25c8c414-b446-48e9-a1bd-b10700bbd740".parse().unwrap(), - folder_id: Some("942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap()), - - name: "Bitwarden".to_string(), - notes: Some("My note".to_string()), - - r#type: CipherType::Login(Box::new(Login { - username: Some("test@bitwarden.com".to_string()), - password: Some("asdfasdfasdf".to_string()), - login_uris: vec![LoginUri { - uri: Some("https://vault.bitwarden.com".to_string()), - r#match: None, - }], - totp: Some("ABC".to_string()), - })), - - favorite: true, - reprompt: 0, - - fields: vec![ - Field { - name: Some("Text".to_string()), - value: Some("A".to_string()), - r#type: 0, - linked_id: None, - }, - Field { - name: Some("Hidden".to_string()), - value: Some("B".to_string()), - r#type: 1, - linked_id: None, - }, - Field { - name: Some("Boolean (true)".to_string()), - value: Some("true".to_string()), - r#type: 2, - linked_id: None, - }, - Field { - name: Some("Boolean (false)".to_string()), - value: Some("false".to_string()), - r#type: 2, - linked_id: None, - }, - Field { - name: Some("Linked".to_string()), - value: None, - r#type: 3, - linked_id: Some(101), - }, - ], - - revision_date: "2024-01-30T14:09:33.753Z".parse().unwrap(), - creation_date: "2024-01-30T11:23:54.416Z".parse().unwrap(), - deleted_date: None, - }; - - let json = serde_json::to_string(&JsonCipher::from(cipher)).unwrap(); - - let expected = r#"{ - "passwordHistory": null, - "revisionDate": "2024-01-30T14:09:33.753Z", - "creationDate": "2024-01-30T11:23:54.416Z", - "deletedDate": null, - "id": "25c8c414-b446-48e9-a1bd-b10700bbd740", - "organizationId": null, - "folderId": "942e2984-1b9a-453b-b039-b107012713b9", - "type": 1, - "reprompt": 0, - "name": "Bitwarden", - "notes": "My note", - "favorite": true, - "fields": [ - { - "name": "Text", - "value": "A", - "type": 0, - "linkedId": null - }, - { - "name": "Hidden", - "value": "B", - "type": 1, - "linkedId": null - }, - { - "name": "Boolean (true)", - "value": "true", - "type": 2, - "linkedId": null - }, - { - "name": "Boolean (false)", - "value": "false", - "type": 2, - "linkedId": null - }, - { - "name": "Linked", - "value": null, - "type": 3, - "linkedId": 101 - } - ], - "login": { - "fido2Credentials": [], - "uris": [ - { - "match": null, - "uri": "https://vault.bitwarden.com" - } - ], - "username": "test@bitwarden.com", - "password": "asdfasdfasdf", - "totp": "ABC" - }, - "collectionIds": null - }"#; - - assert_eq!( - json.parse::().unwrap(), - expected.parse::().unwrap() - ) - } - - #[test] - fn test_convert_secure_note() { - let cipher = Cipher { - id: "23f0f877-42b1-4820-a850-b10700bc41eb".parse().unwrap(), - folder_id: None, - - name: "My secure note".to_string(), - notes: Some("Very secure!".to_string()), - - r#type: CipherType::SecureNote(Box::new(SecureNote { - r#type: SecureNoteType::Generic, - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T11:25:25.466Z".parse().unwrap(), - creation_date: "2024-01-30T11:25:25.466Z".parse().unwrap(), - deleted_date: None, - }; - - let json = serde_json::to_string(&JsonCipher::from(cipher)).unwrap(); - - let expected = r#"{ - "passwordHistory": null, - "revisionDate": "2024-01-30T11:25:25.466Z", - "creationDate": "2024-01-30T11:25:25.466Z", - "deletedDate": null, - "id": "23f0f877-42b1-4820-a850-b10700bc41eb", - "organizationId": null, - "folderId": null, - "type": 2, - "reprompt": 0, - "name": "My secure note", - "notes": "Very secure!", - "favorite": false, - "secureNote": { - "type": 0 - }, - "collectionIds": null - }"#; - - assert_eq!( - json.parse::().unwrap(), - expected.parse::().unwrap() - ) - } - - #[test] - fn test_convert_card() { - let cipher = Cipher { - id: "3ed8de45-48ee-4e26-a2dc-b10701276c53".parse().unwrap(), - folder_id: None, - - name: "My card".to_string(), - notes: None, - - r#type: CipherType::Card(Box::new(Card { - cardholder_name: Some("John Doe".to_string()), - exp_month: Some("1".to_string()), - exp_year: Some("2032".to_string()), - code: Some("123".to_string()), - brand: Some("Visa".to_string()), - number: Some("4111111111111111".to_string()), - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - creation_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - deleted_date: None, - }; - - let json = serde_json::to_string(&JsonCipher::from(cipher)).unwrap(); - - let expected = r#"{ - "passwordHistory": null, - "revisionDate": "2024-01-30T17:55:36.150Z", - "creationDate": "2024-01-30T17:55:36.150Z", - "deletedDate": null, - "id": "3ed8de45-48ee-4e26-a2dc-b10701276c53", - "organizationId": null, - "folderId": null, - "type": 3, - "reprompt": 0, - "name": "My card", - "notes": null, - "favorite": false, - "card": { - "cardholderName": "John Doe", - "brand": "Visa", - "number": "4111111111111111", - "expMonth": "1", - "expYear": "2032", - "code": "123" - }, - "collectionIds": null - }"#; - - assert_eq!( - json.parse::().unwrap(), - expected.parse::().unwrap() - ) - } - - #[test] - fn test_convert_identity() { - let cipher = Cipher { - id: "41cc3bc1-c3d9-4637-876c-b10701273712".parse().unwrap(), - folder_id: Some("942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap()), - - name: "My identity".to_string(), - notes: None, - - r#type: CipherType::Identity(Box::new(Identity { - title: Some("Mr".to_string()), - first_name: Some("John".to_string()), - middle_name: None, - last_name: Some("Doe".to_string()), - address1: None, - address2: None, - address3: None, - city: None, - state: None, - postal_code: None, - country: None, - company: Some("Bitwarden".to_string()), - email: None, - phone: None, - ssn: None, - username: Some("JDoe".to_string()), - passport_number: None, - license_number: None, - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T17:54:50.706Z".parse().unwrap(), - creation_date: "2024-01-30T17:54:50.706Z".parse().unwrap(), - deleted_date: None, - }; - - let json = serde_json::to_string(&JsonCipher::from(cipher)).unwrap(); - - let expected = r#"{ - "passwordHistory": null, - "revisionDate": "2024-01-30T17:54:50.706Z", - "creationDate": "2024-01-30T17:54:50.706Z", - "deletedDate": null, - "id": "41cc3bc1-c3d9-4637-876c-b10701273712", - "organizationId": null, - "folderId": "942e2984-1b9a-453b-b039-b107012713b9", - "type": 4, - "reprompt": 0, - "name": "My identity", - "notes": null, - "favorite": false, - "identity": { - "title": "Mr", - "firstName": "John", - "middleName": null, - "lastName": "Doe", - "address1": null, - "address2": null, - "address3": null, - "city": null, - "state": null, - "postalCode": null, - "country": null, - "company": "Bitwarden", - "email": null, - "phone": null, - "ssn": null, - "username": "JDoe", - "passportNumber": null, - "licenseNumber": null - }, - "collectionIds": null - }"#; - - assert_eq!( - json.parse::().unwrap(), - expected.parse::().unwrap() - ) - } - - #[test] - pub fn test_export() { - let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - d.push("resources"); - d.push("json_export.json"); - - let mut file = fs::File::open(d).unwrap(); - - let mut expected = String::new(); - file.read_to_string(&mut expected).unwrap(); - - let export = export_json( - vec![Folder { - id: "942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap(), - name: "Important".to_string(), - }], - vec![ - Cipher { - id: "25c8c414-b446-48e9-a1bd-b10700bbd740".parse().unwrap(), - folder_id: Some("942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap()), - - name: "Bitwarden".to_string(), - notes: Some("My note".to_string()), - - r#type: CipherType::Login(Box::new(Login { - username: Some("test@bitwarden.com".to_string()), - password: Some("asdfasdfasdf".to_string()), - login_uris: vec![LoginUri { - uri: Some("https://vault.bitwarden.com".to_string()), - r#match: None, - }], - totp: Some("ABC".to_string()), - })), - - favorite: true, - reprompt: 0, - - fields: vec![ - Field { - name: Some("Text".to_string()), - value: Some("A".to_string()), - r#type: 0, - linked_id: None, - }, - Field { - name: Some("Hidden".to_string()), - value: Some("B".to_string()), - r#type: 1, - linked_id: None, - }, - Field { - name: Some("Boolean (true)".to_string()), - value: Some("true".to_string()), - r#type: 2, - linked_id: None, - }, - Field { - name: Some("Boolean (false)".to_string()), - value: Some("false".to_string()), - r#type: 2, - linked_id: None, - }, - Field { - name: Some("Linked".to_string()), - value: None, - r#type: 3, - linked_id: Some(101), - }, - ], - - revision_date: "2024-01-30T14:09:33.753Z".parse().unwrap(), - creation_date: "2024-01-30T11:23:54.416Z".parse().unwrap(), - deleted_date: None, - }, - Cipher { - id: "23f0f877-42b1-4820-a850-b10700bc41eb".parse().unwrap(), - folder_id: None, - - name: "My secure note".to_string(), - notes: Some("Very secure!".to_string()), - - r#type: CipherType::SecureNote(Box::new(SecureNote { - r#type: SecureNoteType::Generic, - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T11:25:25.466Z".parse().unwrap(), - creation_date: "2024-01-30T11:25:25.466Z".parse().unwrap(), - deleted_date: None, - }, - Cipher { - id: "3ed8de45-48ee-4e26-a2dc-b10701276c53".parse().unwrap(), - folder_id: None, - - name: "My card".to_string(), - notes: None, - - r#type: CipherType::Card(Box::new(Card { - cardholder_name: Some("John Doe".to_string()), - exp_month: Some("1".to_string()), - exp_year: Some("2032".to_string()), - code: Some("123".to_string()), - brand: Some("Visa".to_string()), - number: Some("4111111111111111".to_string()), - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - creation_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - deleted_date: None, - }, - Cipher { - id: "41cc3bc1-c3d9-4637-876c-b10701273712".parse().unwrap(), - folder_id: Some("942e2984-1b9a-453b-b039-b107012713b9".parse().unwrap()), - - name: "My identity".to_string(), - notes: None, - - r#type: CipherType::Identity(Box::new(Identity { - title: Some("Mr".to_string()), - first_name: Some("John".to_string()), - middle_name: None, - last_name: Some("Doe".to_string()), - address1: None, - address2: None, - address3: None, - city: None, - state: None, - postal_code: None, - country: None, - company: Some("Bitwarden".to_string()), - email: None, - phone: None, - ssn: None, - username: Some("JDoe".to_string()), - passport_number: None, - license_number: None, - })), - - favorite: false, - reprompt: 0, - - fields: vec![], - - revision_date: "2024-01-30T17:54:50.706Z".parse().unwrap(), - creation_date: "2024-01-30T17:54:50.706Z".parse().unwrap(), - deleted_date: None, - }, - ], - ) - .unwrap(); - - assert_eq!( - export.parse::().unwrap(), - expected.parse::().unwrap() - ) - } -} diff --git a/crates/bitwarden-exporters/src/lib.rs b/crates/bitwarden-exporters/src/lib.rs deleted file mode 100644 index 75b0503e2..000000000 --- a/crates/bitwarden-exporters/src/lib.rs +++ /dev/null @@ -1,134 +0,0 @@ -use std::fmt; - -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use uuid::Uuid; - -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); - -mod client_exporter; -mod csv; -mod encrypted_json; -mod json; -mod models; -pub use client_exporter::{ClientExporters, ClientExportersExt}; -mod error; -mod export; -pub use error::ExportError; - -#[derive(JsonSchema)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum ExportFormat { - Csv, - Json, - EncryptedJson { password: String }, -} - -/// Export representation of a Bitwarden folder. -/// -/// These are mostly duplicated from the `bitwarden` vault models to facilitate a stable export API -/// that is not tied to the internal vault models. We may revisit this in the future. -pub struct Folder { - pub id: Uuid, - pub name: String, -} - -/// Export representation of a Bitwarden cipher. -/// -/// These are mostly duplicated from the `bitwarden` vault models to facilitate a stable export API -/// that is not tied to the internal vault models. We may revisit this in the future. -pub struct Cipher { - pub id: Uuid, - pub folder_id: Option, - - pub name: String, - pub notes: Option, - - pub r#type: CipherType, - - pub favorite: bool, - pub reprompt: u8, - - pub fields: Vec, - - pub revision_date: DateTime, - pub creation_date: DateTime, - pub deleted_date: Option>, -} - -#[derive(Clone)] -pub struct Field { - pub name: Option, - pub value: Option, - pub r#type: u8, - pub linked_id: Option, -} - -pub enum CipherType { - Login(Box), - SecureNote(Box), - Card(Box), - Identity(Box), -} - -impl fmt::Display for CipherType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CipherType::Login(_) => write!(f, "login"), - CipherType::SecureNote(_) => write!(f, "note"), - CipherType::Card(_) => write!(f, "card"), - CipherType::Identity(_) => write!(f, "identity"), - } - } -} - -pub struct Login { - pub username: Option, - pub password: Option, - pub login_uris: Vec, - pub totp: Option, -} - -pub struct LoginUri { - pub uri: Option, - pub r#match: Option, -} - -pub struct Card { - pub cardholder_name: Option, - pub exp_month: Option, - pub exp_year: Option, - pub code: Option, - pub brand: Option, - pub number: Option, -} - -pub struct SecureNote { - pub r#type: SecureNoteType, -} - -pub enum SecureNoteType { - Generic = 0, -} - -pub struct Identity { - pub title: Option, - pub first_name: Option, - pub middle_name: Option, - pub last_name: Option, - pub address1: Option, - pub address2: Option, - pub address3: Option, - pub city: Option, - pub state: Option, - pub postal_code: Option, - pub country: Option, - pub company: Option, - pub email: Option, - pub phone: Option, - pub ssn: Option, - pub username: Option, - pub passport_number: Option, - pub license_number: Option, -} diff --git a/crates/bitwarden-exporters/src/models.rs b/crates/bitwarden-exporters/src/models.rs deleted file mode 100644 index 1d56e7233..000000000 --- a/crates/bitwarden-exporters/src/models.rs +++ /dev/null @@ -1,220 +0,0 @@ -use bitwarden_core::{require, MissingFieldError}; -use bitwarden_vault::{ - CipherType, CipherView, FieldView, FolderView, LoginUriView, SecureNoteType, -}; - -impl TryFrom for crate::Folder { - type Error = MissingFieldError; - - fn try_from(value: FolderView) -> Result { - Ok(Self { - id: require!(value.id), - name: value.name, - }) - } -} - -impl TryFrom for crate::Cipher { - type Error = MissingFieldError; - - fn try_from(value: CipherView) -> Result { - let r = match value.r#type { - CipherType::Login => { - let l = require!(value.login); - crate::CipherType::Login(Box::new(crate::Login { - username: l.username, - password: l.password, - login_uris: l - .uris - .unwrap_or_default() - .into_iter() - .map(|u| u.into()) - .collect(), - totp: l.totp, - })) - } - CipherType::SecureNote => crate::CipherType::SecureNote(Box::new(crate::SecureNote { - r#type: value - .secure_note - .map(|t| t.r#type) - .unwrap_or(SecureNoteType::Generic) - .into(), - })), - CipherType::Card => { - let c = require!(value.card); - crate::CipherType::Card(Box::new(crate::Card { - cardholder_name: c.cardholder_name, - exp_month: c.exp_month, - exp_year: c.exp_year, - code: c.code, - brand: c.brand, - number: c.number, - })) - } - CipherType::Identity => { - let i = require!(value.identity); - crate::CipherType::Identity(Box::new(crate::Identity { - title: i.title, - first_name: i.first_name, - middle_name: i.middle_name, - last_name: i.last_name, - address1: i.address1, - address2: i.address2, - address3: i.address3, - city: i.city, - state: i.state, - postal_code: i.postal_code, - country: i.country, - company: i.company, - email: i.email, - phone: i.phone, - ssn: i.ssn, - username: i.username, - passport_number: i.passport_number, - license_number: i.license_number, - })) - } - }; - - Ok(Self { - id: require!(value.id), - folder_id: value.folder_id, - name: value.name, - notes: value.notes, - r#type: r, - favorite: value.favorite, - reprompt: value.reprompt as u8, - fields: value - .fields - .unwrap_or_default() - .into_iter() - .map(|f| f.into()) - .collect(), - revision_date: value.revision_date, - creation_date: value.creation_date, - deleted_date: value.deleted_date, - }) - } -} - -impl From for crate::Field { - fn from(value: FieldView) -> Self { - Self { - name: value.name, - value: value.value, - r#type: value.r#type as u8, - linked_id: value.linked_id.map(|id| id.into()), - } - } -} - -impl From for crate::LoginUri { - fn from(value: LoginUriView) -> Self { - Self { - r#match: value.r#match.map(|v| v as u8), - uri: value.uri, - } - } -} - -impl From for crate::SecureNoteType { - fn from(value: SecureNoteType) -> Self { - match value { - SecureNoteType::Generic => crate::SecureNoteType::Generic, - } - } -} - -#[cfg(test)] -mod tests { - use bitwarden_vault::{CipherRepromptType, LoginView}; - use chrono::{DateTime, Utc}; - - use super::*; - - #[test] - fn test_try_from_folder_view() { - let view = FolderView { - id: Some("fd411a1a-fec8-4070-985d-0e6560860e69".parse().unwrap()), - name: "test_name".to_string(), - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - }; - - let f: crate::Folder = view.try_into().unwrap(); - - assert_eq!( - f.id, - "fd411a1a-fec8-4070-985d-0e6560860e69".parse().unwrap() - ); - assert_eq!(f.name, "test_name".to_string()); - } - - #[test] - fn test_try_from_cipher_view_login() { - let cipher_view = CipherView { - r#type: CipherType::Login, - login: Some(LoginView { - username: Some("test_username".to_string()), - password: Some("test_password".to_string()), - password_revision_date: None, - uris: None, - totp: None, - autofill_on_page_load: None, - fido2_credentials: None, - }), - id: "fd411a1a-fec8-4070-985d-0e6560860e69".parse().ok(), - organization_id: None, - folder_id: None, - collection_ids: vec![], - key: None, - name: "My login".to_string(), - notes: None, - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: true, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - deleted_date: None, - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - }; - - let cipher: crate::Cipher = cipher_view.try_into().unwrap(); - - assert_eq!( - cipher.id, - "fd411a1a-fec8-4070-985d-0e6560860e69".parse().unwrap() - ); - assert_eq!(cipher.folder_id, None); - assert_eq!(cipher.name, "My login".to_string()); - assert_eq!(cipher.notes, None); - assert!(!cipher.favorite); - assert_eq!(cipher.reprompt, 0); - assert!(cipher.fields.is_empty()); - assert_eq!( - cipher.revision_date, - "2024-01-30T17:55:36.150Z".parse::>().unwrap() - ); - assert_eq!( - cipher.creation_date, - "2024-01-30T17:55:36.150Z".parse::>().unwrap() - ); - assert_eq!(cipher.deleted_date, None); - - if let crate::CipherType::Login(l) = cipher.r#type { - assert_eq!(l.username, Some("test_username".to_string())); - assert_eq!(l.password, Some("test_password".to_string())); - assert!(l.login_uris.is_empty()); - assert_eq!(l.totp, None); - } else { - panic!("Expected login type"); - } - } -} diff --git a/crates/bitwarden-exporters/uniffi.toml b/crates/bitwarden-exporters/uniffi.toml deleted file mode 100644 index 7a57dfabd..000000000 --- a/crates/bitwarden-exporters/uniffi.toml +++ /dev/null @@ -1,9 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.exporters" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenExportersFFI" -module_name = "BitwardenExporters" -generate_immutable_records = true diff --git a/crates/bitwarden-fido/Cargo.toml b/crates/bitwarden-fido/Cargo.toml deleted file mode 100644 index 20f5cdaf6..000000000 --- a/crates/bitwarden-fido/Cargo.toml +++ /dev/null @@ -1,43 +0,0 @@ -[package] -name = "bitwarden-fido" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[features] -uniffi = ["dep:uniffi", "bitwarden-core/uniffi", "bitwarden-vault/uniffi"] - -[dependencies] -async-trait = ">=0.1.80, <0.2" -base64 = ">=0.22.1, <0.23" -bitwarden-core = { workspace = true } -bitwarden-crypto = { workspace = true } -bitwarden-vault = { workspace = true } -chrono = { workspace = true } -coset = { version = "0.3.7" } -itertools = "0.13.0" -log = ">=0.4.18, <0.5" -p256 = { version = ">=0.13.2, <0.14" } -passkey = { git = "https://github.com/bitwarden/passkey-rs", rev = "ff757604cd7b4e8f321ed1616fef7e40e21ac5df" } -passkey-client = { git = "https://github.com/bitwarden/passkey-rs", rev = "ff757604cd7b4e8f321ed1616fef7e40e21ac5df", features = [ - "android-asset-validation", -] } -reqwest = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } -uniffi = { workspace = true, optional = true } -uuid = { workspace = true } - -[lints] -workspace = true diff --git a/crates/bitwarden-fido/README.md b/crates/bitwarden-fido/README.md deleted file mode 100644 index b94a1cb83..000000000 --- a/crates/bitwarden-fido/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Fido - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-fido/src/authenticator.rs b/crates/bitwarden-fido/src/authenticator.rs deleted file mode 100644 index cbddaf94b..000000000 --- a/crates/bitwarden-fido/src/authenticator.rs +++ /dev/null @@ -1,670 +0,0 @@ -use std::sync::Mutex; - -use bitwarden_core::{Client, VaultLocked}; -use bitwarden_crypto::{CryptoError, KeyContainer, KeyEncryptable}; -use bitwarden_vault::{CipherError, CipherView}; -use itertools::Itertools; -use log::error; -use passkey::{ - authenticator::{Authenticator, DiscoverabilitySupport, StoreInfo, UIHint, UserCheck}, - types::{ - ctap2::{self, Ctap2Error, StatusCode, VendorError}, - Passkey, - }, -}; -use thiserror::Error; - -use super::{ - try_from_credential_new_view, types::*, CheckUserOptions, CipherViewContainer, - Fido2CredentialStore, Fido2UserInterface, SelectedCredential, UnknownEnum, AAGUID, -}; -use crate::{ - fill_with_credential, string_to_guid_bytes, try_from_credential_full, Fido2CallbackError, - FillCredentialError, InvalidGuid, -}; - -#[derive(Debug, Error)] -pub enum GetSelectedCredentialError { - #[error("No selected credential available")] - NoSelectedCredential, - #[error("No fido2 credentials found")] - NoCredentialFound, - - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - #[error(transparent)] - CipherError(#[from] CipherError), -} - -#[derive(Debug, Error)] -pub enum MakeCredentialError { - #[error(transparent)] - PublicKeyCredentialParametersError(#[from] PublicKeyCredentialParametersError), - #[error(transparent)] - UnknownEnum(#[from] UnknownEnum), - #[error(transparent)] - Serde(#[from] serde_json::Error), - #[error("Missing attested_credential_data")] - MissingAttestedCredentialData, - #[error("make_credential error: {0}")] - Other(String), -} - -#[derive(Debug, Error)] -pub enum GetAssertionError { - #[error(transparent)] - UnknownEnum(#[from] UnknownEnum), - #[error(transparent)] - Serde(#[from] serde_json::Error), - #[error(transparent)] - GetSelectedCredentialError(#[from] GetSelectedCredentialError), - #[error(transparent)] - InvalidGuid(#[from] InvalidGuid), - #[error("missing user")] - MissingUser, - #[error("get_assertion error: {0}")] - Other(String), -} - -#[derive(Debug, Error)] -pub enum SilentlyDiscoverCredentialsError { - #[error(transparent)] - CipherError(#[from] CipherError), - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - #[error(transparent)] - InvalidGuid(#[from] InvalidGuid), - #[error(transparent)] - Fido2CallbackError(#[from] Fido2CallbackError), - #[error(transparent)] - FromCipherViewError(#[from] Fido2CredentialAutofillViewError), -} - -#[derive(Debug, Error)] -pub enum CredentialsForAutofillError { - #[error(transparent)] - CipherError(#[from] CipherError), - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - #[error(transparent)] - InvalidGuid(#[from] InvalidGuid), - #[error(transparent)] - Fido2CallbackError(#[from] Fido2CallbackError), - #[error(transparent)] - FromCipherViewError(#[from] Fido2CredentialAutofillViewError), -} - -pub struct Fido2Authenticator<'a> { - pub client: &'a Client, - pub user_interface: &'a dyn Fido2UserInterface, - pub credential_store: &'a dyn Fido2CredentialStore, - - pub(crate) selected_cipher: Mutex>, - pub(crate) requested_uv: Mutex>, -} - -impl<'a> Fido2Authenticator<'a> { - pub fn new( - client: &'a Client, - user_interface: &'a dyn Fido2UserInterface, - credential_store: &'a dyn Fido2CredentialStore, - ) -> Fido2Authenticator<'a> { - Fido2Authenticator { - client, - user_interface, - credential_store, - selected_cipher: Mutex::new(None), - requested_uv: Mutex::new(None), - } - } - - pub async fn make_credential( - &mut self, - request: MakeCredentialRequest, - ) -> Result { - // Insert the received UV to be able to return it later in check_user - self.requested_uv - .get_mut() - .expect("Mutex is not poisoned") - .replace(request.options.uv); - - let mut authenticator = self.get_authenticator(true); - - let response = authenticator - .make_credential(ctap2::make_credential::Request { - client_data_hash: request.client_data_hash.into(), - rp: passkey::types::ctap2::make_credential::PublicKeyCredentialRpEntity { - id: request.rp.id, - name: request.rp.name, - }, - user: passkey::types::webauthn::PublicKeyCredentialUserEntity { - id: request.user.id.into(), - display_name: request.user.display_name, - name: request.user.name, - }, - pub_key_cred_params: request - .pub_key_cred_params - .into_iter() - .map(TryInto::try_into) - .collect::>()?, - exclude_list: request - .exclude_list - .map(|x| x.into_iter().map(TryInto::try_into).collect()) - .transpose()?, - extensions: request - .extensions - .map(|e| serde_json::from_str(&e)) - .transpose()?, - options: passkey::types::ctap2::make_credential::Options { - rk: request.options.rk, - up: true, - uv: self.convert_requested_uv(request.options.uv).await, - }, - pin_auth: None, - pin_protocol: None, - }) - .await; - - let response = match response { - Ok(x) => x, - Err(e) => return Err(MakeCredentialError::Other(format!("{e:?}"))), - }; - - let attestation_object = response.as_bytes().to_vec(); - let authenticator_data = response.auth_data.to_vec(); - let attested_credential_data = response - .auth_data - .attested_credential_data - .ok_or(MakeCredentialError::MissingAttestedCredentialData)?; - let credential_id = attested_credential_data.credential_id().to_vec(); - - Ok(MakeCredentialResult { - authenticator_data, - attestation_object, - credential_id, - }) - } - - pub async fn get_assertion( - &mut self, - request: GetAssertionRequest, - ) -> Result { - // Insert the received UV to be able to return it later in check_user - self.requested_uv - .get_mut() - .expect("Mutex is not poisoned") - .replace(request.options.uv); - - let mut authenticator = self.get_authenticator(false); - - let response = authenticator - .get_assertion(ctap2::get_assertion::Request { - rp_id: request.rp_id, - client_data_hash: request.client_data_hash.into(), - allow_list: request - .allow_list - .map(|l| { - l.into_iter() - .map(TryInto::try_into) - .collect::, _>>() - }) - .transpose()?, - extensions: request - .extensions - .map(|e| serde_json::from_str(&e)) - .transpose()?, - options: passkey::types::ctap2::make_credential::Options { - rk: request.options.rk, - up: true, - uv: self.convert_requested_uv(request.options.uv).await, - }, - pin_auth: None, - pin_protocol: None, - }) - .await; - - let response = match response { - Ok(x) => x, - Err(e) => return Err(GetAssertionError::Other(format!("{e:?}"))), - }; - - let selected_credential = self.get_selected_credential()?; - let authenticator_data = response.auth_data.to_vec(); - let credential_id = string_to_guid_bytes(&selected_credential.credential.credential_id)?; - - Ok(GetAssertionResult { - credential_id, - authenticator_data, - signature: response.signature.into(), - user_handle: response - .user - .ok_or(GetAssertionError::MissingUser)? - .id - .into(), - selected_credential, - }) - } - - pub async fn silently_discover_credentials( - &mut self, - rp_id: String, - ) -> Result, SilentlyDiscoverCredentialsError> { - let enc = self.client.internal.get_encryption_settings()?; - let result = self.credential_store.find_credentials(None, rp_id).await?; - - result - .into_iter() - .map( - |cipher| -> Result, SilentlyDiscoverCredentialsError> { - Ok(Fido2CredentialAutofillView::from_cipher_view(&cipher, &*enc)?) - }, - ) - .flatten_ok() - .collect() - } - - /// Returns all Fido2 credentials that can be used for autofill, in a view - /// tailored for integration with OS autofill systems. - pub async fn credentials_for_autofill( - &mut self, - ) -> Result, CredentialsForAutofillError> { - let enc = self.client.internal.get_encryption_settings()?; - let all_credentials = self.credential_store.all_credentials().await?; - - all_credentials - .into_iter() - .map( - |cipher| -> Result, CredentialsForAutofillError> { - Ok(Fido2CredentialAutofillView::from_cipher_view( - &cipher, &*enc, - )?) - }, - ) - .flatten_ok() - .collect() - } - - pub(super) fn get_authenticator( - &self, - create_credential: bool, - ) -> Authenticator { - Authenticator::new( - AAGUID, - CredentialStoreImpl { - authenticator: self, - create_credential, - }, - UserValidationMethodImpl { - authenticator: self, - }, - ) - } - - async fn convert_requested_uv(&self, uv: UV) -> bool { - let verification_enabled = self.user_interface.is_verification_enabled().await; - match (uv, verification_enabled) { - (UV::Preferred, true) => true, - (UV::Preferred, false) => false, - (UV::Required, _) => true, - (UV::Discouraged, _) => false, - } - } - - pub(super) fn get_selected_credential( - &self, - ) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - - let cipher = self - .selected_cipher - .lock() - .expect("Mutex is not poisoned") - .clone() - .ok_or(GetSelectedCredentialError::NoSelectedCredential)?; - - let creds = cipher.decrypt_fido2_credentials(&*enc)?; - - let credential = creds - .first() - .ok_or(GetSelectedCredentialError::NoCredentialFound)? - .clone(); - - Ok(SelectedCredential { cipher, credential }) - } -} - -pub(super) struct CredentialStoreImpl<'a> { - authenticator: &'a Fido2Authenticator<'a>, - create_credential: bool, -} -pub(super) struct UserValidationMethodImpl<'a> { - authenticator: &'a Fido2Authenticator<'a>, -} - -#[async_trait::async_trait] -impl passkey::authenticator::CredentialStore for CredentialStoreImpl<'_> { - type PasskeyItem = CipherViewContainer; - async fn find_credentials( - &self, - ids: Option<&[passkey::types::webauthn::PublicKeyCredentialDescriptor]>, - rp_id: &str, - ) -> Result, StatusCode> { - #[derive(Debug, Error)] - enum InnerError { - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - #[error(transparent)] - CipherError(#[from] CipherError), - #[error(transparent)] - CryptoError(#[from] CryptoError), - #[error(transparent)] - Fido2CallbackError(#[from] Fido2CallbackError), - } - - // This is just a wrapper around the actual implementation to allow for ? error handling - async fn inner( - this: &CredentialStoreImpl<'_>, - ids: Option<&[passkey::types::webauthn::PublicKeyCredentialDescriptor]>, - rp_id: &str, - ) -> Result, InnerError> { - let ids: Option>> = - ids.map(|ids| ids.iter().map(|id| id.id.clone().into()).collect()); - - let ciphers = this - .authenticator - .credential_store - .find_credentials(ids, rp_id.to_string()) - .await?; - - let enc = this - .authenticator - .client - .internal - .get_encryption_settings()?; - - // Remove any that don't have Fido2 credentials - let creds: Vec<_> = ciphers - .into_iter() - .filter(|c| { - c.login - .as_ref() - .and_then(|l| l.fido2_credentials.as_ref()) - .is_some() - }) - .collect(); - - // When using the credential for authentication we have to ask the user to pick one. - if this.create_credential { - Ok(creds - .into_iter() - .map(|c| CipherViewContainer::new(c, &*enc)) - .collect::>()?) - } else { - let picked = this - .authenticator - .user_interface - .pick_credential_for_authentication(creds) - .await?; - - // Store the selected credential for later use - this.authenticator - .selected_cipher - .lock() - .expect("Mutex is not poisoned") - .replace(picked.clone()); - - Ok(vec![CipherViewContainer::new(picked, &*enc)?]) - } - } - - inner(self, ids, rp_id).await.map_err(|e| { - error!("Error finding credentials: {e:?}"); - VendorError::try_from(0xF0) - .expect("Valid vendor error code") - .into() - }) - } - - async fn save_credential( - &mut self, - cred: Passkey, - user: passkey::types::ctap2::make_credential::PublicKeyCredentialUserEntity, - rp: passkey::types::ctap2::make_credential::PublicKeyCredentialRpEntity, - options: passkey::types::ctap2::get_assertion::Options, - ) -> Result<(), StatusCode> { - #[derive(Debug, Error)] - enum InnerError { - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - #[error(transparent)] - FillCredentialError(#[from] FillCredentialError), - #[error(transparent)] - CipherError(#[from] CipherError), - #[error(transparent)] - CryptoError(#[from] CryptoError), - #[error(transparent)] - Fido2CallbackError(#[from] Fido2CallbackError), - - #[error("No selected credential available")] - NoSelectedCredential, - } - - // This is just a wrapper around the actual implementation to allow for ? error handling - async fn inner( - this: &mut CredentialStoreImpl<'_>, - cred: Passkey, - user: passkey::types::ctap2::make_credential::PublicKeyCredentialUserEntity, - rp: passkey::types::ctap2::make_credential::PublicKeyCredentialRpEntity, - options: passkey::types::ctap2::get_assertion::Options, - ) -> Result<(), InnerError> { - let enc = this - .authenticator - .client - .internal - .get_encryption_settings()?; - - let cred = try_from_credential_full(cred, user, rp, options)?; - - // Get the previously selected cipher and add the new credential to it - let mut selected: CipherView = this - .authenticator - .selected_cipher - .lock() - .expect("Mutex is not poisoned") - .clone() - .ok_or(InnerError::NoSelectedCredential)?; - - selected.set_new_fido2_credentials(&*enc, vec![cred])?; - - // Store the updated credential for later use - this.authenticator - .selected_cipher - .lock() - .expect("Mutex is not poisoned") - .replace(selected.clone()); - - // Encrypt the updated cipher before sending it to the clients to be stored - let key = enc.get_key(&selected.organization_id)?; - let encrypted = selected.encrypt_with_key(key)?; - - this.authenticator - .credential_store - .save_credential(encrypted) - .await?; - - Ok(()) - } - - inner(self, cred, user, rp, options).await.map_err(|e| { - error!("Error saving credential: {e:?}"); - VendorError::try_from(0xF1) - .expect("Valid vendor error code") - .into() - }) - } - - async fn update_credential(&mut self, cred: Passkey) -> Result<(), StatusCode> { - #[derive(Debug, Error)] - enum InnerError { - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - #[error(transparent)] - InvalidGuid(#[from] InvalidGuid), - #[error("Credential ID does not match selected credential")] - CredentialIdMismatch, - #[error(transparent)] - FillCredentialError(#[from] FillCredentialError), - #[error(transparent)] - CipherError(#[from] CipherError), - #[error(transparent)] - CryptoError(#[from] CryptoError), - #[error(transparent)] - Fido2CallbackError(#[from] Fido2CallbackError), - #[error(transparent)] - GetSelectedCredentialError(#[from] GetSelectedCredentialError), - } - - // This is just a wrapper around the actual implementation to allow for ? error handling - async fn inner( - this: &mut CredentialStoreImpl<'_>, - cred: Passkey, - ) -> Result<(), InnerError> { - let enc = this - .authenticator - .client - .internal - .get_encryption_settings()?; - - // Get the previously selected cipher and update the credential - let selected = this.authenticator.get_selected_credential()?; - - // Check that the provided credential ID matches the selected credential - let new_id: &Vec = &cred.credential_id; - let selected_id = string_to_guid_bytes(&selected.credential.credential_id)?; - if new_id != &selected_id { - return Err(InnerError::CredentialIdMismatch); - } - - let cred = fill_with_credential(&selected.credential, cred)?; - - let mut selected = selected.cipher; - selected.set_new_fido2_credentials(&*enc, vec![cred])?; - - // Store the updated credential for later use - this.authenticator - .selected_cipher - .lock() - .expect("Mutex is not poisoned") - .replace(selected.clone()); - - // Encrypt the updated cipher before sending it to the clients to be stored - let key = enc.get_key(&selected.organization_id)?; - let encrypted = selected.encrypt_with_key(key)?; - - this.authenticator - .credential_store - .save_credential(encrypted) - .await?; - - Ok(()) - } - - inner(self, cred).await.map_err(|e| { - error!("Error updating credential: {e:?}"); - VendorError::try_from(0xF2) - .expect("Valid vendor error code") - .into() - }) - } - - async fn get_info(&self) -> StoreInfo { - StoreInfo { - discoverability: DiscoverabilitySupport::Full, - } - } -} - -#[async_trait::async_trait] -impl passkey::authenticator::UserValidationMethod for UserValidationMethodImpl<'_> { - type PasskeyItem = CipherViewContainer; - - async fn check_user<'a>( - &self, - hint: UIHint<'a, Self::PasskeyItem>, - presence: bool, - _verification: bool, - ) -> Result { - let verification = self - .authenticator - .requested_uv - .lock() - .expect("Mutex is not poisoned") - .ok_or(Ctap2Error::UserVerificationInvalid)?; - - let options = CheckUserOptions { - require_presence: presence, - require_verification: verification.into(), - }; - - let result = match hint { - UIHint::RequestNewCredential(user, rp) => { - let new_credential = try_from_credential_new_view(user, rp) - .map_err(|_| Ctap2Error::InvalidCredential)?; - - let (cipher_view, user_check) = self - .authenticator - .user_interface - .check_user_and_pick_credential_for_creation(options, new_credential) - .await - .map_err(|_| Ctap2Error::OperationDenied)?; - - self.authenticator - .selected_cipher - .lock() - .expect("Mutex is not poisoned") - .replace(cipher_view); - - Ok(user_check) - } - _ => { - self.authenticator - .user_interface - .check_user(options, map_ui_hint(hint)) - .await - } - }; - - let result = result.map_err(|e| { - error!("Error checking user: {e:?}"); - Ctap2Error::UserVerificationInvalid - })?; - - Ok(UserCheck { - presence: result.user_present, - verification: result.user_verified, - }) - } - - async fn is_presence_enabled(&self) -> bool { - true - } - - async fn is_verification_enabled(&self) -> Option { - Some( - self.authenticator - .user_interface - .is_verification_enabled() - .await, - ) - } -} - -fn map_ui_hint(hint: UIHint<'_, CipherViewContainer>) -> UIHint<'_, CipherView> { - use UIHint::*; - match hint { - InformExcludedCredentialFound(c) => InformExcludedCredentialFound(&c.cipher), - InformNoCredentialsFound => InformNoCredentialsFound, - RequestNewCredential(u, r) => RequestNewCredential(u, r), - RequestExistingCredential(c) => RequestExistingCredential(&c.cipher), - } -} diff --git a/crates/bitwarden-fido/src/client.rs b/crates/bitwarden-fido/src/client.rs deleted file mode 100644 index ac4330be7..000000000 --- a/crates/bitwarden-fido/src/client.rs +++ /dev/null @@ -1,142 +0,0 @@ -use passkey::client::WebauthnError; -use thiserror::Error; - -use super::{ - authenticator::GetSelectedCredentialError, - get_string_name_from_enum, - types::{ - AuthenticatorAssertionResponse, AuthenticatorAttestationResponse, ClientData, - ClientExtensionResults, CredPropsResult, Origin, - }, - Fido2Authenticator, PublicKeyCredentialAuthenticatorAssertionResponse, - PublicKeyCredentialAuthenticatorAttestationResponse, -}; -use crate::types::InvalidOriginError; - -#[derive(Debug, Error)] -pub enum Fido2ClientError { - #[error(transparent)] - InvalidOrigin(#[from] InvalidOriginError), - #[error(transparent)] - Serde(#[from] serde_json::Error), - #[error(transparent)] - GetSelectedCredentialError(#[from] GetSelectedCredentialError), - - #[error("Webauthn error: {0:?}")] - Webauthn(WebauthnError), -} - -impl From for Fido2ClientError { - fn from(e: WebauthnError) -> Self { - Self::Webauthn(e) - } -} - -pub struct Fido2Client<'a> { - pub authenticator: Fido2Authenticator<'a>, -} - -impl<'a> Fido2Client<'a> { - pub async fn register( - &mut self, - origin: Origin, - request: String, - client_data: ClientData, - ) -> Result { - let origin: passkey::client::Origin = origin.try_into()?; - let request: passkey::types::webauthn::CredentialCreationOptions = - serde_json::from_str(&request)?; - - // Insert the received UV to be able to return it later in check_user - let uv = request - .public_key - .authenticator_selection - .as_ref() - .map(|s| s.user_verification.into()); - *self - .authenticator - .requested_uv - .get_mut() - .expect("Mutex is not poisoned") = uv; - - let rp_id = request.public_key.rp.id.clone(); - - let mut client = passkey::client::Client::new(self.authenticator.get_authenticator(true)); - let result = client.register(origin, request, client_data).await?; - - Ok(PublicKeyCredentialAuthenticatorAttestationResponse { - id: result.id, - raw_id: result.raw_id.into(), - ty: get_string_name_from_enum(result.ty)?, - authenticator_attachment: result - .authenticator_attachment - .map(get_string_name_from_enum) - .transpose()?, - client_extension_results: ClientExtensionResults { - cred_props: result.client_extension_results.cred_props.map(Into::into), - }, - response: AuthenticatorAttestationResponse { - client_data_json: result.response.client_data_json.into(), - authenticator_data: result.response.authenticator_data.into(), - public_key: result.response.public_key.map(|x| x.into()), - public_key_algorithm: result.response.public_key_algorithm, - attestation_object: result.response.attestation_object.into(), - transports: if rp_id.unwrap_or_default() == "https://google.com" { - Some(vec!["internal".to_string(), "usb".to_string()]) - } else { - Some(vec!["internal".to_string()]) - }, - }, - selected_credential: self.authenticator.get_selected_credential()?, - }) - } - - pub async fn authenticate( - &mut self, - origin: Origin, - request: String, - client_data: ClientData, - ) -> Result { - let origin: passkey::client::Origin = origin.try_into()?; - let request: passkey::types::webauthn::CredentialRequestOptions = - serde_json::from_str(&request)?; - - // Insert the received UV to be able to return it later in check_user - let uv = request.public_key.user_verification.into(); - self.authenticator - .requested_uv - .get_mut() - .expect("Mutex is not poisoned") - .replace(uv); - - let mut client = passkey::client::Client::new(self.authenticator.get_authenticator(false)); - let result = client.authenticate(origin, request, client_data).await?; - - Ok(PublicKeyCredentialAuthenticatorAssertionResponse { - id: result.id, - raw_id: result.raw_id.into(), - ty: get_string_name_from_enum(result.ty)?, - - authenticator_attachment: result - .authenticator_attachment - .map(get_string_name_from_enum) - .transpose()?, - client_extension_results: ClientExtensionResults { - cred_props: result - .client_extension_results - .cred_props - .map(|c| CredPropsResult { - rk: c.discoverable, - authenticator_display_name: c.authenticator_display_name, - }), - }, - response: AuthenticatorAssertionResponse { - client_data_json: result.response.client_data_json.into(), - authenticator_data: result.response.authenticator_data.into(), - signature: result.response.signature.into(), - user_handle: result.response.user_handle.unwrap_or_default().into(), - }, - selected_credential: self.authenticator.get_selected_credential()?, - }) - } -} diff --git a/crates/bitwarden-fido/src/client_fido.rs b/crates/bitwarden-fido/src/client_fido.rs deleted file mode 100644 index 84b3de6a1..000000000 --- a/crates/bitwarden-fido/src/client_fido.rs +++ /dev/null @@ -1,67 +0,0 @@ -use bitwarden_core::Client; -use bitwarden_vault::CipherView; -use thiserror::Error; - -use crate::{ - Fido2Authenticator, Fido2Client, Fido2CredentialAutofillView, Fido2CredentialAutofillViewError, - Fido2CredentialStore, Fido2UserInterface, -}; - -pub struct ClientFido2<'a> { - #[allow(dead_code)] - pub(crate) client: &'a Client, -} - -#[derive(Debug, Error)] -pub enum DecryptFido2AutofillCredentialsError { - #[error(transparent)] - VaultLocked(#[from] bitwarden_core::VaultLocked), - #[error(transparent)] - Fido2CredentialAutofillViewError(#[from] Fido2CredentialAutofillViewError), -} - -impl<'a> ClientFido2<'a> { - pub fn new(client: &'a Client) -> Self { - Self { client } - } - - pub fn create_authenticator( - &'a self, - user_interface: &'a dyn Fido2UserInterface, - credential_store: &'a dyn Fido2CredentialStore, - ) -> Fido2Authenticator<'a> { - Fido2Authenticator::new(self.client, user_interface, credential_store) - } - - pub fn create_client( - &'a self, - user_interface: &'a dyn Fido2UserInterface, - credential_store: &'a dyn Fido2CredentialStore, - ) -> Fido2Client<'a> { - Fido2Client { - authenticator: self.create_authenticator(user_interface, credential_store), - } - } - - pub fn decrypt_fido2_autofill_credentials( - &'a self, - cipher_view: CipherView, - ) -> Result, DecryptFido2AutofillCredentialsError> { - let enc = self.client.internal.get_encryption_settings()?; - - Ok(Fido2CredentialAutofillView::from_cipher_view( - &cipher_view, - &*enc, - )?) - } -} - -pub trait ClientFido2Ext<'a> { - fn fido2(&'a self) -> ClientFido2<'a>; -} - -impl<'a> ClientFido2Ext<'a> for Client { - fn fido2(&'a self) -> ClientFido2<'a> { - ClientFido2::new(self) - } -} diff --git a/crates/bitwarden-fido/src/crypto.rs b/crates/bitwarden-fido/src/crypto.rs deleted file mode 100644 index 7d2ccab98..000000000 --- a/crates/bitwarden-fido/src/crypto.rs +++ /dev/null @@ -1,102 +0,0 @@ -use coset::{iana, CoseKey}; -use p256::{ - pkcs8::{DecodePrivateKey, EncodePrivateKey}, - SecretKey, -}; -use passkey::authenticator::{private_key_from_cose_key, CoseKeyPair}; -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum CoseKeyToPkcs8Error { - #[error("Failed to extract private key from cose_key")] - FailedToExtractPrivateKeyFromCoseKey, - #[error("Failed to convert P256 private key to PKC8")] - FailedToConvertP256PrivateKeyToPkcs8, -} - -pub(crate) fn cose_key_to_pkcs8(cose_key: &CoseKey) -> Result, CoseKeyToPkcs8Error> { - // cose_key. - let secret_key = private_key_from_cose_key(cose_key).map_err(|error| { - log::error!("Failed to extract private key from cose_key: {:?}", error); - CoseKeyToPkcs8Error::FailedToExtractPrivateKeyFromCoseKey - })?; - - let vec = secret_key - .to_pkcs8_der() - .map_err(|error| { - log::error!("Failed to convert P256 private key to PKC8: {:?}", error); - CoseKeyToPkcs8Error::FailedToConvertP256PrivateKeyToPkcs8 - })? - .as_bytes() - .to_vec(); - - Ok(vec) -} - -#[derive(Debug, Error)] -#[error("Failed to extract private key from secret_key")] -pub struct PrivateKeyFromSecretKeyError; - -pub fn pkcs8_to_cose_key(secret_key: &[u8]) -> Result { - let secret_key = SecretKey::from_pkcs8_der(secret_key).map_err(|error| { - log::error!("Failed to extract private key from secret_key: {:?}", error); - PrivateKeyFromSecretKeyError - })?; - - let cose_key_pair = CoseKeyPair::from_secret_key(&secret_key, iana::Algorithm::ES256); - Ok(cose_key_pair.private) -} - -#[cfg(test)] -mod tests { - use super::*; - - fn private_key_for_testing() -> CoseKey { - // Hardcoded CoseKey for testing purposes - let bytes = vec![ - 166, 1, 2, 3, 38, 32, 1, 33, 88, 32, 200, 30, 161, 146, 196, 121, 165, 149, 92, 232, - 49, 48, 245, 253, 73, 234, 204, 3, 209, 153, 166, 77, 59, 232, 70, 16, 206, 77, 84, - 156, 28, 77, 34, 88, 32, 82, 141, 165, 28, 241, 82, 31, 33, 183, 206, 29, 91, 93, 111, - 216, 216, 26, 62, 211, 49, 191, 86, 238, 118, 241, 124, 131, 106, 214, 95, 170, 160, - 35, 88, 32, 147, 171, 4, 49, 68, 170, 47, 51, 74, 211, 94, 40, 212, 244, 95, 55, 154, - 92, 171, 241, 0, 55, 84, 151, 79, 244, 151, 198, 135, 45, 97, 238, - ]; - - ::from_slice(bytes.as_slice()).unwrap() - } - - #[test] - fn test_cose_key_to_pkcs8_and_back() { - let cose_key = private_key_for_testing(); - - let pkcs8 = cose_key_to_pkcs8(&cose_key).expect("CoseKey to PKCS8 failed"); - let cose_key2 = pkcs8_to_cose_key(&pkcs8).expect("PKCS8 to CoseKey failed"); - - assert_eq!(cose_key, cose_key2); - } - - fn pkcs8_key_for_testing() -> Vec { - vec![ - 0x30, 0x81, 0x87, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, - 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x04, - 0x6d, 0x30, 0x6b, 0x02, 0x01, 0x01, 0x04, 0x20, 0x06, 0x76, 0x5e, 0x85, 0xe0, 0x7f, - 0xef, 0x43, 0xaa, 0x17, 0xe0, 0x7a, 0xd7, 0x85, 0x63, 0x01, 0x80, 0x70, 0x8c, 0x6c, - 0x61, 0x43, 0x7d, 0xc3, 0xb1, 0xe6, 0xf9, 0x09, 0x24, 0xeb, 0x1f, 0xf5, 0xa1, 0x44, - 0x03, 0x42, 0x00, 0x04, 0x35, 0x9a, 0x52, 0xf3, 0x82, 0x44, 0x66, 0x5f, 0x3f, 0xe2, - 0xc4, 0x0b, 0x1c, 0x16, 0x34, 0xc5, 0x60, 0x07, 0x3a, 0x25, 0xfe, 0x7e, 0x7f, 0x7f, - 0xda, 0xd4, 0x1c, 0x36, 0x90, 0x00, 0xee, 0xb1, 0x8e, 0x92, 0xb3, 0xac, 0x91, 0x7f, - 0xb1, 0x8c, 0xa4, 0x85, 0xe7, 0x03, 0x07, 0xd1, 0xf5, 0x5b, 0xd3, 0x7b, 0xc3, 0x56, - 0x11, 0xdf, 0xbc, 0x7a, 0x97, 0x70, 0x32, 0x4b, 0x3c, 0x84, 0x05, 0x71, - ] - } - - #[test] - fn test_pkcs8_to_cose_key_and_back() { - let pkcs8 = pkcs8_key_for_testing(); - - let cose_key = pkcs8_to_cose_key(&pkcs8).expect("PKCS8 to CoseKey failed"); - let pkcs8_2 = cose_key_to_pkcs8(&cose_key).expect("CoseKey to PKCS8 failed"); - - assert_eq!(pkcs8, pkcs8_2); - } -} diff --git a/crates/bitwarden-fido/src/lib.rs b/crates/bitwarden-fido/src/lib.rs deleted file mode 100644 index be1dfdb53..000000000 --- a/crates/bitwarden-fido/src/lib.rs +++ /dev/null @@ -1,297 +0,0 @@ -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; -use bitwarden_crypto::KeyContainer; -use bitwarden_vault::{ - CipherError, CipherView, Fido2CredentialFullView, Fido2CredentialNewView, Fido2CredentialView, -}; -use crypto::{CoseKeyToPkcs8Error, PrivateKeyFromSecretKeyError}; -use passkey::types::{ctap2::Aaguid, Passkey}; - -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); -#[cfg(feature = "uniffi")] -mod uniffi_support; - -mod authenticator; -mod client; -mod client_fido; -mod crypto; -mod traits; -mod types; -pub use authenticator::{ - CredentialsForAutofillError, Fido2Authenticator, GetAssertionError, MakeCredentialError, - SilentlyDiscoverCredentialsError, -}; -pub use client::{Fido2Client, Fido2ClientError}; -pub use client_fido::{ClientFido2, ClientFido2Ext, DecryptFido2AutofillCredentialsError}; -pub use passkey::authenticator::UIHint; -use thiserror::Error; -pub use traits::{ - CheckUserOptions, CheckUserResult, Fido2CallbackError, Fido2CredentialStore, - Fido2UserInterface, Verification, -}; -pub use types::{ - AuthenticatorAssertionResponse, AuthenticatorAttestationResponse, ClientData, - Fido2CredentialAutofillView, Fido2CredentialAutofillViewError, GetAssertionRequest, - GetAssertionResult, MakeCredentialRequest, MakeCredentialResult, Options, Origin, - PublicKeyCredentialAuthenticatorAssertionResponse, - PublicKeyCredentialAuthenticatorAttestationResponse, PublicKeyCredentialRpEntity, - PublicKeyCredentialUserEntity, UnverifiedAssetLink, -}; - -use self::crypto::{cose_key_to_pkcs8, pkcs8_to_cose_key}; - -// This is the AAGUID for the Bitwarden Passkey provider (d548826e-79b4-db40-a3d8-11116f7e8349) -// It is used for the Relaying Parties to identify the authenticator during registration -const AAGUID: Aaguid = Aaguid([ - 0xd5, 0x48, 0x82, 0x6e, 0x79, 0xb4, 0xdb, 0x40, 0xa3, 0xd8, 0x11, 0x11, 0x6f, 0x7e, 0x83, 0x49, -]); - -#[allow(dead_code)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SelectedCredential { - cipher: CipherView, - credential: Fido2CredentialView, -} - -// This container is needed so we can properly implement the TryFrom trait for Passkey -// Otherwise we need to decrypt the Fido2 credentials every time we create a CipherView -#[derive(Clone)] -pub(crate) struct CipherViewContainer { - cipher: CipherView, - fido2_credentials: Vec, -} - -impl CipherViewContainer { - fn new(cipher: CipherView, enc: &dyn KeyContainer) -> Result { - let fido2_credentials = cipher.get_fido2_credentials(enc)?; - Ok(Self { - cipher, - fido2_credentials, - }) - } -} - -#[derive(Debug, Error)] -pub enum Fido2Error { - #[error(transparent)] - DecodeError(#[from] base64::DecodeError), - - #[error(transparent)] - UnknownEnum(#[from] UnknownEnum), - - #[error(transparent)] - InvalidGuid(#[from] InvalidGuid), - - #[error(transparent)] - PrivateKeyFromSecretKeyError(#[from] PrivateKeyFromSecretKeyError), - - #[error("No Fido2 credentials found")] - NoFido2CredentialsFound, -} - -impl TryFrom for Passkey { - type Error = Fido2Error; - - fn try_from(value: CipherViewContainer) -> Result { - let cred = value - .fido2_credentials - .first() - .ok_or(Fido2Error::NoFido2CredentialsFound)?; - - try_from_credential_full_view(cred.clone()) - } -} - -fn try_from_credential_full_view(value: Fido2CredentialFullView) -> Result { - let counter: u32 = value.counter.parse().expect("Invalid counter"); - let counter = (counter != 0).then_some(counter); - let key_value = URL_SAFE_NO_PAD.decode(value.key_value)?; - let user_handle = value - .user_handle - .map(|u| URL_SAFE_NO_PAD.decode(u)) - .transpose()?; - - let key = pkcs8_to_cose_key(&key_value)?; - - Ok(Passkey { - key, - credential_id: string_to_guid_bytes(&value.credential_id)?.into(), - rp_id: value.rp_id.clone(), - user_handle: user_handle.map(|u| u.into()), - counter, - }) -} - -#[derive(Debug, Error)] -pub enum FillCredentialError { - #[error(transparent)] - InvalidInputLength(#[from] InvalidInputLength), - #[error(transparent)] - CoseKeyToPkcs8Error(#[from] CoseKeyToPkcs8Error), -} - -pub fn fill_with_credential( - view: &Fido2CredentialView, - value: Passkey, -) -> Result { - let cred_id: Vec = value.credential_id.into(); - let user_handle = value - .user_handle - .map(|u| URL_SAFE_NO_PAD.encode(u.to_vec())); - let key_value = URL_SAFE_NO_PAD.encode(cose_key_to_pkcs8(&value.key)?); - - Ok(Fido2CredentialFullView { - credential_id: guid_bytes_to_string(&cred_id)?, - key_type: "public-key".to_owned(), - key_algorithm: "ECDSA".to_owned(), - key_curve: "P-256".to_owned(), - key_value, - rp_id: value.rp_id, - rp_name: view.rp_name.clone(), - user_handle, - - counter: value.counter.unwrap_or(0).to_string(), - user_name: view.user_name.clone(), - user_display_name: view.user_display_name.clone(), - discoverable: "true".to_owned(), - creation_date: chrono::offset::Utc::now(), - }) -} - -pub(crate) fn try_from_credential_new_view( - user: &passkey::types::ctap2::make_credential::PublicKeyCredentialUserEntity, - rp: &passkey::types::ctap2::make_credential::PublicKeyCredentialRpEntity, -) -> Result { - let cred_id: Vec = vec![0; 16]; - let user_handle = URL_SAFE_NO_PAD.encode(user.id.to_vec()); - - Ok(Fido2CredentialNewView { - // TODO: Why do we have a credential id here? - credential_id: guid_bytes_to_string(&cred_id)?, - key_type: "public-key".to_owned(), - key_algorithm: "ECDSA".to_owned(), - key_curve: "P-256".to_owned(), - rp_id: rp.id.clone(), - rp_name: rp.name.clone(), - user_handle: Some(user_handle), - - counter: 0.to_string(), - user_name: user.name.clone(), - user_display_name: user.display_name.clone(), - creation_date: chrono::offset::Utc::now(), - }) -} - -pub(crate) fn try_from_credential_full( - value: Passkey, - user: passkey::types::ctap2::make_credential::PublicKeyCredentialUserEntity, - rp: passkey::types::ctap2::make_credential::PublicKeyCredentialRpEntity, - options: passkey::types::ctap2::get_assertion::Options, -) -> Result { - let cred_id: Vec = value.credential_id.into(); - let key_value = URL_SAFE_NO_PAD.encode(cose_key_to_pkcs8(&value.key)?); - let user_handle = URL_SAFE_NO_PAD.encode(user.id.to_vec()); - - Ok(Fido2CredentialFullView { - credential_id: guid_bytes_to_string(&cred_id)?, - key_type: "public-key".to_owned(), - key_algorithm: "ECDSA".to_owned(), - key_curve: "P-256".to_owned(), - key_value, - rp_id: value.rp_id, - rp_name: rp.name, - user_handle: Some(user_handle), - - counter: value.counter.unwrap_or(0).to_string(), - user_name: user.name, - user_display_name: user.display_name, - discoverable: options.rk.to_string(), - creation_date: chrono::offset::Utc::now(), - }) -} - -#[derive(Debug, Error)] -#[error("Input should be a 16 byte array")] -pub struct InvalidInputLength; - -pub fn guid_bytes_to_string(source: &[u8]) -> Result { - if source.len() != 16 { - return Err(InvalidInputLength); - } - Ok(uuid::Uuid::from_bytes(source.try_into().expect("Invalid length")).to_string()) -} - -#[derive(Debug, Error)] -#[error("Invalid GUID")] -pub struct InvalidGuid; - -pub fn string_to_guid_bytes(source: &str) -> Result, InvalidGuid> { - if source.starts_with("b64.") { - let bytes = URL_SAFE_NO_PAD - .decode(source.trim_start_matches("b64.")) - .map_err(|_| InvalidGuid)?; - Ok(bytes) - } else { - let Ok(uuid) = uuid::Uuid::try_parse(source) else { - return Err(InvalidGuid); - }; - Ok(uuid.as_bytes().to_vec()) - } -} - -#[derive(Debug, Error)] -#[error("Unknown enum value")] -pub struct UnknownEnum; - -// Some utilities to convert back and forth between enums and strings -fn get_enum_from_string_name(s: &str) -> Result { - let serialized = format!(r#""{}""#, s); - let deserialized: T = serde_json::from_str(&serialized).map_err(|_| UnknownEnum)?; - Ok(deserialized) -} - -fn get_string_name_from_enum(s: impl serde::Serialize) -> Result { - let serialized = serde_json::to_string(&s)?; - let deserialized: String = serde_json::from_str(&serialized)?; - Ok(deserialized) -} - -#[cfg(test)] -mod tests { - use passkey::types::webauthn::AuthenticatorAttachment; - - use super::{get_enum_from_string_name, get_string_name_from_enum}; - - #[test] - fn test_enum_string_conversion_works_as_expected() { - assert_eq!( - get_string_name_from_enum(AuthenticatorAttachment::CrossPlatform).unwrap(), - "cross-platform" - ); - - assert_eq!( - get_enum_from_string_name::("cross-platform").unwrap(), - AuthenticatorAttachment::CrossPlatform - ); - } - - #[test] - fn string_to_guid_with_uuid_works() { - let uuid = "d548826e-79b4-db40-a3d8-11116f7e8349"; - let bytes = super::string_to_guid_bytes(uuid).unwrap(); - assert_eq!( - bytes, - vec![213, 72, 130, 110, 121, 180, 219, 64, 163, 216, 17, 17, 111, 126, 131, 73] - ); - } - - #[test] - fn string_to_guid_with_b64_works() { - let b64 = "b64.1UiCbnm020Cj2BERb36DSQ"; - let bytes = super::string_to_guid_bytes(b64).unwrap(); - assert_eq!( - bytes, - vec![213, 72, 130, 110, 121, 180, 219, 64, 163, 216, 17, 17, 111, 126, 131, 73] - ); - } -} diff --git a/crates/bitwarden-fido/src/traits.rs b/crates/bitwarden-fido/src/traits.rs deleted file mode 100644 index 215e5934d..000000000 --- a/crates/bitwarden-fido/src/traits.rs +++ /dev/null @@ -1,67 +0,0 @@ -use bitwarden_vault::{Cipher, CipherView, Fido2CredentialNewView}; -use passkey::authenticator::UIHint; -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum Fido2CallbackError { - #[error("The operation requires user interaction")] - UserInterfaceRequired, - - #[error("The operation was cancelled by the user")] - OperationCancelled, - - #[error("Unknown error: {0}")] - Unknown(String), -} - -#[async_trait::async_trait] -pub trait Fido2UserInterface: Send + Sync { - async fn check_user<'a>( - &self, - options: CheckUserOptions, - hint: UIHint<'a, CipherView>, - ) -> Result; - async fn pick_credential_for_authentication( - &self, - available_credentials: Vec, - ) -> Result; - async fn check_user_and_pick_credential_for_creation( - &self, - options: CheckUserOptions, - new_credential: Fido2CredentialNewView, - ) -> Result<(CipherView, CheckUserResult), Fido2CallbackError>; - async fn is_verification_enabled(&self) -> bool; -} - -#[async_trait::async_trait] -pub trait Fido2CredentialStore: Send + Sync { - async fn find_credentials( - &self, - ids: Option>>, - rip_id: String, - ) -> Result, Fido2CallbackError>; - - async fn all_credentials(&self) -> Result, Fido2CallbackError>; - - async fn save_credential(&self, cred: Cipher) -> Result<(), Fido2CallbackError>; -} - -#[derive(Clone)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct CheckUserOptions { - pub require_presence: bool, - pub require_verification: Verification, -} - -#[derive(Clone)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum Verification { - Discouraged, - Preferred, - Required, -} - -pub struct CheckUserResult { - pub user_present: bool, - pub user_verified: bool, -} diff --git a/crates/bitwarden-fido/src/types.rs b/crates/bitwarden-fido/src/types.rs deleted file mode 100644 index 409db7a98..000000000 --- a/crates/bitwarden-fido/src/types.rs +++ /dev/null @@ -1,484 +0,0 @@ -use std::borrow::Cow; - -use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; -use bitwarden_crypto::KeyContainer; -use bitwarden_vault::{CipherError, CipherView}; -use passkey::types::webauthn::UserVerificationRequirement; -use reqwest::Url; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use thiserror::Error; - -use super::{ - get_enum_from_string_name, string_to_guid_bytes, InvalidGuid, SelectedCredential, UnknownEnum, - Verification, -}; - -#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Fido2CredentialAutofillView { - pub credential_id: Vec, - pub cipher_id: uuid::Uuid, - pub rp_id: String, - pub user_name_for_ui: Option, - pub user_handle: Vec, -} - -trait NoneWhitespace { - /// Convert only whitespace to None - fn none_whitespace(&self) -> Option; -} - -impl NoneWhitespace for String { - fn none_whitespace(&self) -> Option { - match self.trim() { - "" => None, - s => Some(s.to_owned()), - } - } -} - -impl NoneWhitespace for Option { - fn none_whitespace(&self) -> Option { - self.as_ref().and_then(|s| s.none_whitespace()) - } -} - -#[derive(Debug, Error)] -pub enum Fido2CredentialAutofillViewError { - #[error( - "Autofill credentials can only be created from existing ciphers that have a cipher id" - )] - MissingCipherId, - - #[error(transparent)] - InvalidGuid(#[from] InvalidGuid), - - #[error(transparent)] - CipherError(#[from] CipherError), - - #[error(transparent)] - Base64DecodeError(#[from] base64::DecodeError), -} - -impl Fido2CredentialAutofillView { - pub fn from_cipher_view( - cipher: &CipherView, - enc: &dyn KeyContainer, - ) -> Result, Fido2CredentialAutofillViewError> { - let credentials = cipher.decrypt_fido2_credentials(enc)?; - - credentials - .into_iter() - .filter_map(|c| -> Option> { - c.user_handle - .map(|u| URL_SAFE_NO_PAD.decode(u)) - .map(|user_handle| { - Ok(Fido2CredentialAutofillView { - credential_id: string_to_guid_bytes(&c.credential_id)?, - cipher_id: cipher - .id - .ok_or(Fido2CredentialAutofillViewError::MissingCipherId)?, - rp_id: c.rp_id.clone(), - user_handle: user_handle?, - user_name_for_ui: c - .user_name - .none_whitespace() - .or(c.user_display_name.none_whitespace()) - .or(cipher - .login - .as_ref() - .and_then(|l| l.username.none_whitespace())) - .or(cipher.name.none_whitespace()), - }) - }) - }) - .collect() - } -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PublicKeyCredentialRpEntity { - pub id: String, - pub name: Option, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PublicKeyCredentialUserEntity { - pub id: Vec, - pub display_name: String, - pub name: String, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PublicKeyCredentialParameters { - pub ty: String, - pub alg: i64, -} - -#[derive(Debug, Error)] -pub enum PublicKeyCredentialParametersError { - #[error("Invalid algorithm")] - InvalidAlgorithm, - - #[error("Unknown type")] - UnknownEnum(#[from] UnknownEnum), -} - -impl TryFrom - for passkey::types::webauthn::PublicKeyCredentialParameters -{ - type Error = PublicKeyCredentialParametersError; - - fn try_from(value: PublicKeyCredentialParameters) -> Result { - use coset::iana::EnumI64; - Ok(Self { - ty: get_enum_from_string_name(&value.ty)?, - alg: coset::iana::Algorithm::from_i64(value.alg) - .ok_or(PublicKeyCredentialParametersError::InvalidAlgorithm)?, - }) - } -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PublicKeyCredentialDescriptor { - pub ty: String, - pub id: Vec, - pub transports: Option>, -} - -impl TryFrom - for passkey::types::webauthn::PublicKeyCredentialDescriptor -{ - type Error = UnknownEnum; - - fn try_from(value: PublicKeyCredentialDescriptor) -> Result { - Ok(Self { - ty: get_enum_from_string_name(&value.ty)?, - id: value.id.into(), - transports: value - .transports - .map(|tt| { - tt.into_iter() - .map(|t| get_enum_from_string_name(&t)) - .collect::, Self::Error>>() - }) - .transpose()?, - }) - } -} - -pub type Extensions = Option; - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct MakeCredentialRequest { - pub client_data_hash: Vec, - pub rp: PublicKeyCredentialRpEntity, - pub user: PublicKeyCredentialUserEntity, - pub pub_key_cred_params: Vec, - pub exclude_list: Option>, - pub options: Options, - pub extensions: Extensions, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct MakeCredentialResult { - pub authenticator_data: Vec, - pub attestation_object: Vec, - pub credential_id: Vec, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct GetAssertionRequest { - pub rp_id: String, - pub client_data_hash: Vec, - pub allow_list: Option>, - pub options: Options, - pub extensions: Extensions, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Options { - pub rk: bool, - pub uv: UV, -} - -impl From for Options { - fn from(value: super::CheckUserOptions) -> Self { - Self { - rk: value.require_presence, - uv: value.require_verification.into(), - } - } -} - -impl From for super::CheckUserOptions { - fn from(value: Options) -> Self { - Self { - require_presence: value.rk, - require_verification: value.uv.into(), - } - } -} - -#[derive(Eq, PartialEq, Clone, Copy)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum UV { - Discouraged, - Preferred, - Required, -} - -impl From for Verification { - fn from(value: UV) -> Self { - match value { - UV::Discouraged => Verification::Discouraged, - UV::Preferred => Verification::Preferred, - UV::Required => Verification::Required, - } - } -} - -impl From for UV { - fn from(value: Verification) -> Self { - match value { - Verification::Discouraged => UV::Discouraged, - Verification::Preferred => UV::Preferred, - Verification::Required => UV::Required, - } - } -} - -impl From for UV { - fn from(value: UserVerificationRequirement) -> Self { - match value { - UserVerificationRequirement::Discouraged => UV::Discouraged, - UserVerificationRequirement::Preferred => UV::Preferred, - UserVerificationRequirement::Required => UV::Required, - } - } -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct GetAssertionResult { - pub credential_id: Vec, - pub authenticator_data: Vec, - pub signature: Vec, - pub user_handle: Vec, - - pub selected_credential: SelectedCredential, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum ClientData { - DefaultWithExtraData { android_package_name: String }, - DefaultWithCustomHash { hash: Vec }, -} - -#[derive(Serialize, Clone)] -#[serde(rename_all = "camelCase")] -pub(super) struct AndroidClientData { - android_package_name: String, -} - -impl passkey::client::ClientData> for ClientData { - fn extra_client_data(&self) -> Option { - match self { - ClientData::DefaultWithExtraData { - android_package_name, - } => Some(AndroidClientData { - android_package_name: android_package_name.clone(), - }), - ClientData::DefaultWithCustomHash { .. } => None, - } - } - - fn client_data_hash(&self) -> Option> { - match self { - ClientData::DefaultWithExtraData { .. } => None, - ClientData::DefaultWithCustomHash { hash } => Some(hash.clone()), - } - } -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct ClientExtensionResults { - pub cred_props: Option, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct CredPropsResult { - pub rk: Option, - pub authenticator_display_name: Option, -} - -impl From for CredPropsResult { - fn from(value: passkey::types::webauthn::CredentialPropertiesOutput) -> Self { - Self { - rk: value.discoverable, - authenticator_display_name: value.authenticator_display_name, - } - } -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PublicKeyCredentialAuthenticatorAttestationResponse { - pub id: String, - pub raw_id: Vec, - pub ty: String, - pub authenticator_attachment: Option, - pub client_extension_results: ClientExtensionResults, - pub response: AuthenticatorAttestationResponse, - pub selected_credential: SelectedCredential, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct AuthenticatorAttestationResponse { - pub client_data_json: Vec, - pub authenticator_data: Vec, - pub public_key: Option>, - pub public_key_algorithm: i64, - pub attestation_object: Vec, - pub transports: Option>, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PublicKeyCredentialAuthenticatorAssertionResponse { - pub id: String, - pub raw_id: Vec, - pub ty: String, - pub authenticator_attachment: Option, - pub client_extension_results: ClientExtensionResults, - pub response: AuthenticatorAssertionResponse, - pub selected_credential: SelectedCredential, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct AuthenticatorAssertionResponse { - pub client_data_json: Vec, - pub authenticator_data: Vec, - pub signature: Vec, - pub user_handle: Vec, -} - -#[derive(Debug, Error)] -#[error("Invalid origin: {0}")] -pub struct InvalidOriginError(String); - -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -/// An Unverified asset link. -pub struct UnverifiedAssetLink { - /// Application package name. - package_name: String, - /// Fingerprint to compare. - sha256_cert_fingerprint: String, - /// Host to lookup the well known asset link. - host: String, - /// When sourced from the application statement list or parsed from host for passkeys. - /// Will be generated from `host` if not provided. - asset_link_url: Option, -} - -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -/// The origin of a WebAuthn request. -pub enum Origin { - /// A Url, meant for a request in the web browser. - Web(String), - /// An android digital asset fingerprint. - /// Meant for a request coming from an android application. - Android(UnverifiedAssetLink), -} - -impl<'a> TryFrom for passkey::client::Origin<'a> { - type Error = InvalidOriginError; - - fn try_from(value: Origin) -> Result { - Ok(match value { - Origin::Web(url) => { - let url = Url::parse(&url).map_err(|e| InvalidOriginError(format!("{}", e)))?; - passkey::client::Origin::Web(Cow::Owned(url)) - } - Origin::Android(link) => passkey::client::Origin::Android(link.try_into()?), - }) - } -} - -impl<'a> TryFrom for passkey::client::UnverifiedAssetLink<'a> { - type Error = InvalidOriginError; - - fn try_from(value: UnverifiedAssetLink) -> Result { - let asset_link_url = match value.asset_link_url { - Some(url) => Some(Url::parse(&url).map_err(|e| InvalidOriginError(format!("{}", e)))?), - None => None, - }; - - passkey::client::UnverifiedAssetLink::new( - Cow::from(value.package_name), - value.sha256_cert_fingerprint.as_str(), - Cow::from(value.host), - asset_link_url, - ) - .map_err(|e| InvalidOriginError(format!("{:?}", e))) - } -} - -#[cfg(test)] -mod tests { - use serde::{Deserialize, Serialize}; - - use super::AndroidClientData; - - // This is a stripped down of the passkey-rs implementation, to test the - // serialization of the `ClientData` enum, and to make sure that () and None - // are serialized the same way when going through #[serde(flatten)]. - #[derive(Serialize, Deserialize)] - #[serde(rename_all = "camelCase")] - pub struct CollectedClientData - where - E: Serialize, - { - pub origin: String, - - #[serde(flatten)] - pub extra_data: E, - } - - #[test] - fn test_serialize_unit_data() { - let data = CollectedClientData { - origin: "https://example.com".to_owned(), - extra_data: (), - }; - - let serialized = serde_json::to_string(&data).unwrap(); - assert_eq!(serialized, r#"{"origin":"https://example.com"}"#); - } - - #[test] - fn test_serialize_none_data() { - let data = CollectedClientData { - origin: "https://example.com".to_owned(), - extra_data: Option::::None, - }; - - let serialized = serde_json::to_string(&data).unwrap(); - assert_eq!(serialized, r#"{"origin":"https://example.com"}"#); - } - - #[test] - fn test_serialize_android_data() { - let data = CollectedClientData { - origin: "https://example.com".to_owned(), - extra_data: Some(AndroidClientData { - android_package_name: "com.example.app".to_owned(), - }), - }; - - let serialized = serde_json::to_string(&data).unwrap(); - assert_eq!( - serialized, - r#"{"origin":"https://example.com","androidPackageName":"com.example.app"}"# - ); - } -} diff --git a/crates/bitwarden-fido/src/uniffi_support.rs b/crates/bitwarden-fido/src/uniffi_support.rs deleted file mode 100644 index 5bf94d09f..000000000 --- a/crates/bitwarden-fido/src/uniffi_support.rs +++ /dev/null @@ -1,3 +0,0 @@ -use uuid::Uuid; - -uniffi::ffi_converter_forward!(Uuid, bitwarden_core::UniFfiTag, crate::UniFfiTag); diff --git a/crates/bitwarden-fido/uniffi.toml b/crates/bitwarden-fido/uniffi.toml deleted file mode 100644 index 395a85b21..000000000 --- a/crates/bitwarden-fido/uniffi.toml +++ /dev/null @@ -1,9 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.fido" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenFidoFFI" -module_name = "BitwardenFido" -generate_immutable_records = true diff --git a/crates/bitwarden-generators/Cargo.toml b/crates/bitwarden-generators/Cargo.toml deleted file mode 100644 index 24e5d5ebc..000000000 --- a/crates/bitwarden-generators/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -name = "bitwarden-generators" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[features] -uniffi = ["dep:uniffi"] # Uniffi bindings - -[dependencies] -bitwarden-core = { workspace = true, features = ["internal"] } -bitwarden-crypto = { workspace = true } -rand = ">=0.8.5, <0.9" -reqwest = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } -uniffi = { workspace = true, optional = true } - -[dev-dependencies] -rand_chacha = "0.3.1" -tokio = { workspace = true, features = ["rt"] } -wiremock = "0.6.0" - -[lints] -workspace = true diff --git a/crates/bitwarden-generators/README.md b/crates/bitwarden-generators/README.md deleted file mode 100644 index db70c11df..000000000 --- a/crates/bitwarden-generators/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Generators - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-generators/src/client_generator.rs b/crates/bitwarden-generators/src/client_generator.rs deleted file mode 100644 index d2e2b7483..000000000 --- a/crates/bitwarden-generators/src/client_generator.rs +++ /dev/null @@ -1,106 +0,0 @@ -use bitwarden_core::Client; - -use crate::{ - passphrase::passphrase, password::password, username::username, PassphraseError, - PassphraseGeneratorRequest, PasswordError, PasswordGeneratorRequest, UsernameError, - UsernameGeneratorRequest, -}; - -pub struct ClientGenerator<'a> { - client: &'a Client, -} - -impl<'a> ClientGenerator<'a> { - fn new(client: &'a Client) -> Self { - Self { client } - } - - /// Generates a random password. - /// - /// The character sets and password length can be customized using the `input` parameter. - /// - /// # Examples - /// - /// ``` - /// use bitwarden_core::Client; - /// use bitwarden_generators::{ClientGeneratorExt, PassphraseError, PasswordGeneratorRequest}; - /// - /// async fn test() -> Result<(), PassphraseError> { - /// let input = PasswordGeneratorRequest { - /// lowercase: true, - /// uppercase: true, - /// numbers: true, - /// length: 20, - /// ..Default::default() - /// }; - /// let password = Client::new(None).generator().password(input).unwrap(); - /// println!("{}", password); - /// Ok(()) - /// } - /// ``` - pub fn password(&self, input: PasswordGeneratorRequest) -> Result { - password(input) - } - - /// Generates a random passphrase. - /// A passphrase is a combination of random words separated by a character. - /// An example of passphrase is `correct horse battery staple`. - /// - /// The number of words and their case, the word separator, and the inclusion of - /// a number in the passphrase can be customized using the `input` parameter. - /// - /// # Examples - /// - /// ``` - /// use bitwarden_core::Client; - /// use bitwarden_generators::{ClientGeneratorExt, PassphraseError, PassphraseGeneratorRequest}; - /// - /// async fn test() -> Result<(), PassphraseError> { - /// let input = PassphraseGeneratorRequest { - /// num_words: 4, - /// ..Default::default() - /// }; - /// let passphrase = Client::new(None).generator().passphrase(input).unwrap(); - /// println!("{}", passphrase); - /// Ok(()) - /// } - /// ``` - pub fn passphrase(&self, input: PassphraseGeneratorRequest) -> Result { - passphrase(input) - } - - /// Generates a random username. - /// There are different username generation strategies, which can be customized using the - /// `input` parameter. - /// - /// Note that most generation strategies will be executed on the client side, but `Forwarded` - /// will use third-party services, which may require a specific setup or API key. - /// - /// ``` - /// use bitwarden_core::Client; - /// use bitwarden_generators::{ClientGeneratorExt, UsernameError, UsernameGeneratorRequest}; - /// - /// async fn test() -> Result<(), UsernameError> { - /// let input = UsernameGeneratorRequest::Word { - /// capitalize: true, - /// include_number: true, - /// }; - /// let username = Client::new(None).generator().username(input).await.unwrap(); - /// println!("{}", username); - /// Ok(()) - /// } - /// ``` - pub async fn username(&self, input: UsernameGeneratorRequest) -> Result { - username(input, self.client.internal.get_http_client()).await - } -} - -pub trait ClientGeneratorExt<'a> { - fn generator(&'a self) -> ClientGenerator<'a>; -} - -impl<'a> ClientGeneratorExt<'a> for Client { - fn generator(&'a self) -> ClientGenerator<'a> { - ClientGenerator::new(self) - } -} diff --git a/crates/bitwarden-generators/src/lib.rs b/crates/bitwarden-generators/src/lib.rs deleted file mode 100644 index 6455a759a..000000000 --- a/crates/bitwarden-generators/src/lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -mod client_generator; -mod username_forwarders; -pub use client_generator::{ClientGenerator, ClientGeneratorExt}; -pub(crate) mod passphrase; -pub use passphrase::{PassphraseError, PassphraseGeneratorRequest}; -pub(crate) mod password; -pub use password::{PasswordError, PasswordGeneratorRequest}; -pub(crate) mod username; -pub use username::{ForwarderServiceType, UsernameError, UsernameGeneratorRequest}; -mod util; - -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); diff --git a/crates/bitwarden-generators/src/passphrase.rs b/crates/bitwarden-generators/src/passphrase.rs deleted file mode 100644 index 1fb83422e..000000000 --- a/crates/bitwarden-generators/src/passphrase.rs +++ /dev/null @@ -1,229 +0,0 @@ -use bitwarden_crypto::EFF_LONG_WORD_LIST; -use rand::{seq::SliceRandom, Rng, RngCore}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use thiserror::Error; - -use crate::util::capitalize_first_letter; - -#[derive(Debug, Error)] -pub enum PassphraseError { - #[error("'num_words' must be between {} and {}", minimum, maximum)] - InvalidNumWords { minimum: u8, maximum: u8 }, -} - -/// Passphrase generator request options. -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PassphraseGeneratorRequest { - /// Number of words in the generated passphrase. - /// This value must be between 3 and 20. - pub num_words: u8, - /// Character separator between words in the generated passphrase. The value cannot be empty. - pub word_separator: String, - /// When set to true, capitalize the first letter of each word in the generated passphrase. - pub capitalize: bool, - /// When set to true, include a number at the end of one of the words in the generated - /// passphrase. - pub include_number: bool, -} - -impl Default for PassphraseGeneratorRequest { - fn default() -> Self { - Self { - num_words: 3, - word_separator: ' '.to_string(), - capitalize: false, - include_number: false, - } - } -} - -const MINIMUM_PASSPHRASE_NUM_WORDS: u8 = 3; -const MAXIMUM_PASSPHRASE_NUM_WORDS: u8 = 20; - -/// Represents a set of valid options to generate a passhprase with. -/// To get an instance of it, use -/// [`PassphraseGeneratorRequest::validate_options`](PassphraseGeneratorRequest::validate_options) -struct ValidPassphraseGeneratorOptions { - pub(super) num_words: u8, - pub(super) word_separator: String, - pub(super) capitalize: bool, - pub(super) include_number: bool, -} - -impl PassphraseGeneratorRequest { - /// Validates the request and returns an immutable struct with valid options to use with the - /// passphrase generator. - fn validate_options(self) -> Result { - // TODO: Add password generator policy checks - - if !(MINIMUM_PASSPHRASE_NUM_WORDS..=MAXIMUM_PASSPHRASE_NUM_WORDS).contains(&self.num_words) - { - return Err(PassphraseError::InvalidNumWords { - minimum: MINIMUM_PASSPHRASE_NUM_WORDS, - maximum: MAXIMUM_PASSPHRASE_NUM_WORDS, - }); - } - - Ok(ValidPassphraseGeneratorOptions { - num_words: self.num_words, - word_separator: self.word_separator, - capitalize: self.capitalize, - include_number: self.include_number, - }) - } -} - -/// Implementation of the random passphrase generator. -pub(crate) fn passphrase(request: PassphraseGeneratorRequest) -> Result { - let options = request.validate_options()?; - Ok(passphrase_with_rng(rand::thread_rng(), options)) -} - -fn passphrase_with_rng(mut rng: impl RngCore, options: ValidPassphraseGeneratorOptions) -> String { - let mut passphrase_words = gen_words(&mut rng, options.num_words); - if options.include_number { - include_number_in_words(&mut rng, &mut passphrase_words); - } - if options.capitalize { - capitalize_words(&mut passphrase_words); - } - passphrase_words.join(&options.word_separator) -} - -fn gen_words(mut rng: impl RngCore, num_words: u8) -> Vec { - (0..num_words) - .map(|_| { - EFF_LONG_WORD_LIST - .choose(&mut rng) - .expect("slice is not empty") - .to_string() - }) - .collect() -} - -fn include_number_in_words(mut rng: impl RngCore, words: &mut [String]) { - let number_idx = rng.gen_range(0..words.len()); - words[number_idx].push_str(&rng.gen_range(0..=9).to_string()); -} - -fn capitalize_words(words: &mut [String]) { - words - .iter_mut() - .for_each(|w| *w = capitalize_first_letter(w)); -} - -#[cfg(test)] -mod tests { - use rand::SeedableRng; - - use super::*; - - #[test] - fn test_gen_words() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - assert_eq!( - &gen_words(&mut rng, 4), - &["subsystem", "undertook", "silenced", "dinginess"] - ); - assert_eq!(&gen_words(&mut rng, 1), &["numbing"]); - assert_eq!(&gen_words(&mut rng, 2), &["catnip", "jokester"]); - } - - #[test] - fn test_capitalize() { - assert_eq!(capitalize_first_letter("hello"), "Hello"); - assert_eq!(capitalize_first_letter("1ello"), "1ello"); - assert_eq!(capitalize_first_letter("Hello"), "Hello"); - assert_eq!(capitalize_first_letter("h"), "H"); - assert_eq!(capitalize_first_letter(""), ""); - - // Also supports non-ascii, though the EFF list doesn't have any - assert_eq!(capitalize_first_letter("áéíóú"), "Áéíóú"); - } - - #[test] - fn test_capitalize_words() { - let mut words = vec!["hello".into(), "world".into()]; - capitalize_words(&mut words); - assert_eq!(words, &["Hello", "World"]); - } - - #[test] - fn test_include_number() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let mut words = vec!["hello".into(), "world".into()]; - include_number_in_words(&mut rng, &mut words); - assert_eq!(words, &["hello", "world7"]); - - let mut words = vec!["This".into(), "is".into(), "a".into(), "test".into()]; - include_number_in_words(&mut rng, &mut words); - assert_eq!(words, &["This", "is", "a1", "test"]); - } - - #[test] - fn test_separator() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let input = PassphraseGeneratorRequest { - num_words: 4, - // This emoji is 35 bytes long, but represented as a single character - word_separator: "👨🏻‍❤️‍💋‍👨🏻".into(), - capitalize: false, - include_number: true, - } - .validate_options() - .unwrap(); - assert_eq!( - passphrase_with_rng(&mut rng, input), - "subsystem4👨🏻‍❤️‍💋‍👨🏻undertook👨🏻‍❤️‍💋‍👨🏻silenced👨🏻‍❤️‍💋‍👨🏻dinginess" - ); - } - - #[test] - fn test_passphrase() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let input = PassphraseGeneratorRequest { - num_words: 4, - word_separator: "-".into(), - capitalize: true, - include_number: true, - } - .validate_options() - .unwrap(); - assert_eq!( - passphrase_with_rng(&mut rng, input), - "Subsystem4-Undertook-Silenced-Dinginess" - ); - - let input = PassphraseGeneratorRequest { - num_words: 3, - word_separator: " ".into(), - capitalize: false, - include_number: true, - } - .validate_options() - .unwrap(); - assert_eq!( - passphrase_with_rng(&mut rng, input), - "drew7 hankering cabana" - ); - - let input = PassphraseGeneratorRequest { - num_words: 5, - word_separator: ";".into(), - capitalize: false, - include_number: false, - } - .validate_options() - .unwrap(); - assert_eq!( - passphrase_with_rng(&mut rng, input), - "duller;backlight;factual;husked;remover" - ); - } -} diff --git a/crates/bitwarden-generators/src/password.rs b/crates/bitwarden-generators/src/password.rs deleted file mode 100644 index 9821f8bbe..000000000 --- a/crates/bitwarden-generators/src/password.rs +++ /dev/null @@ -1,397 +0,0 @@ -use std::collections::BTreeSet; - -use rand::{distributions::Distribution, seq::SliceRandom, RngCore}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum PasswordError { - #[error("No character set enabled")] - NoCharacterSetEnabled, - #[error("Invalid password length")] - InvalidLength, -} - -/// Password generator request options. -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PasswordGeneratorRequest { - /// Include lowercase characters (a-z). - pub lowercase: bool, - /// Include uppercase characters (A-Z). - pub uppercase: bool, - /// Include numbers (0-9). - pub numbers: bool, - /// Include special characters: ! @ # $ % ^ & * - pub special: bool, - - /// The length of the generated password. - /// Note that the password length must be greater than the sum of all the minimums. - pub length: u8, - - /// When set to true, the generated password will not contain ambiguous characters. - /// The ambiguous characters are: I, O, l, 0, 1 - pub avoid_ambiguous: bool, // TODO: Should we rename this to include_all_characters? - - /// The minimum number of lowercase characters in the generated password. - /// When set, the value must be between 1 and 9. This value is ignored if lowercase is false. - pub min_lowercase: Option, - /// The minimum number of uppercase characters in the generated password. - /// When set, the value must be between 1 and 9. This value is ignored if uppercase is false. - pub min_uppercase: Option, - /// The minimum number of numbers in the generated password. - /// When set, the value must be between 1 and 9. This value is ignored if numbers is false. - pub min_number: Option, - /// The minimum number of special characters in the generated password. - /// When set, the value must be between 1 and 9. This value is ignored if special is false. - pub min_special: Option, -} - -const DEFAULT_PASSWORD_LENGTH: u8 = 16; - -impl Default for PasswordGeneratorRequest { - fn default() -> Self { - Self { - lowercase: true, - uppercase: true, - numbers: true, - special: false, - length: DEFAULT_PASSWORD_LENGTH, - avoid_ambiguous: false, - min_lowercase: None, - min_uppercase: None, - min_number: None, - min_special: None, - } - } -} - -const UPPER_CHARS_AMBIGUOUS: &[char] = &['I', 'O']; -const LOWER_CHARS_AMBIGUOUS: &[char] = &['l']; -const NUMBER_CHARS_AMBIGUOUS: &[char] = &['0', '1']; -const SPECIAL_CHARS: &[char] = &['!', '@', '#', '$', '%', '^', '&', '*']; - -/// A set of characters used to generate a password. This set is backed by a BTreeSet -/// to have consistent ordering between runs. This is not important during normal execution, -/// but it's necessary for the tests to be repeatable. -/// To create an instance, use [`CharSet::default()`](CharSet::default) -#[derive(Clone, Default)] -struct CharSet(BTreeSet); -impl CharSet { - /// Includes the given characters in the set. Any duplicate items will be ignored - pub fn include(self, other: impl IntoIterator) -> Self { - self.include_if(true, other) - } - - /// Includes the given characters in the set if the predicate is true. Any duplicate items will - /// be ignored - pub fn include_if(mut self, predicate: bool, other: impl IntoIterator) -> Self { - if predicate { - self.0.extend(other); - } - self - } - - /// Excludes the given characters from the set. Any missing items will be ignored - pub fn exclude_if<'a>( - self, - predicate: bool, - other: impl IntoIterator, - ) -> Self { - if predicate { - let other: BTreeSet<_> = other.into_iter().copied().collect(); - Self(self.0.difference(&other).copied().collect()) - } else { - self - } - } -} -impl<'a> IntoIterator for &'a CharSet { - type Item = char; - type IntoIter = std::iter::Copied>; - fn into_iter(self) -> Self::IntoIter { - self.0.iter().copied() - } -} -impl Distribution for CharSet { - fn sample(&self, rng: &mut R) -> char { - let idx = rng.gen_range(0..self.0.len()); - *self.0.iter().nth(idx).expect("Valid index") - } -} - -/// Represents a set of valid options to generate a password with. -/// To get an instance of it, use -/// [`PasswordGeneratorRequest::validate_options`](PasswordGeneratorRequest::validate_options) -struct PasswordGeneratorOptions { - pub(super) lower: (CharSet, usize), - pub(super) upper: (CharSet, usize), - pub(super) number: (CharSet, usize), - pub(super) special: (CharSet, usize), - pub(super) all: (CharSet, usize), - - pub(super) length: usize, -} - -impl PasswordGeneratorRequest { - /// Validates the request and returns an immutable struct with valid options to use with the - /// password generator. - fn validate_options(self) -> Result { - // TODO: Add password generator policy checks - - // We always have to have at least one character set enabled - if !self.lowercase && !self.uppercase && !self.numbers && !self.special { - return Err(PasswordError::NoCharacterSetEnabled); - } - - if self.length < 4 { - return Err(PasswordError::InvalidLength); - } - - // Make sure the minimum values are zero when the character - // set is disabled, and at least one when it's enabled - fn get_minimum(min: Option, enabled: bool) -> usize { - if enabled { - usize::max(min.unwrap_or(1) as usize, 1) - } else { - 0 - } - } - - let length = self.length as usize; - let min_lowercase = get_minimum(self.min_lowercase, self.lowercase); - let min_uppercase = get_minimum(self.min_uppercase, self.uppercase); - let min_number = get_minimum(self.min_number, self.numbers); - let min_special = get_minimum(self.min_special, self.special); - - // Check that the minimum lengths aren't larger than the password length - let minimum_length = min_lowercase + min_uppercase + min_number + min_special; - if minimum_length > length { - return Err(PasswordError::InvalidLength); - } - - let lower = ( - CharSet::default() - .include_if(self.lowercase, 'a'..='z') - .exclude_if(self.avoid_ambiguous, LOWER_CHARS_AMBIGUOUS), - min_lowercase, - ); - - let upper = ( - CharSet::default() - .include_if(self.uppercase, 'A'..='Z') - .exclude_if(self.avoid_ambiguous, UPPER_CHARS_AMBIGUOUS), - min_uppercase, - ); - - let number = ( - CharSet::default() - .include_if(self.numbers, '0'..='9') - .exclude_if(self.avoid_ambiguous, NUMBER_CHARS_AMBIGUOUS), - min_number, - ); - - let special = ( - CharSet::default().include_if(self.special, SPECIAL_CHARS.iter().copied()), - min_special, - ); - - let all = ( - CharSet::default() - .include(&lower.0) - .include(&upper.0) - .include(&number.0) - .include(&special.0), - length - minimum_length, - ); - - Ok(PasswordGeneratorOptions { - lower, - upper, - number, - special, - all, - length, - }) - } -} - -/// Implementation of the random password generator. -pub(crate) fn password(input: PasswordGeneratorRequest) -> Result { - let options = input.validate_options()?; - Ok(password_with_rng(rand::thread_rng(), options)) -} - -fn password_with_rng(mut rng: impl RngCore, options: PasswordGeneratorOptions) -> String { - let mut buf: Vec = Vec::with_capacity(options.length); - - let opts = [ - &options.all, - &options.upper, - &options.lower, - &options.number, - &options.special, - ]; - for (set, qty) in opts { - buf.extend(set.sample_iter(&mut rng).take(*qty)); - } - - buf.shuffle(&mut rng); - - buf.iter().collect() -} - -#[cfg(test)] -mod test { - use std::collections::BTreeSet; - - use rand::SeedableRng; - - use super::*; - - // We convert the slices to BTreeSets to be able to use `is_subset` - fn ref_to_set<'a>(chars: impl IntoIterator) -> BTreeSet { - chars.into_iter().copied().collect() - } - fn to_set(chars: impl IntoIterator) -> BTreeSet { - chars.into_iter().collect() - } - - #[test] - fn test_password_gen_all_charsets_enabled() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let options = PasswordGeneratorRequest { - lowercase: true, - uppercase: true, - numbers: true, - special: true, - avoid_ambiguous: false, - ..Default::default() - } - .validate_options() - .unwrap(); - - assert_eq!(to_set(&options.lower.0), to_set('a'..='z')); - assert_eq!(to_set(&options.upper.0), to_set('A'..='Z')); - assert_eq!(to_set(&options.number.0), to_set('0'..='9')); - assert_eq!(to_set(&options.special.0), ref_to_set(SPECIAL_CHARS)); - - let pass = password_with_rng(&mut rng, options); - assert_eq!(pass, "Z!^B5r%hUa23dFM@"); - } - - #[test] - fn test_password_gen_only_letters_enabled() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let options = PasswordGeneratorRequest { - lowercase: true, - uppercase: true, - numbers: false, - special: false, - avoid_ambiguous: false, - ..Default::default() - } - .validate_options() - .unwrap(); - - assert_eq!(to_set(&options.lower.0), to_set('a'..='z')); - assert_eq!(to_set(&options.upper.0), to_set('A'..='Z')); - assert_eq!(to_set(&options.number.0), to_set([])); - assert_eq!(to_set(&options.special.0), to_set([])); - - let pass = password_with_rng(&mut rng, options); - assert_eq!(pass, "NQiFrGufQMiNUAmj"); - } - - #[test] - fn test_password_gen_only_numbers_and_lower_enabled_no_ambiguous() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let options = PasswordGeneratorRequest { - lowercase: true, - uppercase: false, - numbers: true, - special: false, - avoid_ambiguous: true, - ..Default::default() - } - .validate_options() - .unwrap(); - - assert!(to_set(&options.lower.0).is_subset(&to_set('a'..='z'))); - assert!(to_set(&options.lower.0).is_disjoint(&ref_to_set(LOWER_CHARS_AMBIGUOUS))); - - assert!(to_set(&options.number.0).is_subset(&to_set('0'..='9'))); - assert!(to_set(&options.number.0).is_disjoint(&ref_to_set(NUMBER_CHARS_AMBIGUOUS))); - - assert_eq!(to_set(&options.upper.0), to_set([])); - assert_eq!(to_set(&options.special.0), to_set([])); - - let pass = password_with_rng(&mut rng, options); - assert_eq!(pass, "mnjabfz5ct272prf"); - } - - #[test] - fn test_password_gen_only_upper_and_special_enabled_no_ambiguous() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let options = PasswordGeneratorRequest { - lowercase: false, - uppercase: true, - numbers: false, - special: true, - avoid_ambiguous: true, - ..Default::default() - } - .validate_options() - .unwrap(); - - assert!(to_set(&options.upper.0).is_subset(&to_set('A'..='Z'))); - assert!(to_set(&options.upper.0).is_disjoint(&ref_to_set(UPPER_CHARS_AMBIGUOUS))); - - assert_eq!(to_set(&options.special.0), ref_to_set(SPECIAL_CHARS)); - - assert_eq!(to_set(&options.lower.0), to_set([])); - assert_eq!(to_set(&options.number.0), to_set([])); - - let pass = password_with_rng(&mut rng, options); - assert_eq!(pass, "B*GBQANS%UZPQD!K"); - } - - #[test] - fn test_password_gen_minimum_limits() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - - let options = PasswordGeneratorRequest { - lowercase: true, - uppercase: true, - numbers: true, - special: true, - avoid_ambiguous: false, - length: 24, - min_lowercase: Some(5), - min_uppercase: Some(5), - min_number: Some(5), - min_special: Some(5), - } - .validate_options() - .unwrap(); - - assert_eq!(to_set(&options.lower.0), to_set('a'..='z')); - assert_eq!(to_set(&options.upper.0), to_set('A'..='Z')); - assert_eq!(to_set(&options.number.0), to_set('0'..='9')); - assert_eq!(to_set(&options.special.0), ref_to_set(SPECIAL_CHARS)); - - assert_eq!(options.lower.1, 5); - assert_eq!(options.upper.1, 5); - assert_eq!(options.number.1, 5); - assert_eq!(options.special.1, 5); - - let pass = password_with_rng(&mut rng, options); - assert_eq!(pass, "236q5!a#R%PG5rI%k1!*@uRt"); - } -} diff --git a/crates/bitwarden-generators/src/username.rs b/crates/bitwarden-generators/src/username.rs deleted file mode 100644 index 0140f77fb..000000000 --- a/crates/bitwarden-generators/src/username.rs +++ /dev/null @@ -1,267 +0,0 @@ -use bitwarden_crypto::EFF_LONG_WORD_LIST; -use rand::{distributions::Distribution, seq::SliceRandom, Rng, RngCore}; -use reqwest::StatusCode; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use thiserror::Error; - -use crate::util::capitalize_first_letter; - -#[derive(Debug, Error)] -pub enum UsernameError { - #[error("Invalid API Key")] - InvalidApiKey, - #[error("Unknown error")] - Unknown, - - #[error("Received error message from server: [{}] {}", .status, .message)] - ResponseContent { status: StatusCode, message: String }, - - #[error(transparent)] - Reqwest(#[from] reqwest::Error), -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum AppendType { - /// Generates a random string of 8 lowercase characters as part of your username - Random, - /// Uses the websitename as part of your username - WebsiteName { website: String }, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -/// Configures the email forwarding service to use. -/// For instructions on how to configure each service, see the documentation: -/// -pub enum ForwarderServiceType { - /// Previously known as "AnonAddy" - AddyIo { - api_token: String, - domain: String, - base_url: String, - }, - DuckDuckGo { - token: String, - }, - Firefox { - api_token: String, - }, - Fastmail { - api_token: String, - }, - ForwardEmail { - api_token: String, - domain: String, - }, - SimpleLogin { - api_key: String, - }, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum UsernameGeneratorRequest { - /// Generates a single word username - Word { - /// Capitalize the first letter of the word - capitalize: bool, - /// Include a 4 digit number at the end of the word - include_number: bool, - }, - /// Generates an email using your provider's subaddressing capabilities. - /// Note that not all providers support this functionality. - /// This will generate an address of the format `youremail+generated@domain.tld` - Subaddress { - /// The type of subaddress to add to the base email - r#type: AppendType, - /// The full email address to use as the base for the subaddress - email: String, - }, - Catchall { - /// The type of username to use with the catchall email domain - r#type: AppendType, - /// The domain to use for the catchall email address - domain: String, - }, - Forwarded { - /// The email forwarding service to use, see [ForwarderServiceType] - /// for instructions on how to configure each - service: ForwarderServiceType, - /// The website for which the email address is being generated - /// This is not used in all services, and is only used for display purposes - website: Option, - }, -} - -impl ForwarderServiceType { - // Generate a username using the specified email forwarding service - // This requires an HTTP client to be passed in, as the service will need to make API calls - pub async fn generate( - self, - http: &reqwest::Client, - website: Option, - ) -> Result { - use ForwarderServiceType::*; - - use crate::username_forwarders::*; - - match self { - AddyIo { - api_token, - domain, - base_url, - } => addyio::generate(http, api_token, domain, base_url, website).await, - DuckDuckGo { token } => duckduckgo::generate(http, token).await, - Firefox { api_token } => firefox::generate(http, api_token, website).await, - Fastmail { api_token } => fastmail::generate(http, api_token, website).await, - ForwardEmail { api_token, domain } => { - forwardemail::generate(http, api_token, domain, website).await - } - SimpleLogin { api_key } => simplelogin::generate(http, api_key, website).await, - } - } -} - -/// Implementation of the username generator. -/// -/// Note: The HTTP client is passed in as a required parameter for convenience, -/// as some username generators require making API calls. -pub(crate) async fn username( - input: UsernameGeneratorRequest, - http: &reqwest::Client, -) -> Result { - use rand::thread_rng; - use UsernameGeneratorRequest::*; - match input { - Word { - capitalize, - include_number, - } => Ok(username_word(&mut thread_rng(), capitalize, include_number)), - Subaddress { r#type, email } => Ok(username_subaddress(&mut thread_rng(), r#type, email)), - Catchall { r#type, domain } => Ok(username_catchall(&mut thread_rng(), r#type, domain)), - Forwarded { service, website } => service.generate(http, website).await, - } -} - -fn username_word(mut rng: impl RngCore, capitalize: bool, include_number: bool) -> String { - let word = EFF_LONG_WORD_LIST - .choose(&mut rng) - .expect("slice is not empty"); - - let mut word = if capitalize { - capitalize_first_letter(word) - } else { - word.to_string() - }; - - if include_number { - word.push_str(&random_number(&mut rng)); - } - - word -} - -/// Generate a random 4 digit number, including leading zeros -fn random_number(mut rng: impl RngCore) -> String { - let num = rng.gen_range(0..=9999); - format!("{num:0>4}") -} - -/// Generate a username using a plus addressed email address -/// The format is `+@` -fn username_subaddress(mut rng: impl RngCore, r#type: AppendType, email: String) -> String { - if email.len() < 3 { - return email; - } - - let (email_begin, email_end) = match email.find('@') { - Some(pos) if pos > 0 && pos < email.len() - 1 => { - email.split_once('@').expect("The email contains @") - } - _ => return email, - }; - - let email_middle = match r#type { - AppendType::Random => random_lowercase_string(&mut rng, 8), - AppendType::WebsiteName { website } => website, - }; - - format!("{}+{}@{}", email_begin, email_middle, email_end) -} - -/// Generate a username using a catchall email address -/// The format is `@` -fn username_catchall(mut rng: impl RngCore, r#type: AppendType, domain: String) -> String { - if domain.is_empty() { - return domain; - } - - let email_start = match r#type { - AppendType::Random => random_lowercase_string(&mut rng, 8), - AppendType::WebsiteName { website } => website, - }; - - format!("{}@{}", email_start, domain) -} - -fn random_lowercase_string(mut rng: impl RngCore, length: usize) -> String { - const LOWERCASE_ALPHANUMERICAL: &[u8] = b"abcdefghijklmnopqrstuvwxyz1234567890"; - let dist = rand::distributions::Slice::new(LOWERCASE_ALPHANUMERICAL).expect("Non-empty slice"); - - dist.sample_iter(&mut rng) - .take(length) - .map(|&b| b as char) - .collect() -} - -#[cfg(test)] -mod tests { - use rand::SeedableRng; - - pub use super::*; - - #[test] - fn test_username_word() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - assert_eq!(username_word(&mut rng, true, true), "Subsystem6314"); - assert_eq!(username_word(&mut rng, true, false), "Silenced"); - assert_eq!(username_word(&mut rng, false, true), "dinginess4487"); - } - - #[test] - fn test_username_subaddress() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([0u8; 32]); - let user = username_subaddress(&mut rng, AppendType::Random, "demo@test.com".into()); - assert_eq!(user, "demo+5wiejdaj@test.com"); - - let user = username_subaddress( - &mut rng, - AppendType::WebsiteName { - website: "bitwarden.com".into(), - }, - "demo@test.com".into(), - ); - assert_eq!(user, "demo+bitwarden.com@test.com"); - } - - #[test] - fn test_username_catchall() { - let mut rng = rand_chacha::ChaCha8Rng::from_seed([1u8; 32]); - let user = username_catchall(&mut rng, AppendType::Random, "test.com".into()); - assert_eq!(user, "k9y6yw7j@test.com"); - - let user = username_catchall( - &mut rng, - AppendType::WebsiteName { - website: "bitwarden.com".into(), - }, - "test.com".into(), - ); - assert_eq!(user, "bitwarden.com@test.com"); - } -} diff --git a/crates/bitwarden-generators/src/username_forwarders/addyio.rs b/crates/bitwarden-generators/src/username_forwarders/addyio.rs deleted file mode 100644 index 4b75e1c84..000000000 --- a/crates/bitwarden-generators/src/username_forwarders/addyio.rs +++ /dev/null @@ -1,158 +0,0 @@ -use reqwest::{header::CONTENT_TYPE, StatusCode}; - -use crate::username::UsernameError; - -pub async fn generate( - http: &reqwest::Client, - api_token: String, - domain: String, - base_url: String, - website: Option, -) -> Result { - let description = super::format_description(&website); - - #[derive(serde::Serialize)] - struct Request { - domain: String, - description: String, - } - - let response = http - .post(format!("{base_url}/api/v1/aliases")) - .header(CONTENT_TYPE, "application/json") - .bearer_auth(api_token) - .header("X-Requested-With", "XMLHttpRequest") - .json(&Request { - domain, - description, - }) - .send() - .await?; - - if response.status() == StatusCode::UNAUTHORIZED { - return Err(UsernameError::InvalidApiKey); - } - - // Throw any other errors - response.error_for_status_ref()?; - - #[derive(serde::Deserialize)] - struct ResponseData { - email: String, - } - #[derive(serde::Deserialize)] - struct Response { - data: ResponseData, - } - let response: Response = response.json().await?; - - Ok(response.data.email) -} - -#[cfg(test)] -mod tests { - use serde_json::json; - - use crate::username::UsernameError; - #[tokio::test] - async fn test_mock_server() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - // Mock the request to the addy.io API, and verify that the correct request is made - server - .register( - Mock::given(matchers::path("/api/v1/aliases")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Bearer MY_TOKEN")) - .and(matchers::body_json(json!({ - "domain": "myemail.com", - "description": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "data": { - "id": "50c9e585-e7f5-41c4-9016-9014c15454bc", - "user_id": "ca0a4e09-c266-4f6f-845c-958db5090f09", - "local_part": "50c9e585-e7f5-41c4-9016-9014c15454bc", - "domain": "myemail.com", - "email": "50c9e585-e7f5-41c4-9016-9014c15454bc@myemail.com", - "active": true - } - }))) - .expect(1), - ) - .await; - // Mock an invalid API token request - server - .register( - Mock::given(matchers::path("/api/v1/aliases")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Bearer MY_FAKE_TOKEN")) - .and(matchers::body_json(json!({ - "domain": "myemail.com", - "description": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(401)) - .expect(1), - ) - .await; - // Mock an invalid domain - server - .register( - Mock::given(matchers::path("/api/v1/aliases")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Bearer MY_TOKEN")) - .and(matchers::body_json(json!({ - "domain": "gmail.com", - "description": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(403)) - .expect(1), - ) - .await; - - let address = super::generate( - &reqwest::Client::new(), - "MY_TOKEN".into(), - "myemail.com".into(), - format!("http://{}", server.address()), - Some("example.com".into()), - ) - .await - .unwrap(); - - let fake_token_error = super::generate( - &reqwest::Client::new(), - "MY_FAKE_TOKEN".into(), - "myemail.com".into(), - format!("http://{}", server.address()), - Some("example.com".into()), - ) - .await - .unwrap_err(); - - assert_eq!( - fake_token_error.to_string(), - UsernameError::InvalidApiKey.to_string() - ); - - let fake_domain_error = super::generate( - &reqwest::Client::new(), - "MY_TOKEN".into(), - "gmail.com".into(), - format!("http://{}", server.address()), - Some("example.com".into()), - ) - .await - .unwrap_err(); - - assert!(fake_domain_error.to_string().contains("403 Forbidden")); - - server.verify().await; - assert_eq!(address, "50c9e585-e7f5-41c4-9016-9014c15454bc@myemail.com"); - } -} diff --git a/crates/bitwarden-generators/src/username_forwarders/duckduckgo.rs b/crates/bitwarden-generators/src/username_forwarders/duckduckgo.rs deleted file mode 100644 index 3f21fd3a5..000000000 --- a/crates/bitwarden-generators/src/username_forwarders/duckduckgo.rs +++ /dev/null @@ -1,97 +0,0 @@ -use reqwest::{header::CONTENT_TYPE, StatusCode}; - -use crate::username::UsernameError; - -pub async fn generate(http: &reqwest::Client, token: String) -> Result { - generate_with_api_url(http, token, "https://quack.duckduckgo.com".into()).await -} - -async fn generate_with_api_url( - http: &reqwest::Client, - token: String, - api_url: String, -) -> Result { - let response = http - .post(format!("{api_url}/api/email/addresses")) - .header(CONTENT_TYPE, "application/json") - .bearer_auth(token) - .send() - .await?; - - if response.status() == StatusCode::UNAUTHORIZED { - return Err(UsernameError::InvalidApiKey); - } - - // Throw any other errors - response.error_for_status_ref()?; - - #[derive(serde::Deserialize)] - struct Response { - address: String, - } - let response: Response = response.json().await?; - - Ok(format!("{}@duck.com", response.address)) -} - -#[cfg(test)] -mod tests { - use serde_json::json; - - use crate::username::UsernameError; - #[tokio::test] - async fn test_mock_server() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - // Mock the request to the DDG API, and verify that the correct request is made - server - .register( - Mock::given(matchers::path("/api/email/addresses")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Bearer MY_TOKEN")) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "address": "bw7prt" - }))) - .expect(1), - ) - .await; - // Mock an invalid token request - server - .register( - Mock::given(matchers::path("/api/email/addresses")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Bearer MY_FAKE_TOKEN")) - .respond_with(ResponseTemplate::new(401)) - .expect(1), - ) - .await; - - let address = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_TOKEN".into(), - format!("http://{}", server.address()), - ) - .await - .unwrap(); - assert_eq!(address, "bw7prt@duck.com"); - - let fake_token_error = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_FAKE_TOKEN".into(), - format!("http://{}", server.address()), - ) - .await - .unwrap_err(); - - assert_eq!( - fake_token_error.to_string(), - UsernameError::InvalidApiKey.to_string() - ); - - server.verify().await; - } -} diff --git a/crates/bitwarden-generators/src/username_forwarders/fastmail.rs b/crates/bitwarden-generators/src/username_forwarders/fastmail.rs deleted file mode 100644 index 8a73250c4..000000000 --- a/crates/bitwarden-generators/src/username_forwarders/fastmail.rs +++ /dev/null @@ -1,206 +0,0 @@ -use std::collections::HashMap; - -use reqwest::{header::CONTENT_TYPE, StatusCode}; -use serde_json::json; - -use crate::username::UsernameError; - -pub async fn generate( - http: &reqwest::Client, - api_token: String, - website: Option, -) -> Result { - generate_with_api_url(http, api_token, website, "https://api.fastmail.com".into()).await -} - -pub async fn generate_with_api_url( - http: &reqwest::Client, - api_token: String, - website: Option, - api_url: String, -) -> Result { - let account_id = get_account_id(http, &api_token, &api_url).await?; - - let response = http - .post(format!("{api_url}/jmap/api/")) - .header(CONTENT_TYPE, "application/json") - .bearer_auth(api_token) - .json(&json!({ - "using": ["https://www.fastmail.com/dev/maskedemail", "urn:ietf:params:jmap:core"], - "methodCalls": [[ - "MaskedEmail/set", { - "accountId": account_id, - "create": { - "new-masked-email": { - "state": "enabled", - "description": "", - "forDomain": website, - "emailPrefix": null, - }, - }, - }, - "0", - ]], - })) - .send() - .await?; - - let status_code = response.status(); - if status_code == StatusCode::UNAUTHORIZED { - return Err(UsernameError::InvalidApiKey); - } - - let response_json: serde_json::Value = response.json().await?; - let Some(r) = response_json.get("methodResponses").and_then(|r| r.get(0)) else { - return Err(UsernameError::Unknown); - }; - let method_response = r.get(0).and_then(|r| r.as_str()); - let response_value = r.get(1); - - if method_response == Some("MaskedEmail/set") { - if let Some(email) = response_value - .and_then(|r| r.get("created")) - .and_then(|r| r.get("new-masked-email")) - .and_then(|r| r.get("email")) - .and_then(|r| r.as_str()) - { - return Ok(email.to_owned()); - }; - - let error_description = response_value - .and_then(|r| r.get("notCreated")) - .and_then(|r| r.get("new-masked-email")) - .and_then(|r| r.get("description")) - .and_then(|r| r.as_str()) - .unwrap_or("Unknown error"); - - return Err(UsernameError::ResponseContent { - status: status_code, - message: error_description.to_owned(), - }); - } else if method_response == Some("error") { - let error_description = response_value - .and_then(|r| r.get("description")) - .and_then(|r| r.as_str()) - .unwrap_or("Unknown error"); - - return Err(UsernameError::ResponseContent { - status: status_code, - message: error_description.to_owned(), - }); - } - - Err(UsernameError::Unknown) -} - -async fn get_account_id( - client: &reqwest::Client, - api_token: &str, - api_url: &str, -) -> Result { - #[derive(serde::Deserialize)] - struct Response { - #[serde(rename = "primaryAccounts")] - primary_accounts: HashMap, - } - let response = client - .get(format!("{api_url}/.well-known/jmap")) - .bearer_auth(api_token) - .send() - .await?; - - if response.status() == StatusCode::UNAUTHORIZED { - return Err(UsernameError::InvalidApiKey); - } - - response.error_for_status_ref()?; - let mut response: Response = response.json().await?; - - Ok(response - .primary_accounts - .remove("https://www.fastmail.com/dev/maskedemail") - .unwrap_or_default()) -} - -#[cfg(test)] -mod tests { - use serde_json::json; - - use crate::username::UsernameError; - #[tokio::test] - async fn test_mock_server() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - // Mock a valid request to FastMail API - server.register(Mock::given(matchers::path("/.well-known/jmap")) - .and(matchers::method("GET")) - .and(matchers::header("Authorization", "Bearer MY_TOKEN")) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "primaryAccounts": { - "https://www.fastmail.com/dev/maskedemail": "ca0a4e09-c266-4f6f-845c-958db5090f09" - } - }))) - .expect(1)).await; - - server.register(Mock::given(matchers::path("/jmap/api/")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Bearer MY_TOKEN")) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "methodResponses": [ - ["MaskedEmail/set", {"created": {"new-masked-email": {"email": "9f823dq23d123ds@mydomain.com"}}}] - ] - }))) - .expect(1)).await; - - // Mock an invalid token request - server - .register( - Mock::given(matchers::path("/.well-known/jmap")) - .and(matchers::method("GET")) - .and(matchers::header("Authorization", "Bearer MY_FAKE_TOKEN")) - .respond_with(ResponseTemplate::new(401)) - .expect(1), - ) - .await; - - server - .register( - Mock::given(matchers::path("/jmap/api/")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Bearer MY_FAKE_TOKEN")) - .respond_with(ResponseTemplate::new(201)) - .expect(0), - ) - .await; - - let address = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_TOKEN".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap(); - assert_eq!(address, "9f823dq23d123ds@mydomain.com"); - - let fake_token_error = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_FAKE_TOKEN".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap_err(); - - assert_eq!( - fake_token_error.to_string(), - UsernameError::InvalidApiKey.to_string() - ); - - server.verify().await; - } -} diff --git a/crates/bitwarden-generators/src/username_forwarders/firefox.rs b/crates/bitwarden-generators/src/username_forwarders/firefox.rs deleted file mode 100644 index 66c2a3a2c..000000000 --- a/crates/bitwarden-generators/src/username_forwarders/firefox.rs +++ /dev/null @@ -1,173 +0,0 @@ -use reqwest::{ - header::{self}, - StatusCode, -}; - -use crate::username::UsernameError; - -pub async fn generate( - http: &reqwest::Client, - api_token: String, - website: Option, -) -> Result { - generate_with_api_url(http, api_token, website, "https://relay.firefox.com".into()).await -} - -async fn generate_with_api_url( - http: &reqwest::Client, - api_token: String, - website: Option, - api_url: String, -) -> Result { - #[derive(serde::Serialize)] - struct Request { - enabled: bool, - #[serde(skip_serializing_if = "Option::is_none")] - generated_for: Option, - description: String, - } - - let description = super::format_description_ff(&website); - - let response = http - .post(format!("{api_url}/api/v1/relayaddresses/")) - .header(header::AUTHORIZATION, format!("Token {api_token}")) - .json(&Request { - enabled: true, - generated_for: website, - description, - }) - .send() - .await?; - - if response.status() == StatusCode::UNAUTHORIZED { - return Err(UsernameError::InvalidApiKey); - } - - // Throw any other errors - response.error_for_status_ref()?; - - #[derive(serde::Deserialize)] - struct Response { - full_address: String, - } - let response: Response = response.json().await?; - - Ok(response.full_address) -} - -#[cfg(test)] -mod tests { - use serde_json::json; - - use crate::username::UsernameError; - - #[tokio::test] - async fn test_mock_success() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - server - .register( - Mock::given(matchers::path("/api/v1/relayaddresses/")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Token MY_TOKEN")) - .and(matchers::body_json(json!({ - "enabled": true, - "generated_for": "example.com", - "description": "example.com - Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "full_address": "ofuj4d4qw@mozmail.com" - }))) - .expect(1), - ) - .await; - - let address = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_TOKEN".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap(); - assert_eq!(address, "ofuj4d4qw@mozmail.com"); - - server.verify().await; - } - - #[tokio::test] - async fn test_mock_without_website() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - server - .register( - Mock::given(matchers::path("/api/v1/relayaddresses/")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Token MY_OTHER_TOKEN")) - .and(matchers::body_json(json!({ - "enabled": true, - "description": "Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "full_address": "856f7765@mozmail.com" - }))) - .expect(1), - ) - .await; - - let address = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_OTHER_TOKEN".into(), - None, - format!("http://{}", server.address()), - ) - .await - .unwrap(); - assert_eq!(address, "856f7765@mozmail.com"); - - server.verify().await; - } - - #[tokio::test] - async fn test_mock_invalid_token() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - server - .register( - Mock::given(matchers::path("/api/v1/relayaddresses/")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Token MY_FAKE_TOKEN")) - .and(matchers::body_json(json!({ - "enabled": true, - "generated_for": "example.com", - "description": "example.com - Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(401)) - .expect(1), - ) - .await; - - let error = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_FAKE_TOKEN".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap_err(); - - assert_eq!(error.to_string(), UsernameError::InvalidApiKey.to_string()); - - server.verify().await; - } -} diff --git a/crates/bitwarden-generators/src/username_forwarders/forwardemail.rs b/crates/bitwarden-generators/src/username_forwarders/forwardemail.rs deleted file mode 100644 index 1cec22882..000000000 --- a/crates/bitwarden-generators/src/username_forwarders/forwardemail.rs +++ /dev/null @@ -1,209 +0,0 @@ -use reqwest::{header::CONTENT_TYPE, StatusCode}; - -use crate::username::UsernameError; - -pub async fn generate( - http: &reqwest::Client, - api_token: String, - domain: String, - website: Option, -) -> Result { - generate_with_api_url( - http, - api_token, - domain, - website, - "https://api.forwardemail.net".into(), - ) - .await -} - -async fn generate_with_api_url( - http: &reqwest::Client, - api_token: String, - domain: String, - website: Option, - api_url: String, -) -> Result { - let description = super::format_description(&website); - - #[derive(serde::Serialize)] - struct Request { - labels: Option, - description: String, - } - - let response = http - .post(format!("{api_url}/v1/domains/{domain}/aliases")) - .header(CONTENT_TYPE, "application/json") - .basic_auth(api_token, None::) - .json(&Request { - description, - labels: website, - }) - .send() - .await?; - - if response.status() == StatusCode::UNAUTHORIZED { - return Err(UsernameError::InvalidApiKey); - } - - #[derive(serde::Deserialize)] - struct ResponseDomain { - name: Option, - } - #[derive(serde::Deserialize)] - struct Response { - name: Option, - domain: Option, - - message: Option, - error: Option, - } - let status = response.status(); - let response: Response = response.json().await?; - - if status.is_success() { - if let Some(name) = response.name { - if let Some(response_domain) = response.domain { - return Ok(format!( - "{}@{}", - name, - response_domain.name.unwrap_or(domain) - )); - } - } - } - - if let Some(message) = response.message { - return Err(UsernameError::ResponseContent { status, message }); - } - if let Some(message) = response.error { - return Err(UsernameError::ResponseContent { status, message }); - } - - Err(UsernameError::Unknown) -} - -#[cfg(test)] -mod tests { - use serde_json::json; - - use crate::username::UsernameError; - - #[tokio::test] - async fn test_mock_server() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - // Mock the request to the ForwardEmail API, and verify that the correct request is made - server - .register( - Mock::given(matchers::path("/v1/domains/mydomain.com/aliases")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authorization", "Basic TVlfVE9LRU46")) - .and(matchers::body_json(json!({ - "labels": "example.com", - "description": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "name": "wertg8ad", - "domain": { - "name": "mydomain.com" - } - }))) - .expect(1), - ) - .await; - - // Mock an invalid API token request - server - .register( - Mock::given(matchers::path("/v1/domains/mydomain.com/aliases")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header( - "Authorization", - "Basic TVlfRkFLRV9UT0tFTjo=", - )) - .and(matchers::body_json(json!({ - "labels": "example.com", - "description": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(401).set_body_json(json!({ - "statusCode": 401, - "error": "Unauthorized", - "message": "Invalid API token." - }))) - .expect(1), - ) - .await; - - // Mock a free API token request - server - .register( - Mock::given(matchers::path("/v1/domains/mydomain.com/aliases")) - .and(matchers::method("POST")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header( - "Authorization", - "Basic TVlfRlJFRV9UT0tFTjo=", - )) - .and(matchers::body_json(json!({ - "labels": "example.com", - "description": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(402).set_body_json(json!({ - "statusCode": 402, - "error": "Payment required", - "message": "Please upgrade to a paid plan to unlock this feature." - }))) - .expect(1), - ) - .await; - - let address = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_TOKEN".into(), - "mydomain.com".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap(); - assert_eq!(address, "wertg8ad@mydomain.com"); - - let invalid_token_error = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_FAKE_TOKEN".into(), - "mydomain.com".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap_err(); - - assert_eq!( - invalid_token_error.to_string(), - UsernameError::InvalidApiKey.to_string() - ); - - let free_token_error = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_FREE_TOKEN".into(), - "mydomain.com".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap_err(); - - assert!(free_token_error - .to_string() - .contains("Please upgrade to a paid plan")); - - server.verify().await; - } -} diff --git a/crates/bitwarden-generators/src/username_forwarders/mod.rs b/crates/bitwarden-generators/src/username_forwarders/mod.rs deleted file mode 100644 index 8d445bc04..000000000 --- a/crates/bitwarden-generators/src/username_forwarders/mod.rs +++ /dev/null @@ -1,22 +0,0 @@ -pub(super) mod addyio; -pub(super) mod duckduckgo; -pub(super) mod fastmail; -pub(super) mod firefox; -pub(super) mod forwardemail; -pub(super) mod simplelogin; - -fn format_description(website: &Option) -> String { - let description = website - .as_ref() - .map(|w| format!("Website: {w}. ")) - .unwrap_or_default(); - format!("{description}Generated by Bitwarden.") -} - -fn format_description_ff(website: &Option) -> String { - let description = website - .as_ref() - .map(|w| format!("{w} - ")) - .unwrap_or_default(); - format!("{description}Generated by Bitwarden.") -} diff --git a/crates/bitwarden-generators/src/username_forwarders/simplelogin.rs b/crates/bitwarden-generators/src/username_forwarders/simplelogin.rs deleted file mode 100644 index fa9342267..000000000 --- a/crates/bitwarden-generators/src/username_forwarders/simplelogin.rs +++ /dev/null @@ -1,125 +0,0 @@ -use reqwest::{header::CONTENT_TYPE, StatusCode}; - -use crate::username::UsernameError; - -pub async fn generate( - http: &reqwest::Client, - api_key: String, - website: Option, -) -> Result { - generate_with_api_url(http, api_key, website, "https://app.simplelogin.io".into()).await -} - -async fn generate_with_api_url( - http: &reqwest::Client, - api_key: String, - website: Option, - api_url: String, -) -> Result { - let query = website - .as_ref() - .map(|w| format!("?hostname={}", w)) - .unwrap_or_default(); - - let note = super::format_description(&website); - - #[derive(serde::Serialize)] - struct Request { - note: String, - } - - let response = http - .post(format!("{api_url}/api/alias/random/new{query}")) - .header(CONTENT_TYPE, "application/json") - .header("Authentication", api_key) - .json(&Request { note }) - .send() - .await?; - - if response.status() == StatusCode::UNAUTHORIZED { - return Err(UsernameError::InvalidApiKey); - } - - // Throw any other errors - response.error_for_status_ref()?; - - #[derive(serde::Deserialize)] - struct Response { - alias: String, - } - let response: Response = response.json().await?; - - Ok(response.alias) -} - -#[cfg(test)] -mod tests { - use serde_json::json; - - use crate::username::UsernameError; - #[tokio::test] - async fn test_mock_server() { - use wiremock::{matchers, Mock, ResponseTemplate}; - - let server = wiremock::MockServer::start().await; - - // Mock the request to the SimpleLogin API, and verify that the correct request is made - server - .register( - Mock::given(matchers::path("/api/alias/random/new")) - .and(matchers::method("POST")) - .and(matchers::query_param("hostname", "example.com")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authentication", "MY_TOKEN")) - .and(matchers::body_json(json!({ - "note": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(201).set_body_json(json!({ - "alias": "simplelogin.yut3g8@aleeas.com", - }))) - .expect(1), - ) - .await; - // Mock an invalid token request - server - .register( - Mock::given(matchers::path("/api/alias/random/new")) - .and(matchers::method("POST")) - .and(matchers::query_param("hostname", "example.com")) - .and(matchers::header("Content-Type", "application/json")) - .and(matchers::header("Authentication", "MY_FAKE_TOKEN")) - .and(matchers::body_json(json!({ - "note": "Website: example.com. Generated by Bitwarden." - }))) - .respond_with(ResponseTemplate::new(401)) - .expect(1), - ) - .await; - - let address = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_TOKEN".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap(); - assert_eq!(address, "simplelogin.yut3g8@aleeas.com"); - - let fake_token_error = super::generate_with_api_url( - &reqwest::Client::new(), - "MY_FAKE_TOKEN".into(), - Some("example.com".into()), - format!("http://{}", server.address()), - ) - .await - .unwrap_err(); - - assert_eq!( - fake_token_error.to_string(), - UsernameError::InvalidApiKey.to_string() - ); - - server.verify().await; - } -} diff --git a/crates/bitwarden-generators/src/util.rs b/crates/bitwarden-generators/src/util.rs deleted file mode 100644 index e434500ea..000000000 --- a/crates/bitwarden-generators/src/util.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub(crate) fn capitalize_first_letter(s: &str) -> String { - // Unicode case conversion can change the length of the string, so we can't capitalize in place. - // Instead we extract the first character and convert it to uppercase. This returns - // an iterator which we collect into a string, and then append the rest of the input. - let mut c = s.chars(); - match c.next() { - None => String::new(), - Some(f) => f.to_uppercase().collect::() + c.as_str(), - } -} diff --git a/crates/bitwarden-generators/uniffi.toml b/crates/bitwarden-generators/uniffi.toml deleted file mode 100644 index 75f929b1a..000000000 --- a/crates/bitwarden-generators/uniffi.toml +++ /dev/null @@ -1,9 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.generators" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenGeneratorsFFI" -module_name = "BitwardenGenerators" -generate_immutable_records = true diff --git a/crates/bitwarden-json/Cargo.toml b/crates/bitwarden-json/Cargo.toml index b5b8052b0..20d10652a 100644 --- a/crates/bitwarden-json/Cargo.toml +++ b/crates/bitwarden-json/Cargo.toml @@ -22,8 +22,8 @@ secrets = ["bitwarden/secrets"] # Secrets manager API bitwarden = { workspace = true } log = ">=0.4.18, <0.5" schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } +serde = { version = ">=1.0, <2.0", features = ["derive"] } +serde_json = ">=1.0.96, <2.0" [lints] workspace = true diff --git a/crates/bitwarden-send/Cargo.toml b/crates/bitwarden-send/Cargo.toml deleted file mode 100644 index 33c0b76c6..000000000 --- a/crates/bitwarden-send/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "bitwarden-send" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[features] -uniffi = [ - "bitwarden-core/uniffi", - "bitwarden-crypto/uniffi", - "dep:uniffi", -] # Uniffi bindings - -[dependencies] -base64 = ">=0.22.1, <0.23" -bitwarden-api-api = { workspace = true } -bitwarden-core = { workspace = true } -bitwarden-crypto = { workspace = true } -chrono = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde_repr = { workspace = true } -thiserror = { workspace = true } -uniffi = { workspace = true, optional = true } -uuid = { workspace = true } -zeroize = { version = ">=1.7.0, <2.0" } - -[lints] -workspace = true diff --git a/crates/bitwarden-send/README.md b/crates/bitwarden-send/README.md deleted file mode 100644 index 85da845b4..000000000 --- a/crates/bitwarden-send/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Send - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-send/src/client_sends.rs b/crates/bitwarden-send/src/client_sends.rs deleted file mode 100644 index bf496e013..000000000 --- a/crates/bitwarden-send/src/client_sends.rs +++ /dev/null @@ -1,95 +0,0 @@ -use std::path::Path; - -use bitwarden_core::{Client, Error}; -use bitwarden_crypto::{EncString, KeyDecryptable, KeyEncryptable}; - -use crate::{Send, SendListView, SendView}; - -pub struct ClientSends<'a> { - client: &'a Client, -} - -impl<'a> ClientSends<'a> { - fn new(client: &'a Client) -> Self { - Self { client } - } - - pub fn decrypt(&self, send: Send) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let send_view = send.decrypt_with_key(key)?; - - Ok(send_view) - } - - pub fn decrypt_list(&self, sends: Vec) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let send_views = sends.decrypt_with_key(key)?; - - Ok(send_views) - } - - pub fn decrypt_file( - &self, - send: Send, - encrypted_file_path: &Path, - decrypted_file_path: &Path, - ) -> Result<(), Error> { - let data = std::fs::read(encrypted_file_path)?; - let decrypted = self.decrypt_buffer(send, &data)?; - std::fs::write(decrypted_file_path, decrypted)?; - Ok(()) - } - - pub fn decrypt_buffer(&self, send: Send, encrypted_buffer: &[u8]) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - let key = Send::get_key(&send.key, key)?; - - let buf = EncString::from_buffer(encrypted_buffer)?; - Ok(buf.decrypt_with_key(&key)?) - } - - pub fn encrypt(&self, send_view: SendView) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let send = send_view.encrypt_with_key(key)?; - - Ok(send) - } - - pub fn encrypt_file( - &self, - send: Send, - decrypted_file_path: &Path, - encrypted_file_path: &Path, - ) -> Result<(), Error> { - let data = std::fs::read(decrypted_file_path)?; - let encrypted = self.encrypt_buffer(send, &data)?; - std::fs::write(encrypted_file_path, encrypted)?; - Ok(()) - } - - pub fn encrypt_buffer(&self, send: Send, buffer: &[u8]) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - let key = Send::get_key(&send.key, key)?; - - let encrypted = buffer.encrypt_with_key(&key)?; - Ok(encrypted.to_buffer()?) - } -} - -pub trait ClientSendsExt<'a> { - fn sends(&'a self) -> ClientSends<'a>; -} - -impl<'a> ClientSendsExt<'a> for Client { - fn sends(&'a self) -> ClientSends<'a> { - ClientSends::new(self) - } -} diff --git a/crates/bitwarden-send/src/error.rs b/crates/bitwarden-send/src/error.rs deleted file mode 100644 index 9d220d9cd..000000000 --- a/crates/bitwarden-send/src/error.rs +++ /dev/null @@ -1,11 +0,0 @@ -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum SendParseError { - #[error(transparent)] - Chrono(#[from] chrono::ParseError), - #[error(transparent)] - Crypto(#[from] bitwarden_crypto::CryptoError), - #[error(transparent)] - MissingFieldError(#[from] bitwarden_core::MissingFieldError), -} diff --git a/crates/bitwarden-send/src/lib.rs b/crates/bitwarden-send/src/lib.rs deleted file mode 100644 index e29d7305f..000000000 --- a/crates/bitwarden-send/src/lib.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); -#[cfg(feature = "uniffi")] -mod uniffi_support; - -mod error; -pub use error::SendParseError; -mod client_sends; -pub use client_sends::{ClientSends, ClientSendsExt}; -mod send; -pub use send::{Send, SendListView, SendView}; diff --git a/crates/bitwarden-send/src/send.rs b/crates/bitwarden-send/src/send.rs deleted file mode 100644 index 3222ec1cf..000000000 --- a/crates/bitwarden-send/src/send.rs +++ /dev/null @@ -1,606 +0,0 @@ -use base64::{ - engine::general_purpose::{STANDARD, URL_SAFE_NO_PAD}, - Engine, -}; -use bitwarden_api_api::models::{SendFileModel, SendResponseModel, SendTextModel}; -use bitwarden_core::require; -use bitwarden_crypto::{ - derive_shareable_key, generate_random_bytes, CryptoError, EncString, KeyDecryptable, - KeyEncryptable, SymmetricCryptoKey, -}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; -use uuid::Uuid; -use zeroize::Zeroizing; - -use crate::SendParseError; - -const SEND_ITERATIONS: u32 = 100_000; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SendFile { - pub id: Option, - pub file_name: EncString, - pub size: Option, - /// Readable size, ex: "4.2 KB" or "1.43 GB" - pub size_name: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, PartialEq, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SendFileView { - pub id: Option, - pub file_name: String, - pub size: Option, - /// Readable size, ex: "4.2 KB" or "1.43 GB" - pub size_name: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SendText { - pub text: Option, - pub hidden: bool, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, PartialEq, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SendTextView { - pub text: Option, - pub hidden: bool, -} - -#[derive(Clone, Copy, Serialize_repr, Deserialize_repr, Debug, JsonSchema, PartialEq)] -#[repr(u8)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum SendType { - Text = 0, - File = 1, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Send { - pub id: Option, - pub access_id: Option, - - pub name: EncString, - pub notes: Option, - pub key: EncString, - pub password: Option, - - pub r#type: SendType, - pub file: Option, - pub text: Option, - - pub max_access_count: Option, - pub access_count: u32, - pub disabled: bool, - pub hide_email: bool, - - pub revision_date: DateTime, - pub deletion_date: DateTime, - pub expiration_date: Option>, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, PartialEq, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SendView { - pub id: Option, - pub access_id: Option, - - pub name: String, - pub notes: Option, - /// Base64 encoded key - pub key: Option, - /// Replace or add a password to an existing send. The SDK will always return None when - /// decrypting a [Send] - /// TODO: We should revisit this, one variant is to have `[Create, Update]SendView` DTOs. - pub new_password: Option, - /// Denote if an existing send has a password. The SDK will ignore this value when creating or - /// updating sends. - pub has_password: bool, - - pub r#type: SendType, - pub file: Option, - pub text: Option, - - pub max_access_count: Option, - pub access_count: u32, - pub disabled: bool, - pub hide_email: bool, - - pub revision_date: DateTime, - pub deletion_date: DateTime, - pub expiration_date: Option>, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SendListView { - pub id: Option, - pub access_id: Option, - - pub name: String, - - pub r#type: SendType, - pub disabled: bool, - - pub revision_date: DateTime, - pub deletion_date: DateTime, - pub expiration_date: Option>, -} - -impl Send { - pub fn get_key( - send_key: &EncString, - enc_key: &SymmetricCryptoKey, - ) -> Result { - let key: Vec = send_key.decrypt_with_key(enc_key)?; - Self::derive_shareable_key(&key) - } - - fn derive_shareable_key(key: &[u8]) -> Result { - let key = Zeroizing::new(key.try_into().map_err(|_| CryptoError::InvalidKeyLen)?); - Ok(derive_shareable_key(key, "send", Some("send"))) - } -} - -impl KeyDecryptable for SendText { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(SendTextView { - text: self.text.decrypt_with_key(key)?, - hidden: self.hidden, - }) - } -} - -impl KeyEncryptable for SendTextView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(SendText { - text: self.text.encrypt_with_key(key)?, - hidden: self.hidden, - }) - } -} - -impl KeyDecryptable for SendFile { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(SendFileView { - id: self.id.clone(), - file_name: self.file_name.decrypt_with_key(key)?, - size: self.size.clone(), - size_name: self.size_name.clone(), - }) - } -} - -impl KeyEncryptable for SendFileView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(SendFile { - id: self.id.clone(), - file_name: self.file_name.encrypt_with_key(key)?, - size: self.size.clone(), - size_name: self.size_name.clone(), - }) - } -} - -impl KeyDecryptable for Send { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - // For sends, we first decrypt the send key with the user key, and stretch it to it's full - // size For the rest of the fields, we ignore the provided SymmetricCryptoKey and - // the stretched key - let k: Vec = self.key.decrypt_with_key(key)?; - let key = Send::derive_shareable_key(&k)?; - - Ok(SendView { - id: self.id, - access_id: self.access_id.clone(), - - name: self.name.decrypt_with_key(&key).ok().unwrap_or_default(), - notes: self.notes.decrypt_with_key(&key).ok().flatten(), - key: Some(URL_SAFE_NO_PAD.encode(k)), - new_password: None, - has_password: self.password.is_some(), - - r#type: self.r#type, - file: self.file.decrypt_with_key(&key).ok().flatten(), - text: self.text.decrypt_with_key(&key).ok().flatten(), - - max_access_count: self.max_access_count, - access_count: self.access_count, - disabled: self.disabled, - hide_email: self.hide_email, - - revision_date: self.revision_date, - deletion_date: self.deletion_date, - expiration_date: self.expiration_date, - }) - } -} - -impl KeyDecryptable for Send { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - // For sends, we first decrypt the send key with the user key, and stretch it to it's full - // size For the rest of the fields, we ignore the provided SymmetricCryptoKey and - // the stretched key - let key = Send::get_key(&self.key, key)?; - - Ok(SendListView { - id: self.id, - access_id: self.access_id.clone(), - - name: self.name.decrypt_with_key(&key)?, - r#type: self.r#type, - - disabled: self.disabled, - - revision_date: self.revision_date, - deletion_date: self.deletion_date, - expiration_date: self.expiration_date, - }) - } -} - -impl KeyEncryptable for SendView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - // For sends, we first decrypt the send key with the user key, and stretch it to it's full - // size For the rest of the fields, we ignore the provided SymmetricCryptoKey and - // the stretched key - let k = match (self.key, self.id) { - // Existing send, decrypt key - (Some(k), _) => URL_SAFE_NO_PAD - .decode(k) - .map_err(|_| CryptoError::InvalidKey)?, - // New send, generate random key - (None, None) => { - let key = generate_random_bytes::<[u8; 16]>(); - key.to_vec() - } - // Existing send without key - _ => return Err(CryptoError::InvalidKey), - }; - let send_key = Send::derive_shareable_key(&k)?; - - Ok(Send { - id: self.id, - access_id: self.access_id, - - name: self.name.encrypt_with_key(&send_key)?, - notes: self.notes.encrypt_with_key(&send_key)?, - key: k.encrypt_with_key(key)?, - password: self.new_password.map(|password| { - let password = bitwarden_crypto::pbkdf2(password.as_bytes(), &k, SEND_ITERATIONS); - STANDARD.encode(password) - }), - - r#type: self.r#type, - file: self.file.encrypt_with_key(&send_key)?, - text: self.text.encrypt_with_key(&send_key)?, - - max_access_count: self.max_access_count, - access_count: self.access_count, - disabled: self.disabled, - hide_email: self.hide_email, - - revision_date: self.revision_date, - deletion_date: self.deletion_date, - expiration_date: self.expiration_date, - }) - } -} - -impl TryFrom for Send { - type Error = SendParseError; - - fn try_from(send: SendResponseModel) -> Result { - Ok(Send { - id: send.id, - access_id: send.access_id, - name: require!(send.name).parse()?, - notes: EncString::try_from_optional(send.notes)?, - key: require!(send.key).parse()?, - password: send.password, - r#type: require!(send.r#type).into(), - file: send.file.map(|f| (*f).try_into()).transpose()?, - text: send.text.map(|t| (*t).try_into()).transpose()?, - max_access_count: send.max_access_count.map(|s| s as u32), - access_count: require!(send.access_count) as u32, - disabled: send.disabled.unwrap_or(false), - hide_email: send.hide_email.unwrap_or(false), - revision_date: require!(send.revision_date).parse()?, - deletion_date: require!(send.deletion_date).parse()?, - expiration_date: send.expiration_date.map(|s| s.parse()).transpose()?, - }) - } -} - -impl From for SendType { - fn from(t: bitwarden_api_api::models::SendType) -> Self { - match t { - bitwarden_api_api::models::SendType::Text => SendType::Text, - bitwarden_api_api::models::SendType::File => SendType::File, - } - } -} - -impl TryFrom for SendFile { - type Error = SendParseError; - - fn try_from(file: SendFileModel) -> Result { - Ok(SendFile { - id: file.id, - file_name: require!(file.file_name).parse()?, - size: file.size.map(|v| v.to_string()), - size_name: file.size_name, - }) - } -} - -impl TryFrom for SendText { - type Error = SendParseError; - - fn try_from(text: SendTextModel) -> Result { - Ok(SendText { - text: EncString::try_from_optional(text.text)?, - hidden: text.hidden.unwrap_or(false), - }) - } -} - -#[cfg(test)] -mod tests { - use std::collections::HashMap; - - use bitwarden_crypto::{Kdf, KeyContainer, KeyDecryptable, KeyEncryptable, MasterKey}; - - use super::*; - - struct MockKeyContainer(HashMap, SymmetricCryptoKey>); - impl MockKeyContainer { - fn new(master_key: MasterKey, user_key: EncString) -> Result { - let user_key = master_key.decrypt_user_key(user_key)?; - Ok(Self(HashMap::from([(None, user_key)]))) - } - } - impl KeyContainer for MockKeyContainer { - fn get_key<'a>( - &'a self, - org_id: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - self.0 - .get(org_id) - .ok_or(CryptoError::MissingKey(org_id.unwrap_or_default())) - } - } - - #[test] - fn test_get_send_key() { - // Initialize user encryption with some test data - let master_key = MasterKey::derive( - "asdfasdfasdf", - "test@bitwarden.com", - &Kdf::PBKDF2 { - iterations: 345123.try_into().unwrap(), - }, - ) - .unwrap(); - let enc = MockKeyContainer::new( - master_key, - "2.majkL1/hNz9yptLqNAUSnw==|RiOzMTTJMG948qu8O3Zm1EQUO2E8BuTwFKnO9LWQjMzxMWJM5GbyOq2/A+tumPbTERt4JWur/FKfgHb+gXuYiEYlXPMuVBvT7nv4LPytJuM=|IVqMxHJeR1ZXY0sGngTC0x+WqbG8p6V+BTrdgBbQXjM=".parse().unwrap(), - ).unwrap(); - - let k = enc.get_key(&None).unwrap(); - - let send_key = "2.+1KUfOX8A83Xkwk1bumo/w==|Nczvv+DTkeP466cP/wMDnGK6W9zEIg5iHLhcuQG6s+M=|SZGsfuIAIaGZ7/kzygaVUau3LeOvJUlolENBOU+LX7g=" - .parse() - .unwrap(); - - // Get the send key - let send_key = Send::get_key(&send_key, k).unwrap(); - let send_key_b64 = send_key.to_base64(); - assert_eq!(send_key_b64, "IR9ImHGm6rRuIjiN7csj94bcZR5WYTJj5GtNfx33zm6tJCHUl+QZlpNPba8g2yn70KnOHsAODLcR0um6E3MAlg=="); - } - - fn build_encryption_settings() -> MockKeyContainer { - let master_key = MasterKey::derive( - "asdfasdfasdf", - "test@bitwarden.com", - &Kdf::PBKDF2 { - iterations: 600_000.try_into().unwrap(), - }, - ) - .unwrap(); - - MockKeyContainer::new( - master_key, - "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".parse().unwrap(), - ).unwrap() - } - - #[test] - pub fn test_decrypt() { - let enc = build_encryption_settings(); - let key = enc.get_key(&None).unwrap(); - - let send = Send { - id: "3d80dd72-2d14-4f26-812c-b0f0018aa144".parse().ok(), - access_id: Some("ct2APRQtJk-BLLDwAYqhRA".to_owned()), - r#type: SendType::Text, - name: "2.STIyTrfDZN/JXNDN9zNEMw==|NDLum8BHZpPNYhJo9ggSkg==|UCsCLlBO3QzdPwvMAWs2VVwuE6xwOx/vxOooPObqnEw=".parse() - .unwrap(), - notes: None, - file: None, - text: Some(SendText { - text: "2.2VPyLzk1tMLug0X3x7RkaQ==|mrMt9vbZsCJhJIj4eebKyg==|aZ7JeyndytEMR1+uEBupEvaZuUE69D/ejhfdJL8oKq0=".parse().ok(), - hidden: false, - }), - key: "2.KLv/j0V4Ebs0dwyPdtt4vw==|jcrFuNYN1Qb3onBlwvtxUV/KpdnR1LPRL4EsCoXNAt4=|gHSywGy4Rj/RsCIZFwze4s2AACYKBtqDXTrQXjkgtIE=".parse().unwrap(), - max_access_count: None, - access_count: 0, - password: None, - disabled: false, - revision_date: "2024-01-07T23:56:48.207363Z".parse().unwrap(), - expiration_date: None, - deletion_date: "2024-01-14T23:56:48Z".parse().unwrap(), - hide_email: false, - }; - - let view: SendView = send.decrypt_with_key(key).unwrap(); - - let expected = SendView { - id: "3d80dd72-2d14-4f26-812c-b0f0018aa144".parse().ok(), - access_id: Some("ct2APRQtJk-BLLDwAYqhRA".to_owned()), - name: "Test".to_string(), - notes: None, - key: Some("Pgui0FK85cNhBGWHAlBHBw".to_owned()), - new_password: None, - has_password: false, - r#type: SendType::Text, - file: None, - text: Some(SendTextView { - text: Some("This is a test".to_owned()), - hidden: false, - }), - max_access_count: None, - access_count: 0, - disabled: false, - hide_email: false, - revision_date: "2024-01-07T23:56:48.207363Z".parse().unwrap(), - deletion_date: "2024-01-14T23:56:48Z".parse().unwrap(), - expiration_date: None, - }; - - assert_eq!(view, expected); - } - - #[test] - pub fn test_encrypt() { - let enc = build_encryption_settings(); - let key = enc.get_key(&None).unwrap(); - - let view = SendView { - id: "3d80dd72-2d14-4f26-812c-b0f0018aa144".parse().ok(), - access_id: Some("ct2APRQtJk-BLLDwAYqhRA".to_owned()), - name: "Test".to_string(), - notes: None, - key: Some("Pgui0FK85cNhBGWHAlBHBw".to_owned()), - new_password: None, - has_password: false, - r#type: SendType::Text, - file: None, - text: Some(SendTextView { - text: Some("This is a test".to_owned()), - hidden: false, - }), - max_access_count: None, - access_count: 0, - disabled: false, - hide_email: false, - revision_date: "2024-01-07T23:56:48.207363Z".parse().unwrap(), - deletion_date: "2024-01-14T23:56:48Z".parse().unwrap(), - expiration_date: None, - }; - - // Re-encrypt and decrypt again to ensure encrypt works - let v: SendView = view - .clone() - .encrypt_with_key(key) - .unwrap() - .decrypt_with_key(key) - .unwrap(); - assert_eq!(v, view); - } - - #[test] - pub fn test_create() { - let enc = build_encryption_settings(); - let key = enc.get_key(&None).unwrap(); - - let view = SendView { - id: None, - access_id: Some("ct2APRQtJk-BLLDwAYqhRA".to_owned()), - name: "Test".to_string(), - notes: None, - key: None, - new_password: None, - has_password: false, - r#type: SendType::Text, - file: None, - text: Some(SendTextView { - text: Some("This is a test".to_owned()), - hidden: false, - }), - max_access_count: None, - access_count: 0, - disabled: false, - hide_email: false, - revision_date: "2024-01-07T23:56:48.207363Z".parse().unwrap(), - deletion_date: "2024-01-14T23:56:48Z".parse().unwrap(), - expiration_date: None, - }; - - // Re-encrypt and decrypt again to ensure encrypt works - let v: SendView = view - .clone() - .encrypt_with_key(key) - .unwrap() - .decrypt_with_key(key) - .unwrap(); - - // Ignore key when comparing - let t = SendView { key: None, ..v }; - assert_eq!(t, view); - } - - #[test] - pub fn test_create_password() { - let enc = build_encryption_settings(); - let key = enc.get_key(&None).unwrap(); - - let view = SendView { - id: None, - access_id: Some("ct2APRQtJk-BLLDwAYqhRA".to_owned()), - name: "Test".to_owned(), - notes: None, - key: Some("Pgui0FK85cNhBGWHAlBHBw".to_owned()), - new_password: Some("abc123".to_owned()), - has_password: false, - r#type: SendType::Text, - file: None, - text: Some(SendTextView { - text: Some("This is a test".to_owned()), - hidden: false, - }), - max_access_count: None, - access_count: 0, - disabled: false, - hide_email: false, - revision_date: "2024-01-07T23:56:48.207363Z".parse().unwrap(), - deletion_date: "2024-01-14T23:56:48Z".parse().unwrap(), - expiration_date: None, - }; - - let send: Send = view.encrypt_with_key(key).unwrap(); - - assert_eq!( - send.password, - Some("vTIDfdj3FTDbejmMf+mJWpYdMXsxfeSd1Sma3sjCtiQ=".to_owned()) - ); - - let v: SendView = send.decrypt_with_key(key).unwrap(); - assert_eq!(v.new_password, None); - assert!(v.has_password); - } -} diff --git a/crates/bitwarden-send/src/uniffi_support.rs b/crates/bitwarden-send/src/uniffi_support.rs deleted file mode 100644 index 932f0de7a..000000000 --- a/crates/bitwarden-send/src/uniffi_support.rs +++ /dev/null @@ -1,8 +0,0 @@ -use bitwarden_crypto::EncString; -use uuid::Uuid; - -uniffi::ffi_converter_forward!(EncString, bitwarden_crypto::UniFfiTag, crate::UniFfiTag); - -type DateTime = chrono::DateTime; -uniffi::ffi_converter_forward!(DateTime, bitwarden_core::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!(Uuid, bitwarden_core::UniFfiTag, crate::UniFfiTag); diff --git a/crates/bitwarden-send/uniffi.toml b/crates/bitwarden-send/uniffi.toml deleted file mode 100644 index 674ea3684..000000000 --- a/crates/bitwarden-send/uniffi.toml +++ /dev/null @@ -1,9 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.send" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenSendFFI" -module_name = "BitwardenSend" -generate_immutable_records = true diff --git a/crates/bitwarden-sm/Cargo.toml b/crates/bitwarden-sm/Cargo.toml deleted file mode 100644 index 77fa9d7c1..000000000 --- a/crates/bitwarden-sm/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "bitwarden-sm" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[dependencies] -bitwarden-api-api = { workspace = true } -bitwarden-core = { workspace = true } -bitwarden-crypto = { workspace = true } -chrono = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } -uuid = { workspace = true } -validator = { workspace = true } - -[dev-dependencies] -tokio = { workspace = true, features = ["rt"] } - -[lints] -workspace = true diff --git a/crates/bitwarden-sm/src/client_projects.rs b/crates/bitwarden-sm/src/client_projects.rs deleted file mode 100644 index 13b2c6967..000000000 --- a/crates/bitwarden-sm/src/client_projects.rs +++ /dev/null @@ -1,50 +0,0 @@ -use bitwarden_core::{Client, Error}; - -use crate::projects::{ - create_project, delete_projects, get_project, list_projects, update_project, - ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectResponse, - ProjectsDeleteRequest, ProjectsDeleteResponse, ProjectsListRequest, ProjectsResponse, -}; - -pub struct ClientProjects<'a> { - pub client: &'a Client, -} - -impl<'a> ClientProjects<'a> { - pub fn new(client: &'a Client) -> Self { - Self { client } - } - - pub async fn get(&self, input: &ProjectGetRequest) -> Result { - get_project(self.client, input).await - } - - pub async fn create(&self, input: &ProjectCreateRequest) -> Result { - create_project(self.client, input).await - } - - pub async fn list(&self, input: &ProjectsListRequest) -> Result { - list_projects(self.client, input).await - } - - pub async fn update(&self, input: &ProjectPutRequest) -> Result { - update_project(self.client, input).await - } - - pub async fn delete( - &self, - input: ProjectsDeleteRequest, - ) -> Result { - delete_projects(self.client, input).await - } -} - -pub trait ClientProjectsExt<'a> { - fn projects(&'a self) -> ClientProjects<'a>; -} - -impl<'a> ClientProjectsExt<'a> for Client { - fn projects(&'a self) -> ClientProjects<'a> { - ClientProjects::new(self) - } -} diff --git a/crates/bitwarden-sm/src/client_secrets.rs b/crates/bitwarden-sm/src/client_secrets.rs deleted file mode 100644 index 2b1085a0a..000000000 --- a/crates/bitwarden-sm/src/client_secrets.rs +++ /dev/null @@ -1,70 +0,0 @@ -use bitwarden_core::{Client, Error}; - -use crate::secrets::{ - create_secret, delete_secrets, get_secret, get_secrets_by_ids, list_secrets, - list_secrets_by_project, sync_secrets, update_secret, SecretCreateRequest, SecretGetRequest, - SecretIdentifiersByProjectRequest, SecretIdentifiersRequest, SecretIdentifiersResponse, - SecretPutRequest, SecretResponse, SecretsDeleteRequest, SecretsDeleteResponse, - SecretsGetRequest, SecretsResponse, SecretsSyncRequest, SecretsSyncResponse, -}; - -pub struct ClientSecrets<'a> { - client: &'a Client, -} - -impl<'a> ClientSecrets<'a> { - pub fn new(client: &'a Client) -> Self { - Self { client } - } - - pub async fn get(&self, input: &SecretGetRequest) -> Result { - get_secret(self.client, input).await - } - - pub async fn get_by_ids(&self, input: SecretsGetRequest) -> Result { - get_secrets_by_ids(self.client, input).await - } - - pub async fn create(&self, input: &SecretCreateRequest) -> Result { - create_secret(self.client, input).await - } - - pub async fn list( - &self, - input: &SecretIdentifiersRequest, - ) -> Result { - list_secrets(self.client, input).await - } - - pub async fn list_by_project( - &self, - input: &SecretIdentifiersByProjectRequest, - ) -> Result { - list_secrets_by_project(self.client, input).await - } - - pub async fn update(&self, input: &SecretPutRequest) -> Result { - update_secret(self.client, input).await - } - - pub async fn delete( - &self, - input: SecretsDeleteRequest, - ) -> Result { - delete_secrets(self.client, input).await - } - - pub async fn sync(&self, input: &SecretsSyncRequest) -> Result { - sync_secrets(self.client, input).await - } -} - -pub trait ClientSecretsExt<'a> { - fn secrets(&'a self) -> ClientSecrets<'a>; -} - -impl<'a> ClientSecretsExt<'a> for Client { - fn secrets(&'a self) -> ClientSecrets<'a> { - ClientSecrets::new(self) - } -} diff --git a/crates/bitwarden-sm/src/lib.rs b/crates/bitwarden-sm/src/lib.rs deleted file mode 100644 index 6f44bd16d..000000000 --- a/crates/bitwarden-sm/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod client_projects; -mod client_secrets; -pub mod projects; -pub mod secrets; - -pub use client_projects::{ClientProjects, ClientProjectsExt}; -pub use client_secrets::{ClientSecrets, ClientSecretsExt}; diff --git a/crates/bitwarden-sm/src/projects/create.rs b/crates/bitwarden-sm/src/projects/create.rs deleted file mode 100644 index bb377e23c..000000000 --- a/crates/bitwarden-sm/src/projects/create.rs +++ /dev/null @@ -1,116 +0,0 @@ -use bitwarden_api_api::models::ProjectCreateRequestModel; -use bitwarden_core::{validate_only_whitespaces, Client, Error}; -use bitwarden_crypto::KeyEncryptable; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use validator::Validate; - -use super::ProjectResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectCreateRequest { - /// Organization where the project will be created - pub organization_id: Uuid, - #[validate(length(min = 1, max = 500), custom(function = validate_only_whitespaces))] - pub name: String, -} - -pub(crate) async fn create_project( - client: &Client, - input: &ProjectCreateRequest, -) -> Result { - input.validate()?; - - let enc = client.internal.get_encryption_settings()?; - let key = enc.get_key(&Some(input.organization_id))?; - - let project = Some(ProjectCreateRequestModel { - name: input.name.clone().trim().encrypt_with_key(key)?.to_string(), - }); - - let config = client.internal.get_api_configurations().await; - let res = bitwarden_api_api::apis::projects_api::organizations_organization_id_projects_post( - &config.api, - input.organization_id, - project, - ) - .await?; - - ProjectResponse::process_response(res, &enc) -} - -#[cfg(test)] -mod tests { - use super::*; - - async fn create_project(name: String) -> Result { - let input = ProjectCreateRequest { - organization_id: Uuid::new_v4(), - name, - }; - - super::create_project(&Client::new(None), &input).await - } - - #[tokio::test] - async fn test_create_project_request_name_empty_string() { - let response = create_project("".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not be empty" - ); - } - - #[tokio::test] - async fn test_create_project_request_name_all_whitespaces_space() { - let response = create_project(" ".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_project_request_name_all_whitespaces_tab() { - let response = create_project("\t".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_project_request_name_all_whitespaces_newline() { - let response = create_project("\n".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_project_request_name_all_whitespaces_combined() { - let response = create_project(" \t\n".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_project_request_name_501_character_length() { - let response = create_project("a".repeat(501)).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not exceed 500 characters in length" - ); - } -} diff --git a/crates/bitwarden-sm/src/projects/delete.rs b/crates/bitwarden-sm/src/projects/delete.rs deleted file mode 100644 index 27e7f83e7..000000000 --- a/crates/bitwarden-sm/src/projects/delete.rs +++ /dev/null @@ -1,65 +0,0 @@ -use bitwarden_api_api::models::{ - BulkDeleteResponseModel, BulkDeleteResponseModelListResponseModel, -}; -use bitwarden_core::{client::Client, require, Error}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectsDeleteRequest { - /// IDs of the projects to delete - pub ids: Vec, -} - -pub(crate) async fn delete_projects( - client: &Client, - input: ProjectsDeleteRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - let res = - bitwarden_api_api::apis::projects_api::projects_delete_post(&config.api, Some(input.ids)) - .await?; - - ProjectsDeleteResponse::process_response(res) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectsDeleteResponse { - pub data: Vec, -} - -impl ProjectsDeleteResponse { - pub(crate) fn process_response( - response: BulkDeleteResponseModelListResponseModel, - ) -> Result { - Ok(ProjectsDeleteResponse { - data: response - .data - .unwrap_or_default() - .into_iter() - .map(ProjectDeleteResponse::process_response) - .collect::>()?, - }) - } -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectDeleteResponse { - pub id: Uuid, - pub error: Option, -} - -impl ProjectDeleteResponse { - pub(crate) fn process_response( - response: BulkDeleteResponseModel, - ) -> Result { - Ok(ProjectDeleteResponse { - id: require!(response.id), - error: response.error, - }) - } -} diff --git a/crates/bitwarden-sm/src/projects/get.rs b/crates/bitwarden-sm/src/projects/get.rs deleted file mode 100644 index 81a669739..000000000 --- a/crates/bitwarden-sm/src/projects/get.rs +++ /dev/null @@ -1,26 +0,0 @@ -use bitwarden_core::{client::Client, Error}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use super::ProjectResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectGetRequest { - /// ID of the project to retrieve - pub id: Uuid, -} - -pub(crate) async fn get_project( - client: &Client, - input: &ProjectGetRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - - let res = bitwarden_api_api::apis::projects_api::projects_id_get(&config.api, input.id).await?; - - let enc = client.internal.get_encryption_settings()?; - - ProjectResponse::process_response(res, &enc) -} diff --git a/crates/bitwarden-sm/src/projects/list.rs b/crates/bitwarden-sm/src/projects/list.rs deleted file mode 100644 index 334e06007..000000000 --- a/crates/bitwarden-sm/src/projects/list.rs +++ /dev/null @@ -1,55 +0,0 @@ -use bitwarden_api_api::models::ProjectResponseModelListResponseModel; -use bitwarden_core::{ - client::{encryption_settings::EncryptionSettings, Client}, - Error, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use super::ProjectResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectsListRequest { - /// Organization to retrieve all the projects from - pub organization_id: Uuid, -} - -pub(crate) async fn list_projects( - client: &Client, - input: &ProjectsListRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - let res = bitwarden_api_api::apis::projects_api::organizations_organization_id_projects_get( - &config.api, - input.organization_id, - ) - .await?; - - let enc = client.internal.get_encryption_settings()?; - - ProjectsResponse::process_response(res, &enc) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectsResponse { - pub data: Vec, -} - -impl ProjectsResponse { - pub(crate) fn process_response( - response: ProjectResponseModelListResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let data = response.data.unwrap_or_default(); - - Ok(ProjectsResponse { - data: data - .into_iter() - .map(|r| ProjectResponse::process_response(r, enc)) - .collect::>()?, - }) - } -} diff --git a/crates/bitwarden-sm/src/projects/mod.rs b/crates/bitwarden-sm/src/projects/mod.rs deleted file mode 100644 index 20ae5d95b..000000000 --- a/crates/bitwarden-sm/src/projects/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod create; -mod delete; -mod get; -mod list; -mod project_response; -mod update; - -pub(crate) use create::create_project; -pub use create::ProjectCreateRequest; -pub(crate) use delete::delete_projects; -pub use delete::{ProjectsDeleteRequest, ProjectsDeleteResponse}; -pub(crate) use get::get_project; -pub use get::ProjectGetRequest; -pub(crate) use list::list_projects; -pub use list::{ProjectsListRequest, ProjectsResponse}; -pub use project_response::ProjectResponse; -pub(crate) use update::update_project; -pub use update::ProjectPutRequest; diff --git a/crates/bitwarden-sm/src/projects/project_response.rs b/crates/bitwarden-sm/src/projects/project_response.rs deleted file mode 100644 index a70a3fd78..000000000 --- a/crates/bitwarden-sm/src/projects/project_response.rs +++ /dev/null @@ -1,40 +0,0 @@ -use bitwarden_api_api::models::ProjectResponseModel; -use bitwarden_core::{client::encryption_settings::EncryptionSettings, require, Error}; -use bitwarden_crypto::{EncString, KeyDecryptable}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectResponse { - pub id: Uuid, - pub organization_id: Uuid, - pub name: String, - pub creation_date: DateTime, - pub revision_date: DateTime, -} - -impl ProjectResponse { - pub(crate) fn process_response( - response: ProjectResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let organization_id = require!(response.organization_id); - let enc_key = enc.get_key(&Some(organization_id))?; - - let name = require!(response.name) - .parse::()? - .decrypt_with_key(enc_key)?; - - Ok(ProjectResponse { - id: require!(response.id), - organization_id, - name, - - creation_date: require!(response.creation_date).parse()?, - revision_date: require!(response.revision_date).parse()?, - }) - } -} diff --git a/crates/bitwarden-sm/src/projects/update.rs b/crates/bitwarden-sm/src/projects/update.rs deleted file mode 100644 index 359b66945..000000000 --- a/crates/bitwarden-sm/src/projects/update.rs +++ /dev/null @@ -1,116 +0,0 @@ -use bitwarden_api_api::models::ProjectUpdateRequestModel; -use bitwarden_core::{validate_only_whitespaces, Client, Error}; -use bitwarden_crypto::KeyEncryptable; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use validator::Validate; - -use super::ProjectResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectPutRequest { - /// ID of the project to modify - pub id: Uuid, - /// Organization ID of the project to modify - pub organization_id: Uuid, - #[validate(length(min = 1, max = 500), custom(function = validate_only_whitespaces))] - pub name: String, -} - -pub(crate) async fn update_project( - client: &Client, - input: &ProjectPutRequest, -) -> Result { - input.validate()?; - - let enc = client.internal.get_encryption_settings()?; - let key = enc.get_key(&Some(input.organization_id))?; - - let project = Some(ProjectUpdateRequestModel { - name: input.name.clone().trim().encrypt_with_key(key)?.to_string(), - }); - - let config = client.internal.get_api_configurations().await; - let res = - bitwarden_api_api::apis::projects_api::projects_id_put(&config.api, input.id, project) - .await?; - - ProjectResponse::process_response(res, &enc) -} - -#[cfg(test)] -mod tests { - use super::*; - - async fn update_project(name: String) -> Result { - let input = ProjectPutRequest { - id: Uuid::new_v4(), - organization_id: Uuid::new_v4(), - name, - }; - - super::update_project(&Client::new(None), &input).await - } - - #[tokio::test] - async fn test_update_project_request_name_empty_string() { - let response = update_project("".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not be empty" - ); - } - - #[tokio::test] - async fn test_update_project_request_name_all_whitespaces_space() { - let response = update_project(" ".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_project_request_name_all_whitespaces_tab() { - let response = update_project("\t".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_project_request_name_all_whitespaces_newline() { - let response = update_project("\n".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_project_request_name_all_whitespaces_combined() { - let response = update_project(" \t\n".into()).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_project_request_name_501_character_length() { - let response = update_project("a".repeat(501)).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "name must not exceed 500 characters in length" - ); - } -} diff --git a/crates/bitwarden-sm/src/secrets/create.rs b/crates/bitwarden-sm/src/secrets/create.rs deleted file mode 100644 index efd813877..000000000 --- a/crates/bitwarden-sm/src/secrets/create.rs +++ /dev/null @@ -1,202 +0,0 @@ -use bitwarden_api_api::models::SecretCreateRequestModel; -use bitwarden_core::{validate_only_whitespaces, Client, Error}; -use bitwarden_crypto::KeyEncryptable; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use validator::Validate; - -use super::SecretResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretCreateRequest { - /// Organization where the secret will be created - pub organization_id: Uuid, - - #[validate(length(min = 1, max = 500), custom(function = validate_only_whitespaces))] - pub key: String, - #[validate(length(min = 1, max = 25_000))] - pub value: String, - #[validate(length(max = 7_000), custom(function = validate_only_whitespaces))] - pub note: String, - - /// IDs of the projects that this secret will belong to - pub project_ids: Option>, -} - -pub(crate) async fn create_secret( - client: &Client, - input: &SecretCreateRequest, -) -> Result { - input.validate()?; - - let enc = client.internal.get_encryption_settings()?; - let key = enc.get_key(&Some(input.organization_id))?; - - let secret = Some(SecretCreateRequestModel { - key: input.key.clone().trim().encrypt_with_key(key)?.to_string(), - value: input.value.clone().encrypt_with_key(key)?.to_string(), - note: input.note.clone().trim().encrypt_with_key(key)?.to_string(), - project_ids: input.project_ids.clone(), - access_policies_requests: None, - }); - - let config = client.internal.get_api_configurations().await; - let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_post( - &config.api, - input.organization_id, - secret, - ) - .await?; - - SecretResponse::process_response(res, &enc) -} - -#[cfg(test)] -mod tests { - use super::*; - - async fn create_secret( - key: Option, - value: Option, - note: Option, - ) -> Result { - let input = SecretCreateRequest { - organization_id: Uuid::new_v4(), - key: key.unwrap_or_else(|| "test key".into()), - value: value.unwrap_or_else(|| "test value".into()), - note: note.unwrap_or_else(|| "test note".into()), - project_ids: Some(vec![Uuid::new_v4()]), - }; - - super::create_secret(&Client::new(None), &input).await - } - - #[tokio::test] - async fn test_create_secret_request_key_empty_string() { - let response = create_secret(Some("".into()), None, None).await; - assert!(response.is_err()); - assert_eq!(response.err().unwrap().to_string(), "key must not be empty"); - } - - #[tokio::test] - async fn test_create_secret_request_key_all_whitespaces_space() { - let response = create_secret(Some(" ".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_key_all_whitespaces_tab() { - let response = create_secret(Some("\t".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_key_all_whitespaces_newline() { - let response = create_secret(Some("\n".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_key_all_whitespaces_combined() { - let response = create_secret(Some(" \t\n".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_key_501_character_length() { - let response = create_secret(Some("a".repeat(501)), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not exceed 500 characters in length" - ); - } - - #[tokio::test] - async fn test_create_secret_request_value_empty_string() { - let response = create_secret(None, Some("".into()), None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "value must not be empty" - ); - } - - #[tokio::test] - async fn test_create_secret_request_value_25001_character_length() { - let response = create_secret(None, Some("a".repeat(25001)), None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "value must not exceed 25000 characters in length" - ); - } - - #[tokio::test] - async fn test_create_secret_request_note_all_whitespaces_space() { - let response = create_secret(None, None, Some(" ".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_note_all_whitespaces_tab() { - let response = create_secret(None, None, Some("\t".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_note_all_whitespaces_newline() { - let response = create_secret(None, None, Some("\n".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_note_all_whitespaces_combined() { - let response = create_secret(None, None, Some(" \t\n".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_create_secret_request_note_7001_character_length() { - let response = create_secret(None, None, Some("a".repeat(7001))).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not exceed 7000 characters in length" - ); - } -} diff --git a/crates/bitwarden-sm/src/secrets/delete.rs b/crates/bitwarden-sm/src/secrets/delete.rs deleted file mode 100644 index 377d19f62..000000000 --- a/crates/bitwarden-sm/src/secrets/delete.rs +++ /dev/null @@ -1,65 +0,0 @@ -use bitwarden_api_api::models::{ - BulkDeleteResponseModel, BulkDeleteResponseModelListResponseModel, -}; -use bitwarden_core::{client::Client, require, Error}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretsDeleteRequest { - /// IDs of the secrets to delete - pub ids: Vec, -} - -pub(crate) async fn delete_secrets( - client: &Client, - input: SecretsDeleteRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - let res = - bitwarden_api_api::apis::secrets_api::secrets_delete_post(&config.api, Some(input.ids)) - .await?; - - SecretsDeleteResponse::process_response(res) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretsDeleteResponse { - pub data: Vec, -} - -impl SecretsDeleteResponse { - pub(crate) fn process_response( - response: BulkDeleteResponseModelListResponseModel, - ) -> Result { - Ok(SecretsDeleteResponse { - data: response - .data - .unwrap_or_default() - .into_iter() - .map(SecretDeleteResponse::process_response) - .collect::>()?, - }) - } -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretDeleteResponse { - pub id: Uuid, - pub error: Option, -} - -impl SecretDeleteResponse { - pub(crate) fn process_response( - response: BulkDeleteResponseModel, - ) -> Result { - Ok(SecretDeleteResponse { - id: require!(response.id), - error: response.error, - }) - } -} diff --git a/crates/bitwarden-sm/src/secrets/get.rs b/crates/bitwarden-sm/src/secrets/get.rs deleted file mode 100644 index d0964df2e..000000000 --- a/crates/bitwarden-sm/src/secrets/get.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bitwarden_core::{Client, Error}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use super::SecretResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretGetRequest { - /// ID of the secret to retrieve - pub id: Uuid, -} - -pub(crate) async fn get_secret( - client: &Client, - input: &SecretGetRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - let res = bitwarden_api_api::apis::secrets_api::secrets_id_get(&config.api, input.id).await?; - - let enc = client.internal.get_encryption_settings()?; - - SecretResponse::process_response(res, &enc) -} diff --git a/crates/bitwarden-sm/src/secrets/get_by_ids.rs b/crates/bitwarden-sm/src/secrets/get_by_ids.rs deleted file mode 100644 index b5714c4b7..000000000 --- a/crates/bitwarden-sm/src/secrets/get_by_ids.rs +++ /dev/null @@ -1,30 +0,0 @@ -use bitwarden_api_api::models::GetSecretsRequestModel; -use bitwarden_core::{client::Client, Error}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use super::SecretsResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretsGetRequest { - /// IDs of the secrets to retrieve - pub ids: Vec, -} - -pub(crate) async fn get_secrets_by_ids( - client: &Client, - input: SecretsGetRequest, -) -> Result { - let request = Some(GetSecretsRequestModel { ids: input.ids }); - - let config = client.internal.get_api_configurations().await; - - let res = - bitwarden_api_api::apis::secrets_api::secrets_get_by_ids_post(&config.api, request).await?; - - let enc = client.internal.get_encryption_settings()?; - - SecretsResponse::process_response(res, &enc) -} diff --git a/crates/bitwarden-sm/src/secrets/list.rs b/crates/bitwarden-sm/src/secrets/list.rs deleted file mode 100644 index 60a5c9727..000000000 --- a/crates/bitwarden-sm/src/secrets/list.rs +++ /dev/null @@ -1,108 +0,0 @@ -use bitwarden_api_api::models::{ - SecretWithProjectsListResponseModel, SecretsWithProjectsInnerSecret, -}; -use bitwarden_core::{ - client::{encryption_settings::EncryptionSettings, Client}, - require, Error, -}; -use bitwarden_crypto::{EncString, KeyDecryptable}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretIdentifiersRequest { - /// Organization to retrieve all the secrets from - pub organization_id: Uuid, -} - -pub(crate) async fn list_secrets( - client: &Client, - input: &SecretIdentifiersRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_get( - &config.api, - input.organization_id, - ) - .await?; - - let enc = client.internal.get_encryption_settings()?; - - SecretIdentifiersResponse::process_response(res, &enc) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretIdentifiersByProjectRequest { - /// Project to retrieve all the secrets from - pub project_id: Uuid, -} - -pub(crate) async fn list_secrets_by_project( - client: &Client, - input: &SecretIdentifiersByProjectRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - let res = bitwarden_api_api::apis::secrets_api::projects_project_id_secrets_get( - &config.api, - input.project_id, - ) - .await?; - - let enc = client.internal.get_encryption_settings()?; - - SecretIdentifiersResponse::process_response(res, &enc) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretIdentifiersResponse { - pub data: Vec, -} - -impl SecretIdentifiersResponse { - pub(crate) fn process_response( - response: SecretWithProjectsListResponseModel, - enc: &EncryptionSettings, - ) -> Result { - Ok(SecretIdentifiersResponse { - data: response - .secrets - .unwrap_or_default() - .into_iter() - .map(|r| SecretIdentifierResponse::process_response(r, enc)) - .collect::>()?, - }) - } -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretIdentifierResponse { - pub id: Uuid, - pub organization_id: Uuid, - - pub key: String, -} - -impl SecretIdentifierResponse { - pub(crate) fn process_response( - response: SecretsWithProjectsInnerSecret, - enc: &EncryptionSettings, - ) -> Result { - let organization_id = require!(response.organization_id); - let enc_key = enc.get_key(&Some(organization_id))?; - - let key = require!(response.key) - .parse::()? - .decrypt_with_key(enc_key)?; - - Ok(SecretIdentifierResponse { - id: require!(response.id), - organization_id, - key, - }) - } -} diff --git a/crates/bitwarden-sm/src/secrets/mod.rs b/crates/bitwarden-sm/src/secrets/mod.rs deleted file mode 100644 index 74a7a9c47..000000000 --- a/crates/bitwarden-sm/src/secrets/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -mod create; -mod delete; -mod get; -mod get_by_ids; -mod list; -mod secret_response; -mod sync; -mod update; - -pub(crate) use create::create_secret; -pub use create::SecretCreateRequest; -pub(crate) use delete::delete_secrets; -pub use delete::{SecretsDeleteRequest, SecretsDeleteResponse}; -pub(crate) use get::get_secret; -pub use get::SecretGetRequest; -pub(crate) use get_by_ids::get_secrets_by_ids; -pub use get_by_ids::SecretsGetRequest; -pub(crate) use list::{list_secrets, list_secrets_by_project}; -pub use list::{ - SecretIdentifiersByProjectRequest, SecretIdentifiersRequest, SecretIdentifiersResponse, -}; -pub use secret_response::{SecretResponse, SecretsResponse}; -pub(crate) use sync::sync_secrets; -pub use sync::{SecretsSyncRequest, SecretsSyncResponse}; -pub(crate) use update::update_secret; -pub use update::SecretPutRequest; diff --git a/crates/bitwarden-sm/src/secrets/secret_response.rs b/crates/bitwarden-sm/src/secrets/secret_response.rs deleted file mode 100644 index e480ac3fc..000000000 --- a/crates/bitwarden-sm/src/secrets/secret_response.rs +++ /dev/null @@ -1,100 +0,0 @@ -use bitwarden_api_api::models::{ - BaseSecretResponseModel, BaseSecretResponseModelListResponseModel, SecretResponseModel, -}; -use bitwarden_core::{client::encryption_settings::EncryptionSettings, require, Error}; -use bitwarden_crypto::{EncString, KeyDecryptable}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretResponse { - pub id: Uuid, - pub organization_id: Uuid, - pub project_id: Option, - - pub key: String, - pub value: String, - pub note: String, - - pub creation_date: DateTime, - pub revision_date: DateTime, -} - -impl SecretResponse { - pub(crate) fn process_response( - response: SecretResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let base = BaseSecretResponseModel { - object: response.object, - id: response.id, - organization_id: response.organization_id, - key: response.key, - value: response.value, - note: response.note, - creation_date: response.creation_date, - revision_date: response.revision_date, - projects: response.projects, - }; - Self::process_base_response(base, enc) - } - pub(crate) fn process_base_response( - response: BaseSecretResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let org_id = response.organization_id; - let enc_key = enc.get_key(&org_id)?; - - let key = require!(response.key) - .parse::()? - .decrypt_with_key(enc_key)?; - let value = require!(response.value) - .parse::()? - .decrypt_with_key(enc_key)?; - let note = require!(response.note) - .parse::()? - .decrypt_with_key(enc_key)?; - - let project = response - .projects - .and_then(|p| p.into_iter().next()) - .and_then(|p| p.id); - - Ok(SecretResponse { - id: require!(response.id), - organization_id: require!(org_id), - project_id: project, - key, - value, - note, - - creation_date: require!(response.creation_date).parse()?, - revision_date: require!(response.revision_date).parse()?, - }) - } -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretsResponse { - pub data: Vec, -} - -impl SecretsResponse { - pub(crate) fn process_response( - response: BaseSecretResponseModelListResponseModel, - enc: &EncryptionSettings, - ) -> Result { - Ok(SecretsResponse { - data: response - .data - .unwrap_or_default() - .into_iter() - .map(|r| SecretResponse::process_base_response(r, enc)) - .collect::>()?, - }) - } -} diff --git a/crates/bitwarden-sm/src/secrets/sync.rs b/crates/bitwarden-sm/src/secrets/sync.rs deleted file mode 100644 index 9c922a002..000000000 --- a/crates/bitwarden-sm/src/secrets/sync.rs +++ /dev/null @@ -1,70 +0,0 @@ -use bitwarden_api_api::models::SecretsSyncResponseModel; -use bitwarden_core::{client::encryption_settings::EncryptionSettings, require, Client, Error}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use super::SecretResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretsSyncRequest { - /// Organization to sync secrets from - pub organization_id: Uuid, - /// Optional date time a sync last occurred - pub last_synced_date: Option>, -} - -pub(crate) async fn sync_secrets( - client: &Client, - input: &SecretsSyncRequest, -) -> Result { - let config = client.internal.get_api_configurations().await; - let last_synced_date = input.last_synced_date.map(|date| date.to_rfc3339()); - - let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_sync_get( - &config.api, - input.organization_id, - last_synced_date, - ) - .await?; - - let enc = client.internal.get_encryption_settings()?; - - SecretsSyncResponse::process_response(res, &enc) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretsSyncResponse { - pub has_changes: bool, - pub secrets: Option>, -} - -impl SecretsSyncResponse { - pub(crate) fn process_response( - response: SecretsSyncResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let has_changes = require!(response.has_changes); - - if has_changes { - let secrets = require!(response.secrets) - .data - .unwrap_or_default() - .into_iter() - .map(|r| SecretResponse::process_base_response(r, enc)) - .collect::>()?; - return Ok(SecretsSyncResponse { - has_changes, - secrets: Some(secrets), - }); - } - - Ok(SecretsSyncResponse { - has_changes: false, - secrets: None, - }) - } -} diff --git a/crates/bitwarden-sm/src/secrets/update.rs b/crates/bitwarden-sm/src/secrets/update.rs deleted file mode 100644 index b80c57234..000000000 --- a/crates/bitwarden-sm/src/secrets/update.rs +++ /dev/null @@ -1,198 +0,0 @@ -use bitwarden_api_api::models::SecretUpdateRequestModel; -use bitwarden_core::{validate_only_whitespaces, Client, Error}; -use bitwarden_crypto::KeyEncryptable; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use validator::Validate; - -use super::SecretResponse; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Validate)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretPutRequest { - /// ID of the secret to modify - pub id: Uuid, - /// Organization ID of the secret to modify - pub organization_id: Uuid, - #[validate(length(min = 1, max = 500), custom(function = validate_only_whitespaces))] - pub key: String, - #[validate(length(min = 1, max = 25_000))] - pub value: String, - #[validate(length(max = 7_000), custom(function = validate_only_whitespaces))] - pub note: String, - pub project_ids: Option>, -} - -pub(crate) async fn update_secret( - client: &Client, - input: &SecretPutRequest, -) -> Result { - input.validate()?; - - let enc = client.internal.get_encryption_settings()?; - let key = enc.get_key(&Some(input.organization_id))?; - - let secret = Some(SecretUpdateRequestModel { - key: input.key.clone().trim().encrypt_with_key(key)?.to_string(), - value: input.value.clone().encrypt_with_key(key)?.to_string(), - note: input.note.clone().trim().encrypt_with_key(key)?.to_string(), - project_ids: input.project_ids.clone(), - access_policies_requests: None, - }); - - let config = client.internal.get_api_configurations().await; - let res = - bitwarden_api_api::apis::secrets_api::secrets_id_put(&config.api, input.id, secret).await?; - - SecretResponse::process_response(res, &enc) -} - -#[cfg(test)] -mod tests { - use super::*; - - async fn update_secret( - key: Option, - value: Option, - note: Option, - ) -> Result { - let input = SecretPutRequest { - id: Uuid::new_v4(), - organization_id: Uuid::new_v4(), - key: key.unwrap_or_else(|| "test key".into()), - value: value.unwrap_or_else(|| "test value".into()), - note: note.unwrap_or_else(|| "test note".into()), - project_ids: Some(vec![Uuid::new_v4()]), - }; - - super::update_secret(&Client::new(None), &input).await - } - - #[tokio::test] - async fn test_update_secret_request_key_empty_string() { - let response = update_secret(Some("".into()), None, None).await; - assert!(response.is_err()); - assert_eq!(response.err().unwrap().to_string(), "key must not be empty"); - } - - #[tokio::test] - async fn test_update_secret_request_key_all_whitespaces_space() { - let response = update_secret(Some(" ".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_key_all_whitespaces_tab() { - let response = update_secret(Some("\t".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_key_all_whitespaces_newline() { - let response = update_secret(Some("\n".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_key_all_whitespaces_combined() { - let response = update_secret(Some(" \t\n".into()), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_key_501_character_length() { - let response = update_secret(Some("a".repeat(501)), None, None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "key must not exceed 500 characters in length" - ); - } - - #[tokio::test] - async fn test_update_secret_request_value_empty_string() { - let response = update_secret(None, Some("".into()), None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "value must not be empty" - ); - } - - #[tokio::test] - async fn test_update_secret_request_value_25001_character_length() { - let response = update_secret(None, Some("a".repeat(25001)), None).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "value must not exceed 25000 characters in length" - ); - } - - #[tokio::test] - async fn test_update_secret_request_note_all_whitespaces_space() { - let response = update_secret(None, None, Some(" ".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_note_all_whitespaces_tab() { - let response = update_secret(None, None, Some("\t".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_note_all_whitespaces_newline() { - let response = update_secret(None, None, Some("\n".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_note_all_whitespaces_combined() { - let response = update_secret(None, None, Some(" \t\n".into())).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not contain only whitespaces" - ); - } - - #[tokio::test] - async fn test_update_secret_request_note_7001_character_length() { - let response = update_secret(None, None, Some("a".repeat(7001))).await; - assert!(response.is_err()); - assert_eq!( - response.err().unwrap().to_string(), - "note must not exceed 7000 characters in length" - ); - } -} diff --git a/crates/bitwarden-uniffi/Cargo.toml b/crates/bitwarden-uniffi/Cargo.toml deleted file mode 100644 index 2e57e23b5..000000000 --- a/crates/bitwarden-uniffi/Cargo.toml +++ /dev/null @@ -1,51 +0,0 @@ -[package] -name = "bitwarden-uniffi" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[features] - -[lib] -crate-type = ["lib", "staticlib", "cdylib"] -bench = false - -[dependencies] -async-trait = "0.1.80" -bitwarden-core = { workspace = true, features = ["uniffi"] } -bitwarden-crypto = { workspace = true, features = ["uniffi"] } -bitwarden-exporters = { workspace = true, features = ["uniffi"] } -bitwarden-fido = { workspace = true, features = ["uniffi"] } -bitwarden-generators = { workspace = true, features = ["uniffi"] } -bitwarden-send = { workspace = true, features = ["uniffi"] } -bitwarden-vault = { workspace = true, features = ["uniffi"] } -chrono = { workspace = true, features = ["std"] } -env_logger = "0.11.1" -log = { workspace = true } -schemars = { workspace = true, optional = true } -thiserror = { workspace = true } -uniffi = { workspace = true } -uuid = { workspace = true } - -[target.'cfg(target_os = "android")'.dependencies] -android_logger = "0.14" - -# The use of rustls-platform-verifier requires some extra support to communicate with the Android platform -jni = ">=0.19, <0.20" -libloading = ">=0.8.1, <0.9" -rustls-platform-verifier = "0.3.4" - -[target.'cfg(target_os = "ios")'.dependencies] -oslog = "0.2.0" - -[build-dependencies] -uniffi = { workspace = true, features = ["build"] } - -[lints] -workspace = true diff --git a/crates/bitwarden-uniffi/README.md b/crates/bitwarden-uniffi/README.md deleted file mode 100644 index c2e4d6c45..000000000 --- a/crates/bitwarden-uniffi/README.md +++ /dev/null @@ -1 +0,0 @@ -# Bitwarden-uniffi diff --git a/crates/bitwarden-uniffi/src/android_support.rs b/crates/bitwarden-uniffi/src/android_support.rs deleted file mode 100644 index c6d8b70a7..000000000 --- a/crates/bitwarden-uniffi/src/android_support.rs +++ /dev/null @@ -1,77 +0,0 @@ -use std::error::Error; - -use jni::sys::{jint, jsize, JavaVM}; - -pub fn init() { - static ANDROID_INIT: std::sync::Once = std::sync::Once::new(); - - fn init_inner() -> Result<(), Box> { - let jvm = java_vm()?; - let env = jvm.attach_current_thread_permanently()?; - init_verifier(&env)?; - Ok(()) - } - - ANDROID_INIT.call_once(|| { - if let Err(e) = init_inner() { - log::error!("Failed to initialize Android support: {}", e); - } - }); -} - -type JniGetCreatedJavaVms = - unsafe extern "system" fn(vmBuf: *mut *mut JavaVM, bufLen: jsize, nVMs: *mut jsize) -> jint; -const JNI_GET_JAVA_VMS_NAME: &[u8] = b"JNI_GetCreatedJavaVMs"; - -fn java_vm() -> Result> { - // Ideally we would use JNI to get a reference to the JavaVM, but that's not possible since - // UniFFI uses JNA - // - // If we could use JNI, we'd just need to export a function and call it from the Android app: - // #[export_name = "Java_com_orgname_android_rust_init"] - // extern "C" fn java_init(env: JNIEnv, _class: JClass, context: JObject, ) -> jboolean { - // - // Instead we have to use libloading to get a reference to the JavaVM: - // - // https://github.com/mozilla/uniffi-rs/issues/1778#issuecomment-1807979746 - let lib = libloading::os::unix::Library::this(); - let get_created_java_vms: JniGetCreatedJavaVms = unsafe { *lib.get(JNI_GET_JAVA_VMS_NAME)? }; - - let mut java_vms: [*mut JavaVM; 1] = [std::ptr::null_mut() as *mut JavaVM]; - let mut vm_count: i32 = 0; - - let ok = unsafe { get_created_java_vms(java_vms.as_mut_ptr(), 1, &mut vm_count) }; - if ok != jni::sys::JNI_OK { - return Err("Failed to get JavaVM".into()); - } - if vm_count != 1 { - return Err(format!("Invalid JavaVM count: {vm_count}").into()); - } - - let jvm = unsafe { jni::JavaVM::from_raw(java_vms[0]) }?; - Ok(jvm) -} - -fn init_verifier(env: &jni::JNIEnv<'_>) -> jni::errors::Result<()> { - let activity_thread = env - .call_static_method( - "android/app/ActivityThread", - "currentActivityThread", - "()Landroid/app/ActivityThread;", - &[], - )? - .l()?; - - let context = env - .call_method( - activity_thread, - "getApplication", - "()Landroid/app/Application;", - &[], - )? - .l()?; - - Ok(rustls_platform_verifier::android::init_hosted( - &env, context, - )?) -} diff --git a/crates/bitwarden-uniffi/src/auth/mod.rs b/crates/bitwarden-uniffi/src/auth/mod.rs deleted file mode 100644 index 43496080a..000000000 --- a/crates/bitwarden-uniffi/src/auth/mod.rs +++ /dev/null @@ -1,151 +0,0 @@ -use std::sync::Arc; - -use bitwarden_core::{ - auth::{ - password::MasterPasswordPolicyOptions, AuthRequestResponse, KeyConnectorResponse, - RegisterKeyResponse, RegisterTdeKeyResponse, - }, - Error, -}; -use bitwarden_crypto::{AsymmetricEncString, EncString, HashPurpose, Kdf, TrustDeviceResponse}; - -use crate::{error::Result, Client}; - -#[derive(uniffi::Object)] -pub struct ClientAuth(pub(crate) Arc); - -#[uniffi::export(async_runtime = "tokio")] -impl ClientAuth { - /// **API Draft:** Calculate Password Strength - pub fn password_strength( - &self, - password: String, - email: String, - additional_inputs: Vec, - ) -> u8 { - self.0 - .0 - .auth() - .password_strength(password, email, additional_inputs) - } - - /// Evaluate if the provided password satisfies the provided policy - pub fn satisfies_policy( - &self, - password: String, - strength: u8, - policy: MasterPasswordPolicyOptions, - ) -> bool { - self.0 - .0 - .auth() - .satisfies_policy(password, strength, &policy) - } - - /// Hash the user password - pub async fn hash_password( - &self, - email: String, - password: String, - kdf_params: Kdf, - purpose: HashPurpose, - ) -> Result { - Ok(self - .0 - .0 - .kdf() - .hash_password(email, password, kdf_params, purpose) - .await?) - } - - /// Generate keys needed for registration process - pub fn make_register_keys( - &self, - email: String, - password: String, - kdf: Kdf, - ) -> Result { - Ok(self.0 .0.auth().make_register_keys(email, password, kdf)?) - } - - /// Generate keys needed for TDE process - pub fn make_register_tde_keys( - &self, - email: String, - org_public_key: String, - remember_device: bool, - ) -> Result { - Ok(self - .0 - .0 - .auth() - .make_register_tde_keys(email, org_public_key, remember_device)?) - } - - /// Generate keys needed to onboard a new user without master key to key connector - pub fn make_key_connector_keys(&self) -> Result { - Ok(self - .0 - .0 - .auth() - .make_key_connector_keys() - .map_err(Error::Crypto)?) - } - - /// Validate the user password - /// - /// To retrieve the user's password hash, use [`ClientAuth::hash_password`] with - /// `HashPurpose::LocalAuthentication` during login and persist it. If the login method has no - /// password, use the email OTP. - pub fn validate_password(&self, password: String, password_hash: String) -> Result { - Ok(self - .0 - .0 - .auth() - .validate_password(password, password_hash)?) - } - - /// Validate the user password without knowing the password hash - /// - /// Used for accounts that we know have master passwords but that have not logged in with a - /// password. Some example are login with device or TDE. - /// - /// This works by comparing the provided password against the encrypted user key. - pub fn validate_password_user_key( - &self, - password: String, - encrypted_user_key: String, - ) -> Result { - Ok(self - .0 - .0 - .auth() - .validate_password_user_key(password, encrypted_user_key)?) - } - - /// Validate the user PIN - /// - /// To validate the user PIN, you need to have the user's pin_protected_user_key. This key is - /// obtained when enabling PIN unlock on the account with the `derive_pin_key` method. - /// - /// This works by comparing the decrypted user key with the current user key, so the client must - /// be unlocked. - pub fn validate_pin(&self, pin: String, pin_protected_user_key: EncString) -> Result { - Ok(self.0 .0.auth().validate_pin(pin, pin_protected_user_key)?) - } - - /// Initialize a new auth request - pub fn new_auth_request(&self, email: String) -> Result { - Ok(self.0 .0.auth().new_auth_request(&email)?) - } - - /// Approve an auth request - pub fn approve_auth_request(&self, public_key: String) -> Result { - Ok(self.0 .0.auth().approve_auth_request(public_key)?) - } - - /// Trust the current device - pub fn trust_device(&self) -> Result { - Ok(self.0 .0.auth().trust_device()?) - } -} diff --git a/crates/bitwarden-uniffi/src/crypto.rs b/crates/bitwarden-uniffi/src/crypto.rs deleted file mode 100644 index 6404d62f6..000000000 --- a/crates/bitwarden-uniffi/src/crypto.rs +++ /dev/null @@ -1,76 +0,0 @@ -use std::sync::Arc; - -use bitwarden_core::{ - mobile::crypto::{ - DeriveKeyConnectorRequest, DerivePinKeyResponse, InitOrgCryptoRequest, - InitUserCryptoRequest, UpdatePasswordResponse, - }, - Error, -}; -use bitwarden_crypto::{AsymmetricEncString, EncString}; - -use crate::{error::Result, Client}; - -#[derive(uniffi::Object)] -pub struct ClientCrypto(pub(crate) Arc); - -#[uniffi::export(async_runtime = "tokio")] -impl ClientCrypto { - /// Initialization method for the user crypto. Needs to be called before any other crypto - /// operations. - pub async fn initialize_user_crypto(&self, req: InitUserCryptoRequest) -> Result<()> { - Ok(self - .0 - .0 - .crypto() - .initialize_user_crypto(req) - .await - .map_err(Error::EncryptionSettings)?) - } - - /// Initialization method for the organization crypto. Needs to be called after - /// `initialize_user_crypto` but before any other crypto operations. - pub async fn initialize_org_crypto(&self, req: InitOrgCryptoRequest) -> Result<()> { - Ok(self - .0 - .0 - .crypto() - .initialize_org_crypto(req) - .await - .map_err(Error::EncryptionSettings)?) - } - - /// Get the uses's decrypted encryption key. Note: It's very important - /// to keep this key safe, as it can be used to decrypt all of the user's data - pub async fn get_user_encryption_key(&self) -> Result { - Ok(self.0 .0.crypto().get_user_encryption_key().await?) - } - - /// Update the user's password, which will re-encrypt the user's encryption key with the new - /// password. This returns the new encrypted user key and the new password hash. - pub fn update_password(&self, new_password: String) -> Result { - Ok(self.0 .0.crypto().update_password(new_password)?) - } - - /// Generates a PIN protected user key from the provided PIN. The result can be stored and later - /// used to initialize another client instance by using the PIN and the PIN key with - /// `initialize_user_crypto`. - pub fn derive_pin_key(&self, pin: String) -> Result { - Ok(self.0 .0.crypto().derive_pin_key(pin)?) - } - - /// Derives the pin protected user key from encrypted pin. Used when pin requires master - /// password on first unlock. - pub fn derive_pin_user_key(&self, encrypted_pin: EncString) -> Result { - Ok(self.0 .0.crypto().derive_pin_user_key(encrypted_pin)?) - } - - pub fn enroll_admin_password_reset(&self, public_key: String) -> Result { - Ok(self.0 .0.crypto().enroll_admin_password_reset(public_key)?) - } - - /// Derive the master key for migrating to the key connector - pub fn derive_key_connector(&self, request: DeriveKeyConnectorRequest) -> Result { - Ok(self.0 .0.crypto().derive_key_connector(request)?) - } -} diff --git a/crates/bitwarden-uniffi/src/error.rs b/crates/bitwarden-uniffi/src/error.rs deleted file mode 100644 index 889e3c7fb..000000000 --- a/crates/bitwarden-uniffi/src/error.rs +++ /dev/null @@ -1,81 +0,0 @@ -use std::fmt::{Display, Formatter}; - -use bitwarden_exporters::ExportError; -use bitwarden_generators::{PassphraseError, PasswordError, UsernameError}; - -// Name is converted from *Error to *Exception, so we can't just name the enum Error because -// Exception already exists -#[derive(uniffi::Error, Debug)] -#[uniffi(flat_error)] -pub enum BitwardenError { - E(Error), -} - -impl From for BitwardenError { - fn from(e: bitwarden_core::Error) -> Self { - Self::E(e.into()) - } -} - -impl From for BitwardenError { - fn from(e: Error) -> Self { - Self::E(e) - } -} - -impl Display for BitwardenError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - Self::E(e) => Display::fmt(e, f), - } - } -} - -impl std::error::Error for BitwardenError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - BitwardenError::E(e) => Some(e), - } - } -} - -pub type Result = std::result::Result; - -#[derive(thiserror::Error, Debug)] -pub enum Error { - #[error(transparent)] - Core(#[from] bitwarden_core::Error), - - // Generators - #[error(transparent)] - UsernameError(#[from] UsernameError), - #[error(transparent)] - PassphraseError(#[from] PassphraseError), - #[error(transparent)] - PasswordError(#[from] PasswordError), - - // Vault - #[error(transparent)] - Cipher(#[from] bitwarden_vault::CipherError), - #[error(transparent)] - Totp(#[from] bitwarden_vault::TotpError), - - #[error(transparent)] - ExportError(#[from] ExportError), - - // Fido - #[error(transparent)] - MakeCredential(#[from] bitwarden_fido::MakeCredentialError), - #[error(transparent)] - GetAssertion(#[from] bitwarden_fido::GetAssertionError), - #[error(transparent)] - SilentlyDiscoverCredentials(#[from] bitwarden_fido::SilentlyDiscoverCredentialsError), - #[error(transparent)] - CredentialsForAutofillError(#[from] bitwarden_fido::CredentialsForAutofillError), - #[error(transparent)] - DecryptFido2AutofillCredentialsError( - #[from] bitwarden_fido::DecryptFido2AutofillCredentialsError, - ), - #[error(transparent)] - Fido2Client(#[from] bitwarden_fido::Fido2ClientError), -} diff --git a/crates/bitwarden-uniffi/src/lib.rs b/crates/bitwarden-uniffi/src/lib.rs deleted file mode 100644 index aae35c37a..000000000 --- a/crates/bitwarden-uniffi/src/lib.rs +++ /dev/null @@ -1,107 +0,0 @@ -uniffi::setup_scaffolding!(); - -use std::sync::Arc; - -use auth::ClientAuth; -use bitwarden_core::ClientSettings; - -pub mod auth; -pub mod crypto; -mod error; -pub mod platform; -pub mod tool; -mod uniffi_support; -pub mod vault; - -#[cfg(target_os = "android")] -mod android_support; - -use crypto::ClientCrypto; -use error::Result; -use platform::ClientPlatform; -use tool::{ClientExporters, ClientGenerators, ClientSends}; -use vault::ClientVault; - -#[derive(uniffi::Object)] -pub struct Client(bitwarden_core::Client); - -#[uniffi::export(async_runtime = "tokio")] -impl Client { - /// Initialize a new instance of the SDK client - #[uniffi::constructor] - pub fn new(settings: Option) -> Arc { - init_logger(); - - #[cfg(target_os = "android")] - android_support::init(); - - Arc::new(Self(bitwarden_core::Client::new(settings))) - } - - /// Crypto operations - pub fn crypto(self: Arc) -> Arc { - Arc::new(ClientCrypto(self)) - } - - /// Vault item operations - pub fn vault(self: Arc) -> Arc { - Arc::new(ClientVault(self)) - } - - pub fn platform(self: Arc) -> Arc { - Arc::new(ClientPlatform(self)) - } - - /// Generator operations - pub fn generators(self: Arc) -> Arc { - Arc::new(ClientGenerators(self)) - } - - /// Exporters - pub fn exporters(self: Arc) -> Arc { - Arc::new(ClientExporters(self)) - } - - /// Sends operations - pub fn sends(self: Arc) -> Arc { - Arc::new(ClientSends(self)) - } - - /// Auth operations - pub fn auth(self: Arc) -> Arc { - Arc::new(ClientAuth(self)) - } - - /// Test method, echoes back the input - pub fn echo(&self, msg: String) -> String { - msg - } - - /// Test method, calls http endpoint - pub async fn http_get(&self, url: String) -> Result { - let client = self.0.internal.get_http_client(); - let res = client - .get(&url) - .send() - .await - .map_err(bitwarden_core::Error::Reqwest)?; - - Ok(res.text().await.map_err(bitwarden_core::Error::Reqwest)?) - } -} - -fn init_logger() { - #[cfg(not(any(target_os = "android", target_os = "ios")))] - let _ = env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")) - .try_init(); - - #[cfg(target_os = "ios")] - let _ = oslog::OsLogger::new("com.8bit.bitwarden") - .level_filter(log::LevelFilter::Info) - .init(); - - #[cfg(target_os = "android")] - android_logger::init_once( - android_logger::Config::default().with_max_level(uniffi::deps::log::LevelFilter::Info), - ); -} diff --git a/crates/bitwarden-uniffi/src/platform/fido2.rs b/crates/bitwarden-uniffi/src/platform/fido2.rs deleted file mode 100644 index 99c998648..000000000 --- a/crates/bitwarden-uniffi/src/platform/fido2.rs +++ /dev/null @@ -1,371 +0,0 @@ -use std::sync::Arc; - -use bitwarden_fido::{ - CheckUserOptions, ClientData, ClientFido2Ext, Fido2CallbackError as BitFido2CallbackError, - Fido2CredentialAutofillView, GetAssertionRequest, GetAssertionResult, MakeCredentialRequest, - MakeCredentialResult, Origin, PublicKeyCredentialAuthenticatorAssertionResponse, - PublicKeyCredentialAuthenticatorAttestationResponse, PublicKeyCredentialRpEntity, - PublicKeyCredentialUserEntity, -}; -use bitwarden_vault::{Cipher, CipherView, Fido2CredentialNewView}; - -use crate::{ - error::{Error, Result}, - Client, -}; - -#[derive(uniffi::Object)] -pub struct ClientFido2(pub(crate) Arc); - -#[uniffi::export] -impl ClientFido2 { - pub fn authenticator( - self: Arc, - user_interface: Arc, - credential_store: Arc, - ) -> Arc { - Arc::new(ClientFido2Authenticator( - self.0.clone(), - user_interface, - credential_store, - )) - } - - pub fn client( - self: Arc, - user_interface: Arc, - credential_store: Arc, - ) -> Arc { - Arc::new(ClientFido2Client(ClientFido2Authenticator( - self.0.clone(), - user_interface, - credential_store, - ))) - } - - pub fn decrypt_fido2_autofill_credentials( - self: Arc, - cipher_view: CipherView, - ) -> Result> { - let result = self - .0 - .0 - .fido2() - .decrypt_fido2_autofill_credentials(cipher_view) - .map_err(Error::DecryptFido2AutofillCredentialsError)?; - - Ok(result) - } -} - -#[derive(uniffi::Object)] -pub struct ClientFido2Authenticator( - pub(crate) Arc, - pub(crate) Arc, - pub(crate) Arc, -); - -#[uniffi::export] -impl ClientFido2Authenticator { - pub async fn make_credential( - &self, - request: MakeCredentialRequest, - ) -> Result { - let fido2 = self.0 .0.fido2(); - let ui = UniffiTraitBridge(self.1.as_ref()); - let cs = UniffiTraitBridge(self.2.as_ref()); - let mut auth = fido2.create_authenticator(&ui, &cs); - - let result = auth - .make_credential(request) - .await - .map_err(Error::MakeCredential)?; - Ok(result) - } - - pub async fn get_assertion(&self, request: GetAssertionRequest) -> Result { - let fido2 = self.0 .0.fido2(); - let ui = UniffiTraitBridge(self.1.as_ref()); - let cs = UniffiTraitBridge(self.2.as_ref()); - let mut auth = fido2.create_authenticator(&ui, &cs); - - let result = auth - .get_assertion(request) - .await - .map_err(Error::GetAssertion)?; - Ok(result) - } - - pub async fn silently_discover_credentials( - &self, - rp_id: String, - ) -> Result> { - let fido2 = self.0 .0.fido2(); - - let ui = UniffiTraitBridge(self.1.as_ref()); - let cs = UniffiTraitBridge(self.2.as_ref()); - let mut auth = fido2.create_authenticator(&ui, &cs); - - let result = auth - .silently_discover_credentials(rp_id) - .await - .map_err(Error::SilentlyDiscoverCredentials)?; - Ok(result) - } - - pub async fn credentials_for_autofill(&self) -> Result> { - let fido2 = self.0 .0.fido2(); - let ui = UniffiTraitBridge(self.1.as_ref()); - let cs = UniffiTraitBridge(self.2.as_ref()); - let mut auth = fido2.create_authenticator(&ui, &cs); - - let result = auth - .credentials_for_autofill() - .await - .map_err(Error::CredentialsForAutofillError)?; - Ok(result) - } -} - -#[derive(uniffi::Object)] -pub struct ClientFido2Client(pub(crate) ClientFido2Authenticator); - -#[uniffi::export] -impl ClientFido2Client { - pub async fn register( - &self, - origin: Origin, - request: String, - client_data: ClientData, - ) -> Result { - let fido2 = self.0 .0 .0.fido2(); - let ui = UniffiTraitBridge(self.0 .1.as_ref()); - let cs = UniffiTraitBridge(self.0 .2.as_ref()); - let mut client = fido2.create_client(&ui, &cs); - - let result = client - .register(origin, request, client_data) - .await - .map_err(Error::Fido2Client)?; - Ok(result) - } - - pub async fn authenticate( - &self, - origin: Origin, - request: String, - client_data: ClientData, - ) -> Result { - let fido2 = self.0 .0 .0.fido2(); - let ui = UniffiTraitBridge(self.0 .1.as_ref()); - let cs = UniffiTraitBridge(self.0 .2.as_ref()); - let mut client = fido2.create_client(&ui, &cs); - - let result = client - .authenticate(origin, request, client_data) - .await - .map_err(Error::Fido2Client)?; - Ok(result) - } -} - -// Note that uniffi doesn't support external traits for now it seems, so we have to duplicate them -// here. - -#[allow(dead_code)] -#[derive(uniffi::Record)] -pub struct CheckUserResult { - user_present: bool, - user_verified: bool, -} - -impl From for bitwarden_fido::CheckUserResult { - fn from(val: CheckUserResult) -> Self { - Self { - user_present: val.user_present, - user_verified: val.user_verified, - } - } -} - -#[allow(dead_code)] -#[derive(uniffi::Record)] -pub struct CheckUserAndPickCredentialForCreationResult { - cipher: CipherViewWrapper, - check_user_result: CheckUserResult, -} - -#[derive(Debug, thiserror::Error, uniffi::Error)] -pub enum Fido2CallbackError { - #[error("The operation requires user interaction")] - UserInterfaceRequired, - - #[error("The operation was cancelled by the user")] - OperationCancelled, - - #[error("Unknown error: {reason}")] - Unknown { reason: String }, -} - -// Need to implement this From<> impl in order to handle unexpected callback errors. See the -// following page in the Uniffi user guide: -// -impl From for Fido2CallbackError { - fn from(e: uniffi::UnexpectedUniFFICallbackError) -> Self { - Self::Unknown { reason: e.reason } - } -} - -impl From for BitFido2CallbackError { - fn from(val: Fido2CallbackError) -> Self { - match val { - Fido2CallbackError::UserInterfaceRequired => Self::UserInterfaceRequired, - Fido2CallbackError::OperationCancelled => Self::OperationCancelled, - Fido2CallbackError::Unknown { reason } => Self::Unknown(reason), - } - } -} - -#[uniffi::export(with_foreign)] -#[async_trait::async_trait] -pub trait Fido2UserInterface: Send + Sync { - async fn check_user( - &self, - options: CheckUserOptions, - hint: UIHint, - ) -> Result; - async fn pick_credential_for_authentication( - &self, - available_credentials: Vec, - ) -> Result; - async fn check_user_and_pick_credential_for_creation( - &self, - options: CheckUserOptions, - new_credential: Fido2CredentialNewView, - ) -> Result; - async fn is_verification_enabled(&self) -> bool; -} - -#[uniffi::export(with_foreign)] -#[async_trait::async_trait] -pub trait Fido2CredentialStore: Send + Sync { - async fn find_credentials( - &self, - ids: Option>>, - rip_id: String, - ) -> Result, Fido2CallbackError>; - - async fn all_credentials(&self) -> Result, Fido2CallbackError>; - - async fn save_credential(&self, cred: Cipher) -> Result<(), Fido2CallbackError>; -} - -// Because uniffi doesn't support external traits, we have to make a copy of the trait here. -// Ideally we'd want to implement the original trait for every item that implements our local copy, -// but the orphan rules don't allow us to blanket implement an external trait. So we have to wrap -// the trait in a newtype and implement the trait for the newtype. -struct UniffiTraitBridge(T); - -#[async_trait::async_trait] -impl bitwarden_fido::Fido2CredentialStore for UniffiTraitBridge<&dyn Fido2CredentialStore> { - async fn find_credentials( - &self, - ids: Option>>, - rip_id: String, - ) -> Result, BitFido2CallbackError> { - self.0 - .find_credentials(ids, rip_id) - .await - .map_err(Into::into) - } - - async fn all_credentials(&self) -> Result, BitFido2CallbackError> { - self.0.all_credentials().await.map_err(Into::into) - } - - async fn save_credential(&self, cred: Cipher) -> Result<(), BitFido2CallbackError> { - self.0.save_credential(cred).await.map_err(Into::into) - } -} - -// Uniffi seems to have trouble generating code for Android when a local trait returns a type from -// an external crate. If the type is small we can just copy it over and convert back and forth, but -// Cipher is too big for that to be practical. So we wrap it in a newtype, which is local to the -// trait and so we can sidestep the Uniffi issue -#[derive(uniffi::Record)] -pub struct CipherViewWrapper { - cipher: CipherView, -} - -#[derive(uniffi::Enum)] -pub enum UIHint { - InformExcludedCredentialFound(CipherView), - InformNoCredentialsFound, - RequestNewCredential(PublicKeyCredentialUserEntity, PublicKeyCredentialRpEntity), - RequestExistingCredential(CipherView), -} - -impl From> for UIHint { - fn from(hint: bitwarden_fido::UIHint<'_, CipherView>) -> Self { - use bitwarden_fido::UIHint as BWUIHint; - match hint { - BWUIHint::InformExcludedCredentialFound(cipher) => { - UIHint::InformExcludedCredentialFound(cipher.clone()) - } - BWUIHint::InformNoCredentialsFound => UIHint::InformNoCredentialsFound, - BWUIHint::RequestNewCredential(user, rp) => UIHint::RequestNewCredential( - PublicKeyCredentialUserEntity { - id: user.id.clone().into(), - name: user.name.clone().unwrap_or_default(), - display_name: user.display_name.clone().unwrap_or_default(), - }, - PublicKeyCredentialRpEntity { - id: rp.id.clone(), - name: rp.name.clone(), - }, - ), - BWUIHint::RequestExistingCredential(cipher) => { - UIHint::RequestExistingCredential(cipher.clone()) - } - } - } -} - -#[async_trait::async_trait] -impl bitwarden_fido::Fido2UserInterface for UniffiTraitBridge<&dyn Fido2UserInterface> { - async fn check_user<'a>( - &self, - options: CheckUserOptions, - hint: bitwarden_fido::UIHint<'a, CipherView>, - ) -> Result { - self.0 - .check_user(options.clone(), hint.into()) - .await - .map(Into::into) - .map_err(Into::into) - } - async fn pick_credential_for_authentication( - &self, - available_credentials: Vec, - ) -> Result { - self.0 - .pick_credential_for_authentication(available_credentials) - .await - .map(|v| v.cipher) - .map_err(Into::into) - } - async fn check_user_and_pick_credential_for_creation( - &self, - options: CheckUserOptions, - new_credential: Fido2CredentialNewView, - ) -> Result<(CipherView, bitwarden_fido::CheckUserResult), BitFido2CallbackError> { - self.0 - .check_user_and_pick_credential_for_creation(options, new_credential) - .await - .map(|v| (v.cipher.cipher, v.check_user_result.into())) - .map_err(Into::into) - } - async fn is_verification_enabled(&self) -> bool { - self.0.is_verification_enabled().await - } -} diff --git a/crates/bitwarden-uniffi/src/platform/mod.rs b/crates/bitwarden-uniffi/src/platform/mod.rs deleted file mode 100644 index b5d944152..000000000 --- a/crates/bitwarden-uniffi/src/platform/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -use std::sync::Arc; - -use bitwarden_core::platform::FingerprintRequest; - -use crate::{error::Result, Client}; - -mod fido2; - -#[derive(uniffi::Object)] -pub struct ClientPlatform(pub(crate) Arc); - -#[uniffi::export] -impl ClientPlatform { - /// Fingerprint (public key) - pub fn fingerprint(&self, req: FingerprintRequest) -> Result { - Ok(self.0 .0.platform().fingerprint(&req)?.fingerprint) - } - - /// Fingerprint using logged in user's public key - pub fn user_fingerprint(&self, fingerprint_material: String) -> Result { - Ok(self - .0 - .0 - .platform() - .user_fingerprint(fingerprint_material)?) - } - - /// Load feature flags into the client - pub fn load_flags(&self, flags: std::collections::HashMap) -> Result<()> { - self.0 .0.internal.load_flags(flags); - Ok(()) - } - - /// FIDO2 operations - pub fn fido2(self: Arc) -> Arc { - Arc::new(fido2::ClientFido2(self.0.clone())) - } -} diff --git a/crates/bitwarden-uniffi/src/tool/mod.rs b/crates/bitwarden-uniffi/src/tool/mod.rs deleted file mode 100644 index 498884218..000000000 --- a/crates/bitwarden-uniffi/src/tool/mod.rs +++ /dev/null @@ -1,89 +0,0 @@ -use std::sync::Arc; - -use bitwarden_exporters::{ClientExportersExt, ExportFormat}; -use bitwarden_generators::{ - ClientGeneratorExt, PassphraseGeneratorRequest, PasswordGeneratorRequest, - UsernameGeneratorRequest, -}; -use bitwarden_vault::{Cipher, Collection, Folder}; - -use crate::{ - error::{Error, Result}, - Client, -}; - -mod sends; -pub use sends::ClientSends; - -#[derive(uniffi::Object)] -pub struct ClientGenerators(pub(crate) Arc); - -#[uniffi::export(async_runtime = "tokio")] -impl ClientGenerators { - /// **API Draft:** Generate Password - pub fn password(&self, settings: PasswordGeneratorRequest) -> Result { - Ok(self - .0 - .0 - .generator() - .password(settings) - .map_err(Error::PasswordError)?) - } - - /// **API Draft:** Generate Passphrase - pub fn passphrase(&self, settings: PassphraseGeneratorRequest) -> Result { - Ok(self - .0 - .0 - .generator() - .passphrase(settings) - .map_err(Error::PassphraseError)?) - } - - /// **API Draft:** Generate Username - pub async fn username(&self, settings: UsernameGeneratorRequest) -> Result { - Ok(self - .0 - .0 - .generator() - .username(settings) - .await - .map_err(Error::UsernameError)?) - } -} - -#[derive(uniffi::Object)] -pub struct ClientExporters(pub(crate) Arc); - -#[uniffi::export] -impl ClientExporters { - /// **API Draft:** Export user vault - pub fn export_vault( - &self, - folders: Vec, - ciphers: Vec, - format: ExportFormat, - ) -> Result { - Ok(self - .0 - .0 - .exporters() - .export_vault(folders, ciphers, format) - .map_err(Error::ExportError)?) - } - - /// **API Draft:** Export organization vault - pub fn export_organization_vault( - &self, - collections: Vec, - ciphers: Vec, - format: ExportFormat, - ) -> Result { - Ok(self - .0 - .0 - .exporters() - .export_organization_vault(collections, ciphers, format) - .map_err(Error::ExportError)?) - } -} diff --git a/crates/bitwarden-uniffi/src/tool/sends.rs b/crates/bitwarden-uniffi/src/tool/sends.rs deleted file mode 100644 index 18732f57c..000000000 --- a/crates/bitwarden-uniffi/src/tool/sends.rs +++ /dev/null @@ -1,64 +0,0 @@ -use std::{path::Path, sync::Arc}; - -use bitwarden_send::{ClientSendsExt, Send, SendListView, SendView}; - -use crate::{Client, Result}; - -#[derive(uniffi::Object)] -pub struct ClientSends(pub Arc); - -#[uniffi::export] -impl ClientSends { - /// Encrypt send - pub fn encrypt(&self, send: SendView) -> Result { - Ok(self.0 .0.sends().encrypt(send)?) - } - - /// Encrypt a send file in memory - pub fn encrypt_buffer(&self, send: Send, buffer: Vec) -> Result> { - Ok(self.0 .0.sends().encrypt_buffer(send, &buffer)?) - } - - /// Encrypt a send file located in the file system - pub fn encrypt_file( - &self, - send: Send, - decrypted_file_path: String, - encrypted_file_path: String, - ) -> Result<()> { - Ok(self.0 .0.sends().encrypt_file( - send, - Path::new(&decrypted_file_path), - Path::new(&encrypted_file_path), - )?) - } - - /// Decrypt send - pub fn decrypt(&self, send: Send) -> Result { - Ok(self.0 .0.sends().decrypt(send)?) - } - - /// Decrypt send list - pub fn decrypt_list(&self, sends: Vec) -> Result> { - Ok(self.0 .0.sends().decrypt_list(sends)?) - } - - /// Decrypt a send file in memory - pub fn decrypt_buffer(&self, send: Send, buffer: Vec) -> Result> { - Ok(self.0 .0.sends().decrypt_buffer(send, &buffer)?) - } - - /// Decrypt a send file located in the file system - pub fn decrypt_file( - &self, - send: Send, - encrypted_file_path: String, - decrypted_file_path: String, - ) -> Result<()> { - Ok(self.0 .0.sends().decrypt_file( - send, - Path::new(&encrypted_file_path), - Path::new(&decrypted_file_path), - )?) - } -} diff --git a/crates/bitwarden-uniffi/src/uniffi_support.rs b/crates/bitwarden-uniffi/src/uniffi_support.rs deleted file mode 100644 index 282b03460..000000000 --- a/crates/bitwarden-uniffi/src/uniffi_support.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bitwarden_crypto::{AsymmetricEncString, EncString}; -use uuid::Uuid; - -// Forward the type definitions to the main bitwarden crate -type DateTime = chrono::DateTime; -uniffi::ffi_converter_forward!(DateTime, bitwarden_core::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!(EncString, bitwarden_core::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!( - AsymmetricEncString, - bitwarden_core::UniFfiTag, - crate::UniFfiTag -); -uniffi::ffi_converter_forward!(Uuid, bitwarden_core::UniFfiTag, crate::UniFfiTag); diff --git a/crates/bitwarden-uniffi/src/vault/attachments.rs b/crates/bitwarden-uniffi/src/vault/attachments.rs deleted file mode 100644 index cb2a011a0..000000000 --- a/crates/bitwarden-uniffi/src/vault/attachments.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::{path::Path, sync::Arc}; - -use bitwarden_vault::{ - Attachment, AttachmentEncryptResult, AttachmentView, Cipher, ClientVaultExt, -}; - -use crate::{Client, Result}; - -#[derive(uniffi::Object)] -pub struct ClientAttachments(pub Arc); - -#[uniffi::export] -impl ClientAttachments { - /// Encrypt an attachment file in memory - pub fn encrypt_buffer( - &self, - cipher: Cipher, - attachment: AttachmentView, - buffer: Vec, - ) -> Result { - Ok(self - .0 - .0 - .vault() - .attachments() - .encrypt_buffer(cipher, attachment, &buffer)?) - } - - /// Encrypt an attachment file located in the file system - pub fn encrypt_file( - &self, - cipher: Cipher, - attachment: AttachmentView, - decrypted_file_path: String, - encrypted_file_path: String, - ) -> Result { - Ok(self.0 .0.vault().attachments().encrypt_file( - cipher, - attachment, - Path::new(&decrypted_file_path), - Path::new(&encrypted_file_path), - )?) - } - /// Decrypt an attachment file in memory - pub fn decrypt_buffer( - &self, - cipher: Cipher, - attachment: Attachment, - buffer: Vec, - ) -> Result> { - Ok(self - .0 - .0 - .vault() - .attachments() - .decrypt_buffer(cipher, attachment, &buffer)?) - } - - /// Decrypt an attachment file located in the file system - pub fn decrypt_file( - &self, - cipher: Cipher, - attachment: Attachment, - encrypted_file_path: String, - decrypted_file_path: String, - ) -> Result<()> { - Ok(self.0 .0.vault().attachments().decrypt_file( - cipher, - attachment, - Path::new(&encrypted_file_path), - Path::new(&decrypted_file_path), - )?) - } -} diff --git a/crates/bitwarden-uniffi/src/vault/ciphers.rs b/crates/bitwarden-uniffi/src/vault/ciphers.rs deleted file mode 100644 index 64751b37c..000000000 --- a/crates/bitwarden-uniffi/src/vault/ciphers.rs +++ /dev/null @@ -1,54 +0,0 @@ -use std::sync::Arc; - -use bitwarden_vault::{Cipher, CipherListView, CipherView, ClientVaultExt, Fido2CredentialView}; -use uuid::Uuid; - -use crate::{error::Error, Client, Result}; - -#[derive(uniffi::Object)] -pub struct ClientCiphers(pub Arc); - -#[uniffi::export] -impl ClientCiphers { - /// Encrypt cipher - pub fn encrypt(&self, cipher_view: CipherView) -> Result { - Ok(self.0 .0.vault().ciphers().encrypt(cipher_view)?) - } - - /// Decrypt cipher - pub fn decrypt(&self, cipher: Cipher) -> Result { - Ok(self.0 .0.vault().ciphers().decrypt(cipher)?) - } - - /// Decrypt cipher list - pub fn decrypt_list(&self, ciphers: Vec) -> Result> { - Ok(self.0 .0.vault().ciphers().decrypt_list(ciphers)?) - } - - pub fn decrypt_fido2_credentials( - &self, - cipher_view: CipherView, - ) -> Result> { - Ok(self - .0 - .0 - .vault() - .ciphers() - .decrypt_fido2_credentials(cipher_view)?) - } - - /// Move a cipher to an organization, reencrypting the cipher key if necessary - pub fn move_to_organization( - &self, - cipher: CipherView, - organization_id: Uuid, - ) -> Result { - Ok(self - .0 - .0 - .vault() - .ciphers() - .move_to_organization(cipher, organization_id) - .map_err(Error::Cipher)?) - } -} diff --git a/crates/bitwarden-uniffi/src/vault/collections.rs b/crates/bitwarden-uniffi/src/vault/collections.rs deleted file mode 100644 index 250588e8d..000000000 --- a/crates/bitwarden-uniffi/src/vault/collections.rs +++ /dev/null @@ -1,21 +0,0 @@ -use std::sync::Arc; - -use bitwarden_vault::{ClientVaultExt, Collection, CollectionView}; - -use crate::{Client, Result}; - -#[derive(uniffi::Object)] -pub struct ClientCollections(pub Arc); - -#[uniffi::export] -impl ClientCollections { - /// Decrypt collection - pub fn decrypt(&self, collection: Collection) -> Result { - Ok(self.0 .0.vault().collections().decrypt(collection)?) - } - - /// Decrypt collection list - pub fn decrypt_list(&self, collections: Vec) -> Result> { - Ok(self.0 .0.vault().collections().decrypt_list(collections)?) - } -} diff --git a/crates/bitwarden-uniffi/src/vault/folders.rs b/crates/bitwarden-uniffi/src/vault/folders.rs deleted file mode 100644 index 758d09173..000000000 --- a/crates/bitwarden-uniffi/src/vault/folders.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::sync::Arc; - -use bitwarden_vault::{ClientVaultExt, Folder, FolderView}; - -use crate::{Client, Result}; - -#[derive(uniffi::Object)] -pub struct ClientFolders(pub Arc); - -#[uniffi::export] -impl ClientFolders { - /// Encrypt folder - pub fn encrypt(&self, folder: FolderView) -> Result { - Ok(self.0 .0.vault().folders().encrypt(folder)?) - } - - /// Decrypt folder - pub fn decrypt(&self, folder: Folder) -> Result { - Ok(self.0 .0.vault().folders().decrypt(folder)?) - } - - /// Decrypt folder list - pub fn decrypt_list(&self, folders: Vec) -> Result> { - Ok(self.0 .0.vault().folders().decrypt_list(folders)?) - } -} diff --git a/crates/bitwarden-uniffi/src/vault/mod.rs b/crates/bitwarden-uniffi/src/vault/mod.rs deleted file mode 100644 index cec625e33..000000000 --- a/crates/bitwarden-uniffi/src/vault/mod.rs +++ /dev/null @@ -1,75 +0,0 @@ -use std::sync::Arc; - -use bitwarden_vault::{CipherListView, ClientVaultExt, TotpResponse}; -use chrono::{DateTime, Utc}; - -use crate::{ - error::{Error, Result}, - Client, -}; - -pub mod attachments; -pub mod ciphers; -pub mod collections; -pub mod folders; -pub mod password_history; - -#[derive(uniffi::Object)] -pub struct ClientVault(pub(crate) Arc); - -#[uniffi::export] -impl ClientVault { - /// Folder operations - pub fn folders(self: Arc) -> Arc { - Arc::new(folders::ClientFolders(self.0.clone())) - } - - /// Collections operations - pub fn collections(self: Arc) -> Arc { - Arc::new(collections::ClientCollections(self.0.clone())) - } - - /// Ciphers operations - pub fn ciphers(self: Arc) -> Arc { - Arc::new(ciphers::ClientCiphers(self.0.clone())) - } - - /// Password history operations - pub fn password_history(self: Arc) -> Arc { - Arc::new(password_history::ClientPasswordHistory(self.0.clone())) - } - - /// Attachment file operations - pub fn attachments(self: Arc) -> Arc { - Arc::new(attachments::ClientAttachments(self.0.clone())) - } - - /// Generate a TOTP code from a provided key. - /// - /// The key can be either: - /// - A base32 encoded string - /// - OTP Auth URI - /// - Steam URI - pub fn generate_totp(&self, key: String, time: Option>) -> Result { - Ok(self - .0 - .0 - .vault() - .generate_totp(key, time) - .map_err(Error::Totp)?) - } - - /// Generate a TOTP code from a provided cipher list view. - pub fn generate_totp_cipher_view( - &self, - view: CipherListView, - time: Option>, - ) -> Result { - Ok(self - .0 - .0 - .vault() - .generate_totp_cipher_view(view, time) - .map_err(Error::Totp)?) - } -} diff --git a/crates/bitwarden-uniffi/src/vault/password_history.rs b/crates/bitwarden-uniffi/src/vault/password_history.rs deleted file mode 100644 index 330e91214..000000000 --- a/crates/bitwarden-uniffi/src/vault/password_history.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::sync::Arc; - -use bitwarden_vault::{ClientVaultExt, PasswordHistory, PasswordHistoryView}; - -use crate::{Client, Result}; - -#[derive(uniffi::Object)] -pub struct ClientPasswordHistory(pub Arc); - -#[uniffi::export] -impl ClientPasswordHistory { - /// Encrypt password history - pub fn encrypt(&self, password_history: PasswordHistoryView) -> Result { - Ok(self - .0 - .0 - .vault() - .password_history() - .encrypt(password_history)?) - } - - /// Decrypt password history - pub fn decrypt_list(&self, list: Vec) -> Result> { - Ok(self.0 .0.vault().password_history().decrypt_list(list)?) - } -} diff --git a/crates/bitwarden-uniffi/uniffi.toml b/crates/bitwarden-uniffi/uniffi.toml deleted file mode 100644 index 8abfa33fc..000000000 --- a/crates/bitwarden-uniffi/uniffi.toml +++ /dev/null @@ -1,10 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.sdk" -cdylib_name = "bitwarden_uniffi" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenFFI" -module_name = "BitwardenSDK" -generate_immutable_records = true diff --git a/crates/bitwarden-vault/Cargo.toml b/crates/bitwarden-vault/Cargo.toml deleted file mode 100644 index 3c7757e2f..000000000 --- a/crates/bitwarden-vault/Cargo.toml +++ /dev/null @@ -1,49 +0,0 @@ -[package] -name = "bitwarden-vault" -description = """ -Internal crate for the bitwarden crate. Do not use. -""" - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[features] -uniffi = [ - "bitwarden-core/uniffi", - "bitwarden-crypto/uniffi", - "dep:uniffi", -] # Uniffi bindings -wasm = ["dep:tsify-next", "dep:wasm-bindgen"] # WASM support - -[dependencies] -base64 = ">=0.22.1, <0.23" -bitwarden-api-api = { workspace = true } -bitwarden-core = { workspace = true, features = ["internal"] } -bitwarden-crypto = { workspace = true } -chrono = { workspace = true } -rand = ">=0.8.5, <0.9" -hmac = ">=0.12.1, <0.13" -reqwest = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -serde_repr = { workspace = true } -sha1 = ">=0.10.5, <0.11" -sha2 = ">=0.10.6, <0.11" -thiserror = { workspace = true } -uniffi = { version = "=0.28.1", optional = true } -uuid = { workspace = true } -tsify-next = { workspace = true, optional = true } -wasm-bindgen = { workspace = true, optional = true } - -[dev-dependencies] -tokio = { workspace = true, features = ["rt"] } - -[lints] -workspace = true diff --git a/crates/bitwarden-vault/README.md b/crates/bitwarden-vault/README.md deleted file mode 100644 index 9f3687616..000000000 --- a/crates/bitwarden-vault/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Bitwarden Vault - -This is an internal crate for the Bitwarden SDK do not depend on this directly and use the -[`bitwarden`](https://crates.io/crates/bitwarden) crate instead. - -This crate does not follow semantic versioning and the public interface may change at any time. diff --git a/crates/bitwarden-vault/src/cipher/attachment.rs b/crates/bitwarden-vault/src/cipher/attachment.rs deleted file mode 100644 index d1a058c01..000000000 --- a/crates/bitwarden-vault/src/cipher/attachment.rs +++ /dev/null @@ -1,342 +0,0 @@ -use bitwarden_crypto::{ - CryptoError, EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use super::Cipher; -use crate::VaultParseError; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Attachment { - pub id: Option, - pub url: Option, - pub size: Option, - /// Readable size, ex: "4.2 KB" or "1.43 GB" - pub size_name: Option, - pub file_name: Option, - pub key: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct AttachmentView { - pub id: Option, - pub url: Option, - pub size: Option, - pub size_name: Option, - pub file_name: Option, - pub key: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct AttachmentEncryptResult { - pub attachment: Attachment, - pub contents: Vec, -} - -pub struct AttachmentFile { - pub cipher: Cipher, - pub attachment: Attachment, - - /// There are three different ways attachments are encrypted. - /// 1. UserKey / OrgKey (Contents) - Legacy - /// 2. AttachmentKey(Contents) - Pre CipherKey - /// 3. CipherKey(AttachmentKey(Contents)) - Current - pub contents: EncString, -} - -pub struct AttachmentFileView<'a> { - pub cipher: Cipher, - pub attachment: AttachmentView, - pub contents: &'a [u8], -} - -impl<'a> KeyEncryptable for AttachmentFileView<'a> { - fn encrypt_with_key( - self, - key: &SymmetricCryptoKey, - ) -> Result { - let ciphers_key = Cipher::get_cipher_key(key, &self.cipher.key)?; - let ciphers_key = ciphers_key.as_ref().unwrap_or(key); - - let mut attachment = self.attachment; - - // Because this is a new attachment, we have to generate a key for it, encrypt the contents - // with it, and then encrypt the key with the cipher key - let attachment_key = SymmetricCryptoKey::generate(rand::thread_rng()); - let encrypted_contents = self.contents.encrypt_with_key(&attachment_key)?; - attachment.key = Some(attachment_key.to_vec().encrypt_with_key(ciphers_key)?); - - let contents = encrypted_contents.to_buffer()?; - - // Once we have the encrypted contents, we can set the size of the attachment - attachment.size = Some(contents.len().to_string()); - attachment.size_name = Some(size_name(contents.len())); - - Ok(AttachmentEncryptResult { - attachment: attachment.encrypt_with_key(ciphers_key)?, - contents, - }) - } -} - -fn size_name(size: usize) -> String { - let units = ["Bytes", "KB", "MB", "GB", "TB"]; - let size = size as f64; - let unit = (size.ln() / 1024_f64.ln()).floor() as usize; - let size = size / 1024_f64.powi(unit as i32); - - let size_round = (size * 10.0_f64).round() as usize as f64 / 10.0_f64; - format!("{} {}", size_round, units[unit]) -} - -impl KeyDecryptable> for AttachmentFile { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result, CryptoError> { - let ciphers_key = Cipher::get_cipher_key(key, &self.cipher.key)?; - let ciphers_key = ciphers_key.as_ref().unwrap_or(key); - - // Version 2 or 3, `AttachmentKey` or `CipherKey(AttachmentKey)` - if let Some(attachment_key) = &self.attachment.key { - let mut content_key: Vec = attachment_key.decrypt_with_key(ciphers_key)?; - let content_key = SymmetricCryptoKey::try_from(content_key.as_mut_slice())?; - - self.contents.decrypt_with_key(&content_key) - } else { - // Legacy attachment version 1, use user/org key - self.contents.decrypt_with_key(key) - } - } -} - -impl KeyEncryptable for AttachmentView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Attachment { - id: self.id, - url: self.url, - size: self.size, - size_name: self.size_name, - file_name: self.file_name.encrypt_with_key(key)?, - key: self.key, - }) - } -} - -impl KeyDecryptable for Attachment { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(AttachmentView { - id: self.id.clone(), - url: self.url.clone(), - size: self.size.clone(), - size_name: self.size_name.clone(), - file_name: self.file_name.decrypt_with_key(key)?, - key: self.key.clone(), - }) - } -} - -impl TryFrom for Attachment { - type Error = VaultParseError; - - fn try_from( - attachment: bitwarden_api_api::models::AttachmentResponseModel, - ) -> Result { - Ok(Self { - id: attachment.id, - url: attachment.url, - size: attachment.size, - size_name: attachment.size_name, - file_name: EncString::try_from_optional(attachment.file_name)?, - key: EncString::try_from_optional(attachment.key)?, - }) - } -} - -#[cfg(test)] -mod tests { - use base64::{engine::general_purpose::STANDARD, Engine}; - use bitwarden_crypto::{EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey}; - - use crate::{ - cipher::cipher::{CipherRepromptType, CipherType}, - Attachment, AttachmentFile, AttachmentFileView, AttachmentView, Cipher, - }; - - #[test] - fn test_size_name_conversions() { - assert_eq!(super::size_name(0), "0 Bytes"); - assert_eq!(super::size_name(19), "19 Bytes"); - assert_eq!(super::size_name(1024), "1 KB"); - assert_eq!(super::size_name(1570), "1.5 KB"); - assert_eq!(super::size_name(1024 * 1024), "1 MB"); - assert_eq!(super::size_name(1024 * 18999), "18.6 MB"); - assert_eq!(super::size_name(1024 * 1024 * 1024), "1 GB"); - assert_eq!(super::size_name(1024 * 1024 * 1024 * 1024), "1 TB"); - } - - #[test] - fn test_encrypt_attachment() { - let user_key: SymmetricCryptoKey = "w2LO+nwV4oxwswVYCxlOfRUseXfvU03VzvKQHrqeklPgiMZrspUe6sOBToCnDn9Ay0tuCBn8ykVVRb7PWhub2Q==".to_string().try_into().unwrap(); - - let attachment = AttachmentView { - id: None, - url: None, - size: Some("100".into()), - size_name: Some("100 Bytes".into()), - file_name: Some("Test.txt".into()), - key: None, - }; - - let contents = b"This is a test file that we will encrypt. It's 100 bytes long, the encrypted version will be longer!"; - - let attachment_file = AttachmentFileView { - cipher: Cipher { - id: None, - organization_id: None, - folder_id: None, - collection_ids: Vec::new(), - key: Some("2.Gg8yCM4IIgykCZyq0O4+cA==|GJLBtfvSJTDJh/F7X4cJPkzI6ccnzJm5DYl3yxOW2iUn7DgkkmzoOe61sUhC5dgVdV0kFqsZPcQ0yehlN1DDsFIFtrb4x7LwzJNIkMgxNyg=|1rGkGJ8zcM5o5D0aIIwAyLsjMLrPsP3EWm3CctBO3Fw=".parse().unwrap()), - name: "2.d24xECyEdMZ3MG9s6SrGNw==|XvJlTeu5KJ22M3jKosy6iw==|8xGiQty4X61cDMx6PVqkJfSQ0ZTdA/5L9TpG7QfovoM=".parse().unwrap(), - notes: None, - r#type: CipherType::Login, - login: None, - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: false, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2023-07-24T12:05:09.466666700Z".parse().unwrap(), - deleted_date: None, - revision_date: "2023-07-27T19:28:05.240Z".parse().unwrap(), - }, - attachment, - contents: contents.as_slice(), - }; - - let result = attachment_file.encrypt_with_key(&user_key).unwrap(); - - assert_eq!(result.contents.len(), 161); - assert_eq!(result.attachment.size, Some("161".into())); - assert_eq!(result.attachment.size_name, Some("161 Bytes".into())); - } - - #[test] - fn test_attachment_key() { - let user_key: SymmetricCryptoKey = "w2LO+nwV4oxwswVYCxlOfRUseXfvU03VzvKQHrqeklPgiMZrspUe6sOBToCnDn9Ay0tuCBn8ykVVRb7PWhub2Q==".to_string().try_into().unwrap(); - - let attachment = Attachment { - id: None, - url: None, - size: Some("161".into()), - size_name: Some("161 Bytes".into()), - file_name: Some("2.M3z1MOO9eBG9BWRTEUbPog==|jPw0By1AakHDfoaY8UOwOQ==|eP9/J1583OJpHsSM4ZnXZzdBHfqVTXnOXGlkkmAKSfA=".parse().unwrap()), - key: Some("2.r288/AOSPiaLFkW07EBGBw==|SAmnnCbOLFjX5lnURvoualOetQwuyPc54PAmHDTRrhT0gwO9ailna9U09q9bmBfI5XrjNNEsuXssgzNygRkezoVQvZQggZddOwHB6KQW5EQ=|erIMUJp8j+aTcmhdE50zEX+ipv/eR1sZ7EwULJm/6DY=".parse().unwrap()) - }; - - let cipher = Cipher { - id: None, - organization_id: None, - folder_id: None, - collection_ids: Vec::new(), - key: Some("2.Gg8yCM4IIgykCZyq0O4+cA==|GJLBtfvSJTDJh/F7X4cJPkzI6ccnzJm5DYl3yxOW2iUn7DgkkmzoOe61sUhC5dgVdV0kFqsZPcQ0yehlN1DDsFIFtrb4x7LwzJNIkMgxNyg=|1rGkGJ8zcM5o5D0aIIwAyLsjMLrPsP3EWm3CctBO3Fw=".parse().unwrap()), - name: "2.d24xECyEdMZ3MG9s6SrGNw==|XvJlTeu5KJ22M3jKosy6iw==|8xGiQty4X61cDMx6PVqkJfSQ0ZTdA/5L9TpG7QfovoM=".parse().unwrap(), - notes: None, - r#type: CipherType::Login, - login: None, - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: false, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2023-07-24T12:05:09.466666700Z".parse().unwrap(), - deleted_date: None, - revision_date: "2023-07-27T19:28:05.240Z".parse().unwrap(), - }; - - let enc_file = STANDARD.decode(b"Ao00qr1xLsV+ZNQpYZ/UwEwOWo3hheKwCYcOGIbsorZ6JIG2vLWfWEXCVqP0hDuzRvmx8otApNZr8pJYLNwCe1aQ+ySHQYGkdubFjoMojulMbQ959Y4SJ6Its/EnVvpbDnxpXTDpbutDxyhxfq1P3lstL2G9rObJRrxiwdGlRGu1h94UA1fCCkIUQux5LcqUee6W4MyQmRnsUziH8gGzmtI=").unwrap(); - let original = STANDARD.decode(b"rMweTemxOL9D0iWWfRxiY3enxiZ5IrwWD6ef2apGO6MvgdGhy2fpwmATmn7BpSj9lRumddLLXm7u8zSp6hnXt1hS71YDNh78LjGKGhGL4sbg8uNnpa/I6GK/83jzqGYN7+ESbg==").unwrap(); - - let dec = AttachmentFile { - cipher, - attachment, - contents: EncString::from_buffer(&enc_file).unwrap(), - } - .decrypt_with_key(&user_key) - .unwrap(); - - assert_eq!(dec, original); - } - - #[test] - fn test_attachment_without_key() { - let user_key: SymmetricCryptoKey = "w2LO+nwV4oxwswVYCxlOfRUseXfvU03VzvKQHrqeklPgiMZrspUe6sOBToCnDn9Ay0tuCBn8ykVVRb7PWhub2Q==".to_string().try_into().unwrap(); - - let attachment = Attachment { - id: None, - url: None, - size: Some("161".into()), - size_name: Some("161 Bytes".into()), - file_name: Some("2.qTJdrgQe+tLCHTlPHMJXLw==|0we9+uYJPEY3FU5SblX2hg==|+fL/wTF/WgpoV+BNzmsmi284O0QNdVBUYmfqqs0CG1E=".parse().unwrap()), - key: None, - }; - - let cipher = Cipher { - id: None, - organization_id: None, - folder_id: None, - collection_ids: Vec::new(), - key: None, - name: "2.d24xECyEdMZ3MG9s6SrGNw==|XvJlTeu5KJ22M3jKosy6iw==|8xGiQty4X61cDMx6PVqkJfSQ0ZTdA/5L9TpG7QfovoM=".parse().unwrap(), - notes: None, - r#type: CipherType::Login, - login: None, - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: false, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2023-07-24T12:05:09.466666700Z".parse().unwrap(), - deleted_date: None, - revision_date: "2023-07-27T19:28:05.240Z".parse().unwrap(), - }; - - let enc_file = STANDARD.decode(b"AsQLXOBHrJ8porroTUlPxeJOm9XID7LL9D2+KwYATXEpR1EFjLBpcCvMmnqcnYLXIEefe9TCeY4Us50ux43kRSpvdB7YkjxDKV0O1/y6tB7qC4vvv9J9+O/uDEnMx/9yXuEhAW/LA/TsU/WAgxkOM0uTvm8JdD9LUR1z9Ql7zOWycMVzkvGsk2KBNcqAdrotS5FlDftZOXyU8pWecNeyA/w=").unwrap(); - let original = STANDARD.decode(b"rMweTemxOL9D0iWWfRxiY3enxiZ5IrwWD6ef2apGO6MvgdGhy2fpwmATmn7BpSj9lRumddLLXm7u8zSp6hnXt1hS71YDNh78LjGKGhGL4sbg8uNnpa/I6GK/83jzqGYN7+ESbg==").unwrap(); - - let dec = AttachmentFile { - cipher, - attachment, - contents: EncString::from_buffer(&enc_file).unwrap(), - } - .decrypt_with_key(&user_key) - .unwrap(); - - assert_eq!(dec, original); - } -} diff --git a/crates/bitwarden-vault/src/cipher/card.rs b/crates/bitwarden-vault/src/cipher/card.rs deleted file mode 100644 index 5a2396d92..000000000 --- a/crates/bitwarden-vault/src/cipher/card.rs +++ /dev/null @@ -1,73 +0,0 @@ -use bitwarden_api_api::models::CipherCardModel; -use bitwarden_crypto::{ - CryptoError, EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::VaultParseError; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Card { - pub cardholder_name: Option, - pub exp_month: Option, - pub exp_year: Option, - pub code: Option, - pub brand: Option, - pub number: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct CardView { - pub cardholder_name: Option, - pub exp_month: Option, - pub exp_year: Option, - pub code: Option, - pub brand: Option, - pub number: Option, -} - -impl KeyEncryptable for CardView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Card { - cardholder_name: self.cardholder_name.encrypt_with_key(key)?, - exp_month: self.exp_month.encrypt_with_key(key)?, - exp_year: self.exp_year.encrypt_with_key(key)?, - code: self.code.encrypt_with_key(key)?, - brand: self.brand.encrypt_with_key(key)?, - number: self.number.encrypt_with_key(key)?, - }) - } -} - -impl KeyDecryptable for Card { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(CardView { - cardholder_name: self.cardholder_name.decrypt_with_key(key).ok().flatten(), - exp_month: self.exp_month.decrypt_with_key(key).ok().flatten(), - exp_year: self.exp_year.decrypt_with_key(key).ok().flatten(), - code: self.code.decrypt_with_key(key).ok().flatten(), - brand: self.brand.decrypt_with_key(key).ok().flatten(), - number: self.number.decrypt_with_key(key).ok().flatten(), - }) - } -} - -impl TryFrom for Card { - type Error = VaultParseError; - - fn try_from(card: CipherCardModel) -> Result { - Ok(Self { - cardholder_name: EncString::try_from_optional(card.cardholder_name)?, - exp_month: EncString::try_from_optional(card.exp_month)?, - exp_year: EncString::try_from_optional(card.exp_year)?, - code: EncString::try_from_optional(card.code)?, - brand: EncString::try_from_optional(card.brand)?, - number: EncString::try_from_optional(card.number)?, - }) - } -} diff --git a/crates/bitwarden-vault/src/cipher/cipher.rs b/crates/bitwarden-vault/src/cipher/cipher.rs deleted file mode 100644 index 8ac4bfe79..000000000 --- a/crates/bitwarden-vault/src/cipher/cipher.rs +++ /dev/null @@ -1,1162 +0,0 @@ -use bitwarden_api_api::models::CipherDetailsResponseModel; -use bitwarden_core::{require, MissingFieldError, VaultLocked}; -use bitwarden_crypto::{ - CryptoError, EncString, KeyContainer, KeyDecryptable, KeyEncryptable, LocateKey, - SymmetricCryptoKey, -}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; -use thiserror::Error; -use uuid::Uuid; - -use super::{ - attachment, card, field, identity, - local_data::{LocalData, LocalDataView}, - secure_note, -}; -use crate::{ - password_history, Fido2CredentialFullView, Fido2CredentialView, Login, LoginView, - VaultParseError, -}; - -#[derive(Debug, Error)] -pub enum CipherError { - #[error(transparent)] - MissingFieldError(#[from] MissingFieldError), - #[error(transparent)] - VaultLocked(#[from] VaultLocked), - #[error(transparent)] - CryptoError(#[from] CryptoError), - #[error("This cipher contains attachments without keys. Those attachments will need to be reuploaded to complete the operation")] - AttachmentsWithoutKeys, -} - -#[derive(Clone, Copy, Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u8)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum CipherType { - Login = 1, - SecureNote = 2, - Card = 3, - Identity = 4, -} - -#[derive(Clone, Copy, Serialize_repr, Deserialize_repr, Debug, JsonSchema, PartialEq)] -#[repr(u8)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum CipherRepromptType { - None = 0, - Password = 1, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Cipher { - pub id: Option, - pub organization_id: Option, - pub folder_id: Option, - pub collection_ids: Vec, - - /// More recent ciphers uses individual encryption keys to encrypt the other fields of the - /// Cipher. - pub key: Option, - - pub name: EncString, - pub notes: Option, - - pub r#type: CipherType, - pub login: Option, - pub identity: Option, - pub card: Option, - pub secure_note: Option, - - pub favorite: bool, - pub reprompt: CipherRepromptType, - pub organization_use_totp: bool, - pub edit: bool, - pub view_password: bool, - pub local_data: Option, - - pub attachments: Option>, - pub fields: Option>, - pub password_history: Option>, - - pub creation_date: DateTime, - pub deleted_date: Option>, - pub revision_date: DateTime, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct CipherView { - pub id: Option, - pub organization_id: Option, - pub folder_id: Option, - pub collection_ids: Vec, - - /// Temporary, required to support re-encrypting existing items. - pub key: Option, - - pub name: String, - pub notes: Option, - - pub r#type: CipherType, - pub login: Option, - pub identity: Option, - pub card: Option, - pub secure_note: Option, - - pub favorite: bool, - pub reprompt: CipherRepromptType, - pub organization_use_totp: bool, - pub edit: bool, - pub view_password: bool, - pub local_data: Option, - - pub attachments: Option>, - pub fields: Option>, - pub password_history: Option>, - - pub creation_date: DateTime, - pub deleted_date: Option>, - pub revision_date: DateTime, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, PartialEq)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum CipherListViewType { - Login { - has_fido2: bool, - totp: Option, - }, - SecureNote, - Card, - Identity, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, PartialEq)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct CipherListView { - pub id: Option, - pub organization_id: Option, - pub folder_id: Option, - pub collection_ids: Vec, - - /// Temporary, required to support calculating TOTP from CipherListView. - pub key: Option, - - pub name: String, - pub sub_title: String, - - pub r#type: CipherListViewType, - - pub favorite: bool, - pub reprompt: CipherRepromptType, - pub edit: bool, - pub view_password: bool, - - /// The number of attachments - pub attachments: u32, - - pub creation_date: DateTime, - pub deleted_date: Option>, - pub revision_date: DateTime, -} - -impl CipherListView { - pub(crate) fn get_totp_key( - self, - enc: &dyn KeyContainer, - ) -> Result, CryptoError> { - let key = self.locate_key(enc, &None)?; - let cipher_key = Cipher::get_cipher_key(key, &self.key)?; - let key = cipher_key.as_ref().unwrap_or(key); - - let totp = if let CipherListViewType::Login { totp, .. } = self.r#type { - totp.decrypt_with_key(key)? - } else { - None - }; - - Ok(totp) - } -} - -impl KeyEncryptable for CipherView { - fn encrypt_with_key(mut self, key: &SymmetricCryptoKey) -> Result { - let ciphers_key = Cipher::get_cipher_key(key, &self.key)?; - let key = ciphers_key.as_ref().unwrap_or(key); - - // For compatibility reasons, we only create checksums for ciphers that have a key - if ciphers_key.is_some() { - self.generate_checksums(); - } - - Ok(Cipher { - id: self.id, - organization_id: self.organization_id, - folder_id: self.folder_id, - collection_ids: self.collection_ids, - key: self.key, - name: self.name.encrypt_with_key(key)?, - notes: self.notes.encrypt_with_key(key)?, - r#type: self.r#type, - login: self.login.encrypt_with_key(key)?, - identity: self.identity.encrypt_with_key(key)?, - card: self.card.encrypt_with_key(key)?, - secure_note: self.secure_note.encrypt_with_key(key)?, - favorite: self.favorite, - reprompt: self.reprompt, - organization_use_totp: self.organization_use_totp, - edit: self.edit, - view_password: self.view_password, - local_data: self.local_data.encrypt_with_key(key)?, - attachments: self.attachments.encrypt_with_key(key)?, - fields: self.fields.encrypt_with_key(key)?, - password_history: self.password_history.encrypt_with_key(key)?, - creation_date: self.creation_date, - deleted_date: self.deleted_date, - revision_date: self.revision_date, - }) - } -} - -impl KeyDecryptable for Cipher { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - let ciphers_key = Cipher::get_cipher_key(key, &self.key)?; - let key = ciphers_key.as_ref().unwrap_or(key); - - let mut cipher = CipherView { - id: self.id, - organization_id: self.organization_id, - folder_id: self.folder_id, - collection_ids: self.collection_ids.clone(), - key: self.key.clone(), - name: self.name.decrypt_with_key(key).ok().unwrap_or_default(), - notes: self.notes.decrypt_with_key(key).ok().flatten(), - r#type: self.r#type, - login: self.login.decrypt_with_key(key).ok().flatten(), - identity: self.identity.decrypt_with_key(key).ok().flatten(), - card: self.card.decrypt_with_key(key).ok().flatten(), - secure_note: self.secure_note.decrypt_with_key(key).ok().flatten(), - favorite: self.favorite, - reprompt: self.reprompt, - organization_use_totp: self.organization_use_totp, - edit: self.edit, - view_password: self.view_password, - local_data: self.local_data.decrypt_with_key(key).ok().flatten(), - attachments: self.attachments.decrypt_with_key(key).ok().flatten(), - fields: self.fields.decrypt_with_key(key).ok().flatten(), - password_history: self.password_history.decrypt_with_key(key).ok().flatten(), - creation_date: self.creation_date, - deleted_date: self.deleted_date, - revision_date: self.revision_date, - }; - - // For compatibility we only remove URLs with invalid checksums if the cipher has a key - if ciphers_key.is_some() { - cipher.remove_invalid_checksums(); - } - - Ok(cipher) - } -} - -impl Cipher { - /// Get the decrypted individual encryption key for this cipher. - /// Note that some ciphers do not have individual encryption keys, - /// in which case this will return Ok(None) and the key associated - /// with this cipher's user or organization must be used instead - pub(super) fn get_cipher_key( - key: &SymmetricCryptoKey, - ciphers_key: &Option, - ) -> Result, CryptoError> { - ciphers_key - .as_ref() - .map(|k| { - let mut key: Vec = k.decrypt_with_key(key)?; - SymmetricCryptoKey::try_from(key.as_mut_slice()) - }) - .transpose() - } - - fn get_decrypted_subtitle(&self, key: &SymmetricCryptoKey) -> Result { - Ok(match self.r#type { - CipherType::Login => { - let Some(login) = &self.login else { - return Ok(String::new()); - }; - login.username.decrypt_with_key(key)?.unwrap_or_default() - } - CipherType::SecureNote => String::new(), - CipherType::Card => { - let Some(card) = &self.card else { - return Ok(String::new()); - }; - - build_subtitle_card( - card.brand - .as_ref() - .map(|b| b.decrypt_with_key(key)) - .transpose()?, - card.number - .as_ref() - .map(|n| n.decrypt_with_key(key)) - .transpose()?, - ) - } - CipherType::Identity => { - let Some(identity) = &self.identity else { - return Ok(String::new()); - }; - - build_subtitle_identity( - identity - .first_name - .as_ref() - .map(|f| f.decrypt_with_key(key)) - .transpose()?, - identity - .last_name - .as_ref() - .map(|l| l.decrypt_with_key(key)) - .transpose()?, - ) - } - }) - } -} - -/// Builds the subtitle for a card cipher -fn build_subtitle_card(brand: Option, number: Option) -> String { - // Attempt to pre-allocate the string with the expected max-size - let mut sub_title = - String::with_capacity(brand.as_ref().map(|b| b.len()).unwrap_or_default() + 8); - - if let Some(brand) = brand { - sub_title.push_str(&brand); - } - - if let Some(number) = number { - let number_len = number.len(); - if number_len > 4 { - if !sub_title.is_empty() { - sub_title.push_str(", "); - } - - // On AMEX cards we show 5 digits instead of 4 - let digit_count = match &number[0..2] { - "34" | "37" => 5, - _ => 4, - }; - - sub_title.push('*'); - sub_title.push_str(&number[(number_len - digit_count)..]); - } - } - - sub_title -} - -/// Builds the subtitle for a card cipher -fn build_subtitle_identity(first_name: Option, last_name: Option) -> String { - let len = match (first_name.as_ref(), last_name.as_ref()) { - (Some(first_name), Some(last_name)) => first_name.len() + last_name.len() + 1, - (Some(first_name), None) => first_name.len(), - (None, Some(last_name)) => last_name.len(), - (None, None) => 0, - }; - - let mut sub_title = String::with_capacity(len); - - if let Some(first_name) = &first_name { - sub_title.push_str(first_name); - } - - if let Some(last_name) = &last_name { - if !sub_title.is_empty() { - sub_title.push(' '); - } - sub_title.push_str(last_name); - } - - sub_title -} - -impl CipherView { - pub fn generate_cipher_key(&mut self, key: &SymmetricCryptoKey) -> Result<(), CryptoError> { - let old_ciphers_key = Cipher::get_cipher_key(key, &self.key)?; - let old_key = old_ciphers_key.as_ref().unwrap_or(key); - - let new_key = SymmetricCryptoKey::generate(rand::thread_rng()); - - self.reencrypt_attachment_keys(old_key, &new_key)?; - self.reencrypt_fido2_credentials(old_key, &new_key)?; - - self.key = Some(new_key.to_vec().encrypt_with_key(key)?); - Ok(()) - } - - pub fn generate_checksums(&mut self) { - if let Some(uris) = self.login.as_mut().and_then(|l| l.uris.as_mut()) { - for uri in uris { - uri.generate_checksum(); - } - } - } - - pub fn remove_invalid_checksums(&mut self) { - if let Some(uris) = self.login.as_mut().and_then(|l| l.uris.as_mut()) { - uris.retain(|u| u.is_checksum_valid()); - } - } - - fn reencrypt_attachment_keys( - &mut self, - old_key: &SymmetricCryptoKey, - new_key: &SymmetricCryptoKey, - ) -> Result<(), CryptoError> { - if let Some(attachments) = &mut self.attachments { - for attachment in attachments { - if let Some(attachment_key) = &mut attachment.key { - let dec_attachment_key: Vec = attachment_key.decrypt_with_key(old_key)?; - *attachment_key = dec_attachment_key.encrypt_with_key(new_key)?; - } - } - } - Ok(()) - } - - pub fn decrypt_fido2_credentials( - &self, - enc: &dyn KeyContainer, - ) -> Result, CipherError> { - let key = self.locate_key(enc, &None)?; - let cipher_key = Cipher::get_cipher_key(key, &self.key)?; - - let key = cipher_key.as_ref().unwrap_or(key); - - Ok(self - .login - .as_ref() - .and_then(|l| l.fido2_credentials.as_ref()) - .map(|f| f.decrypt_with_key(key)) - .transpose()? - .unwrap_or_default()) - } - - fn reencrypt_fido2_credentials( - &mut self, - old_key: &SymmetricCryptoKey, - new_key: &SymmetricCryptoKey, - ) -> Result<(), CryptoError> { - if let Some(login) = self.login.as_mut() { - if let Some(fido2_credentials) = &mut login.fido2_credentials { - let dec_fido2_credentials: Vec = - fido2_credentials.decrypt_with_key(old_key)?; - *fido2_credentials = dec_fido2_credentials.encrypt_with_key(new_key)?; - } - } - Ok(()) - } - - pub fn move_to_organization( - &mut self, - enc: &dyn KeyContainer, - organization_id: Uuid, - ) -> Result<(), CipherError> { - let old_key = enc.get_key(&self.organization_id)?; - - let new_key = enc.get_key(&Some(organization_id))?; - - // If any attachment is missing a key we can't reencrypt the attachment keys - if self.attachments.iter().flatten().any(|a| a.key.is_none()) { - return Err(CipherError::AttachmentsWithoutKeys); - } - - // If the cipher has a key, we need to re-encrypt it with the new organization key - if let Some(cipher_key) = &mut self.key { - let dec_cipher_key: Vec = cipher_key.decrypt_with_key(old_key)?; - *cipher_key = dec_cipher_key.encrypt_with_key(new_key)?; - } else { - // If the cipher does not have a key, we need to reencrypt all attachment keys - self.reencrypt_attachment_keys(old_key, new_key)?; - self.reencrypt_fido2_credentials(old_key, new_key)?; - } - - self.organization_id = Some(organization_id); - Ok(()) - } - - pub fn set_new_fido2_credentials( - &mut self, - enc: &dyn KeyContainer, - creds: Vec, - ) -> Result<(), CipherError> { - let key = enc.get_key(&self.organization_id)?; - - let ciphers_key = Cipher::get_cipher_key(key, &self.key)?; - let ciphers_key = ciphers_key.as_ref().unwrap_or(key); - - require!(self.login.as_mut()).fido2_credentials = - Some(creds.encrypt_with_key(ciphers_key)?); - - Ok(()) - } - - pub fn get_fido2_credentials( - &self, - enc: &dyn KeyContainer, - ) -> Result, CipherError> { - let key = enc.get_key(&self.organization_id)?; - - let ciphers_key = Cipher::get_cipher_key(key, &self.key)?; - let ciphers_key = ciphers_key.as_ref().unwrap_or(key); - - let login = require!(self.login.as_ref()); - let creds = require!(login.fido2_credentials.as_ref()); - let res = creds.decrypt_with_key(ciphers_key)?; - Ok(res) - } -} - -impl KeyDecryptable for Cipher { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - let ciphers_key = Cipher::get_cipher_key(key, &self.key)?; - let key = ciphers_key.as_ref().unwrap_or(key); - - Ok(CipherListView { - id: self.id, - organization_id: self.organization_id, - folder_id: self.folder_id, - collection_ids: self.collection_ids.clone(), - key: self.key.clone(), - name: self.name.decrypt_with_key(key).ok().unwrap_or_default(), - sub_title: self.get_decrypted_subtitle(key).ok().unwrap_or_default(), - r#type: match self.r#type { - CipherType::Login => { - let login = self - .login - .as_ref() - .ok_or(CryptoError::MissingField("login"))?; - CipherListViewType::Login { - has_fido2: login.fido2_credentials.is_some(), - totp: login.totp.clone(), - } - } - CipherType::SecureNote => CipherListViewType::SecureNote, - CipherType::Card => CipherListViewType::Card, - CipherType::Identity => CipherListViewType::Identity, - }, - favorite: self.favorite, - reprompt: self.reprompt, - edit: self.edit, - view_password: self.view_password, - attachments: self - .attachments - .as_ref() - .map(|a| a.len() as u32) - .unwrap_or(0), - creation_date: self.creation_date, - deleted_date: self.deleted_date, - revision_date: self.revision_date, - }) - } -} - -impl LocateKey for Cipher { - fn locate_key<'a>( - &self, - enc: &'a dyn KeyContainer, - _: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - enc.get_key(&self.organization_id) - } -} -impl LocateKey for CipherView { - fn locate_key<'a>( - &self, - enc: &'a dyn KeyContainer, - _: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - enc.get_key(&self.organization_id) - } -} -impl LocateKey for CipherListView { - fn locate_key<'a>( - &self, - enc: &'a dyn KeyContainer, - _: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - enc.get_key(&self.organization_id) - } -} - -impl TryFrom for Cipher { - type Error = VaultParseError; - - fn try_from(cipher: CipherDetailsResponseModel) -> Result { - Ok(Self { - id: cipher.id, - organization_id: cipher.organization_id, - folder_id: cipher.folder_id, - collection_ids: cipher.collection_ids.unwrap_or_default(), - name: require!(EncString::try_from_optional(cipher.name)?), - notes: EncString::try_from_optional(cipher.notes)?, - r#type: require!(cipher.r#type).into(), - login: cipher.login.map(|l| (*l).try_into()).transpose()?, - identity: cipher.identity.map(|i| (*i).try_into()).transpose()?, - card: cipher.card.map(|c| (*c).try_into()).transpose()?, - secure_note: cipher.secure_note.map(|s| (*s).try_into()).transpose()?, - favorite: cipher.favorite.unwrap_or(false), - reprompt: cipher - .reprompt - .map(|r| r.into()) - .unwrap_or(CipherRepromptType::None), - organization_use_totp: cipher.organization_use_totp.unwrap_or(true), - edit: cipher.edit.unwrap_or(true), - view_password: cipher.view_password.unwrap_or(true), - local_data: None, // Not sent from server - attachments: cipher - .attachments - .map(|a| a.into_iter().map(|a| a.try_into()).collect()) - .transpose()?, - fields: cipher - .fields - .map(|f| f.into_iter().map(|f| f.try_into()).collect()) - .transpose()?, - password_history: cipher - .password_history - .map(|p| p.into_iter().map(|p| p.try_into()).collect()) - .transpose()?, - creation_date: require!(cipher.creation_date).parse()?, - deleted_date: cipher.deleted_date.map(|d| d.parse()).transpose()?, - revision_date: require!(cipher.revision_date).parse()?, - key: EncString::try_from_optional(cipher.key)?, - }) - } -} - -impl From for CipherType { - fn from(t: bitwarden_api_api::models::CipherType) -> Self { - match t { - bitwarden_api_api::models::CipherType::Login => CipherType::Login, - bitwarden_api_api::models::CipherType::SecureNote => CipherType::SecureNote, - bitwarden_api_api::models::CipherType::Card => CipherType::Card, - bitwarden_api_api::models::CipherType::Identity => CipherType::Identity, - } - } -} - -impl From for CipherRepromptType { - fn from(t: bitwarden_api_api::models::CipherRepromptType) -> Self { - match t { - bitwarden_api_api::models::CipherRepromptType::None => CipherRepromptType::None, - bitwarden_api_api::models::CipherRepromptType::Password => CipherRepromptType::Password, - } - } -} - -#[cfg(test)] -mod tests { - - use std::collections::HashMap; - - use attachment::AttachmentView; - - use super::*; - use crate::Fido2Credential; - - fn generate_cipher() -> CipherView { - CipherView { - r#type: CipherType::Login, - login: Some(LoginView { - username: Some("test_username".to_string()), - password: Some("test_password".to_string()), - password_revision_date: None, - uris: None, - totp: None, - autofill_on_page_load: None, - fido2_credentials: None, - }), - id: "fd411a1a-fec8-4070-985d-0e6560860e69".parse().ok(), - organization_id: None, - folder_id: None, - collection_ids: vec![], - key: None, - name: "My test login".to_string(), - notes: None, - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: true, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - deleted_date: None, - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - } - } - - fn generate_fido2(key: &SymmetricCryptoKey) -> Fido2Credential { - Fido2Credential { - credential_id: "123".to_string().encrypt_with_key(key).unwrap(), - key_type: "public-key".to_string().encrypt_with_key(key).unwrap(), - key_algorithm: "ECDSA".to_string().encrypt_with_key(key).unwrap(), - key_curve: "P-256".to_string().encrypt_with_key(key).unwrap(), - key_value: "123".to_string().encrypt_with_key(key).unwrap(), - rp_id: "123".to_string().encrypt_with_key(key).unwrap(), - user_handle: None, - user_name: None, - counter: "123".to_string().encrypt_with_key(key).unwrap(), - rp_name: None, - user_display_name: None, - discoverable: "true".to_string().encrypt_with_key(key).unwrap(), - creation_date: "2024-06-07T14:12:36.150Z".parse().unwrap(), - } - } - - #[test] - fn test_decrypt_cipher_list_view() { - let key: SymmetricCryptoKey = "w2LO+nwV4oxwswVYCxlOfRUseXfvU03VzvKQHrqeklPgiMZrspUe6sOBToCnDn9Ay0tuCBn8ykVVRb7PWhub2Q==".to_string().try_into().unwrap(); - - let cipher = Cipher { - id: Some("090c19ea-a61a-4df6-8963-262b97bc6266".parse().unwrap()), - organization_id: None, - folder_id: None, - collection_ids: vec![], - key: None, - name: "2.d3rzo0P8rxV9Hs1m1BmAjw==|JOwna6i0zs+K7ZghwrZRuw==|SJqKreLag1ID+g6H1OdmQr0T5zTrVWKzD6hGy3fDqB0=".parse().unwrap(), - notes: None, - r#type: CipherType::Login, - login: Some(Login { - username: Some("2.EBNGgnaMHeO/kYnI3A0jiA==|9YXlrgABP71ebZ5umurCJQ==|GDk5jxiqTYaU7e2AStCFGX+a1kgCIk8j0NEli7Jn0L4=".parse().unwrap()), - password: Some("2.M7ZJ7EuFDXCq66gDTIyRIg==|B1V+jroo6+m/dpHx6g8DxA==|PIXPBCwyJ1ady36a7jbcLg346pm/7N/06W4UZxc1TUo=".parse().unwrap()), - password_revision_date: None, - uris: None, - totp: Some("2.hqdioUAc81FsKQmO1XuLQg==|oDRdsJrQjoFu9NrFVy8tcJBAFKBx95gHaXZnWdXbKpsxWnOr2sKipIG43pKKUFuq|3gKZMiboceIB5SLVOULKg2iuyu6xzos22dfJbvx0EHk=".parse().unwrap()), - autofill_on_page_load: None, - fido2_credentials: Some(vec![generate_fido2(&key)]), - }), - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: false, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - deleted_date: None, - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - }; - - let view: CipherListView = cipher.decrypt_with_key(&key).unwrap(); - - assert_eq!( - view, - CipherListView { - id: cipher.id, - organization_id: cipher.organization_id, - folder_id: cipher.folder_id, - collection_ids: cipher.collection_ids, - key: cipher.key, - name: "My test login".to_string(), - sub_title: "test_username".to_string(), - r#type: CipherListViewType::Login { - has_fido2: true, - totp: cipher.login.as_ref().unwrap().totp.clone() - }, - favorite: cipher.favorite, - reprompt: cipher.reprompt, - edit: cipher.edit, - view_password: cipher.view_password, - attachments: 0, - creation_date: cipher.creation_date, - deleted_date: cipher.deleted_date, - revision_date: cipher.revision_date - } - ) - } - - #[test] - fn test_generate_cipher_key() { - let key = SymmetricCryptoKey::generate(rand::thread_rng()); - - let original_cipher = generate_cipher(); - - // Check that the cipher gets encrypted correctly without it's own key - let cipher = generate_cipher(); - let no_key_cipher_enc = cipher.encrypt_with_key(&key).unwrap(); - let no_key_cipher_dec: CipherView = no_key_cipher_enc.decrypt_with_key(&key).unwrap(); - assert!(no_key_cipher_dec.key.is_none()); - assert_eq!(no_key_cipher_dec.name, original_cipher.name); - - let mut cipher = generate_cipher(); - cipher.generate_cipher_key(&key).unwrap(); - - // Check that the cipher gets encrypted correctly when it's assigned it's own key - let key_cipher_enc = cipher.encrypt_with_key(&key).unwrap(); - let key_cipher_dec: CipherView = key_cipher_enc.decrypt_with_key(&key).unwrap(); - assert!(key_cipher_dec.key.is_some()); - assert_eq!(key_cipher_dec.name, original_cipher.name); - } - - #[test] - fn test_generate_cipher_key_when_a_cipher_key_already_exists() { - let key = SymmetricCryptoKey::generate(rand::thread_rng()); - - let cipher_key = SymmetricCryptoKey::generate(rand::thread_rng()); - let cipher_key = cipher_key.to_vec().encrypt_with_key(&key).unwrap(); - - let mut original_cipher = generate_cipher(); - original_cipher.key = Some(cipher_key.clone()); - - original_cipher.generate_cipher_key(&key).unwrap(); - - // Make sure that the cipher key is decryptable - let _: Vec = original_cipher.key.unwrap().decrypt_with_key(&key).unwrap(); - } - - #[test] - fn test_generate_cipher_key_ignores_attachments_without_key() { - let key = SymmetricCryptoKey::generate(rand::thread_rng()); - - let mut cipher = generate_cipher(); - let attachment = AttachmentView { - id: None, - url: None, - size: None, - size_name: None, - file_name: Some("Attachment test name".into()), - key: None, - }; - cipher.attachments = Some(vec![attachment]); - - cipher.generate_cipher_key(&key).unwrap(); - assert!(cipher.attachments.unwrap()[0].key.is_none()); - } - - struct MockKeyContainer(HashMap, SymmetricCryptoKey>); - impl KeyContainer for MockKeyContainer { - fn get_key<'a>( - &'a self, - org_id: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - self.0 - .get(org_id) - .ok_or(CryptoError::MissingKey(org_id.unwrap_or_default())) - } - } - - #[test] - fn test_move_user_cipher_to_org() { - let org = uuid::Uuid::new_v4(); - - let enc = MockKeyContainer(HashMap::from([ - (None, SymmetricCryptoKey::generate(rand::thread_rng())), - (Some(org), SymmetricCryptoKey::generate(rand::thread_rng())), - ])); - - // Create a cipher with a user key - let mut cipher = generate_cipher(); - cipher - .generate_cipher_key(enc.get_key(&None).unwrap()) - .unwrap(); - - cipher.move_to_organization(&enc, org).unwrap(); - assert_eq!(cipher.organization_id, Some(org)); - - // Check that the cipher can be encrypted/decrypted with the new org key - let org_key = enc.get_key(&Some(org)).unwrap(); - let cipher_enc = cipher.encrypt_with_key(org_key).unwrap(); - let cipher_dec: CipherView = cipher_enc.decrypt_with_key(org_key).unwrap(); - - assert_eq!(cipher_dec.name, "My test login"); - } - - #[test] - fn test_move_user_cipher_to_org_manually() { - let org = uuid::Uuid::new_v4(); - - let enc = MockKeyContainer(HashMap::from([ - (None, SymmetricCryptoKey::generate(rand::thread_rng())), - (Some(org), SymmetricCryptoKey::generate(rand::thread_rng())), - ])); - - // Create a cipher with a user key - let mut cipher = generate_cipher(); - cipher - .generate_cipher_key(enc.get_key(&None).unwrap()) - .unwrap(); - - cipher.organization_id = Some(org); - - // Check that the cipher can not be encrypted, as the - // cipher key is tied to the user key and not the org key - let org_key = enc.get_key(&Some(org)).unwrap(); - assert!(cipher.encrypt_with_key(org_key).is_err()); - } - - #[test] - fn test_move_user_cipher_with_attachment_without_key_to_org() { - let org = uuid::Uuid::new_v4(); - - let enc = MockKeyContainer(HashMap::from([ - (None, SymmetricCryptoKey::generate(rand::thread_rng())), - (Some(org), SymmetricCryptoKey::generate(rand::thread_rng())), - ])); - - let mut cipher = generate_cipher(); - let attachment = AttachmentView { - id: None, - url: None, - size: None, - size_name: None, - file_name: Some("Attachment test name".into()), - key: None, - }; - cipher.attachments = Some(vec![attachment]); - - // Neither cipher nor attachment have keys, so the cipher can't be moved - assert!(cipher.move_to_organization(&enc, org).is_err()); - } - - #[test] - fn test_move_user_cipher_with_attachment_with_key_to_org() { - let org = uuid::Uuid::new_v4(); - - let enc = MockKeyContainer(HashMap::from([ - (None, SymmetricCryptoKey::generate(rand::thread_rng())), - (Some(org), SymmetricCryptoKey::generate(rand::thread_rng())), - ])); - - // Attachment has a key that is encrypted with the user key, as the cipher has no key itself - let attachment_key = SymmetricCryptoKey::generate(rand::thread_rng()); - let attachment_key_enc = attachment_key - .to_vec() - .encrypt_with_key(enc.get_key(&None).unwrap()) - .unwrap(); - - let mut cipher = generate_cipher(); - let attachment = AttachmentView { - id: None, - url: None, - size: None, - size_name: None, - file_name: Some("Attachment test name".into()), - key: Some(attachment_key_enc), - }; - cipher.attachments = Some(vec![attachment]); - let cred = generate_fido2(enc.get_key(&None).unwrap()); - cipher.login.as_mut().unwrap().fido2_credentials = Some(vec![cred]); - - cipher.move_to_organization(&enc, org).unwrap(); - - assert!(cipher.key.is_none()); - - // Check that the attachment key has been re-encrypted with the org key, - // and the value matches with the original attachment key - let new_attachment_key = cipher.attachments.unwrap()[0].key.clone().unwrap(); - let new_attachment_key_dec: Vec<_> = new_attachment_key - .decrypt_with_key(enc.get_key(&Some(org)).unwrap()) - .unwrap(); - let new_attachment_key_dec: SymmetricCryptoKey = new_attachment_key_dec.try_into().unwrap(); - assert_eq!(new_attachment_key_dec.to_vec(), attachment_key.to_vec()); - - let cred2: Fido2CredentialFullView = cipher - .login - .unwrap() - .fido2_credentials - .unwrap() - .first() - .unwrap() - .decrypt_with_key(enc.get_key(&Some(org)).unwrap()) - .unwrap(); - - assert_eq!(cred2.credential_id, "123"); - } - - #[test] - fn test_move_user_cipher_with_key_with_attachment_with_key_to_org() { - let org = uuid::Uuid::new_v4(); - - let enc = MockKeyContainer(HashMap::from([ - (None, SymmetricCryptoKey::generate(rand::thread_rng())), - (Some(org), SymmetricCryptoKey::generate(rand::thread_rng())), - ])); - - let cipher_key = SymmetricCryptoKey::generate(rand::thread_rng()); - let cipher_key_enc = cipher_key - .to_vec() - .encrypt_with_key(enc.get_key(&None).unwrap()) - .unwrap(); - - // Attachment has a key that is encrypted with the cipher key - let attachment_key = SymmetricCryptoKey::generate(rand::thread_rng()); - let attachment_key_enc = attachment_key - .to_vec() - .encrypt_with_key(&cipher_key) - .unwrap(); - - let mut cipher = generate_cipher(); - cipher.key = Some(cipher_key_enc); - - let attachment = AttachmentView { - id: None, - url: None, - size: None, - size_name: None, - file_name: Some("Attachment test name".into()), - key: Some(attachment_key_enc.clone()), - }; - cipher.attachments = Some(vec![attachment]); - - let cred = generate_fido2(&cipher_key); - cipher.login.as_mut().unwrap().fido2_credentials = Some(vec![cred.clone()]); - - cipher.move_to_organization(&enc, org).unwrap(); - - // Check that the cipher key has been re-encrypted with the org key, - let new_cipher_key_dec: Vec<_> = cipher - .key - .clone() - .unwrap() - .decrypt_with_key(enc.get_key(&Some(org)).unwrap()) - .unwrap(); - - let new_cipher_key_dec: SymmetricCryptoKey = new_cipher_key_dec.try_into().unwrap(); - - assert_eq!(new_cipher_key_dec.to_vec(), cipher_key.to_vec()); - - // Check that the attachment key hasn't changed - assert_eq!( - cipher.attachments.unwrap()[0] - .key - .as_ref() - .unwrap() - .to_string(), - attachment_key_enc.to_string() - ); - - let cred2: Fido2Credential = cipher - .login - .unwrap() - .fido2_credentials - .unwrap() - .first() - .unwrap() - .clone(); - - assert_eq!( - cred2.credential_id.to_string(), - cred.credential_id.to_string() - ); - } - - #[test] - fn test_build_subtitle_card_visa() { - let brand = Some("Visa".to_owned()); - let number = Some("4111111111111111".to_owned()); - - let subtitle = build_subtitle_card(brand, number); - assert_eq!(subtitle, "Visa, *1111"); - } - - #[test] - fn test_build_subtitle_card_mastercard() { - let brand = Some("Mastercard".to_owned()); - let number = Some("5555555555554444".to_owned()); - - let subtitle = build_subtitle_card(brand, number); - assert_eq!(subtitle, "Mastercard, *4444"); - } - - #[test] - fn test_build_subtitle_card_amex() { - let brand = Some("Amex".to_owned()); - let number = Some("378282246310005".to_owned()); - - let subtitle = build_subtitle_card(brand, number); - assert_eq!(subtitle, "Amex, *10005"); - } - - #[test] - fn test_build_subtitle_card_underflow() { - let brand = Some("Mastercard".to_owned()); - let number = Some("4".to_owned()); - - let subtitle = build_subtitle_card(brand, number); - assert_eq!(subtitle, "Mastercard"); - } - - #[test] - fn test_build_subtitle_card_only_brand() { - let brand = Some("Mastercard".to_owned()); - let number = None; - - let subtitle = build_subtitle_card(brand, number); - assert_eq!(subtitle, "Mastercard"); - } - - #[test] - fn test_build_subtitle_card_only_card() { - let brand = None; - let number = Some("5555555555554444".to_owned()); - - let subtitle = build_subtitle_card(brand, number); - assert_eq!(subtitle, "*4444"); - } - - #[test] - fn test_build_subtitle_identity() { - let first_name = Some("John".to_owned()); - let last_name = Some("Doe".to_owned()); - - let subtitle = build_subtitle_identity(first_name, last_name); - assert_eq!(subtitle, "John Doe"); - } - - #[test] - fn test_build_subtitle_identity_only_first() { - let first_name = Some("John".to_owned()); - let last_name = None; - - let subtitle = build_subtitle_identity(first_name, last_name); - assert_eq!(subtitle, "John"); - } - - #[test] - fn test_build_subtitle_identity_only_last() { - let first_name = None; - let last_name = Some("Doe".to_owned()); - - let subtitle = build_subtitle_identity(first_name, last_name); - assert_eq!(subtitle, "Doe"); - } - - #[test] - fn test_build_subtitle_identity_none() { - let first_name = None; - let last_name = None; - - let subtitle = build_subtitle_identity(first_name, last_name); - assert_eq!(subtitle, ""); - } -} diff --git a/crates/bitwarden-vault/src/cipher/field.rs b/crates/bitwarden-vault/src/cipher/field.rs deleted file mode 100644 index 6c826d4ba..000000000 --- a/crates/bitwarden-vault/src/cipher/field.rs +++ /dev/null @@ -1,92 +0,0 @@ -use bitwarden_api_api::models::CipherFieldModel; -use bitwarden_core::require; -use bitwarden_crypto::{ - CryptoError, EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; - -use super::linked_id::LinkedIdType; -use crate::VaultParseError; - -#[derive(Clone, Copy, Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u8)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum FieldType { - Text = 0, - Hidden = 1, - Boolean = 2, - Linked = 3, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Field { - name: Option, - value: Option, - r#type: FieldType, - - linked_id: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct FieldView { - pub name: Option, - pub value: Option, - pub r#type: FieldType, - - pub linked_id: Option, -} - -impl KeyEncryptable for FieldView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Field { - name: self.name.encrypt_with_key(key)?, - value: self.value.encrypt_with_key(key)?, - r#type: self.r#type, - linked_id: self.linked_id, - }) - } -} - -impl KeyDecryptable for Field { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(FieldView { - name: self.name.decrypt_with_key(key).ok().flatten(), - value: self.value.decrypt_with_key(key).ok().flatten(), - r#type: self.r#type, - linked_id: self.linked_id, - }) - } -} - -impl TryFrom for Field { - type Error = VaultParseError; - - fn try_from(model: CipherFieldModel) -> Result { - Ok(Self { - name: EncString::try_from_optional(model.name)?, - value: EncString::try_from_optional(model.value)?, - r#type: require!(model.r#type).into(), - linked_id: model - .linked_id - .map(|id| (id as u32).try_into()) - .transpose()?, - }) - } -} - -impl From for FieldType { - fn from(model: bitwarden_api_api::models::FieldType) -> Self { - match model { - bitwarden_api_api::models::FieldType::Text => FieldType::Text, - bitwarden_api_api::models::FieldType::Hidden => FieldType::Hidden, - bitwarden_api_api::models::FieldType::Boolean => FieldType::Boolean, - bitwarden_api_api::models::FieldType::Linked => FieldType::Linked, - } - } -} diff --git a/crates/bitwarden-vault/src/cipher/identity.rs b/crates/bitwarden-vault/src/cipher/identity.rs deleted file mode 100644 index f01274d77..000000000 --- a/crates/bitwarden-vault/src/cipher/identity.rs +++ /dev/null @@ -1,133 +0,0 @@ -use bitwarden_api_api::models::CipherIdentityModel; -use bitwarden_crypto::{ - CryptoError, EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::VaultParseError; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Identity { - pub title: Option, - pub first_name: Option, - pub middle_name: Option, - pub last_name: Option, - pub address1: Option, - pub address2: Option, - pub address3: Option, - pub city: Option, - pub state: Option, - pub postal_code: Option, - pub country: Option, - pub company: Option, - pub email: Option, - pub phone: Option, - pub ssn: Option, - pub username: Option, - pub passport_number: Option, - pub license_number: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct IdentityView { - pub title: Option, - pub first_name: Option, - pub middle_name: Option, - pub last_name: Option, - pub address1: Option, - pub address2: Option, - pub address3: Option, - pub city: Option, - pub state: Option, - pub postal_code: Option, - pub country: Option, - pub company: Option, - pub email: Option, - pub phone: Option, - pub ssn: Option, - pub username: Option, - pub passport_number: Option, - pub license_number: Option, -} - -impl KeyEncryptable for IdentityView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Identity { - title: self.title.encrypt_with_key(key)?, - first_name: self.first_name.encrypt_with_key(key)?, - middle_name: self.middle_name.encrypt_with_key(key)?, - last_name: self.last_name.encrypt_with_key(key)?, - address1: self.address1.encrypt_with_key(key)?, - address2: self.address2.encrypt_with_key(key)?, - address3: self.address3.encrypt_with_key(key)?, - city: self.city.encrypt_with_key(key)?, - state: self.state.encrypt_with_key(key)?, - postal_code: self.postal_code.encrypt_with_key(key)?, - country: self.country.encrypt_with_key(key)?, - company: self.company.encrypt_with_key(key)?, - email: self.email.encrypt_with_key(key)?, - phone: self.phone.encrypt_with_key(key)?, - ssn: self.ssn.encrypt_with_key(key)?, - username: self.username.encrypt_with_key(key)?, - passport_number: self.passport_number.encrypt_with_key(key)?, - license_number: self.license_number.encrypt_with_key(key)?, - }) - } -} - -impl KeyDecryptable for Identity { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(IdentityView { - title: self.title.decrypt_with_key(key).ok().flatten(), - first_name: self.first_name.decrypt_with_key(key).ok().flatten(), - middle_name: self.middle_name.decrypt_with_key(key).ok().flatten(), - last_name: self.last_name.decrypt_with_key(key).ok().flatten(), - address1: self.address1.decrypt_with_key(key).ok().flatten(), - address2: self.address2.decrypt_with_key(key).ok().flatten(), - address3: self.address3.decrypt_with_key(key).ok().flatten(), - city: self.city.decrypt_with_key(key).ok().flatten(), - state: self.state.decrypt_with_key(key).ok().flatten(), - postal_code: self.postal_code.decrypt_with_key(key).ok().flatten(), - country: self.country.decrypt_with_key(key).ok().flatten(), - company: self.company.decrypt_with_key(key).ok().flatten(), - email: self.email.decrypt_with_key(key).ok().flatten(), - phone: self.phone.decrypt_with_key(key).ok().flatten(), - ssn: self.ssn.decrypt_with_key(key).ok().flatten(), - username: self.username.decrypt_with_key(key).ok().flatten(), - passport_number: self.passport_number.decrypt_with_key(key).ok().flatten(), - license_number: self.license_number.decrypt_with_key(key).ok().flatten(), - }) - } -} - -impl TryFrom for Identity { - type Error = VaultParseError; - - fn try_from(identity: CipherIdentityModel) -> Result { - Ok(Self { - title: EncString::try_from_optional(identity.title)?, - first_name: EncString::try_from_optional(identity.first_name)?, - middle_name: EncString::try_from_optional(identity.middle_name)?, - last_name: EncString::try_from_optional(identity.last_name)?, - address1: EncString::try_from_optional(identity.address1)?, - address2: EncString::try_from_optional(identity.address2)?, - address3: EncString::try_from_optional(identity.address3)?, - city: EncString::try_from_optional(identity.city)?, - state: EncString::try_from_optional(identity.state)?, - postal_code: EncString::try_from_optional(identity.postal_code)?, - country: EncString::try_from_optional(identity.country)?, - company: EncString::try_from_optional(identity.company)?, - email: EncString::try_from_optional(identity.email)?, - phone: EncString::try_from_optional(identity.phone)?, - ssn: EncString::try_from_optional(identity.ssn)?, - username: EncString::try_from_optional(identity.username)?, - passport_number: EncString::try_from_optional(identity.passport_number)?, - license_number: EncString::try_from_optional(identity.license_number)?, - }) - } -} diff --git a/crates/bitwarden-vault/src/cipher/linked_id.rs b/crates/bitwarden-vault/src/cipher/linked_id.rs deleted file mode 100644 index 9e7cd91cc..000000000 --- a/crates/bitwarden-vault/src/cipher/linked_id.rs +++ /dev/null @@ -1,168 +0,0 @@ -use bitwarden_core::MissingFieldError; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; - -#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Debug, JsonSchema)] -#[serde(untagged)] -pub enum LinkedIdType { - Login(LoginLinkedIdType), - Card(CardLinkedIdType), - Identity(IdentityLinkedIdType), -} - -#[cfg(feature = "uniffi")] -use crate::UniffiCustomTypeConverter; -#[cfg(feature = "uniffi")] -uniffi::custom_type!(LinkedIdType, u32); -#[cfg(feature = "uniffi")] -impl UniffiCustomTypeConverter for LinkedIdType { - type Builtin = u32; - - fn into_custom(val: Self::Builtin) -> uniffi::Result { - let val = serde_json::Value::Number(val.into()); - Ok(serde_json::from_value(val)?) - } - - fn from_custom(obj: Self) -> Self::Builtin { - obj.into() - } -} - -impl From for u32 { - fn from(v: LinkedIdType) -> Self { - serde_json::to_value(v) - .expect("LinkedIdType should be serializable") - .as_u64() - .expect("Not a numeric enum value") as u32 - } -} - -#[derive(Clone, Copy, PartialEq, Eq, Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u16)] -pub enum LoginLinkedIdType { - Username = 100, - Password = 101, -} - -#[derive(Clone, Copy, PartialEq, Eq, Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u16)] -pub enum CardLinkedIdType { - CardholderName = 300, - ExpMonth = 301, - ExpYear = 302, - Code = 303, - Brand = 304, - Number = 305, -} - -#[derive(Clone, Copy, PartialEq, Eq, Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u16)] -pub enum IdentityLinkedIdType { - Title = 400, - MiddleName = 401, - Address1 = 402, - Address2 = 403, - Address3 = 404, - City = 405, - State = 406, - PostalCode = 407, - Country = 408, - Company = 409, - Email = 410, - Phone = 411, - Ssn = 412, - Username = 413, - PassportNumber = 414, - LicenseNumber = 415, - FirstName = 416, - LastName = 417, - FullName = 418, -} - -impl TryFrom for LinkedIdType { - type Error = MissingFieldError; - - fn try_from(value: u32) -> Result { - match value { - 100 => Ok(LinkedIdType::Login(LoginLinkedIdType::Username)), - 101 => Ok(LinkedIdType::Login(LoginLinkedIdType::Password)), - 300 => Ok(LinkedIdType::Card(CardLinkedIdType::CardholderName)), - 301 => Ok(LinkedIdType::Card(CardLinkedIdType::ExpMonth)), - 302 => Ok(LinkedIdType::Card(CardLinkedIdType::ExpYear)), - 303 => Ok(LinkedIdType::Card(CardLinkedIdType::Code)), - 304 => Ok(LinkedIdType::Card(CardLinkedIdType::Brand)), - 305 => Ok(LinkedIdType::Card(CardLinkedIdType::Number)), - 400 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Title)), - 401 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::MiddleName)), - 402 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Address1)), - 403 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Address2)), - 404 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Address3)), - 405 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::City)), - 406 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::State)), - 407 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::PostalCode)), - 408 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Country)), - 409 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Company)), - 410 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Email)), - 411 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Phone)), - 412 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Ssn)), - 413 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::Username)), - 414 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::PassportNumber)), - 415 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::LicenseNumber)), - 416 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::FirstName)), - 417 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::LastName)), - 418 => Ok(LinkedIdType::Identity(IdentityLinkedIdType::FullName)), - _ => Err(MissingFieldError("LinkedIdType")), - } - } -} - -#[cfg(test)] -mod tests { - - #[test] - fn test_linked_id_serialization() { - use super::{LinkedIdType, LoginLinkedIdType}; - - #[derive(serde::Serialize, serde::Deserialize)] - struct Test { - id: LinkedIdType, - } - - let json = "{\"id\":100}"; - let val = serde_json::from_str::(json).unwrap(); - - assert_eq!(val.id, LinkedIdType::Login(LoginLinkedIdType::Username)); - - let serialized = serde_json::to_string(&val).unwrap(); - assert_eq!(serialized, json); - } - - #[cfg(feature = "uniffi")] - #[test] - fn test_linked_id_serialization_uniffi() { - use super::{CardLinkedIdType, LinkedIdType, LoginLinkedIdType}; - - assert_eq!( - 100, - crate::UniffiCustomTypeConverter::from_custom(LinkedIdType::Login( - LoginLinkedIdType::Username - )) - ); - assert_eq!( - 303, - crate::UniffiCustomTypeConverter::from_custom(LinkedIdType::Card( - CardLinkedIdType::Code - )) - ); - - assert_eq!( - LinkedIdType::Login(LoginLinkedIdType::Username), - crate::UniffiCustomTypeConverter::into_custom(100).unwrap() - ); - assert_eq!( - LinkedIdType::Card(CardLinkedIdType::Code), - crate::UniffiCustomTypeConverter::into_custom(303).unwrap() - ); - } -} diff --git a/crates/bitwarden-vault/src/cipher/local_data.rs b/crates/bitwarden-vault/src/cipher/local_data.rs deleted file mode 100644 index 1c1c7661c..000000000 --- a/crates/bitwarden-vault/src/cipher/local_data.rs +++ /dev/null @@ -1,37 +0,0 @@ -use bitwarden_crypto::{CryptoError, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct LocalData { - last_used_date: Option, - last_launched: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct LocalDataView { - last_used_date: Option, - last_launched: Option, -} - -impl KeyEncryptable for LocalDataView { - fn encrypt_with_key(self, _key: &SymmetricCryptoKey) -> Result { - Ok(LocalData { - last_used_date: self.last_used_date, - last_launched: self.last_launched, - }) - } -} - -impl KeyDecryptable for LocalData { - fn decrypt_with_key(&self, _key: &SymmetricCryptoKey) -> Result { - Ok(LocalDataView { - last_used_date: self.last_used_date, - last_launched: self.last_launched, - }) - } -} diff --git a/crates/bitwarden-vault/src/cipher/login.rs b/crates/bitwarden-vault/src/cipher/login.rs deleted file mode 100644 index 4b476b075..000000000 --- a/crates/bitwarden-vault/src/cipher/login.rs +++ /dev/null @@ -1,493 +0,0 @@ -use base64::{engine::general_purpose::STANDARD, Engine}; -use bitwarden_api_api::models::{CipherLoginModel, CipherLoginUriModel}; -use bitwarden_core::require; -use bitwarden_crypto::{ - CryptoError, EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; - -use crate::VaultParseError; - -#[derive(Clone, Copy, Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u8)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum UriMatchType { - Domain = 0, - Host = 1, - StartsWith = 2, - Exact = 3, - RegularExpression = 4, - Never = 5, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct LoginUri { - pub uri: Option, - pub r#match: Option, - pub uri_checksum: Option, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct LoginUriView { - pub uri: Option, - pub r#match: Option, - pub uri_checksum: Option, -} - -impl LoginUriView { - pub(crate) fn is_checksum_valid(&self) -> bool { - let Some(uri) = &self.uri else { - return false; - }; - let Some(cs) = &self.uri_checksum else { - return false; - }; - let Ok(cs) = STANDARD.decode(cs) else { - return false; - }; - - use sha2::Digest; - let uri_hash = sha2::Sha256::new().chain_update(uri.as_bytes()).finalize(); - - uri_hash.as_slice() == cs - } - - pub(crate) fn generate_checksum(&mut self) { - if let Some(uri) = &self.uri { - use sha2::Digest; - let uri_hash = sha2::Sha256::new().chain_update(uri.as_bytes()).finalize(); - let uri_hash = STANDARD.encode(uri_hash.as_slice()); - self.uri_checksum = Some(uri_hash); - } - } -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Fido2Credential { - pub credential_id: EncString, - pub key_type: EncString, - pub key_algorithm: EncString, - pub key_curve: EncString, - pub key_value: EncString, - pub rp_id: EncString, - pub user_handle: Option, - pub user_name: Option, - pub counter: EncString, - pub rp_name: Option, - pub user_display_name: Option, - pub discoverable: EncString, - pub creation_date: DateTime, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Fido2CredentialView { - pub credential_id: String, - pub key_type: String, - pub key_algorithm: String, - pub key_curve: String, - // This value doesn't need to be returned to the client - // so we keep it encrypted until we need it - pub key_value: EncString, - pub rp_id: String, - pub user_handle: Option, - pub user_name: Option, - pub counter: String, - pub rp_name: Option, - pub user_display_name: Option, - pub discoverable: String, - pub creation_date: DateTime, -} - -// This is mostly a copy of the Fido2CredentialView, but with the key exposed -// Only meant to be used internally and not exposed to the outside world -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct Fido2CredentialFullView { - pub credential_id: String, - pub key_type: String, - pub key_algorithm: String, - pub key_curve: String, - pub key_value: String, - pub rp_id: String, - pub user_handle: Option, - pub user_name: Option, - pub counter: String, - pub rp_name: Option, - pub user_display_name: Option, - pub discoverable: String, - pub creation_date: DateTime, -} - -// This is mostly a copy of the Fido2CredentialView, meant to be exposed to the clients -// to let them select where to store the new credential. Note that it doesn't contain -// the encrypted key as that is only filled when the cipher is selected -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Fido2CredentialNewView { - pub credential_id: String, - pub key_type: String, - pub key_algorithm: String, - pub key_curve: String, - pub rp_id: String, - pub user_handle: Option, - pub user_name: Option, - pub counter: String, - pub rp_name: Option, - pub user_display_name: Option, - pub creation_date: DateTime, -} - -impl From for Fido2CredentialNewView { - fn from(value: Fido2CredentialFullView) -> Self { - Fido2CredentialNewView { - credential_id: value.credential_id, - key_type: value.key_type, - key_algorithm: value.key_algorithm, - key_curve: value.key_curve, - rp_id: value.rp_id, - user_handle: value.user_handle, - user_name: value.user_name, - counter: value.counter, - rp_name: value.rp_name, - user_display_name: value.user_display_name, - creation_date: value.creation_date, - } - } -} - -impl KeyEncryptable for Fido2CredentialFullView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Fido2Credential { - credential_id: self.credential_id.encrypt_with_key(key)?, - key_type: self.key_type.encrypt_with_key(key)?, - key_algorithm: self.key_algorithm.encrypt_with_key(key)?, - key_curve: self.key_curve.encrypt_with_key(key)?, - key_value: self.key_value.encrypt_with_key(key)?, - rp_id: self.rp_id.encrypt_with_key(key)?, - user_handle: self - .user_handle - .map(|h| h.encrypt_with_key(key)) - .transpose()?, - user_name: self.user_name.encrypt_with_key(key)?, - counter: self.counter.encrypt_with_key(key)?, - rp_name: self.rp_name.encrypt_with_key(key)?, - user_display_name: self.user_display_name.encrypt_with_key(key)?, - discoverable: self.discoverable.encrypt_with_key(key)?, - creation_date: self.creation_date, - }) - } -} - -impl KeyDecryptable for Fido2Credential { - fn decrypt_with_key( - &self, - key: &SymmetricCryptoKey, - ) -> Result { - Ok(Fido2CredentialFullView { - credential_id: self.credential_id.decrypt_with_key(key)?, - key_type: self.key_type.decrypt_with_key(key)?, - key_algorithm: self.key_algorithm.decrypt_with_key(key)?, - key_curve: self.key_curve.decrypt_with_key(key)?, - key_value: self.key_value.decrypt_with_key(key)?, - rp_id: self.rp_id.decrypt_with_key(key)?, - user_handle: self.user_handle.decrypt_with_key(key)?, - user_name: self.user_name.decrypt_with_key(key)?, - counter: self.counter.decrypt_with_key(key)?, - rp_name: self.rp_name.decrypt_with_key(key)?, - user_display_name: self.user_display_name.decrypt_with_key(key)?, - discoverable: self.discoverable.decrypt_with_key(key)?, - creation_date: self.creation_date, - }) - } -} - -impl KeyDecryptable for Fido2CredentialView { - fn decrypt_with_key( - &self, - key: &SymmetricCryptoKey, - ) -> Result { - Ok(Fido2CredentialFullView { - credential_id: self.credential_id.clone(), - key_type: self.key_type.clone(), - key_algorithm: self.key_algorithm.clone(), - key_curve: self.key_curve.clone(), - key_value: self.key_value.decrypt_with_key(key)?, - rp_id: self.rp_id.clone(), - user_handle: self.user_handle.clone(), - user_name: self.user_name.clone(), - counter: self.counter.clone(), - rp_name: self.rp_name.clone(), - user_display_name: self.user_display_name.clone(), - discoverable: self.discoverable.clone(), - creation_date: self.creation_date, - }) - } -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Login { - pub username: Option, - pub password: Option, - pub password_revision_date: Option>, - - pub uris: Option>, - pub totp: Option, - pub autofill_on_page_load: Option, - - pub fido2_credentials: Option>, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct LoginView { - pub username: Option, - pub password: Option, - pub password_revision_date: Option>, - - pub uris: Option>, - pub totp: Option, - pub autofill_on_page_load: Option, - - // TODO: Remove this once the SDK supports state - pub fido2_credentials: Option>, -} - -impl KeyEncryptable for LoginUriView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(LoginUri { - uri: self.uri.encrypt_with_key(key)?, - r#match: self.r#match, - uri_checksum: self.uri_checksum.encrypt_with_key(key)?, - }) - } -} - -impl KeyEncryptable for LoginView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Login { - username: self.username.encrypt_with_key(key)?, - password: self.password.encrypt_with_key(key)?, - password_revision_date: self.password_revision_date, - uris: self.uris.encrypt_with_key(key)?, - totp: self.totp.encrypt_with_key(key)?, - autofill_on_page_load: self.autofill_on_page_load, - fido2_credentials: self.fido2_credentials, - }) - } -} - -impl KeyDecryptable for LoginUri { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(LoginUriView { - uri: self.uri.decrypt_with_key(key)?, - r#match: self.r#match, - uri_checksum: self.uri_checksum.decrypt_with_key(key)?, - }) - } -} - -impl KeyDecryptable for Login { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(LoginView { - username: self.username.decrypt_with_key(key).ok().flatten(), - password: self.password.decrypt_with_key(key).ok().flatten(), - password_revision_date: self.password_revision_date, - uris: self.uris.decrypt_with_key(key).ok().flatten(), - totp: self.totp.decrypt_with_key(key).ok().flatten(), - autofill_on_page_load: self.autofill_on_page_load, - fido2_credentials: self.fido2_credentials.clone(), - }) - } -} - -impl KeyEncryptable for Fido2CredentialView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Fido2Credential { - credential_id: self.credential_id.encrypt_with_key(key)?, - key_type: self.key_type.encrypt_with_key(key)?, - key_algorithm: self.key_algorithm.encrypt_with_key(key)?, - key_curve: self.key_curve.encrypt_with_key(key)?, - key_value: self.key_value, - rp_id: self.rp_id.encrypt_with_key(key)?, - user_handle: self - .user_handle - .map(|h| h.encrypt_with_key(key)) - .transpose()?, - user_name: self - .user_name - .map(|n| n.encrypt_with_key(key)) - .transpose()?, - counter: self.counter.encrypt_with_key(key)?, - rp_name: self.rp_name.encrypt_with_key(key)?, - user_display_name: self.user_display_name.encrypt_with_key(key)?, - discoverable: self.discoverable.encrypt_with_key(key)?, - creation_date: self.creation_date, - }) - } -} - -impl KeyDecryptable for Fido2Credential { - fn decrypt_with_key( - &self, - key: &SymmetricCryptoKey, - ) -> Result { - Ok(Fido2CredentialView { - credential_id: self.credential_id.decrypt_with_key(key)?, - key_type: self.key_type.decrypt_with_key(key)?, - key_algorithm: self.key_algorithm.decrypt_with_key(key)?, - key_curve: self.key_curve.decrypt_with_key(key)?, - key_value: self.key_value.clone(), - rp_id: self.rp_id.decrypt_with_key(key)?, - user_handle: self.user_handle.decrypt_with_key(key)?, - user_name: self.user_name.decrypt_with_key(key)?, - counter: self.counter.decrypt_with_key(key)?, - rp_name: self.rp_name.decrypt_with_key(key)?, - user_display_name: self.user_display_name.decrypt_with_key(key)?, - discoverable: self.discoverable.decrypt_with_key(key)?, - creation_date: self.creation_date, - }) - } -} - -impl TryFrom for Login { - type Error = VaultParseError; - - fn try_from(login: CipherLoginModel) -> Result { - Ok(Self { - username: EncString::try_from_optional(login.username)?, - password: EncString::try_from_optional(login.password)?, - password_revision_date: login - .password_revision_date - .map(|d| d.parse()) - .transpose()?, - uris: login - .uris - .map(|v| v.into_iter().map(|u| u.try_into()).collect()) - .transpose()?, - totp: EncString::try_from_optional(login.totp)?, - autofill_on_page_load: login.autofill_on_page_load, - fido2_credentials: login - .fido2_credentials - .map(|v| v.into_iter().map(|c| c.try_into()).collect()) - .transpose()?, - }) - } -} - -impl TryFrom for LoginUri { - type Error = VaultParseError; - - fn try_from(uri: CipherLoginUriModel) -> Result { - Ok(Self { - uri: EncString::try_from_optional(uri.uri)?, - r#match: uri.r#match.map(|m| m.into()), - uri_checksum: EncString::try_from_optional(uri.uri_checksum)?, - }) - } -} - -impl From for UriMatchType { - fn from(value: bitwarden_api_api::models::UriMatchType) -> Self { - match value { - bitwarden_api_api::models::UriMatchType::Domain => Self::Domain, - bitwarden_api_api::models::UriMatchType::Host => Self::Host, - bitwarden_api_api::models::UriMatchType::StartsWith => Self::StartsWith, - bitwarden_api_api::models::UriMatchType::Exact => Self::Exact, - bitwarden_api_api::models::UriMatchType::RegularExpression => Self::RegularExpression, - bitwarden_api_api::models::UriMatchType::Never => Self::Never, - } - } -} - -impl TryFrom for Fido2Credential { - type Error = VaultParseError; - - fn try_from( - value: bitwarden_api_api::models::CipherFido2CredentialModel, - ) -> Result { - Ok(Self { - credential_id: require!(value.credential_id).parse()?, - key_type: require!(value.key_type).parse()?, - key_algorithm: require!(value.key_algorithm).parse()?, - key_curve: require!(value.key_curve).parse()?, - key_value: require!(value.key_value).parse()?, - rp_id: require!(value.rp_id).parse()?, - user_handle: EncString::try_from_optional(value.user_handle) - .ok() - .flatten(), - user_name: EncString::try_from_optional(value.user_name).ok().flatten(), - counter: require!(value.counter).parse()?, - rp_name: EncString::try_from_optional(value.rp_name).ok().flatten(), - user_display_name: EncString::try_from_optional(value.user_display_name) - .ok() - .flatten(), - discoverable: require!(value.discoverable).parse()?, - creation_date: value.creation_date.parse()?, - }) - } -} - -#[cfg(test)] -mod tests { - #[test] - fn test_valid_checksum() { - let uri = super::LoginUriView { - uri: Some("https://example.com".to_string()), - r#match: Some(super::UriMatchType::Domain), - uri_checksum: Some("EAaArVRs5qV39C9S3zO0z9ynVoWeZkuNfeMpsVDQnOk=".to_string()), - }; - assert!(uri.is_checksum_valid()); - } - - #[test] - fn test_invalid_checksum() { - let uri = super::LoginUriView { - uri: Some("https://example.com".to_string()), - r#match: Some(super::UriMatchType::Domain), - uri_checksum: Some("UtSgIv8LYfEdOu7yqjF7qXWhmouYGYC8RSr7/ryZg5Q=".to_string()), - }; - assert!(!uri.is_checksum_valid()); - } - - #[test] - fn test_missing_checksum() { - let uri = super::LoginUriView { - uri: Some("https://example.com".to_string()), - r#match: Some(super::UriMatchType::Domain), - uri_checksum: None, - }; - assert!(!uri.is_checksum_valid()); - } - - #[test] - fn test_generate_checksum() { - let mut uri = super::LoginUriView { - uri: Some("https://test.com".to_string()), - r#match: Some(super::UriMatchType::Domain), - uri_checksum: None, - }; - - uri.generate_checksum(); - - assert_eq!( - uri.uri_checksum.unwrap().as_str(), - "OWk2vQvwYD1nhLZdA+ltrpBWbDa2JmHyjUEWxRZSS8w=" - ); - } -} diff --git a/crates/bitwarden-vault/src/cipher/mod.rs b/crates/bitwarden-vault/src/cipher/mod.rs deleted file mode 100644 index 67513d524..000000000 --- a/crates/bitwarden-vault/src/cipher/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -pub(crate) mod attachment; -pub(crate) mod card; -#[allow(clippy::module_inception)] -pub(crate) mod cipher; -pub(crate) mod field; -pub(crate) mod identity; -pub(crate) mod linked_id; -pub(crate) mod local_data; -pub(crate) mod login; -pub(crate) mod secure_note; - -pub use attachment::{ - Attachment, AttachmentEncryptResult, AttachmentFile, AttachmentFileView, AttachmentView, -}; -pub use cipher::{Cipher, CipherError, CipherListView, CipherRepromptType, CipherType, CipherView}; -pub use field::FieldView; -pub use login::{ - Fido2Credential, Fido2CredentialFullView, Fido2CredentialNewView, Fido2CredentialView, Login, - LoginUriView, LoginView, -}; -pub use secure_note::SecureNoteType; diff --git a/crates/bitwarden-vault/src/cipher/secure_note.rs b/crates/bitwarden-vault/src/cipher/secure_note.rs deleted file mode 100644 index 2563160bb..000000000 --- a/crates/bitwarden-vault/src/cipher/secure_note.rs +++ /dev/null @@ -1,63 +0,0 @@ -use bitwarden_api_api::models::CipherSecureNoteModel; -use bitwarden_core::require; -use bitwarden_crypto::{CryptoError, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use serde_repr::{Deserialize_repr, Serialize_repr}; - -use crate::VaultParseError; - -#[derive(Clone, Copy, Serialize_repr, Deserialize_repr, Debug, JsonSchema)] -#[repr(u8)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum SecureNoteType { - Generic = 0, -} - -#[derive(Clone, Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SecureNote { - r#type: SecureNoteType, -} - -#[derive(Clone, Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct SecureNoteView { - pub r#type: SecureNoteType, -} - -impl KeyEncryptable for SecureNoteView { - fn encrypt_with_key(self, _key: &SymmetricCryptoKey) -> Result { - Ok(SecureNote { - r#type: self.r#type, - }) - } -} - -impl KeyDecryptable for SecureNote { - fn decrypt_with_key(&self, _key: &SymmetricCryptoKey) -> Result { - Ok(SecureNoteView { - r#type: self.r#type, - }) - } -} - -impl TryFrom for SecureNote { - type Error = VaultParseError; - - fn try_from(model: CipherSecureNoteModel) -> Result { - Ok(Self { - r#type: require!(model.r#type).into(), - }) - } -} - -impl From for SecureNoteType { - fn from(model: bitwarden_api_api::models::SecureNoteType) -> Self { - match model { - bitwarden_api_api::models::SecureNoteType::Generic => SecureNoteType::Generic, - } - } -} diff --git a/crates/bitwarden-vault/src/client_totp.rs b/crates/bitwarden-vault/src/client_totp.rs deleted file mode 100644 index 6425b72eb..000000000 --- a/crates/bitwarden-vault/src/client_totp.rs +++ /dev/null @@ -1,32 +0,0 @@ -use chrono::{DateTime, Utc}; - -use crate::{ - generate_totp, generate_totp_cipher_view, CipherListView, ClientVault, TotpError, TotpResponse, -}; - -impl<'a> ClientVault<'a> { - /// Generate a TOTP code from a provided key. - /// - /// Key can be either: - /// - A base32 encoded string - /// - OTP Auth URI - /// - Steam URI - pub fn generate_totp( - &'a self, - key: String, - time: Option>, - ) -> Result { - generate_totp(key, time) - } - - /// Generate a TOTP code from a provided cipher list view. - pub fn generate_totp_cipher_view( - &'a self, - view: CipherListView, - time: Option>, - ) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - - generate_totp_cipher_view(&enc, view, time) - } -} diff --git a/crates/bitwarden-vault/src/client_vault.rs b/crates/bitwarden-vault/src/client_vault.rs deleted file mode 100644 index 67f6792b9..000000000 --- a/crates/bitwarden-vault/src/client_vault.rs +++ /dev/null @@ -1,30 +0,0 @@ -use bitwarden_core::Client; - -use crate::{ - sync::{sync, SyncError}, - SyncRequest, SyncResponse, -}; - -pub struct ClientVault<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> ClientVault<'a> { - pub fn new(client: &'a Client) -> Self { - Self { client } - } - - pub async fn sync(&self, input: &SyncRequest) -> Result { - sync(self.client, input).await - } -} - -pub trait ClientVaultExt<'a> { - fn vault(&'a self) -> ClientVault<'a>; -} - -impl<'a> ClientVaultExt<'a> for Client { - fn vault(&'a self) -> ClientVault<'a> { - ClientVault::new(self) - } -} diff --git a/crates/bitwarden-vault/src/collection.rs b/crates/bitwarden-vault/src/collection.rs deleted file mode 100644 index 5e0fcbdc5..000000000 --- a/crates/bitwarden-vault/src/collection.rs +++ /dev/null @@ -1,77 +0,0 @@ -use bitwarden_api_api::models::CollectionDetailsResponseModel; -use bitwarden_core::require; -use bitwarden_crypto::{ - CryptoError, EncString, KeyContainer, KeyDecryptable, LocateKey, SymmetricCryptoKey, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use crate::VaultParseError; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct Collection { - pub id: Option, - pub organization_id: Uuid, - - pub name: EncString, - - pub external_id: Option, - pub hide_passwords: bool, - pub read_only: bool, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct CollectionView { - pub id: Option, - pub organization_id: Uuid, - - pub name: String, - - pub external_id: Option, - pub hide_passwords: bool, - pub read_only: bool, -} - -impl LocateKey for Collection { - fn locate_key<'a>( - &self, - enc: &'a dyn KeyContainer, - _: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - enc.get_key(&Some(self.organization_id)) - } -} -impl KeyDecryptable for Collection { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(CollectionView { - id: self.id, - organization_id: self.organization_id, - - name: self.name.decrypt_with_key(key).ok().unwrap_or_default(), - - external_id: self.external_id.clone(), - hide_passwords: self.hide_passwords, - read_only: self.read_only, - }) - } -} - -impl TryFrom for Collection { - type Error = VaultParseError; - - fn try_from(collection: CollectionDetailsResponseModel) -> Result { - Ok(Collection { - id: collection.id, - organization_id: require!(collection.organization_id), - name: require!(collection.name).parse()?, - external_id: collection.external_id, - hide_passwords: collection.hide_passwords.unwrap_or(false), - read_only: collection.read_only.unwrap_or(false), - }) - } -} diff --git a/crates/bitwarden-vault/src/domain.rs b/crates/bitwarden-vault/src/domain.rs deleted file mode 100644 index dbdfcaddf..000000000 --- a/crates/bitwarden-vault/src/domain.rs +++ /dev/null @@ -1,26 +0,0 @@ -use bitwarden_core::require; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::VaultParseError; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -pub struct GlobalDomains { - pub r#type: i32, - pub domains: Vec, - pub excluded: bool, -} - -impl TryFrom for GlobalDomains { - type Error = VaultParseError; - - fn try_from( - global_domains: bitwarden_api_api::models::GlobalDomains, - ) -> Result { - Ok(Self { - r#type: require!(global_domains.r#type), - domains: require!(global_domains.domains), - excluded: require!(global_domains.excluded), - }) - } -} diff --git a/crates/bitwarden-vault/src/error.rs b/crates/bitwarden-vault/src/error.rs deleted file mode 100644 index 123337678..000000000 --- a/crates/bitwarden-vault/src/error.rs +++ /dev/null @@ -1,11 +0,0 @@ -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum VaultParseError { - #[error(transparent)] - Chrono(#[from] chrono::ParseError), - #[error(transparent)] - Crypto(#[from] bitwarden_crypto::CryptoError), - #[error(transparent)] - MissingFieldError(#[from] bitwarden_core::MissingFieldError), -} diff --git a/crates/bitwarden-vault/src/folder.rs b/crates/bitwarden-vault/src/folder.rs deleted file mode 100644 index f57b8ee15..000000000 --- a/crates/bitwarden-vault/src/folder.rs +++ /dev/null @@ -1,65 +0,0 @@ -use bitwarden_api_api::models::FolderResponseModel; -use bitwarden_core::require; -use bitwarden_crypto::{ - CryptoError, EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -#[cfg(feature = "wasm")] -use {tsify_next::Tsify, wasm_bindgen::prelude::*}; - -use crate::VaultParseError; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] -pub struct Folder { - id: Option, - name: EncString, - revision_date: DateTime, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))] -pub struct FolderView { - pub id: Option, - pub name: String, - pub revision_date: DateTime, -} - -impl KeyEncryptable for FolderView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(Folder { - id: self.id, - name: self.name.encrypt_with_key(key)?, - revision_date: self.revision_date, - }) - } -} - -impl KeyDecryptable for Folder { - fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result { - Ok(FolderView { - id: self.id, - name: self.name.decrypt_with_key(key).ok().unwrap_or_default(), - revision_date: self.revision_date, - }) - } -} - -impl TryFrom for Folder { - type Error = VaultParseError; - - fn try_from(folder: FolderResponseModel) -> Result { - Ok(Folder { - id: folder.id, - name: require!(EncString::try_from_optional(folder.name)?), - revision_date: require!(folder.revision_date).parse()?, - }) - } -} diff --git a/crates/bitwarden-vault/src/lib.rs b/crates/bitwarden-vault/src/lib.rs deleted file mode 100644 index 70524bb20..000000000 --- a/crates/bitwarden-vault/src/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); -#[cfg(feature = "uniffi")] -mod uniffi_support; - -mod cipher; -pub use cipher::*; -mod collection; -pub use collection::{Collection, CollectionView}; -mod folder; -pub use folder::{Folder, FolderView}; -mod password_history; -pub use password_history::{PasswordHistory, PasswordHistoryView}; -mod domain; -pub use domain::GlobalDomains; -mod totp; -pub use totp::{generate_totp, generate_totp_cipher_view, TotpError, TotpResponse}; -mod error; -pub use error::VaultParseError; -mod client_vault; -pub use client_vault::{ClientVault, ClientVaultExt}; -mod client_totp; -mod mobile; -mod sync; -pub use sync::{SyncRequest, SyncResponse}; diff --git a/crates/bitwarden-vault/src/mobile/client_attachments.rs b/crates/bitwarden-vault/src/mobile/client_attachments.rs deleted file mode 100644 index a98a7d1e7..000000000 --- a/crates/bitwarden-vault/src/mobile/client_attachments.rs +++ /dev/null @@ -1,85 +0,0 @@ -use std::path::Path; - -use bitwarden_core::{Client, Error}; -use bitwarden_crypto::{EncString, KeyDecryptable, KeyEncryptable, LocateKey}; - -use crate::{ - Attachment, AttachmentEncryptResult, AttachmentFile, AttachmentFileView, AttachmentView, - Cipher, ClientVault, -}; - -pub struct ClientAttachments<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> ClientAttachments<'a> { - pub fn encrypt_buffer( - &self, - cipher: Cipher, - attachment: AttachmentView, - buffer: &[u8], - ) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = cipher.locate_key(&enc, &None)?; - - Ok(AttachmentFileView { - cipher, - attachment, - contents: buffer, - } - .encrypt_with_key(key)?) - } - pub fn encrypt_file( - &self, - cipher: Cipher, - attachment: AttachmentView, - decrypted_file_path: &Path, - encrypted_file_path: &Path, - ) -> Result { - let data = std::fs::read(decrypted_file_path)?; - let AttachmentEncryptResult { - attachment, - contents, - } = self.encrypt_buffer(cipher, attachment, &data)?; - std::fs::write(encrypted_file_path, contents)?; - Ok(attachment) - } - - pub fn decrypt_buffer( - &self, - cipher: Cipher, - attachment: Attachment, - encrypted_buffer: &[u8], - ) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - let key = cipher.locate_key(&enc, &None)?; - - AttachmentFile { - cipher, - attachment, - contents: EncString::from_buffer(encrypted_buffer)?, - } - .decrypt_with_key(key) - .map_err(Error::Crypto) - } - pub fn decrypt_file( - &self, - cipher: Cipher, - attachment: Attachment, - encrypted_file_path: &Path, - decrypted_file_path: &Path, - ) -> Result<(), Error> { - let data = std::fs::read(encrypted_file_path)?; - let decrypted = self.decrypt_buffer(cipher, attachment, &data)?; - std::fs::write(decrypted_file_path, decrypted)?; - Ok(()) - } -} - -impl<'a> ClientVault<'a> { - pub fn attachments(&'a self) -> ClientAttachments<'a> { - ClientAttachments { - client: self.client, - } - } -} diff --git a/crates/bitwarden-vault/src/mobile/client_ciphers.rs b/crates/bitwarden-vault/src/mobile/client_ciphers.rs deleted file mode 100644 index 345f04df1..000000000 --- a/crates/bitwarden-vault/src/mobile/client_ciphers.rs +++ /dev/null @@ -1,333 +0,0 @@ -use bitwarden_core::{Client, Error}; -use bitwarden_crypto::{KeyDecryptable, KeyEncryptable, LocateKey}; -use uuid::Uuid; - -use crate::{Cipher, CipherError, CipherListView, CipherView, ClientVault}; - -pub struct ClientCiphers<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> ClientCiphers<'a> { - pub fn encrypt(&self, mut cipher_view: CipherView) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - - // TODO: Once this flag is removed, the key generation logic should - // be moved directly into the KeyEncryptable implementation - if cipher_view.key.is_none() - && self - .client - .internal - .get_flags() - .enable_cipher_key_encryption - { - let key = cipher_view.locate_key(&enc, &None)?; - cipher_view.generate_cipher_key(key)?; - } - - let key = cipher_view.locate_key(&enc, &None)?; - let cipher = cipher_view.encrypt_with_key(key)?; - - Ok(cipher) - } - - pub fn decrypt(&self, cipher: Cipher) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = cipher.locate_key(&enc, &None)?; - - let cipher_view = cipher.decrypt_with_key(key)?; - - Ok(cipher_view) - } - - pub fn decrypt_list(&self, ciphers: Vec) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - - let cipher_views: Result, _> = ciphers - .iter() - .map(|c| -> Result { - let key = c.locate_key(&enc, &None)?; - Ok(c.decrypt_with_key(key)?) - }) - .collect(); - - cipher_views - } - - #[cfg(feature = "uniffi")] - pub fn decrypt_fido2_credentials( - &self, - cipher_view: CipherView, - ) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - - let credentials = cipher_view - .decrypt_fido2_credentials(&enc) - .map_err(|e| e.to_string())?; - - Ok(credentials) - } - - pub fn move_to_organization( - &self, - mut cipher_view: CipherView, - organization_id: Uuid, - ) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - cipher_view.move_to_organization(&enc, organization_id)?; - Ok(cipher_view) - } -} - -impl<'a> ClientVault<'a> { - pub fn ciphers(&'a self) -> ClientCiphers<'a> { - ClientCiphers { - client: self.client, - } - } -} - -#[cfg(test)] -mod tests { - - use bitwarden_core::client::test_accounts::test_bitwarden_com_account; - - use super::*; - use crate::{Attachment, CipherRepromptType, CipherType, ClientVaultExt, Login}; - - #[tokio::test] - async fn test_decrypt_list() { - let client = Client::init_test_account(test_bitwarden_com_account()).await; - - let dec = client - .vault() - .ciphers() - .decrypt_list(vec![Cipher { - id: Some("a1569f46-0797-4d3f-b859-b181009e2e49".parse().unwrap()), - organization_id: Some("1bc9ac1e-f5aa-45f2-94bf-b181009709b8".parse().unwrap()), - folder_id: None, - collection_ids: vec!["66c5ca57-0868-4c7e-902f-b181009709c0".parse().unwrap()], - key: None, - name: "2.RTdUGVWYl/OZHUMoy68CMg==|sCaT5qHx8i0rIvzVrtJKww==|jB8DsRws6bXBtXNfNXUmFJ0JLDlB6GON6Y87q0jgJ+0=".parse().unwrap(), - notes: None, - r#type: CipherType::Login, - login: Some(Login{ - username: Some("2.ouEYEk+SViUtqncesfe9Ag==|iXzEJq1zBeNdDbumFO1dUA==|RqMoo9soSwz/yB99g6YPqk8+ASWRcSdXsKjbwWzyy9U=".parse().unwrap()), - password: Some("2.6yXnOz31o20Z2kiYDnXueA==|rBxTb6NK9lkbfdhrArmacw==|ogZir8Z8nLgiqlaLjHH+8qweAtItS4P2iPv1TELo5a0=".parse().unwrap()), - password_revision_date: None, uris:None, totp: None, autofill_on_page_load: None, fido2_credentials: None }), - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: true, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2024-05-31T09:35:55.12Z".parse().unwrap(), - deleted_date: None, - revision_date: "2024-05-31T09:35:55.12Z".parse().unwrap(), - }]) - - .unwrap(); - - assert_eq!(dec[0].name, "Test item"); - } - - fn test_cipher() -> Cipher { - Cipher { - id: Some("358f2b2b-9326-4e5e-94a8-b18100bb0908".parse().unwrap()), - organization_id: None, - folder_id: None, - collection_ids: vec![], - key: None, - name: "2.+oPT8B4xJhyhQRe1VkIx0A==|PBtC/bZkggXR+fSnL/pG7g==|UkjRD0VpnUYkjRC/05ZLdEBAmRbr3qWRyJey2bUvR9w=".parse().unwrap(), - notes: None, - r#type: CipherType::Login, - login: Some(Login{ - username: None, - password: None, - password_revision_date: None, - uris:None, - totp: None, - autofill_on_page_load: None, - fido2_credentials: None, - }), - identity: None, - card: None, - secure_note: None, - favorite: false, - reprompt: CipherRepromptType::None, - organization_use_totp: true, - edit: true, - view_password: true, - local_data: None, - attachments: None, - fields: None, - password_history: None, - creation_date: "2024-05-31T11:20:58.4566667Z".parse().unwrap(), - deleted_date: None, - revision_date: "2024-05-31T11:20:58.4566667Z".parse().unwrap(), - } - } - - fn test_attachment_legacy() -> Attachment { - Attachment { - id: Some("uf7bkexzag04d3cw04jsbqqkbpbwhxs0".to_string()), - url: Some("http://localhost:4000/attachments//358f2b2b-9326-4e5e-94a8-b18100bb0908/uf7bkexzag04d3cw04jsbqqkbpbwhxs0".to_string()), - file_name: Some("2.mV50WiLq6duhwGbhM1TO0A==|dTufWNH8YTPP0EMlNLIpFA==|QHp+7OM8xHtEmCfc9QPXJ0Ro2BeakzvLgxJZ7NdLuDc=".parse().unwrap()), - key: None, - size: Some("65".to_string()), - size_name: Some("65 Bytes".to_string()), - } - } - - fn test_attachment_v2() -> Attachment { - Attachment { - id: Some("a77m56oerrz5b92jm05lq5qoyj1xh2t9".to_string()), - url: Some("http://localhost:4000/attachments//358f2b2b-9326-4e5e-94a8-b18100bb0908/uf7bkexzag04d3cw04jsbqqkbpbwhxs0".to_string()), - file_name: Some("2.GhazFdCYQcM5v+AtVwceQA==|98bMUToqC61VdVsSuXWRwA==|bsLByMht9Hy5QO9pPMRz0K4d0aqBiYnnROGM5YGbNu4=".parse().unwrap()), - key: Some("2.6TPEiYULFg/4+3CpDRwCqw==|6swweBHCJcd5CHdwBBWuRN33XRV22VoroDFDUmiM4OzjPEAhgZK57IZS1KkBlCcFvT+t+YbsmDcdv+Lqr+iJ3MmzfJ40MCB5TfYy+22HVRA=|rkgFDh2IWTfPC1Y66h68Diiab/deyi1p/X0Fwkva0NQ=".parse().unwrap()), - size: Some("65".to_string()), - size_name: Some("65 Bytes".to_string()), - } - } - - #[tokio::test] - async fn test_move_user_cipher_with_attachment_without_key_to_org_fails() { - let client = Client::init_test_account(test_bitwarden_com_account()).await; - - let mut cipher = test_cipher(); - cipher.attachments = Some(vec![test_attachment_legacy()]); - - let view = client.vault().ciphers().decrypt(cipher.clone()).unwrap(); - - // Move cipher to organization - let res = client.vault().ciphers().move_to_organization( - view, - "1bc9ac1e-f5aa-45f2-94bf-b181009709b8".parse().unwrap(), - ); - - assert!(res.is_err()); - } - - #[tokio::test] - async fn test_encrypt_cipher_with_legacy_attachment_without_key() { - let client = Client::init_test_account(test_bitwarden_com_account()).await; - - let mut cipher = test_cipher(); - let attachment = test_attachment_legacy(); - cipher.attachments = Some(vec![attachment.clone()]); - - let view = client.vault().ciphers().decrypt(cipher.clone()).unwrap(); - - assert!(cipher.key.is_none()); - - // Assert the cipher has a key, and the attachment is still readable - let new_cipher = client.vault().ciphers().encrypt(view).unwrap(); - assert!(new_cipher.key.is_some()); - - let view = client.vault().ciphers().decrypt(new_cipher).unwrap(); - let attachments = view.clone().attachments.unwrap(); - let attachment_view = attachments.first().unwrap().clone(); - assert!(attachment_view.key.is_none()); - - assert_eq!(attachment_view.file_name.unwrap(), "h.txt"); - - let buf = vec![ - 2, 100, 205, 148, 152, 77, 184, 77, 53, 80, 38, 240, 83, 217, 251, 118, 254, 27, 117, - 41, 148, 244, 216, 110, 216, 255, 104, 215, 23, 15, 176, 239, 208, 114, 95, 159, 23, - 211, 98, 24, 145, 166, 60, 197, 42, 204, 131, 144, 253, 204, 195, 154, 27, 201, 215, - 43, 10, 244, 107, 226, 152, 85, 167, 66, 185, - ]; - - let content = client - .vault() - .attachments() - .decrypt_buffer(cipher, attachment, buf.as_slice()) - .unwrap(); - - assert_eq!(content, b"Hello"); - } - - #[tokio::test] - async fn test_encrypt_cipher_with_v1_attachment_without_key() { - let client = Client::init_test_account(test_bitwarden_com_account()).await; - - let mut cipher = test_cipher(); - let attachment = test_attachment_v2(); - cipher.attachments = Some(vec![attachment.clone()]); - - let view = client.vault().ciphers().decrypt(cipher.clone()).unwrap(); - - assert!(cipher.key.is_none()); - - // Assert the cipher has a key, and the attachment is still readable - let new_cipher = client.vault().ciphers().encrypt(view).unwrap(); - assert!(new_cipher.key.is_some()); - - let view = client.vault().ciphers().decrypt(new_cipher).unwrap(); - let attachments = view.clone().attachments.unwrap(); - let attachment_view = attachments.first().unwrap().clone(); - assert!(attachment_view.key.is_some()); - - // Ensure attachment key is updated since it's now protected by the cipher key - assert_ne!( - attachment.clone().key.unwrap().to_string(), - attachment_view.clone().key.unwrap().to_string() - ); - - assert_eq!(attachment_view.file_name.unwrap(), "h.txt"); - - let buf = vec![ - 2, 114, 53, 72, 20, 82, 18, 46, 48, 137, 97, 1, 100, 142, 120, 187, 28, 36, 180, 46, - 189, 254, 133, 23, 169, 58, 73, 212, 172, 116, 185, 127, 111, 92, 112, 145, 99, 28, - 158, 198, 48, 241, 121, 218, 66, 37, 152, 197, 122, 241, 110, 82, 245, 72, 47, 230, 95, - 188, 196, 170, 127, 67, 44, 129, 90, - ]; - - let content = client - .vault() - .attachments() - .decrypt_buffer(cipher, attachment, buf.as_slice()) - .unwrap(); - - assert_eq!(content, b"Hello"); - - // Move cipher to organization - let new_view = client - .vault() - .ciphers() - .move_to_organization( - view, - "1bc9ac1e-f5aa-45f2-94bf-b181009709b8".parse().unwrap(), - ) - .unwrap(); - let new_cipher = client.vault().ciphers().encrypt(new_view).unwrap(); - - let attachment = new_cipher - .clone() - .attachments - .unwrap() - .first() - .unwrap() - .clone(); - - // Ensure attachment key is still the same since it's protected by the cipher key - assert_eq!( - attachment.clone().key.unwrap().to_string(), - attachment_view.key.unwrap().to_string() - ); - - let content = client - .vault() - .attachments() - .decrypt_buffer(new_cipher, attachment, buf.as_slice()) - .unwrap(); - - assert_eq!(content, b"Hello"); - } -} diff --git a/crates/bitwarden-vault/src/mobile/client_collection.rs b/crates/bitwarden-vault/src/mobile/client_collection.rs deleted file mode 100644 index a3d6ee612..000000000 --- a/crates/bitwarden-vault/src/mobile/client_collection.rs +++ /dev/null @@ -1,81 +0,0 @@ -use bitwarden_core::{Client, Error}; -use bitwarden_crypto::{KeyDecryptable, LocateKey}; - -use crate::{ClientVault, Collection, CollectionView}; - -pub struct ClientCollections<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> ClientCollections<'a> { - pub fn decrypt(&self, collection: Collection) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = collection.locate_key(&enc, &None)?; - - let view = collection.decrypt_with_key(key)?; - - Ok(view) - } - - pub fn decrypt_list(&self, collections: Vec) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - - let views: Result, _> = collections - .iter() - .map(|c| -> Result { - let key = c.locate_key(&enc, &None)?; - Ok(c.decrypt_with_key(key)?) - }) - .collect(); - - views - } -} - -impl<'a> ClientVault<'a> { - pub fn collections(&'a self) -> ClientCollections<'a> { - ClientCollections { - client: self.client, - } - } -} - -#[cfg(test)] -mod tests { - use bitwarden_core::client::test_accounts::test_bitwarden_com_account; - - use super::*; - use crate::ClientVaultExt; - - #[tokio::test] - async fn test_decrypt_list() { - let client = Client::init_test_account(test_bitwarden_com_account()).await; - - let dec = client.vault().collections().decrypt_list(vec![Collection { - id: Some("66c5ca57-0868-4c7e-902f-b181009709c0".parse().unwrap()), - organization_id: "1bc9ac1e-f5aa-45f2-94bf-b181009709b8".parse().unwrap(), - name: "2.EI9Km5BfrIqBa1W+WCccfA==|laWxNnx+9H3MZww4zm7cBSLisjpi81zreaQntRhegVI=|x42+qKFf5ga6DIL0OW5pxCdLrC/gm8CXJvf3UASGteI=".parse().unwrap(), - external_id: None, - hide_passwords: false, - read_only: false, - }]).unwrap(); - - assert_eq!(dec[0].name, "Default collection"); - } - - #[tokio::test] - async fn test_decrypt() { - let client = Client::init_test_account(test_bitwarden_com_account()).await; - - let dec = client.vault().collections().decrypt(Collection { - id: Some("66c5ca57-0868-4c7e-902f-b181009709c0".parse().unwrap()), - organization_id: "1bc9ac1e-f5aa-45f2-94bf-b181009709b8".parse().unwrap(), - name: "2.EI9Km5BfrIqBa1W+WCccfA==|laWxNnx+9H3MZww4zm7cBSLisjpi81zreaQntRhegVI=|x42+qKFf5ga6DIL0OW5pxCdLrC/gm8CXJvf3UASGteI=".parse().unwrap(), - external_id: None, - hide_passwords: false, - read_only: false, - }).unwrap(); - - assert_eq!(dec.name, "Default collection"); - } -} diff --git a/crates/bitwarden-vault/src/mobile/client_folders.rs b/crates/bitwarden-vault/src/mobile/client_folders.rs deleted file mode 100644 index d8ebb76ed..000000000 --- a/crates/bitwarden-vault/src/mobile/client_folders.rs +++ /dev/null @@ -1,45 +0,0 @@ -use bitwarden_core::{Client, Error}; -use bitwarden_crypto::{KeyDecryptable, KeyEncryptable}; - -use crate::{ClientVault, Folder, FolderView}; - -pub struct ClientFolders<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> ClientFolders<'a> { - pub fn encrypt(&self, folder_view: FolderView) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let folder = folder_view.encrypt_with_key(key)?; - - Ok(folder) - } - - pub fn decrypt(&self, folder: Folder) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let folder_view = folder.decrypt_with_key(key)?; - - Ok(folder_view) - } - - pub fn decrypt_list(&self, folders: Vec) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let views = folders.decrypt_with_key(key)?; - - Ok(views) - } -} - -impl<'a> ClientVault<'a> { - pub fn folders(&'a self) -> ClientFolders<'a> { - ClientFolders { - client: self.client, - } - } -} diff --git a/crates/bitwarden-vault/src/mobile/client_password_history.rs b/crates/bitwarden-vault/src/mobile/client_password_history.rs deleted file mode 100644 index 98d989dbd..000000000 --- a/crates/bitwarden-vault/src/mobile/client_password_history.rs +++ /dev/null @@ -1,39 +0,0 @@ -use bitwarden_core::{Client, Error}; -use bitwarden_crypto::{KeyDecryptable, KeyEncryptable}; - -use crate::{ClientVault, PasswordHistory, PasswordHistoryView}; - -pub struct ClientPasswordHistory<'a> { - pub(crate) client: &'a Client, -} - -impl<'a> ClientPasswordHistory<'a> { - pub fn encrypt(&self, history_view: PasswordHistoryView) -> Result { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let history = history_view.encrypt_with_key(key)?; - - Ok(history) - } - - pub fn decrypt_list( - &self, - history: Vec, - ) -> Result, Error> { - let enc = self.client.internal.get_encryption_settings()?; - let key = enc.get_key(&None)?; - - let history_view = history.decrypt_with_key(key)?; - - Ok(history_view) - } -} - -impl<'a> ClientVault<'a> { - pub fn password_history(&'a self) -> ClientPasswordHistory<'a> { - ClientPasswordHistory { - client: self.client, - } - } -} diff --git a/crates/bitwarden-vault/src/mobile/mod.rs b/crates/bitwarden-vault/src/mobile/mod.rs deleted file mode 100644 index 59e28b6e8..000000000 --- a/crates/bitwarden-vault/src/mobile/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod client_attachments; -mod client_ciphers; -mod client_collection; -mod client_folders; -mod client_password_history; diff --git a/crates/bitwarden-vault/src/password_history.rs b/crates/bitwarden-vault/src/password_history.rs deleted file mode 100644 index 5e2075e3b..000000000 --- a/crates/bitwarden-vault/src/password_history.rs +++ /dev/null @@ -1,57 +0,0 @@ -use bitwarden_api_api::models::CipherPasswordHistoryModel; -use bitwarden_crypto::{ - CryptoError, EncString, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, -}; -use chrono::{DateTime, Utc}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::VaultParseError; - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PasswordHistory { - password: EncString, - last_used_date: DateTime, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PasswordHistoryView { - password: String, - last_used_date: DateTime, -} - -impl KeyEncryptable for PasswordHistoryView { - fn encrypt_with_key(self, key: &SymmetricCryptoKey) -> Result { - Ok(PasswordHistory { - password: self.password.encrypt_with_key(key)?, - last_used_date: self.last_used_date, - }) - } -} - -impl KeyDecryptable for PasswordHistory { - fn decrypt_with_key( - &self, - key: &SymmetricCryptoKey, - ) -> Result { - Ok(PasswordHistoryView { - password: self.password.decrypt_with_key(key).ok().unwrap_or_default(), - last_used_date: self.last_used_date, - }) - } -} - -impl TryFrom for PasswordHistory { - type Error = VaultParseError; - - fn try_from(model: CipherPasswordHistoryModel) -> Result { - Ok(Self { - password: model.password.parse()?, - last_used_date: model.last_used_date.parse()?, - }) - } -} diff --git a/crates/bitwarden-vault/src/sync.rs b/crates/bitwarden-vault/src/sync.rs deleted file mode 100644 index be4c3b169..000000000 --- a/crates/bitwarden-vault/src/sync.rs +++ /dev/null @@ -1,169 +0,0 @@ -use bitwarden_api_api::models::{ - DomainsResponseModel, ProfileOrganizationResponseModel, ProfileResponseModel, SyncResponseModel, -}; -use bitwarden_core::{ - client::encryption_settings::EncryptionSettings, require, Client, Error, MissingFieldError, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use thiserror::Error; -use uuid::Uuid; - -use crate::{Cipher, Collection, Folder, GlobalDomains, VaultParseError}; - -#[derive(Debug, Error)] -pub enum SyncError { - #[error(transparent)] - Core(#[from] bitwarden_core::Error), - - #[error(transparent)] - MissingFieldError(#[from] MissingFieldError), - - #[error(transparent)] - VaultParse(#[from] VaultParseError), -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SyncRequest { - /// Exclude the subdomains from the response, defaults to false - pub exclude_subdomains: Option, -} - -pub(crate) async fn sync(client: &Client, input: &SyncRequest) -> Result { - let config = client.internal.get_api_configurations().await; - let sync = bitwarden_api_api::apis::sync_api::sync_get(&config.api, input.exclude_subdomains) - .await - .map_err(|e| SyncError::Core(e.into()))?; - - let org_keys: Vec<_> = require!(sync.profile.as_ref()) - .organizations - .as_deref() - .unwrap_or_default() - .iter() - .filter_map(|o| o.id.zip(o.key.as_deref().and_then(|k| k.parse().ok()))) - .collect(); - - let enc = client - .internal - .initialize_org_crypto(org_keys) - .map_err(bitwarden_core::Error::EncryptionSettings)?; - - SyncResponse::process_response(sync, &enc) -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProfileResponse { - pub id: Uuid, - pub name: String, - pub email: String, - - //key: String, - //private_key: String, - pub organizations: Vec, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProfileOrganizationResponse { - pub id: Uuid, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct DomainResponse { - pub equivalent_domains: Vec>, - pub global_equivalent_domains: Vec, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SyncResponse { - /// Data about the user, including their encryption keys and the organizations they are a part - /// of - pub profile: ProfileResponse, - pub folders: Vec, - pub collections: Vec, - /// List of ciphers accessible by the user - pub ciphers: Vec, - pub domains: Option, - //pub policies: Vec, - //pub sends: Vec, -} - -impl SyncResponse { - pub(crate) fn process_response( - response: SyncResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let profile = require!(response.profile); - let ciphers = require!(response.ciphers); - - fn try_into_iter(iter: In) -> Result - where - In: IntoIterator, - InItem: TryInto, - Out: FromIterator, - { - iter.into_iter().map(|i| i.try_into()).collect() - } - - Ok(SyncResponse { - profile: ProfileResponse::process_response(*profile, enc)?, - folders: try_into_iter(require!(response.folders))?, - collections: try_into_iter(require!(response.collections))?, - ciphers: try_into_iter(ciphers)?, - domains: response.domains.map(|d| (*d).try_into()).transpose()?, - //policies: try_into_iter(require!(response.policies))?, - //sends: try_into_iter(require!(response.sends))?, - }) - } -} - -impl ProfileOrganizationResponse { - fn process_response( - response: ProfileOrganizationResponseModel, - ) -> Result { - Ok(ProfileOrganizationResponse { - id: require!(response.id), - }) - } -} - -impl ProfileResponse { - fn process_response( - response: ProfileResponseModel, - _enc: &EncryptionSettings, - ) -> Result { - Ok(ProfileResponse { - id: require!(response.id), - name: require!(response.name), - email: require!(response.email), - //key: response.key, - //private_key: response.private_key, - organizations: response - .organizations - .unwrap_or_default() - .into_iter() - .map(ProfileOrganizationResponse::process_response) - .collect::>()?, - }) - } -} - -impl TryFrom for DomainResponse { - type Error = SyncError; - - fn try_from(value: DomainsResponseModel) -> Result { - Ok(Self { - equivalent_domains: value.equivalent_domains.unwrap_or_default(), - global_equivalent_domains: value - .global_equivalent_domains - .unwrap_or_default() - .into_iter() - .map(|s| s.try_into()) - .collect::, _>>()?, - }) - } -} diff --git a/crates/bitwarden-vault/src/totp.rs b/crates/bitwarden-vault/src/totp.rs deleted file mode 100644 index 8aee3e694..000000000 --- a/crates/bitwarden-vault/src/totp.rs +++ /dev/null @@ -1,381 +0,0 @@ -use std::{collections::HashMap, str::FromStr}; - -use bitwarden_core::VaultLocked; -use bitwarden_crypto::{CryptoError, KeyContainer}; -use chrono::{DateTime, Utc}; -use hmac::{Hmac, Mac}; -use reqwest::Url; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use thiserror::Error; - -use crate::CipherListView; - -type HmacSha1 = Hmac; -type HmacSha256 = Hmac; -type HmacSha512 = Hmac; - -const BASE32_CHARS: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; -const STEAM_CHARS: &str = "23456789BCDFGHJKMNPQRTVWXY"; - -const DEFAULT_ALGORITHM: Algorithm = Algorithm::Sha1; -const DEFAULT_DIGITS: u32 = 6; -const DEFAULT_PERIOD: u32 = 30; - -#[derive(Debug, Error)] -pub enum TotpError { - #[error("Invalid otpauth")] - InvalidOtpauth, - #[error("Missing secret")] - MissingSecret, - - #[error(transparent)] - CryptoError(#[from] CryptoError), - #[error(transparent)] - VaultLocked(#[from] VaultLocked), -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct TotpResponse { - /// Generated TOTP code - pub code: String, - /// Time period - pub period: u32, -} - -/// Generate a OATH or RFC 6238 TOTP code from a provided key. -/// -/// -/// -/// Key can be either: -/// - A base32 encoded string -/// - OTP Auth URI -/// - Steam URI -/// -/// Supports providing an optional time, and defaults to current system time if none is provided. -/// -/// Arguments: -/// - `key` - The key to generate the TOTP code from -/// - `time` - The time in UTC to generate the TOTP code for, defaults to current system time -pub fn generate_totp(key: String, time: Option>) -> Result { - let params: Totp = key.parse()?; - - let time = time.unwrap_or_else(Utc::now); - - let otp = params.derive_otp(time.timestamp()); - - Ok(TotpResponse { - code: otp, - period: params.period, - }) -} - -/// Generate a OATH or RFC 6238 TOTP code from a provided CipherListView. -/// -/// See [generate_totp] for more information. -pub fn generate_totp_cipher_view( - enc: &dyn KeyContainer, - view: CipherListView, - time: Option>, -) -> Result { - let key = view.get_totp_key(enc)?.ok_or(TotpError::MissingSecret)?; - - generate_totp(key, time) -} - -#[derive(Clone, Copy, Debug)] -enum Algorithm { - Sha1, - Sha256, - Sha512, - Steam, -} - -impl Algorithm { - // Derive the HMAC hash for the given algorithm - fn derive_hash(&self, key: &[u8], time: &[u8]) -> Vec { - fn compute_digest(digest: D, time: &[u8]) -> Vec { - digest.chain_update(time).finalize().into_bytes().to_vec() - } - - match self { - Algorithm::Sha1 => compute_digest( - HmacSha1::new_from_slice(key).expect("hmac new_from_slice should not fail"), - time, - ), - Algorithm::Sha256 => compute_digest( - HmacSha256::new_from_slice(key).expect("hmac new_from_slice should not fail"), - time, - ), - Algorithm::Sha512 => compute_digest( - HmacSha512::new_from_slice(key).expect("hmac new_from_slice should not fail"), - time, - ), - Algorithm::Steam => compute_digest( - HmacSha1::new_from_slice(key).expect("hmac new_from_slice should not fail"), - time, - ), - } - } -} - -#[derive(Debug)] -struct Totp { - algorithm: Algorithm, - digits: u32, - period: u32, - secret: Vec, -} - -impl Totp { - fn derive_otp(&self, time: i64) -> String { - let time = time / self.period as i64; - - let hash = self - .algorithm - .derive_hash(&self.secret, time.to_be_bytes().as_ref()); - let binary = derive_binary(hash); - - if let Algorithm::Steam = self.algorithm { - derive_steam_otp(binary, self.digits) - } else { - let otp = binary % 10_u32.pow(self.digits); - format!("{1:00$}", self.digits as usize, otp) - } - } -} - -impl FromStr for Totp { - type Err = TotpError; - - /// Parses the provided key and returns the corresponding `Totp`. - /// - /// Key can be either: - /// - A base32 encoded string - /// - OTP Auth URI - /// - Steam URI - fn from_str(key: &str) -> Result { - let params = if key.starts_with("otpauth://") { - let url = Url::parse(key).map_err(|_| TotpError::InvalidOtpauth)?; - let parts: HashMap<_, _> = url.query_pairs().collect(); - - Totp { - algorithm: parts - .get("algorithm") - .and_then(|v| match v.to_uppercase().as_ref() { - "SHA1" => Some(Algorithm::Sha1), - "SHA256" => Some(Algorithm::Sha256), - "SHA512" => Some(Algorithm::Sha512), - _ => None, - }) - .unwrap_or(DEFAULT_ALGORITHM), - digits: parts - .get("digits") - .and_then(|v| v.parse().ok()) - .map(|v: u32| v.clamp(0, 10)) - .unwrap_or(DEFAULT_DIGITS), - period: parts - .get("period") - .and_then(|v| v.parse().ok()) - .map(|v: u32| v.max(1)) - .unwrap_or(DEFAULT_PERIOD), - secret: decode_b32( - &parts - .get("secret") - .map(|v| v.to_string()) - .ok_or(TotpError::MissingSecret)?, - ), - } - } else if let Some(secret) = key.strip_prefix("steam://") { - Totp { - algorithm: Algorithm::Steam, - digits: 5, - period: DEFAULT_PERIOD, - secret: decode_b32(secret), - } - } else { - Totp { - algorithm: DEFAULT_ALGORITHM, - digits: DEFAULT_DIGITS, - period: DEFAULT_PERIOD, - secret: decode_b32(key), - } - }; - - Ok(params) - } -} - -/// Derive the Steam OTP from the hash with the given number of digits. -fn derive_steam_otp(binary: u32, digits: u32) -> String { - let mut full_code = binary & 0x7fffffff; - - (0..digits) - .map(|_| { - let index = full_code as usize % STEAM_CHARS.len(); - let char = STEAM_CHARS - .chars() - .nth(index) - .expect("Should always be within range"); - full_code /= STEAM_CHARS.len() as u32; - char - }) - .collect() -} - -/// Derive the OTP from the hash with the given number of digits. -fn derive_binary(hash: Vec) -> u32 { - let offset = (hash.last().unwrap_or(&0) & 15) as usize; - - ((hash[offset] & 127) as u32) << 24 - | (hash[offset + 1] as u32) << 16 - | (hash[offset + 2] as u32) << 8 - | hash[offset + 3] as u32 -} - -/// This code is migrated from our javascript implementation and is not technically a correct base32 -/// decoder since we filter out various characters, and use exact chunking. -fn decode_b32(s: &str) -> Vec { - let s = s.to_uppercase(); - - let mut bits = String::new(); - for c in s.chars() { - if let Some(i) = BASE32_CHARS.find(c) { - bits.push_str(&format!("{:05b}", i)); - } - } - let mut bytes = Vec::new(); - - for chunk in bits.as_bytes().chunks_exact(8) { - let byte_str = std::str::from_utf8(chunk).expect("The value is a valid string"); - let byte = u8::from_str_radix(byte_str, 2).expect("The value is a valid binary string"); - bytes.push(byte); - } - - bytes -} - -#[cfg(test)] -mod tests { - use bitwarden_crypto::{CryptoError, SymmetricCryptoKey}; - use chrono::Utc; - use uuid::Uuid; - - use super::*; - use crate::{cipher::cipher::CipherListViewType, CipherRepromptType}; - - #[test] - fn test_decode_b32() { - let res = decode_b32("WQIQ25BRKZYCJVYP"); - assert_eq!(res, vec![180, 17, 13, 116, 49, 86, 112, 36, 215, 15]); - - let res = decode_b32("ABCD123"); - assert_eq!(res, vec![0, 68, 61]); - } - - #[test] - fn test_generate_totp() { - let cases = vec![ - ("WQIQ25BRKZYCJVYP", "194506"), // valid base32 - ("wqiq25brkzycjvyp", "194506"), // lowercase - ("PIUDISEQYA", "829846"), // non padded - ("PIUDISEQYA======", "829846"), // padded - ("PIUD1IS!EQYA=", "829846"), // sanitized - // Steam - ("steam://HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ", "7W6CJ"), - ("steam://ABCD123", "N26DF"), - // Various weird lengths - ("ddfdf", "932653"), - ("HJSGFJHDFDJDJKSDFD", "000034"), - ("xvdsfasdfasdasdghsgsdfg", "403786"), - ("KAKFJWOSFJ12NWL", "093430"), - ]; - - let time = Some( - DateTime::parse_from_rfc3339("2023-01-01T00:00:00.000Z") - .unwrap() - .with_timezone(&Utc), - ); - - for (key, expected_code) in cases { - let response = generate_totp(key.to_string(), time).unwrap(); - - assert_eq!(response.code, expected_code, "wrong code for key: {key}"); - assert_eq!(response.period, 30); - } - } - - #[test] - fn test_generate_otpauth() { - let key = "otpauth://totp/test-account?secret=WQIQ25BRKZYCJVYP".to_string(); - let time = Some( - DateTime::parse_from_rfc3339("2023-01-01T00:00:00.000Z") - .unwrap() - .with_timezone(&Utc), - ); - let response = generate_totp(key, time).unwrap(); - - assert_eq!(response.code, "194506".to_string()); - assert_eq!(response.period, 30); - } - - #[test] - fn test_generate_otpauth_period() { - let key = "otpauth://totp/test-account?secret=WQIQ25BRKZYCJVYP&period=60".to_string(); - let time = Some( - DateTime::parse_from_rfc3339("2023-01-01T00:00:00.000Z") - .unwrap() - .with_timezone(&Utc), - ); - let response = generate_totp(key, time).unwrap(); - - assert_eq!(response.code, "730364".to_string()); - assert_eq!(response.period, 60); - } - - #[test] - fn test_generate_totp_cipher_view() { - let view = CipherListView { - id: Some("090c19ea-a61a-4df6-8963-262b97bc6266".parse().unwrap()), - organization_id: None, - folder_id: None, - collection_ids: vec![], - key: None, - name: "My test login".to_string(), - sub_title: "test_username".to_string(), - r#type: CipherListViewType::Login { - has_fido2: true, - totp: Some("2.hqdioUAc81FsKQmO1XuLQg==|oDRdsJrQjoFu9NrFVy8tcJBAFKBx95gHaXZnWdXbKpsxWnOr2sKipIG43pKKUFuq|3gKZMiboceIB5SLVOULKg2iuyu6xzos22dfJbvx0EHk=".parse().unwrap()), - }, - favorite: false, - reprompt: CipherRepromptType::None, - edit: true, - view_password: true, - attachments: 0, - creation_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - deleted_date: None, - revision_date: "2024-01-30T17:55:36.150Z".parse().unwrap(), - }; - - struct MockKeyContainer(SymmetricCryptoKey); - impl KeyContainer for MockKeyContainer { - fn get_key<'a>( - &'a self, - _: &Option, - ) -> Result<&'a SymmetricCryptoKey, CryptoError> { - Ok(&self.0) - } - } - - let enc = MockKeyContainer("w2LO+nwV4oxwswVYCxlOfRUseXfvU03VzvKQHrqeklPgiMZrspUe6sOBToCnDn9Ay0tuCBn8ykVVRb7PWhub2Q==".to_string().try_into().unwrap()); - let time = DateTime::parse_from_rfc3339("2023-01-01T00:00:00.000Z") - .unwrap() - .with_timezone(&Utc); - - let response = generate_totp_cipher_view(&enc, view, Some(time)).unwrap(); - assert_eq!(response.code, "559388".to_string()); - assert_eq!(response.period, 30); - } -} diff --git a/crates/bitwarden-vault/src/uniffi_support.rs b/crates/bitwarden-vault/src/uniffi_support.rs deleted file mode 100644 index 932f0de7a..000000000 --- a/crates/bitwarden-vault/src/uniffi_support.rs +++ /dev/null @@ -1,8 +0,0 @@ -use bitwarden_crypto::EncString; -use uuid::Uuid; - -uniffi::ffi_converter_forward!(EncString, bitwarden_crypto::UniFfiTag, crate::UniFfiTag); - -type DateTime = chrono::DateTime; -uniffi::ffi_converter_forward!(DateTime, bitwarden_core::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!(Uuid, bitwarden_core::UniFfiTag, crate::UniFfiTag); diff --git a/crates/bitwarden-vault/uniffi.toml b/crates/bitwarden-vault/uniffi.toml deleted file mode 100644 index 8d4fbe384..000000000 --- a/crates/bitwarden-vault/uniffi.toml +++ /dev/null @@ -1,9 +0,0 @@ -[bindings.kotlin] -package_name = "com.bitwarden.vault" -generate_immutable_records = true -android = true - -[bindings.swift] -ffi_module_name = "BitwardenVaultFFI" -module_name = "BitwardenVault" -generate_immutable_records = true diff --git a/crates/bitwarden-wasm-internal/Cargo.toml b/crates/bitwarden-wasm-internal/Cargo.toml deleted file mode 100644 index 33f8128e7..000000000 --- a/crates/bitwarden-wasm-internal/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "bitwarden-wasm-internal" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[lib] -crate-type = ["cdylib"] - -[dependencies] -bitwarden-core = { workspace = true, features = ["wasm", "internal"] } -bitwarden-crypto = { workspace = true, features = ["wasm"] } -bitwarden-vault = { workspace = true, features = ["wasm"] } -console_error_panic_hook = "0.1.7" -console_log = { version = "1.0.0", features = ["color"] } -js-sys = "0.3.68" -log = "0.4.20" -serde_json = ">=1.0.96, <2.0" -# When upgrading wasm-bindgen, make sure to update the version in the workflows! -wasm-bindgen = { version = "=0.2.95", features = ["serde-serialize"] } -wasm-bindgen-futures = "0.4.41" - -[lints] -workspace = true diff --git a/crates/bitwarden-wasm-internal/README.md b/crates/bitwarden-wasm-internal/README.md deleted file mode 100644 index 4db9847f5..000000000 --- a/crates/bitwarden-wasm-internal/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# bitwarden-wasm-internal - -**Note:** This is only for internal use. Bitwarden will not provide any support for this crate. - -Requirements: - -- `wasm32-unknown-unknown` rust target. -- `wasm-bindgen-cli` installed. -- `binaryen` installed for `wasm-opt` and `wasm2js`. - -```bash -rustup target add wasm32-unknown-unknown -cargo install -f wasm-bindgen-cli -brew install binaryen -``` - -#### Build - -```bash -# dev -./build.sh - -# release -./build.sh -r -``` diff --git a/crates/bitwarden-wasm-internal/build.sh b/crates/bitwarden-wasm-internal/build.sh deleted file mode 100755 index 109037e89..000000000 --- a/crates/bitwarden-wasm-internal/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -# Move to the root of the repository -cd "$(dirname "$0")" -cd ../../ - -if [ "$1" != "-r" ]; then - # Dev - cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown - wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm - wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm -else - # Release - cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown --release - wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm - wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm -fi - -# Format -npx prettier --write ./languages/js/sdk-internal - -# Optimize size -wasm-opt -Os ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm - -# Transpile to JS -wasm2js ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js -npx terser ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js diff --git a/crates/bitwarden-wasm-internal/src/client.rs b/crates/bitwarden-wasm-internal/src/client.rs deleted file mode 100644 index 0a5ce27d5..000000000 --- a/crates/bitwarden-wasm-internal/src/client.rs +++ /dev/null @@ -1,71 +0,0 @@ -extern crate console_error_panic_hook; -use std::rc::Rc; - -use bitwarden_core::{Client, ClientSettings}; -use log::{set_max_level, Level}; -use wasm_bindgen::prelude::*; - -use crate::{vault::ClientVault, ClientCrypto}; - -#[wasm_bindgen] -pub enum LogLevel { - Trace, - Debug, - Info, - Warn, - Error, -} - -fn convert_level(level: LogLevel) -> Level { - match level { - LogLevel::Trace => Level::Trace, - LogLevel::Debug => Level::Debug, - LogLevel::Info => Level::Info, - LogLevel::Warn => Level::Warn, - LogLevel::Error => Level::Error, - } -} - -// Rc<...> is to avoid needing to take ownership of the Client during our async run_command -// function https://github.com/rustwasm/wasm-bindgen/issues/2195#issuecomment-799588401 -#[wasm_bindgen] -pub struct BitwardenClient(pub(crate) Rc); - -#[wasm_bindgen] -impl BitwardenClient { - #[wasm_bindgen(constructor)] - pub fn new(settings: Option, log_level: Option) -> Self { - console_error_panic_hook::set_once(); - let log_level = convert_level(log_level.unwrap_or(LogLevel::Info)); - if let Err(_e) = console_log::init_with_level(log_level) { - set_max_level(log_level.to_level_filter()) - } - - Self(Rc::new(Client::new(settings))) - } - - /// Test method, echoes back the input - pub fn echo(&self, msg: String) -> String { - msg - } - - pub fn throw(&self, msg: String) -> Result<(), crate::error::GenericError> { - Err(crate::error::GenericError(msg)) - } - - /// Test method, calls http endpoint - pub async fn http_get(&self, url: String) -> Result { - let client = self.0.internal.get_http_client(); - let res = client.get(&url).send().await.map_err(|e| e.to_string())?; - - res.text().await.map_err(|e| e.to_string()) - } - - pub fn crypto(&self) -> ClientCrypto { - ClientCrypto::new(self.0.clone()) - } - - pub fn vault(&self) -> ClientVault { - ClientVault::new(self.0.clone()) - } -} diff --git a/crates/bitwarden-wasm-internal/src/crypto.rs b/crates/bitwarden-wasm-internal/src/crypto.rs deleted file mode 100644 index f1b581964..000000000 --- a/crates/bitwarden-wasm-internal/src/crypto.rs +++ /dev/null @@ -1,33 +0,0 @@ -use std::rc::Rc; - -use bitwarden_core::{ - mobile::crypto::{InitOrgCryptoRequest, InitUserCryptoRequest}, - Client, -}; -use wasm_bindgen::prelude::*; - -use crate::error::Result; - -#[wasm_bindgen] -pub struct ClientCrypto(Rc); - -impl ClientCrypto { - pub fn new(client: Rc) -> Self { - Self(client) - } -} - -#[wasm_bindgen] -impl ClientCrypto { - /// Initialization method for the user crypto. Needs to be called before any other crypto - /// operations. - pub async fn initialize_user_crypto(&self, req: InitUserCryptoRequest) -> Result<()> { - Ok(self.0.crypto().initialize_user_crypto(req).await?) - } - - /// Initialization method for the organization crypto. Needs to be called after - /// `initialize_user_crypto` but before any other crypto operations. - pub async fn initialize_org_crypto(&self, req: InitOrgCryptoRequest) -> Result<()> { - Ok(self.0.crypto().initialize_org_crypto(req).await?) - } -} diff --git a/crates/bitwarden-wasm-internal/src/custom_types.rs b/crates/bitwarden-wasm-internal/src/custom_types.rs deleted file mode 100644 index 8d20bf85d..000000000 --- a/crates/bitwarden-wasm-internal/src/custom_types.rs +++ /dev/null @@ -1,22 +0,0 @@ -/// This file contains custom TypeScript for types defined by external crates. -/// Everything in the string below is appended to the generated TypeScript definition file. -#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)] -const TS_CUSTOM_TYPES: &'static str = r#" -export type Uuid = string; - -/** - * RFC3339 compliant date-time string. - * @typeParam T - Not used in JavaScript. - */ -export type DateTime = string; - -/** - * UTC date-time string. Not used in JavaScript. - */ -export type Utc = unknown; - -/** - * An integer that is known not to equal zero. - */ -export type NonZeroU32 = number; -"#; diff --git a/crates/bitwarden-wasm-internal/src/error.rs b/crates/bitwarden-wasm-internal/src/error.rs deleted file mode 100644 index 237ee4941..000000000 --- a/crates/bitwarden-wasm-internal/src/error.rs +++ /dev/null @@ -1,28 +0,0 @@ -use wasm_bindgen::prelude::*; - -// Importing an error class defined in JavaScript instead of defining it in Rust -// allows us to extend the `Error` class. It also provides much better console output. -#[wasm_bindgen] -extern "C" { - #[wasm_bindgen(js_name = Error)] - type JsError; - - #[wasm_bindgen(constructor, js_class = Error)] - fn new(message: String) -> JsError; -} - -pub type Result = std::result::Result; - -pub struct GenericError(pub String); - -impl From for GenericError { - fn from(error: T) -> Self { - GenericError(error.to_string()) - } -} - -impl From for JsValue { - fn from(error: GenericError) -> Self { - JsError::new(error.0).into() - } -} diff --git a/crates/bitwarden-wasm-internal/src/lib.rs b/crates/bitwarden-wasm-internal/src/lib.rs deleted file mode 100644 index 6367ff317..000000000 --- a/crates/bitwarden-wasm-internal/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -mod client; -mod crypto; -mod custom_types; -mod error; -mod vault; - -pub use client::BitwardenClient; -pub use crypto::ClientCrypto; -pub use vault::{folders::ClientFolders, ClientVault}; diff --git a/crates/bitwarden-wasm-internal/src/vault/folders.rs b/crates/bitwarden-wasm-internal/src/vault/folders.rs deleted file mode 100644 index 652892694..000000000 --- a/crates/bitwarden-wasm-internal/src/vault/folders.rs +++ /dev/null @@ -1,24 +0,0 @@ -use std::rc::Rc; - -use bitwarden_core::Client; -use bitwarden_vault::{ClientVaultExt, Folder, FolderView}; -use wasm_bindgen::prelude::*; - -use crate::error::Result; - -#[wasm_bindgen] -pub struct ClientFolders(Rc); - -impl ClientFolders { - pub fn new(client: Rc) -> Self { - Self(client) - } -} - -#[wasm_bindgen] -impl ClientFolders { - /// Decrypt folder - pub fn decrypt(&self, folder: Folder) -> Result { - Ok(self.0.vault().folders().decrypt(folder)?) - } -} diff --git a/crates/bitwarden-wasm-internal/src/vault/mod.rs b/crates/bitwarden-wasm-internal/src/vault/mod.rs deleted file mode 100644 index 11db0e130..000000000 --- a/crates/bitwarden-wasm-internal/src/vault/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod folders; - -use std::rc::Rc; - -use bitwarden_core::Client; -use wasm_bindgen::prelude::*; - -use crate::ClientFolders; - -#[wasm_bindgen] -pub struct ClientVault(Rc); - -impl ClientVault { - pub fn new(client: Rc) -> Self { - Self(client) - } -} - -#[wasm_bindgen] -impl ClientVault { - pub fn folders(&self) -> ClientFolders { - ClientFolders::new(self.0.clone()) - } -} diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index 3626f9d11..8a85cb867 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -24,16 +24,16 @@ secrets = [ "dep:bitwarden-sm", "dep:bitwarden-generators", ] # Secrets manager API -wasm = ["bitwarden-core/wasm"] # WASM support +wasm = [] # WASM support [dependencies] bitwarden-core = { workspace = true } bitwarden-generators = { workspace = true, optional = true } bitwarden-sm = { workspace = true, optional = true } -thiserror = { workspace = true } +thiserror = ">=1.0.40, <2.0" [dev-dependencies] -uuid = { workspace = true } +uuid = { version = ">=1.3.3, <2.0", features = ["serde", "v4"] } [lints] workspace = true diff --git a/crates/bw/Cargo.toml b/crates/bw/Cargo.toml deleted file mode 100644 index a2ba807c3..000000000 --- a/crates/bw/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "bw" -version = "0.0.2" -description = """ -Bitwarden Password Manager CLI -""" -keywords = ["bitwarden", "password-manager", "cli"] - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[dependencies] -bitwarden-cli = { workspace = true } -bitwarden-core = { workspace = true } -bitwarden-crypto = { workspace = true } -bitwarden-generators = { workspace = true } -bitwarden-vault = { workspace = true } -clap = { version = "4.5.4", features = ["derive", "env"] } -color-eyre = "0.6.3" -env_logger = "0.11.1" -inquire = "0.7.0" -log = "0.4.20" -tokio = { workspace = true, features = ["rt-multi-thread"] } - -[dev-dependencies] -tempfile = "3.10.0" - -[lints] -workspace = true diff --git a/crates/bw/README.md b/crates/bw/README.md deleted file mode 100644 index ef3d1fe8b..000000000 --- a/crates/bw/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Reserved Bitwarden Crate - -Due to the wild-west nature of crates.io, we can't own a "bitwarden" namespace that we fully -control. This means that certain crate names that we have a high likelihood of using in the future -could be claimed by malicious or uniformed actors. diff --git a/crates/bw/src/auth/login.rs b/crates/bw/src/auth/login.rs deleted file mode 100644 index 131d39f02..000000000 --- a/crates/bw/src/auth/login.rs +++ /dev/null @@ -1,136 +0,0 @@ -use bitwarden_cli::text_prompt_when_none; -use bitwarden_core::{ - auth::login::{ - ApiKeyLoginRequest, PasswordLoginRequest, TwoFactorEmailRequest, TwoFactorProvider, - TwoFactorRequest, - }, - Client, -}; -use bitwarden_vault::{ClientVaultExt, SyncRequest}; -use color_eyre::eyre::{bail, Result}; -use inquire::{Password, Text}; -use log::{debug, error, info}; - -pub(crate) async fn login_password(client: Client, email: Option) -> Result<()> { - let email = text_prompt_when_none("Email", email)?; - - let password = Password::new("Password").without_confirmation().prompt()?; - - let kdf = client.auth().prelogin(email.clone()).await?; - - let result = client - .auth() - .login_password(&PasswordLoginRequest { - email: email.clone(), - password: password.clone(), - two_factor: None, - kdf: kdf.clone(), - }) - .await?; - - if result.captcha.is_some() { - // TODO: We should build a web captcha solution - error!("Captcha required"); - } else if let Some(two_factor) = result.two_factor { - error!("{:?}", two_factor); - - let two_factor = if let Some(tf) = two_factor.authenticator { - debug!("{:?}", tf); - - let token = Text::new("Authenticator code").prompt()?; - - Some(TwoFactorRequest { - token, - provider: TwoFactorProvider::Authenticator, - remember: false, - }) - } else if let Some(tf) = two_factor.email { - // Send token - client - .auth() - .send_two_factor_email(&TwoFactorEmailRequest { - email: email.clone(), - password: password.clone(), - }) - .await?; - - info!("Two factor code sent to {:?}", tf); - let token = Text::new("Two factor code").prompt()?; - - Some(TwoFactorRequest { - token, - provider: TwoFactorProvider::Email, - remember: false, - }) - } else { - bail!("Not supported: {:?}", two_factor); - }; - - let result = client - .auth() - .login_password(&PasswordLoginRequest { - email, - password, - two_factor, - kdf, - }) - .await?; - - debug!("{:?}", result); - } else { - debug!("{:?}", result); - } - - let res = client - .vault() - .sync(&SyncRequest { - exclude_subdomains: Some(true), - }) - .await?; - info!("{:#?}", res); - - Ok(()) -} - -pub(crate) async fn login_api_key( - client: Client, - client_id: Option, - client_secret: Option, -) -> Result<()> { - let client_id = text_prompt_when_none("Client ID", client_id)?; - let client_secret = text_prompt_when_none("Client Secret", client_secret)?; - - let password = Password::new("Password").without_confirmation().prompt()?; - - let result = client - .auth() - .login_api_key(&ApiKeyLoginRequest { - client_id, - client_secret, - password, - }) - .await?; - - debug!("{:?}", result); - - Ok(()) -} - -pub(crate) async fn login_device( - client: Client, - email: Option, - device_identifier: Option, -) -> Result<()> { - let email = text_prompt_when_none("Email", email)?; - let device_identifier = text_prompt_when_none("Device Identifier", device_identifier)?; - - let auth = client.auth().login_device(email, device_identifier).await?; - - println!("Fingerprint: {}", auth.fingerprint); - - Text::new("Press enter once approved").prompt()?; - - client.auth().login_device_complete(auth).await?; - - Ok(()) -} diff --git a/crates/bw/src/auth/mod.rs b/crates/bw/src/auth/mod.rs deleted file mode 100644 index 1f165f5f3..000000000 --- a/crates/bw/src/auth/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -mod login; -pub(crate) use login::{login_api_key, login_device, login_password}; diff --git a/crates/bw/src/main.rs b/crates/bw/src/main.rs deleted file mode 100644 index 06d5d0bd5..000000000 --- a/crates/bw/src/main.rs +++ /dev/null @@ -1,252 +0,0 @@ -use bitwarden_cli::{install_color_eyre, text_prompt_when_none, Color}; -use bitwarden_core::{auth::RegisterRequest, ClientSettings}; -use bitwarden_generators::{ - ClientGeneratorExt, PassphraseGeneratorRequest, PasswordGeneratorRequest, -}; -use clap::{command, Args, CommandFactory, Parser, Subcommand}; -use color_eyre::eyre::Result; -use inquire::Password; -use render::Output; - -mod auth; -mod render; - -#[derive(Parser, Clone)] -#[command(name = "Bitwarden CLI", version, about = "Bitwarden CLI", long_about = None)] -struct Cli { - // Optional as a workaround for https://github.com/clap-rs/clap/issues/3572 - #[command(subcommand)] - command: Option, - - #[arg(short = 'o', long, global = true, value_enum, default_value_t = Output::JSON)] - output: Output, - - #[arg(short = 'c', long, global = true, value_enum, default_value_t = Color::Auto)] - color: Color, -} - -#[derive(Subcommand, Clone)] -enum Commands { - Login(LoginArgs), - - #[command(long_about = "Register")] - Register { - #[arg(short = 'e', long, help = "Email address")] - email: Option, - - name: Option, - - password_hint: Option, - - #[arg(short = 's', long, global = true, help = "Server URL")] - server: Option, - }, - - #[command(long_about = "Manage vault items")] - Item { - #[command(subcommand)] - command: ItemCommands, - }, - - #[command(long_about = "Pull the latest vault data from the server")] - Sync {}, - - #[command(long_about = "Password and passphrase generators")] - Generate { - #[command(subcommand)] - command: GeneratorCommands, - }, -} - -#[derive(Args, Clone)] -struct LoginArgs { - #[command(subcommand)] - command: LoginCommands, - - #[arg(short = 's', long, global = true, help = "Server URL")] - server: Option, -} - -#[derive(Subcommand, Clone)] -enum LoginCommands { - Password { - #[arg(short = 'e', long, help = "Email address")] - email: Option, - }, - ApiKey { - client_id: Option, - client_secret: Option, - }, - Device { - #[arg(short = 'e', long, help = "Email address")] - email: Option, - device_identifier: Option, - }, -} - -#[derive(Subcommand, Clone)] -enum ItemCommands { - Get { id: String }, - Create {}, -} - -#[derive(Subcommand, Clone)] -enum GeneratorCommands { - Password(PasswordGeneratorArgs), - Passphrase(PassphraseGeneratorArgs), -} - -#[derive(Args, Clone)] -struct PasswordGeneratorArgs { - #[arg(short = 'l', long, action, help = "Include lowercase characters (a-z)")] - lowercase: bool, - - #[arg(short = 'u', long, action, help = "Include uppercase characters (A-Z)")] - uppercase: bool, - - #[arg(short = 'n', long, action, help = "Include numbers (0-9)")] - numbers: bool, - - #[arg( - short = 's', - long, - action, - help = "Include special characters (!@#$%^&*)" - )] - special: bool, - - #[arg(long, default_value = "16", help = "Length of generated password")] - length: u8, -} - -#[derive(Args, Clone)] -struct PassphraseGeneratorArgs { - #[arg(long, default_value = "3", help = "Number of words in the passphrase")] - words: u8, - #[arg(long, default_value = " ", help = "Separator between words")] - separator: char, - #[arg(long, action, help = "Capitalize the first letter of each word")] - capitalize: bool, - #[arg(long, action, help = "Include a number in one of the words")] - include_number: bool, -} - -#[tokio::main(flavor = "current_thread")] -async fn main() -> Result<()> { - env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); - - process_commands().await -} - -async fn process_commands() -> Result<()> { - let cli = Cli::parse(); - - install_color_eyre(cli.color)?; - - let Some(command) = cli.command else { - let mut cmd = Cli::command(); - cmd.print_help()?; - return Ok(()); - }; - - match command.clone() { - Commands::Login(args) => { - let settings = args.server.map(|server| ClientSettings { - api_url: format!("{}/api", server), - identity_url: format!("{}/identity", server), - ..Default::default() - }); - let client = bitwarden_core::Client::new(settings); - - match args.command { - // FIXME: Rust CLI will not support password login! - LoginCommands::Password { email } => { - auth::login_password(client, email).await?; - } - LoginCommands::ApiKey { - client_id, - client_secret, - } => auth::login_api_key(client, client_id, client_secret).await?, - LoginCommands::Device { - email, - device_identifier, - } => { - auth::login_device(client, email, device_identifier).await?; - } - } - return Ok(()); - } - Commands::Register { - email, - name, - password_hint, - server, - } => { - let settings = server.map(|server| ClientSettings { - api_url: format!("{}/api", server), - identity_url: format!("{}/identity", server), - ..Default::default() - }); - let client = bitwarden_core::Client::new(settings); - - let email = text_prompt_when_none("Email", email)?; - let password = Password::new("Password").prompt()?; - - client - .auth() - .register(&RegisterRequest { - email, - name, - password, - password_hint, - }) - .await?; - } - _ => {} - } - - // Not login, assuming we have a config - let client = bitwarden_core::Client::new(None); - - // And finally we process all the commands which require authentication - match command { - Commands::Login(_) => unreachable!(), - Commands::Register { .. } => unreachable!(), - Commands::Item { command: _ } => todo!(), - Commands::Sync {} => todo!(), - Commands::Generate { command } => match command { - GeneratorCommands::Password(args) => { - let password = client.generator().password(PasswordGeneratorRequest { - lowercase: args.lowercase, - uppercase: args.uppercase, - numbers: args.numbers, - special: args.special, - length: args.length, - ..Default::default() - })?; - - println!("{}", password); - } - GeneratorCommands::Passphrase(args) => { - let passphrase = client.generator().passphrase(PassphraseGeneratorRequest { - num_words: args.words, - word_separator: args.separator.to_string(), - capitalize: args.capitalize, - include_number: args.include_number, - })?; - - println!("{}", passphrase); - } - }, - }; - - Ok(()) -} - -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - assert_eq!(2 + 2, 4); - } -} diff --git a/crates/bw/src/render.rs b/crates/bw/src/render.rs deleted file mode 100644 index da8ed4997..000000000 --- a/crates/bw/src/render.rs +++ /dev/null @@ -1,11 +0,0 @@ -use clap::ValueEnum; - -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)] -#[allow(clippy::upper_case_acronyms)] -pub(crate) enum Output { - JSON, - YAML, - Table, - TSV, - None, -} diff --git a/crates/memory-testing/.gitignore b/crates/memory-testing/.gitignore deleted file mode 100644 index 53752db25..000000000 --- a/crates/memory-testing/.gitignore +++ /dev/null @@ -1 +0,0 @@ -output diff --git a/crates/memory-testing/Cargo.toml b/crates/memory-testing/Cargo.toml deleted file mode 100644 index 3da4c99de..000000000 --- a/crates/memory-testing/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "memory-testing" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[dependencies] -bitwarden-crypto = { workspace = true } -comfy-table = "7.1.1" -hex = "0.4.3" -serde = "1.0.196" -serde_json = "1.0.113" -zeroize = { version = "1.7.0", features = ["serde"] } diff --git a/crates/memory-testing/Dockerfile b/crates/memory-testing/Dockerfile deleted file mode 100644 index 3df22466d..000000000 --- a/crates/memory-testing/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -############################################### -# Build stage # -############################################### -FROM rust:1.81 AS build - -WORKDIR /app - -# Copy dependency files and create dummy files to allow cargo to build the dependencies in a separate stage -COPY Cargo.toml Cargo.lock /app/ -COPY crates/bitwarden-crypto/Cargo.toml /app/crates/bitwarden-crypto/ -COPY crates/memory-testing/Cargo.toml /app/crates/memory-testing/ - -RUN mkdir -p /app/crates/bitwarden-crypto/src \ - /app/crates/bitwarden-crypto/benches \ - /app/crates/memory-testing/src \ - && touch /app/crates/bitwarden-crypto/src/lib.rs \ - /app/crates/bitwarden-crypto/benches/default_allocator.rs \ - /app/crates/bitwarden-crypto/benches/zeroizing_allocator.rs \ - && echo 'fn main(){}' > /app/crates/memory-testing/src/main.rs \ - && cargo build -p memory-testing --release - -# Delete dummy files and copy the actual source code -RUN rm /app/crates/bitwarden-crypto/src/lib.rs \ - /app/crates/bitwarden-crypto/benches/default_allocator.rs \ - /app/crates/bitwarden-crypto/benches/zeroizing_allocator.rs \ - /app/crates/memory-testing/src/main.rs - -COPY crates/bitwarden-crypto /app/crates/bitwarden-crypto -COPY crates/memory-testing/src /app/crates/memory-testing/src - -# Build the project. We use touch to force a rebuild of the now real files -RUN touch /app/crates/bitwarden-crypto/src/lib.rs /app/crates/memory-testing/src/main.rs -RUN cargo build -p memory-testing --release - -############################################### -# App stage # -############################################### -FROM debian:bookworm-slim - -# This specifically needs to run as root to be able to capture core dumps -USER root - -RUN apt-get update && apt-get install -y --no-install-recommends gdb=13.1-3 && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Copy built project from the build stage and the cases.json file -COPY --from=build /app/target/release/memory-testing /app/target/release/capture-dumps ./ -COPY crates/memory-testing/cases.json . - -CMD [ "/capture-dumps", "./memory-testing", "/" ] diff --git a/crates/memory-testing/Dockerfile.dockerignore b/crates/memory-testing/Dockerfile.dockerignore deleted file mode 100644 index 50f4b1230..000000000 --- a/crates/memory-testing/Dockerfile.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!crates/* -!Cargo.toml -!Cargo.lock diff --git a/crates/memory-testing/cases.json b/crates/memory-testing/cases.json deleted file mode 100644 index 5223d3671..000000000 --- a/crates/memory-testing/cases.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "cases": [ - { - "name": "Symmetric Key", - "symmetric_key": { - "key": "FfhVVP8fmFIZY1WmRszPmRmVCxXNWVcJffPrbkywTPtBNkgfhYGT+D9sVGizYXrPffuj2yoyWqMwF9iF5aMQhQ==" - }, - "memory_lookups": [ - { - "name": "Decrypted key", - "hex": "15f85554ff1f9852196355a646cccf9919950b15cd5957097df3eb6e4cb04cfb" - }, - { - "name": "Decrypted MAC", - "hex": "4136481f858193f83f6c5468b3617acf7dfba3db2a325aa33017d885e5a31085" - } - ] - }, - { - "name": "Asymmetric Key", - "asymmetric_key": { - "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDiTQVuzhdygFz5\nqv14i+XFDGTnDravzUQT1hPKPGUZOUSZ1gwdNgkWqOIaOnR65BHEnL0sp4bnuiYc\nafeK2JAW5Sc8Z7IxBNSuAwhQmuKx3RochMIiuCkI2/p+JvUQoJu6FBNm8OoJ4Cwm\nqqHGZESMfnpQDCuDrB3JdJEdXhtmnl0C48sGjOk3WaBMcgGqn8LbJDUlyu1zdqyv\nb0waJf0iV4PJm2fkUl7+57D/2TkpbCqURVnZK1FFIEg8mr6FzSN1F2pOfktkNYZw\nP7MSNR7o81CkRSCMr7EkIVa+MZYMBx106BMK7FXgWB7nbSpsWKxBk7ZDHkID2fam\nrEcVtrzDAgMBAAECggEBAKwq9OssGGKgjhvUnyrLJHAZ0dqIMyzk+dotkLjX4gKi\nszJmyqiep6N5sStLNbsZMPtoU/RZMCW0VbJgXFhiEp2YkZU/Py5UAoqw++53J+kx\n0d/IkPphKbb3xUec0+1mg5O6GljDCQuiZXS1dIa/WfeZcezclW6Dz9WovY6ePjJ+\n8vEBR1icbNKzyeINd6MtPtpcgQPHtDwHvhPyUDbKDYGbLvjh9nui8h4+ZUlXKuVR\njB0ChxiKV1xJRjkrEVoulOOicd5r597WfB2ghax3pvRZ4MdXemCXm3gQYqPVKach\nvGU+1cPQR/MBJZpxT+EZA97xwtFS3gqwbxJaNFcoE8ECgYEA9OaeYZhQPDo485tI\n1u/Z7L/3PNape9hBQIXoW7+MgcQ5NiWqYh8Jnj43EIYa0wM/ECQINr1Za8Q5e6KR\nJ30FcU+kfyjuQ0jeXdNELGU/fx5XXNg/vV8GevHwxRlwzqZTCg6UExUZzbYEQqd7\nl+wPyETGeua5xCEywA1nX/D101kCgYEA7I6aMFjhEjO71RmzNhqjKJt6DOghoOfQ\nTjhaaanNEhLYSbenFz1mlb21mW67ulmz162saKdIYLxQNJIP8ZPmxh4ummOJI8w9\nClHfo8WuCI2hCjJ19xbQJocSbTA5aJg6lA1IDVZMDbQwsnAByPRGpaLHBT/Q9Bye\nKvCMB+9amXsCgYEAx65yXSkP4sumPBrVHUub6MntERIGRxBgw/drKcPZEMWp0FiN\nwEuGUBxyUWrG3F69QK/gcqGZE6F/LSu0JvptQaKqgXQiMYJsrRvhbkFvsHpQyUcZ\nUZL1ebFjm5HOxPAgrQaN/bEqxOwwNRjSUWEMzUImg3c06JIZCzbinvudtKECgYEA\nkY3JF/iIPI/yglP27lKDlCfeeHSYxI3+oTKRhzSAxx8rUGidenJAXeDGDauR/T7W\npt3pGNfddBBK9Z3uC4Iq3DqUCFE4f/taj7ADAJ1Q0Vh7/28/IJM77ojr8J1cpZwN\nZy2o6PPxhfkagaDjqEeN9Lrs5LD4nEvDkr5CG1vOjmMCgYEAvIBFKRm31NyF8jLi\nCVuPwC5PzrW5iThDmsWTaXFpB3esUsbICO2pEz872oeQS+Em4GO5vXUlpbbFPzup\nPFhA8iMJ8TAvemhvc7oM0OZqpU6p3K4seHf6BkwLxumoA3vDJfovu9RuXVcJVOnf\nDnqOsltgPomWZ7xVfMkm9niL2OA=\n-----END PRIVATE KEY-----" - }, - "memory_lookups": [ - { - "name": "key", - "string": "-----BEGIN PRIVATE KEY-----\nMIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQDiTQVuzhdygFz5\nqv14i+XFDGTnDravzUQT1hPKPGUZOUSZ1gwdNgkWqOIaOnR65BHEnL0sp4bnuiYc\nafeK2JAW5Sc8Z7IxBNSuAwhQmuKx3RochMIiuCkI2/p+JvUQoJu6FBNm8OoJ4Cwm\nqqHGZESMfnpQDCuDrB3JdJEdXhtmnl0C48sGjOk3WaBMcgGqn8LbJDUlyu1zdqyv\nb0waJf0iV4PJm2fkUl7+57D/2TkpbCqURVnZK1FFIEg8mr6FzSN1F2pOfktkNYZw\nP7MSNR7o81CkRSCMr7EkIVa+MZYMBx106BMK7FXgWB7nbSpsWKxBk7ZDHkID2fam\nrEcVtrzDAgMBAAECggEBAKwq9OssGGKgjhvUnyrLJHAZ0dqIMyzk+dotkLjX4gKi\nszJmyqiep6N5sStLNbsZMPtoU/RZMCW0VbJgXFhiEp2YkZU/Py5UAoqw++53J+kx\n0d/IkPphKbb3xUec0+1mg5O6GljDCQuiZXS1dIa/WfeZcezclW6Dz9WovY6ePjJ+\n8vEBR1icbNKzyeINd6MtPtpcgQPHtDwHvhPyUDbKDYGbLvjh9nui8h4+ZUlXKuVR\njB0ChxiKV1xJRjkrEVoulOOicd5r597WfB2ghax3pvRZ4MdXemCXm3gQYqPVKach\nvGU+1cPQR/MBJZpxT+EZA97xwtFS3gqwbxJaNFcoE8ECgYEA9OaeYZhQPDo485tI\n1u/Z7L/3PNape9hBQIXoW7+MgcQ5NiWqYh8Jnj43EIYa0wM/ECQINr1Za8Q5e6KR\nJ30FcU+kfyjuQ0jeXdNELGU/fx5XXNg/vV8GevHwxRlwzqZTCg6UExUZzbYEQqd7\nl+wPyETGeua5xCEywA1nX/D101kCgYEA7I6aMFjhEjO71RmzNhqjKJt6DOghoOfQ\nTjhaaanNEhLYSbenFz1mlb21mW67ulmz162saKdIYLxQNJIP8ZPmxh4ummOJI8w9\nClHfo8WuCI2hCjJ19xbQJocSbTA5aJg6lA1IDVZMDbQwsnAByPRGpaLHBT/Q9Bye\nKvCMB+9amXsCgYEAx65yXSkP4sumPBrVHUub6MntERIGRxBgw/drKcPZEMWp0FiN\nwEuGUBxyUWrG3F69QK/gcqGZE6F/LSu0JvptQaKqgXQiMYJsrRvhbkFvsHpQyUcZ\nUZL1ebFjm5HOxPAgrQaN/bEqxOwwNRjSUWEMzUImg3c06JIZCzbinvudtKECgYEA\nkY3JF/iIPI/yglP27lKDlCfeeHSYxI3+oTKRhzSAxx8rUGidenJAXeDGDauR/T7W\npt3pGNfddBBK9Z3uC4Iq3DqUCFE4f/taj7ADAJ1Q0Vh7/28/IJM77ojr8J1cpZwN\nZy2o6PPxhfkagaDjqEeN9Lrs5LD4nEvDkr5CG1vOjmMCgYEAvIBFKRm31NyF8jLi\nCVuPwC5PzrW5iThDmsWTaXFpB3esUsbICO2pEz872oeQS+Em4GO5vXUlpbbFPzup\nPFhA8iMJ8TAvemhvc7oM0OZqpU6p3K4seHf6BkwLxumoA3vDJfovu9RuXVcJVOnf\nDnqOsltgPomWZ7xVfMkm9niL2OA=\n-----END PRIVATE KEY-----" - }, - { - "name": "prime 1", - "hex": "59D3F5F05F670DC03221C4B9E67AC644" - }, - { - "name": "prime 2", - "hex": "7B995AEF078CF02A9E1CF4D03F05C7A2" - } - ] - }, - { - "name": "Master Key PBKDF2", - "master_key": { - "password": "123412341234", - "email": "test@mail.com", - - "kdf": { - "pBKDF2": { - "iterations": 100000 - } - } - }, - "memory_lookups": [ - { - "name": "Key", - "hex": "2d55ac8e33bd14ee9eee26fa651163a41049a37b3b20c914a8b6abc9a38a89d5" - }, - { - "name": "Hash B64", - "string": "gQ9O5ZhtQ23dL5r93e4BL04ATYOJVEvBAOwYsDDEJFA=" - }, - { - "name": "Hash bytes", - "hex": "810f4ee5986d436ddd2f9afdddee012f4e004d8389544bc100ec18b030c42450" - } - ] - }, - { - "name": "Master Key Argon2", - "master_key": { - "password": "asdfasdfasdf", - "email": "test@mail.com", - - "kdf": { - "argon2id": { - "iterations": 3, - "memory": 16, - "parallelism": 1 - } - } - }, - "memory_lookups": [ - { - "name": "Key", - "hex": "59079cd7134409c6882c2701de8357a3d8aabb2dad2da19eea5f1b8081dfb51c" - }, - { - "name": "Hash B64", - "string": "P1ZT6T80zOfEqXj/kPbtON3yszf7xLNGCxWjdO2xfjU=" - }, - { - "name": "Hash bytes", - "hex": "3f5653e93f34cce7c4a978ff90f6ed38ddf2b337fbc4b3460b15a374edb17e35" - } - ] - }, - { - "name": "Simple", - "string": { - "parts": ["Hello"] - }, - "memory_lookups": [ - { - "name": "String", - "string": "Hello" - } - ] - }, - { - "name": "Join", - "string": { - "parts": ["battery", "horse", "staple"] - }, - "memory_lookups": [ - { - "name": "String", - "string": "battery" - }, - { - "name": "String", - "string": "horse" - }, - { - "name": "String", - "string": "battery horse staple" - } - ] - } - ] -} diff --git a/crates/memory-testing/run_test.sh b/crates/memory-testing/run_test.sh deleted file mode 100755 index c9b5e375f..000000000 --- a/crates/memory-testing/run_test.sh +++ /dev/null @@ -1,22 +0,0 @@ -set -eo pipefail - -# Move to the root of the repository -cd "$(dirname "$0")" -cd ../../ - -BASE_DIR="./crates/memory-testing" - -mkdir -p $BASE_DIR/output -rm $BASE_DIR/output/* || true - -cargo build -p memory-testing --release - -if [ "$1" = "no-docker" ]; then - # This specifically needs to run as root to be able to capture core dumps - sudo ./target/release/capture-dumps ./target/release/memory-testing $BASE_DIR -else - docker build -f crates/memory-testing/Dockerfile -t bitwarden/memory-testing . - docker run --rm -it --privileged --cap-add=SYS_PTRACE -v $BASE_DIR/output:/output bitwarden/memory-testing -fi - -./target/release/analyze-dumps $BASE_DIR diff --git a/crates/memory-testing/src/bin/analyze-dumps.rs b/crates/memory-testing/src/bin/analyze-dumps.rs deleted file mode 100644 index d55bf8b46..000000000 --- a/crates/memory-testing/src/bin/analyze-dumps.rs +++ /dev/null @@ -1,89 +0,0 @@ -use std::{env, io, path::Path, process}; - -use memory_testing::*; - -fn find_subarrays(needle: &[u8], haystack: &[u8]) -> Vec { - let needle_len = needle.len(); - let haystack_len = haystack.len(); - let mut subarrays = vec![]; - - if needle_len == 0 || haystack_len == 0 || needle_len > haystack_len { - return vec![]; - } - - for i in 0..=(haystack_len - needle_len) { - if &haystack[i..i + needle_len] == needle { - subarrays.push(i); - } - } - - subarrays -} - -const OK: &str = "✅"; -const FAIL: &str = "❌"; - -fn comma_sep(nums: &[usize]) -> String { - nums.iter() - .map(ToString::to_string) - .collect::>() - .join(", ") -} - -fn main() -> io::Result<()> { - let args: Vec = env::args().collect(); - if args.len() < 2 { - println!("Usage: ./analyze-dumps "); - process::exit(1); - } - let base_dir: &Path = args[1].as_ref(); - - println!("Memory testing script started"); - - let initial_core = std::fs::read(base_dir.join("output/initial_dump.bin"))?; - let final_core = std::fs::read(base_dir.join("output/final_dump.bin"))?; - - let mut error = false; - let mut table = comfy_table::Table::new(); - table.set_header(vec!["Name", "Initial", "Final", "OK"]); - - let cases = memory_testing::load_cases(base_dir); - - let test_string: Vec = TEST_STRING.as_bytes().to_vec(); - let test_initial_pos = find_subarrays(&test_string, &initial_core); - - if test_initial_pos.is_empty() { - println!("ERROR: Test string not found in initial core dump, is the dump valid?"); - error = true; - } - - for (idx, case) in cases.cases.iter().enumerate() { - for lookup in &case.memory_lookups { - let value = match &lookup.value { - MemoryLookupValue::String { string } => string.as_bytes().to_vec(), - MemoryLookupValue::Binary { hex } => hex::decode(hex).unwrap(), - }; - - let initial_pos = find_subarrays(&value, &initial_core); - let final_pos = find_subarrays(&value, &final_core); - - let name = format!("{idx}: {} / {}", case.name, lookup.name); - let ok_cond = final_pos.len() <= lookup.allowed_count.unwrap_or(0); - - table.add_row([ - name.as_str(), - &comma_sep(&initial_pos), - &comma_sep(&final_pos), - if ok_cond { OK } else { FAIL }, - ]); - - if !ok_cond { - error = true; - } - } - } - - println!("{table}"); - - process::exit(if error { 1 } else { 0 }); -} diff --git a/crates/memory-testing/src/bin/capture-dumps.rs b/crates/memory-testing/src/bin/capture-dumps.rs deleted file mode 100644 index 5dddd7622..000000000 --- a/crates/memory-testing/src/bin/capture-dumps.rs +++ /dev/null @@ -1,88 +0,0 @@ -use std::{ - fs, - io::{self, prelude::*}, - path::Path, - process::{ChildStdin, ChildStdout, Command, Stdio}, -}; - -fn dump_process_to_bytearray(pid: u32, output_dir: &Path, output_name: &Path) -> io::Result { - let output = Command::new("gcore") - .args(["-a", &pid.to_string()]) - .output()?; - - if !output.status.success() { - return io::Result::Err(io::Error::new( - io::ErrorKind::Other, - format!("Failed to dump process: {:?}", output), - )); - } - - let core_path = format!("core.{}", pid); - let output_path = output_dir.join(output_name); - let len = fs::copy(&core_path, output_path)?; - fs::remove_file(&core_path)?; - Ok(len) -} - -fn wait_dump_and_continue( - stdin: &mut ChildStdin, - stdout: &mut ChildStdout, - id: u32, - base_dir: &Path, - name: &Path, -) -> Result<(), io::Error> { - // Read the input from the process until we get the "Waiting for dump..." message - // That way we know the process is ready to be dumped, and we don't need to just sleep a fixed - // amount of time - loop { - let mut buf = [0u8; 1024]; - let read = stdout.read(&mut buf).unwrap(); - - if read == 0 { - panic!("Process exited unexpectedly"); - } - - let buf_str = std::str::from_utf8(&buf[..read]).unwrap(); - if buf_str.contains("Waiting for dump...") { - break; - } - } - let dump_size = dump_process_to_bytearray(id, &base_dir.join("output"), name)?; - println!("Got memory dump of file size: {}", dump_size); - - stdin.write_all(b".")?; - stdin.flush()?; - - Ok(()) -} - -fn main() -> io::Result<()> { - let args: Vec = std::env::args().collect(); - if args.len() < 3 { - println!("Usage: ./capture_dumps "); - std::process::exit(1); - } - - let binary_path = &args[1]; - let base_dir: &Path = args[2].as_ref(); - - let mut proc = Command::new(binary_path) - .arg(base_dir) - .stdout(Stdio::piped()) - .stdin(Stdio::piped()) - .spawn()?; - let id = proc.id(); - println!("Started memory testing process with PID: {}", id); - - let stdin = proc.stdin.as_mut().expect("Valid stdin"); - let stdout = proc.stdout.as_mut().expect("Valid stdin"); - - wait_dump_and_continue(stdin, stdout, id, base_dir, "initial_dump.bin".as_ref())?; - wait_dump_and_continue(stdin, stdout, id, base_dir, "final_dump.bin".as_ref())?; - - // Wait for the process to finish and print the output - let output = proc.wait()?; - println!("Return code: {}", output); - - std::process::exit(output.code().unwrap_or(1)); -} diff --git a/crates/memory-testing/src/lib.rs b/crates/memory-testing/src/lib.rs deleted file mode 100644 index 8b51a9e73..000000000 --- a/crates/memory-testing/src/lib.rs +++ /dev/null @@ -1,69 +0,0 @@ -use std::path::Path; - -use bitwarden_crypto::Kdf; -use zeroize::{Zeroize, Zeroizing}; - -pub const TEST_STRING: &str = "THIS IS USED TO CHECK THAT THE MEMORY IS DUMPED CORRECTLY"; - -pub fn load_cases(base_dir: &Path) -> Cases { - let mut json_str = std::fs::read_to_string(base_dir.join("cases.json")).unwrap(); - let cases: Cases = serde_json::from_str(&json_str).unwrap(); - - // Make sure that we don't leave extra copies of the string data in memory - json_str.zeroize(); - cases -} - -#[derive(serde::Deserialize)] -pub struct Cases { - pub cases: Vec, -} - -#[derive(serde::Deserialize)] -pub struct Case { - pub name: String, - #[serde(flatten)] - pub command: CaseCommand, - pub memory_lookups: Vec, -} - -// We don't actively zeroize this struct because we want the code in bitwarden_crypto -// to handle it for us -#[derive(serde::Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum CaseCommand { - SymmetricKey { - key: String, - }, - AsymmetricKey { - private_key: String, - }, - MasterKey { - password: String, - email: String, - kdf: Kdf, - }, - String { - parts: Vec, - }, -} - -#[derive(serde::Deserialize)] -pub struct MemoryLookup { - pub name: String, - - #[serde(flatten)] - pub value: MemoryLookupValue, - - #[serde(default)] - pub allowed_count: Option, -} - -// We don't actually want these values to be caught by the memory testing, -// so this enum should be always zeroized -#[derive(serde::Deserialize)] -#[serde(untagged)] -pub enum MemoryLookupValue { - String { string: Zeroizing }, - Binary { hex: Zeroizing }, -} diff --git a/crates/memory-testing/src/main.rs b/crates/memory-testing/src/main.rs deleted file mode 100644 index 133a786ee..000000000 --- a/crates/memory-testing/src/main.rs +++ /dev/null @@ -1,76 +0,0 @@ -use std::{env, io::Read, path::Path, process}; - -use bitwarden_crypto::{MasterKey, SymmetricCryptoKey}; - -fn wait_for_dump() { - println!("Waiting for dump..."); - std::io::stdin().read_exact(&mut [1u8]).unwrap(); -} - -fn main() { - let args: Vec = env::args().collect(); - if args.len() < 2 { - println!("Usage: ./memory-testing "); - process::exit(1); - } - let base_dir: &Path = args[1].as_ref(); - - let test_string = String::from(memory_testing::TEST_STRING); - - let cases = memory_testing::load_cases(base_dir); - - let mut symmetric_keys = Vec::new(); - let mut asymmetric_keys = Vec::new(); - let mut master_keys = Vec::new(); - let mut strings = Vec::new(); - - for case in cases.cases { - match case.command { - memory_testing::CaseCommand::SymmetricKey { key } => { - let key = SymmetricCryptoKey::try_from(key).unwrap(); - symmetric_keys.push((key.to_vec(), key)); - } - memory_testing::CaseCommand::AsymmetricKey { private_key } => { - let key = bitwarden_crypto::AsymmetricCryptoKey::from_pem(&private_key).unwrap(); - asymmetric_keys.push(key); - } - memory_testing::CaseCommand::MasterKey { - password, - email, - kdf, - } => { - let key = MasterKey::derive(&password, &email, &kdf).unwrap(); - let hash = key - .derive_master_key_hash( - password.as_bytes(), - bitwarden_crypto::HashPurpose::ServerAuthorization, - ) - .unwrap(); - - master_keys.push((key, hash)); - } - memory_testing::CaseCommand::String { parts } => { - let s = parts.join(" "); - strings.push(s); - } - } - } - - // Make a memory dump before the variables are freed - wait_for_dump(); - - // Put all the variables through a black box to prevent them from being optimized out before we - // get to this point, and then drop them - let _ = std::hint::black_box(( - test_string, - symmetric_keys, - asymmetric_keys, - master_keys, - strings, - )); - - // After the variables are dropped, we want to make another dump - wait_for_dump(); - - println!("Done!") -} diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index 13a664873..32e1beea5 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -17,7 +17,6 @@ keywords.workspace = true anyhow = "1.0.82" bitwarden = { workspace = true } bitwarden-json = { path = "../bitwarden-json" } -bitwarden-uniffi = { path = "../bitwarden-uniffi", optional = true } itertools = "0.13.0" schemars = { workspace = true, features = ["preserve_order"] } serde_json = "1.0.113" diff --git a/crates/uniffi-bindgen/Cargo.toml b/crates/uniffi-bindgen/Cargo.toml deleted file mode 100644 index b5401afb9..000000000 --- a/crates/uniffi-bindgen/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "uniffi-bindgen" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[[bin]] -# This can be whatever name makes sense for your project, but the rest of this tutorial assumes uniffi-bindgen. -name = "uniffi-bindgen" -path = "uniffi-bindgen.rs" - -[dependencies] -uniffi = { workspace = true, features = ["cli"] } diff --git a/crates/uniffi-bindgen/uniffi-bindgen.rs b/crates/uniffi-bindgen/uniffi-bindgen.rs deleted file mode 100644 index f6cff6cf1..000000000 --- a/crates/uniffi-bindgen/uniffi-bindgen.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - uniffi::uniffi_bindgen_main() -} diff --git a/languages/js/sdk-internal/.gitignore b/languages/js/sdk-internal/.gitignore deleted file mode 100644 index 99cddcd21..000000000 --- a/languages/js/sdk-internal/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -**/snippets/**/*.js -bitwarden_wasm_internal_bg.js -bitwarden_wasm_internal_bg.wasm -bitwarden_wasm_internal_bg.wasm.d.ts -bitwarden_wasm_internal_bg.wasm.js -bitwarden_wasm_internal.d.ts -bitwarden_wasm_internal.js diff --git a/languages/js/sdk-internal/LICENSE b/languages/js/sdk-internal/LICENSE deleted file mode 100644 index e9d496ff7..000000000 --- a/languages/js/sdk-internal/LICENSE +++ /dev/null @@ -1,295 +0,0 @@ -BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT -Version 1, 17 March 2023 - -1. Introduction - -1.1 The Bitwarden Software Development Kit (referred to in the License Agreement -as the "SDK" and available for download at the following URL -https://github.com/bitwarden/sdk) is licensed to you subject to the terms of -this License Agreement. The License Agreement forms a legally binding contract -between you and the Company in relation to your use of the SDK. - -1.2 "Bitwarden" means the Bitwarden software made available by the Company, -available for download at the following URL, as updated from time to time. - -1.3 A "Compatible Application" means any software program or service that (i) -connects to and interoperates with a current version of the Bitwarden server -products distributed by the Company; and (ii) complies with the Company’s -acceptable use policy available at the following URL: -https://bitwarden.com/terms/#acceptable_use. - -1.4 "Company" means Bitwarden Inc., organized under the laws of the State of -Delaware. - -2. Accepting this License Agreement - -2.1 In order to access or use the SDK, you must first agree to the License -Agreement. You may not access or use the SDK if you do not accept the License -Agreement. - -2.2 By clicking to accept and/or accessing or using the SDK, you hereby agree to -the terms of the License Agreement. - -2.3 You may not access or use the SDK and may not accept the License Agreement -if you are a person barred from receiving the SDK under the laws of the United -States or other countries, including the country in which you are resident or -from which you access or use the SDK. - -2.4 If you are agreeing to be bound by the License Agreement on behalf of your -employer or any other entity, you represent and warrant that you have full legal -authority to bind your employer or such other entity to the License Agreement. -If you do not have the requisite authority, you may not accept the License -Agreement or you may not access or use the SDK on behalf of your employer or -other entity. - -3. SDK License from Bitwarden - -3.1 Subject to the terms of this License Agreement, Bitwarden grants you a -limited, worldwide, royalty-free, non-assignable, non-exclusive, and -non-sublicensable license to use the SDK solely (a) to develop, test, and -demonstrate a Compatible Application; (b) to develop, test, and run a Compatible -Application for personal use by your family; or (c) to to develop, test, and run -a Compatible Application for the internal business operations of your -organization in connection with a paid license for a Bitwarden server product, -provided that in no case above may the Compatible Application be offered, -licensed, or sold to a third party. - -3.2 You agree that Bitwarden or third parties own all legal right, title and -interest in and to the SDK, including any Intellectual Property Rights that -subsist in the SDK. "Intellectual Property Rights" means any and all rights -under patent law, copyright law, trade secret law, trademark law, and any and -all other proprietary rights. Bitwarden reserves all rights not expressly -granted to you. - -3.3 You may not use this SDK to develop applications for use with software other -than Bitwarden (including non-compatible implementations of Bitwarden) or to -develop another SDK. - -3.4 You may not use the SDK for any purpose not expressly permitted by the -License Agreement. Except for contributions to Bitwarden pursuant to the -Contribution License Agreement available at this URL: -https://cla-assistant.io/bitwarden/clients, or to the extent required by -applicable third party licenses, you may not copy modify, adapt, redistribute, -decompile, reverse engineer, disassemble, or create derivative works of the SDK -or any part of the SDK. - -3.5 Use, reproduction, and distribution of a component of the SDK licensed under -an open source software license are governed solely by the terms of that open -source software license and not the License Agreement. - -3.6 You agree that the form and nature of the SDK that the Company provides may -change without prior notice to you and that future versions of the SDK may be -incompatible with applications developed on previous versions of the SDK. You -agree that the Company may stop (permanently or temporarily) providing the SDK -or any features within the SDK to you or to users generally at the Company’s -sole discretion, without prior notice to you. - -3.7 Nothing in the License Agreement gives you a right to use any of the -Company’s trade names, trademarks, service marks, logos, domain names, or other -distinctive brand features. - -3.8 You agree that you will not remove, obscure, or alter any proprietary rights -notices (including copyright and trademark notices) that may be affixed to or -contained within the SDK. - -4. Use of the SDK by You - -4.1 The Company agrees that it obtains no right, title, or interest from you (or -your licensors) under the License Agreement in or to any software applications -that you develop using the SDK, including any Intellectual Property Rights that -subsist in those applications. - -4.2 You agree to use the SDK and write applications only for purposes that are -permitted by (a) the License Agreement and (b) any applicable law, regulation or -generally accepted practices or guidelines in the relevant jurisdictions -(including any laws regarding the export of data or software to and from the -United States or other relevant countries). - -4.3 You agree that if you use the SDK to develop applications for other users, -you will protect the privacy and legal rights of those users. If the users -provide you with user names, passwords, or other login information or personal -information, you must make the users aware that the information will be -available to your application, and you must provide legally adequate privacy -notice and protection for those users. If your application stores personal or -sensitive information provided by users, it must do so securely. If the user -provides your application with Bitwarden Account information, your application -may only use that information to access the user's Bitwarden Account when, and -for the limited purposes for which, the user has given you permission to do so. - -4.4 You agree that you will not engage in any activity with the SDK, including -the development or distribution of an application, that interferes with, -disrupts, damages, or accesses in an unauthorized manner the servers, networks, -or other properties or services of any third party including, but not limited -to, the Company, or any mobile communications carrier or public cloud service. - -4.5 If you use the SDK to retrieve a user's data from Bitwarden, you acknowledge -and agree that you shall retrieve data only with the user's explicit consent and -only when, and for the limited purposes for which, the user has given you -permission to do so. - -4.6 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any data, content, or resources -that you create, transmit or display through Bitwarden and/or applications for -Bitwarden, and for the consequences of your actions (including any loss or -damage which Bitwarden may suffer) by doing so. - -4.7 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any breach of your obligations -under the License Agreement, any applicable third party contract or Terms of -Service, or any applicable law or regulation, and for the consequences -(including any loss or damage which the Company or any third party may suffer) -of any such breach. - -5. Third Party Applications - -5.1 If you use the SDK to integrate or run applications developed by a third -party or that access data, content or resources provided by a third party, you -agree that the Company is not responsible for those applications, data, content, -or resources. You understand that all data, content or resources which you may -access through such third party applications are the sole responsibility of the -person from which they originated and that the Company is not liable for any -loss or damage that you may experience as a result of the use or access of any -of those third party applications, data, content, or resources. - -5.2 You should be aware that the data, content, and resources presented to you -through such a third party application may be protected by intellectual property -rights which are owned by the providers (or by other persons or companies on -their behalf). You acknowledge that your use of such third party applications, -data, content, or resources may be subject to separate terms between you and the -relevant third party. In that case, the License Agreement does not affect your -legal relationship with these third parties. - -6. Use of Bitwarden Server - -You acknowledge and agree that the Bitwarden server products to which any -Compatible Application must connect is protected by intellectual property rights -which are owned by the Company and your use of the Bitwarden server products is -subject to additional terms not set forth in this License Agreement. - -7. Terminating this License Agreement - -7.1 The License Agreement will continue to apply until terminated by either you -or the Company as set out below. - -7.2 If you want to terminate the License Agreement, you may do so by ceasing -your use of the SDK and any relevant developer credentials. - -7.3 The Company may at any time, terminate the License Agreement with you if: - -(a) you have breached any provision of the License Agreement; or - -(b) the Company is required to do so by law; or - -(c) a third party with whom the Company offered certain parts of the SDK to you -has terminated its relationship with the Company or ceased to offer certain -parts of the SDK to either the Company or to you; or - -(d) the Company decides to no longer provide the SDK or certain parts of the SDK -to users in the country in which you are resident or from which you use the -service, or the provision of the SDK or certain SDK services to you by the -Company is, in the Company’'s sole discretion, no longer commercially viable or -technically practicable. - -7.4 When the License Agreement comes to an end, all of the legal rights, -obligations and liabilities that you and the Company have benefited from, been -subject to (or which have accrued over time whilst the License Agreement has -been in force) or which are expressed to continue indefinitely, shall be -unaffected by this cessation, and the provisions of paragraph 12.8 shall -continue to apply to such rights, obligations and liabilities indefinitely. - -8. NO SUPPORT - -The Company is not obligated under this License Agreement to provide you any -support services for the SDK. Any support provided is at the Company’s sole -discretion and provided on an "as is" basis and without warranty of any kind. - -9. DISCLAIMER OF WARRANTIES - -9.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE -RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF -ANY KIND FROM Bitwarden. - -9.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED -THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY -RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF -DATA THAT RESULTS FROM SUCH USE. - -9.3 THE COMPANY FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY -KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED -WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE -AND NON-INFRINGEMENT. - -10. LIMITATION OF LIABILITY - -YOU EXPRESSLY UNDERSTAND AND AGREE THAT THE COMPANY, ITS SUBSIDIARIES AND -AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF -LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, -STATUTORY, OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS -OF DATA, WHETHER OR NOT THE COMPANY OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF -OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. - -11. Indemnification - -To the maximum extent permitted by law, you agree to defend, indemnify and hold -harmless the Company, its affiliates and their respective directors, officers, -employees and agents from and against any and all claims, actions, suits or -proceedings, as well as any and all losses, liabilities, damages, costs and -expenses (including reasonable attorneys fees) arising out of or accruing from -(a) your use of the SDK, (b) any application you develop on the SDK that -infringes any copyright, trademark, trade secret, trade dress, patent or other -intellectual property right of any person or defames any person or violates -their rights of publicity or privacy, and (c) any non-compliance by you with the -License Agreement. - -12. General Legal Terms - -12.1 The Company may make changes to the License Agreement as it distributes new -versions of the SDK. When these changes are made, the Company will make a new -version of the License Agreement available on the website where the SDK is made -available. - -12.2 The License Agreement constitutes the whole legal agreement between you and -the Company and governs your use of the SDK (excluding any services or software -which the Company may provide to you under a separate written agreement), and -completely replaces any prior agreements between you and the Company in relation -to the SDK. - -12.3 You agree that if the Company does not exercise or enforce any legal right -or remedy which is contained in the License Agreement (or which the Company has -the benefit of under any applicable law), this will not be taken to be a formal -waiver of the Company's rights and that those rights or remedies will still be -available to the Company. - -12.4 If any court of law, having the jurisdiction to decide on this matter, -rules that any provision of the License Agreement is invalid, then that -provision will be removed from the License Agreement without affecting the rest -of the License Agreement. The remaining provisions of the License Agreement will -continue to be valid and enforceable. - -12.5 You acknowledge and agree that each member of the group of companies of -which the Company is the parent shall be third party beneficiaries to the -License Agreement and that such other companies shall be entitled to directly -enforce, and rely upon, any provision of the License Agreement that confers a -benefit on them or rights in favor of them. Other than this, no other person or -company shall be third party beneficiaries to the License Agreement. - -12.6 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND -REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND -REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON -DESTINATIONS, END USERS, AND END USE. - -12.7 The rights granted in the License Agreement may not be assigned or -transferred by either you or the Company without the prior written approval of -the other party, provided that the Company may assign this License Agreement -upon notice to you in connection with an acquisition, merger, sale of assets, or -similar corporate change in control for the Company or the Intellectual Property -Rights in the SDK. - -12.8 The License Agreement, and any dispute relating to or arising out of this -License Agreement, shall be governed by the laws of the State of California -without regard to its conflict of laws provisions. You and the Company agree to -submit to the exclusive jurisdiction of the courts located within the county of -Los Angeles, California to resolve any dispute or legal matter arising from the -License Agreement. Notwithstanding this, you agree that the Company shall be -allowed to apply for injunctive remedies, or any equivalent type of urgent legal -relief, in any forum or jurisdiction. diff --git a/languages/js/sdk-internal/README.md b/languages/js/sdk-internal/README.md deleted file mode 100644 index 9391aa071..000000000 --- a/languages/js/sdk-internal/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @bitwarden/sdk-internal - -**Note:** This is only for internal use. Bitwarden will not provide any support for this package. diff --git a/languages/js/sdk-internal/index.js b/languages/js/sdk-internal/index.js deleted file mode 100644 index 0525f7aa4..000000000 --- a/languages/js/sdk-internal/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import { __wbg_set_wasm } from "./bitwarden_wasm_internal_bg.js"; - -// In order to support a fallback strategy for web we need to conditionally load the wasm file -export function init(wasm) { - __wbg_set_wasm(wasm); -} - -export * from "./bitwarden_wasm_internal_bg.js"; diff --git a/languages/js/sdk-internal/package.json b/languages/js/sdk-internal/package.json deleted file mode 100644 index 29e5c5a54..000000000 --- a/languages/js/sdk-internal/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@bitwarden/sdk-internal", - "version": "0.1.0", - "license": "SEE LICENSE IN LICENSE", - "files": [ - "bitwarden_wasm_internal_bg.js", - "bitwarden_wasm_internal_bg.wasm", - "bitwarden_wasm_internal_bg.wasm.d.ts", - "bitwarden_wasm_internal_bg.wasm.js", - "bitwarden_wasm_internal.d.ts", - "bitwarden_wasm_internal.js", - "index.js", - "node/bitwarden_wasm_internal_bg.wasm", - "node/bitwarden_wasm_internal_bg.wasm.d.ts", - "node/bitwarden_wasm_internal.d.ts", - "node/bitwarden_wasm_internal.js" - ], - "main": "node/bitwarden_wasm_internal.js", - "module": "index.js", - "types": "bitwarden_wasm_internal.d.ts", - "scripts": {}, - "sideEffects": [ - "./bitwarden_wasm_internal.js" - ] -} diff --git a/languages/kotlin/.gitignore b/languages/kotlin/.gitignore deleted file mode 100644 index aa724b770..000000000 --- a/languages/kotlin/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store -/build -/captures -.externalNativeBuild -.cxx -local.properties diff --git a/languages/kotlin/README.md b/languages/kotlin/README.md deleted file mode 100644 index 3531840bc..000000000 --- a/languages/kotlin/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Android - -Android builds needs vendored OpenSSL to function correctly. The easiest way to build this is by -using [cross](https://github.com/cross-rs/cross). - -```bash -cargo install cross -``` - -## Building - -Depending on which CPU architecture you will need to specify different targets. Please refer to the -[Android ABIs](https://developer.android.com/ndk/guides/abis) for more details. - -```bash -mkdir -p ./sdk/src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86_64,x86} - -cross build -p bitwarden-uniffi --release --target=aarch64-linux-android -mv ../../target/aarch64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/arm64-v8a/libbitwarden_uniffi.so - -cross build -p bitwarden-uniffi --release --target=armv7-linux-androideabi -mv ../../target/armv7-linux-androideabi/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/armeabi-v7a/libbitwarden_uniffi.so - -cross build -p bitwarden-uniffi --release --target=x86_64-linux-android -mv ../../target/x86_64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86_64/libbitwarden_uniffi.so - -cross build -p bitwarden-uniffi --release --target=i686-linux-android -mv ../../target/i686-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/x86/libbitwarden_uniffi.so -``` - -### Schemas - -```bash -./build-schemas.sh -``` - -### Publish - -```bash -export GITHUB_ACTOR=username -export GITHUB_TOKEN=token - -./gradlew sdk:publish -``` diff --git a/languages/kotlin/app/.gitignore b/languages/kotlin/app/.gitignore deleted file mode 100644 index 796b96d1c..000000000 --- a/languages/kotlin/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/languages/kotlin/app/build.gradle b/languages/kotlin/app/build.gradle deleted file mode 100644 index 188d984a2..000000000 --- a/languages/kotlin/app/build.gradle +++ /dev/null @@ -1,75 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'kotlinx-serialization' -} - -android { - namespace 'com.bitwarden.myapplication' - compileSdk 34 - - defaultConfig { - applicationId "com.bitwarden.myapplication" - minSdk 28 - targetSdk 34 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary true - } - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } - buildFeatures { - compose true - } - composeOptions { - kotlinCompilerExtensionVersion '1.5.12' - } - packagingOptions { - resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' - } - } -} - -dependencies { - // implementation 'com.bitwarden.sdk-android' - implementation project(':sdk') - - implementation 'androidx.core:core-ktx:1.8.0' - implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0') - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' - implementation 'androidx.activity:activity-compose:1.5.1' - implementation platform('androidx.compose:compose-bom:2022.10.00') - implementation 'androidx.compose.ui:ui' - implementation 'androidx.compose.ui:ui-graphics' - implementation 'androidx.compose.ui:ui-tooling-preview' - implementation 'androidx.compose.material3:material3' - implementation "androidx.biometric:biometric:1.1.0" - implementation "io.ktor:ktor-client-core:2.3.3" - implementation "io.ktor:ktor-client-cio:2.3.3" - implementation "io.ktor:ktor-client-content-negotiation:2.3.3" - implementation "io.ktor:ktor-serialization-kotlinx-json:2.3.3" - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00') - androidTestImplementation 'androidx.compose.ui:ui-test-junit4' - debugImplementation 'androidx.compose.ui:ui-tooling' - debugImplementation 'androidx.compose.ui:ui-test-manifest' -} diff --git a/languages/kotlin/app/proguard-rules.pro b/languages/kotlin/app/proguard-rules.pro deleted file mode 100644 index f1b424510..000000000 --- a/languages/kotlin/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/languages/kotlin/app/src/main/AndroidManifest.xml b/languages/kotlin/app/src/main/AndroidManifest.xml deleted file mode 100644 index de89e684b..000000000 --- a/languages/kotlin/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt b/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt deleted file mode 100644 index 8f8115e8d..000000000 --- a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/Biometrics.kt +++ /dev/null @@ -1,132 +0,0 @@ -package com.bitwarden.myapplication - -import android.os.Build -import android.security.keystore.KeyGenParameterSpec -import android.security.keystore.KeyProperties -import android.util.Log -import androidx.biometric.BiometricManager -import androidx.biometric.BiometricManager.Authenticators -import androidx.biometric.BiometricPrompt -import androidx.biometric.BiometricPrompt.CryptoObject -import androidx.core.content.ContextCompat -import androidx.fragment.app.FragmentActivity -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.async -import java.security.KeyStore -import java.util.Base64 -import javax.crypto.Cipher -import javax.crypto.KeyGenerator -import javax.crypto.SecretKey -import javax.crypto.spec.GCMParameterSpec - -/** - * IMPORTANT: This file is provided only for the purpose of demostrating the use of the biometric unlock functionality. - * It hasn't gone through a throrough security review and should not be considered production ready. It also doesn't - * handle a lot of errors and edge cases that a production application would need to deal with. - * Developers are encouraged to review and improve the code as needed to meet their security requirements. - * Additionally, we recommend to consult with security experts and conduct thorough testing before using the code in production. - */ - -class Biometric(private var activity: FragmentActivity) { - private var promptInfo: BiometricPrompt.PromptInfo = - BiometricPrompt.PromptInfo.Builder().setTitle("Unlock") - .setSubtitle("Bitwarden biometric unlock") - .setDescription("Confirm biometric to continue").setConfirmationRequired(true) - .setNegativeButtonText("Use account password").build() - - suspend fun encryptString( - keyName: String, plaintext: String, callback: (String, String) -> Unit - ) { - if (canAuthenticate()) { - val cipher = getCipher() - cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(keyName)) - - val bio = createBiometricPrompt { - val ciphertext = it.cipher!!.doFinal(plaintext.toByteArray()) - callback( - String(Base64.getEncoder().encode(ciphertext)), - String(Base64.getEncoder().encode(cipher.iv)) - ) - } - CoroutineScope(Dispatchers.Main).async { - bio.authenticate(promptInfo, CryptoObject(cipher)) - }.await() - } - } - - suspend fun decryptString( - keyName: String, encrypted: String, initializationVector: String, callback: (String) -> Unit - ) { - if (canAuthenticate()) { - val enc = Base64.getDecoder().decode(encrypted) - val iv = Base64.getDecoder().decode(initializationVector) - - val cipher = getCipher() - cipher.init(Cipher.DECRYPT_MODE, getSecretKey(keyName), GCMParameterSpec(128, iv)) - - val bio = createBiometricPrompt { - callback(String(it.cipher!!.doFinal(enc))) - } - - CoroutineScope(Dispatchers.Main).async { - bio.authenticate(promptInfo, CryptoObject(cipher)) - }.await() - } - } - - private fun canAuthenticate() = BiometricManager.from(activity) - .canAuthenticate(Authenticators.BIOMETRIC_STRONG) == BiometricManager.BIOMETRIC_SUCCESS - - private fun createBiometricPrompt(processData: (CryptoObject) -> Unit): BiometricPrompt { - return BiometricPrompt(activity, - ContextCompat.getMainExecutor(activity), - object : BiometricPrompt.AuthenticationCallback() { - override fun onAuthenticationError(errorCode: Int, errString: CharSequence) { - super.onAuthenticationError(errorCode, errString) - Log.e("Biometric", "$errorCode :: $errString") - } - - override fun onAuthenticationFailed() { - super.onAuthenticationFailed() - Log.e("Biometric", "Authentication failed for an unknown reason") - } - - override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) { - super.onAuthenticationSucceeded(result) - processData(result.cryptoObject!!) - } - }) - } - - private fun getCipher(): Cipher { - val transform = - "${KeyProperties.KEY_ALGORITHM_AES}/${KeyProperties.BLOCK_MODE_GCM}/${KeyProperties.ENCRYPTION_PADDING_NONE}" - return Cipher.getInstance(transform) - } - - private fun getSecretKey(keyName: String): SecretKey { - // If the SecretKey exists, return it - val keyStore = KeyStore.getInstance("AndroidKeyStore") - keyStore.load(null) - keyStore.getKey(keyName, null)?.let { return it as SecretKey } - - // Otherwise, we generate a new one - val keyGenParams = KeyGenParameterSpec.Builder( - keyName, KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT - ).apply { - setBlockModes(KeyProperties.BLOCK_MODE_GCM) - setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE) - setKeySize(256) - setUserAuthenticationRequired(true) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - setUserAuthenticationParameters(0, KeyProperties.AUTH_BIOMETRIC_STRONG) - } - }.build() - - val keyGenerator = - KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore") - keyGenerator.init(keyGenParams) - return keyGenerator.generateKey() - } -} diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt b/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt deleted file mode 100644 index e421416d6..000000000 --- a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt +++ /dev/null @@ -1,445 +0,0 @@ -package com.bitwarden.myapplication - -import android.content.Context -import android.os.Bundle -import androidx.activity.compose.setContent -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Button -import androidx.compose.material3.Checkbox -import androidx.compose.material3.Divider -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Surface -import androidx.compose.material3.Text -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment -import androidx.compose.ui.Alignment.Companion.CenterVertically -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.dp -import androidx.fragment.app.FragmentActivity -import com.bitwarden.core.DateTime -import com.bitwarden.vault.Folder -import com.bitwarden.core.InitOrgCryptoRequest -import com.bitwarden.core.InitUserCryptoMethod -import com.bitwarden.core.InitUserCryptoRequest -import com.bitwarden.core.Uuid -import com.bitwarden.crypto.HashPurpose -import com.bitwarden.crypto.Kdf -import com.bitwarden.myapplication.ui.theme.MyApplicationTheme -import com.bitwarden.sdk.Client -import io.ktor.client.HttpClient -import io.ktor.client.call.body -import io.ktor.client.engine.cio.CIO -import io.ktor.client.plugins.contentnegotiation.ContentNegotiation -import io.ktor.client.request.bearerAuth -import io.ktor.client.request.forms.FormDataContent -import io.ktor.client.request.get -import io.ktor.client.request.header -import io.ktor.client.request.post -import io.ktor.client.request.setBody -import io.ktor.http.ContentType -import io.ktor.http.Parameters -import io.ktor.http.contentType -import io.ktor.serialization.kotlinx.json.json -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonArray -import kotlinx.serialization.json.JsonObject -import kotlinx.serialization.json.JsonPrimitive -import java.security.cert.X509Certificate -import java.util.Base64 -import javax.net.ssl.X509TrustManager - -/** - * IMPORTANT: This file is provided only for the purpose of demostrating the use of the SDK functionality. - * It hasn't gone through a throrough security review and should not be considered production ready. It also doesn't - * handle a lot of errors and edge cases that a production application would need to deal with. - * Developers are encouraged to review and improve the code as needed to meet their security requirements. - * Additionally, we recommend to consult with security experts and conduct thorough testing before using the code in production. - * - * Note that this SDK uses the system trust store to perform TLS certificate validation. If you want to use this SDK with - * self hosted servers using self-signed certificates, make sure to configure the Android Network Security Config correctly. - * We provide an example configuration in `languages/kotlin/app/src/main/res/xml/network_security_config.xml` - * https://developer.android.com/privacy-and-security/security-config - */ - -const val SERVER_URL = "https://10.0.2.2:8080/" -const val API_URL = SERVER_URL + "api/" -const val IDENTITY_URL = SERVER_URL + "identity/" - -const val EMAIL = "test@bitwarden.com" -const val PASSWORD = "asdfasdfasdf" - -const val PIN = "1234" - -// We should separate keys for each user by appending the user_id -const val BIOMETRIC_KEY = "biometric_key" - -class MainActivity : FragmentActivity() { - private lateinit var biometric: Biometric - private lateinit var client: Client - private lateinit var http: HttpClient - - private var accessToken = "" - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - biometric = Biometric(this) - client = Client(null) - http = httpClient() - - setContent { - MyApplicationTheme { - // A surface container using the 'background' color from the theme - Surface( - modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background - ) { - Column( - horizontalAlignment = Alignment.CenterHorizontally - ) { - - val setupBiometrics = remember { mutableStateOf(true) } - val setupPin = remember { mutableStateOf(true) } - val outputText = remember { mutableStateOf("") } - - Row { - Checkbox( - checked = setupBiometrics.value, - onCheckedChange = { isChecked -> - setupBiometrics.value = isChecked - }) - Text( - "Setup biometric unlock after login", - modifier = Modifier.align(CenterVertically) - ) - } - - Row { - Checkbox(checked = setupPin.value, onCheckedChange = { isChecked -> - setupPin.value = isChecked - }) - Text( - "Setup pin unlock after login", - modifier = Modifier.align(CenterVertically) - ) - } - - Button({ - GlobalScope.launch { - clientExamplePassword( - client, http, outputText, setupBiometrics.value, setupPin.value - ) - } - }) { - Text("Login with username + password") - } - - Divider( - color = Color.Black, - thickness = 1.dp, - modifier = Modifier.padding(30.dp) - ) - - Button({ - GlobalScope.launch { - clientExampleBiometrics(client, http, outputText) - } - }) { - Text("Unlock with biometrics") - } - - Button({ - GlobalScope.launch { - clientExamplePin(client, http, outputText) - } - }) { - Text("Unlock with PIN") - } - - Button({ - GlobalScope.launch { - client.destroy() - client = Client(null) - outputText.value = "OK" - } - }) { - Text("Lock & reset client") - } - - Text( - "Output: " + outputText.value, - modifier = Modifier.padding(vertical = 10.dp) - ) - } - } - } - } - } - - private suspend fun clientExamplePassword( - client: Client, - http: HttpClient, - outputText: MutableState, - setupBiometrics: Boolean, - setupPin: Boolean - ) { - println("### Logging in with username and password ###") - ///////////////////////////// Get master password hash ///////////////////////////// - @Serializable - data class PreloginRequest(val email: String) - - @Serializable - data class PreloginResponse( - val kdf: UInt, val kdfIterations: UInt, val kdfMemory: UInt?, val kdfParallelism: UInt? - ) - - val prelogin_body = http.post(IDENTITY_URL + "accounts/prelogin") { - contentType(ContentType.Application.Json) - setBody(PreloginRequest(EMAIL)) - }.body() - val kdf = if (prelogin_body.kdf == 0u) { - Kdf.Pbkdf2(prelogin_body.kdfIterations) - } else { - Kdf.Argon2id( - prelogin_body.kdfIterations, - prelogin_body.kdfMemory!!, - prelogin_body.kdfParallelism!! - ) - } - val masterPasswordHash = - client.auth().hashPassword(EMAIL, PASSWORD, kdf, HashPurpose.SERVER_AUTHORIZATION) - - ///////////////////////////// Login ///////////////////////////// - - @Serializable - data class LoginResponse( - val Key: String, - val PrivateKey: String, - val access_token: String, - val refresh_token: String, - ) - - val loginBody = http.post(IDENTITY_URL + "connect/token") { - contentType(ContentType.Application.Json) - header("Auth-Email", Base64.getEncoder().encodeToString(EMAIL.toByteArray())) - setBody(FormDataContent(Parameters.build { - append("scope", "api offline_access") - append("client_id", "web") - append("deviceType", "12") - append("deviceIdentifier", "0745d426-8dab-484a-9816-4959721d77c7") - append("deviceName", "edge") - - append("grant_type", "password") - append("username", EMAIL) - append("password", masterPasswordHash) - })) - }.body() - - client.crypto().initializeUserCrypto( - InitUserCryptoRequest( - kdfParams = kdf, - email = EMAIL, - privateKey = loginBody.PrivateKey, - method = InitUserCryptoMethod.Password( - password = PASSWORD, userKey = loginBody.Key - ) - ) - ) - - accessToken = loginBody.access_token - - decryptVault(client, http, outputText) - - if (setupBiometrics) { - // Save values for future logins - val sharedPref = getPreferences(Context.MODE_PRIVATE) - with(sharedPref.edit()) { - putString("accessToken", accessToken) - putString("privateKey", loginBody.PrivateKey) - - putInt("kdfType", prelogin_body.kdf.toInt()) - putInt("kdfIterations", prelogin_body.kdfIterations.toInt()) - putInt("kdfMemory", (prelogin_body.kdfMemory ?: 0u).toInt()) - putInt("kdfParallelism", (prelogin_body.kdfParallelism ?: 0u).toInt()) - - // TODO: This should be protected by Android's secure KeyStore - val decryptedKey = client.crypto().getUserEncryptionKey() - - biometric.encryptString(BIOMETRIC_KEY, decryptedKey) { key, iv -> - putString("encryptedUserKey", key) - putString("encryptedUserKeyIv", iv) - apply() - } - } - } - - if (setupPin) { - val pinOptions = client.crypto().derivePinKey(PIN); - - val sharedPref = getPreferences(Context.MODE_PRIVATE) - with(sharedPref.edit()) { - putString("accessToken", accessToken) - putString("privateKey", loginBody.PrivateKey) - - putInt("kdfType", prelogin_body.kdf.toInt()) - putInt("kdfIterations", prelogin_body.kdfIterations.toInt()) - putInt("kdfMemory", (prelogin_body.kdfMemory ?: 0u).toInt()) - putInt("kdfParallelism", (prelogin_body.kdfParallelism ?: 0u).toInt()) - - putString("encryptedPin", pinOptions.encryptedPin) - putString("pinProtectedUserKey", pinOptions.pinProtectedUserKey) - apply() - } - } - } - - private suspend fun clientExampleBiometrics( - client: Client, http: HttpClient, outputText: MutableState - ) { - println("### Unlocking with Biometrics ###") - - val pref = getPreferences(Context.MODE_PRIVATE) - accessToken = pref.getString("accessToken", "").orEmpty() - val privateKey = pref.getString("privateKey", "") - - val kdf = if (pref.getInt("kdfType", 0) == 0) { - Kdf.Pbkdf2(pref.getInt("kdfIterations", 0).toUInt()) - } else { - Kdf.Argon2id( - pref.getInt("kdfIterations", 0).toUInt(), - pref.getInt("kdfMemory", 0).toUInt(), - pref.getInt("kdfParallelism", 0).toUInt() - ) - } - - val encryptedUserKey = pref.getString("encryptedUserKey", "")!! - val encryptedUserKeyIv = pref.getString("encryptedUserKeyIv", "")!! - - biometric.decryptString( - BIOMETRIC_KEY, encryptedUserKey, encryptedUserKeyIv - ) { key -> - GlobalScope.launch { - client.crypto().initializeUserCrypto( - InitUserCryptoRequest( - kdfParams = kdf, - email = EMAIL, - privateKey = privateKey!!, - method = InitUserCryptoMethod.DecryptedKey(decryptedUserKey = key) - ) - ) - - decryptVault(client, http, outputText) - } - } - } - - private suspend fun clientExamplePin( - client: Client, http: HttpClient, outputText: MutableState - ) { - println("### Unlocking with PIN ###") - - val pref = getPreferences(Context.MODE_PRIVATE) - accessToken = pref.getString("accessToken", "").orEmpty() - val privateKey = pref.getString("privateKey", "") - - val kdf = if (pref.getInt("kdfType", 0) == 0) { - Kdf.Pbkdf2(pref.getInt("kdfIterations", 0).toUInt()) - } else { - Kdf.Argon2id( - pref.getInt("kdfIterations", 0).toUInt(), - pref.getInt("kdfMemory", 0).toUInt(), - pref.getInt("kdfParallelism", 0).toUInt() - ) - } - - val encryptedPin = pref.getString("encryptedPin", "")!! - val pinProtectedUserKey = pref.getString("pinProtectedUserKey", "")!! - - GlobalScope.launch { - client.crypto().initializeUserCrypto( - InitUserCryptoRequest( - kdfParams = kdf, - email = EMAIL, - privateKey = privateKey!!, - method = InitUserCryptoMethod.Pin( - pinProtectedUserKey = pinProtectedUserKey, pin = PIN - ) - ) - ) - - decryptVault(client, http, outputText) - } - } - - suspend fun decryptVault(client: Client, http: HttpClient, outputText: MutableState) { - ///////////////////////////// Sync ///////////////////////////// - - val syncBody = http.get(API_URL + "sync?excludeDomains=true") { - bearerAuth(accessToken) - }.body() - - val folders = (syncBody["folders"] as JsonArray).map { - val o = it as JsonObject - Folder( - (o["id"] as JsonPrimitive).content, - (o["name"] as JsonPrimitive).content, - DateTime.parse( - (o["revisionDate"] as JsonPrimitive).content - ) - ) - } - - ///////////////////////////// Initialize org crypto ///////////////////////////// - val orgs = ((syncBody["profile"] as JsonObject)["organizations"]) as JsonArray - val orgKeys = HashMap() - - for (org in orgs) { - val o = org as JsonObject - orgKeys[(o["id"] as JsonPrimitive).content] = (o["key"] as JsonPrimitive).content - } - - client.crypto().initializeOrgCrypto(InitOrgCryptoRequest(organizationKeys = orgKeys)) - - ///////////////////////////// Decrypt some folders ///////////////////////////// - - val decryptedFolders = client.vault().folders().decryptList(folders) - outputText.value = decryptedFolders.toString() - println(decryptedFolders) - } -} - -fun httpClient(): HttpClient { - return HttpClient(CIO) { - install(ContentNegotiation) { - json(Json { - ignoreUnknownKeys = true - }) - } - - engine { - https { - // Disable SSL Cert validation. Don't do this in production - trustManager = object : X509TrustManager { - override fun checkClientTrusted( - p0: Array?, p1: String? - ) { - } - - override fun checkServerTrusted( - p0: Array?, p1: String? - ) { - } - - override fun getAcceptedIssuers(): Array? = null - } - } - } - } -} diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt b/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt deleted file mode 100644 index a17305153..000000000 --- a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Color.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.bitwarden.myapplication.ui.theme - -import androidx.compose.ui.graphics.Color - -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) - -val Purple40 = Color(0xFF6650a4) -val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt b/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt deleted file mode 100644 index 0e55b4db2..000000000 --- a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Theme.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.bitwarden.myapplication.ui.theme - -import android.app.Activity -import android.os.Build -import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.darkColorScheme -import androidx.compose.material3.dynamicDarkColorScheme -import androidx.compose.material3.dynamicLightColorScheme -import androidx.compose.material3.lightColorScheme -import androidx.compose.runtime.Composable -import androidx.compose.runtime.SideEffect -import androidx.compose.ui.graphics.toArgb -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.LocalView -import androidx.core.view.WindowCompat - -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80 -) - -private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40 - - /* Other default colors to override - background = Color(0xFFFFFBFE), - surface = Color(0xFFFFFBFE), - onPrimary = Color.White, - onSecondary = Color.White, - onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F), - */ -) - -@Composable -fun MyApplicationTheme( - darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - dynamicColor: Boolean = true, - content: @Composable () -> Unit -) { - val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) - } - - darkTheme -> DarkColorScheme - else -> LightColorScheme - } - val view = LocalView.current - if (!view.isInEditMode) { - SideEffect { - val window = (view.context as Activity).window - window.statusBarColor = colorScheme.primary.toArgb() - WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme - } - } - - MaterialTheme( - colorScheme = colorScheme, - typography = Typography, - content = content - ) -} diff --git a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt b/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt deleted file mode 100644 index 703ee0694..000000000 --- a/languages/kotlin/app/src/main/java/com/bitwarden/myapplication/ui/theme/Type.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.bitwarden.myapplication.ui.theme - -import androidx.compose.material3.Typography -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.sp - -// Set of Material typography styles to start with -val Typography = Typography( - bodyLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 16.sp, - lineHeight = 24.sp, - letterSpacing = 0.5.sp - ) - /* Other default text styles to override - titleLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 22.sp, - lineHeight = 28.sp, - letterSpacing = 0.sp - ), - labelSmall = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Medium, - fontSize = 11.sp, - lineHeight = 16.sp, - letterSpacing = 0.5.sp - ) - */ -) diff --git a/languages/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/languages/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d114..000000000 --- a/languages/kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/languages/kotlin/app/src/main/res/drawable/ic_launcher_background.xml b/languages/kotlin/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9cb..000000000 --- a/languages/kotlin/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 6f3b755bf..000000000 --- a/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 6f3b755bf..000000000 --- a/languages/kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78ecd372343283f4157dcfd918ec5165bb3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1404 zcmV-?1%vuhNk&F=1pok7MM6+kP&il$0000G0000-002h-06|PpNX!5L00Dqw+t%{r zzW2vH!KF=w&cMnnN@{whkTw+#mAh0SV?YL=)3MimFYCWp#fpdtz~8$hD5VPuQgtcN zXl<@<#Cme5f5yr2h%@8TWh?)bSK`O z^Z@d={gn7J{iyxL_y_%J|L>ep{dUxUP8a{byupH&!UNR*OutO~0{*T4q5R6@ApLF! z5{w?Z150gC7#>(VHFJZ-^6O@PYp{t!jH(_Z*nzTK4 zkc{fLE4Q3|mA2`CWQ3{8;gxGizgM!zccbdQoOLZc8hThi-IhN90RFT|zlxh3Ty&VG z?Fe{#9RrRnxzsu|Lg2ddugg7k%>0JeD+{XZ7>Z~{=|M+sh1MF7~ zz>To~`~LVQe1nNoR-gEzkpe{Ak^7{{ZBk2i_<+`Bq<^GB!RYG+z)h;Y3+<{zlMUYd zrd*W4w&jZ0%kBuDZ1EW&KLpyR7r2=}fF2%0VwHM4pUs}ZI2egi#DRMYZPek*^H9YK zay4Iy3WXFG(F14xYsoDA|KXgGc5%2DhmQ1gFCkrgHBm!lXG8I5h*uf{rn48Z!_@ z4Bk6TJAB2CKYqPjiX&mWoW>OPFGd$wqroa($ne7EUK;#3VYkXaew%Kh^3OrMhtjYN?XEoY`tRPQsAkH-DSL^QqyN0>^ zmC>{#F14jz4GeW{pJoRpLFa_*GI{?T93^rX7SPQgT@LbLqpNA}<@2wH;q493)G=1Y z#-sCiRNX~qf3KgiFzB3I>4Z%AfS(3$`-aMIBU+6?gbgDb!)L~A)je+;fR0jWLL-Fu z4)P{c7{B4Hp91&%??2$v9iRSFnuckHUm}or9seH6 z>%NbT+5*@L5(I9j@06@(!{ZI?U0=pKn8uwIg&L{JV14+8s2hnvbRrU|hZCd}IJu7*;;ECgO%8_*W Kmw_-CKmY()leWbG diff --git a/languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/languages/kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d1ba5cf3ee31b3ecc1ced89044a1f3b7a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2898 zcmV-Y3$650Nk&FW3jhFDMM6+kP&il$0000G0000-002h-06|PpNWB9900E$G+qN-D z+81ABX7q?;bwx%xBg?kcwr$(C-Tex-ZCkHUw(Y9#+`E5-zuONG5fgw~E2WDng@Bc@ z24xy+R1n%~6xI#u9vJ8zREI)sb<&Il(016}Z~V1n^PU3-_H17A*Bf^o)&{_uBv}Py zulRfeE8g(g6HFhk_?o_;0@tz?1I+l+Y#Q*;RVC?(ud`_cU-~n|AX-b`JHrOIqn(-t&rOg-o`#C zh0LPxmbOAEb;zHTu!R3LDh1QO zZTf-|lJNUxi-PpcbRjw3n~n-pG;$+dIF6eqM5+L();B2O2tQ~|p{PlpNcvDbd1l%c zLtXn%lu(3!aNK!V#+HNn_D3lp z2%l+hK-nsj|Bi9;V*WIcQRTt5j90A<=am+cc`J zTYIN|PsYAhJ|=&h*4wI4ebv-C=Be#u>}%m;a{IGmJDU`0snWS&$9zdrT(z8#{OZ_Y zxwJx!ZClUi%YJjD6Xz@OP8{ieyJB=tn?>zaI-4JN;rr`JQbb%y5h2O-?_V@7pG_+y z(lqAsqYr!NyVb0C^|uclHaeecG)Sz;WV?rtoqOdAAN{j%?Uo%owya(F&qps@Id|Of zo@~Y-(YmfB+chv^%*3g4k3R0WqvuYUIA+8^SGJ{2Bl$X&X&v02>+0$4?di(34{pt* zG=f#yMs@Y|b&=HyH3k4yP&goF2LJ#tBLJNNDo6lG06r}ghC-pC4Q*=x3;|+W04zte zAl>l4kzUBQFYF(E`KJy?ZXd1tnfbH+Z~SMmA21KokJNs#eqcXWKUIC>{TuoKe^vhF z);H)o`t9j~`$h1D`#bxe@E`oE`cM9w(@)5Bp8BNukIwM>wZHfd0S;5bcXA*5KT3bj zc&_~`&{z7u{Et!Z_k78H75gXf4g8<_ul!H$eVspPeU3j&&Au=2R*Zp#M9$9s;fqwgzfiX=E_?BwVcfx3tG9Q-+<5fw z%Hs64z)@Q*%s3_Xd5>S4dg$s>@rN^ixeVj*tqu3ZV)biDcFf&l?lGwsa zWj3rvK}?43c{IruV2L`hUU0t^MemAn3U~x3$4mFDxj=Byowu^Q+#wKRPrWywLjIAp z9*n}eQ9-gZmnd9Y0WHtwi2sn6n~?i#n9VN1B*074_VbZZ=WrpkMYr{RsI ztM_8X1)J*DZejxkjOTRJ&a*lrvMKBQURNP#K)a5wIitfu(CFYV4FT?LUB$jVwJSZz zNBFTWg->Yk0j&h3e*a5>B=-xM7dE`IuOQna!u$OoxLlE;WdrNlN)1 z7**de7-hZ!(%_ZllHBLg`Ir#|t>2$*xVOZ-ADZKTN?{(NUeLU9GbuG-+Axf*AZ-P1 z0ZZ*fx+ck4{XtFsbcc%GRStht@q!m*ImssGwuK+P@%gEK!f5dHymg<9nSCXsB6 zQ*{<`%^bxB($Z@5286^-A(tR;r+p7B%^%$N5h%lb*Vlz-?DL9x;!j<5>~kmXP$E}m zQV|7uv4SwFs0jUervsxVUm>&9Y3DBIzc1XW|CUZrUdb<&{@D5yuLe%Xniw^x&{A2s z0q1+owDSfc3Gs?ht;3jw49c#mmrViUfX-yvc_B*wY|Lo7; zGh!t2R#BHx{1wFXReX*~`NS-LpSX z#TV*miO^~B9PF%O0huw!1Zv>^d0G3$^8dsC6VI!$oKDKiXdJt{mGkyA`+Gwd4D-^1qtNTUK)`N*=NTG-6}=5k6suNfdLt*dt8D| z%H#$k)z#ZRcf|zDWB|pn<3+7Nz>?WW9WdkO5(a^m+D4WRJ9{wc>Y}IN)2Kbgn;_O? zGqdr&9~|$Y0tP=N(k7^Eu;iO*w+f%W`20BNo)=Xa@M_)+o$4LXJyiw{F?a633SC{B zl~9FH%?^Rm*LVz`lkULs)%idDX^O)SxQol(3jDRyBVR!7d`;ar+D7do)jQ}m`g$TevUD5@?*P8)voa?kEe@_hl{_h8j&5eB-5FrYW&*FHVt$ z$kRF9Nstj%KRzpjdd_9wO=4zO8ritN*NPk_9avYrsF(!4))tm{Ga#OY z(r{0buexOzu7+rw8E08Gxd`LTOID{*AC1m*6Nw@osfB%0oBF5sf<~wH1kL;sd zo)k6^VyRFU`)dt*iX^9&QtWbo6yE8XXH?`ztvpiOLgI3R+=MOBQ9=rMVgi<*CU%+d1PQQ0a1U=&b0vkF207%xU0ssI2 diff --git a/languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/languages/kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d64e58ba64d180ce43ee13bf9a17835fbca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 982 zcmV;{11bDcNk&G_0{{S5MM6+kP&il$0000G0000l001ul06|PpNU8t;00Dqo+t#w^ z^1csucXz7-Qrhzl9HuHB%l>&>1tG2^vb*E&k^T3$FG1eQZ51g$uv4V+kI`0<^1Z@N zk?Jjh$olyC%l>)Xq;7!>{iBj&BjJ`P&$fsCfpve_epJOBkTF?nu-B7D!hO=2ZR}

C%4 zc_9eOXvPbC4kzU8YowIA8cW~Uv|eB&yYwAObSwL2vY~UYI7NXPvf3b+c^?wcs~_t{ ze_m66-0)^{JdOMKPwjpQ@Sna!*?$wTZ~su*tNv7o!gXT!GRgivP}ec?5>l1!7<(rT zds|8x(qGc673zrvYIz;J23FG{9nHMnAuP}NpAED^laz3mAN1sy+NXK)!6v1FxQ;lh zOBLA>$~P3r4b*NcqR;y6pwyhZ3_PiDb|%n1gGjl3ZU}ujInlP{eks-#oA6>rh&g+!f`hv#_%JrgYPu z(U^&XLW^QX7F9Z*SRPpQl{B%x)_AMp^}_v~?j7 zapvHMKxSf*Mtyx8I}-<*UGn3)oHd(nn=)BZ`d$lDBwq_GL($_TPaS{UeevT(AJ`p0 z9%+hQb6z)U9qjbuXjg|dExCLjpS8$VKQ55VsIC%@{N5t{NsW)=hNGI`J=x97_kbz@ E0Of=7!TQj4N+cqN`nQhxvX7dAV-`K|Ub$-q+H-5I?Tx0g9jWxd@A|?POE8`3b8fO$T))xP* z(X?&brZw({`)WU&rdAs1iTa0x6F@PIxJ&&L|dpySV!ID|iUhjCcKz(@mE z!x@~W#3H<)4Ae(4eQJRk`Iz3<1)6^m)0b_4_TRZ+cz#eD3f8V;2r-1fE!F}W zEi0MEkTTx}8i1{`l_6vo0(Vuh0HD$I4SjZ=?^?k82R51bC)2D_{y8mi_?X^=U?2|F{Vr7s!k(AZC$O#ZMyavHhlQ7 zUR~QXuH~#o#>(b$u4?s~HLF*3IcF7023AlwAYudn0FV~|odGH^05AYPEfR)8p`i{n zwg3zPVp{+wOsxKc>)(pMupKF!Y2HoUqQ3|Yu|8lwR=?5zZuhG6J?H`bSNk_wPoM{u zSL{c@pY7+c2kck>`^q1^^gR0QB7Y?KUD{vz-uVX~;V-rW)PDcI)$_UjgVV?S?=oLR zf4}zz{#*R_{LkiJ#0RdQLNC^2Vp%JPEUvG9ra2BVZ92(p9h7Ka@!yf9(lj#}>+|u* z;^_?KWdzkM`6gqPo9;;r6&JEa)}R3X{(CWv?NvgLeOTq$cZXqf7|sPImi-7cS8DCN zGf;DVt3Am`>hH3{4-WzH43Ftx)SofNe^-#|0HdCo<+8Qs!}TZP{HH8~z5n`ExcHuT zDL1m&|DVpIy=xsLO>8k92HcmfSKhflQ0H~9=^-{#!I1g(;+44xw~=* zxvNz35vfsQE)@)Zsp*6_GjYD};Squ83<_?^SbALb{a`j<0Gn%6JY!zhp=Fg}Ga2|8 z52e1WU%^L1}15Ex0fF$e@eCT(()_P zvV?CA%#Sy08_U6VPt4EtmVQraWJX` zh=N|WQ>LgrvF~R&qOfB$!%D3cGv?;Xh_z$z7k&s4N)$WYf*k=|*jCEkO19{h_(%W4 zPuOqbCw`SeAX*R}UUsbVsgtuG?xs(#Ikx9`JZoQFz0n*7ZG@Fv@kZk`gzO$HoA9kN z8U5{-yY zvV{`&WKU2$mZeoBmiJrEdzUZAv1sRxpePdg1)F*X^Y)zp^Y*R;;z~vOv-z&)&G)JQ{m!C9cmziu1^nHA z`#`0c>@PnQ9CJKgC5NjJD8HM3|KC(g5nnCq$n0Gsu_DXk36@ql%npEye|?%RmG)

FJ$wK}0tWNB{uH;AM~i diff --git a/languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a3070fe34c611c42c0d3ad3013a0dce358be0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1900 zcmV-y2b1_xNk&Fw2LJ$9MM6+kP&il$0000G0001A003VA06|PpNH75a00DqwTbm-~ zullQTcXxO9ki!OCRx^i?oR|n!<8G0=kI^!JSjFi-LL*`V;ET0H2IXfU0*i>o6o6Gy zRq6Ap5(_{XLdXcL-MzlN`ugSdZY_`jXhcENAu)N_0?GhF))9R;E`!bo9p?g?SRgw_ zEXHhFG$0{qYOqhdX<(wE4N@es3VIo$%il%6xP9gjiBri+2pI6aY4 zJbgh-Ud|V%3O!IcHKQx1FQH(_*TK;1>FQWbt^$K1zNn^cczkBs=QHCYZ8b&l!UV{K z{L0$KCf_&KR^}&2Fe|L&?1I7~pBENnCtCuH3sjcx6$c zwqkNkru);ie``q+_QI;IYLD9OV0ZxkuyBz|5<$1BH|vtey$> z5oto4=l-R-Aaq`Dk0}o9N0VrkqW_#;!u{!bJLDq%0092{Ghe=F;(kn} z+sQ@1=UlX30+2nWjkL$B^b!H2^QYO@iFc0{(-~yXj2TWz?VG{v`Jg zg}WyYnwGgn>{HFaG7E~pt=)sOO}*yd(UU-D(E&x{xKEl6OcU?pl)K%#U$dn1mDF19 zSw@l8G!GNFB3c3VVK0?uyqN&utT-D5%NM4g-3@Sii9tSXKtwce~uF zS&Jn746EW^wV~8zdQ1XC28~kXu8+Yo9p!<8h&(Q({J*4DBglPdpe4M_mD8AguZFn~ ztiuO~{6Bx?SfO~_ZV(GIboeR9~hAym{{fV|VM=77MxDrbW6`ujX z<3HF(>Zr;#*uCvC*bpoSr~C$h?_%nXps@A)=l_;({Fo#6Y1+Zv`!T5HB+)#^-Ud_; zBwftPN=d8Vx)*O1Mj+0oO=mZ+NVH*ptNDC-&zZ7Hwho6UQ#l-yNvc0Cm+2$$6YUk2D2t#vdZX-u3>-Be1u9gtTBiMB^xwWQ_rgvGpZ6(C@e23c!^K=>ai-Rqu zhqT`ZQof;9Bu!AD(i^PCbYV%yha9zuoKMp`U^z;3!+&d@Hud&_iy!O-$b9ZLcSRh? z)R|826w}TU!J#X6P%@Zh=La$I6zXa#h!B;{qfug}O%z@K{EZECu6zl)7CiNi%xti0 zB{OKfAj83~iJvmpTU|&q1^?^cIMn2RQ?jeSB95l}{DrEPTW{_gmU_pqTc)h@4T>~& zluq3)GM=xa(#^VU5}@FNqpc$?#SbVsX!~RH*5p0p@w z;~v{QMX0^bFT1!cXGM8K9FP+=9~-d~#TK#ZE{4umGT=;dfvWi?rYj;^l_Zxywze`W z^Cr{55U@*BalS}K%Czii_80e0#0#Zkhlij4-~I@}`-JFJ7$5{>LnoJSs??J8kWVl6|8A}RCGAu9^rAsfCE=2}tHwl93t0C?#+jMpvr7O3`2=tr{Hg$=HlnjVG^ewm|Js0J*kfPa6*GhtB>`fN!m#9J(sU!?(OSfzY*zS(FJ<-Vb zfAIg+`U)YaXv#sY(c--|X zEB+TVyZ%Ie4L$gi#Fc++`h6%vzsS$pjz9aLt+ZL(g;n$Dzy5=m=_TV(3H8^C{r0xd zp#a%}ht55dOq?yhwYPrtp-m1xXp;4X;)NhxxUpgP%XTLmO zcjaFva^}dP3$&sfFTIR_jC=2pHh9kpI@2(6V*GQo7Ws)`j)hd+tr@P~gR*2gO@+1? zG<`_tB+LJuF|SZ9tIec;h%}}6WClT`L>HSW?E{Hp1h^+mlbf_$9zA>!ug>NALJsO{ mU%z=YwVD?}XMya)Bp;vlyE5&E_6!fzx9pwrdz474!~g(M6R?N? diff --git a/languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/languages/kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a6956b3acdc11f40ce2bb3f6efbd845cc243f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3918 zcmV-U53%r4Nk&FS4*&pHMM6+kP&il$0000G0001A003VA06|PpNSy@$00HoY|G(*G z+qV7x14$dSO^Re!iqt-AAIE9iwr$(CZQJL$blA4B`>;C3fBY6Q8_YSjb2%a=fc}4E zrSzssacq<^nmW|Rs93PJni30R<8w<(bK_$LO4L?!_OxLl$}K$MUEllnMK|rg=f3;y z*?;3j|Nh>)p0JQ3A~rf(MibH2r+)3cyV1qF&;8m{w-S*y+0mM){KTK^M5}ksc`qX3 zy>rf^b>~l>SSHds8(I@hz3&PD@LmEs4&prkT=BjsBCXTMhN$_)+kvnl0bLKW5rEsj z*d#KXGDB4P&>etx0X+`R19yC=LS)j!mgs5M0L~+o-T~Jl!p!AJxnGAhV%~rhYUL4hlWhgES3Kb5oA&X z{}?3OBSS-{!v$nCIGj->(-TAG)8LR{htr41^gxsT8yqt2@DEG6Yl`Uma3Nd4;YUoW zTbkYl3CMU5ypMF3EIkYmWL|*BknM`0+Kq6CpvO(y$#j94e+q{vI{Zp8cV_6RK!`&C zob$*5Q|$IZ09dW=L!V zw@#2wviu|<#3lgGE8GEhcx+zBt`} zOwP8j9X%^f7i_bth4PiJ$LYtFJSCN$3xwDN;8mr*B;CJwBP2G0TMq0uNt7S^DO_wE zepk!Wrn#Z#03j{`c*Rf~y3o7?J}w?tEELRUR2cgxB*Y{LzA#pxHgf}q?u5idu>077 zd^=p)`nA}6e`|@`p?u}YU66PP_MA}Zqqe!c{nK&z%Jwq1N4e_q<#4g^xaz=ao;u|6 zwpRcW2Lax=ZGbx=Q*HhlJ`Ns#Y*r0*%!T?P*TTiX;rb)$CGLz=rSUum$)3Qyv{BL2 zO*=OI2|%(Yz~`pNEOnLp>+?T@glq-DujlIp?hdJeZ7ctP4_OKx|5@EOps3rr(pWzg zK4d3&oN-X2qN(d_MkfwB4I)_)!I_6nj2iA9u^pQ{;GckGLxBGrJUM2Wdda!k)Y>lq zmjws>dVQ*vW9lvEMkiN3wE-__6OWD0txS&Qn0n22cyj4Q*8(nG4!G{6OOwNvsrPIL zCl-$W9UwkEUVuLwyD%|inbOF*xMODZ4VMEVAq_zUxZ+K#Gdqf!DW$5f)?7UNOFMz! zrB~tuu=6X2FE(p^iqgxr+?ZK;=yz`e;C$#_@D9Lj-+TDVOrva>(#*PVbaHO>A)mhl z07OJWCqYC60518$!&c`eNBcBW%GnfaQ*$eazV^2_AW?j)h;J1nUjN(I9=0+!RVx~% z3@Tf!P0TE+98jA?WceK-}A1% zW!K)lyKcGqy#M~})315-A#2NXQ`?6NR#Apo=S!oF=JfpX>iR*49ec{7AN$xxpK{D$ z2d%Fz&rdfSqourN$~Y^NFIMV1CZ?J*bMx~H3k&meGtH@q9ra2vZxmA$S(#jaaj-g4 ztJmxG+DLV<*q<|sDXPp$X>E)#S}Vm&sRaO5P&goh2><}FEdZSXDqsL$06sAkh(e+v zAsBhKSRexgwg6tIy~GFJzaTxXD(}|+0eOwFDA%rn`X;MVwDHT9=4=g%OaJ9s%3b9>9EUTnnp0t;2Zpa{*>mk~hZqItE_!dQ zOtC>8`$l|mV43Jbudf0N6&&X;{=z}Zi}d1`2qmJ}i|0*GsulD3>GgQXHN)pkR6sf1 z?5ZU%&xtL}oH;YiAA)d*^Ndw2T$+Mjuzyzz@-SM`9df7LqTxLuIwC~S0092~+=qYv z@*ja;?Wt!T!{U?c*Z0YtGe)XbI&y-?B&G2$`JDM)(dIV9G`Sc#6?sI60de6kv+)Qb zUW~2|WjvJq3TA8`0+sWA3zRhY9a~ow)O~&StBkG2{*{TGiY~S8ep{V&Vo2l<6LWsu z^#p0-v*t2?3&aA1)ozu|%efSR=XnpX$lvTeRdKlvM!@|pM5p2w3u-6 zU>}t2xiYLS+{|%C65AzX+23Mtlq?BS&YdYcYsVjoiE&rT>;Necn6l^K)T^lmE`5u{ zm1i+-a-gc;Z&v-{;8r)z6NYfBUv+=_L}ef}qa9FX01)+Aaf+;xj(mL6|JUzGJR1|fnanb%?BPPIp>SCjP|8qE5qJ{=n5ZGw?81z3(k;pzH%1CtlX50{E7h)$h{qGKfzC`e2o`*IqA#tjA z`Fz&^%$b9F*N`)U-#6>a)Z`55`$Dd0cfcs0$d13^ONrdCu9xcv_=n#WQo8stcz3jP9|2EvdI-RhJM3%Q%oM&!OlShM|0 z?gz?wHZSnm45njLtsz8PVT1S&jAlbKg5kVam$p16=EK@Sj4EP0OtH zmJDmdc^v)x>56Qg_wmYHz6h)>kl_h$>0@J!ypv%APmjZTAQVLy6Fu50RGY&JAVNhx zrF_qG6`x9MkT;1SFWo$)l{M$;3qUDn9JwE}z zRl#E_bDRJFii61kPgBybIgp8dNW!Cc1b*^YYk-#oWLJvtM_v^hQx~9?8LD4VFFxBF z3MlrsSC%f9Oupn*ctPL0U1fwfX?`tRhPD{PSLFPQOmIt$mDy0SgpNVvHS+f#Do>h1Gn?LZU9(KaN>Q_=Y*_T zvtD7%_u^^+{g`0VGzg(VZrpVQ6Ub5M=tI_p7T93R8@3Zulu3|#{iNcu!oiHxZ4Rf*( zfmiN$$ru(*_Zqn=`Gq#OuHRTSwp7uH_SokR&|)RuW5yo=Z|_4?qU-JU+tpt>!B&Is z@N(=SG;bpVc;AO@zbmMM zScqq1)b-ZQIrs={oD}|?6y{$HNB1U0^LsBh8JI&3!GBZxOXI<}&5-$lgkAaYqhOTb z?2vEnZ$-kk;*M_17(upJF3%+iH*s0-r{vttXVB2OUwI1s^+G(Ft(U8gYFXC}#P&E^ z>T@C^tS`Z7{6HT4_nF~n>JlZtk5&qDBl6r|^kzQYe`wq!C)n@$c>WOPA61NDFj<<6 zGW71NMMhwAl!U-yqrq2xrSFqRCI8acw7?}3j;ynxo*-b7Co;g5r%^j=H@9({PXXBf z@r>U>>N;E)81wx`B4f%{PB~MHka_);%kBCb(d|Jy5!MqJ%2p`t&@L)4$T2j&-WHvG zv3(uyA_gwqNu(k?jQTtv3dgPKRZoH8prxe7>pQBW5L&dpumS&5Ld2?(sCpJjvc4L5 zEnh&?91WVm)ZdTj=fjJ$pPDdgAttLXuke+?KdKxu*;kTC(r!tQk6;gxj4h%FdHAt(^M3YvYj(!tOeN)+Hvj6+< zzyJRG?^lZfWuR#t!tUKP&(?%3v&Zd$R2YN>lB(Lq`OInY48%4%yTv2 zYe1{G`3)(PDEio5Y@-I5tUf`c%%OCJMtSW56g3iEg%3`$7XSJJHyA z<|7&N)5Xrlgv~%BO24eFd;Hd;uiK%D`EdK|quUeRZDqbh9l)%j%J#0lfrZumvA<_w zu&=AVvdChf6}eqh(bUz`(`Ue*p01{fBAcTgKyDYLs_I+YyJEk+rM@avU~>fB$n)HS zM7pfJydu`i%gfS<{PF94kZDv$t>06sAkheDzu40NJ$5CMW%n^Lls?8^p^QGWURbKu3ZduZQZ((s2? zzE`}<{;Zt7<$C|9R8A~DJ~@%x>TfP zF>TX8)@v|t)q4GjRt<}5s6hLHwRel7>V@&r-O|Av(yh;Q1A{E>Ir>p+%dHD|=l+lT zpr(Dg&>#Nu=!)6bCLr-ZS%|;h)Ij$+e@r8_{qO19QvDe=&1tmpY*0lcA^Cc-#{9fQ z<~$*<&P$Q<_jy#<$40PMofM7aQ}C=jphI`4kLg}Z7CIN#26D{-4v-_CA-LiE@(%{y!BzsU%gG`Q?sjLUf%qFSl0y)2#ae*+EI>s|i`d^V$Dn)qmzqRq6VJRY|{4ujsIU%#bnqU6MR&-1I_43=|5(6Jr;Jvert) zE?S|Tmn}Tv<-??sxV5@9t}3D=>YZ0JrQe$CO~|EY=Lj9RM&4svQHPQL6%pV5fPFiH zfXDx;l@~et{*{U*#c#Dvzu)|znDO7$#CRx)Z&yp-}SrD{&|(MQtfUz~n35@RLfUy=aqrhCX0M}J_r5QsK~NmRCR|Nm&L z41UdsLjWxSUlL41r^0K&nCCK>fdR-!MYjFg(z9_mF^C|#ZQw?`)f6uVzF^`bRnVY& zo}@M06J&_+>w9@jpaO4snmU;0t-(zYW1qVBHtuD!d?%?AtN7Plp><-1Y8Rqb20ZaP zTCgn*-Sri4Q8Xn>=gNaWQ57%!D35UkA@ksOlPB*Dvw}t02ENAqw|kFhn%ZyyW%+t{ zNdM!uqEM^;2}f+tECHbwLmH*!nZVrb$-az%t50Y2pg(HqhvY-^-lb}>^6l{$jOI6} zo_kBzj%8aX|6H5M0Y<)7pzz_wLkIpRm!;PzY)9+24wk2&TT{w--phDGDCOz{cN_ca zpnm7`$oDy=HX%0i-`769*0M6(e5j-?(?24%)<)&46y0e&6@HCDZAm9W6Ib#Y#BF6- z=30crHGg+RRTe%VBC>T00OV6F+gQDAK38Ne3N9bm|62tPccBJi)5{B z4zc^Db72XiBd}v$CF|yU{Z=M|DZ%-(XarYNclODlb1Kz1_EKLy(NSLCN`eUl(rBCL zT*jx@wNvze0|TSqgE(QArOZU)_?qH(sj#TwzElLs9q)(0u!_P|R%Cy_0JFQxgGV>1 zz4?_uq<8_gM0`c*Hh|;UMz~vrg1gQXp{ufg`hM_qU;U>+zmvc5blCLSq@PrEBSGR# z&8=2Z4uXN`F3p73ueD1l{s{k$WipAvSh5W7ABe?4)t;r@V?y`bNB5FvBuE|0VRTb< zM1Hn^?DSsJY+sX@T5xW=#>T9VEV|?<(=6|ge$X6Sb05!LFdjDcoq*gM(Zq=t;_)Le&jyt(&9jzR73noru`a# zN*<`KwGa^gZU3-)MSLF0aFag#f0<>E(bYTeHmtdbns#|I)-$)mJ`q9ctQ8g0=ET?| zdO}eZ*b_p>ygRTtR^5Ggdam=Zb5wmd{}np+Jn1d_=M`~P=M67jj})fH4ztb5yQqQW z^C|C&^LHAK-u+ooIK)yM)QM?t;|<{P;;{`p=BclzAN#JzL4jCwXkQB1Dy{=^KR`=~ zTrr)y7eiYBzSNs_DvO=4A6#EgGS-zY%Vi)N*Yb`U;6o}KR}dq{r9pT5wqZ@3NOE8- z9-(}D|Nc5732CSYQbL)!gPQ#RbD8BhK3dl{sUuPvei0tkvnJBxDEAYTesU8H$)g(Plra{VH(v3u^CO1~(+ zU0O7#)jaS4{NcwA+LuSm&VBcX2#Im3xg)W}ySNw%->orn1taZ&+d)}8gJTqA!u|5P z{yv?zol_3|(1(%M(EVU=cp?L`{Pi|ixk{U)*guFML3P!OSlz;zGA#T+E@8@cgQ_mv1o7RSU=Zo_82F?&&2r;WE z@wk}JHYEZ9nYUc(Vv~iTCa3u8e4q(yq<29VoNbKk|`mq%I6u)My=gPIDuUb&lzf4`MEA9^g8u z)vp8|$$HE9m_BTV?lOosIGa4jud=jIbw)O2eCMfyw2*S8?hjWw^nqws$O*M$3I1)x zR0PWFb3$ySOcGTe1dz%N0l;RPc`x%05FtT^f^j{YCP}*Q=lvp4$ZXrTZQHhO+w%wJn3c8j%+5C3UAFD&%8dBl_qi9D5g8fry}6Ev z2_Q~)5^N$!IU`BPh1O|=BxQ#*C5*}`lluC515$lxc-vNC)IgW=K|=z7o%cWFpndn= zX}f{`!VK02_kU+Q5a3m37J;c} zTzbxteE{GNf?yLt5X=Bzc-mio^Up0nunMCgp*ZJ;%MJvPM3QK)BryP(_v@ei4UvHr z6+sbCifQaOkL6-;5fL8$W($zZ_;CZp305C;~$hhRquZr-r)jjd1z z31%ZK{-(`P#|Um_Sivn@p$-vz46uqT>QG0B1w9znfS9A8PB2LaHdzA|_)yjXVR*l{ zkcu3@vEf7bxH0nkh`q?8FmoO_Ucui*>_a~P?qQrlZ9@+D7%MTpSnztpylXrt5!-k8_QPB?YL8Kx_On8WD zgT+111d(Op$^$&KLAN5+@?>f7F4~wFi(8TL8+szgVmcMDTp5l&k6~=rA{Dt}!gb^r zSWY<)M7D|Z2P0cEodj6E42PV>&>DFmQpgt)E-|#sSUU@uKed+F680H@<;-x{p|nuH4!_mn85rx>wz;0mPi2ZkL#k6;sznu?cXh!T0S>{w6 zL^gvR05NY64l*<+_L>On$rjx9!US;l;LX6@z}yi#2XHh)F@Oo+l)h%fq$v}DNmF2> zfs^_t0)3N-W<9-N?uedVv{)-J0W5mh#29QM5R5h&KuiRM=0Zvnf#lF=K#WlCgc#9c zS;qvh(P$!_a8JwyhI^ZJV2k+B6Z^64?w|1?5gyo6y{}923CRZfYVe1#?F% z7h2SUiNO3;T#JUOyovSs@@C1GtwipycA=*x5{BpIZ_#GCMuV8XK=x;qCNy{d7?wA~ zC+=vjls;ci&zW=6$H~4^K%v{p}Ab?U%C6Z4p%eC<3ExqU$XR<}LLF67A$Sr20DR_pJ3yeBa~ z^sw{V0FI5;UpwXsScYuhbqGQ`YQ25;6p6W^+tgL&;Ml;>S3CGpSZ>VrTn0m1$y$HU z&65)I!c?oREz};c=nLCliriqQX->4uivHTgd${GqeAlf*!P^B|jkU|*IdNP(&6C>4 zqOW$)Nw9nvjy^&`?E|gotDV{JmJ9Q~vuhy<`^C4XIUDt|j4o6rK^e8_(=YqC zuaR6TRVf@tUFHB079o4MBIh{M~4>WwnGgesQH*3?w(RA%hCZ*7)b!aNV=yOQ%o_Y=Lt0Sl*(9^jfRnC210Om$=y>*o|3z} zAR&vAdrB#mWoaB0fJSw9xw|Am$fzK>rx-~R#7IFSAwdu_EI|SRfB*yl0w8oX09H^q zAjl2?0I)v*odGJ40FVGaF&2qJq9Gv`>V>2r0|c`GX8h>CX8eHcOy>S0@<;M3<_6UM z7yCEpug5NZL!H_0>Hg_HasQGxR`rY&Z{geOy?N92Z z{lER^um|$*?*G63*njwc(R?NT)Bei*3jVzR>FWUDb^gKhtL4A=kE_1p-%Fo2`!8M} z(0AjuCiS;G{?*^1tB-uY%=)SRx&D)pK4u@>f6@KPe3}2j_har$>HqzH;UCR^ssFD0 z7h+VLO4o@_Yt>>AeaZKUxqyvxWCAjKB>qjQ30UA)#w z&=RmdwlT`7a8J8Yae=7*c8XL|{@%wA8uvCqfsNX^?UZsS>wX}QD{K}ad4y~iO*p%4 z_cS{u7Ek%?WV6em2(U9#d8(&JDirb^u~7wK4+xP$iiI6IlD|a&S)6o=kG;59N|>K1 zn(0mUqbG3YIY7dQd+*4~)`!S9m7H6HP6YcKHhBc#b%1L}VIisp%;TckEkcu0>lo@u995$<*Em;XNodjTiCdC%R+TX|_ZR#|1`RR|`^@Teh zl#w@8fI1FTx2Dy+{blUT{`^kY*V-AZUd?ZZqCS4gW(kY5?retkLbF=>p=59Nl|=sf zo1Pc|{{N4>5nt#627ylGF`3n>X%`w%bw-Y~zWM_{Si$dc82|=YhISal{N7OY?O`C4 zD|qb}6nLWJ`hUyL+E>-;ricg9J@ZNYP(x(Sct&OI$Y!QWr*=^VN;G3#i>^1n4e#Je zOVhbFbLpXVu*16enDM+ic;97@R~u&kh__kgP#!R`*rQEnA+_dLkNP~L`0alC|J;c; zeiK=s8;BsLE)KbG3BD&Br@(Ha@SBT&$?xX`=$;eeel=|R_dIr6-Ro?=HEjnsJ_b`1 zK6Yg^-6;^2aW!xeTK)A~3Rm|L^FCHB_I>jIju7ZGo&N_1*QHkxH2!!%@o4iZ?vntS;&zJdPe1dH#04YD93A44o-MpfD zP{rn_aq>U%RDvC2+bp;xPlsOzauIi3*Lf42`jVKKZCRuKdYhi>FDuL2l=v{$BCN#Q6796s%r-AG$Q^t(3c@ zD?w0UhYr11@feiyl9kY_@H8~|xlmO<8PfQmj1!$@WieW@VxR@Psxfe-v9WCi1+f>F4VL?0O~K7T?m4-u|pSkBpUJZZe*16_wAp zSYZ@;k`3;W3UHKUWc8QeI}0jH5Ly=cGWQPw(Kr2fm=-5L(d`lcXofy8tJY3@Tuadz zYWXR{mW7XT!RF#RVCe%}=tM*O6!AD3^(!8un~opNI%Uko7$5t@<8+?; zTxDys(MyyGsUjtSu9$+|_-t!U3fVb1dkK?l`17<+jfl=hrBHnDSV>^R1=TnQeyqbW z>ov#l%!1|S!1>8UUxIdhQq`_klcHVx0{?#>K3#$4GlXncwldt!g17TcvKq-jo_996 z>oA=tH9CqRl6Yw?Uc`am!V?lHJbizOJaVaScf1UP5e7Dbgabq=b!B~T&_F6?ooU>w%x0A zH~&MHJ=q`fCH{U<7MDXE4SD32cDZA)WJeWkllJ`UspWaS#eDe^kg^oU_A14UE9zG-a^g{xaXf$})Wik>gT zl#dkzGr(;h0JZDuFn(+k8wNq?PZ5grQ<+sM?wBGt@JnH6v0#or-5wBQWKU~(S_> zkE!tc*ZJ1Y&*p(xX84POb3cClRMd!^qJ#CAZfIepEj-<`VURS_yCz0(?*Ixcj4 z-!zV1_QZhpm=0<;*(nm+F>T=)o?ep@CK5I%g^VAA+RB25ab?7)A~z~egru=I1S|@v zH7tXV!0wmGS^qj#e+MY;C5eUjEAp$Y?LDkS^QPZ}8WN85?r$u<-Epi;yZ1|J2J`se z$D6DpH~2F=eI0B&=UFAUnJvZAmClJlK)sutJ?M>xpZiWV&0=G4MZP+x+p>EX=HbCz zxls%Mw?*u^;LbHWIWCyq+yi)`GmFn9J112CZda_u@YIP%i;srFg_paU02Ifij*7}l z&CF-(3|>*a|+vbNR`^RP=9G?ymEJ0Z~)d&c*UE$UMepZ zcITr{0WqhxkjUnM15js_gW=e3Uh|y6ZReaXHIz-=p`x5VvB&rH9y>Amv@^WmXFEw) zQXYrk3feir=a{jMQ+wDIkkFnZ$k{sJakHn*?u za%4b!00ev8NVLM1TY=cl?KB&55BY_MU-sg?c>=Dbz_W{(Z~c?HJi*XpYL)C6Bd8WH zt+v-#0&o~@t4qESi*)+eW%@VD0|o^yF)n0hME$UtXF$*Lvh}7sso{`|pn*JDIy5^Fm3s$5*zEE=?u5<=l8FJc3r%+H} zdfoNl2J0^~!-*mOL5o-x32|e0Im*E!yY7F7E5N)W3>+v_LBydlEx?4$RL5f2oYRD# zaR0wv(-p~wO0eLDl3K=%`{5+0Gd$ktO=W)gWlGZJ0`K z$_RNA=ckrfa;H0KA~dR^p�(p-{x$&=IACIfoAR!za)F-^da-t3#0Dycnp zwO~NVXwXCl;jE<}>%@xz|=8fIJAB?>+E{7)|4l${4ngA3G|=r z2Dyv;VVWSgZx9Wj>qUjleGl3Ei9K4>h!(lPS%8VOG>Xu0%6VDz^O=bjJmuP7>DeUv zrbI}MlHB^^d?{zv6d=@_ZD2lg1&G7UjnVN{1}9WkaM3H~btX0GtSzB+tZ^qRgWo4m z!GmimlG$=wgXCnr6j@m<1gAL46#T~5Bnm=2{^@>|t&`9mkEPddj zAvG~@Tv~TAm2i%VW}R-g(Z0)z-Y|szHr@rk>4MAyG*Ma*7Yh#H7(!-5>DZ@8r;_dx z{prSe<>~099F8vsYd2xff7uAS%7{S)f(|@me3t2$iy&NEc7OUEchp@9A|X;;IA>8!oX+y(BKJ$EzV* znR$z;!L$s7uy@{OT~nG#B!NRraT8(X##Ho!0r_o@gg0CA-9H^;-uE&?$2$nHv_00o z%cbuUc-tCx$Uh&EZ4Nf4Zgqv)Y6>usG3>GeQnxx_Z6+PcbX-+ysbt1hQ`K1LDpOE? zrAhIZhSN9yVIAOa22gn577tbc&i3|3V8NWy&!tw##`}9*x}gtI^h1DzZRA>UuaJG) zaZ7j)dq!O}{?#8Y7~7i6fHh4{`pL?>-18|p!S75Y#^DM>-S3)vuZG+Q7l@ek zQP~#cBpWgg#mApc_sPYjpw8odQuRokmTkzcNl`^CcKB7e&;zViV;{Y{o^Y$%7i0m# z62%#1Lq!RC?}lK>%mp}T!3Xv;L*0v*>USLm``N%>w>@fwC+#T&Tx2bN4w(20JB}oU zuSa6v^kXi0xPs?pbaOHnyiqq6By1EZY9OZ^^QA>{q-Hsd&m`pbQ%8121aWG-F5xf zlZ%;B{;C>X19|`^_?dVyCq>n+41w7|!tUS!{9rHlbhX=SZO5CQ^;!Du_E7*`GiR^Q w)2!4MKjfSAeNo!9>IaV6aUZ*?W>} zs4%E?srLW`CJh0GCIK@hTkrW7A15Iu%N&?Q^$0+!{Tv&|t^Y@u%!L zglTg&?Q5q#ijZ;&HBQ?FNPp;k3J5!&{^+SGq?AX~SiOM9jJMRpyP?RCr@z38AQyy&WRMaC;n4una$~nJKSp?q|s8F00c9?Q! zY_ovvjTFm+DeQM^LXJ#v0}6HRt3R1%5PT*}W!k8BEM;Jrj8dIceFo2fhzTqaB3KKk zGlCLI)gU25(#u6ch6GeB1k@eHq7l{EHXv0n6xE#ws#ri}08kkCf8hUt{|Ejb`2YW* zvg}0nSSX1m=76s?sZhRY$K=3dpJ+y*eDULGnL2}4>4nvW^7_<~wIM_5fjvwt4h1|g z)g0Z6ZFq9j<~9~b8((~TN{Z?ZQfw|is&Xp~AC61sj;xItKyCHdI|tCMC_LbXF>~vR z=w6V3^H=W4CbAgR4#xw}ETTwu2guW~=Crl@SMXv85jQ=%y!s^?m4PI0My7MWICO;- z175jm%&PcPWh8QdOU(#8bp4!N7ET-+)N}N2zk2)8ch|4Q&lPFNQgT-thu053`r*h3 z_8dI@G;`zn;lH$zX3RzIk`E8~`J=BBdR}qD%n@vVG1834)!pS1Y?zVkJGtsa(sB~y zNfMYKsOJb%5J(0ivK8d+l2D2y&5X!cg3BG!AJ}910|_${nF}sC1QF^nLIhzXk-Y#x z0)&1iK!O;Og0Ky!;`b~v%b$`S4E&fB)1NB4v@8wr( z&+NX4e^&o)ecb=)dd~C!{(1e6t?&9j{l8%U*k4)?`(L3;Qjw z#w7FS+U(94MaJKS!J9O8^$)36_J8;thW#2$y9i{bB{?M{QS_inZIJ!jwqAbfXYVd$ zQ5fC$6Nc9hFi8m^;oI-%C#BS|c8vy+@{jx6hFcf^_;2VRgkoN(0h!_VSGmgNPRsxI z8$rTo0LaYq-H5i&gtj81=&xU?H-Y2==G@uQV7E`@+2E9XQW@{&j`?EOktk|Ho{HU>ZqDzvgjwBmdex z&uZNd2C1h{{}2k6Ys9$*nFP3;K%u!MhW`uZy7Sn`1M1zs@Es&;z*Z>Gsh@-3Fe6pE zQD2@cqF((NrRevgvLsvM_8;;iNyJ5nyPyy?e!kvKjGj`6diRFBEe49Oa7wwkJFV7Z z$YT&DWloYu-H?3<0BKn9L&JYDT-SK~*6c5pi18P26$JESKRYj{T7Zk6KiRJcbvOO*{P56Q6s8msbeI3>|j>K9}Q9UBeq*inXKemCm`-<5|-$ZyN4u$(3 z&HcvqehFD%5Yrmykg-^d`=BSa8(i=>ZoC77^mWY{evp(km@aHqhUECBz76YiR+VYK zY_avFC~V3$=`6C4JhfHAQ@DZtUOwH`L;oYX6zK0-uI^?hS$ALfq}A7evR;ohJHij} zHSZdW?EKv9U1s4oD*<(0oQ*;MaQ6@cvGL zuHCPgm_NhVsgp^sfr*ia^Db}swo1?O(_Q2)y+S$CBm+g=9wCOUPbz(x)_GbaKa@A7 zuI&!ynLiZRT#V%_y_-D`0Z5lT*auoe{(U5NylTzFSJW()W-#F6*&A`LNO1bV#Y;QJ zSbLBnp|B^dtK|KIWC|No>JjWBWE@n7O)x{&^E(WMeMvp57#qA8m* zeTow*U@_86B#Fm*rxyYu5PRWaWHx8y> z*qmHEp(AMDl0v)ij(AY8fnH=~ZwwjVAbu*m5;xPfidh@ov6d8g zfJsi&!QyK53Es%sC39ts;54V68koALD4b|%tNHW0bIkZAJKa=W&FomJSEDT>W1xIX z1x%Z>AvNIsSPLcn3RTcHXb@KB?cuM)=x6fcIx>&(GxqZ8w3p#jJ(GVgc*`c0HG}dv zIop&Qim!K1NFwic%07KcjWgHBPUkq7f~lj;TPqVGTiT#cUeim>;nY`>h@a*S{qQex zQ`z62WK|Mj)Y{tfF{;T4P;c8$Q|KU?Joh zIkA^z%X7z|r>4aTh@|StTi!-r1D!g=zb#3d#{{&K3CqE$Iz-UH<%37c zRfkO`&uM%#AD3PHv`g5t0e^O%nVL0d{Xlx^EjEC3#skF@`zl-7PF^0oxW)1!C!JxR zWvuAHH?)61FKA1QeT*_sY7;_Id#!GmV4n`MO{~sv}VLSK` zXRw=Y=Clz*00B(5y^K;gCZMAzjT5+c3IC=)l(9VIDdatpxj3y89WwI|bH&$!ZEvp` zPR!T@#!(|KfI-w?!&+7$N3F6>tD{YO4Qg$d_`nNEdfVCha9vaPn0jI0`)`@*72hq! zpU5ND^P*RoEkbD5o#az(-g=Y)L>HH>Oc%}$ zT3Rs_ih0;4+Lv4Y;@Iv(;fUbQ=i-G(#>vghec~*j(I#r|5mqFiJBpzi&hzEcD{u$< zRsm0BVYn=pT;0>R(itW|*D&;O%bOc7et9ACaH#J>z3A1A~6fdP>pmbM%xzm4>|;c_?B+%sl;Qs2{t!60$^u zH1t@9^6>;?!FuusnISi$f5CL&;z?EqJN$FBuWDA#D5`cy_UvCFIVvf{c?4N0teh;d zET$7aVbj08KTQS!x?Nd1Is8q8qFzs}a=!@nJ;7FSfCY^T@D-gpw`w<6e#X3+;O}1h z$%I!M)0bg|EKUA04Qjn@+x{Rj8vt6Wn!R|3A92z}^$KfF5(#CWr4y#~re1CN4i4w0 z#GsypBR{xA3Er7sgAi(|}1-W?s~n$7?K|9WL8kpVfw-;#b9 z+mn;=ep!162U5R>_t}fOt~tE?s#m( zO-S$7>Ay6*hHdZ)7_oU915WYYCIX;hFI-U2EWYX!pllONr@Q--2o~`!isi6vTPLJ4@(|o=%NHYjo0_S&q*UQIROw@*N-By@PaQ&;YxFZ0aR zX&}LeOEz);#m~Hwm^VAY8DK}b$F4bo{jMN?d!lxKPhNklzr^Cd`0f4oJr^z=I|l`* zm8AHm*fPV`0=lF3Pnnp}&J0N1X@}-D94YvmUabFrLGSnTz7Mu^21F#O5tN#CuY9Vh zUZBH=ez%h*wkf0hBtXJh1SN3d+IF{gzT7lp)j}n?03lt;XSQRAh7qd&v;RwTYDuQ# zbI2*r<>?x-G0@hM{;%{VBD7nLKt~D`T~-HAt5;h%i0_=Ifs=yHma5dhJ+QMG?Ux(a z|E?1CMy1!~oA`FP!k~iG=t&5#>bVdz=peT8HMB6Y)#7PpETtNryT^+Rv3vpJaF^zP z{H}0-LyV9Fu21ID%wO9f1IKlFr1p4c{o-?03vyB-tr5duk^&L$;m_|f$vs`^Sl{j2 z95}oY{LlY+=ZS%J+tZoXCd0*sSU7w^gjovXn+g7uyra5{cU49@yHf#Z^Jl-$9cIfo z+AJuxH$VLb=#+uBbVmUjnx zxb1pZ@-O9=AIk4@S)m6fJ2?{HrNYwwnL3a45muuNjr;6$O`bGEM0T4A2_S$t=86*- zcO+0mywg*j#A4mU}enR_!cGmIYQ;qwfchWtFEXL)AK%*;=j znYne+hS4EMy3S)C*mZ1KI>!+)0V@9!N6H$Y}~MJ{rYuf zz^KljIWvFi-?#?V@LPR&c6Nn{!=XM z>}-h$S76;$H{E{Y%@^zlmOl^efBwa%UU+jJD9UVukQ3ti_kH-?H*RC0?M1W%FCvMB zM_+v6fk$6X2sx)-p~B3&Kl{nscK}pNLM*qjtpaf9>AU{-iPKQZR8yCg!TY}Qg*(;) z)gdvCcB%kppZc$VdvsK@)3l1{&DG!d_6OHOS`y=ITLEVu`unSKA2E%JD*DVX{LJ}K z9l>hMRDqxQh0lnpGHpVYneX}eA3Pt|2v%=q;rt)``R|#bDyB)OXY&vI_@|*}h}G?^ z@aZ4_!7cQPX`!fW_?{oT1NTwHs#l5L-0`E|y@48<3Q^HFf8=Idi zpJYD%1MkII!~|7I^WGo)IF=?{>ACnjJ_WUi39C}!Q{QnheVJqeKKqq5^o5CBde(g9 zvw$X6^jz_^E2$wSw4!q5*RG(C2_^XO$HBn_55vbl44OnTTRwRaePP0vo{K)U1#99& z<>rq7V&V(<&@I%MFoN5zrY}sz=(*-L&}1QQ*a%`u25h{cFj===17eB_uGuzG&byQ< zrm8BJZl4r_E$3k|Wo6FW0-6M7>qac5uFQsQcmkLWGfeH74S3Z_rJ!jgN++!@i=HW8 zkyjI(oPH-+-N#Qc^-mpNO`bc6r=2-<%&Wy5K1vfFJB(L_IkpS6fY^NmuL8qsgj>MD zn~BHH9WM~32_3vd=W&B)k7F9q%stJx+b_L_X-4zr^LVUMCmyCTA3sWtkvsmME?Xiy z?xOSfB=_$oY06~J-HcCq&)qcW{j;uP;?Dm}=hkq?zh&n!;m((-G-u_t|6x399Q;>A zgNpxoJNj{u|MFDH7Rhq@FCAl0dE|ddnl!oh9{Lq?@JDoR6L;C941IK`ISfdE$4S zE0AUQ8+2|Ncl_q5QkSp#AODp~(^mfP&%Au@@|TBQwoP`UU+V{6u8|)6ZA{~uKmQ*M zmrMTDU8S~8Eqi{^v0Ug&5Upcm#y7Z1(RbgZAG8jB$eRwCspQ)>5;U)oGZ&E5aeR*K z8Yt`Y0$G))Yd(Y3KH}tA4`-_QmNke5hU_|nq=xtyjwW(_o?itz>B>WM&^63bNdQ)k@-IgDHW*RW$Xo9#RzrTrCn7L2H{9Amq|qNg@#eZY=|P zCoI?2s+L)zsM%WX(NbVEY^`C>lFjIBYmJ6@DKJ0ZT4&F&WHW!dwa%QzOG!?jY_2(S zDcEzZbz*2Q!43|z))9yOP9X1Xt%DXzwY(3tl-TR=Qb_MbZYRrooh;dYYmS!U_as1(=YVB?Q_A|tNu5Ut&_q3jbfDM zoFxT^uEuH`nX3*sB%K?GuHUkweYReBwnHqh3P)~`+s3+Tj!rDA1e)8vuBv5J*IsxC zkd^~b(aGzArj08{>cnzOuy04C+C`}gb|Yz-1avxeWzev3NzcHbz_&4W@QCr$z3~w=8Ua- z`;vfG1~BP8CyLb=F7t1am~ph_#|O%$khSJ9%Vtcn)YmpgQxF?xM^_Vb+5fnpB^W0I`f%X8gb9#X{Q-yJG0{Z56aWeI&zPxnf5pdJA38bM`cYnS#x)% z`n1tFf$i)W-hGm(f9mde^=X@NcV_lFb=P`4&CI&H=IArijGwdCk&X@uQ$5xmj!~^? z#$ROCI)V-~t%L%GS#wo@U27ddR`4`3)WoB{R-4snfNrfee|kI8^bu#yDgYqOwas9# zmcb`3!kRJ`Cr=_tq)8aMt{aGtUZsqwVlj6DgCGre>AEt&x8H_in!x@uwgExIh|-mA zjdaC(29~CTVSaaF7HPbql&*9Uo8P@f)>LqCXclr}peS7_1BQ28u9PO8Eq1@`l3q9o zkfKCaO2?T?ZyA6loW<#9_c^O=m<&h}CA!ineAD@=(gbq`vyT|tiJ6#^B1$P;;qax` z55k&Q?wEh#87niLo*+n4L@65J(Nz~=Ya%7^(miLb(E>A3B@|Jjl;FU&D>o|9#7PJH z?|ago!o;WC^h=|T7PVBg(DAB}72cyUS zb(f>Bwbr!F1eTCO5fpj<{PqhY5>143p?~5ZA5H40);=@M#MYvrB6gqHbU_!GSY??i z%s=>-ciA4*zOOZHds0a(kWewZ4h(k8h(ua7HX)Au&mY~H8KY6(_cb$_&fA@QjIW-*heP3%$d!m5^AdnT}`12qA^c@!g3DOwZ5WwE2?)-yU z!)Vx#Mtxt?FzFTwK!77sy7)sMzUd->w4^bxtpM2j!b1pjgyk zGKwWGeb4)^zjy{9Es&PU1}gwg?|J#L$KJB7ett9@4M%-nGtIQr0>Fl@8-yh`-+1ed zS6r}(MeSvgSoFmH*_WPu@i?}!AB~2?;i&IxrkNg~cQ9Som98tcq)k^|eeER|Zl77t za-TVUc;DNvzVXJ%w52+#weN?+;i#{f#!Oc&z?81*N>^e~ltRS%ZI@lR{rs()HmqG! zx*}ZrI-EZ}ckJMiy>A^oofwDfC~IH)z8{VHKGT@#E5I(Ll&+MnMCl>~AV7+>Gi%mF zkU1QlKASdR0B80!YhP<$Ywi0?W2Ux45oPfxv9QolWzJPD^weBfvo4SONxP35106sAmh(e+vAs0GboFD@PvNs)jNPvarhW}0YliZEg{Gazv z+JDIpoojRVPr<*C|BTq<`6ga{5q^8^!|0cxe=rZ!zxH3%f5ZO0cQ*Z<^$Yt2{|Ek0 zyT|*F+CO@K;(owBKtGg!S^xj-Z~rga2m6nxKl9J=fBSuNKW_dLKWhJKeg^-Xe`^1? z`TyJj)8E!#>_3Y?uKrwqq3LJ#SGU>AzUO|6`nR^u&3FNN_jGOc zw)Nw`wr3yIKhgcee6IaN=ws>M{6677%)hPwx&HzC(f&u~&)6@b2kNRzBDQAP0*H73 zq%McOmRk{B3i47qRe=DA*$&odrbEJZ*pV9XXa&p@wlW~@Yfs>V{yiTtplMhgM*-Bz zsSnlq&pG;z0OUN%$~$3=g1UF+G*>+17eRbBf3=y79J}KR8owon@$1Z7MIrvvWWH)34nK2SD)GsrJ{l z1Cl#oVo3A8qY3e=aF)qzms~FG#2$LzT=gs&aVMOj>(%{y<&O0cG!nCiESl~x=^dF{ zKvj8F1K8Ng171wwM5Fh4KoQw`_c6#y$(5cAm7e}~nJ#A*fx+c9;y#&W!#VukR)ugk zKp3=+;Ut+IYn%m+r4d*<`L2h%aDnX5}^!5R|H;(34AoVWjRx(msBZvk;rCI*|~ zdOijqI@9Z{Vu!~jvHW{lBa$rnl4+!s_5sfK3bCGk-B%iDe&@-}+%fOKU|(9?V1 zHE8&@4z)Kx!RAvAs z!Wic9=o#(bg?kc-G68-m(jZ`^=XGUXb)}t(%&~sjFnV^sEX%hSy6UKC4iOhgV=BHV z2w`4g7Y=s#Vu2B_?#VQ|hP39@eArgfX>-0S+dd&^mx0*wp}>)x;c4RUgxz%;oNe?& z-7-lJ@Y^2^C;=qJsxx5|xF)*pTGhch2B&kxtn;f!7=gznk}I3}Dh}(CoMXgA5-p&kS202!l?!fT3t|HG*rIP~mS* z$Wjo}jq3}z$Qq!9yrtd3fM0N629ZM?LU$nv@Tv9b7I;D|;0H2dsA~g7Z7zp1| zB)XmrkMgF6OQr|R)HHD^TE{Y#j!~SR?b`Xt3Qs`B+x<hxexYeAjMUWdZ-*n9%(1)Wb(n2U<><7&9dwGJmrob)4%H? zlQ%z+L-^$dFhhH|@u$%97Qz?*Ynh2VG@q|?8vY&L74&fs&_b&3$x&Oyjl~LQDRRap zJU4U*R+(2Dd!G+lh8!V{pT_UJn+^1Qg6$` zqkNm(a#hWyc6SP+p5=C4HL8-m`pO`5o~`-LI?_h5CsH?F_%?nDodmz&pWR20WTpJE z?N|wSzLjMUK8E)a2tI}Lf;+;*M|h3Y(U#>)g1>zk9|Hd}oZAa2 zLYBWBoSW!Ts!RwXr^8h+U*@{9{zqS^iH)Op<;r`Uw~nc}<^$V~_i%$GFjaG?X1@E|M`h)nekvFKt`Dh-f>@|0-`Xoq)o` zx;JmzDfOV9qCx|EVpogEe0LK~tGS?5$$L_i6P$P6wIsCQaP_;d{{N=iV@+8LI}o#( zvo*Ejy=IIn{rdIQh1&q-{EuohpVOjJ^Q3lD*YTp37$^RRgn8ihpdu5{Ct%5-KO!VL zcNB6dUajXI9jkm-P|i3~GB-A(X`P1Oqqb$tcku)UJw0w3GeUijb__#QT4j%64z%EeB7S?jlWwx_7&+EEvB|6N=kV}DwnyAlX=?j`) zmU#!$*^@NIu#n_d7;WoJV@*Fbv9|yJO4;n|BNF2xy(54RyB>t~8lUOUW$&2%Nwi1y zx6JxW88>U2$#qhl^6KUbtmg9}D0o5vYDT7kWJthLGkpGnN4T>{St^_EU>4;DmLF9o zr|LqsA8_MoNLQ=}w?8u!ziSZ@PC#Y<#9uJFo-ozVo6D;<8j^1$c|qAE3ZTE5i~zmE z$BU5lw6l=EWsg^y^;8>r9qH{xfL|~PZYK#md$zZ0?o11gV<*WSW~cgy2GYGQir%wf zt4iW8D+;s*;RGrmd(-T<@2&j(Cb9xhV*l-x`TpK`xq|7p?5R%5*s!69?2c!cC*VY* z2DE^9pvOPLU!1e}wA8S8opcTJ3`NB>hY=JQnL~QFXR4K8A$BqJnoEB$wn-%u@E6Mh zCfMF4kusv3N!(aHC}4)Xs^xoOwXd%e^6pi5|DZo=Q25j+6HlJ^7FodH6y1bMROR^q zGu6)fopS`h%Sw<;ZH%TEPf+#81-#_v+@8nlR0jLcIDKQtLleOC)6yLZgC!D9X3GgS zohwU{v$jl=quD#Go^hB{`@Qw*a%`(^jyT~=q^bWgGzRj;|12J55HWdCWV}EB|K=%N z3Nq-qxJJ`>^|1MNN+q}zTB&ooE3j==AgK@^UW<^oSbeALa2peF)Th6{@sj0KyMNHZ zksk1+MXN2tv+22A%cQOGpS9)77(uP9mh+!5T5ERLvF@b}$+WvXM45Z?-kCa)fb~f1 znVbTD$Gx-0Zxc`0D@YgHakge6SL0H`-vN_x?AP0>iGH0_EE&=v83hMJgaKAI0jJXm zVxVz;X<$v6WW7}fxROO7vr#YLP;;lij5VrX{;>7kK6TtOH&6|Ar^xo>00%+u$C4@# z>!jOt6*3><171+WxoZnKDTzJtDRw+T030;yI}~uV@9fCnei^I*j>Bp&mzP2d=FPb_ zCM*l_+$LDR3B*a!A$g#>xsrZvw0lckxmMg>0aQd7tPyN=t{dgXb;Ie+T8{fZH=gdu zM7Rg9c(kg(Jg0?ARRRl=AONFKrvFj)lTY$KfT%6^6s`mk*ABGhsce*LsoD>K{z_M2 ziPpnu+lw22PfF!CoId^6n*G4H(Ix+#+N{C(da7t1BYMGEaE#PdpOLxsVD5riQXHp@OX;`S`8VnpM~)I920w~<3|mo0 zf8~Az`*?2?H&gZ&*K&bRkV@qzvMlRHXys8*Ze2+1c?5o!^+$&MHxB@4Ee5cke52R! zmn7AZtY6ST%ixgU5)%$%QcwHj7Es-Qu^kLAPwy%7pGBw_4Q9#da^W2$}axNHr03)_nw z5?yuNmXrI5HgS46)c5&}B)Tts49oU92>3xBLLy}FMUW=84DQbVq^;7_e7|(Sdz|&J z73N+M`rc2rt*oSWu#7S{*s~nH6HRHJS1SmzeXk|;CA)FI4bat3<%}nkB%;;?=F>B7ms9QSxv#@+69;@>QaR?REYX4&)=itG>rM{<{A79Rmk)`5ON#GL`*KX%}Ihk3w(RtM-WLt z?f&FLF}4N^yE!(pZ&Yj&Bc`~K0@4_}*0Om?wN|}4WJ>WL;G^H2*QpgEkGA~OET-Km zkwz|5{6dnz1U<2Pe9DNL>3g5FEIvp1jzP&2K#z~j%g6!7B;^zF+o95?fV{3mnB8*RMhCDNp>Am-3e@jNfMj?jHV$MWjk!DDKP zkAz$Y?Sr)!GUOX}qTQ5aMh|wq1uq}~joWyKl=b_LboM#wi{CMuz5x6BKlA-qy++cM01D3b7`uD z#l6M4pI;JCypO8JZ6?U&wNxR!{4oB_ zlV!x9+-&Qy6{%MQ{~yoZGkKiTSC`YS_j22~G;xUV855g2&C(zm^V!(wpcm@zn{%!g z4}JGo(sGZ1O~to-}le

UmY2RIYtNPVDpE$%vda+HD#3m z&VuXJ{BK&Qe+rBa7eq}Q(bq|tn(RrJAk|ztj2(i{d>nmQnM?;HF2k&9sA6up5tmjl z7lySlzMbifH17-m-Lwa_F&e7nOH?ESi3#ckR3tsM+jsck3`oG!uMS}|eAwVXv>}qxwq?QY%QJ0}r@^;fhuUA9W z*BVl>TGo&N004@xSiwDUXUvp51sVmqO3m)=B55aPwf@0=e}cN+$-BdKxY`YrT_4)0 z_d10#i44Q*rFr8MC>*)v$EJvz``(pb{e&*6k+b zsMz%($|1+8hn8c2?P(l@;Rb&CsZeYoCI3?2!LqjbwPXW3z4G$Qfj=cT5Yb%vY0(AX oeb?AaKtwrnc|$|zzw9vfvn^aJJ!zd)XFXqqy0000001=f@-~a#s diff --git a/languages/kotlin/app/src/main/res/values/colors.xml b/languages/kotlin/app/src/main/res/values/colors.xml deleted file mode 100644 index f8c6127d3..000000000 --- a/languages/kotlin/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - \ No newline at end of file diff --git a/languages/kotlin/app/src/main/res/values/strings.xml b/languages/kotlin/app/src/main/res/values/strings.xml deleted file mode 100644 index 3de1a3968..000000000 --- a/languages/kotlin/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - My Application - \ No newline at end of file diff --git a/languages/kotlin/app/src/main/res/values/themes.xml b/languages/kotlin/app/src/main/res/values/themes.xml deleted file mode 100644 index e48770ab8..000000000 --- a/languages/kotlin/app/src/main/res/values/themes.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - -