Skip to content

Commit

Permalink
Rename to_bytes() to digest()
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Nov 15, 2022
1 parent 8c0a179 commit 60ed098
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ impl KeyAuthorization {
/// This can be used for TLS-ALPN-01 challenge responses.
///
/// <https://datatracker.ietf.org/doc/html/rfc8737#section-3>
pub fn to_bytes(&self) -> impl AsRef<[u8]> {
pub fn digest(&self) -> impl AsRef<[u8]> {
digest(&SHA256, self.0.as_bytes())
}

/// Get the base64-encoded SHA256 digest of the key authorization
///
/// This can be used for DNS-01 challenge responses.
pub fn dns_value(&self) -> String {
base64::encode_config(self.to_bytes(), URL_SAFE_NO_PAD)
base64::encode_config(self.digest(), URL_SAFE_NO_PAD)
}
}

Expand Down

0 comments on commit 60ed098

Please sign in to comment.