Skip to content

Commit cd7d5bf

Browse files
committed
signature: rename Signature::as_slice -> Signature::as_bytes
1 parent f2b4c27 commit cd7d5bf

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

signature/src/signature.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@ use crate::{
1111
verifier::{DigestVerifier, Verifier},
1212
};
1313

14-
/// Trait impl'd by concrete types that represent digital signatures
14+
/// Trait impl'd by concrete types that represent digital signatures.
15+
///
16+
/// Signature types *must* (as mandated by the `AsRef<[u8]>` bound) be a thin
17+
/// wrapper around the "bag-of-bytes" serialized form of a signature which can
18+
/// be directly parsed from or written to the "wire".
19+
///
20+
/// For signature systems which require a more advanced internal representation
21+
/// (e.g. involving decoded scalars or decompressed elliptic curve points) it's
22+
/// recommended that "provider" libraries maintain their own internal signature
23+
/// type and use `From` bounds to provide automatic conversions.
1524
pub trait Signature: AsRef<[u8]> + Debug + Sized {
1625
/// Parse a signature from its byte representation
1726
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>;
1827

19-
/// Borrow this signature as serialized bytes
20-
fn as_slice(&self) -> &[u8] {
28+
/// Borrow a byte slice representing the serialized form of this signature
29+
fn as_bytes(&self) -> &[u8] {
2130
self.as_ref()
2231
}
2332
}

0 commit comments

Comments
 (0)