-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-8301] Invert crates relationship #798
Conversation
No New Or Fixed Issues Found |
36d02d2
to
ab15ba3
Compare
# Conflicts: # Cargo.lock # crates/bitwarden-core/src/client/client.rs # crates/bitwarden-core/src/client/test_accounts.rs # crates/bitwarden-core/src/error.rs # crates/bitwarden-core/src/mobile/vault/client_sends.rs # crates/bitwarden-core/src/mobile/vault/client_vault.rs # crates/bitwarden-core/src/platform/domain.rs # crates/bitwarden-core/src/platform/fido2/crypto.rs # crates/bitwarden-core/src/platform/fido2/types.rs # crates/bitwarden-core/src/platform/sync.rs # crates/bitwarden-core/src/tool/mod.rs # crates/bitwarden-core/src/tool/send.rs # crates/bitwarden-core/src/vault/client_vault.rs # crates/bitwarden-core/src/vault/domain.rs # crates/bitwarden-core/src/vault/send.rs # crates/bitwarden-core/src/vault/sync.rs # crates/bitwarden/Cargo.toml # crates/bitwarden/src/lib.rs # crates/bitwarden/src/mobile/tool/client_sends.rs # crates/bitwarden/src/mobile/vault/client_sends.rs # crates/bitwarden/src/platform/domain.rs # crates/bitwarden/src/platform/sync.rs # crates/bitwarden/src/vault/send.rs
# Conflicts: # Cargo.lock # crates/bitwarden-core/Cargo.toml # crates/bitwarden-core/src/error.rs # crates/bitwarden-core/src/lib.rs # crates/bitwarden-core/src/uniffi_support.rs # crates/bitwarden-exporters/src/models.rs # crates/bitwarden-send/src/send.rs # crates/bitwarden-sm/src/projects/delete.rs # crates/bitwarden-sm/src/projects/project_response.rs # crates/bitwarden-sm/src/secrets/delete.rs # crates/bitwarden-sm/src/secrets/list.rs # crates/bitwarden-sm/src/secrets/secret_response.rs # crates/bitwarden-sm/src/secrets/sync.rs # crates/bitwarden/Cargo.toml
# Conflicts: # Cargo.lock # Cargo.toml # crates/bitwarden-core/src/auth/auth_request.rs # crates/bitwarden-core/src/auth/client_auth.rs # crates/bitwarden-core/src/auth/password/validate.rs # crates/bitwarden-core/src/client/internal.rs # crates/bitwarden-core/src/lib.rs # crates/bitwarden-core/src/mobile/crypto.rs # crates/bitwarden-core/src/mobile/vault/client_attachments.rs # crates/bitwarden-core/src/mobile/vault/client_ciphers.rs # crates/bitwarden-core/src/vault/cipher/attachment.rs # crates/bitwarden-core/src/vault/cipher/card.rs # crates/bitwarden-core/src/vault/cipher/cipher.rs # crates/bitwarden-core/src/vault/cipher/field.rs # crates/bitwarden-core/src/vault/cipher/identity.rs # crates/bitwarden-core/src/vault/cipher/linked_id.rs # crates/bitwarden-core/src/vault/cipher/local_data.rs # crates/bitwarden-core/src/vault/cipher/login.rs # crates/bitwarden-core/src/vault/cipher/mod.rs # crates/bitwarden-core/src/vault/cipher/secure_note.rs # crates/bitwarden-core/src/vault/collection.rs # crates/bitwarden-core/src/vault/domain.rs # crates/bitwarden-core/src/vault/folder.rs # crates/bitwarden-core/src/vault/password_history.rs # crates/bitwarden-core/src/vault/sync.rs # crates/bitwarden-core/src/vault/totp.rs # crates/bitwarden-exporters/src/models.rs # crates/bitwarden-sm/src/projects/create.rs # crates/bitwarden-sm/src/projects/update.rs # crates/bitwarden-sm/src/secrets/create.rs # crates/bitwarden-sm/src/secrets/update.rs # crates/bitwarden-vault/src/cipher/attachment.rs # crates/bitwarden-vault/src/cipher/card.rs # crates/bitwarden-vault/src/cipher/cipher.rs # crates/bitwarden-vault/src/cipher/field.rs # crates/bitwarden-vault/src/cipher/identity.rs # crates/bitwarden-vault/src/cipher/linked_id.rs # crates/bitwarden-vault/src/cipher/local_data.rs # crates/bitwarden-vault/src/cipher/login.rs # crates/bitwarden-vault/src/cipher/mod.rs # crates/bitwarden-vault/src/cipher/secure_note.rs # crates/bitwarden-vault/src/collection.rs # crates/bitwarden-vault/src/domain.rs # crates/bitwarden-vault/src/folder.rs # crates/bitwarden-vault/src/password_history.rs # crates/bitwarden-vault/src/totp.rs # crates/bitwarden/Cargo.toml # crates/bitwarden/src/error.rs # crates/bitwarden/src/tool/exporters/client_exporter.rs # crates/bitwarden/src/vault/cipher/attachment.rs # crates/bitwarden/src/vault/cipher/card.rs # crates/bitwarden/src/vault/cipher/cipher.rs # crates/bitwarden/src/vault/cipher/field.rs # crates/bitwarden/src/vault/cipher/identity.rs # crates/bitwarden/src/vault/cipher/linked_id.rs # crates/bitwarden/src/vault/cipher/local_data.rs # crates/bitwarden/src/vault/cipher/login.rs # crates/bitwarden/src/vault/cipher/mod.rs # crates/bitwarden/src/vault/cipher/secure_note.rs # crates/bitwarden/src/vault/collection.rs # crates/bitwarden/src/vault/domain.rs # crates/bitwarden/src/vault/folder.rs # crates/bitwarden/src/vault/password_history.rs # crates/bitwarden/src/vault/totp.rs
In preparation for #798 we need to flip the relationship between vault and exporters. Due to exporters in the future getting a `client_exporters` which means they need to be able to access the vault models to properly model it.
# Conflicts: # crates/bitwarden-core/src/auth/password/validate.rs # crates/bitwarden-core/src/auth/register.rs # crates/bitwarden-core/src/auth/renew.rs # crates/bitwarden-core/src/client/encryption_settings.rs # crates/bitwarden-core/src/mobile/crypto.rs # crates/bitwarden-core/src/platform/client_platform.rs # crates/bitwarden-core/src/platform/fido2/authenticator.rs # crates/bitwarden-core/src/platform/get_user_api_key.rs # crates/bitwarden-exporters/Cargo.toml # crates/bitwarden-exporters/src/lib.rs # crates/bitwarden-exporters/src/models.rs # crates/bitwarden-generators/src/client_generator.rs # crates/bitwarden-send/src/client_sends.rs # crates/bitwarden-sm/src/projects/create.rs # crates/bitwarden-sm/src/projects/update.rs # crates/bitwarden-sm/src/secrets/create.rs # crates/bitwarden-sm/src/secrets/update.rs # crates/bitwarden-uniffi/src/platform/mod.rs # crates/bitwarden-uniffi/src/tool/mod.rs # crates/bitwarden-uniffi/src/vault/ciphers.rs # crates/bitwarden-uniffi/src/vault/mod.rs # crates/bitwarden-vault/src/lib.rs # crates/bitwarden-vault/src/mobile/client_attachments.rs # crates/bitwarden-vault/src/mobile/client_ciphers.rs # crates/bitwarden-vault/src/mobile/client_collection.rs # crates/bitwarden-vault/src/mobile/client_folders.rs # crates/bitwarden-vault/src/mobile/client_password_history.rs # crates/bitwarden-vault/src/sync.rs # crates/bitwarden/src/client/client.rs # crates/bitwarden/src/error.rs # crates/bitwarden/src/tool/exporters/client_exporter.rs # crates/bitwarden/src/tool/exporters/mod.rs # crates/bitwarden/src/vault/client_vault.rs
# Conflicts: # Cargo.lock # Cargo.toml # crates/bitwarden-core/src/platform/client_fido.rs # crates/bitwarden-core/src/platform/client_platform.rs # crates/bitwarden-core/src/platform/fido2/authenticator.rs # crates/bitwarden-core/src/platform/fido2/client.rs # crates/bitwarden-core/src/platform/fido2/crypto.rs # crates/bitwarden-core/src/platform/fido2/mod.rs # crates/bitwarden-core/src/platform/fido2/traits.rs # crates/bitwarden-core/src/platform/fido2/types.rs # crates/bitwarden-fido/src/authenticator.rs # crates/bitwarden-fido/src/client.rs # crates/bitwarden-fido/src/crypto.rs # crates/bitwarden-fido/src/lib.rs # crates/bitwarden-fido/src/traits.rs # crates/bitwarden-fido/src/types.rs # crates/bitwarden-json/src/client.rs # crates/bitwarden-send/Cargo.toml # crates/bitwarden-send/src/lib.rs # crates/bitwarden-send/src/send.rs # crates/bitwarden-send/src/uniffi_support.rs # crates/bitwarden-uniffi/src/vault/ciphers.rs # crates/bitwarden/Cargo.toml # crates/bitwarden/src/error.rs # crates/bitwarden/src/platform/fido2/authenticator.rs # crates/bitwarden/src/platform/fido2/client.rs # crates/bitwarden/src/platform/fido2/crypto.rs # crates/bitwarden/src/platform/fido2/mod.rs # crates/bitwarden/src/platform/fido2/traits.rs # crates/bitwarden/src/platform/fido2/types.rs # crates/bitwarden/src/secrets_manager/client_projects.rs # crates/bitwarden/src/secrets_manager/client_secrets.rs # crates/bitwarden/src/tool/mod.rs
# Conflicts: # crates/bitwarden-core/README.md # crates/bitwarden-json/src/client.rs # crates/bitwarden-vault/src/cipher/cipher.rs # crates/bw/src/main.rs
# Conflicts: # Cargo.lock # crates/bitwarden-core/src/platform/mod.rs # crates/bitwarden-fido/src/authenticator.rs # crates/bitwarden-fido/src/client_fido.rs # crates/bitwarden-fido/src/lib.rs # crates/bitwarden-uniffi/src/platform/fido2.rs # crates/bitwarden/Cargo.toml
Currently auth requests uses the password generator to generate a 25 character password. Since we're shuffling around code for #798 this won't be possible much longer. This PR adds a `generate_random_alphanumeric` to the `bitwarden_crypto` crate which generates a cryptographically secure random alphanumerical string that can be used instead.
# Conflicts: # crates/bitwarden-core/src/auth/auth_request.rs # crates/bws/src/main.rs
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #798 +/- ##
==========================================
- Coverage 59.20% 55.96% -3.24%
==========================================
Files 192 193 +1
Lines 12581 12614 +33
==========================================
- Hits 7449 7060 -389
- Misses 5132 5554 +422 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, but some imports in the Kotlin demo need to be updated, and there's a commented test
@@ -169,6 +165,7 @@ impl<'a> Client { | |||
} | |||
} | |||
|
|||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is commented, should this be fixed or moved somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more of an integration test. I'm thinking we could move them to the bitwarden crate under a separate test directory.
In #798 we accidentally moved the bitwarden crate changelog. Moving it back.
Type of change
Objective
This PR inverts the relationship between most crates in an effort to make the code base easier to maintain.
bitwarden-core
.bitwarden
provides re-exports from the various crates.ClientFeature
structs to the various crates, and introducedClientFeatureExt
which exposes it onClient
. This now becomes the typical way to use functionality.InternalClient
which contains the internal functionality for hooking up logic between the various crates.Before you submit