Skip to main content

holos_tda/relative_interface/wire/
mod.rs

1mod decode;
2mod encode;
3
4use crate::certificate::{CertificateError, CertificateLimits};
5
6use super::model::RelativeInterfaceCertificate;
7
8pub(super) const MAGIC: &[u8; 8] = b"HOLOSRI\0";
9pub(super) const VERSION: u16 = 1;
10pub(super) const F64_BITS_CODEC: u8 = 1;
11
12impl RelativeInterfaceCertificate {
13    /// Encode the canonical `HOLOSRI` version 1 certificate.
14    pub fn encode(&self, limits: CertificateLimits) -> Result<Vec<u8>, CertificateError> {
15        encode::encode(self, limits)
16    }
17
18    /// Decode and verify one bounded `HOLOSRI` version 1 certificate.
19    pub fn decode(bytes: &[u8], limits: CertificateLimits) -> Result<Self, CertificateError> {
20        decode::decode(bytes, limits)
21    }
22}