RelayId: Display the ID type on redacted identities.
Formerly we would display just the first characters of the identity, without telling you what kind of ID it was.
This commit is contained in:
parent
a6ce079d4a
commit
a542a3e93f
|
@ -208,10 +208,9 @@ impl Redactable for RelayId {
|
|||
|
||||
impl<'a> Redactable for RelayIdRef<'a> {
|
||||
fn display_redacted(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
use std::fmt::Display as _;
|
||||
match self {
|
||||
RelayIdRef::Ed25519(k) => k.redacted().fmt(f),
|
||||
RelayIdRef::Rsa(k) => k.redacted().fmt(f),
|
||||
RelayIdRef::Ed25519(k) => write!(f, "ed25519:{}", k.redacted()),
|
||||
RelayIdRef::Rsa(k) => write!(f, "${}", k.redacted()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -343,6 +343,6 @@ mod test {
|
|||
.rsa_identity([45; 20].into());
|
||||
let ids = builder.build().unwrap();
|
||||
assert_eq!(format!("{}", ids), "ed25519:KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio $2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d");
|
||||
assert_eq!(format!("{}", ids.redacted()), "Ki…");
|
||||
assert_eq!(format!("{}", ids.redacted()), "ed25519:Ki…");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue