Skip to content
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

Vault type-safety #6094

Merged
merged 2 commits into from
Oct 3, 2023
Merged

Vault type-safety #6094

merged 2 commits into from
Oct 3, 2023

Conversation

SanjoDeundiak
Copy link
Member

@SanjoDeundiak SanjoDeundiak commented Sep 26, 2023

  1. Introduce more granular types for Vault
  2. Propagate these types to everything that was dependent on Vault

@SanjoDeundiak SanjoDeundiak force-pushed the sanjo/vault_interface branch 14 times, most recently from 5ba314e to 454a50b Compare October 3, 2023 12:16
@SanjoDeundiak SanjoDeundiak force-pushed the sanjo/vault_interface branch from 454a50b to 9801b93 Compare October 3, 2023 12:46
@SanjoDeundiak SanjoDeundiak changed the title WIP: Vault interface Vault type-safety Oct 3, 2023
@SanjoDeundiak SanjoDeundiak marked this pull request as ready for review October 3, 2023 12:51
@SanjoDeundiak SanjoDeundiak requested a review from a team as a code owner October 3, 2023 12:51
etorreborre
etorreborre previously approved these changes Oct 3, 2023
Copy link
Member

@etorreborre etorreborre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional types are great!

The 2 parts that I am bit more uncertain about are the PurposeKeysCreation and the use of a disable feature flag

}

/// Return [`PurposeKeysRepository`] instance
pub fn repository(&self) -> Arc<dyn PurposeKeysRepository> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move the implementation in CredentialsPurposeKeyBuilder and SecureChannelsPurposeKeyBuilder internal to PurposeKeysCreation I think we can remove:

  • repository
  • purpose_keys_verification
  • secure_channel_purpose_key_builder
  • credential_purpose_key_builder
  • vault

This limits the possibility that these elements, in particular repository and vault are accessed via too many different code paths.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please elaborate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather enforce a separation between interfaces and implementations. If we create a struct with a certain purpose (no pun intended) like PurposeKeysCreation it should be able to do things via its public methods without have to expose its internals like repository or vault. Especially in the case of vault where we reach even further to use a more specific vault.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean you would prefer to make those dependencies inaccessible outside of the structure?

implementations/rust/ockam/ockam_vault/src/lib.rs Outdated Show resolved Hide resolved
@SanjoDeundiak SanjoDeundiak added this pull request to the merge queue Oct 3, 2023
Merged via the queue into develop with commit b4cff76 Oct 3, 2023
39 checks passed
@SanjoDeundiak SanjoDeundiak deleted the sanjo/vault_interface branch October 3, 2023 16:51
@etorreborre etorreborre restored the sanjo/vault_interface branch October 4, 2023 13:42
@etorreborre etorreborre deleted the sanjo/vault_interface branch October 4, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants