openpgp-card-sequoia: add comments to url fns

This commit is contained in:
Heiko Schaefer 2022-11-03 15:10:15 +01:00
parent a4dff1ecb8
commit a1d6d8cad2
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D

View file

@ -430,6 +430,10 @@ impl<'a> Card<Transaction<'a>> {
// --- URL (5f50) --- // --- URL (5f50) ---
/// Get "hardholder" URL from the card.
///
/// "The URL should contain a link to a set of public keys in OpenPGP format, related to
/// the card."
pub fn url(&mut self) -> Result<String, Error> { pub fn url(&mut self) -> Result<String, Error> {
Ok(String::from_utf8_lossy(&self.state.opt.url()?).to_string()) Ok(String::from_utf8_lossy(&self.state.opt.url()?).to_string())
} }
@ -763,6 +767,10 @@ impl Card<Admin<'_, '_>> {
self.card().set_sex(sex) self.card().set_sex(sex)
} }
/// Set "hardholder" URL on the card.
///
/// "The URL should contain a link to a set of public keys in OpenPGP format, related to
/// the card."
pub fn set_url(&mut self, url: &str) -> Result<(), Error> { pub fn set_url(&mut self, url: &str) -> Result<(), Error> {
if url.chars().any(|c| !c.is_ascii()) { if url.chars().any(|c| !c.is_ascii()) {
return Err(Error::InternalError("Invalid char in url".into())); return Err(Error::InternalError("Invalid char in url".into()));