pub struct Cursor {
pub last_key: Vec<u8>,
pub snapshot_id: u64,
}Expand description
Decoded cursor payload. Public so callers that want the raw
last_key (e.g. for debugging or custom iteration) can inspect
it. Never construct one directly off the wire — use
Cursor::decode so the HMAC tag gets verified.
Fields§
§last_key: Vec<u8>Raw fjall storage key of the last item the previous page returned. The next page begins strictly after this key.
snapshot_id: u64Unix-second timestamp at the time of minting. Currently opaque metadata — see module docs.
Implementations§
Source§impl Cursor
impl Cursor
Sourcepub fn new(last_key: Vec<u8>, snapshot_id: u64) -> Self
pub fn new(last_key: Vec<u8>, snapshot_id: u64) -> Self
Construct a cursor for the page that ends at last_key.
Sourcepub fn encode(&self, audit_key: &[u8; 32]) -> String
pub fn encode(&self, audit_key: &[u8; 32]) -> String
Encode + sign the cursor under audit_key. Returns the
base64url-encoded wire form ready for next_cursor.
Sourcepub fn encode_bound(&self, audit_key: &[u8; 32], binding: &[u8]) -> String
pub fn encode_bound(&self, audit_key: &[u8; 32], binding: &[u8]) -> String
As Cursor::encode, but additionally binds binding into the
HMAC — without placing it on the wire.
This is how a paginated query pins the filters a cursor was minted
under. The bytes are covered by the tag but not transmitted, so the
wire format is unchanged and a caller cannot rewrite them. Resuming
with a different binding fails verification and surfaces as
AppError::InvalidCursor, which is what stops a consumer from
paging with one filter set and continuing with another — a silent
way to skip entries that must never happen on an audit log.
Callers with no binding use Cursor::encode, which passes an
empty slice and is therefore wire- and tag-compatible with cursors
minted before this method existed.
Sourcepub fn decode(wire: &str, audit_key: &[u8; 32]) -> Result<Self, AppError>
pub fn decode(wire: &str, audit_key: &[u8; 32]) -> Result<Self, AppError>
Decode + verify a wire-form cursor. Returns
AppError::InvalidCursor on any failure (malformed,
tampered, or signed under a different key) — the error
deliberately doesn’t reveal which.
Sourcepub fn decode_bound(
wire: &str,
audit_key: &[u8; 32],
binding: &[u8],
) -> Result<Self, AppError>
pub fn decode_bound( wire: &str, audit_key: &[u8; 32], binding: &[u8], ) -> Result<Self, AppError>
As Cursor::decode, but requires the cursor to have been minted
with the same binding (see Cursor::encode_bound). A mismatch
is indistinguishable from a tampered cursor and yields
AppError::InvalidCursor.
Trait Implementations§
impl Eq for Cursor
impl StructuralPartialEq for Cursor
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnsafeUnpin for Cursor
impl UnwindSafe for Cursor
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> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.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
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T.