Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/issuance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,9 @@ impl Signed {
&self.signature
}

/// Constructs a `Signed` from a byte array containing an `IssueAuthSig` in raw bytes.
pub fn from_data(data: &[u8]) -> Self {
Signed {
signature: IssueAuthSig::decode(data).unwrap(),
}
/// Constructs a `Signed` from an `IssueAuthSig`.
pub fn from_sig(signature: IssueAuthSig<ZSASchnorr>) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to call this function new rather than from_sig.
I prefer if it is the first function in the impl Signed block.

Signed { signature }
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/issuance_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl IssueAuthSig<ZSASchnorr> {
/// defined in [ZIP 227][issueauthsig].
///
/// [issueauthsig]: https://zips.z.cash/zip-0227#issuance-authorization-signing-and-validation
pub(crate) fn encode(&self) -> Vec<u8> {
pub fn encode(&self) -> Vec<u8> {
let sig_bytes = self.0.to_bytes().to_vec();
let mut encoded =
Vec::with_capacity(size_of_val(&ZSASchnorr::ALGORITHM_BYTE) + sig_bytes.len());
Expand All @@ -228,7 +228,7 @@ impl IssueAuthSig<ZSASchnorr> {
/// in [ZIP 227][issueauthsig].
///
/// [issueauthsig]: https://zips.z.cash/zip-0227#issuance-authorization-signing-and-validation
pub(crate) fn decode(bytes: &[u8]) -> Result<Self, Error> {
pub fn decode(bytes: &[u8]) -> Result<Self, Error> {
if let Some((&algorithm_byte, key_bytes)) = bytes.split_first() {
if algorithm_byte == ZSASchnorr::ALGORITHM_BYTE {
return schnorr::Signature::try_from(key_bytes)
Expand Down
Loading