summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-03-21 16:50:23 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-03-21 16:50:23 +0100
commit277ca54a1cd08fe7366a29f5ee635048f95cbe31 (patch)
tree69ac7bb7269278105941f27848581cd649dadcc9 /openpgp
parentfe5a468195477ffa2b70ca81349d08f591a7886a (diff)
openpgp: Rename `UserID::userid()` to `value()`.
- Fixes #224.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/examples/web-of-trust.rs2
-rw-r--r--openpgp/src/autocrypt.rs6
-rw-r--r--openpgp/src/crypto/hash.rs4
-rw-r--r--openpgp/src/packet/userid.rs2
-rw-r--r--openpgp/src/serialize/mod.rs8
-rw-r--r--openpgp/src/tpk/builder.rs2
-rw-r--r--openpgp/src/tpk/mod.rs22
-rw-r--r--openpgp/src/tsk.rs8
8 files changed, 27 insertions, 27 deletions
diff --git a/openpgp/examples/web-of-trust.rs b/openpgp/examples/web-of-trust.rs
index ee760b44..eee9fffa 100644
--- a/openpgp/examples/web-of-trust.rs
+++ b/openpgp/examples/web-of-trust.rs
@@ -43,7 +43,7 @@ fn main() {
println!("{}, {:?}, {}",
issuer.as_u64().unwrap(),
String::from_utf8_lossy(
- uidb.userid().userid()),
+ uidb.userid().value()),
keyid.as_u64().unwrap());
} else {
eprintln!("No issuer!?");
diff --git a/openpgp/src/autocrypt.rs b/openpgp/src/autocrypt.rs
index 0faa1df7..035eb58a 100644
--- a/openpgp/src/autocrypt.rs
+++ b/openpgp/src/autocrypt.rs
@@ -849,7 +849,7 @@ In the light of the Efail vulnerability I am asking myself if it's
assert_eq!(tpk.primary().fingerprint(),
Fingerprint::from_hex(
&"156962B0F3115069ACA970C68E3B03A279B772D6"[..]).unwrap());
- assert_eq!(tpk.userids().next().unwrap().userid().userid(),
+ assert_eq!(tpk.userids().next().unwrap().userid().value(),
&b"holger krekel <holger@merlinux.eu>"[..]);
@@ -872,7 +872,7 @@ In the light of the Efail vulnerability I am asking myself if it's
assert_eq!(tpk.primary().fingerprint(),
Fingerprint::from_hex(
&"D4AB192964F76A7F8F8A9B357BD18320DEADFA11"[..]).unwrap());
- assert_eq!(tpk.userids().next().unwrap().userid().userid(),
+ assert_eq!(tpk.userids().next().unwrap().userid().value(),
&b"Vincent Breitmoser <look@my.amazin.horse>"[..]);
@@ -895,7 +895,7 @@ In the light of the Efail vulnerability I am asking myself if it's
assert_eq!(tpk.primary().fingerprint(),
Fingerprint::from_hex(
&"4F9F89F5505AC1D1A260631CDB1187B9DD5F693B"[..]).unwrap());
- assert_eq!(tpk.userids().next().unwrap().userid().userid(),
+ assert_eq!(tpk.userids().next().unwrap().userid().value(),
&b"Patrick Brunschwig <patrick@enigmail.net>"[..]);
let ac2 = AutocryptHeaders::from_bytes(&PATRICK_UNFOLDED[..]).unwrap();
diff --git a/openpgp/src/crypto/hash.rs b/openpgp/src/crypto/hash.rs
index d2dcd4a9..1ccdc3e6 100644
--- a/openpgp/src/crypto/hash.rs
+++ b/openpgp/src/crypto/hash.rs
@@ -146,14 +146,14 @@ impl Hash for UserID {
let mut header = [0; 5];
header[0] = 0xB4;
- let len = self.userid().len() as u32;
+ let len = self.value().len() as u32;
header[1] = (len >> 24) as u8;
header[2] = (len >> 16) as u8;
header[3] = (len >> 8) as u8;
header[4] = (len) as u8;
hash.update(&header[..]);
- hash.update(self.userid());
+ hash.update(self.value());
}
}
diff --git a/openpgp/src/packet/userid.rs b/openpgp/src/packet/userid.rs
index eb5d9225..99cb2a0d 100644
--- a/openpgp/src/packet/userid.rs
+++ b/openpgp/src/packet/userid.rs
@@ -62,7 +62,7 @@ impl fmt::Debug for UserID {
impl UserID {
/// Gets the user ID packet's value.
- pub fn userid(&self) -> &[u8] {
+ pub fn value(&self) -> &[u8] {
self.value.as_slice()
}
}
diff --git a/openpgp/src/serialize/mod.rs b/openpgp/src/serialize/mod.rs
index 0dc6280c..b04c645d 100644
--- a/openpgp/src/serialize/mod.rs
+++ b/openpgp/src/serialize/mod.rs
@@ -1265,11 +1265,11 @@ impl SerializeKeyInto for Key {
impl Serialize for UserID {
fn serialize<W: io::Write>(&self, o: &mut W) -> Result<()> {
- let len = self.userid().len();
+ let len = self.value().len();
CTB::new(Tag::UserID).serialize(o)?;
BodyLength::Full(len as u32).serialize(o)?;
- o.write_all(self.userid())?;
+ o.write_all(self.value())?;
Ok(())
}
@@ -1277,8 +1277,8 @@ impl Serialize for UserID {
impl SerializeInto for UserID {
fn serialized_len(&self) -> usize {
- 1 + BodyLength::Full(self.userid().len() as u32).serialized_len()
- + self.userid().len()
+ 1 + BodyLength::Full(self.value().len() as u32).serialized_len()
+ + self.value().len()
}
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize> {
diff --git a/openpgp/src/tpk/builder.rs b/openpgp/src/tpk/builder.rs
index b782587a..41e6f29e 100644
--- a/openpgp/src/tpk/builder.rs
+++ b/openpgp/src/tpk/builder.rs
@@ -314,7 +314,7 @@ mod tests {
.generate().unwrap();
let mut userids = tpk.userids()
- .map(|u| String::from_utf8_lossy(u.userid.userid()).into_owned())
+ .map(|u| String::from_utf8_lossy(u.userid.value()).into_owned())
.collect::<Vec<String>>();
userids.sort();
diff --git a/openpgp/src/tpk/mod.rs b/openpgp/src/tpk/mod.rs
index ace1d19a..62ed37b4 100644
--- a/openpgp/src/tpk/mod.rs
+++ b/openpgp/src/tpk/mod.rs
@@ -2106,11 +2106,11 @@ impl TPK {
for binding in self.userids.iter_mut() {
check!(format!("userid \"{}\"",
- String::from_utf8_lossy(binding.userid.userid())),
+ String::from_utf8_lossy(binding.userid.value())),
binding, selfsigs, verify_userid_binding,
&binding.userid);
check!(format!("userid \"{}\"",
- String::from_utf8_lossy(binding.userid.userid())),
+ String::from_utf8_lossy(binding.userid.value())),
binding, self_revocations, verify_userid_revocation,
&binding.userid);
}
@@ -2171,12 +2171,12 @@ impl TPK {
for binding in self.userids.iter_mut() {
check_one!(format!("userid \"{}\"",
String::from_utf8_lossy(
- binding.userid.userid())),
+ binding.userid.value())),
binding.selfsigs, sig,
verify_userid_binding, &binding.userid);
check_one!(format!("userid \"{}\"",
String::from_utf8_lossy(
- binding.userid.userid())),
+ binding.userid.value())),
binding.self_revocations, sig,
verify_userid_revocation, &binding.userid);
}
@@ -2281,7 +2281,7 @@ impl TPK {
// one copy might be sorted to the front and the other to the
// back, and the following dedup wouldn't combine the user
// ids!
- self.userids.sort_by(|a, b| a.userid.userid().cmp(&b.userid.userid()));
+ self.userids.sort_by(|a, b| a.userid.value().cmp(&b.userid.value()));
// Then, we dedup them.
self.userids.dedup_by(|a, b| {
@@ -2401,7 +2401,7 @@ impl TPK {
}
// Fallback to a lexicographical comparison.
- a.userid.userid().cmp(&b.userid.userid())
+ a.userid.value().cmp(&b.userid.value())
});
// Sort the signatures so that the current valid
@@ -3102,7 +3102,7 @@ mod test {
i == 0).unwrap();
assert_eq!(tpk.primary.creation_time().to_pgp().unwrap(), 1511355130);
assert_eq!(tpk.userids.len(), 1);
- assert_eq!(tpk.userids[0].userid.userid(),
+ assert_eq!(tpk.userids[0].userid.value(),
&b"Testy McTestface <testy@example.org>"[..]);
assert_eq!(tpk.userids[0].selfsigs.len(), 1);
assert_eq!(tpk.userids[0].selfsigs[0].hash_prefix(),
@@ -3123,7 +3123,7 @@ mod test {
"3E8877C877274692975189F5D03F6F865226FE8B");
assert_eq!(tpk.userids.len(), 1, "number of userids");
- assert_eq!(tpk.userids[0].userid.userid(),
+ assert_eq!(tpk.userids[0].userid.value(),
&b"Testy McTestface <testy@example.org>"[..]);
assert_eq!(tpk.userids[0].selfsigs.len(), 1);
assert_eq!(tpk.userids[0].selfsigs[0].hash_prefix(),
@@ -3146,7 +3146,7 @@ mod test {
assert_eq!(tpk.user_attributes.len(), 0);
assert_eq!(tpk.userids.len(), 1, "number of userids");
- assert_eq!(tpk.userids[0].userid.userid(),
+ assert_eq!(tpk.userids[0].userid.value(),
&b"Testy McTestface <testy@example.org>"[..]);
assert_eq!(tpk.userids[0].selfsigs.len(), 1);
assert_eq!(tpk.userids[0].selfsigs[0].hash_prefix(),
@@ -3389,7 +3389,7 @@ mod test {
let tpk = TPK::from_bytes(bytes!("neal-sigs-out-of-order.pgp")).unwrap();
let mut userids = tpk.userids()
- .map(|u| String::from_utf8_lossy(u.userid.userid()).into_owned())
+ .map(|u| String::from_utf8_lossy(u.userid.value()).into_owned())
.collect::<Vec<String>>();
userids.sort();
@@ -3417,7 +3417,7 @@ mod test {
let tpk = TPK::from_bytes(bytes!("dkg-sigs-out-of-order.pgp")).unwrap();
let mut userids = tpk.userids()
- .map(|u| String::from_utf8_lossy(u.userid.userid()).into_owned())
+ .map(|u| String::from_utf8_lossy(u.userid.value()).into_owned())
.collect::<Vec<String>>();
userids.sort();
diff --git a/openpgp/src/tsk.rs b/openpgp/src/tsk.rs
index fd84fbe4..d8c1cbe3 100644
--- a/openpgp/src/tsk.rs
+++ b/openpgp/src/tsk.rs
@@ -492,7 +492,7 @@ mod tests {
.unwrap();
let userids = tsk
.userids()
- .map(|binding| binding.userid().userid())
+ .map(|binding| binding.userid().value())
.collect::<Vec<_>>();
assert_eq!(userids.len(), 2);
@@ -545,7 +545,7 @@ mod tests {
let userids = tpk
.userids()
- .map(|binding| binding.userid().userid())
+ .map(|binding| binding.userid().value())
.collect::<Vec<_>>();
assert_eq!(userids.len(), 2);
assert!((userids[0] == b"test1@example.com"
@@ -561,7 +561,7 @@ mod tests {
let userids = tpk
.userids()
- .map(|binding| binding.userid().userid())
+ .map(|binding| binding.userid().value())
.collect::<Vec<_>>();
assert_eq!(userids.len(), 1);
assert_eq!(userids[0], b"Foo");
@@ -571,7 +571,7 @@ mod tests {
let tpk = tsk.into_tpk();
let userids = tpk
.userids()
- .map(|binding| binding.userid().userid())
+ .map(|binding| binding.userid().value())
.collect::<Vec<_>>();
assert_eq!(userids.len(), 1);
assert_eq!(userids[0], b"test@example.com",