iqlusioninc / yubikey.rs

Pure Rust YubiKey host-side driver for PIV-based RSA/ECC key storage + signing/encryption support
BSD 2-Clause "Simplified" License
218 stars 27 forks source link

The `YubiKey::save_object` doesn't require mutable reference #560

Open G1gg1L3s opened 8 months ago

G1gg1L3s commented 8 months ago

In the current version, the Yubikey::save_object method requires a mutable reference to the data being saved:

https://github.com/iqlusioninc/yubikey.rs/blob/b07612eb4e92331c4d2a419b53654ba9cefc4b31/src/yubikey.rs#L629-L634

However, it appears that the mutability requirement is unnecessary, given that the Transaction::save_object method accepts an immutable slice:

https://github.com/iqlusioninc/yubikey.rs/blob/b07612eb4e92331c4d2a419b53654ba9cefc4b31/src/transaction.rs#L486-L488

I understand that this modification is currently marked under the untested feature. Nevertheless, moving to the use of an immutable slice would definitely enhance the API.