redgold_schema/
signature.rs

1use crate::structs::{Signature, SignatureType};
2use crate::{bytes_data, RgResult, SafeOption};
3
4impl Signature {
5    pub fn ecdsa(bytes: Vec<u8>) -> Self {
6        Self {
7            bytes: bytes_data(bytes),
8            signature_type: SignatureType::Ecdsa as i32,
9            rsv: None
10        }
11    }
12    pub fn hardware(bytes: Vec<u8>) -> Self {
13        Self {
14            bytes: bytes_data(bytes),
15            signature_type: SignatureType::EcdsaBitcoinSignMessageHardware as i32,
16            rsv: None
17        }
18    }
19    pub fn raw_bytes(&self) -> RgResult<Vec<u8>> {
20        Ok(self.bytes.safe_get()?.value.clone())
21    }
22}