From 32b968ec4439dfbd702337bef04ef401332513fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Fri, 23 Jun 2023 16:56:49 +0200 Subject: [PATCH 01/32] Use a more robust CLI color detection (#74) --- Cargo.lock | 18 +++++++++++++++++- crates/bws/Cargo.toml | 2 +- crates/bws/src/render.rs | 8 +------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa3f543b00..af9cd2516a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -450,7 +450,6 @@ version = "0.0.2" name = "bws" version = "0.2.1" dependencies = [ - "atty", "bat", "bitwarden", "chrono", @@ -463,6 +462,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml 0.9.21", + "supports-color", "tempfile", "thiserror", "tokio", @@ -1559,6 +1559,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "is_ci" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" + [[package]] name = "itertools" version = "0.10.5" @@ -2862,6 +2868,16 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "supports-color" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4950e7174bffabe99455511c39707310e7e9b440364a2fcb1cc21521be57b354" +dependencies = [ + "is-terminal", + "is_ci", +] + [[package]] name = "syn" version = "1.0.109" diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml index d84f8b2ff2..fd637fb464 100644 --- a/crates/bws/Cargo.toml +++ b/crates/bws/Cargo.toml @@ -20,7 +20,7 @@ tokio = { version = "1.28.2", features = ["rt-multi-thread", "macros"] } log = "0.4.18" bitwarden = { path = "../bitwarden", version = "0.2.1" } env_logger = "0.10.0" -atty = "0.2" +supports-color = "2.0.0" thiserror = "1.0.40" serde = "^1.0.163" serde_json = "^1.0.96" diff --git a/crates/bws/src/render.rs b/crates/bws/src/render.rs index 671fe8b1c2..4fdb78b6c9 100644 --- a/crates/bws/src/render.rs +++ b/crates/bws/src/render.rs @@ -27,13 +27,7 @@ impl Color { match self { Color::No => false, Color::Yes => true, - Color::Auto => { - if std::env::var("NO_COLOR").is_ok() { - false - } else { - atty::is(atty::Stream::Stdout) - } - } + Color::Auto => supports_color::on(supports_color::Stream::Stdout).is_some(), } } } From 4d03abdb587eec0d5c7223630336e6f95fb363fb Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Sat, 24 Jun 2023 10:45:27 -0400 Subject: [PATCH 02/32] SM-815: Switch Command Order (#76) * SM-815: Switch command order * SM-815: Sort bws/src/main.rs enum variants in alphabetical order --- crates/bws/src/main.rs | 227 ++++++++++++++++++++++++++++++----------- 1 file changed, 165 insertions(+), 62 deletions(-) diff --git a/crates/bws/src/main.rs b/crates/bws/src/main.rs index 3fffce0020..4df9503bfc 100644 --- a/crates/bws/src/main.rs +++ b/crates/bws/src/main.rs @@ -62,39 +62,100 @@ struct Cli { #[derive(Subcommand, Debug)] enum Commands { - #[command(long_about = "List items")] - List { + #[command(long_about = "Configure the CLI", arg_required_else_help(true))] + Config { + name: Option, + value: Option, + + #[arg(short = 'd', long)] + delete: bool, + }, + #[command(long_about = "Commands available on Projects")] + Project { #[command(subcommand)] - cmd: ListCommand, + cmd: ProjectCommand, }, - #[command(long_about = "Retrieve a single item")] - Get { + #[command(long_about = "Commands available on Secrets")] + Secret { #[command(subcommand)] - cmd: GetCommand, + cmd: SecretCommand, }, - #[command(long_about = "Create a single item")] + #[command(long_about = "Create a single item (deprecated)", hide(true))] Create { #[command(subcommand)] cmd: CreateCommand, }, - #[command(long_about = "Edit a single item")] + #[command(long_about = "Delete one or more items (deprecated)", hide(true))] + Delete { + #[command(subcommand)] + cmd: DeleteCommand, + }, + #[command(long_about = "Edit a single item (deprecated)", hide(true))] Edit { #[command(subcommand)] cmd: EditCommand, }, - #[command(long_about = "Delete one or more items")] - Delete { + #[command(long_about = "Retrieve a single item (deprecated)", hide(true))] + Get { #[command(subcommand)] - cmd: DeleteCommand, + cmd: GetCommand, }, - #[command(long_about = "Configure the CLI", arg_required_else_help(true))] - Config { - name: Option, + #[command(long_about = "List items (deprecated)", hide(true))] + List { + #[command(subcommand)] + cmd: ListCommand, + }, +} + +#[derive(Subcommand, Debug)] +enum SecretCommand { + Create { + key: String, + value: String, + + #[arg(long, help = "An optional note to add to the secret")] + note: Option, + + #[arg(long, help = "The ID of the project this secret will be added to")] + project_id: Option, + }, + Delete { + secret_ids: Vec, + }, + Edit { + secret_id: Uuid, + #[arg(long, group = "edit_field")] + key: Option, + #[arg(long, group = "edit_field")] value: Option, + #[arg(long, group = "edit_field")] + note: Option, + }, + Get { + secret_id: Uuid, + }, + List { + project_id: Option, + }, +} - #[arg(short = 'd', long)] - delete: bool, +#[derive(Subcommand, Debug)] +enum ProjectCommand { + Create { + name: String, + }, + Delete { + project_ids: Vec, + }, + Edit { + project_id: Uuid, + #[arg(long, group = "edit_field")] + name: String, + }, + Get { + project_id: Uuid, }, + List, } #[derive(Subcommand, Debug)] @@ -111,6 +172,9 @@ enum GetCommand { #[derive(Subcommand, Debug)] enum CreateCommand { + Project { + name: String, + }, Secret { key: String, value: String, @@ -121,13 +185,16 @@ enum CreateCommand { #[arg(long, help = "The ID of the project this secret will be added to")] project_id: Option, }, - Project { - name: String, - }, } #[derive(Subcommand, Debug)] enum EditCommand { + #[clap(group = ArgGroup::new("edit_field").required(true).multiple(true))] + Project { + project_id: Uuid, + #[arg(long, group = "edit_field")] + name: String, + }, #[clap(group = ArgGroup::new("edit_field").required(true).multiple(true))] Secret { secret_id: Uuid, @@ -138,18 +205,12 @@ enum EditCommand { #[arg(long, group = "edit_field")] note: Option, }, - #[clap(group = ArgGroup::new("edit_field").required(true).multiple(true))] - Project { - project_id: Uuid, - #[arg(long, group = "edit_field")] - name: String, - }, } #[derive(Subcommand, Debug)] enum DeleteCommand { - Secret { secret_ids: Vec }, Project { project_ids: Vec }, + Secret { secret_ids: Vec }, } #[tokio::main(flavor = "current_thread")] @@ -258,7 +319,10 @@ async fn process_commands() -> Result<()> { // And finally we process all the commands which require authentication match command { - Commands::List { + Commands::Project { + cmd: ProjectCommand::List, + } + | Commands::List { cmd: ListCommand::Projects, } => { let projects = client @@ -271,35 +335,10 @@ async fn process_commands() -> Result<()> { serialize_response(projects, cli.output, color); } - Commands::List { - cmd: ListCommand::Secrets { project_id }, - } => { - let res = if let Some(project_id) = project_id { - client - .secrets() - .list_by_project(&SecretIdentifiersByProjectRequest { - project_id: project_id, - }) - .await? - } else { - client - .secrets() - .list(&SecretIdentifiersRequest { - organization_id: organization_id.clone(), - }) - .await? - }; - - let mut secrets = Vec::new(); - - for s in res.data { - let secret = client.secrets().get(&SecretGetRequest { id: s.id }).await?; - secrets.push(secret); - } - serialize_response(secrets, cli.output, color); + Commands::Project { + cmd: ProjectCommand::Get { project_id }, } - - Commands::Get { + | Commands::Get { cmd: GetCommand::Project { project_id }, } => { let project = client @@ -309,7 +348,10 @@ async fn process_commands() -> Result<()> { serialize_response(project, cli.output, color); } - Commands::Create { + Commands::Project { + cmd: ProjectCommand::Create { name }, + } + | Commands::Create { cmd: CreateCommand::Project { name }, } => { let project = client @@ -322,7 +364,10 @@ async fn process_commands() -> Result<()> { serialize_response(project, cli.output, color); } - Commands::Edit { + Commands::Project { + cmd: ProjectCommand::Edit { project_id, name }, + } + | Commands::Edit { cmd: EditCommand::Project { project_id, name }, } => { let project = client @@ -336,7 +381,10 @@ async fn process_commands() -> Result<()> { serialize_response(project, cli.output, color); } - Commands::Delete { + Commands::Project { + cmd: ProjectCommand::Delete { project_ids }, + } + | Commands::Delete { cmd: DeleteCommand::Project { project_ids }, } => { let project_count = project_ids.len(); @@ -353,7 +401,41 @@ async fn process_commands() -> Result<()> { } } - Commands::Get { + Commands::Secret { + cmd: SecretCommand::List { project_id }, + } + | Commands::List { + cmd: ListCommand::Secrets { project_id }, + } => { + let res = if let Some(project_id) = project_id { + client + .secrets() + .list_by_project(&SecretIdentifiersByProjectRequest { + project_id: project_id, + }) + .await? + } else { + client + .secrets() + .list(&SecretIdentifiersRequest { + organization_id: organization_id.clone(), + }) + .await? + }; + + let mut secrets = Vec::new(); + + for s in res.data { + let secret = client.secrets().get(&SecretGetRequest { id: s.id }).await?; + secrets.push(secret); + } + serialize_response(secrets, cli.output, color); + } + + Commands::Secret { + cmd: SecretCommand::Get { secret_id }, + } + | Commands::Get { cmd: GetCommand::Secret { secret_id }, } => { let secret = client @@ -363,7 +445,16 @@ async fn process_commands() -> Result<()> { serialize_response(secret, cli.output, color); } - Commands::Create { + Commands::Secret { + cmd: + SecretCommand::Create { + key, + value, + note, + project_id, + }, + } + | Commands::Create { cmd: CreateCommand::Secret { key, @@ -385,7 +476,16 @@ async fn process_commands() -> Result<()> { serialize_response(secret, cli.output, color); } - Commands::Edit { + Commands::Secret { + cmd: + SecretCommand::Edit { + secret_id, + key, + value, + note, + }, + } + | Commands::Edit { cmd: EditCommand::Secret { secret_id, @@ -414,7 +514,10 @@ async fn process_commands() -> Result<()> { serialize_response(secret, cli.output, color); } - Commands::Delete { + Commands::Secret { + cmd: SecretCommand::Delete { secret_ids }, + } + | Commands::Delete { cmd: DeleteCommand::Secret { secret_ids }, } => { client From 237d51783d5e1d9d124cab8a2f2274ff85862163 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 27 Jun 2023 03:57:31 +0200 Subject: [PATCH 03/32] Restructure folder structure (#68) --- crates/bitwarden-api-api/src/apis/mod.rs | 3 +- crates/bitwarden-api-identity/src/apis/mod.rs | 3 +- crates/bitwarden-c/src/c.rs | 3 +- crates/bitwarden-json/src/client.rs | 8 +- .../request => bitwarden-json/src}/command.rs | 19 +- crates/bitwarden-json/src/lib.rs | 1 + .../src-ts/bitwarden_client/index.ts | 3 +- .../src-ts/bitwarden_client/schemas.ts | 211 +----------- crates/bitwarden-wasm/src/client.rs | 2 +- crates/bitwarden/README.md | 12 +- crates/bitwarden/src/{ => auth}/api/mod.rs | 0 .../api/request/access_token_request.rs | 2 +- .../api/request/api_token_request.rs | 2 +- .../src/{ => auth}/api/request/mod.rs | 2 +- .../api/request/password_token_request.rs | 2 +- .../api/request/renew_token_request.rs | 2 +- .../api/response/identity_captcha_response.rs | 0 .../api/response/identity_payload_response.rs | 0 .../api/response/identity_refresh_response.rs | 0 .../api/response/identity_success_response.rs | 0 .../response/identity_token_fail_response.rs | 0 .../api/response/identity_token_response.rs | 2 +- .../response/identity_two_factor_response.rs | 2 +- .../src/{ => auth}/api/response/mod.rs | 0 .../two_factor_provider_data/authenticator.rs | 0 .../response/two_factor_provider_data/duo.rs | 0 .../two_factor_provider_data/email.rs | 0 .../response/two_factor_provider_data/mod.rs | 0 .../organization_duo.rs | 0 .../two_factor_provider_data/remember.rs | 0 .../two_factor_provider_data/web_authn.rs | 0 .../two_factor_provider_data/yubi_key.rs | 0 .../api/response/two_factor_providers.rs | 2 +- .../src/{ => auth}/commands/login.rs | 22 +- crates/bitwarden/src/auth/commands/mod.rs | 3 + crates/bitwarden/src/auth/mod.rs | 4 + .../auth/request/api_key_login_request.rs | 0 .../src/{sdk => }/auth/request/mod.rs | 0 .../auth/request/password_login_request.rs | 0 .../auth/response/api_key_login_response.rs | 12 +- .../response/captcha_response.rs | 4 +- .../src/{sdk => }/auth/response/mod.rs | 1 + .../auth/response/password_login_response.rs | 11 +- .../authenticator.rs | 4 +- .../response/two_factor_login_response/duo.rs | 8 +- .../two_factor_login_response/email.rs | 4 +- .../response/two_factor_login_response/mod.rs | 0 .../two_factor_login_response/remember.rs | 4 +- .../two_factor_providers.rs | 6 +- .../two_factor_login_response/web_authn.rs | 4 +- .../two_factor_login_response/yubi_key.rs | 4 +- crates/bitwarden/src/bin/schemas.rs | 26 -- crates/bitwarden/src/client/access_token.rs | 6 +- crates/bitwarden/src/client/auth_settings.rs | 3 +- crates/bitwarden/src/client/client.rs | 49 ++- .../request => client}/client_settings.rs | 2 +- .../src/client/encryption_settings.rs | 1 + crates/bitwarden/src/client/mod.rs | 5 +- .../src/commands/generate_fingerprint.rs | 13 - crates/bitwarden/src/commands/mod.rs | 13 - crates/bitwarden/src/commands/projects.rs | 119 ------- crates/bitwarden/src/commands/secrets.rs | 144 --------- crates/bitwarden/src/commands/sync.rs | 27 -- crates/bitwarden/src/crypto.rs | 3 +- crates/bitwarden/src/error.rs | 7 +- crates/bitwarden/src/lib.rs | 20 +- .../generate_fingerprint.rs} | 10 + .../get_user_api_key.rs | 27 +- crates/bitwarden/src/platform/mod.rs | 12 + .../secret_verification_request.rs | 0 .../sync_response.rs => platform/sync.rs} | 30 +- crates/bitwarden/src/sdk/auth/mod.rs | 2 - crates/bitwarden/src/sdk/mod.rs | 3 - crates/bitwarden/src/sdk/request/mod.rs | 7 - .../src/sdk/request/projects_request.rs | 44 --- .../src/sdk/request/secrets_request.rs | 58 ---- .../bitwarden/src/sdk/request/sync_request.rs | 9 - crates/bitwarden/src/sdk/response/mod.rs | 5 - .../src/sdk/response/projects_response.rs | 109 ------- .../src/sdk/response/secrets_response.rs | 149 --------- .../src/sdk/response/user_api_key_response.rs | 21 -- .../client_projects.rs | 18 +- .../client_secrets.rs | 24 +- crates/bitwarden/src/secrets_manager/mod.rs | 5 + .../src/secrets_manager/projects/create.rs | 50 +++ .../src/secrets_manager/projects/delete.rs | 69 ++++ .../src/secrets_manager/projects/get.rs | 32 ++ .../src/secrets_manager/projects/list.rs | 58 ++++ .../src/secrets_manager/projects/mod.rs | 18 ++ .../projects/project_response.rs | 45 +++ .../src/secrets_manager/projects/update.rs | 49 +++ .../src/secrets_manager/secrets/create.rs | 58 ++++ .../src/secrets_manager/secrets/delete.rs | 69 ++++ .../src/secrets_manager/secrets/get.rs | 31 ++ .../src/secrets_manager/secrets/list.rs | 114 +++++++ .../src/secrets_manager/secrets/mod.rs | 20 ++ .../secrets/secret_response.rs | 56 ++++ .../src/secrets_manager/secrets/update.rs | 53 ++++ crates/bitwarden/src/util.rs | 4 +- crates/bws/src/main.rs | 30 +- crates/bws/src/render.rs | 4 +- crates/sdk-schemas/src/main.rs | 48 ++- languages/csharp/schemas.cs | 197 +----------- .../bitwarden_client/schemas.ts | 211 +----------- languages/python/BitwardenClient/schemas.py | 300 +----------------- .../client}/ClientSettings.json | 2 +- .../{request => bitwarden_json}/Command.json | 0 .../response/SecretDeleteResponse.json | 54 ---- .../response/SecretIdentifierResponse.json | 57 ---- support/schemas/response/SyncResponse.json | 105 ------ .../schemas/response/UserApiKeyResponse.json | 48 --- 111 files changed, 1018 insertions(+), 2107 deletions(-) rename crates/{bitwarden/src/sdk/request => bitwarden-json/src}/command.rs (94%) rename crates/bitwarden/src/{ => auth}/api/mod.rs (100%) rename crates/bitwarden/src/{ => auth}/api/request/access_token_request.rs (89%) rename crates/bitwarden/src/{ => auth}/api/request/api_token_request.rs (92%) rename crates/bitwarden/src/{ => auth}/api/request/mod.rs (95%) rename crates/bitwarden/src/{ => auth}/api/request/password_token_request.rs (93%) rename crates/bitwarden/src/{ => auth}/api/request/renew_token_request.rs (86%) rename crates/bitwarden/src/{ => auth}/api/response/identity_captcha_response.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/identity_payload_response.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/identity_refresh_response.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/identity_success_response.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/identity_token_fail_response.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/identity_token_response.rs (98%) rename crates/bitwarden/src/{ => auth}/api/response/identity_two_factor_response.rs (93%) rename crates/bitwarden/src/{ => auth}/api/response/mod.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/authenticator.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/duo.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/email.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/mod.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/organization_duo.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/remember.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/web_authn.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_provider_data/yubi_key.rs (100%) rename crates/bitwarden/src/{ => auth}/api/response/two_factor_providers.rs (95%) rename crates/bitwarden/src/{ => auth}/commands/login.rs (96%) create mode 100644 crates/bitwarden/src/auth/commands/mod.rs create mode 100644 crates/bitwarden/src/auth/mod.rs rename crates/bitwarden/src/{sdk => }/auth/request/api_key_login_request.rs (100%) rename crates/bitwarden/src/{sdk => }/auth/request/mod.rs (100%) rename crates/bitwarden/src/{sdk => }/auth/request/password_login_request.rs (100%) rename crates/bitwarden/src/{sdk => }/auth/response/api_key_login_response.rs (83%) rename crates/bitwarden/src/{sdk => auth}/response/captcha_response.rs (72%) rename crates/bitwarden/src/{sdk => }/auth/response/mod.rs (88%) rename crates/bitwarden/src/{sdk => }/auth/response/password_login_response.rs (93%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/authenticator.rs (59%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/duo.rs (56%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/email.rs (62%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/mod.rs (100%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/remember.rs (52%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/two_factor_providers.rs (85%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/web_authn.rs (52%) rename crates/bitwarden/src/{sdk => }/auth/response/two_factor_login_response/yubi_key.rs (62%) delete mode 100644 crates/bitwarden/src/bin/schemas.rs rename crates/bitwarden/src/{sdk/request => client}/client_settings.rs (96%) delete mode 100644 crates/bitwarden/src/commands/generate_fingerprint.rs delete mode 100644 crates/bitwarden/src/commands/mod.rs delete mode 100644 crates/bitwarden/src/commands/projects.rs delete mode 100644 crates/bitwarden/src/commands/secrets.rs delete mode 100644 crates/bitwarden/src/commands/sync.rs rename crates/bitwarden/src/{sdk/request/fingerprint_request.rs => platform/generate_fingerprint.rs} (55%) rename crates/bitwarden/src/{commands => platform}/get_user_api_key.rs (65%) create mode 100644 crates/bitwarden/src/platform/mod.rs rename crates/bitwarden/src/{sdk/request => platform}/secret_verification_request.rs (100%) rename crates/bitwarden/src/{sdk/response/sync_response.rs => platform/sync.rs} (75%) delete mode 100644 crates/bitwarden/src/sdk/auth/mod.rs delete mode 100644 crates/bitwarden/src/sdk/mod.rs delete mode 100644 crates/bitwarden/src/sdk/request/mod.rs delete mode 100644 crates/bitwarden/src/sdk/request/projects_request.rs delete mode 100644 crates/bitwarden/src/sdk/request/secrets_request.rs delete mode 100644 crates/bitwarden/src/sdk/request/sync_request.rs delete mode 100644 crates/bitwarden/src/sdk/response/mod.rs delete mode 100644 crates/bitwarden/src/sdk/response/projects_response.rs delete mode 100644 crates/bitwarden/src/sdk/response/secrets_response.rs delete mode 100644 crates/bitwarden/src/sdk/response/user_api_key_response.rs rename crates/bitwarden/src/{client => secrets_manager}/client_projects.rs (67%) rename crates/bitwarden/src/{client => secrets_manager}/client_secrets.rs (74%) create mode 100644 crates/bitwarden/src/secrets_manager/mod.rs create mode 100644 crates/bitwarden/src/secrets_manager/projects/create.rs create mode 100644 crates/bitwarden/src/secrets_manager/projects/delete.rs create mode 100644 crates/bitwarden/src/secrets_manager/projects/get.rs create mode 100644 crates/bitwarden/src/secrets_manager/projects/list.rs create mode 100644 crates/bitwarden/src/secrets_manager/projects/mod.rs create mode 100644 crates/bitwarden/src/secrets_manager/projects/project_response.rs create mode 100644 crates/bitwarden/src/secrets_manager/projects/update.rs create mode 100644 crates/bitwarden/src/secrets_manager/secrets/create.rs create mode 100644 crates/bitwarden/src/secrets_manager/secrets/delete.rs create mode 100644 crates/bitwarden/src/secrets_manager/secrets/get.rs create mode 100644 crates/bitwarden/src/secrets_manager/secrets/list.rs create mode 100644 crates/bitwarden/src/secrets_manager/secrets/mod.rs create mode 100644 crates/bitwarden/src/secrets_manager/secrets/secret_response.rs create mode 100644 crates/bitwarden/src/secrets_manager/secrets/update.rs rename support/schemas/{request => bitwarden/client}/ClientSettings.json (77%) rename support/schemas/{request => bitwarden_json}/Command.json (100%) delete mode 100644 support/schemas/response/SecretDeleteResponse.json delete mode 100644 support/schemas/response/SecretIdentifierResponse.json delete mode 100644 support/schemas/response/SyncResponse.json delete mode 100644 support/schemas/response/UserApiKeyResponse.json diff --git a/crates/bitwarden-api-api/src/apis/mod.rs b/crates/bitwarden-api-api/src/apis/mod.rs index a0bd115e74..be296aa0e7 100644 --- a/crates/bitwarden-api-api/src/apis/mod.rs +++ b/crates/bitwarden-api-api/src/apis/mod.rs @@ -1,5 +1,4 @@ -use std::error; -use std::fmt; +use std::{error, fmt}; #[derive(Debug, Clone)] pub struct ResponseContent { diff --git a/crates/bitwarden-api-identity/src/apis/mod.rs b/crates/bitwarden-api-identity/src/apis/mod.rs index 6144c7645c..f50e7d44a6 100644 --- a/crates/bitwarden-api-identity/src/apis/mod.rs +++ b/crates/bitwarden-api-identity/src/apis/mod.rs @@ -1,5 +1,4 @@ -use std::error; -use std::fmt; +use std::{error, fmt}; #[derive(Debug, Clone)] pub struct ResponseContent { diff --git a/crates/bitwarden-c/src/c.rs b/crates/bitwarden-c/src/c.rs index cf6e248626..0f7c2855df 100644 --- a/crates/bitwarden-c/src/c.rs +++ b/crates/bitwarden-c/src/c.rs @@ -1,8 +1,9 @@ use std::{ffi::CStr, os::raw::c_char, str}; -use crate::{box_ptr, ffi_ref}; use bitwarden_json::client::Client; +use crate::{box_ptr, ffi_ref}; + #[no_mangle] #[tokio::main] pub async extern "C" fn run_command( diff --git a/crates/bitwarden-json/src/client.rs b/crates/bitwarden-json/src/client.rs index 7e879dc90b..e6523edae9 100644 --- a/crates/bitwarden-json/src/client.rs +++ b/crates/bitwarden-json/src/client.rs @@ -1,10 +1,10 @@ -use bitwarden::sdk::request::{ - client_settings::ClientSettings, +use bitwarden::client::client_settings::ClientSettings; + +use crate::{ command::{Command, ProjectsCommand, SecretsCommand}, + response::ResponseIntoString, }; -use crate::response::ResponseIntoString; - pub struct Client(bitwarden::Client); impl Client { diff --git a/crates/bitwarden/src/sdk/request/command.rs b/crates/bitwarden-json/src/command.rs similarity index 94% rename from crates/bitwarden/src/sdk/request/command.rs rename to crates/bitwarden-json/src/command.rs index 0388dd2af1..d61afec723 100644 --- a/crates/bitwarden/src/sdk/request/command.rs +++ b/crates/bitwarden-json/src/command.rs @@ -1,25 +1,24 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -#[allow(unused_imports)] -use crate::sdk::{ - auth::request::{AccessTokenLoginRequest, ApiKeyLoginRequest, PasswordLoginRequest}, - request::{ - projects_request::{ +use bitwarden::{ + auth::request::AccessTokenLoginRequest, + secrets_manager::{ + projects::{ ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, ProjectsListRequest, }, - secret_verification_request::SecretVerificationRequest, - secrets_request::{ + secrets::{ SecretCreateRequest, SecretGetRequest, SecretIdentifiersRequest, SecretPutRequest, SecretsDeleteRequest, }, - sync_request::SyncRequest, }, }; - #[cfg(feature = "internal")] -use super::fingerprint_request::FingerprintRequest; +use bitwarden::{ + auth::request::{ApiKeyLoginRequest, PasswordLoginRequest}, + platform::{FingerprintRequest, SecretVerificationRequest, SyncRequest}, +}; #[derive(Serialize, Deserialize, JsonSchema, Debug)] #[serde(rename_all = "camelCase", deny_unknown_fields)] diff --git a/crates/bitwarden-json/src/lib.rs b/crates/bitwarden-json/src/lib.rs index 99ab87564a..832fa31682 100644 --- a/crates/bitwarden-json/src/lib.rs +++ b/crates/bitwarden-json/src/lib.rs @@ -1,2 +1,3 @@ pub mod client; +pub mod command; pub mod response; diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts index 7de32ef7a8..06a3b827aa 100644 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts +++ b/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts @@ -8,7 +8,6 @@ import { ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse, - ResponseForSyncResponse, } from "./schemas"; export class BitwardenClient { @@ -43,6 +42,7 @@ export class BitwardenClient { return Convert.toResponseForAPIKeyLoginResponse(response); } + /* async sync(excludeSubdomains = false): Promise { const response = await this.client.runCommand( Convert.commandToJson({ @@ -54,6 +54,7 @@ export class BitwardenClient { return Convert.toResponseForSyncResponse(response); } + */ secrets(): SecretsClient { return new SecretsClient(this.client); diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts index c1322bdfc1..809bd3f321 100644 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts +++ b/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts @@ -1,18 +1,14 @@ // To parse this data: // -// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretDeleteResponse, ResponseForSecretIdentifierResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse, ResponseForSyncResponse, ResponseForUserAPIKeyResponse } from "./file"; +// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse } from "./file"; // // const clientSettings = Convert.toClientSettings(json); // const command = Convert.toCommand(json); // const responseForAPIKeyLoginResponse = Convert.toResponseForAPIKeyLoginResponse(json); // const responseForPasswordLoginResponse = Convert.toResponseForPasswordLoginResponse(json); -// const responseForSecretDeleteResponse = Convert.toResponseForSecretDeleteResponse(json); -// const responseForSecretIdentifierResponse = Convert.toResponseForSecretIdentifierResponse(json); // const responseForSecretIdentifiersResponse = Convert.toResponseForSecretIdentifiersResponse(json); // const responseForSecretResponse = Convert.toResponseForSecretResponse(json); // const responseForSecretsDeleteResponse = Convert.toResponseForSecretsDeleteResponse(json); -// const responseForSyncResponse = Convert.toResponseForSyncResponse(json); -// const responseForUserAPIKeyResponse = Convert.toResponseForUserAPIKeyResponse(json); // // These functions will throw an error if the JSON doesn't // match the expected interface, even if the JSON is valid. @@ -24,7 +20,7 @@ * * Defaults to * - * ``` # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; # use + * ``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; # use * assert_matches::assert_matches; 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(), @@ -549,47 +545,6 @@ export interface FluffyYubiKey { nfc: boolean; } -export interface ResponseForSecretDeleteResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretDeleteResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretDeleteResponse { - error?: null | string; - id: string; -} - -export interface ResponseForSecretIdentifierResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretIdentifierResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretIdentifierResponse { - id: string; - key: string; - organizationId: string; -} - export interface ResponseForSecretIdentifiersResponse { /** * The response data. Populated if `success` is true. @@ -606,10 +561,10 @@ export interface ResponseForSecretIdentifiersResponse { } export interface SecretIdentifiersResponse { - data: DatumElement[]; + data: SecretIdentifierResponse[]; } -export interface DatumElement { +export interface SecretIdentifierResponse { id: string; key: string; organizationId: string; @@ -658,81 +613,14 @@ export interface ResponseForSecretsDeleteResponse { } export interface SecretsDeleteResponse { - data: DatumClass[]; + data: SecretDeleteResponse[]; } -export interface DatumClass { +export interface SecretDeleteResponse { error?: null | string; id: string; } -export interface ResponseForSyncResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SyncResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SyncResponse { - /** - * List of ciphers accesible by the user - */ - ciphers: CipherDetailsResponse[]; - /** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ - profile: ProfileResponse; -} - -export interface CipherDetailsResponse { -} - -/** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ -export interface ProfileResponse { - email: string; - id: string; - name: string; - organizations: ProfileOrganizationResponse[]; -} - -export interface ProfileOrganizationResponse { - id: string; -} - -export interface ResponseForUserAPIKeyResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: UserAPIKeyResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface UserAPIKeyResponse { - /** - * The user's API key, which represents the client_secret portion of an oauth request. - */ - apiKey: string; -} - // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { @@ -768,22 +656,6 @@ export class Convert { return JSON.stringify(uncast(value, r("ResponseForPasswordLoginResponse")), null, 2); } - public static toResponseForSecretDeleteResponse(json: string): ResponseForSecretDeleteResponse { - return cast(JSON.parse(json), r("ResponseForSecretDeleteResponse")); - } - - public static responseForSecretDeleteResponseToJson(value: ResponseForSecretDeleteResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretDeleteResponse")), null, 2); - } - - public static toResponseForSecretIdentifierResponse(json: string): ResponseForSecretIdentifierResponse { - return cast(JSON.parse(json), r("ResponseForSecretIdentifierResponse")); - } - - public static responseForSecretIdentifierResponseToJson(value: ResponseForSecretIdentifierResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretIdentifierResponse")), null, 2); - } - public static toResponseForSecretIdentifiersResponse(json: string): ResponseForSecretIdentifiersResponse { return cast(JSON.parse(json), r("ResponseForSecretIdentifiersResponse")); } @@ -807,22 +679,6 @@ export class Convert { public static responseForSecretsDeleteResponseToJson(value: ResponseForSecretsDeleteResponse): string { return JSON.stringify(uncast(value, r("ResponseForSecretsDeleteResponse")), null, 2); } - - public static toResponseForSyncResponse(json: string): ResponseForSyncResponse { - return cast(JSON.parse(json), r("ResponseForSyncResponse")); - } - - public static responseForSyncResponseToJson(value: ResponseForSyncResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSyncResponse")), null, 2); - } - - public static toResponseForUserAPIKeyResponse(json: string): ResponseForUserAPIKeyResponse { - return cast(JSON.parse(json), r("ResponseForUserAPIKeyResponse")); - } - - public static responseForUserAPIKeyResponseToJson(value: ResponseForUserAPIKeyResponse): string { - return JSON.stringify(uncast(value, r("ResponseForUserAPIKeyResponse")), null, 2); - } } function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { @@ -1148,34 +1004,15 @@ const typeMap: any = { "FluffyYubiKey": o([ { json: "nfc", js: "nfc", typ: true }, ], false), - "ResponseForSecretDeleteResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretDeleteResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretDeleteResponse": o([ - { json: "error", js: "error", typ: u(undefined, u(null, "")) }, - { json: "id", js: "id", typ: "" }, - ], false), - "ResponseForSecretIdentifierResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretIdentifierResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretIdentifierResponse": o([ - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), "ResponseForSecretIdentifiersResponse": o([ { json: "data", js: "data", typ: u(undefined, u(r("SecretIdentifiersResponse"), null)) }, { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, { json: "success", js: "success", typ: true }, ], false), "SecretIdentifiersResponse": o([ - { json: "data", js: "data", typ: a(r("DatumElement")) }, + { json: "data", js: "data", typ: a(r("SecretIdentifierResponse")) }, ], false), - "DatumElement": o([ + "SecretIdentifierResponse": o([ { json: "id", js: "id", typ: "" }, { json: "key", js: "key", typ: "" }, { json: "organizationId", js: "organizationId", typ: "" }, @@ -1202,40 +1039,12 @@ const typeMap: any = { { json: "success", js: "success", typ: true }, ], false), "SecretsDeleteResponse": o([ - { json: "data", js: "data", typ: a(r("DatumClass")) }, + { json: "data", js: "data", typ: a(r("SecretDeleteResponse")) }, ], false), - "DatumClass": o([ + "SecretDeleteResponse": o([ { json: "error", js: "error", typ: u(undefined, u(null, "")) }, { json: "id", js: "id", typ: "" }, ], false), - "ResponseForSyncResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SyncResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SyncResponse": o([ - { json: "ciphers", js: "ciphers", typ: a(r("CipherDetailsResponse")) }, - { json: "profile", js: "profile", typ: r("ProfileResponse") }, - ], false), - "CipherDetailsResponse": o([ - ], false), - "ProfileResponse": o([ - { json: "email", js: "email", typ: "" }, - { json: "id", js: "id", typ: "" }, - { json: "name", js: "name", typ: "" }, - { json: "organizations", js: "organizations", typ: a(r("ProfileOrganizationResponse")) }, - ], false), - "ProfileOrganizationResponse": o([ - { json: "id", js: "id", typ: "" }, - ], false), - "ResponseForUserAPIKeyResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("UserAPIKeyResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "UserAPIKeyResponse": o([ - { json: "apiKey", js: "apiKey", typ: "" }, - ], false), "DeviceType": [ "Android", "AndroidAmazon", diff --git a/crates/bitwarden-wasm/src/client.rs b/crates/bitwarden-wasm/src/client.rs index 2a70a0a461..366dbe7b50 100644 --- a/crates/bitwarden-wasm/src/client.rs +++ b/crates/bitwarden-wasm/src/client.rs @@ -1,9 +1,9 @@ extern crate console_error_panic_hook; -use log::Level; use std::{rc::Rc, sync::RwLock}; use bitwarden_json::client::Client as JsonClient; use js_sys::Promise; +use log::Level; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::future_to_promise; diff --git a/crates/bitwarden/README.md b/crates/bitwarden/README.md index 9bef3cb0ba..e2e338fe4c 100644 --- a/crates/bitwarden/README.md +++ b/crates/bitwarden/README.md @@ -18,15 +18,11 @@ Rust **1.57** or higher. ```rust use bitwarden::{ - Client, + auth::request::AccessTokenLoginRequest, + client::client_settings::{ClientSettings, DeviceType}, error::Result, - sdk::{ - auth::request::AccessTokenLoginRequest, - request::{ - client_settings::{ClientSettings, DeviceType}, - secrets_request::SecretIdentifiersRequest - }, - }, + secrets_manager::secrets::SecretIdentifiersRequest, + Client, }; use uuid::Uuid; diff --git a/crates/bitwarden/src/api/mod.rs b/crates/bitwarden/src/auth/api/mod.rs similarity index 100% rename from crates/bitwarden/src/api/mod.rs rename to crates/bitwarden/src/auth/api/mod.rs diff --git a/crates/bitwarden/src/api/request/access_token_request.rs b/crates/bitwarden/src/auth/api/request/access_token_request.rs similarity index 89% rename from crates/bitwarden/src/api/request/access_token_request.rs rename to crates/bitwarden/src/auth/api/request/access_token_request.rs index f2578e4b8a..b5035269b2 100644 --- a/crates/bitwarden/src/api/request/access_token_request.rs +++ b/crates/bitwarden/src/auth/api/request/access_token_request.rs @@ -2,7 +2,7 @@ use log::debug; use serde::{Deserialize, Serialize}; use uuid::Uuid; -use crate::{api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; +use crate::{auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; #[derive(Serialize, Deserialize, Debug)] pub struct AccessTokenRequest { diff --git a/crates/bitwarden/src/api/request/api_token_request.rs b/crates/bitwarden/src/auth/api/request/api_token_request.rs similarity index 92% rename from crates/bitwarden/src/api/request/api_token_request.rs rename to crates/bitwarden/src/auth/api/request/api_token_request.rs index 31bbba3f87..087dc7e966 100644 --- a/crates/bitwarden/src/api/request/api_token_request.rs +++ b/crates/bitwarden/src/auth/api/request/api_token_request.rs @@ -1,7 +1,7 @@ use log::debug; use serde::{Deserialize, Serialize}; -use crate::{api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; +use crate::{auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; #[derive(Serialize, Deserialize, Debug)] pub struct ApiTokenRequest { diff --git a/crates/bitwarden/src/api/request/mod.rs b/crates/bitwarden/src/auth/api/request/mod.rs similarity index 95% rename from crates/bitwarden/src/api/request/mod.rs rename to crates/bitwarden/src/auth/api/request/mod.rs index 6a762968c4..1bec3f90a5 100644 --- a/crates/bitwarden/src/api/request/mod.rs +++ b/crates/bitwarden/src/auth/api/request/mod.rs @@ -10,7 +10,7 @@ pub(crate) use password_token_request::*; pub(crate) use renew_token_request::*; use crate::{ - api::response::{parse_identity_response, IdentityTokenResponse}, + auth::api::response::{parse_identity_response, IdentityTokenResponse}, client::ApiConfigurations, error::Result, util::BASE64_ENGINE, diff --git a/crates/bitwarden/src/api/request/password_token_request.rs b/crates/bitwarden/src/auth/api/request/password_token_request.rs similarity index 93% rename from crates/bitwarden/src/api/request/password_token_request.rs rename to crates/bitwarden/src/auth/api/request/password_token_request.rs index 519ed654da..f3aec7a8d2 100644 --- a/crates/bitwarden/src/api/request/password_token_request.rs +++ b/crates/bitwarden/src/auth/api/request/password_token_request.rs @@ -1,7 +1,7 @@ use log::debug; use serde::{Deserialize, Serialize}; -use crate::{api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; +use crate::{auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; #[derive(Serialize, Deserialize, Debug)] pub struct PasswordTokenRequest { diff --git a/crates/bitwarden/src/api/request/renew_token_request.rs b/crates/bitwarden/src/auth/api/request/renew_token_request.rs similarity index 86% rename from crates/bitwarden/src/api/request/renew_token_request.rs rename to crates/bitwarden/src/auth/api/request/renew_token_request.rs index 21a2761e5c..2f7b1161fe 100644 --- a/crates/bitwarden/src/api/request/renew_token_request.rs +++ b/crates/bitwarden/src/auth/api/request/renew_token_request.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::{api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; +use crate::{auth::api::response::IdentityTokenResponse, client::ApiConfigurations, error::Result}; #[derive(Serialize, Deserialize, Debug)] pub struct RenewTokenRequest { diff --git a/crates/bitwarden/src/api/response/identity_captcha_response.rs b/crates/bitwarden/src/auth/api/response/identity_captcha_response.rs similarity index 100% rename from crates/bitwarden/src/api/response/identity_captcha_response.rs rename to crates/bitwarden/src/auth/api/response/identity_captcha_response.rs diff --git a/crates/bitwarden/src/api/response/identity_payload_response.rs b/crates/bitwarden/src/auth/api/response/identity_payload_response.rs similarity index 100% rename from crates/bitwarden/src/api/response/identity_payload_response.rs rename to crates/bitwarden/src/auth/api/response/identity_payload_response.rs diff --git a/crates/bitwarden/src/api/response/identity_refresh_response.rs b/crates/bitwarden/src/auth/api/response/identity_refresh_response.rs similarity index 100% rename from crates/bitwarden/src/api/response/identity_refresh_response.rs rename to crates/bitwarden/src/auth/api/response/identity_refresh_response.rs diff --git a/crates/bitwarden/src/api/response/identity_success_response.rs b/crates/bitwarden/src/auth/api/response/identity_success_response.rs similarity index 100% rename from crates/bitwarden/src/api/response/identity_success_response.rs rename to crates/bitwarden/src/auth/api/response/identity_success_response.rs diff --git a/crates/bitwarden/src/api/response/identity_token_fail_response.rs b/crates/bitwarden/src/auth/api/response/identity_token_fail_response.rs similarity index 100% rename from crates/bitwarden/src/api/response/identity_token_fail_response.rs rename to crates/bitwarden/src/auth/api/response/identity_token_fail_response.rs diff --git a/crates/bitwarden/src/api/response/identity_token_response.rs b/crates/bitwarden/src/auth/api/response/identity_token_response.rs similarity index 98% rename from crates/bitwarden/src/api/response/identity_token_response.rs rename to crates/bitwarden/src/auth/api/response/identity_token_response.rs index f888684b9a..3ae74dea7a 100644 --- a/crates/bitwarden/src/api/response/identity_token_response.rs +++ b/crates/bitwarden/src/auth/api/response/identity_token_response.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::{ - api::response::{ + auth::api::response::{ IdentityCaptchaResponse, IdentityTokenFailResponse, IdentityTokenPayloadResponse, IdentityTokenRefreshResponse, IdentityTokenSuccessResponse, IdentityTwoFactorResponse, }, diff --git a/crates/bitwarden/src/api/response/identity_two_factor_response.rs b/crates/bitwarden/src/auth/api/response/identity_two_factor_response.rs similarity index 93% rename from crates/bitwarden/src/api/response/identity_two_factor_response.rs rename to crates/bitwarden/src/auth/api/response/identity_two_factor_response.rs index c5f23422e0..f4765cc3d5 100644 --- a/crates/bitwarden/src/api/response/identity_two_factor_response.rs +++ b/crates/bitwarden/src/auth/api/response/identity_two_factor_response.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::Value; -use crate::api::response::two_factor_providers::TwoFactorProviders; +use crate::auth::api::response::two_factor_providers::TwoFactorProviders; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct IdentityTwoFactorResponse { diff --git a/crates/bitwarden/src/api/response/mod.rs b/crates/bitwarden/src/auth/api/response/mod.rs similarity index 100% rename from crates/bitwarden/src/api/response/mod.rs rename to crates/bitwarden/src/auth/api/response/mod.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/authenticator.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/authenticator.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/authenticator.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/authenticator.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/duo.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/duo.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/duo.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/duo.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/email.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/email.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/email.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/email.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/mod.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/mod.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/mod.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/mod.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/organization_duo.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/organization_duo.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/organization_duo.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/organization_duo.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/remember.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/remember.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/remember.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/remember.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/web_authn.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/web_authn.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/web_authn.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/web_authn.rs diff --git a/crates/bitwarden/src/api/response/two_factor_provider_data/yubi_key.rs b/crates/bitwarden/src/auth/api/response/two_factor_provider_data/yubi_key.rs similarity index 100% rename from crates/bitwarden/src/api/response/two_factor_provider_data/yubi_key.rs rename to crates/bitwarden/src/auth/api/response/two_factor_provider_data/yubi_key.rs diff --git a/crates/bitwarden/src/api/response/two_factor_providers.rs b/crates/bitwarden/src/auth/api/response/two_factor_providers.rs similarity index 95% rename from crates/bitwarden/src/api/response/two_factor_providers.rs rename to crates/bitwarden/src/auth/api/response/two_factor_providers.rs index e8a0261377..c6c1accda3 100644 --- a/crates/bitwarden/src/api/response/two_factor_providers.rs +++ b/crates/bitwarden/src/auth/api/response/two_factor_providers.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::Value; -use crate::api::response::two_factor_provider_data::{ +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, }; diff --git a/crates/bitwarden/src/commands/login.rs b/crates/bitwarden/src/auth/commands/login.rs similarity index 96% rename from crates/bitwarden/src/commands/login.rs rename to crates/bitwarden/src/auth/commands/login.rs index 1ce317becc..b9c642b564 100644 --- a/crates/bitwarden/src/commands/login.rs +++ b/crates/bitwarden/src/auth/commands/login.rs @@ -11,9 +11,13 @@ use bitwarden_api_identity::{ use log::{debug, info}; use crate::{ - api::{ - request::{AccessTokenRequest, ApiTokenRequest, PasswordTokenRequest}, - response::IdentityTokenResponse, + auth::{ + api::{ + request::{AccessTokenRequest, ApiTokenRequest, PasswordTokenRequest}, + response::IdentityTokenResponse, + }, + request::{AccessTokenLoginRequest, ApiKeyLoginRequest, PasswordLoginRequest}, + response::{ApiKeyLoginResponse, PasswordLoginResponse}, }, client::{ access_token::AccessToken, @@ -23,14 +27,10 @@ use crate::{ }, crypto::CipherString, error::{Error, Result}, - sdk::auth::{ - request::{AccessTokenLoginRequest, ApiKeyLoginRequest, PasswordLoginRequest}, - response::{ApiKeyLoginResponse, PasswordLoginResponse}, - }, util::{decode_token, BASE64_ENGINE}, }; -#[allow(dead_code)] +#[cfg(feature = "internal")] pub(crate) async fn password_login( client: &mut Client, input: &PasswordLoginRequest, @@ -60,7 +60,7 @@ pub(crate) async fn password_login( PasswordLoginResponse::process_response(response) } -#[allow(dead_code)] +#[cfg(feature = "internal")] pub(crate) async fn api_key_login( client: &mut Client, input: &ApiKeyLoginRequest, @@ -185,7 +185,7 @@ async fn request_identity_tokens( .await } -#[allow(dead_code)] +#[cfg(feature = "internal")] async fn request_api_identity_tokens( client: &mut Client, input: &ApiKeyLoginRequest, @@ -221,7 +221,7 @@ pub(crate) async fn renew_token(client: &mut Client) -> Result<()> { .as_deref() .ok_or(Error::NotAuthenticated)?; - crate::api::request::RenewTokenRequest::new( + crate::auth::api::request::RenewTokenRequest::new( refresh.to_owned(), client_id.to_owned(), ) diff --git a/crates/bitwarden/src/auth/commands/mod.rs b/crates/bitwarden/src/auth/commands/mod.rs new file mode 100644 index 0000000000..dc86ebb7dd --- /dev/null +++ b/crates/bitwarden/src/auth/commands/mod.rs @@ -0,0 +1,3 @@ +mod login; + +pub(crate) use login::*; diff --git a/crates/bitwarden/src/auth/mod.rs b/crates/bitwarden/src/auth/mod.rs new file mode 100644 index 0000000000..c9afd9341c --- /dev/null +++ b/crates/bitwarden/src/auth/mod.rs @@ -0,0 +1,4 @@ +pub(super) mod api; +pub mod commands; +pub mod request; +pub mod response; diff --git a/crates/bitwarden/src/sdk/auth/request/api_key_login_request.rs b/crates/bitwarden/src/auth/request/api_key_login_request.rs similarity index 100% rename from crates/bitwarden/src/sdk/auth/request/api_key_login_request.rs rename to crates/bitwarden/src/auth/request/api_key_login_request.rs diff --git a/crates/bitwarden/src/sdk/auth/request/mod.rs b/crates/bitwarden/src/auth/request/mod.rs similarity index 100% rename from crates/bitwarden/src/sdk/auth/request/mod.rs rename to crates/bitwarden/src/auth/request/mod.rs diff --git a/crates/bitwarden/src/sdk/auth/request/password_login_request.rs b/crates/bitwarden/src/auth/request/password_login_request.rs similarity index 100% rename from crates/bitwarden/src/sdk/auth/request/password_login_request.rs rename to crates/bitwarden/src/auth/request/password_login_request.rs diff --git a/crates/bitwarden/src/sdk/auth/response/api_key_login_response.rs b/crates/bitwarden/src/auth/response/api_key_login_response.rs similarity index 83% rename from crates/bitwarden/src/sdk/auth/response/api_key_login_response.rs rename to crates/bitwarden/src/auth/response/api_key_login_response.rs index 6d20ff695c..2cc143d01f 100644 --- a/crates/bitwarden/src/sdk/auth/response/api_key_login_response.rs +++ b/crates/bitwarden/src/auth/response/api_key_login_response.rs @@ -2,12 +2,14 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{ - api::response::IdentityTokenResponse, - error::Result, - sdk::auth::response::{ - password_login_response::PasswordLoginResponse, - two_factor_login_response::TwoFactorProviders, + auth::{ + api::response::IdentityTokenResponse, + response::{ + password_login_response::PasswordLoginResponse, + two_factor_login_response::TwoFactorProviders, + }, }, + error::Result, }; #[derive(Serialize, Deserialize, Debug, JsonSchema)] diff --git a/crates/bitwarden/src/sdk/response/captcha_response.rs b/crates/bitwarden/src/auth/response/captcha_response.rs similarity index 72% rename from crates/bitwarden/src/sdk/response/captcha_response.rs rename to crates/bitwarden/src/auth/response/captcha_response.rs index 87e54bdec3..fcd10994a4 100644 --- a/crates/bitwarden/src/sdk/response/captcha_response.rs +++ b/crates/bitwarden/src/auth/response/captcha_response.rs @@ -8,8 +8,8 @@ pub struct CaptchaResponse { pub site_key: String, } -impl From for CaptchaResponse { - fn from(api: crate::api::response::IdentityCaptchaResponse) -> Self { +impl From for CaptchaResponse { + fn from(api: crate::auth::api::response::IdentityCaptchaResponse) -> Self { Self { site_key: api.site_key, } diff --git a/crates/bitwarden/src/sdk/auth/response/mod.rs b/crates/bitwarden/src/auth/response/mod.rs similarity index 88% rename from crates/bitwarden/src/sdk/auth/response/mod.rs rename to crates/bitwarden/src/auth/response/mod.rs index 02d87a280c..2d8e461f51 100644 --- a/crates/bitwarden/src/sdk/auth/response/mod.rs +++ b/crates/bitwarden/src/auth/response/mod.rs @@ -1,4 +1,5 @@ mod api_key_login_response; +mod captcha_response; mod password_login_response; pub mod two_factor_login_response; diff --git a/crates/bitwarden/src/sdk/auth/response/password_login_response.rs b/crates/bitwarden/src/auth/response/password_login_response.rs similarity index 93% rename from crates/bitwarden/src/sdk/auth/response/password_login_response.rs rename to crates/bitwarden/src/auth/response/password_login_response.rs index 26f6956b45..9c5665f9af 100644 --- a/crates/bitwarden/src/sdk/auth/response/password_login_response.rs +++ b/crates/bitwarden/src/auth/response/password_login_response.rs @@ -2,12 +2,13 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{ - api::response::IdentityTokenResponse, - error::Result, - sdk::{ - auth::response::two_factor_login_response::TwoFactorProviders, - response::captcha_response::CaptchaResponse, + auth::{ + api::response::IdentityTokenResponse, + response::{ + captcha_response::CaptchaResponse, two_factor_login_response::TwoFactorProviders, + }, }, + error::Result, }; #[derive(Serialize, Deserialize, Debug, JsonSchema)] diff --git a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/authenticator.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/authenticator.rs similarity index 59% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/authenticator.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/authenticator.rs index 91d7e05f2c..609bd4d34a 100644 --- a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/authenticator.rs +++ b/crates/bitwarden/src/auth/response/two_factor_login_response/authenticator.rs @@ -5,11 +5,11 @@ use serde::{Deserialize, Serialize}; #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct Authenticator {} -impl From +impl From for Authenticator { fn from( - _: crate::api::response::two_factor_provider_data::authenticator::Authenticator, + _: crate::auth::api::response::two_factor_provider_data::authenticator::Authenticator, ) -> Self { Self {} } diff --git a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/duo.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/duo.rs similarity index 56% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/duo.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/duo.rs index 06b4155365..719f8a9efd 100644 --- a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/duo.rs +++ b/crates/bitwarden/src/auth/response/two_factor_login_response/duo.rs @@ -8,8 +8,8 @@ pub struct Duo { pub signature: String, } -impl From for Duo { - fn from(api: crate::api::response::two_factor_provider_data::duo::Duo) -> Self { +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, @@ -17,11 +17,11 @@ impl From for Duo { } } -impl From +impl From for Duo { fn from( - api: crate::api::response::two_factor_provider_data::organization_duo::OrganizationDuo, + api: crate::auth::api::response::two_factor_provider_data::organization_duo::OrganizationDuo, ) -> Self { Self { host: api.host, diff --git a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/email.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/email.rs similarity index 62% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/email.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/email.rs index d763a7bfc2..65ad184c2b 100644 --- a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/email.rs +++ b/crates/bitwarden/src/auth/response/two_factor_login_response/email.rs @@ -8,8 +8,8 @@ pub struct Email { pub email: String, } -impl From for Email { - fn from(api: crate::api::response::two_factor_provider_data::email::Email) -> Self { +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/src/sdk/auth/response/two_factor_login_response/mod.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/mod.rs similarity index 100% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/mod.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/mod.rs diff --git a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/remember.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/remember.rs similarity index 52% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/remember.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/remember.rs index b5b11eefe3..3275041839 100644 --- a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/remember.rs +++ b/crates/bitwarden/src/auth/response/two_factor_login_response/remember.rs @@ -5,8 +5,8 @@ use serde::{Deserialize, Serialize}; #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct Remember {} -impl From for Remember { - fn from(_: crate::api::response::two_factor_provider_data::remember::Remember) -> Self { +impl From for Remember { + fn from(_: crate::auth::api::response::two_factor_provider_data::remember::Remember) -> Self { Self {} } } diff --git a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/two_factor_providers.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/two_factor_providers.rs similarity index 85% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/two_factor_providers.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/two_factor_providers.rs index d372a8ac63..db790f3921 100644 --- a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/two_factor_providers.rs +++ b/crates/bitwarden/src/auth/response/two_factor_login_response/two_factor_providers.rs @@ -1,7 +1,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use crate::sdk::auth::response::two_factor_login_response::{ +use crate::auth::response::two_factor_login_response::{ authenticator::Authenticator, duo::Duo, email::Email, remember::Remember, web_authn::WebAuthn, yubi_key::YubiKey, }; @@ -24,8 +24,8 @@ pub struct TwoFactorProviders { pub web_authn: Option, } -impl From for TwoFactorProviders { - fn from(api: crate::api::response::TwoFactorProviders) -> Self { +impl From for TwoFactorProviders { + fn from(api: crate::auth::api::response::TwoFactorProviders) -> Self { Self { authenticator: api.authenticator.map(Into::into), email: api.email.map(Into::into), diff --git a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/web_authn.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/web_authn.rs similarity index 52% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/web_authn.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/web_authn.rs index 155b4b3f2d..799fd2b23d 100644 --- a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/web_authn.rs +++ b/crates/bitwarden/src/auth/response/two_factor_login_response/web_authn.rs @@ -5,8 +5,8 @@ use serde::{Deserialize, Serialize}; #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct WebAuthn {} -impl From for WebAuthn { - fn from(_: crate::api::response::two_factor_provider_data::web_authn::WebAuthn) -> Self { +impl From for WebAuthn { + fn from(_: crate::auth::api::response::two_factor_provider_data::web_authn::WebAuthn) -> Self { Self {} } } diff --git a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/yubi_key.rs b/crates/bitwarden/src/auth/response/two_factor_login_response/yubi_key.rs similarity index 62% rename from crates/bitwarden/src/sdk/auth/response/two_factor_login_response/yubi_key.rs rename to crates/bitwarden/src/auth/response/two_factor_login_response/yubi_key.rs index 10abe714b7..d6021bd39d 100644 --- a/crates/bitwarden/src/sdk/auth/response/two_factor_login_response/yubi_key.rs +++ b/crates/bitwarden/src/auth/response/two_factor_login_response/yubi_key.rs @@ -8,8 +8,8 @@ pub struct YubiKey { pub nfc: bool, } -impl From for YubiKey { - fn from(api: crate::api::response::two_factor_provider_data::yubi_key::YubiKey) -> Self { +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/src/bin/schemas.rs b/crates/bitwarden/src/bin/schemas.rs deleted file mode 100644 index 5b2e03e0f0..0000000000 --- a/crates/bitwarden/src/bin/schemas.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* -use std::{fs::{self, create_dir_all}, path::Path}; - -use bitwarden::sdk::{ - request::PasswordLoginRequest, - response::{captcha_response::CaptchaResponse, password_login_response::PasswordLoginResponse}, -}; -use schemars::{schema_for, JsonSchema}; - -fn main() { - write_to_file::("schemas/request/password-login-request.json".into()); - write_to_file::("schemas/response/password-login-response.json".into()); - write_to_file::("schemas/response/captcha-response.json".into()); -} - -#[allow(unused_must_use)] -fn write_to_file(filename: String) { - let path = Path::new(&filename); - create_dir_all(path.parent().unwrap()); - - let schema = schema_for!(T); - fs::write(filename, serde_json::to_string_pretty(&schema).unwrap()).unwrap(); -} -*/ - -fn main() {} diff --git a/crates/bitwarden/src/client/access_token.rs b/crates/bitwarden/src/client/access_token.rs index 4ebe872b49..d767113761 100644 --- a/crates/bitwarden/src/client/access_token.rs +++ b/crates/bitwarden/src/client/access_token.rs @@ -58,9 +58,10 @@ mod tests { #[test] fn can_decode_access_token() { - use crate::client::AccessToken; use std::str::FromStr; + use crate::client::AccessToken; + let access_token = "0.ec2c1d46-6a4b-4751-a310-af9601317f2d.C2IgxjjLF7qSshsbwe8JGcbM075YXw:X8vbvA0bduihIDe/qrzIQQ=="; let token = AccessToken::from_str(access_token).unwrap(); @@ -74,9 +75,10 @@ mod tests { #[test] fn malformed_tokens() { - use crate::client::AccessToken; use std::str::FromStr; + use crate::client::AccessToken; + // 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()); diff --git a/crates/bitwarden/src/client/auth_settings.rs b/crates/bitwarden/src/client/auth_settings.rs index 69cc763d6e..88e5eed2f5 100644 --- a/crates/bitwarden/src/client/auth_settings.rs +++ b/crates/bitwarden/src/client/auth_settings.rs @@ -1,6 +1,7 @@ +use std::num::NonZeroU32; + use base64::Engine; use bitwarden_api_identity::models::{KdfType, PreloginResponseModel}; -use std::num::NonZeroU32; use crate::{ crypto::{PbkdfSha256Hmac, PBKDF_SHA256_HMAC_OUT_SIZE}, diff --git a/crates/bitwarden/src/client/client.rs b/crates/bitwarden/src/client/client.rs index f3548c07f7..dabf0e01af 100644 --- a/crates/bitwarden/src/client/client.rs +++ b/crates/bitwarden/src/client/client.rs @@ -4,32 +4,30 @@ use log::debug; use reqwest::header::{self}; use uuid::Uuid; -#[allow(unused_imports)] use crate::{ + auth::{ + commands::{access_token_login, renew_token}, + request::AccessTokenLoginRequest, + response::ApiKeyLoginResponse, + }, client::{ auth_settings::AuthSettings, - client_projects::ClientProjects, - client_secrets::ClientSecrets, + client_settings::{ClientSettings, DeviceType}, encryption_settings::{EncryptionSettings, SymmetricCryptoKey}, }, - commands::{ - access_token_login, api_key_login, generate_fingerprint, get_user_api_key, password_login, - renew_token, sync, - }, crypto::CipherString, error::{Error, Result}, - sdk::{ - auth::{ - request::{AccessTokenLoginRequest, ApiKeyLoginRequest, PasswordLoginRequest}, - response::{ApiKeyLoginResponse, PasswordLoginResponse}, - }, - request::{ - client_settings::{ClientSettings, DeviceType}, - fingerprint_request::FingerprintRequest, - secret_verification_request::SecretVerificationRequest, - sync_request::SyncRequest, - }, - response::{sync_response::SyncResponse, user_api_key_response::UserApiKeyResponse}, +}; +#[cfg(feature = "internal")] +use crate::{ + auth::{ + commands::{api_key_login, password_login}, + request::{ApiKeyLoginRequest, PasswordLoginRequest}, + response::PasswordLoginResponse, + }, + platform::{ + generate_fingerprint, get_user_api_key, sync, FingerprintRequest, + SecretVerificationRequest, SyncRequest, SyncResponse, UserApiKeyResponse, }, }; @@ -235,6 +233,7 @@ impl Client { self.encryption_settings.as_ref().unwrap() } + #[cfg(feature = "internal")] pub(crate) fn initialize_org_crypto( &mut self, org_keys: Vec<(Uuid, CipherString)>, @@ -254,21 +253,11 @@ impl Client { } } -impl<'a> Client { - pub fn secrets(&'a mut self) -> ClientSecrets<'a> { - ClientSecrets { client: self } - } - - pub fn projects(&'a mut self) -> ClientProjects<'a> { - ClientProjects { client: self } - } -} - #[cfg(test)] mod tests { use wiremock::{matchers, Mock, ResponseTemplate}; - use crate::sdk::{auth::request::AccessTokenLoginRequest, request::secrets_request::*}; + use crate::{auth::request::AccessTokenLoginRequest, secrets_manager::secrets::*}; #[tokio::test] async fn test_access_token_login() { diff --git a/crates/bitwarden/src/sdk/request/client_settings.rs b/crates/bitwarden/src/client/client_settings.rs similarity index 96% rename from crates/bitwarden/src/sdk/request/client_settings.rs rename to crates/bitwarden/src/client/client_settings.rs index 45d4f1caaa..76f91fe8f9 100644 --- a/crates/bitwarden/src/sdk/request/client_settings.rs +++ b/crates/bitwarden/src/client/client_settings.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; /// Defaults to /// /// ``` -/// # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; +/// # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; /// # use assert_matches::assert_matches; /// let settings = ClientSettings { /// identity_url: "https://identity.bitwarden.com".to_string(), diff --git a/crates/bitwarden/src/client/encryption_settings.rs b/crates/bitwarden/src/client/encryption_settings.rs index c5119f8fb9..b57677b2ca 100644 --- a/crates/bitwarden/src/client/encryption_settings.rs +++ b/crates/bitwarden/src/client/encryption_settings.rs @@ -140,6 +140,7 @@ impl EncryptionSettings { } } + #[cfg(feature = "internal")] pub(crate) fn set_org_keys( &mut self, org_enc_keys: Vec<(Uuid, CipherString)>, diff --git a/crates/bitwarden/src/client/mod.rs b/crates/bitwarden/src/client/mod.rs index ed5ee7c029..bd0c88a9fd 100644 --- a/crates/bitwarden/src/client/mod.rs +++ b/crates/bitwarden/src/client/mod.rs @@ -4,11 +4,8 @@ pub(crate) use client::*; pub(crate) mod access_token; pub(crate) mod auth_settings; mod client; -mod client_projects; -mod client_secrets; +pub mod client_settings; pub(crate) mod encryption_settings; pub use access_token::AccessToken; pub use client::Client; -pub use client_projects::ClientProjects; -pub use client_secrets::ClientSecrets; diff --git a/crates/bitwarden/src/commands/generate_fingerprint.rs b/crates/bitwarden/src/commands/generate_fingerprint.rs deleted file mode 100644 index 36c4eef13f..0000000000 --- a/crates/bitwarden/src/commands/generate_fingerprint.rs +++ /dev/null @@ -1,13 +0,0 @@ -use log::{debug, info}; - -use crate::crypto::fingerprint; - -use crate::{error::Result, sdk::request::fingerprint_request::FingerprintRequest}; - -#[allow(dead_code)] -pub(crate) fn generate_fingerprint(input: &FingerprintRequest) -> Result { - info!("Generating fingerprint"); - debug!("{:?}", input); - - fingerprint(&input.fingerprint_material, input.public_key.as_bytes()) -} diff --git a/crates/bitwarden/src/commands/mod.rs b/crates/bitwarden/src/commands/mod.rs deleted file mode 100644 index 736f0ed9a5..0000000000 --- a/crates/bitwarden/src/commands/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub(crate) use generate_fingerprint::*; -pub(crate) use get_user_api_key::*; -pub(crate) use login::*; -pub(crate) use projects::*; -pub(crate) use secrets::*; -pub(crate) use sync::*; - -mod generate_fingerprint; -pub(crate) mod get_user_api_key; -mod login; -mod projects; -mod secrets; -mod sync; diff --git a/crates/bitwarden/src/commands/projects.rs b/crates/bitwarden/src/commands/projects.rs deleted file mode 100644 index 6f17aec0fe..0000000000 --- a/crates/bitwarden/src/commands/projects.rs +++ /dev/null @@ -1,119 +0,0 @@ -use bitwarden_api_api::models::{ProjectCreateRequestModel, ProjectUpdateRequestModel}; - -use crate::{ - client::Client, - error::{Error, Result}, - sdk::{ - request::projects_request::{ - ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, - ProjectsListRequest, - }, - response::projects_response::{ProjectResponse, ProjectsDeleteResponse, ProjectsResponse}, - }, -}; - -pub(crate) async fn get_project( - client: &mut Client, - input: &ProjectGetRequest, -) -> Result { - let config = client.get_api_configurations().await; - - let res = bitwarden_api_api::apis::projects_api::projects_id_get(&config.api, input.id).await?; - - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - ProjectResponse::process_response(res, enc) -} - -pub(crate) async fn create_project( - client: &mut Client, - input: &ProjectCreateRequest, -) -> Result { - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - let org_id = Some(input.organization_id); - - let project = Some(ProjectCreateRequestModel { - name: enc.encrypt(input.name.as_bytes(), org_id)?.to_string(), - }); - - let config = client.get_api_configurations().await; - let res = bitwarden_api_api::apis::projects_api::organizations_organization_id_projects_post( - &config.api, - input.organization_id, - project, - ) - .await?; - - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - ProjectResponse::process_response(res, enc) -} - -pub(crate) async fn list_projects( - client: &mut Client, - input: &ProjectsListRequest, -) -> Result { - let config = client.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 - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - ProjectsResponse::process_response(res, enc) -} - -pub(crate) async fn update_project( - client: &mut Client, - input: &ProjectPutRequest, -) -> Result { - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - let org_id = Some(input.organization_id); - - let project = Some(ProjectUpdateRequestModel { - name: enc.encrypt(input.name.as_bytes(), org_id)?.to_string(), - }); - - let config = client.get_api_configurations().await; - let res = - bitwarden_api_api::apis::projects_api::projects_id_put(&config.api, input.id, project) - .await?; - - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - ProjectResponse::process_response(res, enc) -} - -pub(crate) async fn delete_projects( - client: &mut Client, - input: ProjectsDeleteRequest, -) -> Result { - let config = client.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) -} diff --git a/crates/bitwarden/src/commands/secrets.rs b/crates/bitwarden/src/commands/secrets.rs deleted file mode 100644 index 898015ca71..0000000000 --- a/crates/bitwarden/src/commands/secrets.rs +++ /dev/null @@ -1,144 +0,0 @@ -use bitwarden_api_api::models::{SecretCreateRequestModel, SecretUpdateRequestModel}; - -use crate::{ - client::Client, - error::{Error, Result}, - sdk::{ - request::secrets_request::{ - SecretCreateRequest, SecretGetRequest, SecretIdentifiersByProjectRequest, - SecretIdentifiersRequest, SecretPutRequest, SecretsDeleteRequest, - }, - response::secrets_response::{ - SecretIdentifiersResponse, SecretResponse, SecretsDeleteResponse, - }, - }, -}; - -pub(crate) async fn get_secret( - client: &mut Client, - input: &SecretGetRequest, -) -> Result { - let config = client.get_api_configurations().await; - let res = bitwarden_api_api::apis::secrets_api::secrets_id_get(&config.api, input.id).await?; - - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - SecretResponse::process_response(res, enc) -} - -pub(crate) async fn create_secret( - client: &mut Client, - input: &SecretCreateRequest, -) -> Result { - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - let org_id = Some(input.organization_id); - - let secret = Some(SecretCreateRequestModel { - key: enc.encrypt(input.key.as_bytes(), org_id)?.to_string(), - value: enc.encrypt(input.value.as_bytes(), org_id)?.to_string(), - note: enc.encrypt(input.note.as_bytes(), org_id)?.to_string(), - project_ids: input.project_ids.clone(), - }); - - let config = client.get_api_configurations().await; - let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_post( - &config.api, - input.organization_id, - secret, - ) - .await?; - - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - SecretResponse::process_response(res, enc) -} - -pub(crate) async fn list_secrets( - client: &mut Client, - input: &SecretIdentifiersRequest, -) -> Result { - let config = client.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 - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - SecretIdentifiersResponse::process_response(res, enc) -} - -pub(crate) async fn list_secrets_by_project( - client: &mut Client, - input: &SecretIdentifiersByProjectRequest, -) -> Result { - let config = client.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 - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - SecretIdentifiersResponse::process_response(res, enc) -} - -pub(crate) async fn update_secret( - client: &mut Client, - input: &SecretPutRequest, -) -> Result { - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - let org_id = Some(input.organization_id); - - let secret = Some(SecretUpdateRequestModel { - key: enc.encrypt(input.key.as_bytes(), org_id)?.to_string(), - value: enc.encrypt(input.value.as_bytes(), org_id)?.to_string(), - note: enc.encrypt(input.note.as_bytes(), org_id)?.to_string(), - project_ids: None, - }); - - let config = client.get_api_configurations().await; - let res = - bitwarden_api_api::apis::secrets_api::secrets_id_put(&config.api, input.id, secret).await?; - - let enc = client - .get_encryption_settings() - .as_ref() - .ok_or(Error::VaultLocked)?; - - SecretResponse::process_response(res, enc) -} - -pub(crate) async fn delete_secrets( - client: &mut Client, - input: SecretsDeleteRequest, -) -> Result { - let config = client.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) -} diff --git a/crates/bitwarden/src/commands/sync.rs b/crates/bitwarden/src/commands/sync.rs deleted file mode 100644 index 49b0f6ddc6..0000000000 --- a/crates/bitwarden/src/commands/sync.rs +++ /dev/null @@ -1,27 +0,0 @@ -use crate::{ - client::Client, - error::{Error, Result}, - sdk::{request::sync_request::SyncRequest, response::sync_response::SyncResponse}, -}; - -#[allow(dead_code)] -pub(crate) async fn sync(client: &mut Client, input: &SyncRequest) -> Result { - let config = client.get_api_configurations().await; - let sync = - bitwarden_api_api::apis::sync_api::sync_get(&config.api, input.exclude_subdomains).await?; - - let org_keys: Vec<_> = sync - .profile - .as_ref() - .ok_or(Error::MissingFields)? - .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.initialize_org_crypto(org_keys)?; - - SyncResponse::process_response(sync, enc) -} diff --git a/crates/bitwarden/src/crypto.rs b/crates/bitwarden/src/crypto.rs index 5f04c8a67b..2155350fe3 100644 --- a/crates/bitwarden/src/crypto.rs +++ b/crates/bitwarden/src/crypto.rs @@ -328,9 +328,8 @@ fn hash_word(hash: [u8; 32]) -> Result { mod tests { use std::num::NonZeroU32; - use crate::crypto::{stretch_key_password, CipherString}; - use super::{fingerprint, stretch_key}; + use crate::crypto::{stretch_key_password, CipherString}; #[test] fn test_cipher_string_serialization() { diff --git a/crates/bitwarden/src/error.rs b/crates/bitwarden/src/error.rs index 09554d442d..5a3c648526 100644 --- a/crates/bitwarden/src/error.rs +++ b/crates/bitwarden/src/error.rs @@ -2,11 +2,10 @@ use std::fmt::Debug; -use reqwest::StatusCode; -use thiserror::Error; - use bitwarden_api_api::apis::Error as ApiError; use bitwarden_api_identity::apis::Error as IdentityError; +use reqwest::StatusCode; +use thiserror::Error; #[derive(Debug, Error)] pub enum Error { @@ -31,7 +30,7 @@ pub enum Error { InvalidCipherString(#[from] CSParseError), #[error("Error parsing Identity response: {0}")] - IdentityFail(crate::api::response::IdentityTokenFailResponse), + IdentityFail(crate::auth::api::response::IdentityTokenFailResponse), #[error(transparent)] Reqwest(#[from] reqwest::Error), diff --git a/crates/bitwarden/src/lib.rs b/crates/bitwarden/src/lib.rs index b25cb46623..48f93e2faf 100644 --- a/crates/bitwarden/src/lib.rs +++ b/crates/bitwarden/src/lib.rs @@ -16,17 +16,12 @@ //! //! ```rust //! use bitwarden::{ -//! Client, +//! auth::request::AccessTokenLoginRequest, +//! client::client_settings::{ClientSettings, DeviceType}, //! error::Result, -//! sdk::{ -//! auth::request::AccessTokenLoginRequest, -//! request::{ -//! client_settings::{ClientSettings, DeviceType}, -//! secrets_request::SecretIdentifiersRequest -//! }, -//! }, +//! secrets_manager::secrets::SecretIdentifiersRequest, +//! Client, //! }; -//! //! use uuid::Uuid; //! //! async fn test() -> Result<()> { @@ -53,12 +48,13 @@ //! ``` //! -mod api; +pub mod auth; pub mod client; -mod commands; pub mod crypto; pub mod error; -pub mod sdk; +#[cfg(feature = "internal")] +pub mod platform; +pub mod secrets_manager; mod util; pub mod wordlist; diff --git a/crates/bitwarden/src/sdk/request/fingerprint_request.rs b/crates/bitwarden/src/platform/generate_fingerprint.rs similarity index 55% rename from crates/bitwarden/src/sdk/request/fingerprint_request.rs rename to crates/bitwarden/src/platform/generate_fingerprint.rs index a19f40147e..d2960ae315 100644 --- a/crates/bitwarden/src/sdk/request/fingerprint_request.rs +++ b/crates/bitwarden/src/platform/generate_fingerprint.rs @@ -1,6 +1,9 @@ +use log::{debug, info}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use crate::{crypto::fingerprint, error::Result}; + #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct FingerprintRequest { @@ -9,3 +12,10 @@ pub struct FingerprintRequest { /// The user's public key pub public_key: String, } + +pub(crate) fn generate_fingerprint(input: &FingerprintRequest) -> Result { + info!("Generating fingerprint"); + debug!("{:?}", input); + + fingerprint(&input.fingerprint_material, input.public_key.as_bytes()) +} diff --git a/crates/bitwarden/src/commands/get_user_api_key.rs b/crates/bitwarden/src/platform/get_user_api_key.rs similarity index 65% rename from crates/bitwarden/src/commands/get_user_api_key.rs rename to crates/bitwarden/src/platform/get_user_api_key.rs index f1e6c79f03..0548c5d0fa 100644 --- a/crates/bitwarden/src/commands/get_user_api_key.rs +++ b/crates/bitwarden/src/platform/get_user_api_key.rs @@ -1,19 +1,18 @@ use bitwarden_api_api::{ - apis::accounts_api::accounts_api_key_post, models::SecretVerificationRequestModel, + apis::accounts_api::accounts_api_key_post, + models::{ApiKeyResponseModel, SecretVerificationRequestModel}, }; use log::{debug, info}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use super::SecretVerificationRequest; use crate::{ client::auth_settings::AuthSettings, error::{Error, Result}, - sdk::{ - request::secret_verification_request::SecretVerificationRequest, - response::user_api_key_response::UserApiKeyResponse, - }, Client, }; -#[allow(dead_code)] pub(crate) async fn get_user_api_key( client: &mut Client, input: &SecretVerificationRequest, @@ -57,3 +56,19 @@ fn get_secret_verification_request( auth_request_access_code: None, } } + +#[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 { + match response.api_key { + Some(api_key) => Ok(UserApiKeyResponse { api_key }), + None => Err(Error::MissingFields), + } + } +} diff --git a/crates/bitwarden/src/platform/mod.rs b/crates/bitwarden/src/platform/mod.rs new file mode 100644 index 0000000000..88eadd61db --- /dev/null +++ b/crates/bitwarden/src/platform/mod.rs @@ -0,0 +1,12 @@ +mod generate_fingerprint; +mod get_user_api_key; +mod secret_verification_request; +mod sync; + +pub(crate) use generate_fingerprint::generate_fingerprint; +pub use generate_fingerprint::FingerprintRequest; +pub(crate) use get_user_api_key::get_user_api_key; +pub use get_user_api_key::UserApiKeyResponse; +pub use secret_verification_request::SecretVerificationRequest; +pub(crate) use sync::sync; +pub use sync::{SyncRequest, SyncResponse}; diff --git a/crates/bitwarden/src/sdk/request/secret_verification_request.rs b/crates/bitwarden/src/platform/secret_verification_request.rs similarity index 100% rename from crates/bitwarden/src/sdk/request/secret_verification_request.rs rename to crates/bitwarden/src/platform/secret_verification_request.rs diff --git a/crates/bitwarden/src/sdk/response/sync_response.rs b/crates/bitwarden/src/platform/sync.rs similarity index 75% rename from crates/bitwarden/src/sdk/response/sync_response.rs rename to crates/bitwarden/src/platform/sync.rs index 6162f5d337..fd33e4343a 100644 --- a/crates/bitwarden/src/sdk/response/sync_response.rs +++ b/crates/bitwarden/src/platform/sync.rs @@ -7,10 +7,38 @@ use serde::{Deserialize, Serialize}; use uuid::Uuid; use crate::{ - client::encryption_settings::EncryptionSettings, + client::{encryption_settings::EncryptionSettings, Client}, error::{Error, Result}, }; +#[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: &mut Client, input: &SyncRequest) -> Result { + let config = client.get_api_configurations().await; + let sync = + bitwarden_api_api::apis::sync_api::sync_get(&config.api, input.exclude_subdomains).await?; + + let org_keys: Vec<_> = sync + .profile + .as_ref() + .ok_or(Error::MissingFields)? + .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.initialize_org_crypto(org_keys)?; + + SyncResponse::process_response(sync, enc) +} + #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct ProfileResponse { diff --git a/crates/bitwarden/src/sdk/auth/mod.rs b/crates/bitwarden/src/sdk/auth/mod.rs deleted file mode 100644 index e0062185c4..0000000000 --- a/crates/bitwarden/src/sdk/auth/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod request; -pub mod response; diff --git a/crates/bitwarden/src/sdk/mod.rs b/crates/bitwarden/src/sdk/mod.rs deleted file mode 100644 index 2d9ad73aa7..0000000000 --- a/crates/bitwarden/src/sdk/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod auth; -pub mod request; -pub mod response; diff --git a/crates/bitwarden/src/sdk/request/mod.rs b/crates/bitwarden/src/sdk/request/mod.rs deleted file mode 100644 index 94efa4ccb7..0000000000 --- a/crates/bitwarden/src/sdk/request/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod client_settings; -pub mod command; -pub mod fingerprint_request; -pub mod projects_request; -pub mod secret_verification_request; -pub mod secrets_request; -pub mod sync_request; diff --git a/crates/bitwarden/src/sdk/request/projects_request.rs b/crates/bitwarden/src/sdk/request/projects_request.rs deleted file mode 100644 index 6f78d064e6..0000000000 --- a/crates/bitwarden/src/sdk/request/projects_request.rs +++ /dev/null @@ -1,44 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectGetRequest { - /// ID of the project to retrieve - pub id: Uuid, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectCreateRequest { - /// Organization where the project will be created - pub organization_id: Uuid, - - pub name: String, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[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, - - pub name: String, -} - -#[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, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectsDeleteRequest { - /// IDs of the projects to delete - pub ids: Vec, -} diff --git a/crates/bitwarden/src/sdk/request/secrets_request.rs b/crates/bitwarden/src/sdk/request/secrets_request.rs deleted file mode 100644 index 846a456839..0000000000 --- a/crates/bitwarden/src/sdk/request/secrets_request.rs +++ /dev/null @@ -1,58 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretGetRequest { - /// ID of the secret to retrieve - pub id: Uuid, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretCreateRequest { - /// Organization where the secret will be created - pub organization_id: Uuid, - - pub key: String, - pub value: String, - pub note: String, - - /// IDs of the projects that this secret will belong to - pub project_ids: Option>, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[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, - - pub key: String, - pub value: String, - pub note: String, -} - -#[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, -} - -#[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, -} - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretsDeleteRequest { - /// IDs of the secrets to delete - pub ids: Vec, -} diff --git a/crates/bitwarden/src/sdk/request/sync_request.rs b/crates/bitwarden/src/sdk/request/sync_request.rs deleted file mode 100644 index 2408ff5b9c..0000000000 --- a/crates/bitwarden/src/sdk/request/sync_request.rs +++ /dev/null @@ -1,9 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[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, -} diff --git a/crates/bitwarden/src/sdk/response/mod.rs b/crates/bitwarden/src/sdk/response/mod.rs deleted file mode 100644 index 0216e8f63a..0000000000 --- a/crates/bitwarden/src/sdk/response/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod captcha_response; -pub mod projects_response; -pub mod secrets_response; -pub mod sync_response; -pub mod user_api_key_response; diff --git a/crates/bitwarden/src/sdk/response/projects_response.rs b/crates/bitwarden/src/sdk/response/projects_response.rs deleted file mode 100644 index 380b904e55..0000000000 --- a/crates/bitwarden/src/sdk/response/projects_response.rs +++ /dev/null @@ -1,109 +0,0 @@ -use bitwarden_api_api::models::{ - BulkDeleteResponseModel, BulkDeleteResponseModelListResponseModel, ProjectResponseModel, - ProjectResponseModelListResponseModel, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use crate::{ - client::encryption_settings::EncryptionSettings, - error::{Error, Result}, -}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct ProjectResponse { - pub object: String, - pub id: Uuid, - pub organization_id: Uuid, - pub name: String, - pub creation_date: String, - pub revision_date: String, -} - -impl ProjectResponse { - pub(crate) fn process_response( - response: ProjectResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let organization_id = response.organization_id.ok_or(Error::MissingFields)?; - - let name = enc.decrypt_str( - &response.name.ok_or(Error::MissingFields)?, - Some(organization_id), - )?; - - Ok(ProjectResponse { - object: "project".to_owned(), - - id: response.id.ok_or(Error::MissingFields)?, - organization_id, - name, - - creation_date: response.creation_date.ok_or(Error::MissingFields)?, - revision_date: response.revision_date.ok_or(Error::MissingFields)?, - }) - } -} - -#[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::>()?, - }) - } -} - -#[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: response.id.ok_or(Error::MissingFields)?, - error: response.error, - }) - } -} diff --git a/crates/bitwarden/src/sdk/response/secrets_response.rs b/crates/bitwarden/src/sdk/response/secrets_response.rs deleted file mode 100644 index 72e7bb1149..0000000000 --- a/crates/bitwarden/src/sdk/response/secrets_response.rs +++ /dev/null @@ -1,149 +0,0 @@ -use bitwarden_api_api::models::{ - BulkDeleteResponseModel, BulkDeleteResponseModelListResponseModel, SecretResponseModel, - SecretWithProjectsListResponseModel, SecretsWithProjectsInnerSecret, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -use crate::{ - client::encryption_settings::EncryptionSettings, - error::{Error, Result}, -}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct SecretResponse { - pub object: String, - pub id: Uuid, - pub organization_id: Uuid, - pub project_id: Option, - - pub key: String, - pub value: String, - pub note: String, - - pub creation_date: String, - pub revision_date: String, -} - -impl SecretResponse { - pub(crate) fn process_response( - response: SecretResponseModel, - enc: &EncryptionSettings, - ) -> Result { - let org_id = response.organization_id; - - let key = enc.decrypt_str(&response.key.ok_or(Error::MissingFields)?, org_id)?; - let value = enc.decrypt_str(&response.value.ok_or(Error::MissingFields)?, org_id)?; - let note = enc.decrypt_str(&response.note.ok_or(Error::MissingFields)?, org_id)?; - - let project = response - .projects - .and_then(|p| p.into_iter().next()) - .and_then(|p| p.id); - - Ok(SecretResponse { - object: "secret".to_owned(), - id: response.id.ok_or(Error::MissingFields)?, - organization_id: org_id.ok_or(Error::MissingFields)?, - project_id: project, - key, - value, - note, - - creation_date: response.creation_date.ok_or(Error::MissingFields)?, - revision_date: response.revision_date.ok_or(Error::MissingFields)?, - }) - } -} - -#[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 = response.organization_id.ok_or(Error::MissingFields)?; - - let key = enc.decrypt_str( - &response.key.ok_or(Error::MissingFields)?, - Some(organization_id), - )?; - - Ok(SecretIdentifierResponse { - id: response.id.ok_or(Error::MissingFields)?, - organization_id, - key, - }) - } -} - -#[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: response.id.ok_or(Error::MissingFields)?, - error: response.error, - }) - } -} diff --git a/crates/bitwarden/src/sdk/response/user_api_key_response.rs b/crates/bitwarden/src/sdk/response/user_api_key_response.rs deleted file mode 100644 index 4f0d074116..0000000000 --- a/crates/bitwarden/src/sdk/response/user_api_key_response.rs +++ /dev/null @@ -1,21 +0,0 @@ -use bitwarden_api_api::models::ApiKeyResponseModel; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use crate::error::{Error, Result}; - -#[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 { - match response.api_key { - Some(api_key) => Ok(UserApiKeyResponse { api_key }), - None => Err(Error::MissingFields), - } - } -} diff --git a/crates/bitwarden/src/client/client_projects.rs b/crates/bitwarden/src/secrets_manager/client_projects.rs similarity index 67% rename from crates/bitwarden/src/client/client_projects.rs rename to crates/bitwarden/src/secrets_manager/client_projects.rs index 4be6e7ad97..acd4adfaee 100644 --- a/crates/bitwarden/src/client/client_projects.rs +++ b/crates/bitwarden/src/secrets_manager/client_projects.rs @@ -1,13 +1,11 @@ use crate::{ - commands::{create_project, delete_projects, get_project, list_projects, update_project}, error::Result, - sdk::{ - request::projects_request::{ - ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, - ProjectsListRequest, - }, - response::projects_response::{ProjectResponse, ProjectsDeleteResponse, ProjectsResponse}, + secrets_manager::projects::{ + create_project, delete_projects, get_project, list_projects, update_project, + ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectResponse, + ProjectsDeleteRequest, ProjectsDeleteResponse, ProjectsListRequest, ProjectsResponse, }, + Client, }; pub struct ClientProjects<'a> { @@ -35,3 +33,9 @@ impl<'a> ClientProjects<'a> { delete_projects(self.client, input).await } } + +impl<'a> Client { + pub fn projects(&'a mut self) -> ClientProjects<'a> { + ClientProjects { client: self } + } +} diff --git a/crates/bitwarden/src/client/client_secrets.rs b/crates/bitwarden/src/secrets_manager/client_secrets.rs similarity index 74% rename from crates/bitwarden/src/client/client_secrets.rs rename to crates/bitwarden/src/secrets_manager/client_secrets.rs index 158c87c569..2974e067a7 100644 --- a/crates/bitwarden/src/client/client_secrets.rs +++ b/crates/bitwarden/src/secrets_manager/client_secrets.rs @@ -1,18 +1,12 @@ use crate::{ - commands::{ - create_secret, delete_secrets, get_secret, list_secrets, list_secrets_by_project, - update_secret, - }, error::Result, - sdk::{ - request::secrets_request::{ - SecretCreateRequest, SecretGetRequest, SecretIdentifiersByProjectRequest, - SecretIdentifiersRequest, SecretPutRequest, SecretsDeleteRequest, - }, - response::secrets_response::{ - SecretIdentifiersResponse, SecretResponse, SecretsDeleteResponse, - }, + secrets_manager::secrets::{ + create_secret, delete_secrets, get_secret, list_secrets, list_secrets_by_project, + update_secret, SecretCreateRequest, SecretGetRequest, SecretIdentifiersByProjectRequest, + SecretIdentifiersRequest, SecretIdentifiersResponse, SecretPutRequest, SecretResponse, + SecretsDeleteRequest, SecretsDeleteResponse, }, + Client, }; pub struct ClientSecrets<'a> { @@ -50,3 +44,9 @@ impl<'a> ClientSecrets<'a> { delete_secrets(self.client, input).await } } + +impl<'a> Client { + pub fn secrets(&'a mut self) -> ClientSecrets<'a> { + ClientSecrets { client: self } + } +} diff --git a/crates/bitwarden/src/secrets_manager/mod.rs b/crates/bitwarden/src/secrets_manager/mod.rs new file mode 100644 index 0000000000..0afbfe38c9 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/mod.rs @@ -0,0 +1,5 @@ +pub mod projects; +pub mod secrets; + +mod client_projects; +mod client_secrets; diff --git a/crates/bitwarden/src/secrets_manager/projects/create.rs b/crates/bitwarden/src/secrets_manager/projects/create.rs new file mode 100644 index 0000000000..3eae095c3b --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/projects/create.rs @@ -0,0 +1,50 @@ +use bitwarden_api_api::models::ProjectCreateRequestModel; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use super::ProjectResponse; +use crate::{ + client::Client, + error::{Error, Result}, +}; + +#[derive(Serialize, Deserialize, Debug, JsonSchema)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct ProjectCreateRequest { + /// Organization where the project will be created + pub organization_id: Uuid, + + pub name: String, +} + +pub(crate) async fn create_project( + client: &mut Client, + input: &ProjectCreateRequest, +) -> Result { + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + let org_id = Some(input.organization_id); + + let project = Some(ProjectCreateRequestModel { + name: enc.encrypt(input.name.as_bytes(), org_id)?.to_string(), + }); + + let config = client.get_api_configurations().await; + let res = bitwarden_api_api::apis::projects_api::organizations_organization_id_projects_post( + &config.api, + input.organization_id, + project, + ) + .await?; + + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + ProjectResponse::process_response(res, enc) +} diff --git a/crates/bitwarden/src/secrets_manager/projects/delete.rs b/crates/bitwarden/src/secrets_manager/projects/delete.rs new file mode 100644 index 0000000000..55f7926693 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/projects/delete.rs @@ -0,0 +1,69 @@ +use bitwarden_api_api::models::{ + BulkDeleteResponseModel, BulkDeleteResponseModelListResponseModel, +}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use crate::{ + client::Client, + error::{Error, Result}, +}; + +#[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: &mut Client, + input: ProjectsDeleteRequest, +) -> Result { + let config = client.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: response.id.ok_or(Error::MissingFields)?, + error: response.error, + }) + } +} diff --git a/crates/bitwarden/src/secrets_manager/projects/get.rs b/crates/bitwarden/src/secrets_manager/projects/get.rs new file mode 100644 index 0000000000..9601cbc19d --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/projects/get.rs @@ -0,0 +1,32 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use super::ProjectResponse; +use crate::{ + client::Client, + error::{Error, Result}, +}; + +#[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: &mut Client, + input: &ProjectGetRequest, +) -> Result { + let config = client.get_api_configurations().await; + + let res = bitwarden_api_api::apis::projects_api::projects_id_get(&config.api, input.id).await?; + + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + ProjectResponse::process_response(res, enc) +} diff --git a/crates/bitwarden/src/secrets_manager/projects/list.rs b/crates/bitwarden/src/secrets_manager/projects/list.rs new file mode 100644 index 0000000000..9bdeb1f196 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/projects/list.rs @@ -0,0 +1,58 @@ +use bitwarden_api_api::models::ProjectResponseModelListResponseModel; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use super::ProjectResponse; +use crate::{ + client::{encryption_settings::EncryptionSettings, Client}, + error::{Error, Result}, +}; + +#[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: &mut Client, + input: &ProjectsListRequest, +) -> Result { + let config = client.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 + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + 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/src/secrets_manager/projects/mod.rs b/crates/bitwarden/src/secrets_manager/projects/mod.rs new file mode 100644 index 0000000000..20ae5d95b8 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/projects/mod.rs @@ -0,0 +1,18 @@ +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/src/secrets_manager/projects/project_response.rs b/crates/bitwarden/src/secrets_manager/projects/project_response.rs new file mode 100644 index 0000000000..be36327f8a --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/projects/project_response.rs @@ -0,0 +1,45 @@ +use bitwarden_api_api::models::ProjectResponseModel; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use crate::{ + client::encryption_settings::EncryptionSettings, + error::{Error, Result}, +}; + +#[derive(Serialize, Deserialize, Debug, JsonSchema)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct ProjectResponse { + pub object: String, + pub id: Uuid, + pub organization_id: Uuid, + pub name: String, + pub creation_date: String, + pub revision_date: String, +} + +impl ProjectResponse { + pub(crate) fn process_response( + response: ProjectResponseModel, + enc: &EncryptionSettings, + ) -> Result { + let organization_id = response.organization_id.ok_or(Error::MissingFields)?; + + let name = enc.decrypt_str( + &response.name.ok_or(Error::MissingFields)?, + Some(organization_id), + )?; + + Ok(ProjectResponse { + object: "project".to_owned(), + + id: response.id.ok_or(Error::MissingFields)?, + organization_id, + name, + + creation_date: response.creation_date.ok_or(Error::MissingFields)?, + revision_date: response.revision_date.ok_or(Error::MissingFields)?, + }) + } +} diff --git a/crates/bitwarden/src/secrets_manager/projects/update.rs b/crates/bitwarden/src/secrets_manager/projects/update.rs new file mode 100644 index 0000000000..236f5965f7 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/projects/update.rs @@ -0,0 +1,49 @@ +use bitwarden_api_api::models::ProjectUpdateRequestModel; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use super::ProjectResponse; +use crate::{ + client::Client, + error::{Error, Result}, +}; + +#[derive(Serialize, Deserialize, Debug, JsonSchema)] +#[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, + + pub name: String, +} + +pub(crate) async fn update_project( + client: &mut Client, + input: &ProjectPutRequest, +) -> Result { + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + let org_id = Some(input.organization_id); + + let project = Some(ProjectUpdateRequestModel { + name: enc.encrypt(input.name.as_bytes(), org_id)?.to_string(), + }); + + let config = client.get_api_configurations().await; + let res = + bitwarden_api_api::apis::projects_api::projects_id_put(&config.api, input.id, project) + .await?; + + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + ProjectResponse::process_response(res, enc) +} diff --git a/crates/bitwarden/src/secrets_manager/secrets/create.rs b/crates/bitwarden/src/secrets_manager/secrets/create.rs new file mode 100644 index 0000000000..8d576c34f3 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/secrets/create.rs @@ -0,0 +1,58 @@ +use bitwarden_api_api::models::SecretCreateRequestModel; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use super::SecretResponse; +use crate::{ + error::{Error, Result}, + Client, +}; + +#[derive(Serialize, Deserialize, Debug, JsonSchema)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct SecretCreateRequest { + /// Organization where the secret will be created + pub organization_id: Uuid, + + pub key: String, + pub value: String, + pub note: String, + + /// IDs of the projects that this secret will belong to + pub project_ids: Option>, +} + +pub(crate) async fn create_secret( + client: &mut Client, + input: &SecretCreateRequest, +) -> Result { + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + let org_id = Some(input.organization_id); + + let secret = Some(SecretCreateRequestModel { + key: enc.encrypt(input.key.as_bytes(), org_id)?.to_string(), + value: enc.encrypt(input.value.as_bytes(), org_id)?.to_string(), + note: enc.encrypt(input.note.as_bytes(), org_id)?.to_string(), + project_ids: input.project_ids.clone(), + }); + + let config = client.get_api_configurations().await; + let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_post( + &config.api, + input.organization_id, + secret, + ) + .await?; + + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + SecretResponse::process_response(res, enc) +} diff --git a/crates/bitwarden/src/secrets_manager/secrets/delete.rs b/crates/bitwarden/src/secrets_manager/secrets/delete.rs new file mode 100644 index 0000000000..19337e7a1d --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/secrets/delete.rs @@ -0,0 +1,69 @@ +use bitwarden_api_api::models::{ + BulkDeleteResponseModel, BulkDeleteResponseModelListResponseModel, +}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use crate::{ + client::Client, + error::{Error, Result}, +}; + +#[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: &mut Client, + input: SecretsDeleteRequest, +) -> Result { + let config = client.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: response.id.ok_or(Error::MissingFields)?, + error: response.error, + }) + } +} diff --git a/crates/bitwarden/src/secrets_manager/secrets/get.rs b/crates/bitwarden/src/secrets_manager/secrets/get.rs new file mode 100644 index 0000000000..2d3a8983bf --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/secrets/get.rs @@ -0,0 +1,31 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use super::SecretResponse; +use crate::{ + error::{Error, Result}, + Client, +}; + +#[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: &mut Client, + input: &SecretGetRequest, +) -> Result { + let config = client.get_api_configurations().await; + let res = bitwarden_api_api::apis::secrets_api::secrets_id_get(&config.api, input.id).await?; + + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + SecretResponse::process_response(res, enc) +} diff --git a/crates/bitwarden/src/secrets_manager/secrets/list.rs b/crates/bitwarden/src/secrets_manager/secrets/list.rs new file mode 100644 index 0000000000..b14d04f055 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/secrets/list.rs @@ -0,0 +1,114 @@ +use bitwarden_api_api::models::{ + SecretWithProjectsListResponseModel, SecretsWithProjectsInnerSecret, +}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use crate::{ + client::{encryption_settings::EncryptionSettings, Client}, + error::{Error, Result}, +}; + +#[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: &mut Client, + input: &SecretIdentifiersRequest, +) -> Result { + let config = client.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 + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + 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: &mut Client, + input: &SecretIdentifiersByProjectRequest, +) -> Result { + let config = client.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 + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + 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 = response.organization_id.ok_or(Error::MissingFields)?; + + let key = enc.decrypt_str( + &response.key.ok_or(Error::MissingFields)?, + Some(organization_id), + )?; + + Ok(SecretIdentifierResponse { + id: response.id.ok_or(Error::MissingFields)?, + organization_id, + key, + }) + } +} diff --git a/crates/bitwarden/src/secrets_manager/secrets/mod.rs b/crates/bitwarden/src/secrets_manager/secrets/mod.rs new file mode 100644 index 0000000000..de628e6185 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/secrets/mod.rs @@ -0,0 +1,20 @@ +mod create; +mod delete; +mod get; +mod list; +mod secret_response; +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 list::{list_secrets, list_secrets_by_project}; +pub use list::{ + SecretIdentifiersByProjectRequest, SecretIdentifiersRequest, SecretIdentifiersResponse, +}; +pub use secret_response::SecretResponse; +pub(crate) use update::update_secret; +pub use update::SecretPutRequest; diff --git a/crates/bitwarden/src/secrets_manager/secrets/secret_response.rs b/crates/bitwarden/src/secrets_manager/secrets/secret_response.rs new file mode 100644 index 0000000000..85b6c77ddc --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/secrets/secret_response.rs @@ -0,0 +1,56 @@ +use bitwarden_api_api::models::SecretResponseModel; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use crate::{ + client::encryption_settings::EncryptionSettings, + error::{Error, Result}, +}; + +#[derive(Serialize, Deserialize, Debug, JsonSchema)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct SecretResponse { + pub object: String, + pub id: Uuid, + pub organization_id: Uuid, + pub project_id: Option, + + pub key: String, + pub value: String, + pub note: String, + + pub creation_date: String, + pub revision_date: String, +} + +impl SecretResponse { + pub(crate) fn process_response( + response: SecretResponseModel, + enc: &EncryptionSettings, + ) -> Result { + let org_id = response.organization_id; + + let key = enc.decrypt_str(&response.key.ok_or(Error::MissingFields)?, org_id)?; + let value = enc.decrypt_str(&response.value.ok_or(Error::MissingFields)?, org_id)?; + let note = enc.decrypt_str(&response.note.ok_or(Error::MissingFields)?, org_id)?; + + let project = response + .projects + .and_then(|p| p.into_iter().next()) + .and_then(|p| p.id); + + Ok(SecretResponse { + object: "secret".to_owned(), + id: response.id.ok_or(Error::MissingFields)?, + organization_id: org_id.ok_or(Error::MissingFields)?, + project_id: project, + key, + value, + note, + + creation_date: response.creation_date.ok_or(Error::MissingFields)?, + revision_date: response.revision_date.ok_or(Error::MissingFields)?, + }) + } +} diff --git a/crates/bitwarden/src/secrets_manager/secrets/update.rs b/crates/bitwarden/src/secrets_manager/secrets/update.rs new file mode 100644 index 0000000000..45acb21585 --- /dev/null +++ b/crates/bitwarden/src/secrets_manager/secrets/update.rs @@ -0,0 +1,53 @@ +use bitwarden_api_api::models::SecretUpdateRequestModel; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use super::SecretResponse; +use crate::{ + client::Client, + error::{Error, Result}, +}; + +#[derive(Serialize, Deserialize, Debug, JsonSchema)] +#[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, + + pub key: String, + pub value: String, + pub note: String, +} + +pub(crate) async fn update_secret( + client: &mut Client, + input: &SecretPutRequest, +) -> Result { + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + let org_id = Some(input.organization_id); + + let secret = Some(SecretUpdateRequestModel { + key: enc.encrypt(input.key.as_bytes(), org_id)?.to_string(), + value: enc.encrypt(input.value.as_bytes(), org_id)?.to_string(), + note: enc.encrypt(input.note.as_bytes(), org_id)?.to_string(), + project_ids: None, + }); + + let config = client.get_api_configurations().await; + let res = + bitwarden_api_api::apis::secrets_api::secrets_id_put(&config.api, input.id, secret).await?; + + let enc = client + .get_encryption_settings() + .as_ref() + .ok_or(Error::VaultLocked)?; + + SecretResponse::process_response(res, enc) +} diff --git a/crates/bitwarden/src/util.rs b/crates/bitwarden/src/util.rs index 390d6ac888..de39151c87 100644 --- a/crates/bitwarden/src/util.rs +++ b/crates/bitwarden/src/util.rs @@ -77,11 +77,11 @@ pub async fn start_mock(mocks: Vec) -> (wiremock::MockServer, cr server.register(mock).await; } - let settings = crate::sdk::request::client_settings::ClientSettings { + let settings = crate::client::client_settings::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::sdk::request::client_settings::DeviceType::SDK, + device_type: crate::client::client_settings::DeviceType::SDK, }; (server, crate::Client::new(Some(settings))) diff --git a/crates/bws/src/main.rs b/crates/bws/src/main.rs index 4df9503bfc..b8dacad916 100644 --- a/crates/bws/src/main.rs +++ b/crates/bws/src/main.rs @@ -1,26 +1,22 @@ use std::{path::PathBuf, str::FromStr}; -use clap::{ArgGroup, CommandFactory, Parser, Subcommand}; -use color_eyre::eyre::{bail, Result}; -use log::error; - use bitwarden::{ - client::AccessToken, - sdk::{ - auth::request::AccessTokenLoginRequest, - request::{ - client_settings::ClientSettings, - projects_request::{ - ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, - ProjectsListRequest, - }, - secrets_request::{ - SecretCreateRequest, SecretGetRequest, SecretIdentifiersByProjectRequest, - SecretIdentifiersRequest, SecretPutRequest, SecretsDeleteRequest, - }, + auth::request::AccessTokenLoginRequest, + client::{client_settings::ClientSettings, AccessToken}, + secrets_manager::{ + projects::{ + ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, + ProjectsListRequest, + }, + secrets::{ + SecretCreateRequest, SecretGetRequest, SecretIdentifiersByProjectRequest, + SecretIdentifiersRequest, SecretPutRequest, SecretsDeleteRequest, }, }, }; +use clap::{ArgGroup, CommandFactory, Parser, Subcommand}; +use color_eyre::eyre::{bail, Result}; +use log::error; mod config; mod render; diff --git a/crates/bws/src/render.rs b/crates/bws/src/render.rs index 4fdb78b6c9..53306af0d3 100644 --- a/crates/bws/src/render.rs +++ b/crates/bws/src/render.rs @@ -1,6 +1,4 @@ -use bitwarden::sdk::response::{ - projects_response::ProjectResponse, secrets_response::SecretResponse, -}; +use bitwarden::secrets_manager::{projects::ProjectResponse, secrets::SecretResponse}; use chrono::DateTime; use clap::ValueEnum; use comfy_table::Table; diff --git a/crates/sdk-schemas/src/main.rs b/crates/sdk-schemas/src/main.rs index 5cf81f4b8f..fa193a32e2 100644 --- a/crates/sdk-schemas/src/main.rs +++ b/crates/sdk-schemas/src/main.rs @@ -1,10 +1,8 @@ -use anyhow::Result; -use itertools::Itertools; -use schemars::schema::RootSchema; -use schemars::schema_for; use std::{fs::File, io::Write}; -use bitwarden::sdk::*; +use anyhow::Result; +use itertools::Itertools; +use schemars::{schema::RootSchema, schema_for}; /// Creates a json schema file for any type passed in using Schemars. The filename and path of the generated /// schema file is derived from the namespace passed into the macro or supplied as the first argument. @@ -91,32 +89,26 @@ fn write_schema(schema: RootSchema, dir_path: String, type_name: String) -> Resu } fn main() -> Result<()> { - write_schema_for!(request::client_settings::ClientSettings); - write_schema_for!(request::command::Command); + // Input types for new Client + write_schema_for!(bitwarden::client::client_settings::ClientSettings); + // Input types for Client::run_command + write_schema_for!(bitwarden_json::command::Command); - write_schema_for!( - "response", - bitwarden_json::response::Response - ); - write_schema_for!( - "response", - bitwarden_json::response::Response - ); - write_schema_for!( - "response", - bitwarden_json::response::Response - ); + // Output types for Client::run_command + // Only add structs which are direct results of SDK commands. + write_schema_for_response! { + bitwarden::auth::response::ApiKeyLoginResponse, + bitwarden::auth::response::PasswordLoginResponse, + bitwarden::secrets_manager::secrets::SecretIdentifiersResponse, + bitwarden::secrets_manager::secrets::SecretResponse, + bitwarden::secrets_manager::secrets::SecretsDeleteResponse, + }; + // Same as above, but for the internal feature + #[cfg(feature = "internal")] write_schema_for_response! { - auth::response::PasswordLoginResponse, - auth::response::ApiKeyLoginResponse, - response::user_api_key_response::UserApiKeyResponse, - response::sync_response::SyncResponse, - response::secrets_response::SecretResponse, - response::secrets_response::SecretIdentifiersResponse, - response::secrets_response::SecretIdentifierResponse, - response::secrets_response::SecretsDeleteResponse, - response::secrets_response::SecretDeleteResponse, + bitwarden::platform::SyncResponse, + bitwarden::platform::UserApiKeyResponse, }; Ok(()) diff --git a/languages/csharp/schemas.cs b/languages/csharp/schemas.cs index 4a7ab7f7d3..b9059a7107 100644 --- a/languages/csharp/schemas.cs +++ b/languages/csharp/schemas.cs @@ -8,13 +8,9 @@ // var command = Command.FromJson(jsonString); // var responseForApiKeyLoginResponse = ResponseForApiKeyLoginResponse.FromJson(jsonString); // var responseForPasswordLoginResponse = ResponseForPasswordLoginResponse.FromJson(jsonString); -// var responseForSecretDeleteResponse = ResponseForSecretDeleteResponse.FromJson(jsonString); -// var responseForSecretIdentifierResponse = ResponseForSecretIdentifierResponse.FromJson(jsonString); // var responseForSecretIdentifiersResponse = ResponseForSecretIdentifiersResponse.FromJson(jsonString); // var responseForSecretResponse = ResponseForSecretResponse.FromJson(jsonString); // var responseForSecretsDeleteResponse = ResponseForSecretsDeleteResponse.FromJson(jsonString); -// var responseForSyncResponse = ResponseForSyncResponse.FromJson(jsonString); -// var responseForUserApiKeyResponse = ResponseForUserApiKeyResponse.FromJson(jsonString); namespace Bit.Sdk { @@ -32,7 +28,7 @@ namespace Bit.Sdk /// /// Defaults to /// - /// ``` # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; # use + /// ``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; # use /// assert_matches::assert_matches; 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(), @@ -719,69 +715,6 @@ public partial class FluffyYubiKey public bool Nfc { get; set; } } - public partial class ResponseForSecretDeleteResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public SecretDeleteResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class SecretDeleteResponse - { - [JsonProperty("error")] - public string Error { get; set; } - - [JsonProperty("id")] - public Guid Id { get; set; } - } - - public partial class ResponseForSecretIdentifierResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public SecretIdentifierResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class SecretIdentifierResponse - { - [JsonProperty("id")] - public Guid Id { get; set; } - - [JsonProperty("key")] - public string Key { get; set; } - - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - } - public partial class ResponseForSecretIdentifiersResponse { /// @@ -806,10 +739,10 @@ public partial class ResponseForSecretIdentifiersResponse public partial class SecretIdentifiersResponse { [JsonProperty("data")] - public DatumElement[] Data { get; set; } + public SecretIdentifierResponse[] Data { get; set; } } - public partial class DatumElement + public partial class SecretIdentifierResponse { [JsonProperty("id")] public Guid Id { get; set; } @@ -896,10 +829,10 @@ public partial class ResponseForSecretsDeleteResponse public partial class SecretsDeleteResponse { [JsonProperty("data")] - public DatumClass[] Data { get; set; } + public SecretDeleteResponse[] Data { get; set; } } - public partial class DatumClass + public partial class SecretDeleteResponse { [JsonProperty("error")] public string Error { get; set; } @@ -908,102 +841,6 @@ public partial class DatumClass public Guid Id { get; set; } } - public partial class ResponseForSyncResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public SyncResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class SyncResponse - { - /// - /// List of ciphers accesible by the user - /// - [JsonProperty("ciphers")] - public CipherDetailsResponse[] Ciphers { get; set; } - - /// - /// Data about the user, including their encryption keys and the organizations they are a - /// part of - /// - [JsonProperty("profile")] - public ProfileResponse Profile { get; set; } - } - - public partial class CipherDetailsResponse - { - } - - /// - /// Data about the user, including their encryption keys and the organizations they are a - /// part of - /// - public partial class ProfileResponse - { - [JsonProperty("email")] - public string Email { get; set; } - - [JsonProperty("id")] - public Guid Id { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("organizations")] - public ProfileOrganizationResponse[] Organizations { get; set; } - } - - public partial class ProfileOrganizationResponse - { - [JsonProperty("id")] - public Guid Id { get; set; } - } - - public partial class ResponseForUserApiKeyResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public UserApiKeyResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class UserApiKeyResponse - { - /// - /// The user's API key, which represents the client_secret portion of an oauth request. - /// - [JsonProperty("apiKey")] - public string ApiKey { get; set; } - } - /// /// Device type to send to Bitwarden. Defaults to SDK /// @@ -1029,16 +866,6 @@ public partial class ResponseForPasswordLoginResponse public static ResponseForPasswordLoginResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); } - public partial class ResponseForSecretDeleteResponse - { - public static ResponseForSecretDeleteResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class ResponseForSecretIdentifierResponse - { - public static ResponseForSecretIdentifierResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - public partial class ResponseForSecretIdentifiersResponse { public static ResponseForSecretIdentifiersResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); @@ -1054,29 +881,15 @@ public partial class ResponseForSecretsDeleteResponse public static ResponseForSecretsDeleteResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); } - public partial class ResponseForSyncResponse - { - public static ResponseForSyncResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class ResponseForUserApiKeyResponse - { - public static ResponseForUserApiKeyResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - public static class Serialize { public static string ToJson(this ClientSettings self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this Command self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForApiKeyLoginResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForPasswordLoginResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForSecretDeleteResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForSecretIdentifierResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForSecretIdentifiersResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForSecretResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForSecretsDeleteResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForSyncResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForUserApiKeyResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); } internal static class Converter diff --git a/languages/js_webassembly/bitwarden_client/schemas.ts b/languages/js_webassembly/bitwarden_client/schemas.ts index c1322bdfc1..809bd3f321 100644 --- a/languages/js_webassembly/bitwarden_client/schemas.ts +++ b/languages/js_webassembly/bitwarden_client/schemas.ts @@ -1,18 +1,14 @@ // To parse this data: // -// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretDeleteResponse, ResponseForSecretIdentifierResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse, ResponseForSyncResponse, ResponseForUserAPIKeyResponse } from "./file"; +// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse } from "./file"; // // const clientSettings = Convert.toClientSettings(json); // const command = Convert.toCommand(json); // const responseForAPIKeyLoginResponse = Convert.toResponseForAPIKeyLoginResponse(json); // const responseForPasswordLoginResponse = Convert.toResponseForPasswordLoginResponse(json); -// const responseForSecretDeleteResponse = Convert.toResponseForSecretDeleteResponse(json); -// const responseForSecretIdentifierResponse = Convert.toResponseForSecretIdentifierResponse(json); // const responseForSecretIdentifiersResponse = Convert.toResponseForSecretIdentifiersResponse(json); // const responseForSecretResponse = Convert.toResponseForSecretResponse(json); // const responseForSecretsDeleteResponse = Convert.toResponseForSecretsDeleteResponse(json); -// const responseForSyncResponse = Convert.toResponseForSyncResponse(json); -// const responseForUserAPIKeyResponse = Convert.toResponseForUserAPIKeyResponse(json); // // These functions will throw an error if the JSON doesn't // match the expected interface, even if the JSON is valid. @@ -24,7 +20,7 @@ * * Defaults to * - * ``` # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; # use + * ``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; # use * assert_matches::assert_matches; 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(), @@ -549,47 +545,6 @@ export interface FluffyYubiKey { nfc: boolean; } -export interface ResponseForSecretDeleteResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretDeleteResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretDeleteResponse { - error?: null | string; - id: string; -} - -export interface ResponseForSecretIdentifierResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretIdentifierResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretIdentifierResponse { - id: string; - key: string; - organizationId: string; -} - export interface ResponseForSecretIdentifiersResponse { /** * The response data. Populated if `success` is true. @@ -606,10 +561,10 @@ export interface ResponseForSecretIdentifiersResponse { } export interface SecretIdentifiersResponse { - data: DatumElement[]; + data: SecretIdentifierResponse[]; } -export interface DatumElement { +export interface SecretIdentifierResponse { id: string; key: string; organizationId: string; @@ -658,81 +613,14 @@ export interface ResponseForSecretsDeleteResponse { } export interface SecretsDeleteResponse { - data: DatumClass[]; + data: SecretDeleteResponse[]; } -export interface DatumClass { +export interface SecretDeleteResponse { error?: null | string; id: string; } -export interface ResponseForSyncResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SyncResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SyncResponse { - /** - * List of ciphers accesible by the user - */ - ciphers: CipherDetailsResponse[]; - /** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ - profile: ProfileResponse; -} - -export interface CipherDetailsResponse { -} - -/** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ -export interface ProfileResponse { - email: string; - id: string; - name: string; - organizations: ProfileOrganizationResponse[]; -} - -export interface ProfileOrganizationResponse { - id: string; -} - -export interface ResponseForUserAPIKeyResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: UserAPIKeyResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface UserAPIKeyResponse { - /** - * The user's API key, which represents the client_secret portion of an oauth request. - */ - apiKey: string; -} - // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { @@ -768,22 +656,6 @@ export class Convert { return JSON.stringify(uncast(value, r("ResponseForPasswordLoginResponse")), null, 2); } - public static toResponseForSecretDeleteResponse(json: string): ResponseForSecretDeleteResponse { - return cast(JSON.parse(json), r("ResponseForSecretDeleteResponse")); - } - - public static responseForSecretDeleteResponseToJson(value: ResponseForSecretDeleteResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretDeleteResponse")), null, 2); - } - - public static toResponseForSecretIdentifierResponse(json: string): ResponseForSecretIdentifierResponse { - return cast(JSON.parse(json), r("ResponseForSecretIdentifierResponse")); - } - - public static responseForSecretIdentifierResponseToJson(value: ResponseForSecretIdentifierResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretIdentifierResponse")), null, 2); - } - public static toResponseForSecretIdentifiersResponse(json: string): ResponseForSecretIdentifiersResponse { return cast(JSON.parse(json), r("ResponseForSecretIdentifiersResponse")); } @@ -807,22 +679,6 @@ export class Convert { public static responseForSecretsDeleteResponseToJson(value: ResponseForSecretsDeleteResponse): string { return JSON.stringify(uncast(value, r("ResponseForSecretsDeleteResponse")), null, 2); } - - public static toResponseForSyncResponse(json: string): ResponseForSyncResponse { - return cast(JSON.parse(json), r("ResponseForSyncResponse")); - } - - public static responseForSyncResponseToJson(value: ResponseForSyncResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSyncResponse")), null, 2); - } - - public static toResponseForUserAPIKeyResponse(json: string): ResponseForUserAPIKeyResponse { - return cast(JSON.parse(json), r("ResponseForUserAPIKeyResponse")); - } - - public static responseForUserAPIKeyResponseToJson(value: ResponseForUserAPIKeyResponse): string { - return JSON.stringify(uncast(value, r("ResponseForUserAPIKeyResponse")), null, 2); - } } function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { @@ -1148,34 +1004,15 @@ const typeMap: any = { "FluffyYubiKey": o([ { json: "nfc", js: "nfc", typ: true }, ], false), - "ResponseForSecretDeleteResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretDeleteResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretDeleteResponse": o([ - { json: "error", js: "error", typ: u(undefined, u(null, "")) }, - { json: "id", js: "id", typ: "" }, - ], false), - "ResponseForSecretIdentifierResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretIdentifierResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretIdentifierResponse": o([ - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), "ResponseForSecretIdentifiersResponse": o([ { json: "data", js: "data", typ: u(undefined, u(r("SecretIdentifiersResponse"), null)) }, { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, { json: "success", js: "success", typ: true }, ], false), "SecretIdentifiersResponse": o([ - { json: "data", js: "data", typ: a(r("DatumElement")) }, + { json: "data", js: "data", typ: a(r("SecretIdentifierResponse")) }, ], false), - "DatumElement": o([ + "SecretIdentifierResponse": o([ { json: "id", js: "id", typ: "" }, { json: "key", js: "key", typ: "" }, { json: "organizationId", js: "organizationId", typ: "" }, @@ -1202,40 +1039,12 @@ const typeMap: any = { { json: "success", js: "success", typ: true }, ], false), "SecretsDeleteResponse": o([ - { json: "data", js: "data", typ: a(r("DatumClass")) }, + { json: "data", js: "data", typ: a(r("SecretDeleteResponse")) }, ], false), - "DatumClass": o([ + "SecretDeleteResponse": o([ { json: "error", js: "error", typ: u(undefined, u(null, "")) }, { json: "id", js: "id", typ: "" }, ], false), - "ResponseForSyncResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SyncResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SyncResponse": o([ - { json: "ciphers", js: "ciphers", typ: a(r("CipherDetailsResponse")) }, - { json: "profile", js: "profile", typ: r("ProfileResponse") }, - ], false), - "CipherDetailsResponse": o([ - ], false), - "ProfileResponse": o([ - { json: "email", js: "email", typ: "" }, - { json: "id", js: "id", typ: "" }, - { json: "name", js: "name", typ: "" }, - { json: "organizations", js: "organizations", typ: a(r("ProfileOrganizationResponse")) }, - ], false), - "ProfileOrganizationResponse": o([ - { json: "id", js: "id", typ: "" }, - ], false), - "ResponseForUserAPIKeyResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("UserAPIKeyResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "UserAPIKeyResponse": o([ - { json: "apiKey", js: "apiKey", typ: "" }, - ], false), "DeviceType": [ "Android", "AndroidAmazon", diff --git a/languages/python/BitwardenClient/schemas.py b/languages/python/BitwardenClient/schemas.py index 592b761f2c..a70b3e9f56 100644 --- a/languages/python/BitwardenClient/schemas.py +++ b/languages/python/BitwardenClient/schemas.py @@ -81,7 +81,7 @@ class ClientSettings: Defaults to - ``` # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; # use + ``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; # use assert_matches::assert_matches; 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(), @@ -1081,53 +1081,6 @@ def to_dict(self) -> dict: return result -@dataclass -class SecretDeleteResponse: - id: UUID - error: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'SecretDeleteResponse': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - error = from_union([from_none, from_str], obj.get("error")) - return SecretDeleteResponse(id, error) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - if self.error is not None: - result["error"] = from_union([from_none, from_str], self.error) - return result - - -@dataclass -class ResponseForSecretDeleteResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[SecretDeleteResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForSecretDeleteResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([SecretDeleteResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForSecretDeleteResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(SecretDeleteResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - @dataclass class SecretIdentifierResponse: id: UUID @@ -1150,68 +1103,19 @@ def to_dict(self) -> dict: return result -@dataclass -class ResponseForSecretIdentifierResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[SecretIdentifierResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForSecretIdentifierResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([SecretIdentifierResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForSecretIdentifierResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(SecretIdentifierResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - -@dataclass -class DatumElement: - id: UUID - key: str - organization_id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'DatumElement': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - key = from_str(obj.get("key")) - organization_id = UUID(obj.get("organizationId")) - return DatumElement(id, key, organization_id) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - result["key"] = from_str(self.key) - result["organizationId"] = str(self.organization_id) - return result - - @dataclass class SecretIdentifiersResponse: - data: List[DatumElement] + data: List[SecretIdentifierResponse] @staticmethod def from_dict(obj: Any) -> 'SecretIdentifiersResponse': assert isinstance(obj, dict) - data = from_list(DatumElement.from_dict, obj.get("data")) + data = from_list(SecretIdentifierResponse.from_dict, obj.get("data")) return SecretIdentifiersResponse(data) def to_dict(self) -> dict: result: dict = {} - result["data"] = from_list(lambda x: to_class(DatumElement, x), self.data) + result["data"] = from_list(lambda x: to_class(SecretIdentifierResponse, x), self.data) return result @@ -1311,16 +1215,16 @@ def to_dict(self) -> dict: @dataclass -class DatumClass: +class SecretDeleteResponse: id: UUID error: Optional[str] = None @staticmethod - def from_dict(obj: Any) -> 'DatumClass': + def from_dict(obj: Any) -> 'SecretDeleteResponse': assert isinstance(obj, dict) id = UUID(obj.get("id")) error = from_union([from_none, from_str], obj.get("error")) - return DatumClass(id, error) + return SecretDeleteResponse(id, error) def to_dict(self) -> dict: result: dict = {} @@ -1332,17 +1236,17 @@ def to_dict(self) -> dict: @dataclass class SecretsDeleteResponse: - data: List[DatumClass] + data: List[SecretDeleteResponse] @staticmethod def from_dict(obj: Any) -> 'SecretsDeleteResponse': assert isinstance(obj, dict) - data = from_list(DatumClass.from_dict, obj.get("data")) + data = from_list(SecretDeleteResponse.from_dict, obj.get("data")) return SecretsDeleteResponse(data) def to_dict(self) -> dict: result: dict = {} - result["data"] = from_list(lambda x: to_class(DatumClass, x), self.data) + result["data"] = from_list(lambda x: to_class(SecretDeleteResponse, x), self.data) return result @@ -1373,158 +1277,6 @@ def to_dict(self) -> dict: return result -@dataclass -class CipherDetailsResponse: - pass - - @staticmethod - def from_dict(obj: Any) -> 'CipherDetailsResponse': - assert isinstance(obj, dict) - return CipherDetailsResponse() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class ProfileOrganizationResponse: - id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'ProfileOrganizationResponse': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - return ProfileOrganizationResponse(id) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - return result - - -@dataclass -class ProfileResponse: - """Data about the user, including their encryption keys and the organizations they are a - part of - """ - email: str - id: UUID - name: str - organizations: List[ProfileOrganizationResponse] - - @staticmethod - def from_dict(obj: Any) -> 'ProfileResponse': - assert isinstance(obj, dict) - email = from_str(obj.get("email")) - id = UUID(obj.get("id")) - name = from_str(obj.get("name")) - organizations = from_list(ProfileOrganizationResponse.from_dict, obj.get("organizations")) - return ProfileResponse(email, id, name, organizations) - - def to_dict(self) -> dict: - result: dict = {} - result["email"] = from_str(self.email) - result["id"] = str(self.id) - result["name"] = from_str(self.name) - result["organizations"] = from_list(lambda x: to_class(ProfileOrganizationResponse, x), self.organizations) - return result - - -@dataclass -class SyncResponse: - """List of ciphers accesible by the user""" - ciphers: List[CipherDetailsResponse] - """Data about the user, including their encryption keys and the organizations they are a - part of - """ - profile: ProfileResponse - - @staticmethod - def from_dict(obj: Any) -> 'SyncResponse': - assert isinstance(obj, dict) - ciphers = from_list(CipherDetailsResponse.from_dict, obj.get("ciphers")) - profile = ProfileResponse.from_dict(obj.get("profile")) - return SyncResponse(ciphers, profile) - - def to_dict(self) -> dict: - result: dict = {} - result["ciphers"] = from_list(lambda x: to_class(CipherDetailsResponse, x), self.ciphers) - result["profile"] = to_class(ProfileResponse, self.profile) - return result - - -@dataclass -class ResponseForSyncResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[SyncResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForSyncResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([SyncResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForSyncResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(SyncResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - -@dataclass -class UserAPIKeyResponse: - """The user's API key, which represents the client_secret portion of an oauth request.""" - api_key: str - - @staticmethod - def from_dict(obj: Any) -> 'UserAPIKeyResponse': - assert isinstance(obj, dict) - api_key = from_str(obj.get("apiKey")) - return UserAPIKeyResponse(api_key) - - def to_dict(self) -> dict: - result: dict = {} - result["apiKey"] = from_str(self.api_key) - return result - - -@dataclass -class ResponseForUserAPIKeyResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[UserAPIKeyResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForUserAPIKeyResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([UserAPIKeyResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForUserAPIKeyResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(UserAPIKeyResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - def client_settings_from_dict(s: Any) -> ClientSettings: return ClientSettings.from_dict(s) @@ -1557,22 +1309,6 @@ def response_for_password_login_response_to_dict(x: ResponseForPasswordLoginResp return to_class(ResponseForPasswordLoginResponse, x) -def response_for_secret_delete_response_from_dict(s: Any) -> ResponseForSecretDeleteResponse: - return ResponseForSecretDeleteResponse.from_dict(s) - - -def response_for_secret_delete_response_to_dict(x: ResponseForSecretDeleteResponse) -> Any: - return to_class(ResponseForSecretDeleteResponse, x) - - -def response_for_secret_identifier_response_from_dict(s: Any) -> ResponseForSecretIdentifierResponse: - return ResponseForSecretIdentifierResponse.from_dict(s) - - -def response_for_secret_identifier_response_to_dict(x: ResponseForSecretIdentifierResponse) -> Any: - return to_class(ResponseForSecretIdentifierResponse, x) - - def response_for_secret_identifiers_response_from_dict(s: Any) -> ResponseForSecretIdentifiersResponse: return ResponseForSecretIdentifiersResponse.from_dict(s) @@ -1596,19 +1332,3 @@ def response_for_secrets_delete_response_from_dict(s: Any) -> ResponseForSecrets def response_for_secrets_delete_response_to_dict(x: ResponseForSecretsDeleteResponse) -> Any: return to_class(ResponseForSecretsDeleteResponse, x) - -def response_for_sync_response_from_dict(s: Any) -> ResponseForSyncResponse: - return ResponseForSyncResponse.from_dict(s) - - -def response_for_sync_response_to_dict(x: ResponseForSyncResponse) -> Any: - return to_class(ResponseForSyncResponse, x) - - -def response_for_user_api_key_response_from_dict(s: Any) -> ResponseForUserAPIKeyResponse: - return ResponseForUserAPIKeyResponse.from_dict(s) - - -def response_for_user_api_key_response_to_dict(x: ResponseForUserAPIKeyResponse) -> Any: - return to_class(ResponseForUserAPIKeyResponse, x) - diff --git a/support/schemas/request/ClientSettings.json b/support/schemas/bitwarden/client/ClientSettings.json similarity index 77% rename from support/schemas/request/ClientSettings.json rename to support/schemas/bitwarden/client/ClientSettings.json index 78d926b5f3..aa321c42a1 100644 --- a/support/schemas/request/ClientSettings.json +++ b/support/schemas/bitwarden/client/ClientSettings.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "ClientSettings", - "description": "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.\n\nDefaults to\n\n``` # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; # use assert_matches::assert_matches; 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(); assert_matches!(settings, default); ```\n\nTargets `localhost:8080` for debug builds.", + "description": "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.\n\nDefaults to\n\n``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; # use assert_matches::assert_matches; 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(); assert_matches!(settings, default); ```\n\nTargets `localhost:8080` for debug builds.", "type": "object", "required": [ "apiUrl", diff --git a/support/schemas/request/Command.json b/support/schemas/bitwarden_json/Command.json similarity index 100% rename from support/schemas/request/Command.json rename to support/schemas/bitwarden_json/Command.json diff --git a/support/schemas/response/SecretDeleteResponse.json b/support/schemas/response/SecretDeleteResponse.json deleted file mode 100644 index 383ece5c1c..0000000000 --- a/support/schemas/response/SecretDeleteResponse.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_SecretDeleteResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/SecretDeleteResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "SecretDeleteResponse": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "error": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/SecretIdentifierResponse.json b/support/schemas/response/SecretIdentifierResponse.json deleted file mode 100644 index 79632f412a..0000000000 --- a/support/schemas/response/SecretIdentifierResponse.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_SecretIdentifierResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/SecretIdentifierResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "SecretIdentifierResponse": { - "type": "object", - "required": [ - "id", - "key", - "organizationId" - ], - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "key": { - "type": "string" - }, - "organizationId": { - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/SyncResponse.json b/support/schemas/response/SyncResponse.json deleted file mode 100644 index 6c149ab63e..0000000000 --- a/support/schemas/response/SyncResponse.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_SyncResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/SyncResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "CipherDetailsResponse": { - "type": "object", - "additionalProperties": false - }, - "ProfileOrganizationResponse": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "ProfileResponse": { - "type": "object", - "required": [ - "email", - "id", - "name", - "organizations" - ], - "properties": { - "email": { - "type": "string" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string" - }, - "organizations": { - "type": "array", - "items": { - "$ref": "#/definitions/ProfileOrganizationResponse" - } - } - }, - "additionalProperties": false - }, - "SyncResponse": { - "type": "object", - "required": [ - "ciphers", - "profile" - ], - "properties": { - "ciphers": { - "description": "List of ciphers accesible by the user", - "type": "array", - "items": { - "$ref": "#/definitions/CipherDetailsResponse" - } - }, - "profile": { - "description": "Data about the user, including their encryption keys and the organizations they are a part of", - "allOf": [ - { - "$ref": "#/definitions/ProfileResponse" - } - ] - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/UserApiKeyResponse.json b/support/schemas/response/UserApiKeyResponse.json deleted file mode 100644 index cf7bae88e2..0000000000 --- a/support/schemas/response/UserApiKeyResponse.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_UserApiKeyResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/UserApiKeyResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "UserApiKeyResponse": { - "type": "object", - "required": [ - "apiKey" - ], - "properties": { - "apiKey": { - "description": "The user's API key, which represents the client_secret portion of an oauth request.", - "type": "string" - } - }, - "additionalProperties": false - } - } -} From a996478991aedbaac34f5ec27591c487b44c279e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 27 Jun 2023 12:15:08 +0200 Subject: [PATCH 04/32] Enable some optimization flags (#71) --- Cargo.toml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index d02b0e9bff..8bf86ff560 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,22 @@ [workspace] members = ["crates/*"] + +# Compile all dependencies with some optimizations when building this crate on debug +# This slows down clean builds by about 50%, but the resulting binaries can be orders of magnitude faster +# As clean builds won't occur very often, this won't slow down the development process +[profile.dev.package."*"] +opt-level = 2 + +# Turn on a small amount of optimisation in development mode. This might interfere when trying to use a debugger +# if the compiler decides to optimize some code away, if that's the case, it can be set to 0 or commented out +[profile.dev] +opt-level = 1 + +# Turn on LTO on release mode +[profile.release] +lto = "thin" +codegen-units = 1 +# Stripping the binary reduces the size by ~30%, but the stacktraces won't be usable anymore. +# This is fine as long as we don't have any unhandled panics, but let's keep it disabled for now +# strip = true From eb8d3c83977b918836f4d94ec78f8dfa8c7783f0 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 27 Jun 2023 19:26:17 +0200 Subject: [PATCH 05/32] Move all tests to test workflow (#79) --- .github/workflows/build-cli.yml | 6 ------ .github/workflows/build-rust-crates.yml | 6 ------ .github/workflows/rust-test.yml | 11 +---------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 400714bebf..72f16c11b9 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -82,12 +82,6 @@ jobs: TARGET: ${{ matrix.settings.target }} run: cargo build ${{ matrix.features }} -p bws --release --target=${{ matrix.settings.target }} - - name: Test - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 - with: - command: test - args: -p bws -- --test-threads=1 - - name: Zip Windows shell: cmd if: runner.os == 'Windows' diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index 39baaae0e0..ab0c92ca0b 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -75,12 +75,6 @@ jobs: command: build args: ${{ matrix.features }} -p ${{ matrix.package }} --features internal --release - - name: Test - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 - with: - command: test - args: -p ${{ matrix.package }} -- --test-threads=1 - release-dry-run: name: Release dry-run runs-on: ubuntu-latest diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index a9e40acf36..55e56f0d07 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -20,7 +20,7 @@ jobs: - run: exit 0 test: - name: ${{ matrix.os }} / ${{matrix.package}} / ${{matrix.target || 'default' }} + name: ${{ matrix.os }} / ${{matrix.target || 'default' }} runs-on: ${{ matrix.os || 'ubuntu-latest' }} @@ -31,13 +31,6 @@ jobs: - macOS-latest - windows-latest - package: - - bitwarden - - bitwarden-json - - bitwarden-c - - bitwarden-wasm - - bws - steps: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 @@ -57,13 +50,11 @@ jobs: uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 with: command: build - args: ${{ matrix.features }} - name: Test uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 with: command: test - args: -p ${{ matrix.package }} -- --test-threads=1 wasm: name: WASM From d56ec43af4b8d2d961b7873949c948908d561eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Fri, 30 Jun 2023 15:28:22 +0200 Subject: [PATCH 06/32] Remove unnecessary string copy (#81) --- crates/bitwarden-json/src/response.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/bitwarden-json/src/response.rs b/crates/bitwarden-json/src/response.rs index 19392231c2..031a994544 100644 --- a/crates/bitwarden-json/src/response.rs +++ b/crates/bitwarden-json/src/response.rs @@ -30,10 +30,10 @@ impl Response { } } - pub fn error(message: &str) -> Self { + pub fn error(message: String) -> Self { Self { success: false, - error_message: Some(message.into()), + error_message: Some(message), data: None, } } @@ -47,7 +47,7 @@ impl ResponseIntoString for Result { fn into_string(self) -> String { match serde_json::to_string(&Response::new(self)) { Ok(ser) => ser, - Err(e) => serde_json::to_string(&Response::::error(&format!( + Err(e) => serde_json::to_string(&Response::::error(format!( "Failed to serialize Response: {}", e ))) From 8b3fd80ed72461760952ece90f3057711d791c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Fri, 30 Jun 2023 15:59:25 +0200 Subject: [PATCH 07/32] Fix invalid return types in schemas (#80) * Fix invalid return types in schemas * Catch broken links in docs (#82) --------- Co-authored-by: Oscar Hinton --- .github/workflows/lint.yml | 5 +++ crates/bitwarden-json/src/command.rs | 30 +++++++++--------- .../src-ts/bitwarden_client/schemas.ts | 31 +++++++++---------- languages/csharp/schemas.cs | 31 +++++++++---------- .../bitwarden_client/schemas.ts | 31 +++++++++---------- languages/python/BitwardenClient/schemas.py | 31 +++++++++---------- support/schemas/bitwarden_json/Command.json | 30 +++++++++--------- 7 files changed, 95 insertions(+), 94 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 582dc1aea4..cac283e9fc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -55,3 +55,8 @@ jobs: >&2 echo "Failed: Found untracked files!" exit 1 fi + + - name: Verify rust documentation links + run: cargo doc --no-deps --features internal + env: + RUSTDOCFLAGS: "-D warnings" diff --git a/crates/bitwarden-json/src/command.rs b/crates/bitwarden-json/src/command.rs index d61afec723..e88307afa1 100644 --- a/crates/bitwarden-json/src/command.rs +++ b/crates/bitwarden-json/src/command.rs @@ -32,7 +32,7 @@ pub enum Command { /// /// This command is not capable of handling authentication requiring 2fa or captcha. /// - /// Returns: [PasswordLoginResponse](crate::sdk::auth::response::PasswordLoginResponse) + /// Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) /// PasswordLogin(PasswordLoginRequest), @@ -41,7 +41,7 @@ pub enum Command { /// /// This command is for initiating an authentication handshake with Bitwarden. /// - /// Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + /// Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) /// ApiKeyLogin(ApiKeyLoginRequest), @@ -49,7 +49,7 @@ pub enum Command { /// /// This command is for initiating an authentication handshake with Bitwarden. /// - /// Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + /// Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) /// AccessTokenLogin(AccessTokenLoginRequest), @@ -57,7 +57,7 @@ pub enum Command { /// > Requires Authentication /// Get the API key of the currently authenticated user /// - /// Returns: [UserApiKeyResponse](crate::sdk::response::user_api_key_response::UserApiKeyResponse) + /// Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) /// GetUserApiKey(SecretVerificationRequest), @@ -72,7 +72,7 @@ pub enum Command { /// > Requires Authentication /// Retrieve all user data, ciphers and organizations the user is a part of /// - /// Returns: [SyncResponse](crate::sdk::response::sync_response::SyncResponse) + /// Returns: [SyncResponse](bitwarden::platform::SyncResponse) /// Sync(SyncRequest), @@ -87,7 +87,7 @@ pub enum SecretsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Retrieve a secret by the provided identifier /// - /// Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) /// Get(SecretGetRequest), @@ -95,7 +95,7 @@ pub enum SecretsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Creates a new secret in the provided organization using the given data /// - /// Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) /// Create(SecretCreateRequest), @@ -103,7 +103,7 @@ pub enum SecretsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Lists all secret identifiers of the given organization, to then retrieve each secret, use `CreateSecret` /// - /// Returns: [SecretIdentifiersResponse](crate::sdk::response::secrets_response::SecretIdentifiersResponse) + /// Returns: [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) /// List(SecretIdentifiersRequest), @@ -111,7 +111,7 @@ pub enum SecretsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Updates an existing secret with the provided ID using the given data /// - /// Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) /// Update(SecretPutRequest), @@ -119,7 +119,7 @@ pub enum SecretsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Deletes all the secrets whose IDs match the provided ones /// - /// Returns: [SecretsDeleteResponse](crate::sdk::response::secrets_response::SecretsDeleteResponse) + /// Returns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) /// Delete(SecretsDeleteRequest), } @@ -131,7 +131,7 @@ pub enum ProjectsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Retrieve a project by the provided identifier /// - /// Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) /// Get(ProjectGetRequest), @@ -139,7 +139,7 @@ pub enum ProjectsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Creates a new project in the provided organization using the given data /// - /// Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) /// Create(ProjectCreateRequest), @@ -147,7 +147,7 @@ pub enum ProjectsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Lists all projects of the given organization /// - /// Returns: [ProjectsResponse](crate::sdk::response::projects_response::ProjectsResponse) + /// Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) /// List(ProjectsListRequest), @@ -155,7 +155,7 @@ pub enum ProjectsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Updates an existing project with the provided ID using the given data /// - /// Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) /// Update(ProjectPutRequest), @@ -163,7 +163,7 @@ pub enum ProjectsCommand { /// > Requires using an Access Token for login or calling Sync at least once /// Deletes all the projects whose IDs match the provided ones /// - /// Returns: [ProjectsDeleteResponse](crate::sdk::response::projects_response::ProjectsDeleteResponse) + /// Returns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) /// Delete(ProjectsDeleteRequest), } diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts index 809bd3f321..a0c9e3064f 100644 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts +++ b/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts @@ -86,24 +86,23 @@ export enum DeviceType { * * This command is not capable of handling authentication requiring 2fa or captcha. * - * Returns: [PasswordLoginResponse](crate::sdk::auth::response::PasswordLoginResponse) + * Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) * * Login with API Key * * This command is for initiating an authentication handshake with Bitwarden. * - * Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) * * Login with Secrets Manager Access Token * * This command is for initiating an authentication handshake with Bitwarden. * - * Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) * * > Requires Authentication Get the API key of the currently authenticated user * - * Returns: - * [UserApiKeyResponse](crate::sdk::response::user_api_key_response::UserApiKeyResponse) + * Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) * * Get the user's passphrase * @@ -112,7 +111,7 @@ export enum DeviceType { * > Requires Authentication Retrieve all user data, ciphers and organizations the user is a * part of * - * Returns: [SyncResponse](crate::sdk::response::sync_response::SyncResponse) + * Returns: [SyncResponse](bitwarden::platform::SyncResponse) */ export interface Command { passwordLogin?: PasswordLoginRequest; @@ -196,28 +195,28 @@ export interface PasswordLoginRequest { * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Retrieve a project by the provided identifier * - * Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Creates a new project in the provided organization using the given data * - * Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Lists all projects of the given organization * - * Returns: [ProjectsResponse](crate::sdk::response::projects_response::ProjectsResponse) + * Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Updates an existing project with the provided ID using the given data * - * Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Deletes all the projects whose IDs match the provided ones * * Returns: - * [ProjectsDeleteResponse](crate::sdk::response::projects_response::ProjectsDeleteResponse) + * [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) */ export interface ProjectsCommand { get?: ProjectGetRequest; @@ -272,30 +271,30 @@ export interface ProjectPutRequest { * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Retrieve a secret by the provided identifier * - * Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Creates a new secret in the provided organization using the given data * - * Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Lists all secret identifiers of the given organization, to then retrieve each * secret, use `CreateSecret` * * Returns: - * [SecretIdentifiersResponse](crate::sdk::response::secrets_response::SecretIdentifiersResponse) + * [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Updates an existing secret with the provided ID using the given data * - * Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Deletes all the secrets whose IDs match the provided ones * * Returns: - * [SecretsDeleteResponse](crate::sdk::response::secrets_response::SecretsDeleteResponse) + * [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) */ export interface SecretsCommand { get?: SecretGetRequest; diff --git a/languages/csharp/schemas.cs b/languages/csharp/schemas.cs index b9059a7107..4ed30c1552 100644 --- a/languages/csharp/schemas.cs +++ b/languages/csharp/schemas.cs @@ -74,24 +74,23 @@ public partial class ClientSettings /// /// This command is not capable of handling authentication requiring 2fa or captcha. /// - /// Returns: [PasswordLoginResponse](crate::sdk::auth::response::PasswordLoginResponse) + /// Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) /// /// Login with API Key /// /// This command is for initiating an authentication handshake with Bitwarden. /// - /// Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + /// Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) /// /// Login with Secrets Manager Access Token /// /// This command is for initiating an authentication handshake with Bitwarden. /// - /// Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + /// Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) /// /// > Requires Authentication Get the API key of the currently authenticated user /// - /// Returns: - /// [UserApiKeyResponse](crate::sdk::response::user_api_key_response::UserApiKeyResponse) + /// Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) /// /// Get the user's passphrase /// @@ -100,7 +99,7 @@ public partial class ClientSettings /// > Requires Authentication Retrieve all user data, ciphers and organizations the user is a /// part of /// - /// Returns: [SyncResponse](crate::sdk::response::sync_response::SyncResponse) + /// Returns: [SyncResponse](bitwarden::platform::SyncResponse) /// public partial class Command { @@ -220,28 +219,28 @@ public partial class PasswordLoginRequest /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Retrieve a project by the provided identifier /// - /// Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Creates a new project in the provided organization using the given data /// - /// Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Lists all projects of the given organization /// - /// Returns: [ProjectsResponse](crate::sdk::response::projects_response::ProjectsResponse) + /// Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Updates an existing project with the provided ID using the given data /// - /// Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Deletes all the projects whose IDs match the provided ones /// /// Returns: - /// [ProjectsDeleteResponse](crate::sdk::response::projects_response::ProjectsDeleteResponse) + /// [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) /// public partial class ProjectsCommand { @@ -322,30 +321,30 @@ public partial class ProjectPutRequest /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Retrieve a secret by the provided identifier /// - /// Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Creates a new secret in the provided organization using the given data /// - /// Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Lists all secret identifiers of the given organization, to then retrieve each /// secret, use `CreateSecret` /// /// Returns: - /// [SecretIdentifiersResponse](crate::sdk::response::secrets_response::SecretIdentifiersResponse) + /// [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Updates an existing secret with the provided ID using the given data /// - /// Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) /// /// > Requires Authentication > Requires using an Access Token for login or calling Sync at /// least once Deletes all the secrets whose IDs match the provided ones /// /// Returns: - /// [SecretsDeleteResponse](crate::sdk::response::secrets_response::SecretsDeleteResponse) + /// [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) /// public partial class SecretsCommand { diff --git a/languages/js_webassembly/bitwarden_client/schemas.ts b/languages/js_webassembly/bitwarden_client/schemas.ts index 809bd3f321..a0c9e3064f 100644 --- a/languages/js_webassembly/bitwarden_client/schemas.ts +++ b/languages/js_webassembly/bitwarden_client/schemas.ts @@ -86,24 +86,23 @@ export enum DeviceType { * * This command is not capable of handling authentication requiring 2fa or captcha. * - * Returns: [PasswordLoginResponse](crate::sdk::auth::response::PasswordLoginResponse) + * Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) * * Login with API Key * * This command is for initiating an authentication handshake with Bitwarden. * - * Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) * * Login with Secrets Manager Access Token * * This command is for initiating an authentication handshake with Bitwarden. * - * Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) * * > Requires Authentication Get the API key of the currently authenticated user * - * Returns: - * [UserApiKeyResponse](crate::sdk::response::user_api_key_response::UserApiKeyResponse) + * Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) * * Get the user's passphrase * @@ -112,7 +111,7 @@ export enum DeviceType { * > Requires Authentication Retrieve all user data, ciphers and organizations the user is a * part of * - * Returns: [SyncResponse](crate::sdk::response::sync_response::SyncResponse) + * Returns: [SyncResponse](bitwarden::platform::SyncResponse) */ export interface Command { passwordLogin?: PasswordLoginRequest; @@ -196,28 +195,28 @@ export interface PasswordLoginRequest { * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Retrieve a project by the provided identifier * - * Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Creates a new project in the provided organization using the given data * - * Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Lists all projects of the given organization * - * Returns: [ProjectsResponse](crate::sdk::response::projects_response::ProjectsResponse) + * Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Updates an existing project with the provided ID using the given data * - * Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Deletes all the projects whose IDs match the provided ones * * Returns: - * [ProjectsDeleteResponse](crate::sdk::response::projects_response::ProjectsDeleteResponse) + * [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) */ export interface ProjectsCommand { get?: ProjectGetRequest; @@ -272,30 +271,30 @@ export interface ProjectPutRequest { * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Retrieve a secret by the provided identifier * - * Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Creates a new secret in the provided organization using the given data * - * Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Lists all secret identifiers of the given organization, to then retrieve each * secret, use `CreateSecret` * * Returns: - * [SecretIdentifiersResponse](crate::sdk::response::secrets_response::SecretIdentifiersResponse) + * [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Updates an existing secret with the provided ID using the given data * - * Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) * * > Requires Authentication > Requires using an Access Token for login or calling Sync at * least once Deletes all the secrets whose IDs match the provided ones * * Returns: - * [SecretsDeleteResponse](crate::sdk::response::secrets_response::SecretsDeleteResponse) + * [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) */ export interface SecretsCommand { get?: SecretGetRequest; diff --git a/languages/python/BitwardenClient/schemas.py b/languages/python/BitwardenClient/schemas.py index a70b3e9f56..c116f47947 100644 --- a/languages/python/BitwardenClient/schemas.py +++ b/languages/python/BitwardenClient/schemas.py @@ -334,28 +334,28 @@ class ProjectsCommand: """> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a project by the provided identifier - Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new project in the provided organization using the given data - Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all projects of the given organization - Returns: [ProjectsResponse](crate::sdk::response::projects_response::ProjectsResponse) + Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing project with the provided ID using the given data - Returns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse) + Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones Returns: - [ProjectsDeleteResponse](crate::sdk::response::projects_response::ProjectsDeleteResponse) + [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) """ get: Optional[ProjectGetRequest] = None create: Optional[ProjectCreateRequest] = None @@ -505,30 +505,30 @@ class SecretsCommand: """> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a secret by the provided identifier - Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new secret in the provided organization using the given data - Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all secret identifiers of the given organization, to then retrieve each secret, use `CreateSecret` Returns: - [SecretIdentifiersResponse](crate::sdk::response::secrets_response::SecretIdentifiersResponse) + [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing secret with the provided ID using the given data - Returns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse) + Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) > Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones Returns: - [SecretsDeleteResponse](crate::sdk::response::secrets_response::SecretsDeleteResponse) + [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) """ get: Optional[SecretGetRequest] = None create: Optional[SecretCreateRequest] = None @@ -589,24 +589,23 @@ class Command: This command is not capable of handling authentication requiring 2fa or captcha. - Returns: [PasswordLoginResponse](crate::sdk::auth::response::PasswordLoginResponse) + Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) Login with API Key This command is for initiating an authentication handshake with Bitwarden. - Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) Login with Secrets Manager Access Token This command is for initiating an authentication handshake with Bitwarden. - Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) > Requires Authentication Get the API key of the currently authenticated user - Returns: - [UserApiKeyResponse](crate::sdk::response::user_api_key_response::UserApiKeyResponse) + Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) Get the user's passphrase @@ -615,7 +614,7 @@ class Command: > Requires Authentication Retrieve all user data, ciphers and organizations the user is a part of - Returns: [SyncResponse](crate::sdk::response::sync_response::SyncResponse) + Returns: [SyncResponse](bitwarden::platform::SyncResponse) """ password_login: Optional[PasswordLoginRequest] = None api_key_login: Optional[APIKeyLoginRequest] = None diff --git a/support/schemas/bitwarden_json/Command.json b/support/schemas/bitwarden_json/Command.json index bbfd9e9c6b..b65091fa97 100644 --- a/support/schemas/bitwarden_json/Command.json +++ b/support/schemas/bitwarden_json/Command.json @@ -3,7 +3,7 @@ "title": "Command", "oneOf": [ { - "description": "Login with username and password\n\nThis command is for initiating an authentication handshake with Bitwarden. Authorization may fail due to requiring 2fa or captcha challenge completion despite accurate credentials.\n\nThis command is not capable of handling authentication requiring 2fa or captcha.\n\nReturns: [PasswordLoginResponse](crate::sdk::auth::response::PasswordLoginResponse)", + "description": "Login with username and password\n\nThis command is for initiating an authentication handshake with Bitwarden. Authorization may fail due to requiring 2fa or captcha challenge completion despite accurate credentials.\n\nThis command is not capable of handling authentication requiring 2fa or captcha.\n\nReturns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse)", "type": "object", "required": [ "passwordLogin" @@ -16,7 +16,7 @@ "additionalProperties": false }, { - "description": "Login with API Key\n\nThis command is for initiating an authentication handshake with Bitwarden.\n\nReturns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse)", + "description": "Login with API Key\n\nThis command is for initiating an authentication handshake with Bitwarden.\n\nReturns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse)", "type": "object", "required": [ "apiKeyLogin" @@ -29,7 +29,7 @@ "additionalProperties": false }, { - "description": "Login with Secrets Manager Access Token\n\nThis command is for initiating an authentication handshake with Bitwarden.\n\nReturns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse)", + "description": "Login with Secrets Manager Access Token\n\nThis command is for initiating an authentication handshake with Bitwarden.\n\nReturns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse)", "type": "object", "required": [ "accessTokenLogin" @@ -42,7 +42,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication Get the API key of the currently authenticated user\n\nReturns: [UserApiKeyResponse](crate::sdk::response::user_api_key_response::UserApiKeyResponse)", + "description": "> Requires Authentication Get the API key of the currently authenticated user\n\nReturns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse)", "type": "object", "required": [ "getUserApiKey" @@ -68,7 +68,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication Retrieve all user data, ciphers and organizations the user is a part of\n\nReturns: [SyncResponse](crate::sdk::response::sync_response::SyncResponse)", + "description": "> Requires Authentication Retrieve all user data, ciphers and organizations the user is a part of\n\nReturns: [SyncResponse](bitwarden::platform::SyncResponse)", "type": "object", "required": [ "sync" @@ -240,7 +240,7 @@ "ProjectsCommand": { "oneOf": [ { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a project by the provided identifier\n\nReturns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a project by the provided identifier\n\nReturns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)", "type": "object", "required": [ "get" @@ -253,7 +253,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new project in the provided organization using the given data\n\nReturns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new project in the provided organization using the given data\n\nReturns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)", "type": "object", "required": [ "create" @@ -266,7 +266,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all projects of the given organization\n\nReturns: [ProjectsResponse](crate::sdk::response::projects_response::ProjectsResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all projects of the given organization\n\nReturns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse)", "type": "object", "required": [ "list" @@ -279,7 +279,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing project with the provided ID using the given data\n\nReturns: [ProjectResponse](crate::sdk::response::projects_response::ProjectResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing project with the provided ID using the given data\n\nReturns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)", "type": "object", "required": [ "update" @@ -292,7 +292,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones\n\nReturns: [ProjectsDeleteResponse](crate::sdk::response::projects_response::ProjectsDeleteResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones\n\nReturns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse)", "type": "object", "required": [ "delete" @@ -457,7 +457,7 @@ "SecretsCommand": { "oneOf": [ { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a secret by the provided identifier\n\nReturns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a secret by the provided identifier\n\nReturns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)", "type": "object", "required": [ "get" @@ -470,7 +470,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new secret in the provided organization using the given data\n\nReturns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new secret in the provided organization using the given data\n\nReturns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)", "type": "object", "required": [ "create" @@ -483,7 +483,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all secret identifiers of the given organization, to then retrieve each secret, use `CreateSecret`\n\nReturns: [SecretIdentifiersResponse](crate::sdk::response::secrets_response::SecretIdentifiersResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all secret identifiers of the given organization, to then retrieve each secret, use `CreateSecret`\n\nReturns: [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse)", "type": "object", "required": [ "list" @@ -496,7 +496,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing secret with the provided ID using the given data\n\nReturns: [SecretResponse](crate::sdk::response::secrets_response::SecretResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing secret with the provided ID using the given data\n\nReturns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)", "type": "object", "required": [ "update" @@ -509,7 +509,7 @@ "additionalProperties": false }, { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones\n\nReturns: [SecretsDeleteResponse](crate::sdk::response::secrets_response::SecretsDeleteResponse)", + "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones\n\nReturns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse)", "type": "object", "required": [ "delete" From 449a46e8fcf0aedbe51663d6299cf6fca066e6cc Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 30 Jun 2023 17:37:50 +0200 Subject: [PATCH 08/32] Move cloc job to separate workflow (#83) --- .github/workflows/build-napi.yml | 15 --------------- .github/workflows/build-rust-crates.yml | 15 --------------- .github/workflows/cloc.yml | 23 +++++++++++++++++++++++ .vscode/settings.json | 2 +- 4 files changed, 24 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/cloc.yml diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml index 36349a680d..c76035cde1 100644 --- a/.github/workflows/build-napi.yml +++ b/.github/workflows/build-napi.yml @@ -16,21 +16,6 @@ defaults: working-directory: crates/bitwarden-napi jobs: - cloc: - name: CLOC - runs-on: ubuntu-22.04 - steps: - - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - - name: Set up cloc - run: | - sudo apt update - sudo apt -y install cloc - - - name: Print lines of code - run: cloc --vcs git - build: name: Building @bitwarden/sdk-napi for - ${{ matrix.settings.os }} runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index ab0c92ca0b..0a40d9c5ab 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -14,21 +14,6 @@ env: CARGO_TERM_COLOR: always jobs: - cloc: - name: CLOC - runs-on: ubuntu-20.04 - steps: - - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - - name: Set up cloc - run: | - sudo apt update - sudo apt -y install cloc - - - name: Print lines of code - run: cloc --vcs git - build: name: Building ${{matrix.package}} for - ${{ matrix.os }} diff --git a/.github/workflows/cloc.yml b/.github/workflows/cloc.yml new file mode 100644 index 0000000000..fcf9ea013f --- /dev/null +++ b/.github/workflows/cloc.yml @@ -0,0 +1,23 @@ +name: CLOC + +on: + workflow_dispatch: + push: + branches: ["master"] + pull_request: + +jobs: + cloc: + name: CLOC + runs-on: ubuntu-20.04 + steps: + - name: Checkout repo + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + + - name: Set up cloc + run: | + sudo apt update + sudo apt -y install cloc + + - name: Print lines of code + run: cloc --vcs git diff --git a/.vscode/settings.json b/.vscode/settings.json index d98a01b9e9..fb638d3d33 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "cSpell.words": ["bindgen", "Cdecl", "dylib", "Hkdf", "Maybeable", "wordlist"] + "cSpell.words": ["bindgen", "Cdecl", "cloc", "dylib", "Hkdf", "Maybeable", "wordlist"] } From 8a689bb18db4a0937654771b544820e74fc27866 Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Mon, 3 Jul 2023 10:45:08 -0400 Subject: [PATCH 09/32] Add enforce labels workflow (#86) --- .github/workflows/enforce-labels.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/enforce-labels.yml diff --git a/.github/workflows/enforce-labels.yml b/.github/workflows/enforce-labels.yml new file mode 100644 index 0000000000..73092bb2e0 --- /dev/null +++ b/.github/workflows/enforce-labels.yml @@ -0,0 +1,17 @@ +--- +name: Enforce PR labels + +on: + workflow_call: + pull_request: + types: [labeled, unlabeled, opened, edited, synchronize] +jobs: + enforce-label: + name: EnforceLabel + runs-on: ubuntu-20.04 + steps: + - name: Enforce Label + uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 # 2.2.2 + with: + BANNED_LABELS: "hold,needs-qa" + BANNED_LABELS_DESCRIPTION: "PRs with the hold or needs-qa labels cannot be merged" From 4f5aeaa4c433306141390ee5cf2c99dfc0baeb11 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 7 Jul 2023 16:28:41 +0200 Subject: [PATCH 10/32] Extract encrypt/decrypt refactor from state PR (#85) * Extract encrypt/decrypt refactor from state PR * Change decrypt to take a reference. --------- Co-authored-by: =?UTF-8?q?Daniel=20Garci=CC=81a?= --- crates/bitwarden-json/src/command.rs | 5 +- .../src/client/encryption_settings.rs | 22 +++--- crates/bitwarden/src/crypto.rs | 77 ++++++++++++++++++- .../src/secrets_manager/projects/create.rs | 2 +- .../projects/project_response.rs | 10 ++- .../src/secrets_manager/projects/update.rs | 2 +- .../src/secrets_manager/secrets/create.rs | 6 +- .../src/secrets_manager/secrets/list.rs | 10 ++- .../secrets/secret_response.rs | 19 ++++- .../src/secrets_manager/secrets/update.rs | 6 +- 10 files changed, 122 insertions(+), 37 deletions(-) diff --git a/crates/bitwarden-json/src/command.rs b/crates/bitwarden-json/src/command.rs index e88307afa1..cf8b6418cc 100644 --- a/crates/bitwarden-json/src/command.rs +++ b/crates/bitwarden-json/src/command.rs @@ -1,6 +1,3 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - use bitwarden::{ auth::request::AccessTokenLoginRequest, secrets_manager::{ @@ -19,6 +16,8 @@ use bitwarden::{ auth::request::{ApiKeyLoginRequest, PasswordLoginRequest}, platform::{FingerprintRequest, SecretVerificationRequest, SyncRequest}, }; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, JsonSchema, Debug)] #[serde(rename_all = "camelCase", deny_unknown_fields)] diff --git a/crates/bitwarden/src/client/encryption_settings.rs b/crates/bitwarden/src/client/encryption_settings.rs index b57677b2ca..0fa4e2c340 100644 --- a/crates/bitwarden/src/client/encryption_settings.rs +++ b/crates/bitwarden/src/client/encryption_settings.rs @@ -166,14 +166,14 @@ impl EncryptionSettings { Ok(self) } - fn get_key(&self, org_id: Option) -> Option<&SymmetricCryptoKey> { + fn get_key(&self, org_id: &Option) -> Option<&SymmetricCryptoKey> { // 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 Some(&self.user_key); } match org_id { - Some(org_id) => match self.org_keys.get(&org_id) { + Some(org_id) => match self.org_keys.get(org_id) { Some(k) => Some(k), None => return None, }, @@ -181,18 +181,13 @@ impl EncryptionSettings { } } - pub fn decrypt(&self, cipher: &CipherString, org_id: Option) -> Result> { + pub(crate) fn decrypt(&self, cipher: &CipherString, org_id: &Option) -> Result { let key = self.get_key(org_id).ok_or(CryptoError::NoKeyForOrg)?; - decrypt(cipher, key) - } - - pub fn decrypt_str(&self, cipher: &str, org_id: Option) -> Result { - let cipher = CipherString::from_str(cipher)?; - let dec = self.decrypt(&cipher, org_id)?; + let dec = decrypt(cipher, key)?; String::from_utf8(dec).map_err(|_| CryptoError::InvalidUtf8String.into()) } - pub fn encrypt(&self, data: &[u8], org_id: Option) -> Result { + pub(crate) fn encrypt(&self, data: &[u8], org_id: &Option) -> Result { let key = self.get_key(org_id).ok_or(CryptoError::NoKeyForOrg)?; let dec = encrypt_aes256(data, key.mac_key, key.key)?; @@ -278,6 +273,7 @@ mod tests { use std::str::FromStr; use super::{EncryptionSettings, SymmetricCryptoKey}; + use crate::crypto::{Decryptable, Encryptable}; #[test] fn test_symmetric_crypto_key() { @@ -296,10 +292,10 @@ mod tests { let key = SymmetricCryptoKey::generate("test"); let settings = EncryptionSettings::new_single_key(key); - let test_string = "encrypted_test_string"; - let cipher = settings.encrypt(test_string.as_bytes(), None).unwrap(); + let test_string = "encrypted_test_string".to_string(); + let cipher = test_string.clone().encrypt(&settings, &None).unwrap(); - let decrypted_str = settings.decrypt_str(&cipher.to_string(), None).unwrap(); + let decrypted_str = cipher.decrypt(&settings, &None).unwrap(); assert_eq!(decrypted_str, test_string); } } diff --git a/crates/bitwarden/src/crypto.rs b/crates/bitwarden/src/crypto.rs index 2155350fe3..d23b762a03 100644 --- a/crates/bitwarden/src/crypto.rs +++ b/crates/bitwarden/src/crypto.rs @@ -1,6 +1,6 @@ //! Cryptographic primitives used in the SDK -use std::{fmt::Display, num::NonZeroU32, str::FromStr}; +use std::{collections::HashMap, fmt::Display, hash::Hash, num::NonZeroU32, str::FromStr}; use aes::cipher::{ generic_array::GenericArray, @@ -13,9 +13,10 @@ use num_bigint::BigUint; use num_traits::cast::ToPrimitive; use serde::{de::Visitor, Deserialize, Serialize}; use sha2::{Digest, Sha256}; +use uuid::Uuid; -pub use crate::client::encryption_settings::{decrypt, encrypt_aes256, SymmetricCryptoKey}; use crate::{ + client::encryption_settings::{EncryptionSettings, SymmetricCryptoKey}, error::{CSParseError, Error, Result}, util::BASE64_ENGINE, wordlist::EFF_LONG_WORD_LIST, @@ -324,6 +325,78 @@ fn hash_word(hash: [u8; 32]) -> Result { Ok(phrase.join("-")) } +pub trait Encryptable { + fn encrypt(self, enc: &EncryptionSettings, org_id: &Option) -> Result; +} + +pub trait Decryptable { + fn decrypt(&self, enc: &EncryptionSettings, org_id: &Option) -> Result; +} + +impl Encryptable for String { + fn encrypt(self, enc: &EncryptionSettings, org_id: &Option) -> Result { + enc.encrypt(self.as_bytes(), org_id) + } +} + +impl Decryptable for CipherString { + fn decrypt(&self, enc: &EncryptionSettings, org_id: &Option) -> Result { + enc.decrypt(&self, org_id) + } +} + +impl, Output> Encryptable> for Option { + fn encrypt(self, enc: &EncryptionSettings, org_id: &Option) -> Result> { + self.map(|e| e.encrypt(enc, org_id)).transpose() + } +} + +impl, Output> Decryptable> for Option { + fn decrypt(&self, enc: &EncryptionSettings, org_id: &Option) -> Result> { + self.as_ref().map(|e| e.decrypt(enc, org_id)).transpose() + } +} + +impl, Output> Encryptable> for Vec { + fn encrypt(self, enc: &EncryptionSettings, org_id: &Option) -> Result> { + self.into_iter().map(|e| e.encrypt(enc, org_id)).collect() + } +} + +impl, Output> Decryptable> for Vec { + fn decrypt(&self, enc: &EncryptionSettings, org_id: &Option) -> Result> { + self.into_iter().map(|e| e.decrypt(enc, org_id)).collect() + } +} + +impl, Output, Id: Hash + Eq> Encryptable> + for HashMap +{ + fn encrypt( + self, + enc: &EncryptionSettings, + org_id: &Option, + ) -> Result> { + self.into_iter() + .map(|(id, e)| Ok((id, e.encrypt(enc, org_id)?))) + .collect::>>() + } +} + +impl, Output, Id: Hash + Eq + Copy> Decryptable> + for HashMap +{ + fn decrypt( + &self, + enc: &EncryptionSettings, + org_id: &Option, + ) -> Result> { + self.into_iter() + .map(|(id, e)| Ok((*id, e.decrypt(enc, org_id)?))) + .collect::>>() + } +} + #[cfg(test)] mod tests { use std::num::NonZeroU32; diff --git a/crates/bitwarden/src/secrets_manager/projects/create.rs b/crates/bitwarden/src/secrets_manager/projects/create.rs index 3eae095c3b..35f33ff973 100644 --- a/crates/bitwarden/src/secrets_manager/projects/create.rs +++ b/crates/bitwarden/src/secrets_manager/projects/create.rs @@ -30,7 +30,7 @@ pub(crate) async fn create_project( let org_id = Some(input.organization_id); let project = Some(ProjectCreateRequestModel { - name: enc.encrypt(input.name.as_bytes(), org_id)?.to_string(), + name: enc.encrypt(input.name.as_bytes(), &org_id)?.to_string(), }); let config = client.get_api_configurations().await; diff --git a/crates/bitwarden/src/secrets_manager/projects/project_response.rs b/crates/bitwarden/src/secrets_manager/projects/project_response.rs index be36327f8a..5485d012b1 100644 --- a/crates/bitwarden/src/secrets_manager/projects/project_response.rs +++ b/crates/bitwarden/src/secrets_manager/projects/project_response.rs @@ -5,6 +5,7 @@ use uuid::Uuid; use crate::{ client::encryption_settings::EncryptionSettings, + crypto::{CipherString, Decryptable}, error::{Error, Result}, }; @@ -26,10 +27,11 @@ impl ProjectResponse { ) -> Result { let organization_id = response.organization_id.ok_or(Error::MissingFields)?; - let name = enc.decrypt_str( - &response.name.ok_or(Error::MissingFields)?, - Some(organization_id), - )?; + let name = response + .name + .ok_or(Error::MissingFields)? + .parse::()? + .decrypt(enc, &Some(organization_id))?; Ok(ProjectResponse { object: "project".to_owned(), diff --git a/crates/bitwarden/src/secrets_manager/projects/update.rs b/crates/bitwarden/src/secrets_manager/projects/update.rs index 236f5965f7..eee84cac6c 100644 --- a/crates/bitwarden/src/secrets_manager/projects/update.rs +++ b/crates/bitwarden/src/secrets_manager/projects/update.rs @@ -32,7 +32,7 @@ pub(crate) async fn update_project( let org_id = Some(input.organization_id); let project = Some(ProjectUpdateRequestModel { - name: enc.encrypt(input.name.as_bytes(), org_id)?.to_string(), + name: enc.encrypt(input.name.as_bytes(), &org_id)?.to_string(), }); let config = client.get_api_configurations().await; diff --git a/crates/bitwarden/src/secrets_manager/secrets/create.rs b/crates/bitwarden/src/secrets_manager/secrets/create.rs index 8d576c34f3..bcecaeee32 100644 --- a/crates/bitwarden/src/secrets_manager/secrets/create.rs +++ b/crates/bitwarden/src/secrets_manager/secrets/create.rs @@ -35,9 +35,9 @@ pub(crate) async fn create_secret( let org_id = Some(input.organization_id); let secret = Some(SecretCreateRequestModel { - key: enc.encrypt(input.key.as_bytes(), org_id)?.to_string(), - value: enc.encrypt(input.value.as_bytes(), org_id)?.to_string(), - note: enc.encrypt(input.note.as_bytes(), org_id)?.to_string(), + key: enc.encrypt(input.key.as_bytes(), &org_id)?.to_string(), + value: enc.encrypt(input.value.as_bytes(), &org_id)?.to_string(), + note: enc.encrypt(input.note.as_bytes(), &org_id)?.to_string(), project_ids: input.project_ids.clone(), }); diff --git a/crates/bitwarden/src/secrets_manager/secrets/list.rs b/crates/bitwarden/src/secrets_manager/secrets/list.rs index b14d04f055..7ecff9a409 100644 --- a/crates/bitwarden/src/secrets_manager/secrets/list.rs +++ b/crates/bitwarden/src/secrets_manager/secrets/list.rs @@ -7,6 +7,7 @@ use uuid::Uuid; use crate::{ client::{encryption_settings::EncryptionSettings, Client}, + crypto::{CipherString, Decryptable}, error::{Error, Result}, }; @@ -100,10 +101,11 @@ impl SecretIdentifierResponse { ) -> Result { let organization_id = response.organization_id.ok_or(Error::MissingFields)?; - let key = enc.decrypt_str( - &response.key.ok_or(Error::MissingFields)?, - Some(organization_id), - )?; + let key = response + .key + .ok_or(Error::MissingFields)? + .parse::()? + .decrypt(enc, &Some(organization_id))?; Ok(SecretIdentifierResponse { id: response.id.ok_or(Error::MissingFields)?, diff --git a/crates/bitwarden/src/secrets_manager/secrets/secret_response.rs b/crates/bitwarden/src/secrets_manager/secrets/secret_response.rs index 85b6c77ddc..ab8f04721c 100644 --- a/crates/bitwarden/src/secrets_manager/secrets/secret_response.rs +++ b/crates/bitwarden/src/secrets_manager/secrets/secret_response.rs @@ -5,6 +5,7 @@ use uuid::Uuid; use crate::{ client::encryption_settings::EncryptionSettings, + crypto::{CipherString, Decryptable}, error::{Error, Result}, }; @@ -31,9 +32,21 @@ impl SecretResponse { ) -> Result { let org_id = response.organization_id; - let key = enc.decrypt_str(&response.key.ok_or(Error::MissingFields)?, org_id)?; - let value = enc.decrypt_str(&response.value.ok_or(Error::MissingFields)?, org_id)?; - let note = enc.decrypt_str(&response.note.ok_or(Error::MissingFields)?, org_id)?; + let key = response + .key + .ok_or(Error::MissingFields)? + .parse::()? + .decrypt(enc, &org_id)?; + let value = response + .value + .ok_or(Error::MissingFields)? + .parse::()? + .decrypt(enc, &org_id)?; + let note = response + .note + .ok_or(Error::MissingFields)? + .parse::()? + .decrypt(enc, &org_id)?; let project = response .projects diff --git a/crates/bitwarden/src/secrets_manager/secrets/update.rs b/crates/bitwarden/src/secrets_manager/secrets/update.rs index 45acb21585..5fce871965 100644 --- a/crates/bitwarden/src/secrets_manager/secrets/update.rs +++ b/crates/bitwarden/src/secrets_manager/secrets/update.rs @@ -34,9 +34,9 @@ pub(crate) async fn update_secret( let org_id = Some(input.organization_id); let secret = Some(SecretUpdateRequestModel { - key: enc.encrypt(input.key.as_bytes(), org_id)?.to_string(), - value: enc.encrypt(input.value.as_bytes(), org_id)?.to_string(), - note: enc.encrypt(input.note.as_bytes(), org_id)?.to_string(), + key: enc.encrypt(input.key.as_bytes(), &org_id)?.to_string(), + value: enc.encrypt(input.value.as_bytes(), &org_id)?.to_string(), + note: enc.encrypt(input.note.as_bytes(), &org_id)?.to_string(), project_ids: None, }); From 94c0397a8d09de4730964206d7ce536e59302236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 11 Jul 2023 15:31:25 +0200 Subject: [PATCH 11/32] Argon2 support (#84) * Argon2 support * Add tests for Argon2id * Hardcode expected array sizes * Create separate test functions * Remove unused error variant --- Cargo.lock | 20 +++ crates/bitwarden/Cargo.toml | 1 + .../api/response/identity_success_response.rs | 4 +- crates/bitwarden/src/auth/commands/login.rs | 2 +- crates/bitwarden/src/client/auth_settings.rs | 106 +++++++++++----- .../src/client/encryption_settings.rs | 5 +- crates/bitwarden/src/crypto.rs | 116 +++++++++++++++--- crates/bitwarden/src/error.rs | 2 - .../src/platform/get_user_api_key.rs | 11 +- crates/bitwarden/src/util.rs | 11 +- 10 files changed, 213 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af9cd2516a..01feef5ba2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -131,6 +131,16 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +[[package]] +name = "argon2" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95c2fcf79ad1932ac6269a738109997a83c227c09b75842ae564dc8ede6a861c" +dependencies = [ + "base64ct", + "blake2", +] + [[package]] name = "assert-json-diff" version = "2.0.2" @@ -282,6 +292,7 @@ name = "bitwarden" version = "0.2.1" dependencies = [ "aes", + "argon2", "assert_matches", "base64 0.21.2", "bitwarden-api-api", @@ -395,6 +406,15 @@ dependencies = [ "wasm-bindgen-test", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + [[package]] name = "block-buffer" version = "0.10.4" diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index 7cd0b2273f..2bc78b7866 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -35,6 +35,7 @@ rsa = "0.9.2" sha1 = "0.10.5" sha2 = "0.10.6" pbkdf2 = { version = "0.12.1", default-features = false } +argon2 = { version = "0.5.0", features = ["alloc"], default-features = false } rand = "0.8.5" num-bigint = "0.4" num-traits = "0.2.15" diff --git a/crates/bitwarden/src/auth/api/response/identity_success_response.rs b/crates/bitwarden/src/auth/api/response/identity_success_response.rs index 7f81654ab5..e59f91b7be 100644 --- a/crates/bitwarden/src/auth/api/response/identity_success_response.rs +++ b/crates/bitwarden/src/auth/api/response/identity_success_response.rs @@ -22,7 +22,7 @@ pub struct IdentityTokenSuccessResponse { #[serde( rename = "kdfIterations", alias = "KdfIterations", - default = "crate::util::default_kdf_iterations" + default = "crate::util::default_pbkdf2_iterations" )] kdf_iterations: NonZeroU32, @@ -54,7 +54,7 @@ mod test { key: Default::default(), two_factor_token: Default::default(), kdf: KdfType::Variant0, - kdf_iterations: crate::util::default_kdf_iterations(), + kdf_iterations: crate::util::default_pbkdf2_iterations(), reset_master_password: Default::default(), force_password_reset: Default::default(), api_use_key_connector: Default::default(), diff --git a/crates/bitwarden/src/auth/commands/login.rs b/crates/bitwarden/src/auth/commands/login.rs index b9c642b564..7582b5743c 100644 --- a/crates/bitwarden/src/auth/commands/login.rs +++ b/crates/bitwarden/src/auth/commands/login.rs @@ -162,7 +162,7 @@ async fn determine_password_hash( ) -> Result { let pre_login = request_prelogin(client, email.to_owned()).await?; let auth_settings = AuthSettings::new(pre_login, email.to_owned()); - let password_hash = auth_settings.make_user_password_hash(password); + let password_hash = auth_settings.make_user_password_hash(password)?; client.set_auth_settings(auth_settings); Ok(password_hash) diff --git a/crates/bitwarden/src/client/auth_settings.rs b/crates/bitwarden/src/client/auth_settings.rs index 88e5eed2f5..583e78b609 100644 --- a/crates/bitwarden/src/client/auth_settings.rs +++ b/crates/bitwarden/src/client/auth_settings.rs @@ -5,46 +5,66 @@ use bitwarden_api_identity::models::{KdfType, PreloginResponseModel}; use crate::{ crypto::{PbkdfSha256Hmac, PBKDF_SHA256_HMAC_OUT_SIZE}, - util::{default_kdf_iterations, BASE64_ENGINE}, + error::Result, + util::{ + default_argon2_iterations, default_argon2_memory, default_argon2_parallelism, + default_pbkdf2_iterations, BASE64_ENGINE, + }, }; #[derive(Debug)] pub(crate) struct AuthSettings { pub email: String, - kdf_type: KdfType, - pub(crate) kdf_iterations: NonZeroU32, + pub(crate) kdf: Kdf, +} + +#[derive(Debug)] +pub enum Kdf { + PBKDF2 { + iterations: NonZeroU32, + }, + Argon2id { + iterations: NonZeroU32, + memory: NonZeroU32, + parallelism: NonZeroU32, + }, } impl AuthSettings { pub fn new(response: PreloginResponseModel, email: String) -> Self { - Self { - email, - kdf_type: response.kdf.unwrap_or_default(), - kdf_iterations: response - .kdf_iterations - .and_then(|e| NonZeroU32::new(e as u32)) - .unwrap_or_else(default_kdf_iterations), - } + let kdf = match response.kdf.unwrap_or_default() { + KdfType::Variant0 => Kdf::PBKDF2 { + iterations: response + .kdf_iterations + .and_then(|e| NonZeroU32::new(e as u32)) + .unwrap_or_else(default_pbkdf2_iterations), + }, + KdfType::Variant1 => 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), + }, + }; + + Self { email, kdf } } - pub fn make_user_password_hash(&self, password: &str) -> String { + pub fn make_user_password_hash(&self, password: &str) -> Result { self.make_password_hash(password, &self.email) } - pub fn make_password_hash(&self, password: &str, salt: &str) -> String { - let hash = match self.kdf_type { - KdfType::Variant0 => { - pbkdf2::pbkdf2_array::( - password.as_bytes(), - salt.as_bytes(), - self.kdf_iterations.get(), - ) - } - KdfType::Variant1 => { - todo!("Implement argon2id") - } - } - .unwrap(); + pub fn make_password_hash(&self, password: &str, salt: &str) -> Result { + let hash: [u8; 32] = + crate::crypto::hash_kdf(password.as_bytes(), salt.as_bytes(), &self.kdf)?; // Server expects hash + 1 iteration let login_hash = pbkdf2::pbkdf2_array::( @@ -52,9 +72,9 @@ impl AuthSettings { password.as_bytes(), 1, ) - .unwrap(); + .expect("hash is a valid fixed size"); - BASE64_ENGINE.encode(login_hash) + Ok(BASE64_ENGINE.encode(login_hash)) } } @@ -65,7 +85,7 @@ mod tests { use super::AuthSettings; #[test] - fn test_password_hash() { + fn test_password_hash_pbkdf2() { let res = PreloginResponseModel { kdf: Some(KdfType::Variant0), kdf_iterations: Some(100_000), @@ -75,12 +95,36 @@ mod tests { let settings = AuthSettings::new(res, "test@bitwarden.com".into()); assert_eq!( - settings.make_password_hash("asdfasdf", "test_salt"), + settings + .make_password_hash("asdfasdf", "test_salt") + .unwrap(), "ZF6HjxUTSyBHsC+HXSOhZoXN+UuMnygV5YkWXCY4VmM=" ); assert_eq!( - settings.make_user_password_hash("asdfasdf"), + settings.make_user_password_hash("asdfasdf").unwrap(), "wmyadRMyBZOH7P/a/ucTCbSghKgdzDpPqUnu/DAVtSw=" ); } + + #[test] + fn test_password_hash_argon2id() { + let res = PreloginResponseModel { + kdf: Some(KdfType::Variant1), + kdf_iterations: Some(4), + kdf_memory: Some(32), + kdf_parallelism: Some(2), + }; + let settings = AuthSettings::new(res, "test@bitwarden.com".into()); + + assert_eq!( + settings + .make_password_hash("asdfasdf", "test_salt") + .unwrap(), + "PR6UjYmjmppTYcdyTiNbAhPJuQQOmynKbdEl1oyi/iQ=" + ); + assert_eq!( + settings.make_user_password_hash("asdfasdf").unwrap(), + "ImYMPyd/X7FPrWzbt+wRfmlICWTA25yZrOob4TBMEZw=" + ); + } } diff --git a/crates/bitwarden/src/client/encryption_settings.rs b/crates/bitwarden/src/client/encryption_settings.rs index 0fa4e2c340..0e1ffcdad2 100644 --- a/crates/bitwarden/src/client/encryption_settings.rs +++ b/crates/bitwarden/src/client/encryption_settings.rs @@ -104,9 +104,8 @@ impl EncryptionSettings { let (key, mac_key) = crate::crypto::stretch_key_password( password.as_bytes(), auth.email.as_bytes(), - auth.kdf_iterations, - ) - .map_err(|_| CryptoError::KeyStretch)?; + &auth.kdf, + )?; // Decrypt the user key with the stretched key let user_key = { diff --git a/crates/bitwarden/src/crypto.rs b/crates/bitwarden/src/crypto.rs index d23b762a03..b8e6d7f775 100644 --- a/crates/bitwarden/src/crypto.rs +++ b/crates/bitwarden/src/crypto.rs @@ -1,6 +1,6 @@ //! Cryptographic primitives used in the SDK -use std::{collections::HashMap, fmt::Display, hash::Hash, num::NonZeroU32, str::FromStr}; +use std::{collections::HashMap, fmt::Display, hash::Hash, str::FromStr}; use aes::cipher::{ generic_array::GenericArray, @@ -16,7 +16,10 @@ use sha2::{Digest, Sha256}; use uuid::Uuid; use crate::{ - client::encryption_settings::{EncryptionSettings, SymmetricCryptoKey}, + client::{ + auth_settings::Kdf, + encryption_settings::{EncryptionSettings, SymmetricCryptoKey}, + }, error::{CSParseError, Error, Result}, util::BASE64_ENGINE, wordlist::EFF_LONG_WORD_LIST, @@ -237,25 +240,61 @@ pub(crate) type PbkdfSha256Hmac = hmac::Hmac; pub(crate) const PBKDF_SHA256_HMAC_OUT_SIZE: usize = <::OutputSize as Unsigned>::USIZE; +pub(crate) fn hash_kdf(secret: &[u8], salt: &[u8], kdf: &Kdf) -> Result<[u8; 32]> { + let hash = match kdf { + Kdf::PBKDF2 { iterations } => pbkdf2::pbkdf2_array::< + PbkdfSha256Hmac, + PBKDF_SHA256_HMAC_OUT_SIZE, + >(secret, salt, iterations.get()) + .unwrap(), + + Kdf::Argon2id { + iterations, + memory, + parallelism, + } => { + use argon2::*; + + let argon = Argon2::new( + Algorithm::Argon2id, + Version::V0x13, + Params::new( + memory.get() * 1024, // Convert MiB to KiB + iterations.get(), + parallelism.get(), + Some(32), + ) + .unwrap(), + ); + + let salt_sha = sha2::Sha256::new().chain_update(salt).finalize(); + + let mut hash = [0u8; 32]; + argon + .hash_password_into(secret, &salt_sha, &mut hash) + .unwrap(); + hash + } + }; + Ok(hash) +} + pub(crate) fn stretch_key_password( secret: &[u8], salt: &[u8], - iterations: NonZeroU32, -) -> Result<(GenericArray, GenericArray), hkdf::InvalidLength> { - let master_key = pbkdf2::pbkdf2_array::( - secret, - salt, - iterations.get(), - ) - .unwrap(); - - let hkdf = - hkdf::Hkdf::::from_prk(&master_key).map_err(|_| hkdf::InvalidLength)?; - - let mut key = GenericArray::default(); - hkdf.expand("enc".as_bytes(), &mut key)?; - let mut mac_key = GenericArray::default(); - hkdf.expand("mac".as_bytes(), &mut mac_key)?; + kdf: &Kdf, +) -> Result<(GenericArray, GenericArray)> { + let master_key: [u8; 32] = hash_kdf(secret, salt, kdf)?; + + let hkdf = hkdf::Hkdf::::from_prk(&master_key) + .expect("Input is a valid fixed size hash"); + + let mut key = GenericArray::::default(); + hkdf.expand("enc".as_bytes(), &mut key) + .expect("key is a valid fixed size buffer"); + let mut mac_key = GenericArray::::default(); + hkdf.expand("mac".as_bytes(), &mut mac_key) + .expect("mac_key is a valid fixed size buffer"); Ok((key, mac_key)) } @@ -402,7 +441,10 @@ mod tests { use std::num::NonZeroU32; use super::{fingerprint, stretch_key}; - use crate::crypto::{stretch_key_password, CipherString}; + use crate::{ + client::auth_settings::Kdf, + crypto::{stretch_key_password, CipherString}, + }; #[test] fn test_cipher_string_serialization() { @@ -427,11 +469,16 @@ mod tests { let key = stretch_key(*b"67t9b5g67$%Dh89n", "test_key", Some("test")); assert_eq!(key.to_base64(), "F9jVQmrACGx9VUPjuzfMYDjr726JtL300Y3Yg+VYUnVQtQ1s8oImJ5xtp1KALC9h2nav04++1LDW4iFD+infng=="); + } + #[test] + fn test_key_stretch_password_pbkdf2() { let (key, mac) = stretch_key_password( &b"67t9b5g67$%Dh89n"[..], "test_key".as_bytes(), - NonZeroU32::new(10000).unwrap(), + &Kdf::PBKDF2 { + iterations: NonZeroU32::new(10000).unwrap(), + }, ) .unwrap(); @@ -451,6 +498,35 @@ mod tests { ); } + #[test] + fn test_key_stretch_password_argon2() { + let (key, mac) = stretch_key_password( + &b"67t9b5g67$%Dh89n"[..], + "test_key".as_bytes(), + &Kdf::Argon2id { + iterations: NonZeroU32::new(4).unwrap(), + memory: NonZeroU32::new(32).unwrap(), + parallelism: NonZeroU32::new(2).unwrap(), + }, + ) + .unwrap(); + + assert_eq!( + key.as_slice(), + [ + 236, 253, 166, 121, 207, 124, 98, 149, 42, 141, 97, 226, 207, 71, 173, 60, 10, 0, + 184, 255, 252, 87, 62, 32, 188, 166, 173, 223, 146, 159, 222, 219 + ] + ); + assert_eq!( + mac.as_slice(), + [ + 214, 144, 76, 173, 225, 106, 132, 131, 173, 56, 134, 241, 223, 227, 165, 161, 146, + 37, 111, 206, 155, 24, 224, 151, 134, 189, 202, 0, 27, 149, 131, 21 + ] + ); + } + #[test] fn test_fingerprint() { let user_id = "a09726a0-9590-49d1-a5f5-afe300b6a515"; diff --git a/crates/bitwarden/src/error.rs b/crates/bitwarden/src/error.rs index 5a3c648526..98f1fce2d9 100644 --- a/crates/bitwarden/src/error.rs +++ b/crates/bitwarden/src/error.rs @@ -68,8 +68,6 @@ pub enum AccessTokenInvalidError { #[derive(Debug, Error)] pub enum CryptoError { - #[error("Error stretching key")] - KeyStretch, #[error("The provided key is not the expected type")] InvalidKey, #[error("The cipher's MAC doesn't match the expected value")] diff --git a/crates/bitwarden/src/platform/get_user_api_key.rs b/crates/bitwarden/src/platform/get_user_api_key.rs index 0548c5d0fa..98035ad45a 100644 --- a/crates/bitwarden/src/platform/get_user_api_key.rs +++ b/crates/bitwarden/src/platform/get_user_api_key.rs @@ -21,7 +21,7 @@ pub(crate) async fn get_user_api_key( debug!("{:?}", input); let auth_settings = get_auth_settings(client)?; - let request = get_secret_verification_request(auth_settings, input); + let request = get_secret_verification_request(auth_settings, input)?; let config = client.get_api_configurations().await; @@ -44,17 +44,18 @@ fn get_auth_settings(client: &Client) -> Result<&AuthSettings> { fn get_secret_verification_request( auth_settings: &AuthSettings, input: &SecretVerificationRequest, -) -> SecretVerificationRequestModel { +) -> Result { let master_password_hash = input .master_password .as_ref() - .map(|p| auth_settings.make_user_password_hash(p)); - SecretVerificationRequestModel { + .map(|p| auth_settings.make_user_password_hash(p)) + .transpose()?; + Ok(SecretVerificationRequestModel { master_password_hash, otp: input.otp.as_ref().cloned(), secret: None, auth_request_access_code: None, - } + }) } #[derive(Serialize, Deserialize, Debug, JsonSchema)] diff --git a/crates/bitwarden/src/util.rs b/crates/bitwarden/src/util.rs index de39151c87..ed91a27457 100644 --- a/crates/bitwarden/src/util.rs +++ b/crates/bitwarden/src/util.rs @@ -8,9 +8,18 @@ use base64::{ use crate::error::Result; -pub fn default_kdf_iterations() -> NonZeroU32 { +pub fn default_pbkdf2_iterations() -> NonZeroU32 { NonZeroU32::new(600_000).unwrap() } +pub fn default_argon2_iterations() -> NonZeroU32 { + NonZeroU32::new(3).unwrap() +} +pub fn default_argon2_memory() -> NonZeroU32 { + NonZeroU32::new(64).unwrap() +} +pub fn default_argon2_parallelism() -> NonZeroU32 { + NonZeroU32::new(4).unwrap() +} #[derive(serde::Deserialize)] pub struct JWTToken { From e569f4ebd4e99f05eea7ee0b6662223b3c750514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 11 Jul 2023 15:33:18 +0200 Subject: [PATCH 12/32] Disable application features of the bat crate (#88) --- Cargo.lock | 193 ------------------------------------------ crates/bws/Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 194 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 01feef5ba2..14a3953b39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,17 +179,6 @@ dependencies = [ "syn 2.0.18", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -236,34 +225,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd4b13b0233143ae151a66e0135d715b65f631d1028c40502cc88182bcb9f4fa" dependencies = [ "ansi_colours", - "atty", "bincode", - "bugreport", "bytesize", - "clap", "clircle", "console", "content_inspector", "dirs", "encoding", "flate2", - "git2", "globset", - "grep-cli", "nu-ansi-term", "once_cell", "path_abs", "plist", - "regex", "semver", "serde", "serde_yaml 0.8.26", - "shell-words", "syntect", "thiserror", "unicode-width", - "walkdir", - "wild", ] [[package]] @@ -440,22 +420,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" dependencies = [ "memchr", - "once_cell", - "regex-automata", "serde", ] -[[package]] -name = "bugreport" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535120b8182547808081a66f1f77a64533c780b23da26763e0ee34dfb94f98c9" -dependencies = [ - "git-version", - "shell-escape", - "sys-info", -] - [[package]] name = "bumpalo" version = "3.13.0" @@ -528,9 +495,6 @@ name = "cc" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" -dependencies = [ - "jobserver", -] [[package]] name = "cfg-if" @@ -581,9 +545,7 @@ dependencies = [ "anstyle", "bitflags 1.3.2", "clap_lex", - "once_cell", "strsim", - "terminal_size", ] [[package]] @@ -1228,47 +1190,6 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" -[[package]] -name = "git-version" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899" -dependencies = [ - "git-version-macro", - "proc-macro-hack", -] - -[[package]] -name = "git-version-macro" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "git2" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc" -dependencies = [ - "bitflags 1.3.2", - "libc", - "libgit2-sys", - "log", - "url", -] - -[[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.10" @@ -1282,23 +1203,6 @@ dependencies = [ "regex", ] -[[package]] -name = "grep-cli" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19fc6687bc64b6719a839cd24f2c700bcb05ffeb684d19da6a637c2455a7ba1" -dependencies = [ - "atty", - "bstr", - "globset", - "lazy_static", - "log", - "regex", - "same-file", - "termcolor", - "winapi-util", -] - [[package]] name = "h2" version = "0.3.19" @@ -1330,15 +1234,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.2.6" @@ -1600,15 +1495,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" -[[package]] -name = "jobserver" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.63" @@ -1633,18 +1519,6 @@ version = "0.2.145" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc86cde3ff845662b8f4ef6cb50ea0e20c524eb3d29ae048287e06a1b3fa6a81" -[[package]] -name = "libgit2-sys" -version = "0.14.2+1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - [[package]] name = "libloading" version = "0.7.4" @@ -1661,18 +1535,6 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" -[[package]] -name = "libz-sys" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "line-wrap" version = "0.1.1" @@ -2139,12 +2001,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - [[package]] name = "proc-macro2" version = "1.0.59" @@ -2379,12 +2235,6 @@ dependencies = [ "regex-syntax 0.7.2", ] -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - [[package]] name = "regex-syntax" version = "0.6.29" @@ -2758,18 +2608,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shell-escape" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" - -[[package]] -name = "shell-words" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" - [[package]] name = "signal-hook" version = "0.3.15" @@ -2933,24 +2771,12 @@ dependencies = [ "lazy_static", "once_cell", "onig", - "plist", "regex-syntax 0.6.29", "serde", "serde_derive", "serde_json", "thiserror", "walkdir", - "yaml-rust", -] - -[[package]] -name = "sys-info" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c" -dependencies = [ - "cc", - "libc", ] [[package]] @@ -2981,16 +2807,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" -dependencies = [ - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "thiserror" version = "1.0.40" @@ -3450,15 +3266,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "wild" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b116685a6be0c52f5a103334cbff26db643826c7b3735fc0a3ba9871310a74" -dependencies = [ - "glob", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml index fd637fb464..9a7c623b6c 100644 --- a/crates/bws/Cargo.toml +++ b/crates/bws/Cargo.toml @@ -25,7 +25,7 @@ thiserror = "1.0.40" serde = "^1.0.163" serde_json = "^1.0.96" serde_yaml = "0.9" -bat = "0.23.0" +bat = { version = "0.23.0", features = ["regex-onig"], default-features = false } directories = "5.0.1" color-eyre = "0.6" toml = "0.7.4" From 5beef60a10db9852aa68c74e948a65d5b8c8b1cc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 17:20:08 +0200 Subject: [PATCH 13/32] Lock file maintenance (#69) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 517 +++++++++++---------- crates/bitwarden-napi/package-lock.json | 36 +- languages/js_webassembly/package-lock.json | 302 ++++++------ package-lock.json | 152 +++--- 4 files changed, 525 insertions(+), 482 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14a3953b39..58957fefd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" dependencies = [ "gimli", ] @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher", @@ -87,15 +87,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -159,9 +159,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -170,13 +170,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -187,15 +187,15 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide 0.6.2", + "miniz_oxide", "object", "rustc-demangle", ] @@ -263,9 +263,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.1" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" [[package]] name = "bitwarden" @@ -278,7 +278,7 @@ dependencies = [ "bitwarden-api-api", "bitwarden-api-identity", "cbc", - "getrandom 0.2.9", + "getrandom 0.2.10", "hkdf", "hmac", "lazy_static", @@ -415,9 +415,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", "serde", @@ -448,7 +448,7 @@ dependencies = [ "log", "serde", "serde_json", - "serde_yaml 0.9.21", + "serde_yaml 0.9.22", "supports-color", "tempfile", "thiserror", @@ -526,9 +526,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.1" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ed2379f8603fa2b7509891660e802b88c70a79a6427a70abb5968054de2c28" +checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" dependencies = [ "clap_builder", "clap_derive", @@ -537,27 +537,26 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.1" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" +checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" dependencies = [ "anstream", "anstyle", - "bitflags 1.3.2", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.1" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e9ef9a08ee1c0e1f2e162121665ac45ac3783b0f897db7244ae75ad9a8f65b" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -668,9 +667,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" [[package]] name = "content_inspector" @@ -708,9 +707,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -726,9 +725,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -751,9 +750,9 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ "winapi", ] @@ -770,12 +769,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1586fa608b1dab41f667475b4a41faec5ba680aee428bfa5de4ea520fdc6e901" +checksum = "eed5fff0d93c7559121e9c72bf9c242295869396255071ff2cb1617147b608c5" dependencies = [ "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -799,9 +798,9 @@ checksum = "eaa37046cc0f6c3cc6090fbdbf73ef0b8ef4cfcc37f6befc0020f63e8cf121e1" [[package]] name = "der" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", "pem-rfc7468", @@ -954,6 +953,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -1007,7 +1012,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] @@ -1033,9 +1038,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1111,7 +1116,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -1173,9 +1178,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -1186,9 +1191,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "globset" @@ -1205,9 +1210,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -1215,7 +1220,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1229,25 +1234,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] -name = "heck" -version = "0.4.1" +name = "hashbrown" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" [[package]] -name = "hermit-abi" -version = "0.2.6" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hkdf" @@ -1330,9 +1332,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -1367,9 +1369,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1390,9 +1392,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1411,7 +1413,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -1451,26 +1463,25 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi", "libc", "windows-sys 0.48.0", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", + "hermit-abi", + "rustix 0.38.4", "windows-sys 0.48.0", ] @@ -1491,15 +1502,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1515,9 +1526,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.145" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc86cde3ff845662b8f4ef6cb50ea0e20c524eb3d29ae048287e06a1b3fa6a81" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" @@ -1556,11 +1567,17 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -1568,9 +1585,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memchr" @@ -1603,15 +1620,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1635,11 +1643,11 @@ dependencies = [ [[package]] name = "napi" -version = "2.13.1" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f0a2e93526dd9c8c522d72a4d0c88678be8966fabe9fb8f2947fde6339b682" +checksum = "0ede2d12cd6fce44da537a4be1f5510c73be2506c2e32dfaaafd1f36968f3a0e" dependencies = [ - "bitflags 2.3.1", + "bitflags 2.3.3", "ctor", "napi-derive", "napi-sys", @@ -1731,9 +1739,9 @@ dependencies = [ [[package]] name = "num-bigint-dig" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2399c9463abc5f909349d8aa9ba080e0b88b3ce2885389b60b993f39b1a56905" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" dependencies = [ "byteorder", "lazy_static", @@ -1779,19 +1787,19 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi", "libc", ] [[package]] name = "object" -version = "0.30.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" dependencies = [ "memchr", ] @@ -1826,9 +1834,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.54" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags 1.3.2", "cfg-if", @@ -1847,7 +1855,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -1858,9 +1866,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.88" +version = "0.9.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" dependencies = [ "cc", "libc", @@ -1898,15 +1906,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.1", ] [[package]] @@ -1920,9 +1928,9 @@ dependencies = [ [[package]] name = "pbkdf2" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ca0b5a68607598bf3bad68f32227a8164f6254833f84eafaac409cd6746c31" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest", ] @@ -1938,15 +1946,15 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -1983,12 +1991,12 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plist" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" dependencies = [ "base64 0.21.2", - "indexmap", + "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", @@ -2003,9 +2011,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" dependencies = [ "unicode-ident", ] @@ -2108,18 +2116,18 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -2183,7 +2191,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -2219,20 +2227,32 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "regex" -version = "1.8.3" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick 1.0.2", "memchr", - "regex-syntax 0.7.2", + "regex-automata", + "regex-syntax 0.7.4", +] + +[[package]] +name = "regex-automata" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" +dependencies = [ + "aho-corasick 1.0.2", + "memchr", + "regex-syntax 0.7.4", ] [[package]] @@ -2243,9 +2263,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "reqwest" @@ -2330,29 +2350,42 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.3", "windows-sys 0.48.0", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" [[package]] name = "safemem" @@ -2371,11 +2404,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -2458,22 +2491,22 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -2489,9 +2522,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" dependencies = [ "itoa", "ryu", @@ -2522,20 +2555,20 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" +checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "serde_spanned" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -2558,7 +2591,7 @@ version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" dependencies = [ - "indexmap", + "indexmap 1.9.3", "ryu", "serde", "yaml-rust", @@ -2566,11 +2599,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.21" +version = "0.9.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" +checksum = "452e67b9c20c37fa79df53201dc03839651086ed9bbe92b3ca585ca9fdaa7d85" dependencies = [ - "indexmap", + "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -2590,9 +2623,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -2659,9 +2692,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" @@ -2749,9 +2782,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" dependencies = [ "proc-macro2", "quote", @@ -2781,21 +2814,22 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.7" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" +checksum = "df8e77cb757a61f51b947ec4a7e3646efd825b73561db1c232a8ccb639e611a0" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.45.0", + "rustix 0.37.23", + "windows-sys 0.48.0", ] [[package]] @@ -2809,22 +2843,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -2839,9 +2873,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" dependencies = [ "itoa", "serde", @@ -2857,9 +2891,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" dependencies = [ "time-core", ] @@ -2881,11 +2915,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -2906,7 +2941,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -2935,9 +2970,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", @@ -2947,20 +2982,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.10" +version = "0.19.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" +checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" dependencies = [ - "indexmap", + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", @@ -3044,9 +3079,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" [[package]] name = "unicode-normalization" @@ -3083,9 +3118,9 @@ checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -3101,9 +3136,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" dependencies = [ "serde", ] @@ -3144,11 +3179,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -3166,9 +3200,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "serde", @@ -3178,24 +3212,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -3205,9 +3239,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3215,28 +3249,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-bindgen-test" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e636f3a428ff62b3742ebc3c70e254dfe12b8c2b469d688ea59cdd4abcf502" +checksum = "6e6e302a7ea94f83a6d09e78e7dc7d9ca7b186bc2829c24a22d0753efd680671" dependencies = [ "console_error_panic_hook", "js-sys", @@ -3248,9 +3282,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f18c1fad2f7c4958e7bcce014fa212f59a65d5e3721d0f77e6c0b27ede936ba3" +checksum = "ecb993dd8c836930ed130e020e77d9b2e65dd0fbab1b67c790b0f5d80b11a575" dependencies = [ "proc-macro2", "quote", @@ -3258,9 +3292,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -3303,22 +3337,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets 0.48.1", ] [[package]] @@ -3336,7 +3355,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -3356,9 +3375,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -3455,9 +3474,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" dependencies = [ "memchr", ] @@ -3473,9 +3492,9 @@ dependencies = [ [[package]] name = "wiremock" -version = "0.5.18" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7b0b5b253ebc0240d6aac6dd671c495c467420577bf634d3064ae7e6fa2b4c" +checksum = "c6f71803d3a1c80377a06221e0530be02035d5b3e854af56c6ece7ac20ac441d" dependencies = [ "assert-json-diff", "async-trait", diff --git a/crates/bitwarden-napi/package-lock.json b/crates/bitwarden-napi/package-lock.json index bed413648a..91ad63393c 100644 --- a/crates/bitwarden-napi/package-lock.json +++ b/crates/bitwarden-napi/package-lock.json @@ -95,16 +95,16 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true, "peer": true }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -193,9 +193,9 @@ } }, "node_modules/typescript": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", - "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -284,16 +284,16 @@ "dev": true }, "@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true, "peer": true }, "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true }, "acorn-walk": { @@ -348,9 +348,9 @@ } }, "typescript": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", - "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true }, "v8-compile-cache-lib": { diff --git a/languages/js_webassembly/package-lock.json b/languages/js_webassembly/package-lock.json index 21a77c5571..d9985f1bfd 100644 --- a/languages/js_webassembly/package-lock.json +++ b/languages/js_webassembly/package-lock.json @@ -56,9 +56,9 @@ } }, "node_modules/@jridgewell/source-map": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz", - "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", "dev": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.0", @@ -132,9 +132,9 @@ } }, "node_modules/@types/eslint": { - "version": "8.40.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.40.0.tgz", - "integrity": "sha512-nbq2mvc/tBrK9zQQuItvjJl++GTN5j06DaPtp3hZCpngmG6Q3xoyEmd0TwZI0gAy/G1X0zhGBbr2imsGFdFV0g==", + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.0.tgz", + "integrity": "sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw==", "dev": true, "dependencies": { "@types/estree": "*", @@ -187,6 +187,12 @@ "integrity": "sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==", "dev": true }, + "node_modules/@types/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==", + "dev": true + }, "node_modules/@types/http-proxy": { "version": "1.17.11", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz", @@ -209,9 +215,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true }, "node_modules/@types/qs": { @@ -252,11 +258,12 @@ } }, "node_modules/@types/serve-static": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", - "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==", + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.2.tgz", + "integrity": "sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw==", "dev": true, "dependencies": { + "@types/http-errors": "*", "@types/mime": "*", "@types/node": "*" } @@ -271,9 +278,9 @@ } }, "node_modules/@types/ws": { - "version": "8.5.4", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz", - "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", "dev": true, "dependencies": { "@types/node": "*" @@ -495,9 +502,9 @@ } }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -752,9 +759,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.7.tgz", - "integrity": "sha512-BauCXrQ7I2ftSqd2mvKHGo85XR0u7Ru3C/Hxsy/0TkfCtjrmAbPdzLGasmoiBxplpDXlPvdjX9u7srIMfgasNA==", + "version": "4.21.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", + "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", "dev": true, "funding": [ { @@ -771,8 +778,8 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001489", - "electron-to-chromium": "^1.4.411", + "caniuse-lite": "^1.0.30001503", + "electron-to-chromium": "^1.4.431", "node-releases": "^2.0.12", "update-browserslist-db": "^1.0.11" }, @@ -822,9 +829,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001494", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001494.tgz", - "integrity": "sha512-sY2B5Qyl46ZzfYDegrl8GBCzdawSLT4ThM9b9F+aDYUrAG2zCOyMbd2Tq34mS1g4ZKBfjRlzOohQMxx28x6wJg==", + "version": "1.0.30001515", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", + "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", "dev": true, "funding": [ { @@ -1250,9 +1257,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.419", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.419.tgz", - "integrity": "sha512-jdie3RiEgygvDTyS2sgjq71B36q2cDSBfPlwzUyuOrfYTNoYWyBxxjGJV/HAu3A2hB0Y+HesvCVkVAFoCKwCSw==", + "version": "1.4.455", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.455.tgz", + "integrity": "sha512-8tgdX0Odl24LtmLwxotpJCVjIndN559AvaOtd67u+2mo+IDsgsTF580NB+uuDCqsHw8yFg53l5+imFV9Fw3cbA==", "dev": true }, "node_modules/encodeurl": { @@ -1265,9 +1272,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.14.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.1.tgz", - "integrity": "sha512-Vklwq2vDKtl0y/vtwjSesgJ5MYS7Etuk5txS8VdKL4AOS1aUlD96zqIfsOSLQsdv3xgMRbtkWM8eG9XDfKUPow==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -1287,9 +1294,9 @@ } }, "node_modules/envinfo": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", - "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", + "integrity": "sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw==", "dev": true, "bin": { "envinfo": "dist/cli.js" @@ -1299,9 +1306,9 @@ } }, "node_modules/es-module-lexer": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", - "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.0.tgz", + "integrity": "sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA==", "dev": true }, "node_modules/escalade": { @@ -1801,10 +1808,20 @@ } }, "node_modules/html-entities": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", - "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==", - "dev": true + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz", + "integrity": "sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ] }, "node_modules/html-minifier-terser": { "version": "6.1.0", @@ -2265,12 +2282,12 @@ } }, "node_modules/memfs": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.2.tgz", - "integrity": "sha512-4kbWXbVZ+LU4XFDS2CuA7frnwz2HxCMB/0yOXc86q7aCQrfWKkL11t6al1e2CsVC7uhnBNTQ1TfUsAxVauO9IQ==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.3.tgz", + "integrity": "sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==", "dev": true, "dependencies": { - "fs-monkey": "^1.0.3" + "fs-monkey": "^1.0.4" }, "engines": { "node": ">= 4.0.0" @@ -2470,9 +2487,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.12.tgz", - "integrity": "sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==", + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", "dev": true }, "node_modules/normalize-path": { @@ -3000,9 +3017,9 @@ "dev": true }, "node_modules/schema-utils": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.2.tgz", - "integrity": "sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.8", @@ -3036,9 +3053,9 @@ } }, "node_modules/semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -3431,9 +3448,9 @@ } }, "node_modules/terser": { - "version": "5.17.7", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.7.tgz", - "integrity": "sha512-/bi0Zm2C6VAexlGgLlVxA0P2lru/sdLyfCVaRMfKVo9nWxbmz7f/sD8VPybPeSUJaJcwmCJis9pBIhcVcG1QcQ==", + "version": "5.19.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.0.tgz", + "integrity": "sha512-JpcpGOQLOXm2jsomozdMDpd5f8ZHh1rR48OFgWUH3QsyZcfPgv2qDCYbcDEAYNd4OZRj2bWYKpwdll/udZCk/Q==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -3542,9 +3559,9 @@ } }, "node_modules/tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", "dev": true }, "node_modules/type-is": { @@ -3561,9 +3578,9 @@ } }, "node_modules/typescript": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", - "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true, "peer": true, "bin": { @@ -3855,9 +3872,9 @@ "dev": true }, "node_modules/webpack-dev-middleware/node_modules/schema-utils": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", - "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", @@ -3967,9 +3984,9 @@ "dev": true }, "node_modules/webpack-dev-server/node_modules/schema-utils": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", - "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", @@ -4116,9 +4133,9 @@ "dev": true }, "@jridgewell/source-map": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz", - "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", "dev": true, "requires": { "@jridgewell/gen-mapping": "^0.3.0", @@ -4194,9 +4211,9 @@ } }, "@types/eslint": { - "version": "8.40.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.40.0.tgz", - "integrity": "sha512-nbq2mvc/tBrK9zQQuItvjJl++GTN5j06DaPtp3hZCpngmG6Q3xoyEmd0TwZI0gAy/G1X0zhGBbr2imsGFdFV0g==", + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.0.tgz", + "integrity": "sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw==", "dev": true, "requires": { "@types/estree": "*", @@ -4249,6 +4266,12 @@ "integrity": "sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==", "dev": true }, + "@types/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==", + "dev": true + }, "@types/http-proxy": { "version": "1.17.11", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz", @@ -4271,9 +4294,9 @@ "dev": true }, "@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true }, "@types/qs": { @@ -4314,11 +4337,12 @@ } }, "@types/serve-static": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", - "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==", + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.2.tgz", + "integrity": "sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw==", "dev": true, "requires": { + "@types/http-errors": "*", "@types/mime": "*", "@types/node": "*" } @@ -4333,9 +4357,9 @@ } }, "@types/ws": { - "version": "8.5.4", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz", - "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", + "version": "8.5.5", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", + "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", "dev": true, "requires": { "@types/node": "*" @@ -4531,9 +4555,9 @@ } }, "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true }, "acorn-import-assertions": { @@ -4732,13 +4756,13 @@ } }, "browserslist": { - "version": "4.21.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.7.tgz", - "integrity": "sha512-BauCXrQ7I2ftSqd2mvKHGo85XR0u7Ru3C/Hxsy/0TkfCtjrmAbPdzLGasmoiBxplpDXlPvdjX9u7srIMfgasNA==", + "version": "4.21.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", + "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001489", - "electron-to-chromium": "^1.4.411", + "caniuse-lite": "^1.0.30001503", + "electron-to-chromium": "^1.4.431", "node-releases": "^2.0.12", "update-browserslist-db": "^1.0.11" } @@ -4776,9 +4800,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001494", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001494.tgz", - "integrity": "sha512-sY2B5Qyl46ZzfYDegrl8GBCzdawSLT4ThM9b9F+aDYUrAG2zCOyMbd2Tq34mS1g4ZKBfjRlzOohQMxx28x6wJg==", + "version": "1.0.30001515", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", + "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", "dev": true }, "chalk": { @@ -5093,9 +5117,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.419", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.419.tgz", - "integrity": "sha512-jdie3RiEgygvDTyS2sgjq71B36q2cDSBfPlwzUyuOrfYTNoYWyBxxjGJV/HAu3A2hB0Y+HesvCVkVAFoCKwCSw==", + "version": "1.4.455", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.455.tgz", + "integrity": "sha512-8tgdX0Odl24LtmLwxotpJCVjIndN559AvaOtd67u+2mo+IDsgsTF580NB+uuDCqsHw8yFg53l5+imFV9Fw3cbA==", "dev": true }, "encodeurl": { @@ -5105,9 +5129,9 @@ "dev": true }, "enhanced-resolve": { - "version": "5.14.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.1.tgz", - "integrity": "sha512-Vklwq2vDKtl0y/vtwjSesgJ5MYS7Etuk5txS8VdKL4AOS1aUlD96zqIfsOSLQsdv3xgMRbtkWM8eG9XDfKUPow==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", "dev": true, "requires": { "graceful-fs": "^4.2.4", @@ -5121,15 +5145,15 @@ "dev": true }, "envinfo": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", - "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", + "integrity": "sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw==", "dev": true }, "es-module-lexer": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", - "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.0.tgz", + "integrity": "sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA==", "dev": true }, "escalade": { @@ -5520,9 +5544,9 @@ } }, "html-entities": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", - "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz", + "integrity": "sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==", "dev": true }, "html-minifier-terser": { @@ -5856,12 +5880,12 @@ "dev": true }, "memfs": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.2.tgz", - "integrity": "sha512-4kbWXbVZ+LU4XFDS2CuA7frnwz2HxCMB/0yOXc86q7aCQrfWKkL11t6al1e2CsVC7uhnBNTQ1TfUsAxVauO9IQ==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.3.tgz", + "integrity": "sha512-UERzLsxzllchadvbPs5aolHh65ISpKpM+ccLbOJ8/vvpBKmAWf+la7dXFy7Mr0ySHbdHrFv5kGFCUHHe6GFEmw==", "dev": true, "requires": { - "fs-monkey": "^1.0.3" + "fs-monkey": "^1.0.4" } }, "merge-descriptors": { @@ -6012,9 +6036,9 @@ "dev": true }, "node-releases": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.12.tgz", - "integrity": "sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==", + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", "dev": true }, "normalize-path": { @@ -6406,9 +6430,9 @@ "dev": true }, "schema-utils": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.2.tgz", - "integrity": "sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, "requires": { "@types/json-schema": "^7.0.8", @@ -6432,9 +6456,9 @@ } }, "semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -6750,9 +6774,9 @@ } }, "terser": { - "version": "5.17.7", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.7.tgz", - "integrity": "sha512-/bi0Zm2C6VAexlGgLlVxA0P2lru/sdLyfCVaRMfKVo9nWxbmz7f/sD8VPybPeSUJaJcwmCJis9pBIhcVcG1QcQ==", + "version": "5.19.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.0.tgz", + "integrity": "sha512-JpcpGOQLOXm2jsomozdMDpd5f8ZHh1rR48OFgWUH3QsyZcfPgv2qDCYbcDEAYNd4OZRj2bWYKpwdll/udZCk/Q==", "dev": true, "requires": { "@jridgewell/source-map": "^0.3.3", @@ -6822,9 +6846,9 @@ } }, "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", "dev": true }, "type-is": { @@ -6838,9 +6862,9 @@ } }, "typescript": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", - "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true, "peer": true }, @@ -7029,9 +7053,9 @@ "dev": true }, "schema-utils": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", - "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", @@ -7108,9 +7132,9 @@ "dev": true }, "schema-utils": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", - "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", diff --git a/package-lock.json b/package-lock.json index d46a9414c6..52c80835b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,9 +18,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.22.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.3.tgz", - "integrity": "sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz", + "integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==", "dev": true, "dependencies": { "regenerator-runtime": "^0.13.11" @@ -404,9 +404,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true, "peer": true }, @@ -429,9 +429,9 @@ } }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -799,12 +799,12 @@ "dev": true }, "node_modules/cross-fetch": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.6.tgz", - "integrity": "sha512-riRvo06crlE8HiqOwIpQhxwdOk4fOeR7FVM/wXoxchFEqMNUjvbs3bfo4OTgMEMHzppd4DxFBDbyySj8Cv781g==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", "dev": true, "dependencies": { - "node-fetch": "^2.6.11" + "node-fetch": "^2.6.12" } }, "node_modules/cross-spawn": { @@ -1269,9 +1269,9 @@ } }, "node_modules/lru-cache": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.2.tgz", - "integrity": "sha512-ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -1326,9 +1326,9 @@ } }, "node_modules/minipass": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", - "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.2.tgz", + "integrity": "sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==", "dev": true, "engines": { "node": ">=16 || 14 >=14.17" @@ -1341,9 +1341,9 @@ "dev": true }, "node_modules/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", "dev": true, "dependencies": { "whatwg-url": "^5.0.0" @@ -1441,13 +1441,13 @@ } }, "node_modules/path-scurry": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.9.2.tgz", - "integrity": "sha512-qSDLy2aGFPm8i4rsbHd4MNyTcrzHFsLQykrtbuGRknZZCBBVXSv2tSCDN2Cg6Rt/GFRw8GoW9y9Ecw5rIPG1sg==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", "dev": true, "dependencies": { - "lru-cache": "^9.1.1", - "minipass": "^5.0.0 || ^6.0.2" + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -1633,16 +1633,16 @@ } }, "node_modules/rimraf/node_modules/glob": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.6.tgz", - "integrity": "sha512-U/rnDpXJGF414QQQZv5uVsabTVxMSwzS5CH0p3DRCIV6ownl4f7PzGnkGmvlum2wB+9RlJWJZ6ACU1INnBqiPA==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.7.0" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" }, "bin": { "glob": "dist/cjs/src/bin.js" @@ -1655,9 +1655,9 @@ } }, "node_modules/rimraf/node_modules/minimatch": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", - "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -1688,9 +1688,9 @@ } }, "node_modules/rxjs/node_modules/tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", "dev": true }, "node_modules/safe-buffer": { @@ -2159,9 +2159,9 @@ }, "dependencies": { "@babel/runtime": { - "version": "7.22.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.3.tgz", - "integrity": "sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz", + "integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==", "dev": true, "requires": { "regenerator-runtime": "^0.13.11" @@ -2416,9 +2416,9 @@ "dev": true }, "@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", + "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", "dev": true, "peer": true }, @@ -2438,9 +2438,9 @@ } }, "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true }, "acorn-walk": { @@ -2710,12 +2710,12 @@ "dev": true }, "cross-fetch": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.6.tgz", - "integrity": "sha512-riRvo06crlE8HiqOwIpQhxwdOk4fOeR7FVM/wXoxchFEqMNUjvbs3bfo4OTgMEMHzppd4DxFBDbyySj8Cv781g==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", "dev": true, "requires": { - "node-fetch": "^2.6.11" + "node-fetch": "^2.6.12" } }, "cross-spawn": { @@ -3047,9 +3047,9 @@ } }, "lru-cache": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.2.tgz", - "integrity": "sha512-ERJq3FOzJTxBbFjZ7iDs+NiK4VI9Wz+RdrrAB8dio1oV+YvdPzUEE4QNiT2VD51DkIbCYRUUzCRkssXCHqSnKQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", "dev": true }, "make-error": { @@ -3089,9 +3089,9 @@ } }, "minipass": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-6.0.2.tgz", - "integrity": "sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.2.tgz", + "integrity": "sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA==", "dev": true }, "mute-stream": { @@ -3101,9 +3101,9 @@ "dev": true }, "node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", "dev": true, "requires": { "whatwg-url": "^5.0.0" @@ -3169,13 +3169,13 @@ "dev": true }, "path-scurry": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.9.2.tgz", - "integrity": "sha512-qSDLy2aGFPm8i4rsbHd4MNyTcrzHFsLQykrtbuGRknZZCBBVXSv2tSCDN2Cg6Rt/GFRw8GoW9y9Ecw5rIPG1sg==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", "dev": true, "requires": { - "lru-cache": "^9.1.1", - "minipass": "^5.0.0 || ^6.0.2" + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "path-to-regexp": { @@ -3307,22 +3307,22 @@ } }, "glob": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.6.tgz", - "integrity": "sha512-U/rnDpXJGF414QQQZv5uVsabTVxMSwzS5CH0p3DRCIV6ownl4f7PzGnkGmvlum2wB+9RlJWJZ6ACU1INnBqiPA==", + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", "dev": true, "requires": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2", - "path-scurry": "^1.7.0" + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" } }, "minimatch": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", - "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "requires": { "brace-expansion": "^2.0.1" @@ -3346,9 +3346,9 @@ }, "dependencies": { "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", "dev": true } } From d3a4cad761fa328dbccbce09e64501dd391e9b54 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 11 Jul 2023 22:23:38 +0200 Subject: [PATCH 14/32] Renovate: Disable non-breaking updates for rust (#90) * Change renovate to not update minor for unstable dependencies --- .github/renovate.json | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 8f2bf4424e..5d705d79de 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,19 +1,35 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:base", "schedule:monthly", ":maintainLockFilesWeekly"], + "extends": [ + "config:base", + "schedule:weekends", + ":combinePatchMinorReleases", + ":dependencyDashboard", + ":maintainLockFilesWeekly", + ":prConcurrentLimit10", + ":rebaseStalePrs", + ":separateMajorReleases" + ], "separateMajorMinor": true, + "enabledManagers": ["cargo", "github-actions", "npm", "nuget"], "packageRules": [ { + "groupName": "npm minor", "matchManagers": ["npm"], - "matchPackagePatterns": ["*"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "node non-major" + "matchUpdateTypes": ["minor", "patch"] }, { "matchManagers": ["cargo"], - "matchPackagePatterns": ["*"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "rust non-major" + "matchUpdateTypes": ["patch"], + "groupName": "rust non-breaking", + "enabled": false + }, + { + "matchManagers": ["cargo"], + "matchUpdateTypes": ["minor"], + "matchCurrentVersion": ">=1.0.0", + "groupName": "rust non-breaking", + "enabled": false }, { "matchManagers": ["cargo"], @@ -22,15 +38,14 @@ "groupName": "pyo3 non-major" }, { + "groupName": "nuget minor", "matchManagers": ["nuget"], - "matchPackagePatterns": ["*"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "dotnet non-major" + "matchUpdateTypes": ["minor", "patch"] }, { + "groupName": "gh minor", "matchManagers": ["github-actions"], - "matchPackagePatterns": ["*"], - "groupName": "gh actions all" + "matchUpdateTypes": ["minor", "patch"] } ] } From 3ea2cb4a21e934ab0e7f7c72d0699e379e7e1802 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:02:34 +0200 Subject: [PATCH 15/32] Update dependency prettier to v3 (#95) * Update dependency prettier to v3 * Re-run prettier --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Hinton --- .../src-ts/bitwarden_client/index.ts | 16 ++++++++-------- package-lock.json | 18 +++++++++--------- package.json | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts index 06a3b827aa..1b8c31f481 100644 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts +++ b/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts @@ -25,7 +25,7 @@ export class BitwardenClient { email: email, password: password, }, - }) + }), ); return Convert.toResponseForPasswordLoginResponse(response); @@ -74,7 +74,7 @@ export class SecretsClient { secrets: { get: { id }, }, - }) + }), ); return Convert.toResponseForSecretResponse(response); @@ -84,14 +84,14 @@ export class SecretsClient { key: string, note: string, organizationId: string, - value: string + value: string, ): Promise { const response = await this.client.runCommand( Convert.commandToJson({ secrets: { create: { key, note, organizationId, value }, }, - }) + }), ); return Convert.toResponseForSecretResponse(response); @@ -103,7 +103,7 @@ export class SecretsClient { secrets: { list: { organizationId }, }, - }) + }), ); return Convert.toResponseForSecretIdentifiersResponse(response); @@ -114,14 +114,14 @@ export class SecretsClient { key: string, note: string, organizationId: string, - value: string + value: string, ): Promise { const response = await this.client.runCommand( Convert.commandToJson({ secrets: { update: { id, key, note, organizationId, value }, }, - }) + }), ); return Convert.toResponseForSecretResponse(response); @@ -133,7 +133,7 @@ export class SecretsClient { secrets: { delete: { ids }, }, - }) + }), ); return Convert.toResponseForSecretsDeleteResponse(response); diff --git a/package-lock.json b/package-lock.json index 52c80835b4..e7cb1e1a82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "SEE LICENSE IN LICENSE", "devDependencies": { "@openapitools/openapi-generator-cli": "2.6.0", - "prettier": "2.8.8", + "prettier": "3.0.0", "quicktype-core": "21.0.16", "rimraf": "5.0.0", "ts-node": "10.9.1", @@ -1472,15 +1472,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -3191,9 +3191,9 @@ "dev": true }, "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true }, "process": { diff --git a/package.json b/package.json index f286ddfd6e..d8d2f3fe90 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "devDependencies": { "@openapitools/openapi-generator-cli": "2.6.0", - "prettier": "2.8.8", + "prettier": "3.0.0", "quicktype-core": "21.0.16", "rimraf": "5.0.0", "ts-node": "10.9.1", From a418e47f55e3871fb2871c6a5286bc25f8567423 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:34:15 +0200 Subject: [PATCH 16/32] Update gh minor (#98) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build-cli.yml | 8 ++++---- .github/workflows/build-napi.yml | 6 +++--- .github/workflows/build-rust-crates.yml | 8 ++++---- .github/workflows/cloc.yml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/publish-rust-crates.yml | 6 +++--- .github/workflows/release-cli.yml | 6 +++--- .github/workflows/release-napi.yml | 6 +++--- .github/workflows/rust-test.yml | 8 ++++---- .github/workflows/version-bump.yml | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 72f16c11b9..cb6868eafa 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -22,7 +22,7 @@ jobs: package_version: ${{ steps.retrieve-version.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Get Package Version id: retrieve-version @@ -57,7 +57,7 @@ jobs: # target: aarch64-unknown-linux-gnu steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -73,7 +73,7 @@ jobs: sudo apt-get install gcc-aarch64-linux-gnu - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 with: key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} @@ -108,7 +108,7 @@ jobs: _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Download x86_64-apple-darwin artifact uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml index c76035cde1..18f60d981f 100644 --- a/.github/workflows/build-napi.yml +++ b/.github/workflows/build-napi.yml @@ -47,10 +47,10 @@ jobs: strip *.node steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Setup Node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: node-version: 18 cache: "npm" @@ -65,7 +65,7 @@ jobs: target: ${{ matrix.settings.target }} - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 with: key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index 0a40d9c5ab..52a1e670b2 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -45,7 +45,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: Build uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 @@ -68,7 +68,7 @@ jobs: - build steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -79,7 +79,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: Install cargo-release run: cargo install cargo-release diff --git a/.github/workflows/cloc.yml b/.github/workflows/cloc.yml index fcf9ea013f..83f7aa3511 100644 --- a/.github/workflows/cloc.yml +++ b/.github/workflows/cloc.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Set up cloc run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cac283e9fc..1d72621a5f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -34,7 +34,7 @@ jobs: args: -- --check - name: Set up Node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: "npm" cache-dependency-path: "package-lock.json" diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index e8e1fa6792..9b9686fc21 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -43,7 +43,7 @@ jobs: packages_command: ${{ steps.packages-list.outputs.packages_command }} steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -100,7 +100,7 @@ jobs: - setup steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Login to Azure uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 @@ -122,7 +122,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: Install cargo-release run: cargo install cargo-release diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index ce46223310..5f3d1855ab 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -27,7 +27,7 @@ jobs: release-version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -123,7 +123,7 @@ jobs: - setup steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Login to Azure uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 @@ -145,7 +145,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: Install cargo-release run: cargo install cargo-release diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index c10c956989..c48fe6c4b0 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -33,7 +33,7 @@ jobs: release-version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -122,10 +122,10 @@ jobs: _PKG_VERSION: ${{ needs.setup.outputs.release-version }} steps: - name: Checkout repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Setup Node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: node-version: 18 cache: "npm" diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index 55e56f0d07..d6927c847b 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -44,7 +44,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: Build uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 @@ -63,7 +63,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -74,7 +74,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: Check uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 9db7af0542..1193d4575a 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Branch - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -40,7 +40,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: Install cargo-release run: cargo install cargo-edit From 98ac5df19caf51a5b781f34e789dc2032c55fd74 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:39:38 +0200 Subject: [PATCH 17/32] Update bitwarden/gh-actions digest to a30e9c3 (#97) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/publish-rust-crates.yml | 2 +- .github/workflows/release-cli.yml | 8 ++++---- .github/workflows/release-napi.yml | 12 ++++++------ .github/workflows/version-bump.yml | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index 9b9686fc21..bf43b91ede 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -109,7 +109,7 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: keyvault: "bitwarden-prod-kv" secrets: "cratesio-api-token" diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 5f3d1855ab..e2733e0a2c 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -58,7 +58,7 @@ jobs: - name: Download all Release artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: workflow: build-cli.yml path: packages @@ -67,7 +67,7 @@ jobs: - name: Dry Run - Download all artifacts if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: workflow: build-cli.yml path: packages @@ -75,7 +75,7 @@ jobs: branch: master - name: Get checksum files - uses: bitwarden/gh-actions/get-checksum@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/get-checksum@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: packages_dir: "packages" file_path: "packages/bws-sha256-checksums-${{ steps.version.outputs.version }}.txt" @@ -132,7 +132,7 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: keyvault: "bitwarden-prod-kv" secrets: "cratesio-api-token" diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index c48fe6c4b0..276a72c786 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -47,7 +47,7 @@ jobs: - name: Check Release Version id: version - uses: bitwarden/gh-actions/release-version-check@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/release-version-check@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: release-type: ${{ github.event.inputs.release_type }} project-type: ts @@ -67,7 +67,7 @@ jobs: - name: Download all Release artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: workflow: build-napi.yml path: artifacts @@ -76,7 +76,7 @@ jobs: - name: Dry Run - Download all artifacts if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: workflow: build-napi.yml path: artifacts @@ -144,14 +144,14 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: keyvault: "bitwarden-prod-kv" secrets: "npm-api-key" - name: Download artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: workflow: build-napi.yml path: ${{ github.workspace }}/crates/bitwarden-napi/artifacts @@ -160,7 +160,7 @@ jobs: - name: Dry Run - Download artifacts if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: workflow: build-napi.yml path: ${{ github.workspace }}/crates/bitwarden-napi/artifacts diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 1193d4575a..0ed09ec5a4 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -52,7 +52,7 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: keyvault: "bitwarden-prod-kv" secrets: "github-gpg-private-key, github-gpg-private-key-passphrase" From 3f5b0367c8962fd75fbe29f4ab2152ac7971fd38 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Wed, 12 Jul 2023 16:56:32 +0200 Subject: [PATCH 18/32] Add workflow for testing direct minimal versions (#89) * Add workflow for testing direct minimal versions * Fix workflow * Add runs-on * Change to nightly * Use all-features * Rename workflow * Disable mac --- .github/workflows/direct-minimal-versions.yml | 57 +++++++++++++++++++ Cargo.toml | 1 + 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/direct-minimal-versions.yml diff --git a/.github/workflows/direct-minimal-versions.yml b/.github/workflows/direct-minimal-versions.yml new file mode 100644 index 0000000000..925ff0898f --- /dev/null +++ b/.github/workflows/direct-minimal-versions.yml @@ -0,0 +1,57 @@ +--- +name: Direct Minimum Version + +on: + pull_request: + push: + branches: + - "master" + - "rc" + - "hotfix-rc" + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + direct-minimal-versions: + name: Check dependencies minimal versions for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} + runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} + strategy: + fail-fast: false + matrix: + settings: + #- os: macos-12 + # target: x86_64-apple-darwin + + #- os: macos-12 + # target: aarch64-apple-darwin + + - os: windows-2022 + target: x86_64-pc-windows-msvc + + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + + steps: + - name: Checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + + - name: Install rust + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + toolchain: nightly + profile: minimal + override: true + + - name: Cache cargo registry + uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + with: + key: dmv-${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} + + - name: cargo check direct-minimal-versions + uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 + with: + command: check + args: -Z direct-minimal-versions --all-features diff --git a/Cargo.toml b/Cargo.toml index 8bf86ff560..d405dc5013 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = ["crates/*"] From 8091e778fab9c8c375d752e0c2f89f0a3ad2021d Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Wed, 12 Jul 2023 16:57:53 +0200 Subject: [PATCH 19/32] Set rangeStrategy to widen (#99) --- .github/renovate.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 5d705d79de..d6e1832936 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -18,17 +18,19 @@ "matchManagers": ["npm"], "matchUpdateTypes": ["minor", "patch"] }, + { + "matchManagers": ["cargo"], + "rangeStrategy": "widen" + }, { "matchManagers": ["cargo"], "matchUpdateTypes": ["patch"], - "groupName": "rust non-breaking", "enabled": false }, { "matchManagers": ["cargo"], "matchUpdateTypes": ["minor"], "matchCurrentVersion": ">=1.0.0", - "groupName": "rust non-breaking", "enabled": false }, { From 80d62ca0b158cd1f57c6d48b02c5e387618bc08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Thu, 13 Jul 2023 16:59:33 +0200 Subject: [PATCH 20/32] Remove schemas from repo (#72) * Remove schemas from repo * Make sure schema fields are generated in the same order as the rust structs * Separate schema generation into another workflow * Use generated schemas also on release-napi * Enable rust cache and remove duplicate download from release workflow * Retrieve schemas in release, but without triggering the workflow * Use bitwarden/gh-actions/download-artifacts * Change download schema names and switch dry run branch to master * Pin ubuntu runner version in schemas workflow Co-authored-by: mimartin12 <77340197+mimartin12@users.noreply.github.com> * UPDATE: Change the azkv name and gh secret (#91) * Change release-napi branch to test dry-run * Revert "Change release-napi branch to test dry-run" This reverts commit 73ae2cd3263b9f22467def58cc671c38457e7b09. --------- Co-authored-by: mimartin12 <77340197+mimartin12@users.noreply.github.com> --- .github/workflows/build-napi.yml | 10 + .github/workflows/generate_schemas.yml | 67 + .github/workflows/lint.yml | 10 - .github/workflows/release-napi.yml | 24 +- .gitignore | 7 + Cargo.lock | 2 + .../src-ts/bitwarden_client/schemas.ts | 1072 ------------- crates/sdk-schemas/Cargo.toml | 2 +- languages/csharp/schemas.cs | 1049 ------------- .../bitwarden_client/schemas.ts | 1072 ------------- languages/python/BitwardenClient/schemas.py | 1333 ----------------- .../bitwarden/client/ClientSettings.json | 64 - support/schemas/bitwarden_json/Command.json | 557 ------- .../schemas/response/ApiKeyLoginResponse.json | 203 --- .../response/PasswordLoginResponse.json | 228 --- .../response/SecretIdentifiersResponse.json | 72 - support/schemas/response/SecretResponse.json | 84 -- .../response/SecretsDeleteResponse.json | 69 - 18 files changed, 109 insertions(+), 5816 deletions(-) create mode 100644 .github/workflows/generate_schemas.yml delete mode 100644 crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts delete mode 100644 languages/csharp/schemas.cs delete mode 100644 languages/js_webassembly/bitwarden_client/schemas.ts delete mode 100644 languages/python/BitwardenClient/schemas.py delete mode 100644 support/schemas/bitwarden/client/ClientSettings.json delete mode 100644 support/schemas/bitwarden_json/Command.json delete mode 100644 support/schemas/response/ApiKeyLoginResponse.json delete mode 100644 support/schemas/response/PasswordLoginResponse.json delete mode 100644 support/schemas/response/SecretIdentifiersResponse.json delete mode 100644 support/schemas/response/SecretResponse.json delete mode 100644 support/schemas/response/SecretsDeleteResponse.json diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml index 18f60d981f..daad93afe6 100644 --- a/.github/workflows/build-napi.yml +++ b/.github/workflows/build-napi.yml @@ -16,9 +16,13 @@ defaults: working-directory: crates/bitwarden-napi jobs: + generate_schemas: + uses: ./.github/workflows/generate_schemas.yml + build: name: Building @bitwarden/sdk-napi for - ${{ matrix.settings.os }} runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} + needs: generate_schemas strategy: fail-fast: false matrix: @@ -69,6 +73,12 @@ jobs: with: key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} + - name: Retrieve schemas + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: schemas.ts + path: ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/ + - name: Install dependencies run: npm ci diff --git a/.github/workflows/generate_schemas.yml b/.github/workflows/generate_schemas.yml new file mode 100644 index 0000000000..e095709c2d --- /dev/null +++ b/.github/workflows/generate_schemas.yml @@ -0,0 +1,67 @@ +name: Generate schemas + +on: + workflow_call: + +env: + CARGO_TERM_COLOR: always + +jobs: + schemas: + name: Generate schemas + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + + - name: Install rust + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + toolchain: stable + profile: minimal + override: true + + - name: Set up Node + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + with: + cache: "npm" + cache-dependency-path: "package-lock.json" + node-version: "16" + + - name: NPM setup + run: npm ci + + - name: Cache cargo registry + uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + + - name: NPM Schemas + run: npm run schemas + + - name: Upload ts schemas artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: schemas.ts + path: ${{ github.workspace }}/languages/js_webassembly/bitwarden_client/schemas.ts + if-no-files-found: error + + - name: Upload c# schemas artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: schemas.cs + path: ${{ github.workspace }}/languages/csharp/schemas.cs + if-no-files-found: error + + - name: Upload python schemas artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: schemas.py + path: ${{ github.workspace }}/languages/python/BitwardenClient/schemas.py + if-no-files-found: error + + - name: Upload json schemas artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: sdk-schemas-json + path: ${{ github.workspace }}/support/schemas/* + if-no-files-found: error diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1d72621a5f..9382dd38f9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -46,16 +46,6 @@ jobs: - name: Node Lint run: npm run lint - - name: Verify Schemas are up to date - run: | - npm run schemas - git diff --exit-code HEAD - # Verify no untracked files - if [ ! -z "$(git status --porcelain)" ]; then - >&2 echo "Failed: Found untracked files!" - exit 1 - fi - - name: Verify rust documentation links run: cargo doc --no-deps --features internal env: diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index 276a72c786..68b7e3eab0 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -131,6 +131,26 @@ jobs: cache: "npm" cache-dependency-path: crates/bitwarden-napi/package-lock.json + - name: Download schemas + if: ${{ github.event.inputs.release_type != 'Dry Run' }} + uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + with: + workflow: build-napi.yml + artifacts: schemas.ts + path: ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/ + workflow_conclusion: success + branch: ${{ github.ref_name }} + + - name: Dry Run - Download schemas + if: ${{ github.event.inputs.release_type == 'Dry Run' }} + uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + with: + workflow: build-napi.yml + artifacts: schemas.ts + path: ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/ + workflow_conclusion: success + branch: master + - name: Install dependencies run: npm ci @@ -140,13 +160,13 @@ jobs: - name: Login to Azure uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 with: - creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - name: Retrieve secrets id: retrieve-secrets uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c with: - keyvault: "bitwarden-prod-kv" + keyvault: "bitwarden-ci" secrets: "npm-api-key" - name: Download artifacts diff --git a/.gitignore b/.gitignore index 56e8f6c14c..40e8c08aa5 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,10 @@ crates/bitwarden-napi/sdk-napi.*.node # Complied TypeScript client crates/bitwarden-napi/dist + +# Schemas +support/schemas +crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts +languages/csharp/schemas.cs +languages/js_webassembly/bitwarden_client/schemas.ts +languages/python/BitwardenClient/schemas.py diff --git a/Cargo.lock b/Cargo.lock index 58957fefd9..c841a212f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1414,6 +1414,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", + "serde", ] [[package]] @@ -2418,6 +2419,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" dependencies = [ "dyn-clone", + "indexmap 1.9.3", "schemars_derive", "serde", "serde_json", diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts deleted file mode 100644 index a0c9e3064f..0000000000 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts +++ /dev/null @@ -1,1072 +0,0 @@ -// To parse this data: -// -// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse } from "./file"; -// -// const clientSettings = Convert.toClientSettings(json); -// const command = Convert.toCommand(json); -// const responseForAPIKeyLoginResponse = Convert.toResponseForAPIKeyLoginResponse(json); -// const responseForPasswordLoginResponse = Convert.toResponseForPasswordLoginResponse(json); -// const responseForSecretIdentifiersResponse = Convert.toResponseForSecretIdentifiersResponse(json); -// const responseForSecretResponse = Convert.toResponseForSecretResponse(json); -// const responseForSecretsDeleteResponse = Convert.toResponseForSecretsDeleteResponse(json); -// -// These functions will throw an error if the JSON doesn't -// match the expected interface, even if the JSON is valid. - -/** - * 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::client::client_settings::{ClientSettings, DeviceType}; # use - * assert_matches::assert_matches; 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(); - * assert_matches!(settings, default); ``` - * - * Targets `localhost:8080` for debug builds. - */ -export interface ClientSettings { - /** - * The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com` - */ - apiUrl: string; - /** - * Device type to send to Bitwarden. Defaults to SDK - */ - deviceType: DeviceType; - /** - * The identity url of the targeted Bitwarden instance. Defaults to - * `https://identity.bitwarden.com` - */ - identityUrl: string; - /** - * The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK` - */ - userAgent: string; -} - -/** - * Device type to send to Bitwarden. Defaults to SDK - */ -export enum DeviceType { - Android = "Android", - AndroidAmazon = "AndroidAmazon", - ChromeBrowser = "ChromeBrowser", - ChromeExtension = "ChromeExtension", - EdgeBrowser = "EdgeBrowser", - EdgeExtension = "EdgeExtension", - FirefoxBrowser = "FirefoxBrowser", - FirefoxExtension = "FirefoxExtension", - IEBrowser = "IEBrowser", - IOS = "iOS", - LinuxDesktop = "LinuxDesktop", - MACOSDesktop = "MacOsDesktop", - OperaBrowser = "OperaBrowser", - OperaExtension = "OperaExtension", - SDK = "SDK", - SafariBrowser = "SafariBrowser", - SafariExtension = "SafariExtension", - UWP = "UWP", - UnknownBrowser = "UnknownBrowser", - VivaldiBrowser = "VivaldiBrowser", - VivaldiExtension = "VivaldiExtension", - WindowsDesktop = "WindowsDesktop", -} - -/** - * Login with username and password - * - * This command is for initiating an authentication handshake with Bitwarden. Authorization - * may fail due to requiring 2fa or captcha challenge completion despite accurate - * credentials. - * - * This command is not capable of handling authentication requiring 2fa or captcha. - * - * Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) - * - * Login with API Key - * - * This command is for initiating an authentication handshake with Bitwarden. - * - * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - * - * Login with Secrets Manager Access Token - * - * This command is for initiating an authentication handshake with Bitwarden. - * - * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - * - * > Requires Authentication Get the API key of the currently authenticated user - * - * Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) - * - * Get the user's passphrase - * - * Returns: String - * - * > Requires Authentication Retrieve all user data, ciphers and organizations the user is a - * part of - * - * Returns: [SyncResponse](bitwarden::platform::SyncResponse) - */ -export interface Command { - passwordLogin?: PasswordLoginRequest; - apiKeyLogin?: APIKeyLoginRequest; - accessTokenLogin?: AccessTokenLoginRequest; - getUserApiKey?: SecretVerificationRequest; - fingerprint?: FingerprintRequest; - sync?: SyncRequest; - secrets?: SecretsCommand; - projects?: ProjectsCommand; -} - -/** - * Login to Bitwarden with access token - */ -export interface AccessTokenLoginRequest { - /** - * Bitwarden service API access token - */ - accessToken: string; -} - -/** - * Login to Bitwarden with Api Key - */ -export interface APIKeyLoginRequest { - /** - * Bitwarden account client_id - */ - clientId: string; - /** - * Bitwarden account client_secret - */ - clientSecret: string; - /** - * Bitwarden account master password - */ - password: string; -} - -export interface FingerprintRequest { - /** - * The input material, used in the fingerprint generation process. - */ - fingerprintMaterial: string; - /** - * The user's public key - */ - publicKey: string; -} - -export interface SecretVerificationRequest { - /** - * The user's master password to use for user verification. If supplied, this will be used - * for verification purposes. - */ - masterPassword?: null | string; - /** - * 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. - */ - otp?: null | string; -} - -/** - * Login to Bitwarden with Username and Password - */ -export interface PasswordLoginRequest { - /** - * Bitwarden account email address - */ - email: string; - /** - * Bitwarden account master password - */ - password: string; -} - -/** - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Retrieve a project by the provided identifier - * - * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Creates a new project in the provided organization using the given data - * - * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Lists all projects of the given organization - * - * Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Updates an existing project with the provided ID using the given data - * - * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Deletes all the projects whose IDs match the provided ones - * - * Returns: - * [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) - */ -export interface ProjectsCommand { - get?: ProjectGetRequest; - create?: ProjectCreateRequest; - list?: ProjectsListRequest; - update?: ProjectPutRequest; - delete?: ProjectsDeleteRequest; -} - -export interface ProjectCreateRequest { - name: string; - /** - * Organization where the project will be created - */ - organizationId: string; -} - -export interface ProjectsDeleteRequest { - /** - * IDs of the projects to delete - */ - ids: string[]; -} - -export interface ProjectGetRequest { - /** - * ID of the project to retrieve - */ - id: string; -} - -export interface ProjectsListRequest { - /** - * Organization to retrieve all the projects from - */ - organizationId: string; -} - -export interface ProjectPutRequest { - /** - * ID of the project to modify - */ - id: string; - name: string; - /** - * Organization ID of the project to modify - */ - organizationId: string; -} - -/** - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Retrieve a secret by the provided identifier - * - * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Creates a new secret in the provided organization using the given data - * - * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Lists all secret identifiers of the given organization, to then retrieve each - * secret, use `CreateSecret` - * - * Returns: - * [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Updates an existing secret with the provided ID using the given data - * - * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Deletes all the secrets whose IDs match the provided ones - * - * Returns: - * [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) - */ -export interface SecretsCommand { - get?: SecretGetRequest; - create?: SecretCreateRequest; - list?: SecretIdentifiersRequest; - update?: SecretPutRequest; - delete?: SecretsDeleteRequest; -} - -export interface SecretCreateRequest { - key: string; - note: string; - /** - * Organization where the secret will be created - */ - organizationId: string; - /** - * IDs of the projects that this secret will belong to - */ - projectIds?: string[] | null; - value: string; -} - -export interface SecretsDeleteRequest { - /** - * IDs of the secrets to delete - */ - ids: string[]; -} - -export interface SecretGetRequest { - /** - * ID of the secret to retrieve - */ - id: string; -} - -export interface SecretIdentifiersRequest { - /** - * Organization to retrieve all the secrets from - */ - organizationId: string; -} - -export interface SecretPutRequest { - /** - * ID of the secret to modify - */ - id: string; - key: string; - note: string; - /** - * Organization ID of the secret to modify - */ - organizationId: string; - value: string; -} - -export interface SyncRequest { - /** - * Exclude the subdomains from the response, defaults to false - */ - excludeSubdomains?: boolean | null; -} - -export interface ResponseForAPIKeyLoginResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: APIKeyLoginResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface APIKeyLoginResponse { - authenticated: boolean; - /** - * Whether or not the user is required to update their master password - */ - forcePasswordReset: boolean; - /** - * TODO: What does this do? - */ - resetMasterPassword: boolean; - twoFactor?: APIKeyLoginResponseTwoFactorProviders | null; -} - -export interface APIKeyLoginResponseTwoFactorProviders { - authenticator?: PurpleAuthenticator | null; - /** - * Duo-backed 2fa - */ - duo?: PurpleDuo | null; - /** - * Email 2fa - */ - email?: PurpleEmail | null; - /** - * Duo-backed 2fa operated by an organization the user is a member of - */ - organizationDuo?: PurpleDuo | null; - /** - * Presence indicates the user has stored this device as bypassing 2fa - */ - remember?: PurpleRemember | null; - /** - * WebAuthn-backed 2fa - */ - webAuthn?: PurpleWebAuthn | null; - /** - * Yubikey-backed 2fa - */ - yubiKey?: PurpleYubiKey | null; -} - -export interface PurpleAuthenticator { -} - -export interface PurpleDuo { - host: string; - signature: string; -} - -export interface PurpleEmail { - /** - * The email to request a 2fa TOTP for - */ - email: string; -} - -export interface PurpleRemember { -} - -export interface PurpleWebAuthn { -} - -export interface PurpleYubiKey { - /** - * Whether the stored yubikey supports near field communication - */ - nfc: boolean; -} - -export interface ResponseForPasswordLoginResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: PasswordLoginResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface PasswordLoginResponse { - authenticated: boolean; - /** - * The information required to present the user with a captcha challenge. Only present when - * authentication fails due to requiring validation of a captcha challenge. - */ - captcha?: CAPTCHAResponse | null; - /** - * Whether or not the user is required to update their master password - */ - forcePasswordReset: boolean; - /** - * TODO: What does this do? - */ - resetMasterPassword: boolean; - /** - * The available two factor authentication options. Present only when authentication fails - * due to requiring a second authentication factor. - */ - twoFactor?: PasswordLoginResponseTwoFactorProviders | null; -} - -export interface CAPTCHAResponse { - /** - * hcaptcha site key - */ - siteKey: string; -} - -export interface PasswordLoginResponseTwoFactorProviders { - authenticator?: FluffyAuthenticator | null; - /** - * Duo-backed 2fa - */ - duo?: FluffyDuo | null; - /** - * Email 2fa - */ - email?: FluffyEmail | null; - /** - * Duo-backed 2fa operated by an organization the user is a member of - */ - organizationDuo?: FluffyDuo | null; - /** - * Presence indicates the user has stored this device as bypassing 2fa - */ - remember?: FluffyRemember | null; - /** - * WebAuthn-backed 2fa - */ - webAuthn?: FluffyWebAuthn | null; - /** - * Yubikey-backed 2fa - */ - yubiKey?: FluffyYubiKey | null; -} - -export interface FluffyAuthenticator { -} - -export interface FluffyDuo { - host: string; - signature: string; -} - -export interface FluffyEmail { - /** - * The email to request a 2fa TOTP for - */ - email: string; -} - -export interface FluffyRemember { -} - -export interface FluffyWebAuthn { -} - -export interface FluffyYubiKey { - /** - * Whether the stored yubikey supports near field communication - */ - nfc: boolean; -} - -export interface ResponseForSecretIdentifiersResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretIdentifiersResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretIdentifiersResponse { - data: SecretIdentifierResponse[]; -} - -export interface SecretIdentifierResponse { - id: string; - key: string; - organizationId: string; -} - -export interface ResponseForSecretResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretResponse { - creationDate: string; - id: string; - key: string; - note: string; - object: string; - organizationId: string; - projectId?: null | string; - revisionDate: string; - value: string; -} - -export interface ResponseForSecretsDeleteResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretsDeleteResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretsDeleteResponse { - data: SecretDeleteResponse[]; -} - -export interface SecretDeleteResponse { - error?: null | string; - id: string; -} - -// Converts JSON strings to/from your types -// and asserts the results of JSON.parse at runtime -export class Convert { - public static toClientSettings(json: string): ClientSettings { - return cast(JSON.parse(json), r("ClientSettings")); - } - - public static clientSettingsToJson(value: ClientSettings): string { - return JSON.stringify(uncast(value, r("ClientSettings")), null, 2); - } - - public static toCommand(json: string): Command { - return cast(JSON.parse(json), r("Command")); - } - - public static commandToJson(value: Command): string { - return JSON.stringify(uncast(value, r("Command")), null, 2); - } - - public static toResponseForAPIKeyLoginResponse(json: string): ResponseForAPIKeyLoginResponse { - return cast(JSON.parse(json), r("ResponseForAPIKeyLoginResponse")); - } - - public static responseForAPIKeyLoginResponseToJson(value: ResponseForAPIKeyLoginResponse): string { - return JSON.stringify(uncast(value, r("ResponseForAPIKeyLoginResponse")), null, 2); - } - - public static toResponseForPasswordLoginResponse(json: string): ResponseForPasswordLoginResponse { - return cast(JSON.parse(json), r("ResponseForPasswordLoginResponse")); - } - - public static responseForPasswordLoginResponseToJson(value: ResponseForPasswordLoginResponse): string { - return JSON.stringify(uncast(value, r("ResponseForPasswordLoginResponse")), null, 2); - } - - public static toResponseForSecretIdentifiersResponse(json: string): ResponseForSecretIdentifiersResponse { - return cast(JSON.parse(json), r("ResponseForSecretIdentifiersResponse")); - } - - public static responseForSecretIdentifiersResponseToJson(value: ResponseForSecretIdentifiersResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretIdentifiersResponse")), null, 2); - } - - public static toResponseForSecretResponse(json: string): ResponseForSecretResponse { - return cast(JSON.parse(json), r("ResponseForSecretResponse")); - } - - public static responseForSecretResponseToJson(value: ResponseForSecretResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretResponse")), null, 2); - } - - public static toResponseForSecretsDeleteResponse(json: string): ResponseForSecretsDeleteResponse { - return cast(JSON.parse(json), r("ResponseForSecretsDeleteResponse")); - } - - public static responseForSecretsDeleteResponseToJson(value: ResponseForSecretsDeleteResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretsDeleteResponse")), null, 2); - } -} - -function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { - const prettyTyp = prettyTypeName(typ); - const parentText = parent ? ` on ${parent}` : ''; - const keyText = key ? ` for key "${key}"` : ''; - throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); -} - -function prettyTypeName(typ: any): string { - if (Array.isArray(typ)) { - if (typ.length === 2 && typ[0] === undefined) { - return `an optional ${prettyTypeName(typ[1])}`; - } else { - return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; - } - } else if (typeof typ === "object" && typ.literal !== undefined) { - return typ.literal; - } else { - return typeof typ; - } -} - -function jsonToJSProps(typ: any): any { - if (typ.jsonToJS === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); - typ.jsonToJS = map; - } - return typ.jsonToJS; -} - -function jsToJSONProps(typ: any): any { - if (typ.jsToJSON === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); - typ.jsToJSON = map; - } - return typ.jsToJSON; -} - -function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { - function transformPrimitive(typ: string, val: any): any { - if (typeof typ === typeof val) return val; - return invalidValue(typ, val, key, parent); - } - - function transformUnion(typs: any[], val: any): any { - // val must validate against one typ in typs - const l = typs.length; - for (let i = 0; i < l; i++) { - const typ = typs[i]; - try { - return transform(val, typ, getProps); - } catch (_) {} - } - return invalidValue(typs, val, key, parent); - } - - function transformEnum(cases: string[], val: any): any { - if (cases.indexOf(val) !== -1) return val; - return invalidValue(cases.map(a => { return l(a); }), val, key, parent); - } - - function transformArray(typ: any, val: any): any { - // val must be an array with no invalid elements - if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); - return val.map(el => transform(el, typ, getProps)); - } - - function transformDate(val: any): any { - if (val === null) { - return null; - } - const d = new Date(val); - if (isNaN(d.valueOf())) { - return invalidValue(l("Date"), val, key, parent); - } - return d; - } - - function transformObject(props: { [k: string]: any }, additional: any, val: any): any { - if (val === null || typeof val !== "object" || Array.isArray(val)) { - return invalidValue(l(ref || "object"), val, key, parent); - } - const result: any = {}; - Object.getOwnPropertyNames(props).forEach(key => { - const prop = props[key]; - const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; - result[prop.key] = transform(v, prop.typ, getProps, key, ref); - }); - Object.getOwnPropertyNames(val).forEach(key => { - if (!Object.prototype.hasOwnProperty.call(props, key)) { - result[key] = transform(val[key], additional, getProps, key, ref); - } - }); - return result; - } - - if (typ === "any") return val; - if (typ === null) { - if (val === null) return val; - return invalidValue(typ, val, key, parent); - } - if (typ === false) return invalidValue(typ, val, key, parent); - let ref: any = undefined; - while (typeof typ === "object" && typ.ref !== undefined) { - ref = typ.ref; - typ = typeMap[typ.ref]; - } - if (Array.isArray(typ)) return transformEnum(typ, val); - if (typeof typ === "object") { - return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) - : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) - : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) - : invalidValue(typ, val, key, parent); - } - // Numbers can be parsed by Date but shouldn't be. - if (typ === Date && typeof val !== "number") return transformDate(val); - return transformPrimitive(typ, val); -} - -function cast(val: any, typ: any): T { - return transform(val, typ, jsonToJSProps); -} - -function uncast(val: T, typ: any): any { - return transform(val, typ, jsToJSONProps); -} - -function l(typ: any) { - return { literal: typ }; -} - -function a(typ: any) { - return { arrayItems: typ }; -} - -function u(...typs: any[]) { - return { unionMembers: typs }; -} - -function o(props: any[], additional: any) { - return { props, additional }; -} - -function m(additional: any) { - return { props: [], additional }; -} - -function r(name: string) { - return { ref: name }; -} - -const typeMap: any = { - "ClientSettings": o([ - { json: "apiUrl", js: "apiUrl", typ: "" }, - { json: "deviceType", js: "deviceType", typ: r("DeviceType") }, - { json: "identityUrl", js: "identityUrl", typ: "" }, - { json: "userAgent", js: "userAgent", typ: "" }, - ], false), - "Command": o([ - { json: "passwordLogin", js: "passwordLogin", typ: u(undefined, r("PasswordLoginRequest")) }, - { json: "apiKeyLogin", js: "apiKeyLogin", typ: u(undefined, r("APIKeyLoginRequest")) }, - { json: "accessTokenLogin", js: "accessTokenLogin", typ: u(undefined, r("AccessTokenLoginRequest")) }, - { json: "getUserApiKey", js: "getUserApiKey", typ: u(undefined, r("SecretVerificationRequest")) }, - { json: "fingerprint", js: "fingerprint", typ: u(undefined, r("FingerprintRequest")) }, - { json: "sync", js: "sync", typ: u(undefined, r("SyncRequest")) }, - { json: "secrets", js: "secrets", typ: u(undefined, r("SecretsCommand")) }, - { json: "projects", js: "projects", typ: u(undefined, r("ProjectsCommand")) }, - ], false), - "AccessTokenLoginRequest": o([ - { json: "accessToken", js: "accessToken", typ: "" }, - ], false), - "APIKeyLoginRequest": o([ - { json: "clientId", js: "clientId", typ: "" }, - { json: "clientSecret", js: "clientSecret", typ: "" }, - { json: "password", js: "password", typ: "" }, - ], false), - "FingerprintRequest": o([ - { json: "fingerprintMaterial", js: "fingerprintMaterial", typ: "" }, - { json: "publicKey", js: "publicKey", typ: "" }, - ], false), - "SecretVerificationRequest": o([ - { json: "masterPassword", js: "masterPassword", typ: u(undefined, u(null, "")) }, - { json: "otp", js: "otp", typ: u(undefined, u(null, "")) }, - ], false), - "PasswordLoginRequest": o([ - { json: "email", js: "email", typ: "" }, - { json: "password", js: "password", typ: "" }, - ], false), - "ProjectsCommand": o([ - { json: "get", js: "get", typ: u(undefined, r("ProjectGetRequest")) }, - { json: "create", js: "create", typ: u(undefined, r("ProjectCreateRequest")) }, - { json: "list", js: "list", typ: u(undefined, r("ProjectsListRequest")) }, - { json: "update", js: "update", typ: u(undefined, r("ProjectPutRequest")) }, - { json: "delete", js: "delete", typ: u(undefined, r("ProjectsDeleteRequest")) }, - ], false), - "ProjectCreateRequest": o([ - { json: "name", js: "name", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "ProjectsDeleteRequest": o([ - { json: "ids", js: "ids", typ: a("") }, - ], false), - "ProjectGetRequest": o([ - { json: "id", js: "id", typ: "" }, - ], false), - "ProjectsListRequest": o([ - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "ProjectPutRequest": o([ - { json: "id", js: "id", typ: "" }, - { json: "name", js: "name", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "SecretsCommand": o([ - { json: "get", js: "get", typ: u(undefined, r("SecretGetRequest")) }, - { json: "create", js: "create", typ: u(undefined, r("SecretCreateRequest")) }, - { json: "list", js: "list", typ: u(undefined, r("SecretIdentifiersRequest")) }, - { json: "update", js: "update", typ: u(undefined, r("SecretPutRequest")) }, - { json: "delete", js: "delete", typ: u(undefined, r("SecretsDeleteRequest")) }, - ], false), - "SecretCreateRequest": o([ - { json: "key", js: "key", typ: "" }, - { json: "note", js: "note", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - { json: "projectIds", js: "projectIds", typ: u(undefined, u(a(""), null)) }, - { json: "value", js: "value", typ: "" }, - ], false), - "SecretsDeleteRequest": o([ - { json: "ids", js: "ids", typ: a("") }, - ], false), - "SecretGetRequest": o([ - { json: "id", js: "id", typ: "" }, - ], false), - "SecretIdentifiersRequest": o([ - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "SecretPutRequest": o([ - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "note", js: "note", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - { json: "value", js: "value", typ: "" }, - ], false), - "SyncRequest": o([ - { json: "excludeSubdomains", js: "excludeSubdomains", typ: u(undefined, u(true, null)) }, - ], false), - "ResponseForAPIKeyLoginResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("APIKeyLoginResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "APIKeyLoginResponse": o([ - { json: "authenticated", js: "authenticated", typ: true }, - { json: "forcePasswordReset", js: "forcePasswordReset", typ: true }, - { json: "resetMasterPassword", js: "resetMasterPassword", typ: true }, - { json: "twoFactor", js: "twoFactor", typ: u(undefined, u(r("APIKeyLoginResponseTwoFactorProviders"), null)) }, - ], false), - "APIKeyLoginResponseTwoFactorProviders": o([ - { json: "authenticator", js: "authenticator", typ: u(undefined, u(r("PurpleAuthenticator"), null)) }, - { json: "duo", js: "duo", typ: u(undefined, u(r("PurpleDuo"), null)) }, - { json: "email", js: "email", typ: u(undefined, u(r("PurpleEmail"), null)) }, - { json: "organizationDuo", js: "organizationDuo", typ: u(undefined, u(r("PurpleDuo"), null)) }, - { json: "remember", js: "remember", typ: u(undefined, u(r("PurpleRemember"), null)) }, - { json: "webAuthn", js: "webAuthn", typ: u(undefined, u(r("PurpleWebAuthn"), null)) }, - { json: "yubiKey", js: "yubiKey", typ: u(undefined, u(r("PurpleYubiKey"), null)) }, - ], false), - "PurpleAuthenticator": o([ - ], false), - "PurpleDuo": o([ - { json: "host", js: "host", typ: "" }, - { json: "signature", js: "signature", typ: "" }, - ], false), - "PurpleEmail": o([ - { json: "email", js: "email", typ: "" }, - ], false), - "PurpleRemember": o([ - ], false), - "PurpleWebAuthn": o([ - ], false), - "PurpleYubiKey": o([ - { json: "nfc", js: "nfc", typ: true }, - ], false), - "ResponseForPasswordLoginResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("PasswordLoginResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "PasswordLoginResponse": o([ - { json: "authenticated", js: "authenticated", typ: true }, - { json: "captcha", js: "captcha", typ: u(undefined, u(r("CAPTCHAResponse"), null)) }, - { json: "forcePasswordReset", js: "forcePasswordReset", typ: true }, - { json: "resetMasterPassword", js: "resetMasterPassword", typ: true }, - { json: "twoFactor", js: "twoFactor", typ: u(undefined, u(r("PasswordLoginResponseTwoFactorProviders"), null)) }, - ], false), - "CAPTCHAResponse": o([ - { json: "siteKey", js: "siteKey", typ: "" }, - ], false), - "PasswordLoginResponseTwoFactorProviders": o([ - { json: "authenticator", js: "authenticator", typ: u(undefined, u(r("FluffyAuthenticator"), null)) }, - { json: "duo", js: "duo", typ: u(undefined, u(r("FluffyDuo"), null)) }, - { json: "email", js: "email", typ: u(undefined, u(r("FluffyEmail"), null)) }, - { json: "organizationDuo", js: "organizationDuo", typ: u(undefined, u(r("FluffyDuo"), null)) }, - { json: "remember", js: "remember", typ: u(undefined, u(r("FluffyRemember"), null)) }, - { json: "webAuthn", js: "webAuthn", typ: u(undefined, u(r("FluffyWebAuthn"), null)) }, - { json: "yubiKey", js: "yubiKey", typ: u(undefined, u(r("FluffyYubiKey"), null)) }, - ], false), - "FluffyAuthenticator": o([ - ], false), - "FluffyDuo": o([ - { json: "host", js: "host", typ: "" }, - { json: "signature", js: "signature", typ: "" }, - ], false), - "FluffyEmail": o([ - { json: "email", js: "email", typ: "" }, - ], false), - "FluffyRemember": o([ - ], false), - "FluffyWebAuthn": o([ - ], false), - "FluffyYubiKey": o([ - { json: "nfc", js: "nfc", typ: true }, - ], false), - "ResponseForSecretIdentifiersResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretIdentifiersResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretIdentifiersResponse": o([ - { json: "data", js: "data", typ: a(r("SecretIdentifierResponse")) }, - ], false), - "SecretIdentifierResponse": o([ - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "ResponseForSecretResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretResponse": o([ - { json: "creationDate", js: "creationDate", typ: "" }, - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "note", js: "note", typ: "" }, - { json: "object", js: "object", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - { json: "projectId", js: "projectId", typ: u(undefined, u(null, "")) }, - { json: "revisionDate", js: "revisionDate", typ: "" }, - { json: "value", js: "value", typ: "" }, - ], false), - "ResponseForSecretsDeleteResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretsDeleteResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretsDeleteResponse": o([ - { json: "data", js: "data", typ: a(r("SecretDeleteResponse")) }, - ], false), - "SecretDeleteResponse": o([ - { json: "error", js: "error", typ: u(undefined, u(null, "")) }, - { json: "id", js: "id", typ: "" }, - ], false), - "DeviceType": [ - "Android", - "AndroidAmazon", - "ChromeBrowser", - "ChromeExtension", - "EdgeBrowser", - "EdgeExtension", - "FirefoxBrowser", - "FirefoxExtension", - "IEBrowser", - "iOS", - "LinuxDesktop", - "MacOsDesktop", - "OperaBrowser", - "OperaExtension", - "SDK", - "SafariBrowser", - "SafariExtension", - "UWP", - "UnknownBrowser", - "VivaldiBrowser", - "VivaldiExtension", - "WindowsDesktop", - ], -}; - diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index 0e8a884a71..c2af9f3214 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -7,7 +7,7 @@ rust-version = "1.57" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -schemars = "0.8.12" +schemars = { version = "0.8.12", features = ["preserve_order"] } serde_json = "1.0.96" anyhow = "1.0.71" itertools = "0.10.5" diff --git a/languages/csharp/schemas.cs b/languages/csharp/schemas.cs deleted file mode 100644 index 4ed30c1552..0000000000 --- a/languages/csharp/schemas.cs +++ /dev/null @@ -1,1049 +0,0 @@ -// -// -// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do one of these: -// -// using Bit.Sdk; -// -// var clientSettings = ClientSettings.FromJson(jsonString); -// var command = Command.FromJson(jsonString); -// var responseForApiKeyLoginResponse = ResponseForApiKeyLoginResponse.FromJson(jsonString); -// var responseForPasswordLoginResponse = ResponseForPasswordLoginResponse.FromJson(jsonString); -// var responseForSecretIdentifiersResponse = ResponseForSecretIdentifiersResponse.FromJson(jsonString); -// var responseForSecretResponse = ResponseForSecretResponse.FromJson(jsonString); -// var responseForSecretsDeleteResponse = ResponseForSecretsDeleteResponse.FromJson(jsonString); - -namespace Bit.Sdk -{ - using System; - using System.Collections.Generic; - - using System.Globalization; - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - - /// - /// 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::client::client_settings::{ClientSettings, DeviceType}; # use - /// assert_matches::assert_matches; 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(); - /// assert_matches!(settings, default); ``` - /// - /// Targets `localhost:8080` for debug builds. - /// - public partial class ClientSettings - { - /// - /// The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com` - /// - [JsonProperty("apiUrl")] - public string ApiUrl { get; set; } - - /// - /// Device type to send to Bitwarden. Defaults to SDK - /// - [JsonProperty("deviceType")] - public DeviceType DeviceType { get; set; } - - /// - /// The identity url of the targeted Bitwarden instance. Defaults to - /// `https://identity.bitwarden.com` - /// - [JsonProperty("identityUrl")] - public string IdentityUrl { get; set; } - - /// - /// The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK` - /// - [JsonProperty("userAgent")] - public string UserAgent { get; set; } - } - - /// - /// Login with username and password - /// - /// This command is for initiating an authentication handshake with Bitwarden. Authorization - /// may fail due to requiring 2fa or captcha challenge completion despite accurate - /// credentials. - /// - /// This command is not capable of handling authentication requiring 2fa or captcha. - /// - /// Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) - /// - /// Login with API Key - /// - /// This command is for initiating an authentication handshake with Bitwarden. - /// - /// Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - /// - /// Login with Secrets Manager Access Token - /// - /// This command is for initiating an authentication handshake with Bitwarden. - /// - /// Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - /// - /// > Requires Authentication Get the API key of the currently authenticated user - /// - /// Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) - /// - /// Get the user's passphrase - /// - /// Returns: String - /// - /// > Requires Authentication Retrieve all user data, ciphers and organizations the user is a - /// part of - /// - /// Returns: [SyncResponse](bitwarden::platform::SyncResponse) - /// - public partial class Command - { - [JsonProperty("passwordLogin", NullValueHandling = NullValueHandling.Ignore)] - public PasswordLoginRequest PasswordLogin { get; set; } - - [JsonProperty("apiKeyLogin", NullValueHandling = NullValueHandling.Ignore)] - public ApiKeyLoginRequest ApiKeyLogin { get; set; } - - [JsonProperty("accessTokenLogin", NullValueHandling = NullValueHandling.Ignore)] - public AccessTokenLoginRequest AccessTokenLogin { get; set; } - - [JsonProperty("getUserApiKey", NullValueHandling = NullValueHandling.Ignore)] - public SecretVerificationRequest GetUserApiKey { get; set; } - - [JsonProperty("fingerprint", NullValueHandling = NullValueHandling.Ignore)] - public FingerprintRequest Fingerprint { get; set; } - - [JsonProperty("sync", NullValueHandling = NullValueHandling.Ignore)] - public SyncRequest Sync { get; set; } - - [JsonProperty("secrets", NullValueHandling = NullValueHandling.Ignore)] - public SecretsCommand Secrets { get; set; } - - [JsonProperty("projects", NullValueHandling = NullValueHandling.Ignore)] - public ProjectsCommand Projects { get; set; } - } - - /// - /// Login to Bitwarden with access token - /// - public partial class AccessTokenLoginRequest - { - /// - /// Bitwarden service API access token - /// - [JsonProperty("accessToken")] - public string AccessToken { get; set; } - } - - /// - /// Login to Bitwarden with Api Key - /// - public partial class ApiKeyLoginRequest - { - /// - /// Bitwarden account client_id - /// - [JsonProperty("clientId")] - public string ClientId { get; set; } - - /// - /// Bitwarden account client_secret - /// - [JsonProperty("clientSecret")] - public string ClientSecret { get; set; } - - /// - /// Bitwarden account master password - /// - [JsonProperty("password")] - public string Password { get; set; } - } - - public partial class FingerprintRequest - { - /// - /// The input material, used in the fingerprint generation process. - /// - [JsonProperty("fingerprintMaterial")] - public string FingerprintMaterial { get; set; } - - /// - /// The user's public key - /// - [JsonProperty("publicKey")] - public string PublicKey { get; set; } - } - - public partial class SecretVerificationRequest - { - /// - /// The user's master password to use for user verification. If supplied, this will be used - /// for verification purposes. - /// - [JsonProperty("masterPassword")] - public string MasterPassword { get; set; } - - /// - /// 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. - /// - [JsonProperty("otp")] - public string Otp { get; set; } - } - - /// - /// Login to Bitwarden with Username and Password - /// - public partial class PasswordLoginRequest - { - /// - /// Bitwarden account email address - /// - [JsonProperty("email")] - public string Email { get; set; } - - /// - /// Bitwarden account master password - /// - [JsonProperty("password")] - public string Password { get; set; } - } - - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Retrieve a project by the provided identifier - /// - /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Creates a new project in the provided organization using the given data - /// - /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Lists all projects of the given organization - /// - /// Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Updates an existing project with the provided ID using the given data - /// - /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Deletes all the projects whose IDs match the provided ones - /// - /// Returns: - /// [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) - /// - public partial class ProjectsCommand - { - [JsonProperty("get", NullValueHandling = NullValueHandling.Ignore)] - public ProjectGetRequest Get { get; set; } - - [JsonProperty("create", NullValueHandling = NullValueHandling.Ignore)] - public ProjectCreateRequest Create { get; set; } - - [JsonProperty("list", NullValueHandling = NullValueHandling.Ignore)] - public ProjectsListRequest List { get; set; } - - [JsonProperty("update", NullValueHandling = NullValueHandling.Ignore)] - public ProjectPutRequest Update { get; set; } - - [JsonProperty("delete", NullValueHandling = NullValueHandling.Ignore)] - public ProjectsDeleteRequest Delete { get; set; } - } - - public partial class ProjectCreateRequest - { - [JsonProperty("name")] - public string Name { get; set; } - - /// - /// Organization where the project will be created - /// - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - } - - public partial class ProjectsDeleteRequest - { - /// - /// IDs of the projects to delete - /// - [JsonProperty("ids")] - public Guid[] Ids { get; set; } - } - - public partial class ProjectGetRequest - { - /// - /// ID of the project to retrieve - /// - [JsonProperty("id")] - public Guid Id { get; set; } - } - - public partial class ProjectsListRequest - { - /// - /// Organization to retrieve all the projects from - /// - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - } - - public partial class ProjectPutRequest - { - /// - /// ID of the project to modify - /// - [JsonProperty("id")] - public Guid Id { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - /// - /// Organization ID of the project to modify - /// - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - } - - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Retrieve a secret by the provided identifier - /// - /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Creates a new secret in the provided organization using the given data - /// - /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Lists all secret identifiers of the given organization, to then retrieve each - /// secret, use `CreateSecret` - /// - /// Returns: - /// [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Updates an existing secret with the provided ID using the given data - /// - /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - /// - /// > Requires Authentication > Requires using an Access Token for login or calling Sync at - /// least once Deletes all the secrets whose IDs match the provided ones - /// - /// Returns: - /// [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) - /// - public partial class SecretsCommand - { - [JsonProperty("get", NullValueHandling = NullValueHandling.Ignore)] - public SecretGetRequest Get { get; set; } - - [JsonProperty("create", NullValueHandling = NullValueHandling.Ignore)] - public SecretCreateRequest Create { get; set; } - - [JsonProperty("list", NullValueHandling = NullValueHandling.Ignore)] - public SecretIdentifiersRequest List { get; set; } - - [JsonProperty("update", NullValueHandling = NullValueHandling.Ignore)] - public SecretPutRequest Update { get; set; } - - [JsonProperty("delete", NullValueHandling = NullValueHandling.Ignore)] - public SecretsDeleteRequest Delete { get; set; } - } - - public partial class SecretCreateRequest - { - [JsonProperty("key")] - public string Key { get; set; } - - [JsonProperty("note")] - public string Note { get; set; } - - /// - /// Organization where the secret will be created - /// - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - - /// - /// IDs of the projects that this secret will belong to - /// - [JsonProperty("projectIds")] - public Guid[] ProjectIds { get; set; } - - [JsonProperty("value")] - public string Value { get; set; } - } - - public partial class SecretsDeleteRequest - { - /// - /// IDs of the secrets to delete - /// - [JsonProperty("ids")] - public Guid[] Ids { get; set; } - } - - public partial class SecretGetRequest - { - /// - /// ID of the secret to retrieve - /// - [JsonProperty("id")] - public Guid Id { get; set; } - } - - public partial class SecretIdentifiersRequest - { - /// - /// Organization to retrieve all the secrets from - /// - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - } - - public partial class SecretPutRequest - { - /// - /// ID of the secret to modify - /// - [JsonProperty("id")] - public Guid Id { get; set; } - - [JsonProperty("key")] - public string Key { get; set; } - - [JsonProperty("note")] - public string Note { get; set; } - - /// - /// Organization ID of the secret to modify - /// - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - - [JsonProperty("value")] - public string Value { get; set; } - } - - public partial class SyncRequest - { - /// - /// Exclude the subdomains from the response, defaults to false - /// - [JsonProperty("excludeSubdomains")] - public bool? ExcludeSubdomains { get; set; } - } - - public partial class ResponseForApiKeyLoginResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public ApiKeyLoginResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class ApiKeyLoginResponse - { - [JsonProperty("authenticated")] - public bool Authenticated { get; set; } - - /// - /// Whether or not the user is required to update their master password - /// - [JsonProperty("forcePasswordReset")] - public bool ForcePasswordReset { get; set; } - - /// - /// TODO: What does this do? - /// - [JsonProperty("resetMasterPassword")] - public bool ResetMasterPassword { get; set; } - - [JsonProperty("twoFactor")] - public ApiKeyLoginResponseTwoFactorProviders TwoFactor { get; set; } - } - - public partial class ApiKeyLoginResponseTwoFactorProviders - { - [JsonProperty("authenticator")] - public PurpleAuthenticator Authenticator { get; set; } - - /// - /// Duo-backed 2fa - /// - [JsonProperty("duo")] - public PurpleDuo Duo { get; set; } - - /// - /// Email 2fa - /// - [JsonProperty("email")] - public PurpleEmail Email { get; set; } - - /// - /// Duo-backed 2fa operated by an organization the user is a member of - /// - [JsonProperty("organizationDuo")] - public PurpleDuo OrganizationDuo { get; set; } - - /// - /// Presence indicates the user has stored this device as bypassing 2fa - /// - [JsonProperty("remember")] - public PurpleRemember Remember { get; set; } - - /// - /// WebAuthn-backed 2fa - /// - [JsonProperty("webAuthn")] - public PurpleWebAuthn WebAuthn { get; set; } - - /// - /// Yubikey-backed 2fa - /// - [JsonProperty("yubiKey")] - public PurpleYubiKey YubiKey { get; set; } - } - - public partial class PurpleAuthenticator - { - } - - public partial class PurpleDuo - { - [JsonProperty("host")] - public string Host { get; set; } - - [JsonProperty("signature")] - public string Signature { get; set; } - } - - public partial class PurpleEmail - { - /// - /// The email to request a 2fa TOTP for - /// - [JsonProperty("email")] - public string Email { get; set; } - } - - public partial class PurpleRemember - { - } - - public partial class PurpleWebAuthn - { - } - - public partial class PurpleYubiKey - { - /// - /// Whether the stored yubikey supports near field communication - /// - [JsonProperty("nfc")] - public bool Nfc { get; set; } - } - - public partial class ResponseForPasswordLoginResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public PasswordLoginResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class PasswordLoginResponse - { - [JsonProperty("authenticated")] - public bool Authenticated { get; set; } - - /// - /// The information required to present the user with a captcha challenge. Only present when - /// authentication fails due to requiring validation of a captcha challenge. - /// - [JsonProperty("captcha")] - public CaptchaResponse Captcha { get; set; } - - /// - /// Whether or not the user is required to update their master password - /// - [JsonProperty("forcePasswordReset")] - public bool ForcePasswordReset { get; set; } - - /// - /// TODO: What does this do? - /// - [JsonProperty("resetMasterPassword")] - public bool ResetMasterPassword { get; set; } - - /// - /// The available two factor authentication options. Present only when authentication fails - /// due to requiring a second authentication factor. - /// - [JsonProperty("twoFactor")] - public PasswordLoginResponseTwoFactorProviders TwoFactor { get; set; } - } - - public partial class CaptchaResponse - { - /// - /// hcaptcha site key - /// - [JsonProperty("siteKey")] - public string SiteKey { get; set; } - } - - public partial class PasswordLoginResponseTwoFactorProviders - { - [JsonProperty("authenticator")] - public FluffyAuthenticator Authenticator { get; set; } - - /// - /// Duo-backed 2fa - /// - [JsonProperty("duo")] - public FluffyDuo Duo { get; set; } - - /// - /// Email 2fa - /// - [JsonProperty("email")] - public FluffyEmail Email { get; set; } - - /// - /// Duo-backed 2fa operated by an organization the user is a member of - /// - [JsonProperty("organizationDuo")] - public FluffyDuo OrganizationDuo { get; set; } - - /// - /// Presence indicates the user has stored this device as bypassing 2fa - /// - [JsonProperty("remember")] - public FluffyRemember Remember { get; set; } - - /// - /// WebAuthn-backed 2fa - /// - [JsonProperty("webAuthn")] - public FluffyWebAuthn WebAuthn { get; set; } - - /// - /// Yubikey-backed 2fa - /// - [JsonProperty("yubiKey")] - public FluffyYubiKey YubiKey { get; set; } - } - - public partial class FluffyAuthenticator - { - } - - public partial class FluffyDuo - { - [JsonProperty("host")] - public string Host { get; set; } - - [JsonProperty("signature")] - public string Signature { get; set; } - } - - public partial class FluffyEmail - { - /// - /// The email to request a 2fa TOTP for - /// - [JsonProperty("email")] - public string Email { get; set; } - } - - public partial class FluffyRemember - { - } - - public partial class FluffyWebAuthn - { - } - - public partial class FluffyYubiKey - { - /// - /// Whether the stored yubikey supports near field communication - /// - [JsonProperty("nfc")] - public bool Nfc { get; set; } - } - - public partial class ResponseForSecretIdentifiersResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public SecretIdentifiersResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class SecretIdentifiersResponse - { - [JsonProperty("data")] - public SecretIdentifierResponse[] Data { get; set; } - } - - public partial class SecretIdentifierResponse - { - [JsonProperty("id")] - public Guid Id { get; set; } - - [JsonProperty("key")] - public string Key { get; set; } - - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - } - - public partial class ResponseForSecretResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public SecretResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class SecretResponse - { - [JsonProperty("creationDate")] - public string CreationDate { get; set; } - - [JsonProperty("id")] - public Guid Id { get; set; } - - [JsonProperty("key")] - public string Key { get; set; } - - [JsonProperty("note")] - public string Note { get; set; } - - [JsonProperty("object")] - public string Object { get; set; } - - [JsonProperty("organizationId")] - public Guid OrganizationId { get; set; } - - [JsonProperty("projectId")] - public Guid? ProjectId { get; set; } - - [JsonProperty("revisionDate")] - public string RevisionDate { get; set; } - - [JsonProperty("value")] - public string Value { get; set; } - } - - public partial class ResponseForSecretsDeleteResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public SecretsDeleteResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class SecretsDeleteResponse - { - [JsonProperty("data")] - public SecretDeleteResponse[] Data { get; set; } - } - - public partial class SecretDeleteResponse - { - [JsonProperty("error")] - public string Error { get; set; } - - [JsonProperty("id")] - public Guid Id { get; set; } - } - - /// - /// Device type to send to Bitwarden. Defaults to SDK - /// - public enum DeviceType { Android, AndroidAmazon, ChromeBrowser, ChromeExtension, EdgeBrowser, EdgeExtension, FirefoxBrowser, FirefoxExtension, IOs, IeBrowser, LinuxDesktop, MacOsDesktop, OperaBrowser, OperaExtension, SafariBrowser, SafariExtension, Sdk, UnknownBrowser, Uwp, VivaldiBrowser, VivaldiExtension, WindowsDesktop }; - - public partial class ClientSettings - { - public static ClientSettings FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class Command - { - public static Command FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class ResponseForApiKeyLoginResponse - { - public static ResponseForApiKeyLoginResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class ResponseForPasswordLoginResponse - { - public static ResponseForPasswordLoginResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class ResponseForSecretIdentifiersResponse - { - public static ResponseForSecretIdentifiersResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class ResponseForSecretResponse - { - public static ResponseForSecretResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public partial class ResponseForSecretsDeleteResponse - { - public static ResponseForSecretsDeleteResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - - public static class Serialize - { - public static string ToJson(this ClientSettings self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this Command self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForApiKeyLoginResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForPasswordLoginResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForSecretIdentifiersResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForSecretResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForSecretsDeleteResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - } - - internal static class Converter - { - public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings - { - MetadataPropertyHandling = MetadataPropertyHandling.Ignore, - DateParseHandling = DateParseHandling.None, - Converters = - { - DeviceTypeConverter.Singleton, - new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } - }, - }; - } - - internal class DeviceTypeConverter : JsonConverter - { - public override bool CanConvert(Type t) => t == typeof(DeviceType) || t == typeof(DeviceType?); - - public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.Null) return null; - var value = serializer.Deserialize(reader); - switch (value) - { - case "Android": - return DeviceType.Android; - case "AndroidAmazon": - return DeviceType.AndroidAmazon; - case "ChromeBrowser": - return DeviceType.ChromeBrowser; - case "ChromeExtension": - return DeviceType.ChromeExtension; - case "EdgeBrowser": - return DeviceType.EdgeBrowser; - case "EdgeExtension": - return DeviceType.EdgeExtension; - case "FirefoxBrowser": - return DeviceType.FirefoxBrowser; - case "FirefoxExtension": - return DeviceType.FirefoxExtension; - case "IEBrowser": - return DeviceType.IeBrowser; - case "LinuxDesktop": - return DeviceType.LinuxDesktop; - case "MacOsDesktop": - return DeviceType.MacOsDesktop; - case "OperaBrowser": - return DeviceType.OperaBrowser; - case "OperaExtension": - return DeviceType.OperaExtension; - case "SDK": - return DeviceType.Sdk; - case "SafariBrowser": - return DeviceType.SafariBrowser; - case "SafariExtension": - return DeviceType.SafariExtension; - case "UWP": - return DeviceType.Uwp; - case "UnknownBrowser": - return DeviceType.UnknownBrowser; - case "VivaldiBrowser": - return DeviceType.VivaldiBrowser; - case "VivaldiExtension": - return DeviceType.VivaldiExtension; - case "WindowsDesktop": - return DeviceType.WindowsDesktop; - case "iOS": - return DeviceType.IOs; - } - throw new Exception("Cannot unmarshal type DeviceType"); - } - - public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) - { - if (untypedValue == null) - { - serializer.Serialize(writer, null); - return; - } - var value = (DeviceType)untypedValue; - switch (value) - { - case DeviceType.Android: - serializer.Serialize(writer, "Android"); - return; - case DeviceType.AndroidAmazon: - serializer.Serialize(writer, "AndroidAmazon"); - return; - case DeviceType.ChromeBrowser: - serializer.Serialize(writer, "ChromeBrowser"); - return; - case DeviceType.ChromeExtension: - serializer.Serialize(writer, "ChromeExtension"); - return; - case DeviceType.EdgeBrowser: - serializer.Serialize(writer, "EdgeBrowser"); - return; - case DeviceType.EdgeExtension: - serializer.Serialize(writer, "EdgeExtension"); - return; - case DeviceType.FirefoxBrowser: - serializer.Serialize(writer, "FirefoxBrowser"); - return; - case DeviceType.FirefoxExtension: - serializer.Serialize(writer, "FirefoxExtension"); - return; - case DeviceType.IeBrowser: - serializer.Serialize(writer, "IEBrowser"); - return; - case DeviceType.LinuxDesktop: - serializer.Serialize(writer, "LinuxDesktop"); - return; - case DeviceType.MacOsDesktop: - serializer.Serialize(writer, "MacOsDesktop"); - return; - case DeviceType.OperaBrowser: - serializer.Serialize(writer, "OperaBrowser"); - return; - case DeviceType.OperaExtension: - serializer.Serialize(writer, "OperaExtension"); - return; - case DeviceType.Sdk: - serializer.Serialize(writer, "SDK"); - return; - case DeviceType.SafariBrowser: - serializer.Serialize(writer, "SafariBrowser"); - return; - case DeviceType.SafariExtension: - serializer.Serialize(writer, "SafariExtension"); - return; - case DeviceType.Uwp: - serializer.Serialize(writer, "UWP"); - return; - case DeviceType.UnknownBrowser: - serializer.Serialize(writer, "UnknownBrowser"); - return; - case DeviceType.VivaldiBrowser: - serializer.Serialize(writer, "VivaldiBrowser"); - return; - case DeviceType.VivaldiExtension: - serializer.Serialize(writer, "VivaldiExtension"); - return; - case DeviceType.WindowsDesktop: - serializer.Serialize(writer, "WindowsDesktop"); - return; - case DeviceType.IOs: - serializer.Serialize(writer, "iOS"); - return; - } - throw new Exception("Cannot marshal type DeviceType"); - } - - public static readonly DeviceTypeConverter Singleton = new DeviceTypeConverter(); - } -} - diff --git a/languages/js_webassembly/bitwarden_client/schemas.ts b/languages/js_webassembly/bitwarden_client/schemas.ts deleted file mode 100644 index a0c9e3064f..0000000000 --- a/languages/js_webassembly/bitwarden_client/schemas.ts +++ /dev/null @@ -1,1072 +0,0 @@ -// To parse this data: -// -// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse } from "./file"; -// -// const clientSettings = Convert.toClientSettings(json); -// const command = Convert.toCommand(json); -// const responseForAPIKeyLoginResponse = Convert.toResponseForAPIKeyLoginResponse(json); -// const responseForPasswordLoginResponse = Convert.toResponseForPasswordLoginResponse(json); -// const responseForSecretIdentifiersResponse = Convert.toResponseForSecretIdentifiersResponse(json); -// const responseForSecretResponse = Convert.toResponseForSecretResponse(json); -// const responseForSecretsDeleteResponse = Convert.toResponseForSecretsDeleteResponse(json); -// -// These functions will throw an error if the JSON doesn't -// match the expected interface, even if the JSON is valid. - -/** - * 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::client::client_settings::{ClientSettings, DeviceType}; # use - * assert_matches::assert_matches; 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(); - * assert_matches!(settings, default); ``` - * - * Targets `localhost:8080` for debug builds. - */ -export interface ClientSettings { - /** - * The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com` - */ - apiUrl: string; - /** - * Device type to send to Bitwarden. Defaults to SDK - */ - deviceType: DeviceType; - /** - * The identity url of the targeted Bitwarden instance. Defaults to - * `https://identity.bitwarden.com` - */ - identityUrl: string; - /** - * The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK` - */ - userAgent: string; -} - -/** - * Device type to send to Bitwarden. Defaults to SDK - */ -export enum DeviceType { - Android = "Android", - AndroidAmazon = "AndroidAmazon", - ChromeBrowser = "ChromeBrowser", - ChromeExtension = "ChromeExtension", - EdgeBrowser = "EdgeBrowser", - EdgeExtension = "EdgeExtension", - FirefoxBrowser = "FirefoxBrowser", - FirefoxExtension = "FirefoxExtension", - IEBrowser = "IEBrowser", - IOS = "iOS", - LinuxDesktop = "LinuxDesktop", - MACOSDesktop = "MacOsDesktop", - OperaBrowser = "OperaBrowser", - OperaExtension = "OperaExtension", - SDK = "SDK", - SafariBrowser = "SafariBrowser", - SafariExtension = "SafariExtension", - UWP = "UWP", - UnknownBrowser = "UnknownBrowser", - VivaldiBrowser = "VivaldiBrowser", - VivaldiExtension = "VivaldiExtension", - WindowsDesktop = "WindowsDesktop", -} - -/** - * Login with username and password - * - * This command is for initiating an authentication handshake with Bitwarden. Authorization - * may fail due to requiring 2fa or captcha challenge completion despite accurate - * credentials. - * - * This command is not capable of handling authentication requiring 2fa or captcha. - * - * Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) - * - * Login with API Key - * - * This command is for initiating an authentication handshake with Bitwarden. - * - * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - * - * Login with Secrets Manager Access Token - * - * This command is for initiating an authentication handshake with Bitwarden. - * - * Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - * - * > Requires Authentication Get the API key of the currently authenticated user - * - * Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) - * - * Get the user's passphrase - * - * Returns: String - * - * > Requires Authentication Retrieve all user data, ciphers and organizations the user is a - * part of - * - * Returns: [SyncResponse](bitwarden::platform::SyncResponse) - */ -export interface Command { - passwordLogin?: PasswordLoginRequest; - apiKeyLogin?: APIKeyLoginRequest; - accessTokenLogin?: AccessTokenLoginRequest; - getUserApiKey?: SecretVerificationRequest; - fingerprint?: FingerprintRequest; - sync?: SyncRequest; - secrets?: SecretsCommand; - projects?: ProjectsCommand; -} - -/** - * Login to Bitwarden with access token - */ -export interface AccessTokenLoginRequest { - /** - * Bitwarden service API access token - */ - accessToken: string; -} - -/** - * Login to Bitwarden with Api Key - */ -export interface APIKeyLoginRequest { - /** - * Bitwarden account client_id - */ - clientId: string; - /** - * Bitwarden account client_secret - */ - clientSecret: string; - /** - * Bitwarden account master password - */ - password: string; -} - -export interface FingerprintRequest { - /** - * The input material, used in the fingerprint generation process. - */ - fingerprintMaterial: string; - /** - * The user's public key - */ - publicKey: string; -} - -export interface SecretVerificationRequest { - /** - * The user's master password to use for user verification. If supplied, this will be used - * for verification purposes. - */ - masterPassword?: null | string; - /** - * 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. - */ - otp?: null | string; -} - -/** - * Login to Bitwarden with Username and Password - */ -export interface PasswordLoginRequest { - /** - * Bitwarden account email address - */ - email: string; - /** - * Bitwarden account master password - */ - password: string; -} - -/** - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Retrieve a project by the provided identifier - * - * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Creates a new project in the provided organization using the given data - * - * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Lists all projects of the given organization - * - * Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Updates an existing project with the provided ID using the given data - * - * Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Deletes all the projects whose IDs match the provided ones - * - * Returns: - * [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) - */ -export interface ProjectsCommand { - get?: ProjectGetRequest; - create?: ProjectCreateRequest; - list?: ProjectsListRequest; - update?: ProjectPutRequest; - delete?: ProjectsDeleteRequest; -} - -export interface ProjectCreateRequest { - name: string; - /** - * Organization where the project will be created - */ - organizationId: string; -} - -export interface ProjectsDeleteRequest { - /** - * IDs of the projects to delete - */ - ids: string[]; -} - -export interface ProjectGetRequest { - /** - * ID of the project to retrieve - */ - id: string; -} - -export interface ProjectsListRequest { - /** - * Organization to retrieve all the projects from - */ - organizationId: string; -} - -export interface ProjectPutRequest { - /** - * ID of the project to modify - */ - id: string; - name: string; - /** - * Organization ID of the project to modify - */ - organizationId: string; -} - -/** - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Retrieve a secret by the provided identifier - * - * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Creates a new secret in the provided organization using the given data - * - * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Lists all secret identifiers of the given organization, to then retrieve each - * secret, use `CreateSecret` - * - * Returns: - * [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Updates an existing secret with the provided ID using the given data - * - * Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - * - * > Requires Authentication > Requires using an Access Token for login or calling Sync at - * least once Deletes all the secrets whose IDs match the provided ones - * - * Returns: - * [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) - */ -export interface SecretsCommand { - get?: SecretGetRequest; - create?: SecretCreateRequest; - list?: SecretIdentifiersRequest; - update?: SecretPutRequest; - delete?: SecretsDeleteRequest; -} - -export interface SecretCreateRequest { - key: string; - note: string; - /** - * Organization where the secret will be created - */ - organizationId: string; - /** - * IDs of the projects that this secret will belong to - */ - projectIds?: string[] | null; - value: string; -} - -export interface SecretsDeleteRequest { - /** - * IDs of the secrets to delete - */ - ids: string[]; -} - -export interface SecretGetRequest { - /** - * ID of the secret to retrieve - */ - id: string; -} - -export interface SecretIdentifiersRequest { - /** - * Organization to retrieve all the secrets from - */ - organizationId: string; -} - -export interface SecretPutRequest { - /** - * ID of the secret to modify - */ - id: string; - key: string; - note: string; - /** - * Organization ID of the secret to modify - */ - organizationId: string; - value: string; -} - -export interface SyncRequest { - /** - * Exclude the subdomains from the response, defaults to false - */ - excludeSubdomains?: boolean | null; -} - -export interface ResponseForAPIKeyLoginResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: APIKeyLoginResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface APIKeyLoginResponse { - authenticated: boolean; - /** - * Whether or not the user is required to update their master password - */ - forcePasswordReset: boolean; - /** - * TODO: What does this do? - */ - resetMasterPassword: boolean; - twoFactor?: APIKeyLoginResponseTwoFactorProviders | null; -} - -export interface APIKeyLoginResponseTwoFactorProviders { - authenticator?: PurpleAuthenticator | null; - /** - * Duo-backed 2fa - */ - duo?: PurpleDuo | null; - /** - * Email 2fa - */ - email?: PurpleEmail | null; - /** - * Duo-backed 2fa operated by an organization the user is a member of - */ - organizationDuo?: PurpleDuo | null; - /** - * Presence indicates the user has stored this device as bypassing 2fa - */ - remember?: PurpleRemember | null; - /** - * WebAuthn-backed 2fa - */ - webAuthn?: PurpleWebAuthn | null; - /** - * Yubikey-backed 2fa - */ - yubiKey?: PurpleYubiKey | null; -} - -export interface PurpleAuthenticator { -} - -export interface PurpleDuo { - host: string; - signature: string; -} - -export interface PurpleEmail { - /** - * The email to request a 2fa TOTP for - */ - email: string; -} - -export interface PurpleRemember { -} - -export interface PurpleWebAuthn { -} - -export interface PurpleYubiKey { - /** - * Whether the stored yubikey supports near field communication - */ - nfc: boolean; -} - -export interface ResponseForPasswordLoginResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: PasswordLoginResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface PasswordLoginResponse { - authenticated: boolean; - /** - * The information required to present the user with a captcha challenge. Only present when - * authentication fails due to requiring validation of a captcha challenge. - */ - captcha?: CAPTCHAResponse | null; - /** - * Whether or not the user is required to update their master password - */ - forcePasswordReset: boolean; - /** - * TODO: What does this do? - */ - resetMasterPassword: boolean; - /** - * The available two factor authentication options. Present only when authentication fails - * due to requiring a second authentication factor. - */ - twoFactor?: PasswordLoginResponseTwoFactorProviders | null; -} - -export interface CAPTCHAResponse { - /** - * hcaptcha site key - */ - siteKey: string; -} - -export interface PasswordLoginResponseTwoFactorProviders { - authenticator?: FluffyAuthenticator | null; - /** - * Duo-backed 2fa - */ - duo?: FluffyDuo | null; - /** - * Email 2fa - */ - email?: FluffyEmail | null; - /** - * Duo-backed 2fa operated by an organization the user is a member of - */ - organizationDuo?: FluffyDuo | null; - /** - * Presence indicates the user has stored this device as bypassing 2fa - */ - remember?: FluffyRemember | null; - /** - * WebAuthn-backed 2fa - */ - webAuthn?: FluffyWebAuthn | null; - /** - * Yubikey-backed 2fa - */ - yubiKey?: FluffyYubiKey | null; -} - -export interface FluffyAuthenticator { -} - -export interface FluffyDuo { - host: string; - signature: string; -} - -export interface FluffyEmail { - /** - * The email to request a 2fa TOTP for - */ - email: string; -} - -export interface FluffyRemember { -} - -export interface FluffyWebAuthn { -} - -export interface FluffyYubiKey { - /** - * Whether the stored yubikey supports near field communication - */ - nfc: boolean; -} - -export interface ResponseForSecretIdentifiersResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretIdentifiersResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretIdentifiersResponse { - data: SecretIdentifierResponse[]; -} - -export interface SecretIdentifierResponse { - id: string; - key: string; - organizationId: string; -} - -export interface ResponseForSecretResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretResponse { - creationDate: string; - id: string; - key: string; - note: string; - object: string; - organizationId: string; - projectId?: null | string; - revisionDate: string; - value: string; -} - -export interface ResponseForSecretsDeleteResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SecretsDeleteResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SecretsDeleteResponse { - data: SecretDeleteResponse[]; -} - -export interface SecretDeleteResponse { - error?: null | string; - id: string; -} - -// Converts JSON strings to/from your types -// and asserts the results of JSON.parse at runtime -export class Convert { - public static toClientSettings(json: string): ClientSettings { - return cast(JSON.parse(json), r("ClientSettings")); - } - - public static clientSettingsToJson(value: ClientSettings): string { - return JSON.stringify(uncast(value, r("ClientSettings")), null, 2); - } - - public static toCommand(json: string): Command { - return cast(JSON.parse(json), r("Command")); - } - - public static commandToJson(value: Command): string { - return JSON.stringify(uncast(value, r("Command")), null, 2); - } - - public static toResponseForAPIKeyLoginResponse(json: string): ResponseForAPIKeyLoginResponse { - return cast(JSON.parse(json), r("ResponseForAPIKeyLoginResponse")); - } - - public static responseForAPIKeyLoginResponseToJson(value: ResponseForAPIKeyLoginResponse): string { - return JSON.stringify(uncast(value, r("ResponseForAPIKeyLoginResponse")), null, 2); - } - - public static toResponseForPasswordLoginResponse(json: string): ResponseForPasswordLoginResponse { - return cast(JSON.parse(json), r("ResponseForPasswordLoginResponse")); - } - - public static responseForPasswordLoginResponseToJson(value: ResponseForPasswordLoginResponse): string { - return JSON.stringify(uncast(value, r("ResponseForPasswordLoginResponse")), null, 2); - } - - public static toResponseForSecretIdentifiersResponse(json: string): ResponseForSecretIdentifiersResponse { - return cast(JSON.parse(json), r("ResponseForSecretIdentifiersResponse")); - } - - public static responseForSecretIdentifiersResponseToJson(value: ResponseForSecretIdentifiersResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretIdentifiersResponse")), null, 2); - } - - public static toResponseForSecretResponse(json: string): ResponseForSecretResponse { - return cast(JSON.parse(json), r("ResponseForSecretResponse")); - } - - public static responseForSecretResponseToJson(value: ResponseForSecretResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretResponse")), null, 2); - } - - public static toResponseForSecretsDeleteResponse(json: string): ResponseForSecretsDeleteResponse { - return cast(JSON.parse(json), r("ResponseForSecretsDeleteResponse")); - } - - public static responseForSecretsDeleteResponseToJson(value: ResponseForSecretsDeleteResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSecretsDeleteResponse")), null, 2); - } -} - -function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { - const prettyTyp = prettyTypeName(typ); - const parentText = parent ? ` on ${parent}` : ''; - const keyText = key ? ` for key "${key}"` : ''; - throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); -} - -function prettyTypeName(typ: any): string { - if (Array.isArray(typ)) { - if (typ.length === 2 && typ[0] === undefined) { - return `an optional ${prettyTypeName(typ[1])}`; - } else { - return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; - } - } else if (typeof typ === "object" && typ.literal !== undefined) { - return typ.literal; - } else { - return typeof typ; - } -} - -function jsonToJSProps(typ: any): any { - if (typ.jsonToJS === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); - typ.jsonToJS = map; - } - return typ.jsonToJS; -} - -function jsToJSONProps(typ: any): any { - if (typ.jsToJSON === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); - typ.jsToJSON = map; - } - return typ.jsToJSON; -} - -function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { - function transformPrimitive(typ: string, val: any): any { - if (typeof typ === typeof val) return val; - return invalidValue(typ, val, key, parent); - } - - function transformUnion(typs: any[], val: any): any { - // val must validate against one typ in typs - const l = typs.length; - for (let i = 0; i < l; i++) { - const typ = typs[i]; - try { - return transform(val, typ, getProps); - } catch (_) {} - } - return invalidValue(typs, val, key, parent); - } - - function transformEnum(cases: string[], val: any): any { - if (cases.indexOf(val) !== -1) return val; - return invalidValue(cases.map(a => { return l(a); }), val, key, parent); - } - - function transformArray(typ: any, val: any): any { - // val must be an array with no invalid elements - if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); - return val.map(el => transform(el, typ, getProps)); - } - - function transformDate(val: any): any { - if (val === null) { - return null; - } - const d = new Date(val); - if (isNaN(d.valueOf())) { - return invalidValue(l("Date"), val, key, parent); - } - return d; - } - - function transformObject(props: { [k: string]: any }, additional: any, val: any): any { - if (val === null || typeof val !== "object" || Array.isArray(val)) { - return invalidValue(l(ref || "object"), val, key, parent); - } - const result: any = {}; - Object.getOwnPropertyNames(props).forEach(key => { - const prop = props[key]; - const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; - result[prop.key] = transform(v, prop.typ, getProps, key, ref); - }); - Object.getOwnPropertyNames(val).forEach(key => { - if (!Object.prototype.hasOwnProperty.call(props, key)) { - result[key] = transform(val[key], additional, getProps, key, ref); - } - }); - return result; - } - - if (typ === "any") return val; - if (typ === null) { - if (val === null) return val; - return invalidValue(typ, val, key, parent); - } - if (typ === false) return invalidValue(typ, val, key, parent); - let ref: any = undefined; - while (typeof typ === "object" && typ.ref !== undefined) { - ref = typ.ref; - typ = typeMap[typ.ref]; - } - if (Array.isArray(typ)) return transformEnum(typ, val); - if (typeof typ === "object") { - return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) - : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) - : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) - : invalidValue(typ, val, key, parent); - } - // Numbers can be parsed by Date but shouldn't be. - if (typ === Date && typeof val !== "number") return transformDate(val); - return transformPrimitive(typ, val); -} - -function cast(val: any, typ: any): T { - return transform(val, typ, jsonToJSProps); -} - -function uncast(val: T, typ: any): any { - return transform(val, typ, jsToJSONProps); -} - -function l(typ: any) { - return { literal: typ }; -} - -function a(typ: any) { - return { arrayItems: typ }; -} - -function u(...typs: any[]) { - return { unionMembers: typs }; -} - -function o(props: any[], additional: any) { - return { props, additional }; -} - -function m(additional: any) { - return { props: [], additional }; -} - -function r(name: string) { - return { ref: name }; -} - -const typeMap: any = { - "ClientSettings": o([ - { json: "apiUrl", js: "apiUrl", typ: "" }, - { json: "deviceType", js: "deviceType", typ: r("DeviceType") }, - { json: "identityUrl", js: "identityUrl", typ: "" }, - { json: "userAgent", js: "userAgent", typ: "" }, - ], false), - "Command": o([ - { json: "passwordLogin", js: "passwordLogin", typ: u(undefined, r("PasswordLoginRequest")) }, - { json: "apiKeyLogin", js: "apiKeyLogin", typ: u(undefined, r("APIKeyLoginRequest")) }, - { json: "accessTokenLogin", js: "accessTokenLogin", typ: u(undefined, r("AccessTokenLoginRequest")) }, - { json: "getUserApiKey", js: "getUserApiKey", typ: u(undefined, r("SecretVerificationRequest")) }, - { json: "fingerprint", js: "fingerprint", typ: u(undefined, r("FingerprintRequest")) }, - { json: "sync", js: "sync", typ: u(undefined, r("SyncRequest")) }, - { json: "secrets", js: "secrets", typ: u(undefined, r("SecretsCommand")) }, - { json: "projects", js: "projects", typ: u(undefined, r("ProjectsCommand")) }, - ], false), - "AccessTokenLoginRequest": o([ - { json: "accessToken", js: "accessToken", typ: "" }, - ], false), - "APIKeyLoginRequest": o([ - { json: "clientId", js: "clientId", typ: "" }, - { json: "clientSecret", js: "clientSecret", typ: "" }, - { json: "password", js: "password", typ: "" }, - ], false), - "FingerprintRequest": o([ - { json: "fingerprintMaterial", js: "fingerprintMaterial", typ: "" }, - { json: "publicKey", js: "publicKey", typ: "" }, - ], false), - "SecretVerificationRequest": o([ - { json: "masterPassword", js: "masterPassword", typ: u(undefined, u(null, "")) }, - { json: "otp", js: "otp", typ: u(undefined, u(null, "")) }, - ], false), - "PasswordLoginRequest": o([ - { json: "email", js: "email", typ: "" }, - { json: "password", js: "password", typ: "" }, - ], false), - "ProjectsCommand": o([ - { json: "get", js: "get", typ: u(undefined, r("ProjectGetRequest")) }, - { json: "create", js: "create", typ: u(undefined, r("ProjectCreateRequest")) }, - { json: "list", js: "list", typ: u(undefined, r("ProjectsListRequest")) }, - { json: "update", js: "update", typ: u(undefined, r("ProjectPutRequest")) }, - { json: "delete", js: "delete", typ: u(undefined, r("ProjectsDeleteRequest")) }, - ], false), - "ProjectCreateRequest": o([ - { json: "name", js: "name", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "ProjectsDeleteRequest": o([ - { json: "ids", js: "ids", typ: a("") }, - ], false), - "ProjectGetRequest": o([ - { json: "id", js: "id", typ: "" }, - ], false), - "ProjectsListRequest": o([ - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "ProjectPutRequest": o([ - { json: "id", js: "id", typ: "" }, - { json: "name", js: "name", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "SecretsCommand": o([ - { json: "get", js: "get", typ: u(undefined, r("SecretGetRequest")) }, - { json: "create", js: "create", typ: u(undefined, r("SecretCreateRequest")) }, - { json: "list", js: "list", typ: u(undefined, r("SecretIdentifiersRequest")) }, - { json: "update", js: "update", typ: u(undefined, r("SecretPutRequest")) }, - { json: "delete", js: "delete", typ: u(undefined, r("SecretsDeleteRequest")) }, - ], false), - "SecretCreateRequest": o([ - { json: "key", js: "key", typ: "" }, - { json: "note", js: "note", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - { json: "projectIds", js: "projectIds", typ: u(undefined, u(a(""), null)) }, - { json: "value", js: "value", typ: "" }, - ], false), - "SecretsDeleteRequest": o([ - { json: "ids", js: "ids", typ: a("") }, - ], false), - "SecretGetRequest": o([ - { json: "id", js: "id", typ: "" }, - ], false), - "SecretIdentifiersRequest": o([ - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "SecretPutRequest": o([ - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "note", js: "note", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - { json: "value", js: "value", typ: "" }, - ], false), - "SyncRequest": o([ - { json: "excludeSubdomains", js: "excludeSubdomains", typ: u(undefined, u(true, null)) }, - ], false), - "ResponseForAPIKeyLoginResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("APIKeyLoginResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "APIKeyLoginResponse": o([ - { json: "authenticated", js: "authenticated", typ: true }, - { json: "forcePasswordReset", js: "forcePasswordReset", typ: true }, - { json: "resetMasterPassword", js: "resetMasterPassword", typ: true }, - { json: "twoFactor", js: "twoFactor", typ: u(undefined, u(r("APIKeyLoginResponseTwoFactorProviders"), null)) }, - ], false), - "APIKeyLoginResponseTwoFactorProviders": o([ - { json: "authenticator", js: "authenticator", typ: u(undefined, u(r("PurpleAuthenticator"), null)) }, - { json: "duo", js: "duo", typ: u(undefined, u(r("PurpleDuo"), null)) }, - { json: "email", js: "email", typ: u(undefined, u(r("PurpleEmail"), null)) }, - { json: "organizationDuo", js: "organizationDuo", typ: u(undefined, u(r("PurpleDuo"), null)) }, - { json: "remember", js: "remember", typ: u(undefined, u(r("PurpleRemember"), null)) }, - { json: "webAuthn", js: "webAuthn", typ: u(undefined, u(r("PurpleWebAuthn"), null)) }, - { json: "yubiKey", js: "yubiKey", typ: u(undefined, u(r("PurpleYubiKey"), null)) }, - ], false), - "PurpleAuthenticator": o([ - ], false), - "PurpleDuo": o([ - { json: "host", js: "host", typ: "" }, - { json: "signature", js: "signature", typ: "" }, - ], false), - "PurpleEmail": o([ - { json: "email", js: "email", typ: "" }, - ], false), - "PurpleRemember": o([ - ], false), - "PurpleWebAuthn": o([ - ], false), - "PurpleYubiKey": o([ - { json: "nfc", js: "nfc", typ: true }, - ], false), - "ResponseForPasswordLoginResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("PasswordLoginResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "PasswordLoginResponse": o([ - { json: "authenticated", js: "authenticated", typ: true }, - { json: "captcha", js: "captcha", typ: u(undefined, u(r("CAPTCHAResponse"), null)) }, - { json: "forcePasswordReset", js: "forcePasswordReset", typ: true }, - { json: "resetMasterPassword", js: "resetMasterPassword", typ: true }, - { json: "twoFactor", js: "twoFactor", typ: u(undefined, u(r("PasswordLoginResponseTwoFactorProviders"), null)) }, - ], false), - "CAPTCHAResponse": o([ - { json: "siteKey", js: "siteKey", typ: "" }, - ], false), - "PasswordLoginResponseTwoFactorProviders": o([ - { json: "authenticator", js: "authenticator", typ: u(undefined, u(r("FluffyAuthenticator"), null)) }, - { json: "duo", js: "duo", typ: u(undefined, u(r("FluffyDuo"), null)) }, - { json: "email", js: "email", typ: u(undefined, u(r("FluffyEmail"), null)) }, - { json: "organizationDuo", js: "organizationDuo", typ: u(undefined, u(r("FluffyDuo"), null)) }, - { json: "remember", js: "remember", typ: u(undefined, u(r("FluffyRemember"), null)) }, - { json: "webAuthn", js: "webAuthn", typ: u(undefined, u(r("FluffyWebAuthn"), null)) }, - { json: "yubiKey", js: "yubiKey", typ: u(undefined, u(r("FluffyYubiKey"), null)) }, - ], false), - "FluffyAuthenticator": o([ - ], false), - "FluffyDuo": o([ - { json: "host", js: "host", typ: "" }, - { json: "signature", js: "signature", typ: "" }, - ], false), - "FluffyEmail": o([ - { json: "email", js: "email", typ: "" }, - ], false), - "FluffyRemember": o([ - ], false), - "FluffyWebAuthn": o([ - ], false), - "FluffyYubiKey": o([ - { json: "nfc", js: "nfc", typ: true }, - ], false), - "ResponseForSecretIdentifiersResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretIdentifiersResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretIdentifiersResponse": o([ - { json: "data", js: "data", typ: a(r("SecretIdentifierResponse")) }, - ], false), - "SecretIdentifierResponse": o([ - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - ], false), - "ResponseForSecretResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretResponse": o([ - { json: "creationDate", js: "creationDate", typ: "" }, - { json: "id", js: "id", typ: "" }, - { json: "key", js: "key", typ: "" }, - { json: "note", js: "note", typ: "" }, - { json: "object", js: "object", typ: "" }, - { json: "organizationId", js: "organizationId", typ: "" }, - { json: "projectId", js: "projectId", typ: u(undefined, u(null, "")) }, - { json: "revisionDate", js: "revisionDate", typ: "" }, - { json: "value", js: "value", typ: "" }, - ], false), - "ResponseForSecretsDeleteResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SecretsDeleteResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SecretsDeleteResponse": o([ - { json: "data", js: "data", typ: a(r("SecretDeleteResponse")) }, - ], false), - "SecretDeleteResponse": o([ - { json: "error", js: "error", typ: u(undefined, u(null, "")) }, - { json: "id", js: "id", typ: "" }, - ], false), - "DeviceType": [ - "Android", - "AndroidAmazon", - "ChromeBrowser", - "ChromeExtension", - "EdgeBrowser", - "EdgeExtension", - "FirefoxBrowser", - "FirefoxExtension", - "IEBrowser", - "iOS", - "LinuxDesktop", - "MacOsDesktop", - "OperaBrowser", - "OperaExtension", - "SDK", - "SafariBrowser", - "SafariExtension", - "UWP", - "UnknownBrowser", - "VivaldiBrowser", - "VivaldiExtension", - "WindowsDesktop", - ], -}; - diff --git a/languages/python/BitwardenClient/schemas.py b/languages/python/BitwardenClient/schemas.py deleted file mode 100644 index c116f47947..0000000000 --- a/languages/python/BitwardenClient/schemas.py +++ /dev/null @@ -1,1333 +0,0 @@ -from enum import Enum -from dataclasses import dataclass -from typing import Any, Optional, List, TypeVar, Type, Callable, cast -from uuid import UUID - - -T = TypeVar("T") -EnumT = TypeVar("EnumT", bound=Enum) - - -def from_str(x: Any) -> str: - assert isinstance(x, str) - return x - - -def to_enum(c: Type[EnumT], x: Any) -> EnumT: - assert isinstance(x, c) - return x.value - - -def from_none(x: Any) -> Any: - assert x is None - return x - - -def from_union(fs, x): - for f in fs: - try: - return f(x) - except: - pass - assert False - - -def from_list(f: Callable[[Any], T], x: Any) -> List[T]: - assert isinstance(x, list) - return [f(y) for y in x] - - -def to_class(c: Type[T], x: Any) -> dict: - assert isinstance(x, c) - return cast(Any, x).to_dict() - - -def from_bool(x: Any) -> bool: - assert isinstance(x, bool) - return x - - -class DeviceType(Enum): - """Device type to send to Bitwarden. Defaults to SDK""" - ANDROID = "Android" - ANDROID_AMAZON = "AndroidAmazon" - CHROME_BROWSER = "ChromeBrowser" - CHROME_EXTENSION = "ChromeExtension" - EDGE_BROWSER = "EdgeBrowser" - EDGE_EXTENSION = "EdgeExtension" - FIREFOX_BROWSER = "FirefoxBrowser" - FIREFOX_EXTENSION = "FirefoxExtension" - IE_BROWSER = "IEBrowser" - I_OS = "iOS" - LINUX_DESKTOP = "LinuxDesktop" - MAC_OS_DESKTOP = "MacOsDesktop" - OPERA_BROWSER = "OperaBrowser" - OPERA_EXTENSION = "OperaExtension" - SAFARI_BROWSER = "SafariBrowser" - SAFARI_EXTENSION = "SafariExtension" - SDK = "SDK" - UNKNOWN_BROWSER = "UnknownBrowser" - UWP = "UWP" - VIVALDI_BROWSER = "VivaldiBrowser" - VIVALDI_EXTENSION = "VivaldiExtension" - WINDOWS_DESKTOP = "WindowsDesktop" - - -@dataclass -class ClientSettings: - """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::client::client_settings::{ClientSettings, DeviceType}; # use - assert_matches::assert_matches; 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(); - assert_matches!(settings, default); ``` - - Targets `localhost:8080` for debug builds. - """ - """The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com`""" - api_url: str - """Device type to send to Bitwarden. Defaults to SDK""" - device_type: DeviceType - """The identity url of the targeted Bitwarden instance. Defaults to - `https://identity.bitwarden.com` - """ - identity_url: str - """The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK`""" - user_agent: str - - @staticmethod - def from_dict(obj: Any) -> 'ClientSettings': - assert isinstance(obj, dict) - api_url = from_str(obj.get("apiUrl")) - device_type = DeviceType(obj.get("deviceType")) - identity_url = from_str(obj.get("identityUrl")) - user_agent = from_str(obj.get("userAgent")) - return ClientSettings(api_url, device_type, identity_url, user_agent) - - def to_dict(self) -> dict: - result: dict = {} - result["apiUrl"] = from_str(self.api_url) - result["deviceType"] = to_enum(DeviceType, self.device_type) - result["identityUrl"] = from_str(self.identity_url) - result["userAgent"] = from_str(self.user_agent) - return result - - -@dataclass -class AccessTokenLoginRequest: - """Login to Bitwarden with access token""" - """Bitwarden service API access token""" - access_token: str - - @staticmethod - def from_dict(obj: Any) -> 'AccessTokenLoginRequest': - assert isinstance(obj, dict) - access_token = from_str(obj.get("accessToken")) - return AccessTokenLoginRequest(access_token) - - def to_dict(self) -> dict: - result: dict = {} - result["accessToken"] = from_str(self.access_token) - return result - - -@dataclass -class APIKeyLoginRequest: - """Login to Bitwarden with Api Key""" - """Bitwarden account client_id""" - client_id: str - """Bitwarden account client_secret""" - client_secret: str - """Bitwarden account master password""" - password: str - - @staticmethod - def from_dict(obj: Any) -> 'APIKeyLoginRequest': - assert isinstance(obj, dict) - client_id = from_str(obj.get("clientId")) - client_secret = from_str(obj.get("clientSecret")) - password = from_str(obj.get("password")) - return APIKeyLoginRequest(client_id, client_secret, password) - - def to_dict(self) -> dict: - result: dict = {} - result["clientId"] = from_str(self.client_id) - result["clientSecret"] = from_str(self.client_secret) - result["password"] = from_str(self.password) - return result - - -@dataclass -class FingerprintRequest: - """The input material, used in the fingerprint generation process.""" - fingerprint_material: str - """The user's public key""" - public_key: str - - @staticmethod - def from_dict(obj: Any) -> 'FingerprintRequest': - assert isinstance(obj, dict) - fingerprint_material = from_str(obj.get("fingerprintMaterial")) - public_key = from_str(obj.get("publicKey")) - return FingerprintRequest(fingerprint_material, public_key) - - def to_dict(self) -> dict: - result: dict = {} - result["fingerprintMaterial"] = from_str(self.fingerprint_material) - result["publicKey"] = from_str(self.public_key) - return result - - -@dataclass -class SecretVerificationRequest: - """The user's master password to use for user verification. If supplied, this will be used - for verification purposes. - """ - master_password: Optional[str] = None - """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. - """ - otp: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'SecretVerificationRequest': - assert isinstance(obj, dict) - master_password = from_union([from_none, from_str], obj.get("masterPassword")) - otp = from_union([from_none, from_str], obj.get("otp")) - return SecretVerificationRequest(master_password, otp) - - def to_dict(self) -> dict: - result: dict = {} - if self.master_password is not None: - result["masterPassword"] = from_union([from_none, from_str], self.master_password) - if self.otp is not None: - result["otp"] = from_union([from_none, from_str], self.otp) - return result - - -@dataclass -class PasswordLoginRequest: - """Login to Bitwarden with Username and Password""" - """Bitwarden account email address""" - email: str - """Bitwarden account master password""" - password: str - - @staticmethod - def from_dict(obj: Any) -> 'PasswordLoginRequest': - assert isinstance(obj, dict) - email = from_str(obj.get("email")) - password = from_str(obj.get("password")) - return PasswordLoginRequest(email, password) - - def to_dict(self) -> dict: - result: dict = {} - result["email"] = from_str(self.email) - result["password"] = from_str(self.password) - return result - - -@dataclass -class ProjectCreateRequest: - name: str - """Organization where the project will be created""" - organization_id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'ProjectCreateRequest': - assert isinstance(obj, dict) - name = from_str(obj.get("name")) - organization_id = UUID(obj.get("organizationId")) - return ProjectCreateRequest(name, organization_id) - - def to_dict(self) -> dict: - result: dict = {} - result["name"] = from_str(self.name) - result["organizationId"] = str(self.organization_id) - return result - - -@dataclass -class ProjectsDeleteRequest: - """IDs of the projects to delete""" - ids: List[UUID] - - @staticmethod - def from_dict(obj: Any) -> 'ProjectsDeleteRequest': - assert isinstance(obj, dict) - ids = from_list(lambda x: UUID(x), obj.get("ids")) - return ProjectsDeleteRequest(ids) - - def to_dict(self) -> dict: - result: dict = {} - result["ids"] = from_list(lambda x: str(x), self.ids) - return result - - -@dataclass -class ProjectGetRequest: - """ID of the project to retrieve""" - id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'ProjectGetRequest': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - return ProjectGetRequest(id) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - return result - - -@dataclass -class ProjectsListRequest: - """Organization to retrieve all the projects from""" - organization_id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'ProjectsListRequest': - assert isinstance(obj, dict) - organization_id = UUID(obj.get("organizationId")) - return ProjectsListRequest(organization_id) - - def to_dict(self) -> dict: - result: dict = {} - result["organizationId"] = str(self.organization_id) - return result - - -@dataclass -class ProjectPutRequest: - """ID of the project to modify""" - id: UUID - name: str - """Organization ID of the project to modify""" - organization_id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'ProjectPutRequest': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - name = from_str(obj.get("name")) - organization_id = UUID(obj.get("organizationId")) - return ProjectPutRequest(id, name, organization_id) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - result["name"] = from_str(self.name) - result["organizationId"] = str(self.organization_id) - return result - - -@dataclass -class ProjectsCommand: - """> Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Retrieve a project by the provided identifier - - Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Creates a new project in the provided organization using the given data - - Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Lists all projects of the given organization - - Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Updates an existing project with the provided ID using the given data - - Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Deletes all the projects whose IDs match the provided ones - - Returns: - [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) - """ - get: Optional[ProjectGetRequest] = None - create: Optional[ProjectCreateRequest] = None - list: Optional[ProjectsListRequest] = None - update: Optional[ProjectPutRequest] = None - delete: Optional[ProjectsDeleteRequest] = None - - @staticmethod - def from_dict(obj: Any) -> 'ProjectsCommand': - assert isinstance(obj, dict) - get = from_union([ProjectGetRequest.from_dict, from_none], obj.get("get")) - create = from_union([ProjectCreateRequest.from_dict, from_none], obj.get("create")) - list = from_union([ProjectsListRequest.from_dict, from_none], obj.get("list")) - update = from_union([ProjectPutRequest.from_dict, from_none], obj.get("update")) - delete = from_union([ProjectsDeleteRequest.from_dict, from_none], obj.get("delete")) - return ProjectsCommand(get, create, list, update, delete) - - def to_dict(self) -> dict: - result: dict = {} - if self.get is not None: - result["get"] = from_union([lambda x: to_class(ProjectGetRequest, x), from_none], self.get) - if self.create is not None: - result["create"] = from_union([lambda x: to_class(ProjectCreateRequest, x), from_none], self.create) - if self.list is not None: - result["list"] = from_union([lambda x: to_class(ProjectsListRequest, x), from_none], self.list) - if self.update is not None: - result["update"] = from_union([lambda x: to_class(ProjectPutRequest, x), from_none], self.update) - if self.delete is not None: - result["delete"] = from_union([lambda x: to_class(ProjectsDeleteRequest, x), from_none], self.delete) - return result - - -@dataclass -class SecretCreateRequest: - key: str - note: str - """Organization where the secret will be created""" - organization_id: UUID - value: str - """IDs of the projects that this secret will belong to""" - project_ids: Optional[List[UUID]] = None - - @staticmethod - def from_dict(obj: Any) -> 'SecretCreateRequest': - assert isinstance(obj, dict) - key = from_str(obj.get("key")) - note = from_str(obj.get("note")) - organization_id = UUID(obj.get("organizationId")) - value = from_str(obj.get("value")) - project_ids = from_union([from_none, lambda x: from_list(lambda x: UUID(x), x)], obj.get("projectIds")) - return SecretCreateRequest(key, note, organization_id, value, project_ids) - - def to_dict(self) -> dict: - result: dict = {} - result["key"] = from_str(self.key) - result["note"] = from_str(self.note) - result["organizationId"] = str(self.organization_id) - result["value"] = from_str(self.value) - if self.project_ids is not None: - result["projectIds"] = from_union([from_none, lambda x: from_list(lambda x: str(x), x)], self.project_ids) - return result - - -@dataclass -class SecretsDeleteRequest: - """IDs of the secrets to delete""" - ids: List[UUID] - - @staticmethod - def from_dict(obj: Any) -> 'SecretsDeleteRequest': - assert isinstance(obj, dict) - ids = from_list(lambda x: UUID(x), obj.get("ids")) - return SecretsDeleteRequest(ids) - - def to_dict(self) -> dict: - result: dict = {} - result["ids"] = from_list(lambda x: str(x), self.ids) - return result - - -@dataclass -class SecretGetRequest: - """ID of the secret to retrieve""" - id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'SecretGetRequest': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - return SecretGetRequest(id) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - return result - - -@dataclass -class SecretIdentifiersRequest: - """Organization to retrieve all the secrets from""" - organization_id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'SecretIdentifiersRequest': - assert isinstance(obj, dict) - organization_id = UUID(obj.get("organizationId")) - return SecretIdentifiersRequest(organization_id) - - def to_dict(self) -> dict: - result: dict = {} - result["organizationId"] = str(self.organization_id) - return result - - -@dataclass -class SecretPutRequest: - """ID of the secret to modify""" - id: UUID - key: str - note: str - """Organization ID of the secret to modify""" - organization_id: UUID - value: str - - @staticmethod - def from_dict(obj: Any) -> 'SecretPutRequest': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - key = from_str(obj.get("key")) - note = from_str(obj.get("note")) - organization_id = UUID(obj.get("organizationId")) - value = from_str(obj.get("value")) - return SecretPutRequest(id, key, note, organization_id, value) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - result["key"] = from_str(self.key) - result["note"] = from_str(self.note) - result["organizationId"] = str(self.organization_id) - result["value"] = from_str(self.value) - return result - - -@dataclass -class SecretsCommand: - """> Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Retrieve a secret by the provided identifier - - Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Creates a new secret in the provided organization using the given data - - Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Lists all secret identifiers of the given organization, to then retrieve each - secret, use `CreateSecret` - - Returns: - [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Updates an existing secret with the provided ID using the given data - - Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - - > Requires Authentication > Requires using an Access Token for login or calling Sync at - least once Deletes all the secrets whose IDs match the provided ones - - Returns: - [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) - """ - get: Optional[SecretGetRequest] = None - create: Optional[SecretCreateRequest] = None - list: Optional[SecretIdentifiersRequest] = None - update: Optional[SecretPutRequest] = None - delete: Optional[SecretsDeleteRequest] = None - - @staticmethod - def from_dict(obj: Any) -> 'SecretsCommand': - assert isinstance(obj, dict) - get = from_union([SecretGetRequest.from_dict, from_none], obj.get("get")) - create = from_union([SecretCreateRequest.from_dict, from_none], obj.get("create")) - list = from_union([SecretIdentifiersRequest.from_dict, from_none], obj.get("list")) - update = from_union([SecretPutRequest.from_dict, from_none], obj.get("update")) - delete = from_union([SecretsDeleteRequest.from_dict, from_none], obj.get("delete")) - return SecretsCommand(get, create, list, update, delete) - - def to_dict(self) -> dict: - result: dict = {} - if self.get is not None: - result["get"] = from_union([lambda x: to_class(SecretGetRequest, x), from_none], self.get) - if self.create is not None: - result["create"] = from_union([lambda x: to_class(SecretCreateRequest, x), from_none], self.create) - if self.list is not None: - result["list"] = from_union([lambda x: to_class(SecretIdentifiersRequest, x), from_none], self.list) - if self.update is not None: - result["update"] = from_union([lambda x: to_class(SecretPutRequest, x), from_none], self.update) - if self.delete is not None: - result["delete"] = from_union([lambda x: to_class(SecretsDeleteRequest, x), from_none], self.delete) - return result - - -@dataclass -class SyncRequest: - """Exclude the subdomains from the response, defaults to false""" - exclude_subdomains: Optional[bool] = None - - @staticmethod - def from_dict(obj: Any) -> 'SyncRequest': - assert isinstance(obj, dict) - exclude_subdomains = from_union([from_none, from_bool], obj.get("excludeSubdomains")) - return SyncRequest(exclude_subdomains) - - def to_dict(self) -> dict: - result: dict = {} - if self.exclude_subdomains is not None: - result["excludeSubdomains"] = from_union([from_none, from_bool], self.exclude_subdomains) - return result - - -@dataclass -class Command: - """Login with username and password - - This command is for initiating an authentication handshake with Bitwarden. Authorization - may fail due to requiring 2fa or captcha challenge completion despite accurate - credentials. - - This command is not capable of handling authentication requiring 2fa or captcha. - - Returns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse) - - Login with API Key - - This command is for initiating an authentication handshake with Bitwarden. - - Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - - Login with Secrets Manager Access Token - - This command is for initiating an authentication handshake with Bitwarden. - - Returns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse) - - > Requires Authentication Get the API key of the currently authenticated user - - Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) - - Get the user's passphrase - - Returns: String - - > Requires Authentication Retrieve all user data, ciphers and organizations the user is a - part of - - Returns: [SyncResponse](bitwarden::platform::SyncResponse) - """ - password_login: Optional[PasswordLoginRequest] = None - api_key_login: Optional[APIKeyLoginRequest] = None - access_token_login: Optional[AccessTokenLoginRequest] = None - get_user_api_key: Optional[SecretVerificationRequest] = None - fingerprint: Optional[FingerprintRequest] = None - sync: Optional[SyncRequest] = None - secrets: Optional[SecretsCommand] = None - projects: Optional[ProjectsCommand] = None - - @staticmethod - def from_dict(obj: Any) -> 'Command': - assert isinstance(obj, dict) - password_login = from_union([PasswordLoginRequest.from_dict, from_none], obj.get("passwordLogin")) - api_key_login = from_union([APIKeyLoginRequest.from_dict, from_none], obj.get("apiKeyLogin")) - access_token_login = from_union([AccessTokenLoginRequest.from_dict, from_none], obj.get("accessTokenLogin")) - get_user_api_key = from_union([SecretVerificationRequest.from_dict, from_none], obj.get("getUserApiKey")) - fingerprint = from_union([FingerprintRequest.from_dict, from_none], obj.get("fingerprint")) - sync = from_union([SyncRequest.from_dict, from_none], obj.get("sync")) - secrets = from_union([SecretsCommand.from_dict, from_none], obj.get("secrets")) - projects = from_union([ProjectsCommand.from_dict, from_none], obj.get("projects")) - return Command(password_login, api_key_login, access_token_login, get_user_api_key, fingerprint, sync, secrets, projects) - - def to_dict(self) -> dict: - result: dict = {} - if self.password_login is not None: - result["passwordLogin"] = from_union([lambda x: to_class(PasswordLoginRequest, x), from_none], self.password_login) - if self.api_key_login is not None: - result["apiKeyLogin"] = from_union([lambda x: to_class(APIKeyLoginRequest, x), from_none], self.api_key_login) - if self.access_token_login is not None: - result["accessTokenLogin"] = from_union([lambda x: to_class(AccessTokenLoginRequest, x), from_none], self.access_token_login) - if self.get_user_api_key is not None: - result["getUserApiKey"] = from_union([lambda x: to_class(SecretVerificationRequest, x), from_none], self.get_user_api_key) - if self.fingerprint is not None: - result["fingerprint"] = from_union([lambda x: to_class(FingerprintRequest, x), from_none], self.fingerprint) - if self.sync is not None: - result["sync"] = from_union([lambda x: to_class(SyncRequest, x), from_none], self.sync) - if self.secrets is not None: - result["secrets"] = from_union([lambda x: to_class(SecretsCommand, x), from_none], self.secrets) - if self.projects is not None: - result["projects"] = from_union([lambda x: to_class(ProjectsCommand, x), from_none], self.projects) - return result - - -@dataclass -class PurpleAuthenticator: - pass - - @staticmethod - def from_dict(obj: Any) -> 'PurpleAuthenticator': - assert isinstance(obj, dict) - return PurpleAuthenticator() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class PurpleDuo: - host: str - signature: str - - @staticmethod - def from_dict(obj: Any) -> 'PurpleDuo': - assert isinstance(obj, dict) - host = from_str(obj.get("host")) - signature = from_str(obj.get("signature")) - return PurpleDuo(host, signature) - - def to_dict(self) -> dict: - result: dict = {} - result["host"] = from_str(self.host) - result["signature"] = from_str(self.signature) - return result - - -@dataclass -class PurpleEmail: - """The email to request a 2fa TOTP for""" - email: str - - @staticmethod - def from_dict(obj: Any) -> 'PurpleEmail': - assert isinstance(obj, dict) - email = from_str(obj.get("email")) - return PurpleEmail(email) - - def to_dict(self) -> dict: - result: dict = {} - result["email"] = from_str(self.email) - return result - - -@dataclass -class PurpleRemember: - pass - - @staticmethod - def from_dict(obj: Any) -> 'PurpleRemember': - assert isinstance(obj, dict) - return PurpleRemember() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class PurpleWebAuthn: - pass - - @staticmethod - def from_dict(obj: Any) -> 'PurpleWebAuthn': - assert isinstance(obj, dict) - return PurpleWebAuthn() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class PurpleYubiKey: - """Whether the stored yubikey supports near field communication""" - nfc: bool - - @staticmethod - def from_dict(obj: Any) -> 'PurpleYubiKey': - assert isinstance(obj, dict) - nfc = from_bool(obj.get("nfc")) - return PurpleYubiKey(nfc) - - def to_dict(self) -> dict: - result: dict = {} - result["nfc"] = from_bool(self.nfc) - return result - - -@dataclass -class APIKeyLoginResponseTwoFactorProviders: - authenticator: Optional[PurpleAuthenticator] = None - """Duo-backed 2fa""" - duo: Optional[PurpleDuo] = None - """Email 2fa""" - email: Optional[PurpleEmail] = None - """Duo-backed 2fa operated by an organization the user is a member of""" - organization_duo: Optional[PurpleDuo] = None - """Presence indicates the user has stored this device as bypassing 2fa""" - remember: Optional[PurpleRemember] = None - """WebAuthn-backed 2fa""" - web_authn: Optional[PurpleWebAuthn] = None - """Yubikey-backed 2fa""" - yubi_key: Optional[PurpleYubiKey] = None - - @staticmethod - def from_dict(obj: Any) -> 'APIKeyLoginResponseTwoFactorProviders': - assert isinstance(obj, dict) - authenticator = from_union([PurpleAuthenticator.from_dict, from_none], obj.get("authenticator")) - duo = from_union([PurpleDuo.from_dict, from_none], obj.get("duo")) - email = from_union([PurpleEmail.from_dict, from_none], obj.get("email")) - organization_duo = from_union([PurpleDuo.from_dict, from_none], obj.get("organizationDuo")) - remember = from_union([PurpleRemember.from_dict, from_none], obj.get("remember")) - web_authn = from_union([PurpleWebAuthn.from_dict, from_none], obj.get("webAuthn")) - yubi_key = from_union([PurpleYubiKey.from_dict, from_none], obj.get("yubiKey")) - return APIKeyLoginResponseTwoFactorProviders(authenticator, duo, email, organization_duo, remember, web_authn, yubi_key) - - def to_dict(self) -> dict: - result: dict = {} - if self.authenticator is not None: - result["authenticator"] = from_union([lambda x: to_class(PurpleAuthenticator, x), from_none], self.authenticator) - if self.duo is not None: - result["duo"] = from_union([lambda x: to_class(PurpleDuo, x), from_none], self.duo) - if self.email is not None: - result["email"] = from_union([lambda x: to_class(PurpleEmail, x), from_none], self.email) - if self.organization_duo is not None: - result["organizationDuo"] = from_union([lambda x: to_class(PurpleDuo, x), from_none], self.organization_duo) - if self.remember is not None: - result["remember"] = from_union([lambda x: to_class(PurpleRemember, x), from_none], self.remember) - if self.web_authn is not None: - result["webAuthn"] = from_union([lambda x: to_class(PurpleWebAuthn, x), from_none], self.web_authn) - if self.yubi_key is not None: - result["yubiKey"] = from_union([lambda x: to_class(PurpleYubiKey, x), from_none], self.yubi_key) - return result - - -@dataclass -class APIKeyLoginResponse: - authenticated: bool - """Whether or not the user is required to update their master password""" - force_password_reset: bool - """TODO: What does this do?""" - reset_master_password: bool - two_factor: Optional[APIKeyLoginResponseTwoFactorProviders] = None - - @staticmethod - def from_dict(obj: Any) -> 'APIKeyLoginResponse': - assert isinstance(obj, dict) - authenticated = from_bool(obj.get("authenticated")) - force_password_reset = from_bool(obj.get("forcePasswordReset")) - reset_master_password = from_bool(obj.get("resetMasterPassword")) - two_factor = from_union([APIKeyLoginResponseTwoFactorProviders.from_dict, from_none], obj.get("twoFactor")) - return APIKeyLoginResponse(authenticated, force_password_reset, reset_master_password, two_factor) - - def to_dict(self) -> dict: - result: dict = {} - result["authenticated"] = from_bool(self.authenticated) - result["forcePasswordReset"] = from_bool(self.force_password_reset) - result["resetMasterPassword"] = from_bool(self.reset_master_password) - if self.two_factor is not None: - result["twoFactor"] = from_union([lambda x: to_class(APIKeyLoginResponseTwoFactorProviders, x), from_none], self.two_factor) - return result - - -@dataclass -class ResponseForAPIKeyLoginResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[APIKeyLoginResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForAPIKeyLoginResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([APIKeyLoginResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForAPIKeyLoginResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(APIKeyLoginResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - -@dataclass -class CAPTCHAResponse: - """hcaptcha site key""" - site_key: str - - @staticmethod - def from_dict(obj: Any) -> 'CAPTCHAResponse': - assert isinstance(obj, dict) - site_key = from_str(obj.get("siteKey")) - return CAPTCHAResponse(site_key) - - def to_dict(self) -> dict: - result: dict = {} - result["siteKey"] = from_str(self.site_key) - return result - - -@dataclass -class FluffyAuthenticator: - pass - - @staticmethod - def from_dict(obj: Any) -> 'FluffyAuthenticator': - assert isinstance(obj, dict) - return FluffyAuthenticator() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class FluffyDuo: - host: str - signature: str - - @staticmethod - def from_dict(obj: Any) -> 'FluffyDuo': - assert isinstance(obj, dict) - host = from_str(obj.get("host")) - signature = from_str(obj.get("signature")) - return FluffyDuo(host, signature) - - def to_dict(self) -> dict: - result: dict = {} - result["host"] = from_str(self.host) - result["signature"] = from_str(self.signature) - return result - - -@dataclass -class FluffyEmail: - """The email to request a 2fa TOTP for""" - email: str - - @staticmethod - def from_dict(obj: Any) -> 'FluffyEmail': - assert isinstance(obj, dict) - email = from_str(obj.get("email")) - return FluffyEmail(email) - - def to_dict(self) -> dict: - result: dict = {} - result["email"] = from_str(self.email) - return result - - -@dataclass -class FluffyRemember: - pass - - @staticmethod - def from_dict(obj: Any) -> 'FluffyRemember': - assert isinstance(obj, dict) - return FluffyRemember() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class FluffyWebAuthn: - pass - - @staticmethod - def from_dict(obj: Any) -> 'FluffyWebAuthn': - assert isinstance(obj, dict) - return FluffyWebAuthn() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class FluffyYubiKey: - """Whether the stored yubikey supports near field communication""" - nfc: bool - - @staticmethod - def from_dict(obj: Any) -> 'FluffyYubiKey': - assert isinstance(obj, dict) - nfc = from_bool(obj.get("nfc")) - return FluffyYubiKey(nfc) - - def to_dict(self) -> dict: - result: dict = {} - result["nfc"] = from_bool(self.nfc) - return result - - -@dataclass -class PasswordLoginResponseTwoFactorProviders: - authenticator: Optional[FluffyAuthenticator] = None - """Duo-backed 2fa""" - duo: Optional[FluffyDuo] = None - """Email 2fa""" - email: Optional[FluffyEmail] = None - """Duo-backed 2fa operated by an organization the user is a member of""" - organization_duo: Optional[FluffyDuo] = None - """Presence indicates the user has stored this device as bypassing 2fa""" - remember: Optional[FluffyRemember] = None - """WebAuthn-backed 2fa""" - web_authn: Optional[FluffyWebAuthn] = None - """Yubikey-backed 2fa""" - yubi_key: Optional[FluffyYubiKey] = None - - @staticmethod - def from_dict(obj: Any) -> 'PasswordLoginResponseTwoFactorProviders': - assert isinstance(obj, dict) - authenticator = from_union([FluffyAuthenticator.from_dict, from_none], obj.get("authenticator")) - duo = from_union([FluffyDuo.from_dict, from_none], obj.get("duo")) - email = from_union([FluffyEmail.from_dict, from_none], obj.get("email")) - organization_duo = from_union([FluffyDuo.from_dict, from_none], obj.get("organizationDuo")) - remember = from_union([FluffyRemember.from_dict, from_none], obj.get("remember")) - web_authn = from_union([FluffyWebAuthn.from_dict, from_none], obj.get("webAuthn")) - yubi_key = from_union([FluffyYubiKey.from_dict, from_none], obj.get("yubiKey")) - return PasswordLoginResponseTwoFactorProviders(authenticator, duo, email, organization_duo, remember, web_authn, yubi_key) - - def to_dict(self) -> dict: - result: dict = {} - if self.authenticator is not None: - result["authenticator"] = from_union([lambda x: to_class(FluffyAuthenticator, x), from_none], self.authenticator) - if self.duo is not None: - result["duo"] = from_union([lambda x: to_class(FluffyDuo, x), from_none], self.duo) - if self.email is not None: - result["email"] = from_union([lambda x: to_class(FluffyEmail, x), from_none], self.email) - if self.organization_duo is not None: - result["organizationDuo"] = from_union([lambda x: to_class(FluffyDuo, x), from_none], self.organization_duo) - if self.remember is not None: - result["remember"] = from_union([lambda x: to_class(FluffyRemember, x), from_none], self.remember) - if self.web_authn is not None: - result["webAuthn"] = from_union([lambda x: to_class(FluffyWebAuthn, x), from_none], self.web_authn) - if self.yubi_key is not None: - result["yubiKey"] = from_union([lambda x: to_class(FluffyYubiKey, x), from_none], self.yubi_key) - return result - - -@dataclass -class PasswordLoginResponse: - authenticated: bool - """Whether or not the user is required to update their master password""" - force_password_reset: bool - """TODO: What does this do?""" - reset_master_password: bool - """The information required to present the user with a captcha challenge. Only present when - authentication fails due to requiring validation of a captcha challenge. - """ - captcha: Optional[CAPTCHAResponse] = None - """The available two factor authentication options. Present only when authentication fails - due to requiring a second authentication factor. - """ - two_factor: Optional[PasswordLoginResponseTwoFactorProviders] = None - - @staticmethod - def from_dict(obj: Any) -> 'PasswordLoginResponse': - assert isinstance(obj, dict) - authenticated = from_bool(obj.get("authenticated")) - force_password_reset = from_bool(obj.get("forcePasswordReset")) - reset_master_password = from_bool(obj.get("resetMasterPassword")) - captcha = from_union([CAPTCHAResponse.from_dict, from_none], obj.get("captcha")) - two_factor = from_union([PasswordLoginResponseTwoFactorProviders.from_dict, from_none], obj.get("twoFactor")) - return PasswordLoginResponse(authenticated, force_password_reset, reset_master_password, captcha, two_factor) - - def to_dict(self) -> dict: - result: dict = {} - result["authenticated"] = from_bool(self.authenticated) - result["forcePasswordReset"] = from_bool(self.force_password_reset) - result["resetMasterPassword"] = from_bool(self.reset_master_password) - if self.captcha is not None: - result["captcha"] = from_union([lambda x: to_class(CAPTCHAResponse, x), from_none], self.captcha) - if self.two_factor is not None: - result["twoFactor"] = from_union([lambda x: to_class(PasswordLoginResponseTwoFactorProviders, x), from_none], self.two_factor) - return result - - -@dataclass -class ResponseForPasswordLoginResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[PasswordLoginResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForPasswordLoginResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([PasswordLoginResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForPasswordLoginResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(PasswordLoginResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - -@dataclass -class SecretIdentifierResponse: - id: UUID - key: str - organization_id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'SecretIdentifierResponse': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - key = from_str(obj.get("key")) - organization_id = UUID(obj.get("organizationId")) - return SecretIdentifierResponse(id, key, organization_id) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - result["key"] = from_str(self.key) - result["organizationId"] = str(self.organization_id) - return result - - -@dataclass -class SecretIdentifiersResponse: - data: List[SecretIdentifierResponse] - - @staticmethod - def from_dict(obj: Any) -> 'SecretIdentifiersResponse': - assert isinstance(obj, dict) - data = from_list(SecretIdentifierResponse.from_dict, obj.get("data")) - return SecretIdentifiersResponse(data) - - def to_dict(self) -> dict: - result: dict = {} - result["data"] = from_list(lambda x: to_class(SecretIdentifierResponse, x), self.data) - return result - - -@dataclass -class ResponseForSecretIdentifiersResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[SecretIdentifiersResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForSecretIdentifiersResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([SecretIdentifiersResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForSecretIdentifiersResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(SecretIdentifiersResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - -@dataclass -class SecretResponse: - creation_date: str - id: UUID - key: str - note: str - object: str - organization_id: UUID - revision_date: str - value: str - project_id: Optional[UUID] = None - - @staticmethod - def from_dict(obj: Any) -> 'SecretResponse': - assert isinstance(obj, dict) - creation_date = from_str(obj.get("creationDate")) - id = UUID(obj.get("id")) - key = from_str(obj.get("key")) - note = from_str(obj.get("note")) - object = from_str(obj.get("object")) - organization_id = UUID(obj.get("organizationId")) - revision_date = from_str(obj.get("revisionDate")) - value = from_str(obj.get("value")) - project_id = from_union([from_none, lambda x: UUID(x)], obj.get("projectId")) - return SecretResponse(creation_date, id, key, note, object, organization_id, revision_date, value, project_id) - - def to_dict(self) -> dict: - result: dict = {} - result["creationDate"] = from_str(self.creation_date) - result["id"] = str(self.id) - result["key"] = from_str(self.key) - result["note"] = from_str(self.note) - result["object"] = from_str(self.object) - result["organizationId"] = str(self.organization_id) - result["revisionDate"] = from_str(self.revision_date) - result["value"] = from_str(self.value) - if self.project_id is not None: - result["projectId"] = from_union([from_none, lambda x: str(x)], self.project_id) - return result - - -@dataclass -class ResponseForSecretResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[SecretResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForSecretResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([SecretResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForSecretResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(SecretResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - -@dataclass -class SecretDeleteResponse: - id: UUID - error: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'SecretDeleteResponse': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - error = from_union([from_none, from_str], obj.get("error")) - return SecretDeleteResponse(id, error) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - if self.error is not None: - result["error"] = from_union([from_none, from_str], self.error) - return result - - -@dataclass -class SecretsDeleteResponse: - data: List[SecretDeleteResponse] - - @staticmethod - def from_dict(obj: Any) -> 'SecretsDeleteResponse': - assert isinstance(obj, dict) - data = from_list(SecretDeleteResponse.from_dict, obj.get("data")) - return SecretsDeleteResponse(data) - - def to_dict(self) -> dict: - result: dict = {} - result["data"] = from_list(lambda x: to_class(SecretDeleteResponse, x), self.data) - return result - - -@dataclass -class ResponseForSecretsDeleteResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[SecretsDeleteResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForSecretsDeleteResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([SecretsDeleteResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForSecretsDeleteResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(SecretsDeleteResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - -def client_settings_from_dict(s: Any) -> ClientSettings: - return ClientSettings.from_dict(s) - - -def client_settings_to_dict(x: ClientSettings) -> Any: - return to_class(ClientSettings, x) - - -def command_from_dict(s: Any) -> Command: - return Command.from_dict(s) - - -def command_to_dict(x: Command) -> Any: - return to_class(Command, x) - - -def response_for_api_key_login_response_from_dict(s: Any) -> ResponseForAPIKeyLoginResponse: - return ResponseForAPIKeyLoginResponse.from_dict(s) - - -def response_for_api_key_login_response_to_dict(x: ResponseForAPIKeyLoginResponse) -> Any: - return to_class(ResponseForAPIKeyLoginResponse, x) - - -def response_for_password_login_response_from_dict(s: Any) -> ResponseForPasswordLoginResponse: - return ResponseForPasswordLoginResponse.from_dict(s) - - -def response_for_password_login_response_to_dict(x: ResponseForPasswordLoginResponse) -> Any: - return to_class(ResponseForPasswordLoginResponse, x) - - -def response_for_secret_identifiers_response_from_dict(s: Any) -> ResponseForSecretIdentifiersResponse: - return ResponseForSecretIdentifiersResponse.from_dict(s) - - -def response_for_secret_identifiers_response_to_dict(x: ResponseForSecretIdentifiersResponse) -> Any: - return to_class(ResponseForSecretIdentifiersResponse, x) - - -def response_for_secret_response_from_dict(s: Any) -> ResponseForSecretResponse: - return ResponseForSecretResponse.from_dict(s) - - -def response_for_secret_response_to_dict(x: ResponseForSecretResponse) -> Any: - return to_class(ResponseForSecretResponse, x) - - -def response_for_secrets_delete_response_from_dict(s: Any) -> ResponseForSecretsDeleteResponse: - return ResponseForSecretsDeleteResponse.from_dict(s) - - -def response_for_secrets_delete_response_to_dict(x: ResponseForSecretsDeleteResponse) -> Any: - return to_class(ResponseForSecretsDeleteResponse, x) - diff --git a/support/schemas/bitwarden/client/ClientSettings.json b/support/schemas/bitwarden/client/ClientSettings.json deleted file mode 100644 index aa321c42a1..0000000000 --- a/support/schemas/bitwarden/client/ClientSettings.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ClientSettings", - "description": "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.\n\nDefaults to\n\n``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; # use assert_matches::assert_matches; 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(); assert_matches!(settings, default); ```\n\nTargets `localhost:8080` for debug builds.", - "type": "object", - "required": [ - "apiUrl", - "deviceType", - "identityUrl", - "userAgent" - ], - "properties": { - "apiUrl": { - "description": "The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com`", - "type": "string" - }, - "deviceType": { - "description": "Device type to send to Bitwarden. Defaults to SDK", - "allOf": [ - { - "$ref": "#/definitions/DeviceType" - } - ] - }, - "identityUrl": { - "description": "The identity url of the targeted Bitwarden instance. Defaults to `https://identity.bitwarden.com`", - "type": "string" - }, - "userAgent": { - "description": "The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK`", - "type": "string" - } - }, - "additionalProperties": false, - "definitions": { - "DeviceType": { - "type": "string", - "enum": [ - "Android", - "iOS", - "ChromeExtension", - "FirefoxExtension", - "OperaExtension", - "EdgeExtension", - "WindowsDesktop", - "MacOsDesktop", - "LinuxDesktop", - "ChromeBrowser", - "FirefoxBrowser", - "OperaBrowser", - "EdgeBrowser", - "IEBrowser", - "UnknownBrowser", - "AndroidAmazon", - "UWP", - "SafariBrowser", - "VivaldiBrowser", - "VivaldiExtension", - "SafariExtension", - "SDK" - ] - } - } -} diff --git a/support/schemas/bitwarden_json/Command.json b/support/schemas/bitwarden_json/Command.json deleted file mode 100644 index b65091fa97..0000000000 --- a/support/schemas/bitwarden_json/Command.json +++ /dev/null @@ -1,557 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Command", - "oneOf": [ - { - "description": "Login with username and password\n\nThis command is for initiating an authentication handshake with Bitwarden. Authorization may fail due to requiring 2fa or captcha challenge completion despite accurate credentials.\n\nThis command is not capable of handling authentication requiring 2fa or captcha.\n\nReturns: [PasswordLoginResponse](bitwarden::auth::response::PasswordLoginResponse)", - "type": "object", - "required": [ - "passwordLogin" - ], - "properties": { - "passwordLogin": { - "$ref": "#/definitions/PasswordLoginRequest" - } - }, - "additionalProperties": false - }, - { - "description": "Login with API Key\n\nThis command is for initiating an authentication handshake with Bitwarden.\n\nReturns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse)", - "type": "object", - "required": [ - "apiKeyLogin" - ], - "properties": { - "apiKeyLogin": { - "$ref": "#/definitions/ApiKeyLoginRequest" - } - }, - "additionalProperties": false - }, - { - "description": "Login with Secrets Manager Access Token\n\nThis command is for initiating an authentication handshake with Bitwarden.\n\nReturns: [ApiKeyLoginResponse](bitwarden::auth::response::ApiKeyLoginResponse)", - "type": "object", - "required": [ - "accessTokenLogin" - ], - "properties": { - "accessTokenLogin": { - "$ref": "#/definitions/AccessTokenLoginRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication Get the API key of the currently authenticated user\n\nReturns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse)", - "type": "object", - "required": [ - "getUserApiKey" - ], - "properties": { - "getUserApiKey": { - "$ref": "#/definitions/SecretVerificationRequest" - } - }, - "additionalProperties": false - }, - { - "description": "Get the user's passphrase\n\nReturns: String", - "type": "object", - "required": [ - "fingerprint" - ], - "properties": { - "fingerprint": { - "$ref": "#/definitions/FingerprintRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication Retrieve all user data, ciphers and organizations the user is a part of\n\nReturns: [SyncResponse](bitwarden::platform::SyncResponse)", - "type": "object", - "required": [ - "sync" - ], - "properties": { - "sync": { - "$ref": "#/definitions/SyncRequest" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "secrets" - ], - "properties": { - "secrets": { - "$ref": "#/definitions/SecretsCommand" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "projects" - ], - "properties": { - "projects": { - "$ref": "#/definitions/ProjectsCommand" - } - }, - "additionalProperties": false - } - ], - "definitions": { - "AccessTokenLoginRequest": { - "description": "Login to Bitwarden with access token", - "type": "object", - "required": [ - "accessToken" - ], - "properties": { - "accessToken": { - "description": "Bitwarden service API access token", - "type": "string" - } - }, - "additionalProperties": false - }, - "ApiKeyLoginRequest": { - "description": "Login to Bitwarden with Api Key", - "type": "object", - "required": [ - "clientId", - "clientSecret", - "password" - ], - "properties": { - "clientId": { - "description": "Bitwarden account client_id", - "type": "string" - }, - "clientSecret": { - "description": "Bitwarden account client_secret", - "type": "string" - }, - "password": { - "description": "Bitwarden account master password", - "type": "string" - } - }, - "additionalProperties": false - }, - "FingerprintRequest": { - "type": "object", - "required": [ - "fingerprintMaterial", - "publicKey" - ], - "properties": { - "fingerprintMaterial": { - "description": "The input material, used in the fingerprint generation process.", - "type": "string" - }, - "publicKey": { - "description": "The user's public key", - "type": "string" - } - }, - "additionalProperties": false - }, - "PasswordLoginRequest": { - "description": "Login to Bitwarden with Username and Password", - "type": "object", - "required": [ - "email", - "password" - ], - "properties": { - "email": { - "description": "Bitwarden account email address", - "type": "string" - }, - "password": { - "description": "Bitwarden account master password", - "type": "string" - } - }, - "additionalProperties": false - }, - "ProjectCreateRequest": { - "type": "object", - "required": [ - "name", - "organizationId" - ], - "properties": { - "name": { - "type": "string" - }, - "organizationId": { - "description": "Organization where the project will be created", - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "ProjectGetRequest": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "description": "ID of the project to retrieve", - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "ProjectPutRequest": { - "type": "object", - "required": [ - "id", - "name", - "organizationId" - ], - "properties": { - "id": { - "description": "ID of the project to modify", - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string" - }, - "organizationId": { - "description": "Organization ID of the project to modify", - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "ProjectsCommand": { - "oneOf": [ - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a project by the provided identifier\n\nReturns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)", - "type": "object", - "required": [ - "get" - ], - "properties": { - "get": { - "$ref": "#/definitions/ProjectGetRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new project in the provided organization using the given data\n\nReturns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)", - "type": "object", - "required": [ - "create" - ], - "properties": { - "create": { - "$ref": "#/definitions/ProjectCreateRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all projects of the given organization\n\nReturns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse)", - "type": "object", - "required": [ - "list" - ], - "properties": { - "list": { - "$ref": "#/definitions/ProjectsListRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing project with the provided ID using the given data\n\nReturns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse)", - "type": "object", - "required": [ - "update" - ], - "properties": { - "update": { - "$ref": "#/definitions/ProjectPutRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones\n\nReturns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse)", - "type": "object", - "required": [ - "delete" - ], - "properties": { - "delete": { - "$ref": "#/definitions/ProjectsDeleteRequest" - } - }, - "additionalProperties": false - } - ] - }, - "ProjectsDeleteRequest": { - "type": "object", - "required": [ - "ids" - ], - "properties": { - "ids": { - "description": "IDs of the projects to delete", - "type": "array", - "items": { - "type": "string", - "format": "uuid" - } - } - }, - "additionalProperties": false - }, - "ProjectsListRequest": { - "type": "object", - "required": [ - "organizationId" - ], - "properties": { - "organizationId": { - "description": "Organization to retrieve all the projects from", - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "SecretCreateRequest": { - "type": "object", - "required": [ - "key", - "note", - "organizationId", - "value" - ], - "properties": { - "key": { - "type": "string" - }, - "note": { - "type": "string" - }, - "organizationId": { - "description": "Organization where the secret will be created", - "type": "string", - "format": "uuid" - }, - "projectIds": { - "description": "IDs of the projects that this secret will belong to", - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "format": "uuid" - } - }, - "value": { - "type": "string" - } - }, - "additionalProperties": false - }, - "SecretGetRequest": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "description": "ID of the secret to retrieve", - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "SecretIdentifiersRequest": { - "type": "object", - "required": [ - "organizationId" - ], - "properties": { - "organizationId": { - "description": "Organization to retrieve all the secrets from", - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "SecretPutRequest": { - "type": "object", - "required": [ - "id", - "key", - "note", - "organizationId", - "value" - ], - "properties": { - "id": { - "description": "ID of the secret to modify", - "type": "string", - "format": "uuid" - }, - "key": { - "type": "string" - }, - "note": { - "type": "string" - }, - "organizationId": { - "description": "Organization ID of the secret to modify", - "type": "string", - "format": "uuid" - }, - "value": { - "type": "string" - } - }, - "additionalProperties": false - }, - "SecretVerificationRequest": { - "type": "object", - "properties": { - "masterPassword": { - "description": "The user's master password to use for user verification. If supplied, this will be used for verification purposes.", - "type": [ - "string", - "null" - ] - }, - "otp": { - "description": "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.", - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false - }, - "SecretsCommand": { - "oneOf": [ - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a secret by the provided identifier\n\nReturns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)", - "type": "object", - "required": [ - "get" - ], - "properties": { - "get": { - "$ref": "#/definitions/SecretGetRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new secret in the provided organization using the given data\n\nReturns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)", - "type": "object", - "required": [ - "create" - ], - "properties": { - "create": { - "$ref": "#/definitions/SecretCreateRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all secret identifiers of the given organization, to then retrieve each secret, use `CreateSecret`\n\nReturns: [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse)", - "type": "object", - "required": [ - "list" - ], - "properties": { - "list": { - "$ref": "#/definitions/SecretIdentifiersRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing secret with the provided ID using the given data\n\nReturns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)", - "type": "object", - "required": [ - "update" - ], - "properties": { - "update": { - "$ref": "#/definitions/SecretPutRequest" - } - }, - "additionalProperties": false - }, - { - "description": "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones\n\nReturns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse)", - "type": "object", - "required": [ - "delete" - ], - "properties": { - "delete": { - "$ref": "#/definitions/SecretsDeleteRequest" - } - }, - "additionalProperties": false - } - ] - }, - "SecretsDeleteRequest": { - "type": "object", - "required": [ - "ids" - ], - "properties": { - "ids": { - "description": "IDs of the secrets to delete", - "type": "array", - "items": { - "type": "string", - "format": "uuid" - } - } - }, - "additionalProperties": false - }, - "SyncRequest": { - "type": "object", - "properties": { - "excludeSubdomains": { - "description": "Exclude the subdomains from the response, defaults to false", - "type": [ - "boolean", - "null" - ] - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/ApiKeyLoginResponse.json b/support/schemas/response/ApiKeyLoginResponse.json deleted file mode 100644 index 3bfecfb4eb..0000000000 --- a/support/schemas/response/ApiKeyLoginResponse.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_ApiKeyLoginResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/ApiKeyLoginResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "ApiKeyLoginResponse": { - "type": "object", - "required": [ - "authenticated", - "forcePasswordReset", - "resetMasterPassword" - ], - "properties": { - "authenticated": { - "type": "boolean" - }, - "forcePasswordReset": { - "description": "Whether or not the user is required to update their master password", - "type": "boolean" - }, - "resetMasterPassword": { - "description": "TODO: What does this do?", - "type": "boolean" - }, - "twoFactor": { - "anyOf": [ - { - "$ref": "#/definitions/TwoFactorProviders" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - }, - "Authenticator": { - "type": "object", - "additionalProperties": false - }, - "Duo": { - "type": "object", - "required": [ - "host", - "signature" - ], - "properties": { - "host": { - "type": "string" - }, - "signature": { - "type": "string" - } - }, - "additionalProperties": false - }, - "Email": { - "type": "object", - "required": [ - "email" - ], - "properties": { - "email": { - "description": "The email to request a 2fa TOTP for", - "type": "string" - } - }, - "additionalProperties": false - }, - "Remember": { - "type": "object", - "additionalProperties": false - }, - "TwoFactorProviders": { - "type": "object", - "properties": { - "authenticator": { - "anyOf": [ - { - "$ref": "#/definitions/Authenticator" - }, - { - "type": "null" - } - ] - }, - "duo": { - "description": "Duo-backed 2fa", - "anyOf": [ - { - "$ref": "#/definitions/Duo" - }, - { - "type": "null" - } - ] - }, - "email": { - "description": "Email 2fa", - "anyOf": [ - { - "$ref": "#/definitions/Email" - }, - { - "type": "null" - } - ] - }, - "organizationDuo": { - "description": "Duo-backed 2fa operated by an organization the user is a member of", - "anyOf": [ - { - "$ref": "#/definitions/Duo" - }, - { - "type": "null" - } - ] - }, - "remember": { - "description": "Presence indicates the user has stored this device as bypassing 2fa", - "anyOf": [ - { - "$ref": "#/definitions/Remember" - }, - { - "type": "null" - } - ] - }, - "webAuthn": { - "description": "WebAuthn-backed 2fa", - "anyOf": [ - { - "$ref": "#/definitions/WebAuthn" - }, - { - "type": "null" - } - ] - }, - "yubiKey": { - "description": "Yubikey-backed 2fa", - "anyOf": [ - { - "$ref": "#/definitions/YubiKey" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - }, - "WebAuthn": { - "type": "object", - "additionalProperties": false - }, - "YubiKey": { - "type": "object", - "required": [ - "nfc" - ], - "properties": { - "nfc": { - "description": "Whether the stored yubikey supports near field communication", - "type": "boolean" - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/PasswordLoginResponse.json b/support/schemas/response/PasswordLoginResponse.json deleted file mode 100644 index be96773497..0000000000 --- a/support/schemas/response/PasswordLoginResponse.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_PasswordLoginResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/PasswordLoginResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "Authenticator": { - "type": "object", - "additionalProperties": false - }, - "CaptchaResponse": { - "type": "object", - "required": [ - "siteKey" - ], - "properties": { - "siteKey": { - "description": "hcaptcha site key", - "type": "string" - } - }, - "additionalProperties": false - }, - "Duo": { - "type": "object", - "required": [ - "host", - "signature" - ], - "properties": { - "host": { - "type": "string" - }, - "signature": { - "type": "string" - } - }, - "additionalProperties": false - }, - "Email": { - "type": "object", - "required": [ - "email" - ], - "properties": { - "email": { - "description": "The email to request a 2fa TOTP for", - "type": "string" - } - }, - "additionalProperties": false - }, - "PasswordLoginResponse": { - "type": "object", - "required": [ - "authenticated", - "forcePasswordReset", - "resetMasterPassword" - ], - "properties": { - "authenticated": { - "type": "boolean" - }, - "captcha": { - "description": "The information required to present the user with a captcha challenge. Only present when authentication fails due to requiring validation of a captcha challenge.", - "anyOf": [ - { - "$ref": "#/definitions/CaptchaResponse" - }, - { - "type": "null" - } - ] - }, - "forcePasswordReset": { - "description": "Whether or not the user is required to update their master password", - "type": "boolean" - }, - "resetMasterPassword": { - "description": "TODO: What does this do?", - "type": "boolean" - }, - "twoFactor": { - "description": "The available two factor authentication options. Present only when authentication fails due to requiring a second authentication factor.", - "anyOf": [ - { - "$ref": "#/definitions/TwoFactorProviders" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - }, - "Remember": { - "type": "object", - "additionalProperties": false - }, - "TwoFactorProviders": { - "type": "object", - "properties": { - "authenticator": { - "anyOf": [ - { - "$ref": "#/definitions/Authenticator" - }, - { - "type": "null" - } - ] - }, - "duo": { - "description": "Duo-backed 2fa", - "anyOf": [ - { - "$ref": "#/definitions/Duo" - }, - { - "type": "null" - } - ] - }, - "email": { - "description": "Email 2fa", - "anyOf": [ - { - "$ref": "#/definitions/Email" - }, - { - "type": "null" - } - ] - }, - "organizationDuo": { - "description": "Duo-backed 2fa operated by an organization the user is a member of", - "anyOf": [ - { - "$ref": "#/definitions/Duo" - }, - { - "type": "null" - } - ] - }, - "remember": { - "description": "Presence indicates the user has stored this device as bypassing 2fa", - "anyOf": [ - { - "$ref": "#/definitions/Remember" - }, - { - "type": "null" - } - ] - }, - "webAuthn": { - "description": "WebAuthn-backed 2fa", - "anyOf": [ - { - "$ref": "#/definitions/WebAuthn" - }, - { - "type": "null" - } - ] - }, - "yubiKey": { - "description": "Yubikey-backed 2fa", - "anyOf": [ - { - "$ref": "#/definitions/YubiKey" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - }, - "WebAuthn": { - "type": "object", - "additionalProperties": false - }, - "YubiKey": { - "type": "object", - "required": [ - "nfc" - ], - "properties": { - "nfc": { - "description": "Whether the stored yubikey supports near field communication", - "type": "boolean" - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/SecretIdentifiersResponse.json b/support/schemas/response/SecretIdentifiersResponse.json deleted file mode 100644 index 7e9224238c..0000000000 --- a/support/schemas/response/SecretIdentifiersResponse.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_SecretIdentifiersResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/SecretIdentifiersResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "SecretIdentifierResponse": { - "type": "object", - "required": [ - "id", - "key", - "organizationId" - ], - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "key": { - "type": "string" - }, - "organizationId": { - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "SecretIdentifiersResponse": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/SecretIdentifierResponse" - } - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/SecretResponse.json b/support/schemas/response/SecretResponse.json deleted file mode 100644 index 01da0296c4..0000000000 --- a/support/schemas/response/SecretResponse.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_SecretResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/SecretResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "SecretResponse": { - "type": "object", - "required": [ - "creationDate", - "id", - "key", - "note", - "object", - "organizationId", - "revisionDate", - "value" - ], - "properties": { - "creationDate": { - "type": "string" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "key": { - "type": "string" - }, - "note": { - "type": "string" - }, - "object": { - "type": "string" - }, - "organizationId": { - "type": "string", - "format": "uuid" - }, - "projectId": { - "type": [ - "string", - "null" - ], - "format": "uuid" - }, - "revisionDate": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "additionalProperties": false - } - } -} diff --git a/support/schemas/response/SecretsDeleteResponse.json b/support/schemas/response/SecretsDeleteResponse.json deleted file mode 100644 index 718696afd4..0000000000 --- a/support/schemas/response/SecretsDeleteResponse.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_SecretsDeleteResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/SecretsDeleteResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "SecretDeleteResponse": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "error": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "SecretsDeleteResponse": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/SecretDeleteResponse" - } - } - }, - "additionalProperties": false - } - } -} From 55468e9ff1458f51bbae635bc4f9737452decc4e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 11:39:47 +0200 Subject: [PATCH 21/32] Update dependency quicktype-core to v23 (#96) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 34 +++++++++++++++++----------------- package.json | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index e7cb1e1a82..1b3055ac2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@openapitools/openapi-generator-cli": "2.6.0", "prettier": "3.0.0", - "quicktype-core": "21.0.16", + "quicktype-core": "23.0.59", "rimraf": "5.0.0", "ts-node": "10.9.1", "typescript": "5.0.4" @@ -42,9 +42,9 @@ } }, "node_modules/@glideapps/ts-necessities": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@glideapps/ts-necessities/-/ts-necessities-2.1.2.tgz", - "integrity": "sha512-tLjfhinr6doUBcWi7BWnkT2zT6G5UhiZftsiIH6xVvykeXE+FU7Wr0MyqwmqideWlDD5rG+VjVLptLviGo04CA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@glideapps/ts-necessities/-/ts-necessities-2.1.3.tgz", + "integrity": "sha512-q9U8v/n9qbkd2zDYjuX3qtlbl+OIyI9zF+zQhZjfYOE9VMDH7tfcUSJ9p0lXoY3lxmGFne09yi4iiNeQUwV7AA==", "dev": true }, "node_modules/@isaacs/cliui": { @@ -1496,12 +1496,12 @@ } }, "node_modules/quicktype-core": { - "version": "21.0.16", - "resolved": "https://registry.npmjs.org/quicktype-core/-/quicktype-core-21.0.16.tgz", - "integrity": "sha512-582Ksfns/RGcR+r3mTcTzlpHINjPpTbBoQziDciN5TtqwvF0UzRZo6ivGoPyRIK3i4rutOPWGT8oqXqxwBgq/Q==", + "version": "23.0.59", + "resolved": "https://registry.npmjs.org/quicktype-core/-/quicktype-core-23.0.59.tgz", + "integrity": "sha512-D8DwNyJkDi3kcQ0kY3QYHx/REobwa1kJ+2udTo7it1ofqtjQVNncRsjKN0urml6hByqdDCOT7IiFgOB7i0M2Nw==", "dev": true, "dependencies": { - "@glideapps/ts-necessities": "2.1.2", + "@glideapps/ts-necessities": "2.1.3", "@types/urijs": "^1.19.19", "browser-or-node": "^2.1.1", "collection-utils": "^1.0.1", @@ -1515,7 +1515,7 @@ "unicode-properties": "^1.4.1", "urijs": "^1.19.1", "wordwrap": "^1.0.0", - "yaml": "^2.2.1" + "yaml": "^2.3.1" } }, "node_modules/quicktype-core/node_modules/buffer": { @@ -2177,9 +2177,9 @@ } }, "@glideapps/ts-necessities": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@glideapps/ts-necessities/-/ts-necessities-2.1.2.tgz", - "integrity": "sha512-tLjfhinr6doUBcWi7BWnkT2zT6G5UhiZftsiIH6xVvykeXE+FU7Wr0MyqwmqideWlDD5rG+VjVLptLviGo04CA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@glideapps/ts-necessities/-/ts-necessities-2.1.3.tgz", + "integrity": "sha512-q9U8v/n9qbkd2zDYjuX3qtlbl+OIyI9zF+zQhZjfYOE9VMDH7tfcUSJ9p0lXoY3lxmGFne09yi4iiNeQUwV7AA==", "dev": true }, "@isaacs/cliui": { @@ -3203,12 +3203,12 @@ "dev": true }, "quicktype-core": { - "version": "21.0.16", - "resolved": "https://registry.npmjs.org/quicktype-core/-/quicktype-core-21.0.16.tgz", - "integrity": "sha512-582Ksfns/RGcR+r3mTcTzlpHINjPpTbBoQziDciN5TtqwvF0UzRZo6ivGoPyRIK3i4rutOPWGT8oqXqxwBgq/Q==", + "version": "23.0.59", + "resolved": "https://registry.npmjs.org/quicktype-core/-/quicktype-core-23.0.59.tgz", + "integrity": "sha512-D8DwNyJkDi3kcQ0kY3QYHx/REobwa1kJ+2udTo7it1ofqtjQVNncRsjKN0urml6hByqdDCOT7IiFgOB7i0M2Nw==", "dev": true, "requires": { - "@glideapps/ts-necessities": "2.1.2", + "@glideapps/ts-necessities": "2.1.3", "@types/urijs": "^1.19.19", "browser-or-node": "^2.1.1", "collection-utils": "^1.0.1", @@ -3222,7 +3222,7 @@ "unicode-properties": "^1.4.1", "urijs": "^1.19.1", "wordwrap": "^1.0.0", - "yaml": "^2.2.1" + "yaml": "^2.3.1" }, "dependencies": { "buffer": { diff --git a/package.json b/package.json index d8d2f3fe90..4f6283e5a9 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "devDependencies": { "@openapitools/openapi-generator-cli": "2.6.0", "prettier": "3.0.0", - "quicktype-core": "21.0.16", + "quicktype-core": "23.0.59", "rimraf": "5.0.0", "ts-node": "10.9.1", "typescript": "5.0.4" From 962770e5fb6363924bcbee2bc87020b5b5458097 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 09:42:01 +0000 Subject: [PATCH 22/32] Update gh minor (#107) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/direct-minimal-versions.yml | 4 ++-- .github/workflows/generate_schemas.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/direct-minimal-versions.yml b/.github/workflows/direct-minimal-versions.yml index 925ff0898f..ce0f67b6a1 100644 --- a/.github/workflows/direct-minimal-versions.yml +++ b/.github/workflows/direct-minimal-versions.yml @@ -36,7 +36,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -46,7 +46,7 @@ jobs: override: true - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 with: key: dmv-${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} diff --git a/.github/workflows/generate_schemas.yml b/.github/workflows/generate_schemas.yml index e095709c2d..b50d6e4843 100644 --- a/.github/workflows/generate_schemas.yml +++ b/.github/workflows/generate_schemas.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Install rust uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 @@ -23,7 +23,7 @@ jobs: override: true - name: Set up Node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 with: cache: "npm" cache-dependency-path: "package-lock.json" @@ -33,7 +33,7 @@ jobs: run: npm ci - name: Cache cargo registry - uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 # v2.4.0 + uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - name: NPM Schemas run: npm run schemas From 5077a9592c770c200eafc91c09b0d80a94d9d026 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 09:54:14 +0000 Subject: [PATCH 23/32] Lock file maintenance (#108) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Oscar Hinton --- Cargo.lock | 152 +++++++++++---------- crates/bitwarden-napi/package-lock.json | 12 +- languages/js_webassembly/package-lock.json | 36 ++--- package-lock.json | 12 +- 4 files changed, 108 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c841a212f2..626b69299d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,15 +28,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "aho-corasick" version = "1.0.2" @@ -63,9 +54,9 @@ dependencies = [ [[package]] name = "ansi_colours" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db9d9767fde724f83933a716ee182539788f293828244e9d999695ce0f7ba1e" +checksum = "6a1558bd2075d341b9ca698ec8eb6fcc55a746b1fc4255585aad5b141d918a80" dependencies = [ "rgb", ] @@ -121,9 +112,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arc-swap" @@ -133,12 +124,14 @@ checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "argon2" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95c2fcf79ad1932ac6269a738109997a83c227c09b75842ae564dc8ede6a861c" +checksum = "b2e554a8638bdc1e4eae9984845306cc95f8a9208ba8d49c3859fd958b46774d" dependencies = [ "base64ct", "blake2", + "cpufeatures", + "password-hash", ] [[package]] @@ -176,7 +169,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -448,7 +441,7 @@ dependencies = [ "log", "serde", "serde_json", - "serde_yaml 0.9.22", + "serde_yaml 0.9.23", "supports-color", "tempfile", "thiserror", @@ -526,9 +519,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.11" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" +checksum = "3eab9e8ceb9afdade1ab3f0fd8dbce5b1b2f468ad653baf10e771781b2b67b73" dependencies = [ "clap_builder", "clap_derive", @@ -537,9 +530,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.11" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" +checksum = "9f2763db829349bf00cfc06251268865ed4363b93a943174f638daf3ecdba2cd" dependencies = [ "anstream", "anstyle", @@ -549,14 +542,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -769,12 +762,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed5fff0d93c7559121e9c72bf9c242295869396255071ff2cb1617147b608c5" +checksum = "1f34ba9a9bcb8645379e9de8cb3ecfcf4d1c85ba66d90deb3259206fa5aa193b" dependencies = [ "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -851,9 +844,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "either" @@ -1116,7 +1109,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -1197,11 +1190,11 @@ checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "bstr", "fnv", "log", @@ -1503,9 +1496,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" @@ -1856,7 +1849,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -1918,6 +1911,17 @@ dependencies = [ "windows-targets 0.48.1", ] +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "path_abs" version = "0.5.1" @@ -2012,9 +2016,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -2126,9 +2130,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] @@ -2239,7 +2243,7 @@ version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-automata", "regex-syntax 0.7.4", @@ -2247,11 +2251,11 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-syntax 0.7.4", ] @@ -2378,15 +2382,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safemem" @@ -2487,9 +2491,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" @@ -2508,7 +2512,7 @@ checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2524,9 +2528,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.100" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -2563,7 +2567,7 @@ checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2601,9 +2605,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.22" +version = "0.9.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452e67b9c20c37fa79df53201dc03839651086ed9bbe92b3ca585ca9fdaa7d85" +checksum = "da6075b41c7e3b079e5f246eb6094a44850d3a4c25a67c581c80796c80134012" dependencies = [ "indexmap 2.0.0", "itoa", @@ -2645,9 +2649,9 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" +checksum = "b824b6e687aff278cdbf3b36f07aa52d4bd4099699324d5da86a2ebce3aa00b3" dependencies = [ "libc", "signal-hook-registry", @@ -2784,9 +2788,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" dependencies = [ "proc-macro2", "quote", @@ -2860,7 +2864,7 @@ checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2943,7 +2947,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2993,9 +2997,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.12" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "serde", @@ -3081,9 +3085,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -3114,9 +3118,9 @@ checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c" [[package]] name = "unsafe-libyaml" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "url" @@ -3138,9 +3142,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "serde", ] @@ -3223,7 +3227,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-shared", ] @@ -3257,7 +3261,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3476,9 +3480,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.9" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" dependencies = [ "memchr", ] diff --git a/crates/bitwarden-napi/package-lock.json b/crates/bitwarden-napi/package-lock.json index 91ad63393c..be96725b3a 100644 --- a/crates/bitwarden-napi/package-lock.json +++ b/crates/bitwarden-napi/package-lock.json @@ -95,9 +95,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", - "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true, "peer": true }, @@ -284,9 +284,9 @@ "dev": true }, "@types/node": { - "version": "20.4.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", - "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true, "peer": true }, diff --git a/languages/js_webassembly/package-lock.json b/languages/js_webassembly/package-lock.json index d9985f1bfd..19de373d19 100644 --- a/languages/js_webassembly/package-lock.json +++ b/languages/js_webassembly/package-lock.json @@ -215,9 +215,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", - "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true }, "node_modules/@types/qs": { @@ -829,9 +829,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001515", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", - "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", + "version": "1.0.30001516", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001516.tgz", + "integrity": "sha512-Wmec9pCBY8CWbmI4HsjBeQLqDTqV91nFVR83DnZpYyRnPI1wePDsTg0bGLPC5VU/3OIZV1fmxEea1b+tFKe86g==", "dev": true, "funding": [ { @@ -1257,9 +1257,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.455", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.455.tgz", - "integrity": "sha512-8tgdX0Odl24LtmLwxotpJCVjIndN559AvaOtd67u+2mo+IDsgsTF580NB+uuDCqsHw8yFg53l5+imFV9Fw3cbA==", + "version": "1.4.461", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.461.tgz", + "integrity": "sha512-1JkvV2sgEGTDXjdsaQCeSwYYuhLRphRpc+g6EHTFELJXEiznLt3/0pZ9JuAOQ5p2rI3YxKTbivtvajirIfhrEQ==", "dev": true }, "node_modules/encodeurl": { @@ -4294,9 +4294,9 @@ "dev": true }, "@types/node": { - "version": "20.4.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", - "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true }, "@types/qs": { @@ -4800,9 +4800,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001515", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", - "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", + "version": "1.0.30001516", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001516.tgz", + "integrity": "sha512-Wmec9pCBY8CWbmI4HsjBeQLqDTqV91nFVR83DnZpYyRnPI1wePDsTg0bGLPC5VU/3OIZV1fmxEea1b+tFKe86g==", "dev": true }, "chalk": { @@ -5117,9 +5117,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.455", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.455.tgz", - "integrity": "sha512-8tgdX0Odl24LtmLwxotpJCVjIndN559AvaOtd67u+2mo+IDsgsTF580NB+uuDCqsHw8yFg53l5+imFV9Fw3cbA==", + "version": "1.4.461", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.461.tgz", + "integrity": "sha512-1JkvV2sgEGTDXjdsaQCeSwYYuhLRphRpc+g6EHTFELJXEiznLt3/0pZ9JuAOQ5p2rI3YxKTbivtvajirIfhrEQ==", "dev": true }, "encodeurl": { diff --git a/package-lock.json b/package-lock.json index 1b3055ac2c..91f07c6cfd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -404,9 +404,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", - "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true, "peer": true }, @@ -2416,9 +2416,9 @@ "dev": true }, "@types/node": { - "version": "20.4.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", - "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", "dev": true, "peer": true }, From ae865db8ee4c4e10a399662b3b50bc4015b14057 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 17 Jul 2023 11:55:58 +0200 Subject: [PATCH 24/32] Change versions to ranges for libraries (#100) --- .github/renovate.json | 4 --- crates/bitwarden-c/Cargo.toml | 4 +-- crates/bitwarden-json/Cargo.toml | 6 ++-- crates/bitwarden/Cargo.toml | 52 +++++++++++++++++--------------- 4 files changed, 32 insertions(+), 34 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index d6e1832936..71e131e438 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -18,10 +18,6 @@ "matchManagers": ["npm"], "matchUpdateTypes": ["minor", "patch"] }, - { - "matchManagers": ["cargo"], - "rangeStrategy": "widen" - }, { "matchManagers": ["cargo"], "matchUpdateTypes": ["patch"], diff --git a/crates/bitwarden-c/Cargo.toml b/crates/bitwarden-c/Cargo.toml index 0e23cdc407..dc6dc5b5a3 100644 --- a/crates/bitwarden-c/Cargo.toml +++ b/crates/bitwarden-c/Cargo.toml @@ -10,9 +10,9 @@ crate-type = ["lib", "staticlib", "cdylib"] bench = false [target.'cfg(not(target_arch="wasm32"))'.dependencies] -tokio = { version = "1.28.2", features = ["rt-multi-thread", "macros"] } +tokio = { version = ">=1.28.2, <2.0", features = ["rt-multi-thread", "macros"] } bitwarden-json = { path = "../bitwarden-json" } [dependencies] -env_logger = "0.10.0" +env_logger = ">=0.10.0, <0.11" diff --git a/crates/bitwarden-json/Cargo.toml b/crates/bitwarden-json/Cargo.toml index a151dea020..da140f46af 100644 --- a/crates/bitwarden-json/Cargo.toml +++ b/crates/bitwarden-json/Cargo.toml @@ -17,8 +17,8 @@ rust-version = "1.57" internal = ["bitwarden/internal"] # Internal testing methods [dependencies] -schemars = "0.8.12" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.96" +schemars = ">=0.8.12, <0.9" +serde = { version = ">=1.0, <2.0", features = ["derive"] } +serde_json = ">=1.0.96, <2.0" bitwarden = { path = "../bitwarden" } diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index 2bc78b7866..d0685c0a39 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -16,33 +16,35 @@ rust-version = "1.57" internal = [] # Internal testing methods [dependencies] -base64 = "0.21.2" -lazy_static = "1.4.0" -reqwest = { version = "0.11", features = ["json"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.96" -serde_qs = "0.12.0" -serde_repr = "0.1.12" -schemars = { version = "0.8", features = ["uuid1"] } -log = "0.4.18" -assert_matches = "1.5.0" -thiserror = "1.0.40" -aes = "0.8.2" -cbc = { version = "0.1.2", features = ["alloc"] } -hkdf = "0.12.3" -hmac = "0.12.1" -rsa = "0.9.2" -sha1 = "0.10.5" -sha2 = "0.10.6" -pbkdf2 = { version = "0.12.1", default-features = false } -argon2 = { version = "0.5.0", features = ["alloc"], default-features = false } -rand = "0.8.5" -num-bigint = "0.4" -num-traits = "0.2.15" -uuid = { version = "^1.3.3", features = ["serde"] } +base64 = ">=0.21.2, <0.22" +lazy_static = ">=1.4.0, <2.0" +reqwest = { version = ">=0.11, <0.12", features = ["json"] } +serde = { version = ">=1.0, <2.0", features = ["derive"] } +serde_json = ">=1.0.96, <2.0" +serde_qs = ">=0.12.0, <0.13" +serde_repr = ">=0.1.12, <0.2" +schemars = { version = ">=0.8, <0.9", features = ["uuid1"] } +log = ">=0.4.18, <0.5" +assert_matches = ">=1.5.0, <2.0" +thiserror = ">=1.0.40, <2.0" +aes = ">=0.8.2, <0.9" +cbc = { version = ">=0.1.2, <0.2", features = ["alloc"] } +hkdf = ">=0.12.3, <0.13" +hmac = ">=0.12.1, <0.13" +rsa = ">=0.9.2, <0.10" +sha1 = ">=0.10.5, <0.11" +sha2 = ">=0.10.6, <0.11" +pbkdf2 = { version = ">=0.12.1, <0.13", default-features = false } +argon2 = { version = ">=0.5.0, <0.6", features = [ + "alloc", +], default-features = false } +rand = ">=0.8.5, <0.9" +num-bigint = ">=0.4, <0.5" +num-traits = ">=0.2.15, <0.3" +uuid = { version = ">=1.3.3, <2.0", features = ["serde"] } # 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", features = ["js"] } +getrandom = { version = ">=0.2.9", features = ["js"] } bitwarden-api-identity = { path = "../bitwarden-api-identity", version = "0.2.0" } bitwarden-api-api = { path = "../bitwarden-api-api", version = "0.2.0" } From 8f00aaee0779de1d50a4f9fe24a2da4bbd5ebdb2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 10:03:30 +0000 Subject: [PATCH 25/32] Update Rust crate itertools to 0.11.0 (#93) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- crates/sdk-schemas/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 626b69299d..f01a1baa93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1487,9 +1487,9 @@ checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index c2af9f3214..2e7ef9ce64 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -10,7 +10,7 @@ rust-version = "1.57" schemars = { version = "0.8.12", features = ["preserve_order"] } serde_json = "1.0.96" anyhow = "1.0.71" -itertools = "0.10.5" +itertools = "0.11.0" bitwarden = { path = "../bitwarden" } bitwarden-json = { path = "../bitwarden-json" } From 1bdfcdce61773018c41e5206e87ab4ce898b856f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 12:21:13 +0200 Subject: [PATCH 26/32] Update Rust crate comfy-table to v7 (#94) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- crates/bws/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f01a1baa93..6737ac241e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -605,9 +605,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "comfy-table" -version = "6.2.0" +version = "7.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e959d788268e3bf9d35ace83e81b124190378e4c91c9067524675e33394b8ba" +checksum = "9ab77dbd8adecaf3f0db40581631b995f312a8a5ae3aa9993188bb8f23d83a5b" dependencies = [ "crossterm", "strum", diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml index 9a7c623b6c..7dcf39097e 100644 --- a/crates/bws/Cargo.toml +++ b/crates/bws/Cargo.toml @@ -29,7 +29,7 @@ bat = { version = "0.23.0", features = ["regex-onig"], default-features = false directories = "5.0.1" color-eyre = "0.6" toml = "0.7.4" -comfy-table = "^6.2.0" +comfy-table = "^7.0.1" chrono = { version = "0.4.26", features = ["clock", "std"], default-features = false } uuid = { version = "^1.3.3", features = ["serde"] } From 8392d38d28e479ca581336f8d249e97ca5872662 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 12:32:34 +0200 Subject: [PATCH 27/32] Update bitwarden/gh-actions digest to 12452ff (#105) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/publish-rust-crates.yml | 2 +- .github/workflows/release-cli.yml | 8 ++++---- .github/workflows/release-napi.yml | 16 ++++++++-------- .github/workflows/version-bump.yml | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index bf43b91ede..26ecb218e5 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -109,7 +109,7 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/get-keyvault-secrets@12452ffcde72eca60a91abef555090ad17ba2108 with: keyvault: "bitwarden-prod-kv" secrets: "cratesio-api-token" diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index e2733e0a2c..bb2dd192e2 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -58,7 +58,7 @@ jobs: - name: Download all Release artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-cli.yml path: packages @@ -67,7 +67,7 @@ jobs: - name: Dry Run - Download all artifacts if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-cli.yml path: packages @@ -75,7 +75,7 @@ jobs: branch: master - name: Get checksum files - uses: bitwarden/gh-actions/get-checksum@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/get-checksum@12452ffcde72eca60a91abef555090ad17ba2108 with: packages_dir: "packages" file_path: "packages/bws-sha256-checksums-${{ steps.version.outputs.version }}.txt" @@ -132,7 +132,7 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/get-keyvault-secrets@12452ffcde72eca60a91abef555090ad17ba2108 with: keyvault: "bitwarden-prod-kv" secrets: "cratesio-api-token" diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index 68b7e3eab0..e684ebcf07 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -47,7 +47,7 @@ jobs: - name: Check Release Version id: version - uses: bitwarden/gh-actions/release-version-check@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/release-version-check@12452ffcde72eca60a91abef555090ad17ba2108 with: release-type: ${{ github.event.inputs.release_type }} project-type: ts @@ -67,7 +67,7 @@ jobs: - name: Download all Release artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-napi.yml path: artifacts @@ -76,7 +76,7 @@ jobs: - name: Dry Run - Download all artifacts if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-napi.yml path: artifacts @@ -133,7 +133,7 @@ jobs: - name: Download schemas if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-napi.yml artifacts: schemas.ts @@ -143,7 +143,7 @@ jobs: - name: Dry Run - Download schemas if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@72594be690a4e7bfa87b1402b2aedc75acdbff12 + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-napi.yml artifacts: schemas.ts @@ -164,14 +164,14 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/get-keyvault-secrets@12452ffcde72eca60a91abef555090ad17ba2108 with: keyvault: "bitwarden-ci" secrets: "npm-api-key" - name: Download artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-napi.yml path: ${{ github.workspace }}/crates/bitwarden-napi/artifacts @@ -180,7 +180,7 @@ jobs: - name: Dry Run - Download artifacts if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/download-artifacts@12452ffcde72eca60a91abef555090ad17ba2108 with: workflow: build-napi.yml path: ${{ github.workspace }}/crates/bitwarden-napi/artifacts diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 0ed09ec5a4..f811309690 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -52,7 +52,7 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@a30e9c3d658dc97c4c2e61ec749fdab64b83386c + uses: bitwarden/gh-actions/get-keyvault-secrets@12452ffcde72eca60a91abef555090ad17ba2108 with: keyvault: "bitwarden-prod-kv" secrets: "github-gpg-private-key, github-gpg-private-key-passphrase" From e5f50facb7c933f839890f6721d4d3695e0932b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Mon, 17 Jul 2023 16:06:48 +0200 Subject: [PATCH 28/32] Improve errors in bitwarden_json (#104) * Improve errors in bitwarden_json * Use log crate instead of eprintln for wasm compat --- crates/bitwarden-json/Cargo.toml | 1 + crates/bitwarden-json/src/client.rs | 17 ++++++++++++----- crates/bitwarden-json/src/response.rs | 19 +++++++++++++------ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/crates/bitwarden-json/Cargo.toml b/crates/bitwarden-json/Cargo.toml index da140f46af..eaaa881c3c 100644 --- a/crates/bitwarden-json/Cargo.toml +++ b/crates/bitwarden-json/Cargo.toml @@ -20,5 +20,6 @@ internal = ["bitwarden/internal"] # Internal testing methods schemars = ">=0.8.12, <0.9" serde = { version = ">=1.0, <2.0", features = ["derive"] } serde_json = ">=1.0.96, <2.0" +log = ">=0.4.18, <0.5" bitwarden = { path = "../bitwarden" } diff --git a/crates/bitwarden-json/src/client.rs b/crates/bitwarden-json/src/client.rs index e6523edae9..8931269afa 100644 --- a/crates/bitwarden-json/src/client.rs +++ b/crates/bitwarden-json/src/client.rs @@ -2,7 +2,7 @@ use bitwarden::client::client_settings::ClientSettings; use crate::{ command::{Command, ProjectsCommand, SecretsCommand}, - response::ResponseIntoString, + response::{Response, ResponseIntoString}, }; pub struct Client(bitwarden::Client); @@ -17,7 +17,9 @@ impl Client { const SUBCOMMANDS_TO_CLEAN: &[&str] = &["Secrets"]; let mut cmd_value: serde_json::Value = match serde_json::from_str(input_str) { Ok(cmd) => cmd, - Err(e) => return format!("{:#?}", e), + Err(e) => { + return Response::error(format!("Invalid command string: {}", e)).into_string() + } }; if let Some(cmd_value_map) = cmd_value.as_object_mut() { @@ -35,7 +37,9 @@ impl Client { let cmd: Command = match serde_json::from_value(cmd_value) { Ok(cmd) => cmd, - Err(e) => return format!("{:#?}", e), + Err(e) => { + return Response::error(format!("Invalid command value: {}", e)).into_string() + } }; match cmd { @@ -71,8 +75,11 @@ impl Client { fn parse_settings(settings_input: Option) -> Option { if let Some(input) = settings_input.as_ref() { - if let Ok(settings) = serde_json::from_str(input) { - return Some(settings); + match serde_json::from_str(input) { + Ok(settings) => return Some(settings), + Err(e) => { + log::error!("Failed to parse settings: {}", e); + } } } None diff --git a/crates/bitwarden-json/src/response.rs b/crates/bitwarden-json/src/response.rs index 031a994544..25c31ef758 100644 --- a/crates/bitwarden-json/src/response.rs +++ b/crates/bitwarden-json/src/response.rs @@ -29,7 +29,9 @@ impl Response { }, } } +} +impl Response<()> { pub fn error(message: String) -> Self { Self { success: false, @@ -45,13 +47,18 @@ pub(crate) trait ResponseIntoString { impl ResponseIntoString for Result { fn into_string(self) -> String { - match serde_json::to_string(&Response::new(self)) { + Response::new(self).into_string() + } +} + +impl ResponseIntoString for Response { + fn into_string(self) -> String { + match serde_json::to_string(&self) { Ok(ser) => ser, - Err(e) => serde_json::to_string(&Response::::error(format!( - "Failed to serialize Response: {}", - e - ))) - .unwrap(), + Err(e) => { + let error = Response::error(format!("Failed to serialize Response: {}", e)); + serde_json::to_string(&error).unwrap() + } } } } From 23c20df1970882e943f73c517c09fba726374951 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 17 Jul 2023 16:43:04 +0200 Subject: [PATCH 29/32] [PM-2076] Properly handle error responses in send_identity_connect_request (#109) --- crates/bitwarden/src/auth/api/request/mod.rs | 9 +++++---- .../api/response/identity_token_response.rs | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/crates/bitwarden/src/auth/api/request/mod.rs b/crates/bitwarden/src/auth/api/request/mod.rs index 1bec3f90a5..6839c30dc6 100644 --- a/crates/bitwarden/src/auth/api/request/mod.rs +++ b/crates/bitwarden/src/auth/api/request/mod.rs @@ -43,12 +43,13 @@ async fn send_identity_connect_request( request = request.header("Auth-Email", BASE64_ENGINE.encode(email.as_bytes())); } - let raw_response = request + let response = request .body(serde_qs::to_string(&body).unwrap()) .send() - .await? - .text() .await?; - parse_identity_response(&raw_response) + let status = response.status(); + let text = response.text().await?; + + parse_identity_response(status, &text) } diff --git a/crates/bitwarden/src/auth/api/response/identity_token_response.rs b/crates/bitwarden/src/auth/api/response/identity_token_response.rs index 3ae74dea7a..008b49905b 100644 --- a/crates/bitwarden/src/auth/api/response/identity_token_response.rs +++ b/crates/bitwarden/src/auth/api/response/identity_token_response.rs @@ -1,3 +1,4 @@ +use reqwest::StatusCode; use serde::{Deserialize, Serialize}; use crate::{ @@ -17,7 +18,10 @@ pub enum IdentityTokenResponse { CaptchaRequired(IdentityCaptchaResponse), } -pub fn parse_identity_response(response: &str) -> Result { +pub fn parse_identity_response( + status: StatusCode, + response: &str, +) -> Result { if let Ok(r) = serde_json::from_str::(response) { Ok(IdentityTokenResponse::Authenticated(r)) } else if let Ok(r) = serde_json::from_str::(response) { @@ -31,7 +35,10 @@ pub fn parse_identity_response(response: &str) -> Result } else if let Ok(r) = serde_json::from_str::(response) { Err(Error::IdentityFail(r)) } else { - Err(Error::Internal("Failed to parse IdentityTokenResponse")) + Err(Error::ResponseContent { + status: status, + message: response.to_owned(), + }) } } @@ -44,7 +51,7 @@ mod test { let expected = IdentityTokenSuccessResponse::default(); let success = serde_json::to_string(&expected).unwrap(); let expected = IdentityTokenResponse::Authenticated(expected); - let actual = parse_identity_response(&success).unwrap(); + let actual = parse_identity_response(StatusCode::OK, &success).unwrap(); assert_eq!(expected, actual); } @@ -53,7 +60,7 @@ mod test { let expected = IdentityTwoFactorResponse::default(); let two_factor = serde_json::to_string(&expected).unwrap(); let expected = IdentityTokenResponse::TwoFactorRequired(expected); - let actual = parse_identity_response(&two_factor).unwrap(); + let actual = parse_identity_response(StatusCode::BAD_REQUEST, &two_factor).unwrap(); assert_eq!(expected, actual); } @@ -62,7 +69,7 @@ mod test { let expected = IdentityCaptchaResponse::default(); let captcha = serde_json::to_string(&expected).unwrap(); let expected = IdentityTokenResponse::CaptchaRequired(expected); - let actual = parse_identity_response(&captcha).unwrap(); + let actual = parse_identity_response(StatusCode::BAD_REQUEST, &captcha).unwrap(); assert_eq!(expected, actual); } } From 3e32a4d52e1f63a26dcc35a7e819171b5467093c Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 17 Jul 2023 17:01:21 +0200 Subject: [PATCH 30/32] Fix warnings (#110) --- .github/workflows/build-rust-crates.yml | 4 ++ .github/workflows/rust-test.yml | 6 +-- Cargo.lock | 1 + crates/bitwarden/src/auth/api/request/mod.rs | 9 +++- crates/bitwarden/src/auth/commands/login.rs | 37 +++++++++----- crates/bitwarden/src/client/client.rs | 41 +++++++++------- .../src/client/encryption_settings.rs | 10 +++- crates/bitwarden/src/client/mod.rs | 1 + crates/bitwarden/src/crypto.rs | 48 +++++++++++-------- crates/bitwarden/src/util.rs | 3 ++ crates/bitwarden/src/wordlist.rs | 1 + 11 files changed, 106 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index 52a1e670b2..5eb0510e92 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -52,6 +52,8 @@ jobs: with: command: build args: ${{ matrix.features }} -p ${{ matrix.package }} --release + env: + RUSTFLAGS: "-D warnings" - name: Build Internal if: ${{ matrix.package == 'bitwarden' }} @@ -59,6 +61,8 @@ jobs: with: command: build args: ${{ matrix.features }} -p ${{ matrix.package }} --features internal --release + env: + RUSTFLAGS: "-D warnings" release-dry-run: name: Release dry-run diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index d6927c847b..a13d1ae706 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -46,15 +46,11 @@ jobs: - name: Cache cargo registry uses: Swatinem/rust-cache@dd05243424bd5c0e585e4b55eb2d7615cdd32f1f # v2.5.1 - - name: Build - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 - with: - command: build - - name: Test uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 with: command: test + args: --all-features wasm: name: WASM diff --git a/Cargo.lock b/Cargo.lock index 6737ac241e..e50043fa2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -335,6 +335,7 @@ name = "bitwarden-json" version = "0.2.1" dependencies = [ "bitwarden", + "log", "schemars", "serde", "serde_json", diff --git a/crates/bitwarden/src/auth/api/request/mod.rs b/crates/bitwarden/src/auth/api/request/mod.rs index 6839c30dc6..8ba3d239fa 100644 --- a/crates/bitwarden/src/auth/api/request/mod.rs +++ b/crates/bitwarden/src/auth/api/request/mod.rs @@ -1,14 +1,21 @@ mod access_token_request; +#[cfg(feature = "internal")] mod api_token_request; +#[cfg(feature = "internal")] mod password_token_request; +#[cfg(feature = "internal")] mod renew_token_request; pub(crate) use access_token_request::*; +#[cfg(feature = "internal")] pub(crate) use api_token_request::*; -use base64::Engine; +#[cfg(feature = "internal")] pub(crate) use password_token_request::*; +#[cfg(feature = "internal")] pub(crate) use renew_token_request::*; +use base64::Engine; + use crate::{ auth::api::response::{parse_identity_response, IdentityTokenResponse}, client::ApiConfigurations, diff --git a/crates/bitwarden/src/auth/commands/login.rs b/crates/bitwarden/src/auth/commands/login.rs index 7582b5743c..6633ecf5f1 100644 --- a/crates/bitwarden/src/auth/commands/login.rs +++ b/crates/bitwarden/src/auth/commands/login.rs @@ -4,24 +4,15 @@ use std::{ }; use base64::Engine; -use bitwarden_api_identity::{ - apis::accounts_api::accounts_prelogin_post, - models::{PreloginRequestModel, PreloginResponseModel}, -}; -use log::{debug, info}; use crate::{ auth::{ - api::{ - request::{AccessTokenRequest, ApiTokenRequest, PasswordTokenRequest}, - response::IdentityTokenResponse, - }, - request::{AccessTokenLoginRequest, ApiKeyLoginRequest, PasswordLoginRequest}, - response::{ApiKeyLoginResponse, PasswordLoginResponse}, + api::{request::AccessTokenRequest, response::IdentityTokenResponse}, + request::AccessTokenLoginRequest, + response::ApiKeyLoginResponse, }, client::{ access_token::AccessToken, - auth_settings::AuthSettings, encryption_settings::{decrypt, SymmetricCryptoKey}, Client, LoginMethod, }, @@ -30,6 +21,23 @@ use crate::{ util::{decode_token, BASE64_ENGINE}, }; +#[cfg(feature = "internal")] +use { + crate::{ + auth::{ + api::request::{ApiTokenRequest, PasswordTokenRequest}, + request::{ApiKeyLoginRequest, PasswordLoginRequest}, + response::PasswordLoginResponse, + }, + client::auth_settings::AuthSettings, + }, + bitwarden_api_identity::{ + apis::accounts_api::accounts_prelogin_post, + models::{PreloginRequestModel, PreloginResponseModel}, + }, + log::{debug, info}, +}; + #[cfg(feature = "internal")] pub(crate) async fn password_login( client: &mut Client, @@ -155,6 +163,7 @@ pub(crate) async fn access_token_login( ApiKeyLoginResponse::process_response(response) } +#[cfg(feature = "internal")] async fn determine_password_hash( client: &mut Client, email: &str, @@ -168,12 +177,14 @@ async fn determine_password_hash( Ok(password_hash) } +#[cfg(feature = "internal")] async fn request_prelogin(client: &mut Client, email: String) -> Result { let request_model = PreloginRequestModel::new(email); let config = client.get_api_configurations().await; Ok(accounts_prelogin_post(&config.identity, Some(request_model)).await?) } +#[cfg(feature = "internal")] async fn request_identity_tokens( client: &mut Client, input: &PasswordLoginRequest, @@ -215,6 +226,7 @@ pub(crate) async fn renew_token(client: &mut Client) -> Result<()> { } let res = match login_method { + #[cfg(feature = "internal")] LoginMethod::Username { client_id } => { let refresh = client .refresh_token @@ -228,6 +240,7 @@ pub(crate) async fn renew_token(client: &mut Client) -> Result<()> { .send(&client.__api_configurations) .await? } + #[cfg(feature = "internal")] LoginMethod::ApiKey { client_id, client_secret, diff --git a/crates/bitwarden/src/client/client.rs b/crates/bitwarden/src/client/client.rs index dabf0e01af..e38fc3cbe2 100644 --- a/crates/bitwarden/src/client/client.rs +++ b/crates/bitwarden/src/client/client.rs @@ -1,6 +1,5 @@ use std::time::{Duration, Instant}; -use log::debug; use reqwest::header::{self}; use uuid::Uuid; @@ -11,24 +10,28 @@ use crate::{ response::ApiKeyLoginResponse, }, client::{ - auth_settings::AuthSettings, client_settings::{ClientSettings, DeviceType}, encryption_settings::{EncryptionSettings, SymmetricCryptoKey}, }, - crypto::CipherString, - error::{Error, Result}, + error::Result, }; #[cfg(feature = "internal")] -use crate::{ - auth::{ - commands::{api_key_login, password_login}, - request::{ApiKeyLoginRequest, PasswordLoginRequest}, - response::PasswordLoginResponse, - }, - platform::{ - generate_fingerprint, get_user_api_key, sync, FingerprintRequest, - SecretVerificationRequest, SyncRequest, SyncResponse, UserApiKeyResponse, +use { + crate::{ + auth::{ + commands::{api_key_login, password_login}, + request::{ApiKeyLoginRequest, PasswordLoginRequest}, + response::PasswordLoginResponse, + }, + client::auth_settings::AuthSettings, + crypto::CipherString, + error::Error, + platform::{ + generate_fingerprint, get_user_api_key, sync, FingerprintRequest, + SecretVerificationRequest, SyncRequest, SyncResponse, UserApiKeyResponse, + }, }, + log::debug, }; #[derive(Debug)] @@ -40,9 +43,9 @@ pub(crate) struct ApiConfigurations { #[derive(Debug, Clone)] pub(crate) enum LoginMethod { - Username { - client_id: String, - }, + #[cfg(feature = "internal")] + Username { client_id: String }, + #[cfg(feature = "internal")] ApiKey { client_id: String, client_secret: String, @@ -66,6 +69,7 @@ pub struct Client { #[doc(hidden)] pub(crate) __api_configurations: ApiConfigurations, + #[cfg(feature = "internal")] auth_settings: Option, encryption_settings: Option, @@ -112,6 +116,7 @@ impl Client { api, device_type: settings.device_type, }, + #[cfg(feature = "internal")] auth_settings: None, encryption_settings: None, } @@ -160,6 +165,7 @@ impl Client { get_user_api_key(self, input).await } + #[cfg(feature = "internal")] pub(crate) fn get_auth_settings(&self) -> &Option { &self.auth_settings } @@ -177,6 +183,7 @@ impl Client { &self.encryption_settings } + #[cfg(feature = "internal")] pub(crate) fn set_auth_settings(&mut self, auth_settings: AuthSettings) { debug! {"setting auth settings: {:#?}", auth_settings} self.auth_settings = Some(auth_settings); @@ -201,10 +208,12 @@ impl Client { renew_token(self).await } + #[cfg(feature = "internal")] pub fn is_authed(&self) -> bool { self.token.is_some() || self.auth_settings.is_some() } + #[cfg(feature = "internal")] pub(crate) fn initialize_user_crypto( &mut self, password: &str, diff --git a/crates/bitwarden/src/client/encryption_settings.rs b/crates/bitwarden/src/client/encryption_settings.rs index 0e1ffcdad2..6720369acf 100644 --- a/crates/bitwarden/src/client/encryption_settings.rs +++ b/crates/bitwarden/src/client/encryption_settings.rs @@ -7,16 +7,21 @@ use aes::cipher::{ use base64::Engine; use hmac::Mac; use rand::RngCore; -use rsa::{pkcs8::DecodePrivateKey, Oaep, RsaPrivateKey}; +use rsa::RsaPrivateKey; use uuid::Uuid; use crate::{ - client::auth_settings::AuthSettings, crypto::{CipherString, PbkdfSha256Hmac, PBKDF_SHA256_HMAC_OUT_SIZE}, error::{CryptoError, Error, Result}, util::BASE64_ENGINE, }; +#[cfg(feature = "internal")] +use { + crate::client::auth_settings::AuthSettings, + rsa::{pkcs8::DecodePrivateKey, Oaep}, +}; + pub struct SymmetricCryptoKey { pub key: GenericArray, pub mac_key: Option>, @@ -94,6 +99,7 @@ impl std::fmt::Debug for EncryptionSettings { } impl EncryptionSettings { + #[cfg(feature = "internal")] pub(crate) fn new( auth: &AuthSettings, password: &str, diff --git a/crates/bitwarden/src/client/mod.rs b/crates/bitwarden/src/client/mod.rs index bd0c88a9fd..6dcfff940f 100644 --- a/crates/bitwarden/src/client/mod.rs +++ b/crates/bitwarden/src/client/mod.rs @@ -2,6 +2,7 @@ pub(crate) use client::*; pub(crate) mod access_token; +#[cfg(feature = "internal")] pub(crate) mod auth_settings; mod client; pub mod client_settings; diff --git a/crates/bitwarden/src/crypto.rs b/crates/bitwarden/src/crypto.rs index b8e6d7f775..f1607d1593 100644 --- a/crates/bitwarden/src/crypto.rs +++ b/crates/bitwarden/src/crypto.rs @@ -2,27 +2,25 @@ use std::{collections::HashMap, fmt::Display, hash::Hash, str::FromStr}; -use aes::cipher::{ - generic_array::GenericArray, - typenum::{U32, U64}, - Unsigned, -}; +use aes::cipher::{generic_array::GenericArray, typenum::U64, Unsigned}; use base64::Engine; use hmac::digest::OutputSizeUser; -use num_bigint::BigUint; -use num_traits::cast::ToPrimitive; use serde::{de::Visitor, Deserialize, Serialize}; -use sha2::{Digest, Sha256}; use uuid::Uuid; use crate::{ - client::{ - auth_settings::Kdf, - encryption_settings::{EncryptionSettings, SymmetricCryptoKey}, - }, + client::encryption_settings::{EncryptionSettings, SymmetricCryptoKey}, error::{CSParseError, Error, Result}, util::BASE64_ENGINE, - wordlist::EFF_LONG_WORD_LIST, +}; + +#[cfg(feature = "internal")] +use { + crate::{client::auth_settings::Kdf, wordlist::EFF_LONG_WORD_LIST}, + aes::cipher::typenum::U32, + num_bigint::BigUint, + num_traits::cast::ToPrimitive, + sha2::{Digest, Sha256}, }; #[allow(unused, non_camel_case_types)] @@ -240,6 +238,7 @@ pub(crate) type PbkdfSha256Hmac = hmac::Hmac; pub(crate) const PBKDF_SHA256_HMAC_OUT_SIZE: usize = <::OutputSize as Unsigned>::USIZE; +#[cfg(feature = "internal")] pub(crate) fn hash_kdf(secret: &[u8], salt: &[u8], kdf: &Kdf) -> Result<[u8; 32]> { let hash = match kdf { Kdf::PBKDF2 { iterations } => pbkdf2::pbkdf2_array::< @@ -279,6 +278,7 @@ pub(crate) fn hash_kdf(secret: &[u8], salt: &[u8], kdf: &Kdf) -> Result<[u8; 32] Ok(hash) } +#[cfg(feature = "internal")] pub(crate) fn stretch_key_password( secret: &[u8], salt: &[u8], @@ -322,6 +322,7 @@ pub(crate) fn stretch_key(secret: [u8; 16], name: &str, info: Option<&str>) -> S SymmetricCryptoKey::try_from(key.as_slice()).unwrap() } +#[cfg(feature = "internal")] pub(crate) fn fingerprint(fingerprint_material: &str, public_key: &[u8]) -> Result { let mut h = Sha256::new(); h.update(public_key); @@ -337,6 +338,7 @@ pub(crate) fn fingerprint(fingerprint_material: &str, public_key: &[u8]) -> Resu Ok(hash_word(user_fingerprint).unwrap()) } +#[cfg(feature = "internal")] fn hash_word(hash: [u8; 32]) -> Result { let minimum_entropy = 64; @@ -438,14 +440,19 @@ impl, Output, Id: Hash + Eq + Copy> Decryptable NonZeroU32 { NonZeroU32::new(600_000).unwrap() } +#[cfg(feature = "internal")] pub fn default_argon2_iterations() -> NonZeroU32 { NonZeroU32::new(3).unwrap() } +#[cfg(feature = "internal")] pub fn default_argon2_memory() -> NonZeroU32 { NonZeroU32::new(64).unwrap() } +#[cfg(feature = "internal")] pub fn default_argon2_parallelism() -> NonZeroU32 { NonZeroU32::new(4).unwrap() } diff --git a/crates/bitwarden/src/wordlist.rs b/crates/bitwarden/src/wordlist.rs index b5a640d020..03853ea257 100644 --- a/crates/bitwarden/src/wordlist.rs +++ b/crates/bitwarden/src/wordlist.rs @@ -1,4 +1,5 @@ // EFF's Long Wordlist from https://www.eff.org/dice +#[cfg(feature = "internal")] pub(crate) const EFF_LONG_WORD_LIST: &'static [&str] = &[ "abacus", "abdomen", From 3f76e9c8a556e08775d350142c23e86df5e7dc7a Mon Sep 17 00:00:00 2001 From: mimartin12 <77340197+mimartin12@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:28:45 -0600 Subject: [PATCH 31/32] Update Azure Key Vault name and SP name (#102) --- .github/workflows/publish-rust-crates.yml | 4 ++-- .github/workflows/release-cli.yml | 4 ++-- .github/workflows/version-bump.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index 26ecb218e5..058dd13802 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -105,13 +105,13 @@ jobs: - name: Login to Azure uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 with: - creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - name: Retrieve secrets id: retrieve-secrets uses: bitwarden/gh-actions/get-keyvault-secrets@12452ffcde72eca60a91abef555090ad17ba2108 with: - keyvault: "bitwarden-prod-kv" + keyvault: "bitwarden-ci" secrets: "cratesio-api-token" - name: Install rust diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index bb2dd192e2..a108ad4018 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -128,13 +128,13 @@ jobs: - name: Login to Azure uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 with: - creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - name: Retrieve secrets id: retrieve-secrets uses: bitwarden/gh-actions/get-keyvault-secrets@12452ffcde72eca60a91abef555090ad17ba2108 with: - keyvault: "bitwarden-prod-kv" + keyvault: "bitwarden-ci" secrets: "cratesio-api-token" - name: Install rust diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index f811309690..92a91ef8bd 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -48,13 +48,13 @@ jobs: - name: Login to Azure - Prod Subscription uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 with: - creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - name: Retrieve secrets id: retrieve-secrets uses: bitwarden/gh-actions/get-keyvault-secrets@12452ffcde72eca60a91abef555090ad17ba2108 with: - keyvault: "bitwarden-prod-kv" + keyvault: "bitwarden-ci" secrets: "github-gpg-private-key, github-gpg-private-key-passphrase" - name: Import GPG key From f0c10f119e0d8208606755af79b97f7953716509 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 09:25:03 -0500 Subject: [PATCH 32/32] Update pyo3 non-major (#63) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Hinton --- Cargo.lock | 38 ++++++++++++++++------------------ crates/bitwarden-py/Cargo.toml | 13 +++++++----- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e50043fa2d..bf46b87bbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1592,9 +1592,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] @@ -2026,9 +2026,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.17.3" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "268be0c73583c183f2b14052337465768c07726936a260f480f0857cb95ba543" +checksum = "e3b1ac5b3731ba34fdaa9785f8d74d17448cd18f30cf19e0c7e7b1fdb5272109" dependencies = [ "cfg-if", "indoc", @@ -2043,9 +2043,9 @@ dependencies = [ [[package]] name = "pyo3-asyncio" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1febe3946b26194628f00526929ee6f8559f9e807f811257e94d4c456103be0e" +checksum = "d3564762e37035cfc486228e10b0528460fa026d681b5763873c693aa0d5c260" dependencies = [ "futures", "once_cell", @@ -2057,9 +2057,9 @@ dependencies = [ [[package]] name = "pyo3-asyncio-macros" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "270b167ea304b961616aa0f003463c95becd3c11a85bd83ba668fe16129e2469" +checksum = "be72d4cd43a27530306bd0d20d3932182fbdd072c6b98d3638bc37efb9d559dd" dependencies = [ "proc-macro2", "quote", @@ -2068,9 +2068,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.17.3" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28fcd1e73f06ec85bf3280c48c67e731d8290ad3d730f8be9dc07946923005c8" +checksum = "9cb946f5ac61bb61a5014924910d936ebd2b23b705f7a4a3c40b05c720b079a3" dependencies = [ "once_cell", "target-lexicon", @@ -2078,9 +2078,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.17.3" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6cb136e222e49115b3c51c32792886defbfb0adead26a688142b346a0b9ffc" +checksum = "fd4d7c5337821916ea2a1d21d1092e8443cf34879e53a0ac653fbb98f44ff65c" dependencies = [ "libc", "pyo3-build-config", @@ -2088,9 +2088,9 @@ dependencies = [ [[package]] name = "pyo3-log" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5695ccff5060c13ca1751cf8c857a12da9b0bf0378cb071c5e0326f7c7e4c1b" +checksum = "f47b0777feb17f61eea78667d61103758b243a871edc09a7786500a50467b605" dependencies = [ "arc-swap", "log", @@ -2099,9 +2099,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.17.3" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94144a1266e236b1c932682136dc35a9dee8d3589728f68130c7c3861ef96b28" +checksum = "a9d39c55dab3fc5a4b25bbd1ac10a2da452c4aca13bb450f22818a002e29648d" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -2111,9 +2111,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.17.3" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8df9be978a2d2f0cdebabb03206ed73b11314701a5bfe71b0d753b81997777f" +checksum = "97daff08a4c48320587b5224cc98d609e3c27b6d437315bd40b605c98eeb5918" dependencies = [ "proc-macro2", "quote", @@ -2932,9 +2932,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.48.0", diff --git a/crates/bitwarden-py/Cargo.toml b/crates/bitwarden-py/Cargo.toml index c6f1508d08..1657d14e58 100644 --- a/crates/bitwarden-py/Cargo.toml +++ b/crates/bitwarden-py/Cargo.toml @@ -6,18 +6,21 @@ rust-version = "1.57" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name="bitwarden_py" +name = "bitwarden_py" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.17.3", features = ["extension-module"] } -pyo3-log = "0.7.0" +pyo3 = { version = "0.18.3", features = ["extension-module"] } +pyo3-log = "0.8.3" bitwarden-json = { path = "../bitwarden-json" } [build-dependencies] -pyo3-build-config = { version = "0.17.3"} +pyo3-build-config = { version = "0.18.3" } [target.'cfg(not(target_arch="wasm32"))'.dependencies] tokio = { version = "1.28.2", features = ["rt-multi-thread", "macros"] } -pyo3-asyncio = { version = "0.17.0", features = ["attributes", "tokio-runtime"] } +pyo3-asyncio = { version = "0.18.0", features = [ + "attributes", + "tokio-runtime", +] }