Bump MSRV to 1.65.0

This commit is contained in:
Jack Grigg 2023-06-13 20:21:58 +00:00
parent bccc4bc949
commit fdb41822fc
20 changed files with 42 additions and 28 deletions

View file

@ -7,6 +7,11 @@ and this project adheres to Rust's notion of
to 1.0.0 are beta releases.
## [Unreleased]
### Added
- `impl Eq for age_core::format::Stanza`
### Changed
- MSRV is now 1.65.0.
## [0.9.0] - 2022-10-27
### Changed

View file

@ -7,7 +7,7 @@ repository = "https://github.com/str4d/rage"
readme = "README.md"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.59"
rust-version = "1.65"
[package.metadata.docs.rs]
all-features = true

View file

@ -68,7 +68,7 @@ impl<'a> AgeStanza<'a> {
/// recipient.
///
/// This is the owned type; see [`AgeStanza`] for the reference type.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct Stanza {
/// A tag identifying this stanza type.
pub tag: String,

View file

@ -430,7 +430,7 @@ mod tests {
pipe.0 = pipe.0.split_off(n_out);
Ok(n_out)
} else {
(&mut buf[..n_in]).copy_from_slice(&pipe.0);
buf[..n_in].copy_from_slice(&pipe.0);
pipe.0.clear();
Ok(n_in)
}

View file

@ -9,6 +9,8 @@ and this project adheres to Rust's notion of
to 1.0.0 are beta releases.
## [Unreleased]
### Changed
- MSRV is now 1.65.0.
## [0.4.0] - 2022-10-27
### Changed

View file

@ -7,7 +7,7 @@ repository = "https://github.com/str4d/rage"
readme = "README.md"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.59"
rust-version = "1.65"
[dependencies]
age-core = { version = "0.9.0", path = "../age-core", features = ["plugin"] }

View file

@ -9,6 +9,11 @@ and this project adheres to Rust's notion of
to 1.0.0 are beta releases.
## [Unreleased]
### Added
- `impl Eq for age::ssh::{ParseRecipientKeyError, UnsupportedKey}`
### Changed
- MSRV is now 1.65.0.
## [0.9.2] - 2023-06-12
### Added

View file

@ -9,7 +9,7 @@ keywords = ["rage", "encryption"]
categories = ["cryptography"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.59"
rust-version = "1.65"
[badges]
maintenance = { status = "experimental" }

View file

@ -172,7 +172,7 @@ impl Identity {
pub fn default_for_plugin(plugin_name: &str) -> Self {
bech32::encode(
&format!("{}{}-", PLUGIN_IDENTITY_PREFIX, plugin_name),
&[],
[],
Variant::Bech32,
)
.expect("HRP is valid")

View file

@ -60,7 +60,7 @@ impl Nonce {
fn set_last(&mut self, last: bool) -> Result<(), ()> {
if !self.is_last() {
self.0 |= if last { 1 } else { 0 };
self.0 |= u128::from(last);
Ok(())
} else {
Err(())

View file

@ -64,7 +64,7 @@ impl Encryptor {
///
/// Returns `None` if no recipients were provided.
pub fn with_recipients(recipients: Vec<Box<dyn Recipient + Send>>) -> Option<Self> {
(!recipients.is_empty()).then(|| Encryptor(EncryptorType::Keys(recipients)))
(!recipients.is_empty()).then_some(Encryptor(EncryptorType::Keys(recipients)))
}
/// Returns an `Encryptor` that will create an age file encrypted with a passphrase.

View file

@ -94,7 +94,7 @@ impl crate::Recipient for Recipient {
scrypt(&inner_salt, log_n, self.passphrase.expose_secret()).expect("log_n < 64");
let encrypted_file_key = aead_encrypt(&enc_key, file_key.expose_secret());
let encoded_salt = base64::encode_config(&salt, base64::STANDARD_NO_PAD);
let encoded_salt = base64::encode_config(salt, base64::STANDARD_NO_PAD);
Ok(vec![Stanza {
tag: SCRYPT_RECIPIENT_TAG.to_owned(),

View file

@ -128,7 +128,7 @@ impl UnencryptedKey {
///
/// The Display impl provides details for each unsupported key as to why we don't support
/// it, and how a user can migrate to a supported key.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum UnsupportedKey {
/// An encrypted `PEM` key.
EncryptedPem,

View file

@ -43,7 +43,7 @@ pub(crate) enum ParsedRecipient {
}
/// Error conditions when parsing an SSH recipient.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum ParseRecipientKeyError {
/// The string is a parseable value that should be ignored. This case is for handling
/// SSH recipient types that may occur in files we want to be able to parse, but that
@ -74,10 +74,10 @@ impl fmt::Display for Recipient {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Recipient::SshRsa(ssh_key, _) => {
write!(f, "{} {}", SSH_RSA_KEY_PREFIX, base64::encode(&ssh_key))
write!(f, "{} {}", SSH_RSA_KEY_PREFIX, base64::encode(ssh_key))
}
Recipient::SshEd25519(ssh_key, _) => {
write!(f, "{} {}", SSH_ED25519_KEY_PREFIX, base64::encode(&ssh_key))
write!(f, "{} {}", SSH_ED25519_KEY_PREFIX, base64::encode(ssh_key))
}
}
}
@ -127,7 +127,7 @@ impl crate::Recipient for Recipient {
)
.expect("pubkey is valid and file key is not too long");
let encoded_tag = base64::encode_config(&ssh_tag(ssh_key), base64::STANDARD_NO_PAD);
let encoded_tag = base64::encode_config(ssh_tag(ssh_key), base64::STANDARD_NO_PAD);
Ok(vec![Stanza {
tag: SSH_RSA_RECIPIENT_TAG.to_owned(),
@ -138,8 +138,8 @@ impl crate::Recipient for Recipient {
Recipient::SshEd25519(ssh_key, ed25519_pk) => {
let pk: X25519PublicKey = ed25519_pk.to_montgomery().to_bytes().into();
let mut rng = rand_7::rngs::OsRng;
let esk = EphemeralSecret::new(&mut rng);
let rng = rand_7::rngs::OsRng;
let esk = EphemeralSecret::new(rng);
let epk: X25519PublicKey = (&esk).into();
let tweak: StaticSecret =
@ -158,7 +158,7 @@ impl crate::Recipient for Recipient {
);
let encrypted_file_key = aead_encrypt(&enc_key, file_key.expose_secret());
let encoded_tag = base64::encode_config(&ssh_tag(ssh_key), base64::STANDARD_NO_PAD);
let encoded_tag = base64::encode_config(ssh_tag(ssh_key), base64::STANDARD_NO_PAD);
let encoded_epk = base64::encode_config(epk.as_bytes(), base64::STANDARD_NO_PAD);
Ok(vec![Stanza {

View file

@ -61,7 +61,7 @@ pub(crate) mod read {
let c = c as u8;
// Substitute the character in twice after AA, so that padding
// characters will also be detected as a valid if allowed.
base64::decode_config_slice(&[65, 65, c, c], config, &mut [0, 0, 0]).is_ok()
base64::decode_config_slice([65, 65, c, c], config, &mut [0, 0, 0]).is_ok()
}),
|data| base64::decode_config(data, config),
)(input)
@ -83,7 +83,7 @@ pub(crate) mod read {
let c = c as u8;
// Substitute the character in twice after AA, so that padding
// characters will also be detected as a valid if allowed.
base64::decode_config_slice(&[65, 65, c, c], config, &mut [0, 0, 0]).is_ok()
base64::decode_config_slice([65, 65, c, c], config, &mut [0, 0, 0]).is_ok()
}),
),
|chunks| {

View file

@ -55,8 +55,8 @@ impl std::str::FromStr for Identity {
impl Identity {
/// Generates a new secret key.
pub fn generate() -> Self {
let mut rng = OsRng;
Identity(StaticSecret::new(&mut rng))
let rng = OsRng;
Identity(StaticSecret::new(rng))
}
/// Serializes this secret key as a string.
@ -185,8 +185,8 @@ impl fmt::Display for Recipient {
impl crate::Recipient for Recipient {
fn wrap_file_key(&self, file_key: &FileKey) -> Result<Vec<Stanza>, EncryptError> {
let mut rng = OsRng;
let esk = EphemeralSecret::new(&mut rng);
let rng = OsRng;
let esk = EphemeralSecret::new(rng);
let epk: PublicKey = (&esk).into();
let shared_secret = esk.diffie_hellman(&self.0);

View file

@ -583,7 +583,7 @@ fn get_testkit_identities(filename: &str, testfile: &TestFile) -> Vec<x25519::Id
// `scrypt_uppercase` uses the stanza tag `Scrypt` instead of `scrypt`, so
// even though there is a valid passphrase, the decryptor treats it as a
// different recipient stanza kind.
if filename == "scrypt_uppercase" { 1 } else { 0 }
usize::from(filename == "scrypt_uppercase")
);
testfile
.identities
@ -612,7 +612,7 @@ fn check_decrypt_success(
) {
match (res, testfile.expect) {
(Ok(_), Expect::Success { payload_sha256 }) => {
assert_eq!(Sha256::digest(&payload)[..], payload_sha256);
assert_eq!(Sha256::digest(payload)[..], payload_sha256);
}
// These testfile failures are expected, because we maintains support for
// parsing legacy age stanzas without an explicit short final line.
@ -642,7 +642,7 @@ fn check_decrypt_success(
);
// The tests with this expectation are checking that no partial STREAM
// blocks are written to the payload.
assert_eq!(Sha256::digest(&payload)[..], payload_sha256);
assert_eq!(Sha256::digest(payload)[..], payload_sha256);
}
(actual, expected) => panic!(
"Expected {:?}, got {}{}",

View file

@ -9,6 +9,8 @@ and this project adheres to Rust's notion of
to 1.0.0 are beta releases.
## [Unreleased]
### Changed
- MSRV is now 1.65.0.
## [0.9.2] - 2023-06-12
### Changed

View file

@ -9,7 +9,7 @@ keywords = ["age", "cli", "encryption"]
categories = ["command-line-utilities", "cryptography"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.59"
rust-version = "1.65"
default-run = "rage"
[package.metadata.deb]

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "1.59.0"
channel = "1.65.0"
components = ["clippy", "rustfmt"]