pub struct CanonicalBytes(/* private fields */);Expand description
Newtype wrapper over canonical JCS output bytes.
Construction is restricted to this crate — callers obtain a
CanonicalBytes only by routing through canonical_bytes_from_slice
(or the wrappers in vertrule-core::determinism). The type exists so
digest, signature, and receipt APIs can statically require “bytes that
came out of JCS” rather than accepting any &[u8]. Every coercion back
to &[u8] goes through the explicit Self::as_slice method — there
is no AsRef<[u8]> or Deref impl, so escapes are greppable.
The Debug impl deliberately shows the byte length and not the bytes.
Dumping raw canonical JSON into a log is a common way to accidentally
leak receipt contents; callers that want the bytes must ask for them.
Implementations§
Source§impl CanonicalBytes
impl CanonicalBytes
Sourcepub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_slice(&self) -> &[u8] ⓘ
Explicit escape hatch to a byte slice. Named so reviewers can grep
for the boundary where canonical-bytes discipline is dropped (e.g.,
feeding wire bytes to blake3::hash).
Trait Implementations§
Source§impl Clone for CanonicalBytes
impl Clone for CanonicalBytes
Source§fn clone(&self) -> CanonicalBytes
fn clone(&self) -> CanonicalBytes
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CanonicalBytes
impl Debug for CanonicalBytes
Source§impl PartialEq for CanonicalBytes
impl PartialEq for CanonicalBytes
impl Eq for CanonicalBytes
impl StructuralPartialEq for CanonicalBytes
Auto Trait Implementations§
impl Freeze for CanonicalBytes
impl RefUnwindSafe for CanonicalBytes
impl Send for CanonicalBytes
impl Sync for CanonicalBytes
impl Unpin for CanonicalBytes
impl UnsafeUnpin for CanonicalBytes
impl UnwindSafe for CanonicalBytes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.