Skip to content

client: support already-derived file keys - #559

Merged
bilelmoussaoui merged 4 commits into
linux-credentials:mainfrom
caniko:caniko/file-key-api
Aug 25, 2026
Merged

client: support already-derived file keys#559
bilelmoussaoui merged 4 commits into
linux-credentials:mainfrom
caniko:caniko/file-key-api

Conversation

@caniko

@canikocaniko commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Add file-backend APIs for callers that already hold derived key material:

  • LockedKeyring::{validate_key, unlock_with_key}
  • UnlockedKeyring::{load_with_key, open_with_key, open_at_with_key}

This also makes oo7::Key publicly nameable for those APIs.

Behavior

Keys are checked against the active crypto backend's required key length before use.

validate_key mirrors validate_secret: it returns true for an empty keyring or when at least one item authenticates. unlock_with_key retains the existing corruption thresholds, so a partially corrupted keyring can validate but still return PartiallyCorruptedKeyring.

Non-empty unencrypted keyrings reject a direct key. Key-based open and open_at operate only on v1 paths and do not inspect or migrate v0 files; secret-based open retains legacy migration.

An exact-length Key::new(...) value is treated as caller-supplied direct key material, so the caller is responsible for its entropy.

Scope

This PR does not add restart state, fdstore transport, PAM or server changes, D-Bus readiness changes, migration recovery, a generic credential provider, or an unchecked key API.

Testing

Tested with both crypto backends, the complete Tokio client suites, async-std builds, workspace checks and clippy, rustfmt, rustdoc, cargo-deny, and the affected server and package builds. A disposable external async-std consumer also exercised key-only read, write, reload, and wrong-key rejection with both crypto backends without Tokio or oo7-daemon in its feature graph.

Refs #548.

@github-actions

github-actionsBot commented Aug 25, 2026

Copy link
Copy Markdown

📊 Code Coverage Report

MetricValue
Current PR Coverage83.44%
Main Branch Coverage83.39%
Coverage Change📈 +0.05%

Coverage report generated by cargo-tarpaulin

Comment threadclient/src/file/locked_keyring.rs Outdated
Comment threadclient/src/file/unlocked_keyring.rs Outdated
Comment threadclient/src/file/unlocked_keyring.rs Outdated
Comment threadclient/src/file/unlocked_keyring.rs
Comment threadclient/src/key.rs Outdated
@caniko

Copy link
Copy Markdown
ContributorAuthor

Addressed the five review comments in fa4b0dc; the follow-up checks are green. Ready for another look.

@bilelmoussaoui
bilelmoussaoui merged commit 990ce28 into linux-credentials:mainAug 25, 2026
17 checks passed
@bilelmoussaoui

Copy link
Copy Markdown
Collaborator

thanks!

@caniko
caniko deleted the caniko/file-key-api branch August 25, 2026 15:31
Sign up for freeto 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

@caniko@bilelmoussaoui