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

refactor(repository)!: Add more control over used keys #383

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aawsome
Copy link
Member

@aawsome aawsome commented Dec 10, 2024

Adds more control over the used repository keys.
This is needed to implement the missing key list, key remove commands in the rustic CLI.

As this refactors the Repository a bit, this is a breaking change (which will most likely not harm anyone using rustic_core)

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

Attention: Patch coverage is 57.44681% with 20 lines in your changes missing coverage. Please review.

Project coverage is 42.2%. Comparing base (6a50c12) to head (d456270).

Files with missing lines Patch % Lines
crates/core/src/repository.rs 56.0% 11 Missing ⚠️
crates/core/src/backend/decrypt.rs 50.0% 6 Missing ⚠️
crates/core/src/commands/check.rs 0.0% 1 Missing ⚠️
crates/core/src/repofile/keyfile.rs 66.6% 1 Missing ⚠️
crates/core/src/repofile/snapshotfile.rs 50.0% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
crates/core/src/commands/init.rs 93.7% <100.0%> (ø)
crates/core/src/commands/prune.rs 65.2% <100.0%> (-0.1%) ⬇️
crates/core/tests/integration.rs 80.7% <ø> (ø)
crates/core/src/commands/check.rs 61.8% <0.0%> (-0.4%) ⬇️
crates/core/src/repofile/keyfile.rs 65.1% <66.6%> (+0.5%) ⬆️
crates/core/src/repofile/snapshotfile.rs 49.7% <50.0%> (+1.4%) ⬆️
crates/core/src/backend/decrypt.rs 47.8% <50.0%> (-1.9%) ⬇️
crates/core/src/repository.rs 42.5% <56.0%> (+0.2%) ⬆️

... and 17 files with indirect coverage changes

/// # Errors
///
/// * If the key could not be removed.
pub fn delete_key(&self, id: &str) -> RusticResult<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things:

  • what happens in case two keys have the same starting strings?
  • there is no safe-guarding in place, before deleting the keys (although that might fit better into rustic-rs

Copy link
Member Author

Choose a reason for hiding this comment

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

find_id returns an error if no unique id can be found.
The safeguard is the check against key_id() - which is the key used to open the repo.

@simonsan simonsan changed the title refactor!: Add more control over used keys refactor(repository)!: Add more control over used keys Dec 10, 2024
@simonsan simonsan added C-refactor Category: Refactoring of already existing code A-repository Area: Related to the Repository API labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-repository Area: Related to the Repository API C-refactor Category: Refactoring of already existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants