Skip to content

docs: use derive_key_argon2 in examples, derive_key no longer exists#375

Open
Sébastien Duquette (sduquette-devolutions) wants to merge 1 commit intomasterfrom
update-docs
Open

docs: use derive_key_argon2 in examples, derive_key no longer exists#375
Sébastien Duquette (sduquette-devolutions) wants to merge 1 commit intomasterfrom
update-docs

Conversation

@sduquette-devolutions

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Rust README examples to reflect the current key-derivation API (derive_key_argon2), replacing the removed derive_key usage.

Changes:

  • Replace the README key-derivation example to use utils::derive_key_argon2.
  • Switch the example to use Argon2Parameters::default() for configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

use devolutions_crypto::Argon2Parameters;

let key = b"this is a secret password";
let parameters = Argon2Parameters::default();
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Argon2Parameters::default() generates a new random salt each time (see struct docs), so derive_key_argon2 will not be reproducible across runs unless the same parameters (especially salt) are persisted/reused. The example should either show setting a stable salt (e.g., via the builder / set_salt) or explicitly mention that callers must store/serialize the parameters to derive the same key later.

Suggested change
let parameters = Argon2Parameters::default();
// In a real application, generate a random salt once and persist/reuse the same parameters
// (including the salt) whenever you need to derive the same key again.
let mut parameters = Argon2Parameters::default();
parameters.set_salt(b"example fixed salt value");

Copilot uses AI. Check for mistakes.
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