Repository navigation
fix(crypto): update RngCore import path for rand 0.10 - #275
Conversation
Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the RngCore import in crypto.rs to account for rand 0.10 no longer providing RngCore via rand::RngCore, restoring build compatibility for nonce generation in the AES-GCM encryption module.
Changes:
- Switch
RngCoreimport fromrand::RngCoretoaes_gcm::aead::rand_core::RngCore.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| use pbkdf2::pbkdf2_hmac; | ||
| use rand::RngCore; | ||
| use aes_gcm::aead::rand_core::RngCore; |
There was a problem hiding this comment.
After this change, the crate no longer appears to use the rand dependency anywhere (no remaining rand::... imports/usages across the Rust sources), but Cargo.toml still declares rand = "0.10". Consider removing the unused dependency (or switching to a direct rand_core dependency) to reduce dependency surface and avoid carrying extra rand/rand_core versions.
| use aes_gcm::{ | ||
| aead::{Aead, KeyInit, OsRng}, | ||
| Aes256Gcm, Nonce, | ||
| }; | ||
| use pbkdf2::pbkdf2_hmac; | ||
| use rand::RngCore; | ||
| use aes_gcm::aead::rand_core::RngCore; | ||
| use sha2::Sha256; |
There was a problem hiding this comment.
RngCore is now imported from aes_gcm::aead::rand_core, but OsRng is still imported separately from aes_gcm::aead above, resulting in split/duplicated aes_gcm imports. Consider grouping these together (e.g., bring rand_core::RngCore into the existing use aes_gcm::{ ... } block) to keep imports consistent and easier to scan.
…ency Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rand 0.10no longer re-exportsRngCoreat the crate root, breaking the build whencrypto.rsimported it asrand::RngCore.Changes
src/crypto.rs: importRngCoreviaaes_gcm::aead::rand_coreand consolidate it into the existinguse aes_gcm::{ ... }block, removing the split importCargo.toml: remove the now-unusedrand = "0.10"direct dependency —RngCoreis sourced fromaes_gcm's re-exportedrand_core, so the top-levelrandcrate is no longer needed✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.