Skip to content
Open
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions crates/bitwarden-api-api/src/models/keys_request_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ pub struct KeysRequestModel {
pub public_key: String,
#[serde(rename = "encryptedPrivateKey", alias = "EncryptedPrivateKey")]
pub encrypted_private_key: String,
#[serde(
rename = "accountKeys",
alias = "AccountKeys",
skip_serializing_if = "Option::is_none"
)]
pub account_keys: Option<Box<models::AccountKeysRequestModel>>,
}

impl KeysRequestModel {
pub fn new(public_key: String, encrypted_private_key: String) -> KeysRequestModel {
KeysRequestModel {
public_key,
encrypted_private_key,
account_keys: None,
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Bitwarden Identity
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/

use serde::{Deserialize, Serialize};

use crate::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AccountKeysRequestModel {
#[serde(
rename = "userKeyEncryptedAccountPrivateKey",
alias = "UserKeyEncryptedAccountPrivateKey"
)]
pub user_key_encrypted_account_private_key: Option<String>,
#[serde(rename = "accountPublicKey", alias = "AccountPublicKey")]
pub account_public_key: Option<String>,
#[serde(
rename = "publicKeyEncryptionKeyPair",
alias = "PublicKeyEncryptionKeyPair",
skip_serializing_if = "Option::is_none"
)]
pub public_key_encryption_key_pair: Option<Box<models::PublicKeyEncryptionKeyPairRequestModel>>,
#[serde(
rename = "signatureKeyPair",
alias = "SignatureKeyPair",
skip_serializing_if = "Option::is_none"
)]
pub signature_key_pair: Option<Box<models::SignatureKeyPairRequestModel>>,
#[serde(
rename = "securityState",
alias = "SecurityState",
skip_serializing_if = "Option::is_none"
)]
pub security_state: Option<Box<models::SecurityStateModel>>,
}

impl AccountKeysRequestModel {
pub fn new(
user_key_encrypted_account_private_key: Option<String>,
account_public_key: Option<String>,
) -> AccountKeysRequestModel {
AccountKeysRequestModel {
user_key_encrypted_account_private_key,
account_public_key,
public_key_encryption_key_pair: None,
signature_key_pair: None,
security_state: None,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ pub struct KeysRequestModel {
pub public_key: String,
#[serde(rename = "encryptedPrivateKey", alias = "EncryptedPrivateKey")]
pub encrypted_private_key: String,
#[serde(
rename = "accountKeys",
alias = "AccountKeys",
skip_serializing_if = "Option::is_none"
)]
pub account_keys: Option<Box<models::AccountKeysRequestModel>>,
}

impl KeysRequestModel {
pub fn new(public_key: String, encrypted_private_key: String) -> KeysRequestModel {
KeysRequestModel {
public_key,
encrypted_private_key,
account_keys: None,
}
}
}
8 changes: 8 additions & 0 deletions crates/bitwarden-api-identity/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ pub mod kdf_type;
pub use self::kdf_type::KdfType;
pub mod keys_request_model;
pub use self::keys_request_model::KeysRequestModel;
pub mod account_keys_request_model;
pub use self::account_keys_request_model::AccountKeysRequestModel;
pub mod public_key_encryption_key_pair_request_model;
pub use self::public_key_encryption_key_pair_request_model::PublicKeyEncryptionKeyPairRequestModel;
pub mod signature_key_pair_request_model;
pub use self::signature_key_pair_request_model::SignatureKeyPairRequestModel;
pub mod security_state_model;
pub use self::security_state_model::SecurityStateModel;
pub mod password_prelogin_request_model;
pub use self::password_prelogin_request_model::PasswordPreloginRequestModel;
pub mod password_prelogin_response_model;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Bitwarden Identity
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/

use serde::{Deserialize, Serialize};

use crate::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PublicKeyEncryptionKeyPairRequestModel {
#[serde(rename = "wrappedPrivateKey", alias = "WrappedPrivateKey")]
pub wrapped_private_key: Option<String>,
#[serde(rename = "publicKey", alias = "PublicKey")]
pub public_key: Option<String>,
#[serde(
rename = "signedPublicKey",
alias = "SignedPublicKey",
skip_serializing_if = "Option::is_none"
)]
pub signed_public_key: Option<String>,
}

impl PublicKeyEncryptionKeyPairRequestModel {
pub fn new(
wrapped_private_key: Option<String>,
public_key: Option<String>,
) -> PublicKeyEncryptionKeyPairRequestModel {
PublicKeyEncryptionKeyPairRequestModel {
wrapped_private_key,
public_key,
signed_public_key: None,
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Bitwarden Identity
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/

use serde::{Deserialize, Serialize};

use crate::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SecurityStateModel {
#[serde(rename = "securityState", alias = "SecurityState")]
pub security_state: Option<String>,
#[serde(rename = "securityVersion", alias = "SecurityVersion")]
pub security_version: i32,
}

impl SecurityStateModel {
pub fn new(security_state: Option<String>, security_version: i32) -> SecurityStateModel {
SecurityStateModel {
security_state,
security_version,
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Bitwarden Identity
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/

use serde::{Deserialize, Serialize};

use crate::models;

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SignatureKeyPairRequestModel {
#[serde(rename = "signatureAlgorithm", alias = "SignatureAlgorithm")]
pub signature_algorithm: Option<String>,
#[serde(rename = "wrappedSigningKey", alias = "WrappedSigningKey")]
pub wrapped_signing_key: Option<String>,
#[serde(rename = "verifyingKey", alias = "VerifyingKey")]
pub verifying_key: Option<String>,
}

impl SignatureKeyPairRequestModel {
pub fn new(
signature_algorithm: Option<String>,
wrapped_signing_key: Option<String>,
verifying_key: Option<String>,
) -> SignatureKeyPairRequestModel {
SignatureKeyPairRequestModel {
signature_algorithm,
wrapped_signing_key,
verifying_key,
}
}
}
11 changes: 10 additions & 1 deletion crates/bitwarden-auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,31 @@ license-file.workspace = true
keywords.workspace = true

[features]
uniffi = ["dep:uniffi"] # Uniffi bindings
wasm = [
"bitwarden-core/wasm",
"bitwarden-crypto/wasm",
"dep:tsify",
"dep:wasm-bindgen",
"dep:wasm-bindgen-futures"
"dep:wasm-bindgen-futures",
] # WASM support

# Note: dependencies must be alphabetized to pass the cargo sort check in the CI pipeline.
[dependencies]
bitwarden-api-api = { workspace = true }
bitwarden-core = { workspace = true, features = ["internal"] }
bitwarden-crypto = { workspace = true }
bitwarden-encoding = { workspace = true }
bitwarden-error = { workspace = true }
chrono = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
serde_bytes = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
tsify = { workspace = true, optional = true }
uniffi = { workspace = true, optional = true }
uuid = { workspace = true }
wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }

Expand Down
3 changes: 3 additions & 0 deletions crates/bitwarden-auth/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#![doc = include_str!("../README.md")]

#[cfg(feature = "uniffi")]
uniffi::setup_scaffolding!();

mod auth_client;

pub mod identity;
Expand Down
Loading
Loading