diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-02-07 12:35:25 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-02-07 16:09:13 +0100 |
commit | 1992f412fec1bfff0ecf68d0a4127edc9976744e (patch) | |
tree | 43c8a098b5dd80c9e2ed964b0c6f4409d4fe5e38 | |
parent | 188a545d2ab09302baaae6a7e28bc07dc404464d (diff) |
openpgp: Rename CertBuilder::set_expiration.
-rw-r--r-- | openpgp/src/cert/builder.rs | 4 | ||||
-rw-r--r-- | openpgp/src/cert/mod.rs | 4 | ||||
-rw-r--r-- | tool/src/commands/key.rs | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index 94d167aa..cce89fb3 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -260,7 +260,7 @@ impl CertBuilder { /// Sets the expiration time. /// /// A value of None means never. - pub fn set_expiration<T>(mut self, expiration: T) -> Self + pub fn set_expiration_time<T>(mut self, expiration: T) -> Self where T: Into<Option<time::Duration>> { self.primary.expiration = expiration.into(); @@ -583,7 +583,7 @@ mod tests { let s = std::time::Duration::new(1, 0); let (cert,_) = CertBuilder::new() - .set_expiration(600 * s) + .set_expiration_time(600 * s) .add_subkey(KeyFlags::default().set_signing(true), 300 * s) .add_subkey(KeyFlags::default().set_authentication(true), diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index f4c6fde0..0e277fd3 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -1903,8 +1903,8 @@ mod test { let p = &P::new(); let (cert, _) = CertBuilder::new() - .set_expiration(None) // Just to assert this works. - .set_expiration( + .set_expiration_time(None) // Just to assert this works. + .set_expiration_time( Some(crate::types::Duration::weeks(52).unwrap().into())) .generate().unwrap(); assert_eq!(cert.clone().into_packet_pile().children().count(), diff --git a/tool/src/commands/key.rs b/tool/src/commands/key.rs index dc9807d7..2a9e9cf0 100644 --- a/tool/src/commands/key.rs +++ b/tool/src/commands/key.rs @@ -41,7 +41,7 @@ pub fn generate(m: &ArgMatches, force: bool) -> failure::Fallible<()> { match m.value_of("expiry") { Some(expiry) if expiry == "never" => - builder = builder.set_expiration(None), + builder = builder.set_expiration_time(None), Some(expiry) => { let mut expiry = expiry.chars().peekable(); @@ -102,13 +102,13 @@ pub fn generate(m: &ArgMatches, force: bool) -> failure::Fallible<()> { junk, count, factor)); } - builder = builder.set_expiration( + builder = builder.set_expiration_time( Some(std::time::Duration::new(even_off(count * factor), 0))); } // Not specified. Use the default. None => { - builder = builder.set_expiration( + builder = builder.set_expiration_time( Some(std::time::Duration::new(even_off(3 * SECONDS_IN_YEAR), 0)) ); } |