diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-20 14:47:19 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-20 14:52:58 +0100 |
commit | 213f3204087f363c00d9ec42a48c034c6edeae1b (patch) | |
tree | d7e6e5dfe7abbd9556bd1321178f744d30c099a5 | |
parent | f0f645c7a9b6926d0c542f4a4430d0fd47859b41 (diff) |
openpgp: Rename ComponentIter::components to bindings.
- `ComponentIter::components` returns `ComponentBindings`. It is
more accurate to call it `ComponentIter::component_bindings`.
But, since it is called on a component, just use the shorter name,
`ComponentIter::bindings`.
-rw-r--r-- | net/src/wkd.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/cert.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/web-of-trust.rs | 2 | ||||
-rw-r--r-- | openpgp/src/cert/bindings.rs | 4 | ||||
-rw-r--r-- | openpgp/src/cert/component_iter.rs | 10 | ||||
-rw-r--r-- | openpgp/src/cert/mod.rs | 14 | ||||
-rw-r--r-- | openpgp/src/crypto/hash.rs | 4 | ||||
-rw-r--r-- | openpgp/src/serialize/cert.rs | 16 | ||||
-rw-r--r-- | openpgp/src/serialize/cert_armored.rs | 2 | ||||
-rw-r--r-- | tool/src/commands/inspect.rs | 2 |
10 files changed, 30 insertions, 30 deletions
diff --git a/net/src/wkd.rs b/net/src/wkd.rs index 967635d8..fd598731 100644 --- a/net/src/wkd.rs +++ b/net/src/wkd.rs @@ -235,7 +235,7 @@ fn parse_body<S: AsRef<str>>(body: &[u8], email_address: S) let valid_certs: Vec<Cert> = certs.iter() // XXX: This filter could become a Cert method, but it adds other API // method to maintain - .filter(|cert| {cert.userids().components() + .filter(|cert| {cert.userids().bindings() .any(|uidb| if let Ok(Some(a)) = uidb.userid().email() { a == email_address @@ -344,7 +344,7 @@ pub fn insert<P, S, V>(base_path: P, domain: S, variant: V, let variant = variant.into().unwrap_or_default(); // First, check which UserIDs are in `domain`. - let addresses = cert.userids().components().filter_map(|uidb| { + let addresses = cert.userids().bindings().filter_map(|uidb| { uidb.userid().email().unwrap_or(None).and_then(|addr| { if EmailAddress::from(&addr).ok().map(|e| e.domain == domain) .unwrap_or(false) diff --git a/openpgp-ffi/src/cert.rs b/openpgp-ffi/src/cert.rs index 1b4bc65d..dc62a7f1 100644 --- a/openpgp-ffi/src/cert.rs +++ b/openpgp-ffi/src/cert.rs @@ -407,7 +407,7 @@ pub extern "C" fn pgp_cert_user_id_binding_iter(cert: *const Cert) -> *mut UserIDBindingIter<'static> { let cert = cert.ref_raw(); - box_raw!(cert.userids().components()) + box_raw!(cert.userids().bindings()) } /// Frees a pgp_user_id_binding_iter_t. diff --git a/openpgp/examples/web-of-trust.rs b/openpgp/examples/web-of-trust.rs index 7ef155b1..71ddbc4f 100644 --- a/openpgp/examples/web-of-trust.rs +++ b/openpgp/examples/web-of-trust.rs @@ -38,7 +38,7 @@ fn main() { match cert { Ok(cert) => { let keyid = cert.keyid(); - for uidb in cert.userids().components() { + for uidb in cert.userids().bindings() { for tps in uidb.certifications() { for issuer in tps.get_issuers() { println!("{}, {:?}, {}", diff --git a/openpgp/src/cert/bindings.rs b/openpgp/src/cert/bindings.rs index a5493a8b..bbcec352 100644 --- a/openpgp/src/cert/bindings.rs +++ b/openpgp/src/cert/bindings.rs @@ -169,7 +169,7 @@ impl UserID { /// let bob = bob.merge_packets(vec![certificate.into()])?; /// /// // Check that we have a certification on the userid. - /// assert_eq!(bob.userids().components().nth(0).unwrap() + /// assert_eq!(bob.userids().bindings().nth(0).unwrap() /// .certifications().len(), 1); /// # Ok(()) } pub fn certify<S, H, T>(&self, signer: &mut dyn Signer, cert: &Cert, @@ -310,7 +310,7 @@ impl UserAttribute { /// let bob = bob.merge_packets(vec![certificate.into()])?; /// /// // Check that we have a certification on the userid. - /// assert_eq!(bob.user_attributes().components().nth(0).unwrap() + /// assert_eq!(bob.user_attributes().bindings().nth(0).unwrap() /// .certifications().len(), /// 1); /// # Ok(()) } diff --git a/openpgp/src/cert/component_iter.rs b/openpgp/src/cert/component_iter.rs index de62285b..063d1ab8 100644 --- a/openpgp/src/cert/component_iter.rs +++ b/openpgp/src/cert/component_iter.rs @@ -149,12 +149,12 @@ impl<'a, C> ComponentIter<'a, C> .map(|c| ComponentAmalgamation::new(self.cert, (c.0).0, t)) } - /// Changes the iterator to return components. + /// Changes the iterator to return component bindings. /// - /// A component is similar to a component amalgamation, but is not - /// bound to a specific time. It contains the component and all - /// relevant signatures. - pub fn components(self) -> ComponentBindingIter<'a, C> { + /// A component binding is similar to a component amalgamation, + /// but is not bound to a specific time. It contains the + /// component and all relevant signatures. + pub fn bindings(self) -> ComponentBindingIter<'a, C> { self.iter } } diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index 4b3cead3..4f3b046e 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -285,7 +285,7 @@ type UnknownBindings = ComponentBindings<Unknown>; /// for s in cert.other_revocations() { acc.push(s.clone().into()) } /// /// // UserIDs and related signatures. -/// for c in cert.userids().components() { +/// for c in cert.userids().bindings() { /// acc.push(c.userid().clone().into()); /// for s in c.self_signatures() { acc.push(s.clone().into()) } /// for s in c.certifications() { acc.push(s.clone().into()) } @@ -294,7 +294,7 @@ type UnknownBindings = ComponentBindings<Unknown>; /// } /// /// // UserAttributes and related signatures. -/// for c in cert.user_attributes().components() { +/// for c in cert.user_attributes().bindings() { /// acc.push(c.user_attribute().clone().into()); /// for s in c.self_signatures() { acc.push(s.clone().into()) } /// for s in c.certifications() { acc.push(s.clone().into()) } @@ -349,7 +349,7 @@ type UnknownBindings = ComponentBindings<Unknown>; /// match Cert::from_packet_parser(ppr) { /// Ok(cert) => { /// println!("Key: {}", cert.primary()); -/// for binding in cert.userids().components() { +/// for binding in cert.userids().bindings() { /// println!("User ID: {}", binding.userid()); /// } /// } @@ -2384,7 +2384,7 @@ mod test { = cert.revoked(None)); assert_eq!(cert.user_attributes().count(), 1); - let ua = cert.user_attributes().components().nth(0).unwrap(); + let ua = cert.user_attributes().bindings().nth(0).unwrap(); if revoked { assert_match!(RevocationStatus::Revoked(_) = ua.revoked(t)); @@ -2611,7 +2611,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= // than one signature. let mut cmps = 0; - for uid in neal.userids().components() { + for uid in neal.userids().bindings() { for sigs in [ uid.self_signatures(), uid.certifications(), @@ -2876,7 +2876,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= .generate().unwrap(); assert_eq!(bob.userids().len(), 1); - let bob_userid_binding = bob.userids().components().nth(0).unwrap(); + let bob_userid_binding = bob.userids().bindings().nth(0).unwrap(); assert_eq!(bob_userid_binding.userid().value(), b"bob@bar.com"); let sig_template @@ -2899,7 +2899,7 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= // Make sure the certification is merged, and put in the right // place. assert_eq!(bob.userids().len(), 1); - let bob_userid_binding = bob.userids().components().nth(0).unwrap(); + let bob_userid_binding = bob.userids().bindings().nth(0).unwrap(); assert_eq!(bob_userid_binding.userid().value(), b"bob@bar.com"); // Canonicalizing Bob's cert without having Alice's key diff --git a/openpgp/src/crypto/hash.rs b/openpgp/src/crypto/hash.rs index 685c433d..9d2ff7d2 100644 --- a/openpgp/src/crypto/hash.rs +++ b/openpgp/src/crypto/hash.rs @@ -491,7 +491,7 @@ mod test { fn hash_verification() { fn check(cert: Cert) -> (usize, usize, usize) { let mut userid_sigs = 0; - for (i, binding) in cert.userids().components().enumerate() { + for (i, binding) in cert.userids().bindings().enumerate() { for selfsig in binding.self_signatures() { let h = Signature::hash_userid_binding( selfsig, @@ -507,7 +507,7 @@ mod test { } } let mut ua_sigs = 0; - for (i, binding) in cert.user_attributes().components().enumerate() + for (i, binding) in cert.user_attributes().bindings().enumerate() { for selfsig in binding.self_signatures() { let h = Signature::hash_user_attribute_binding( diff --git a/openpgp/src/serialize/cert.rs b/openpgp/src/serialize/cert.rs index c7d572a7..52a0386b 100644 --- a/openpgp/src/serialize/cert.rs +++ b/openpgp/src/serialize/cert.rs @@ -54,7 +54,7 @@ impl Cert { serialize_sig(o, s)?; } - for u in self.userids().components() { + for u in self.userids().bindings() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -77,7 +77,7 @@ impl Cert { } } - for u in self.user_attributes().components() { + for u in self.user_attributes().bindings() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -173,7 +173,7 @@ impl SerializeInto for Cert { l += PacketRef::Signature(s).serialized_len(); } - for u in self.userids().components() { + for u in self.userids().bindings() { l += PacketRef::UserID(u.userid()).serialized_len(); for s in u.self_revocations() { @@ -190,7 +190,7 @@ impl SerializeInto for Cert { } } - for u in self.user_attributes().components() { + for u in self.user_attributes().bindings() { l += PacketRef::UserAttribute(u.user_attribute()).serialized_len(); for s in u.self_revocations() { @@ -400,7 +400,7 @@ impl<'a> TSK<'a> { serialize_sig(o, s)?; } - for u in self.cert.userids().components() { + for u in self.cert.userids().bindings() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -423,7 +423,7 @@ impl<'a> TSK<'a> { } } - for u in self.cert.user_attributes().components() { + for u in self.cert.user_attributes().bindings() { if export && ! u.self_signatures().iter().chain(u.self_revocations()).any( |s| s.exportable_certification().unwrap_or(true)) { @@ -553,7 +553,7 @@ impl<'a> SerializeInto for TSK<'a> { l += PacketRef::Signature(s).serialized_len(); } - for u in self.cert.userids().components() { + for u in self.cert.userids().bindings() { l += PacketRef::UserID(u.userid()).serialized_len(); for s in u.self_revocations() { @@ -570,7 +570,7 @@ impl<'a> SerializeInto for TSK<'a> { } } - for u in self.cert.user_attributes().components() { + for u in self.cert.user_attributes().bindings() { l += PacketRef::UserAttribute(u.user_attribute()).serialized_len(); for s in u.self_revocations() { diff --git a/openpgp/src/serialize/cert_armored.rs b/openpgp/src/serialize/cert_armored.rs index c8da915c..40c05464 100644 --- a/openpgp/src/serialize/cert_armored.rs +++ b/openpgp/src/serialize/cert_armored.rs @@ -29,7 +29,7 @@ impl Cert { pub fn armor_headers(&self) -> Vec<String> { let length_value = armor::LINE_LENGTH - "Comment: ".len(); // Create a header per userid. - let mut headers: Vec<String> = self.userids().components() + let mut headers: Vec<String> = self.userids().bindings() // Ignore revoked userids. .filter_map(|uidb| { if let RevocationStatus::Revoked(_) = uidb.revoked(None) { diff --git a/tool/src/commands/inspect.rs b/tool/src/commands/inspect.rs index c20b1bfa..d56f4503 100644 --- a/tool/src/commands/inspect.rs +++ b/tool/src/commands/inspect.rs @@ -147,7 +147,7 @@ fn inspect_cert(output: &mut dyn io::Write, cert: &openpgp::Cert, writeln!(output)?; } - for uidb in cert.userids().components() { + for uidb in cert.userids().bindings() { writeln!(output, " UserID: {}", uidb.userid())?; inspect_revocation(output, "", uidb.revoked(None))?; if let Some(sig) = uidb.binding_signature(None) { |