pub struct PartialTranscript { /* private fields */ }Expand description
A partial transcript.
A partial transcript is a transcript which may not have all the data authenticated.
Only authenticated data is stored: the bytes, and the set of ranges they occupy. The total length of each direction is also carried, but when the transcript comes from a peer it is untrusted — it is only ever compared against a caller-provided length, never used to size an allocation.
Implementations§
Source§impl PartialTranscript
impl PartialTranscript
Sourcepub fn sent_authed(&self) -> &RangeSet<usize>
pub fn sent_authed(&self) -> &RangeSet<usize>
Returns the index of sent data which have been authenticated.
Sourcepub fn received_authed(&self) -> &RangeSet<usize>
pub fn received_authed(&self) -> &RangeSet<usize>
Returns the index of received data which have been authenticated.
Sourcepub fn len_received(&self) -> usize
pub fn len_received(&self) -> usize
Returns the total length of the received data.
Sourcepub fn union_transcript(&mut self, other: &PartialTranscript)
pub fn union_transcript(&mut self, other: &PartialTranscript)
Unions the authenticated data of another compressed transcript into this one.
Where both transcripts authenticate the same position, self takes
precedence.
§Panics
Panics if the transcripts are not the same length.
Sourcepub fn union_subsequence(&mut self, direction: Direction, seq: &Subsequence)
pub fn union_subsequence(&mut self, direction: Direction, seq: &Subsequence)
Unions an authenticated subsequence into this transcript.
Where the subsequence overlaps already authenticated data, the subsequence takes precedence.
§Panics
Panics if the subsequence is out of bounds of the transcript.
Sourcepub fn sent_unsafe(
&self,
expected: usize,
) -> Result<Vec<u8>, InvalidTranscriptLength>
pub fn sent_unsafe( &self, expected: usize, ) -> Result<Vec<u8>, InvalidTranscriptLength>
Returns the sent data, materialized to expected bytes.
§Warning
Only the positions in sent_authed
have been authenticated; every other position is 0.
The allocation is sized by expected, a length the caller trusts (for
example the length recorded by the Verifier, or a signed
TranscriptLength), never by the
length carried by this transcript. Returns an error if expected does
not match the length carried by this transcript.
Sourcepub fn received_unsafe(
&self,
expected: usize,
) -> Result<Vec<u8>, InvalidTranscriptLength>
pub fn received_unsafe( &self, expected: usize, ) -> Result<Vec<u8>, InvalidTranscriptLength>
Returns the received data, materialized to expected bytes.
§Warning
Only the positions in
received_authed have been
authenticated; every other position is 0.
The allocation is sized by expected, a length the caller trusts, never
by the length carried by this transcript. Returns an error if expected
does not match the length carried by this transcript.
Source§impl PartialTranscript
impl PartialTranscript
Sourcepub fn new(sent_len: usize, received_len: usize) -> Self
pub fn new(sent_len: usize, received_len: usize) -> Self
Creates a new partial transcript initialized to all 0s.
§Arguments
sent_len- The length of the sent data.received_len- The length of the received data.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns whether the transcript is complete.
Sourcepub fn contains(&self, direction: Direction, idx: &RangeSet<usize>) -> bool
pub fn contains(&self, direction: Direction, idx: &RangeSet<usize>) -> bool
Returns whether the index is in bounds of the transcript.
Sourcepub fn sent_unauthed(&self) -> RangeSet<usize>
pub fn sent_unauthed(&self) -> RangeSet<usize>
Returns the index of sent data which haven’t been authenticated.
Sourcepub fn received_unauthed(&self) -> RangeSet<usize>
pub fn received_unauthed(&self) -> RangeSet<usize>
Returns the index of received data which haven’t been authenticated.
Trait Implementations§
Source§impl Clone for PartialTranscript
impl Clone for PartialTranscript
Source§impl Debug for PartialTranscript
impl Debug for PartialTranscript
Source§impl<'de> Deserialize<'de> for PartialTranscript
impl<'de> Deserialize<'de> for PartialTranscript
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PartialTranscript
impl RefUnwindSafe for PartialTranscript
impl Send for PartialTranscript
impl Sync for PartialTranscript
impl Unpin for PartialTranscript
impl UnsafeUnpin for PartialTranscript
impl UnwindSafe for PartialTranscript
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)