Skip to content

refactor(dgw): simplify aead error mapping in credential crypto#1693

Closed
Copilot wants to merge 8 commits intoDGW-326from
copilot/sub-pr-1689
Closed

refactor(dgw): simplify aead error mapping in credential crypto#1693
Copilot wants to merge 8 commits intoDGW-326from
copilot/sub-pr-1689

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

aead::Error is a unit struct that does not implement std::error::Error, making .context() inapplicable. Simplifies the two AEAD error sites to drop the unused binding since the type carries no diagnostic information.

Changes:

  • encrypt / decrypt: map_err(|e| anyhow::anyhow!("...: {e}"))map_err(|_| anyhow::anyhow!("..."))
  • .context() is already used where applicable (e.g., String::from_utf8 on the decrypted bytes)
// Before
cipher.encrypt(&nonce, plaintext.as_bytes())
    .map_err(|e| anyhow::anyhow!("encryption failed: {e}"))?;

// After
cipher.encrypt(&nonce, plaintext.as_bytes())
    .map_err(|_| anyhow::anyhow!("encryption failed"))?;

Issue: #1689


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Add ChaCha20-Poly1305 encryption for credentials stored in the
credential store. Passwords are encrypted at rest with a master key
protected via libsodium's mlock/mprotect facilities, preventing exposure
in memory dumps or swap.

Issue: DGW-326
Co-authored-by: CBenoit <3809077+CBenoit@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on using anyhow::Context for error handling refactor(dgw): simplify aead error mapping in credential crypto Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants