use crate::crypto::HashTy;
#[derive(Debug)]
pub struct SigningOutput<S> {
hash_ty: HashTy,
signature: S,
}
impl<S> SigningOutput<S> {
#[inline]
pub fn from_signature(signature: S) -> Self {
Self { hash_ty: HashTy::default(), signature }
}
#[inline]
pub const fn new(hash_ty: HashTy, signature: S) -> Self {
Self { hash_ty, signature }
}
#[inline]
pub fn as_bytes(&self) -> SigningOutput<&[u8]>
where
S: AsRef<[u8]>,
{
SigningOutput::new(self.hash_ty, self.signature.as_ref())
}
#[inline]
pub const fn hash_ty(&self) -> HashTy {
self.hash_ty
}
#[inline]
pub const fn signature(&self) -> &S {
&self.signature
}
#[inline]
pub const fn signature_mut(&mut self) -> &mut S {
&mut self.signature
}
#[inline]
pub fn into_signature(self) -> S {
self.signature
}
}