pub struct SessionNullifier { /* private fields */ }Expand description
A session nullifier for World ID Session proofs.
They are an adaptation that reuses the same proof system inputs for session flows:
- the nullifier component lets RPs detect replayed submissions for the same proof context
- the action component is randomized for session verification semantics
Together they include:
- the nullifier used as the proof output
- a random action bound to the same proof
The WorldIDVerifier.sol contract expects this as a uint256[2] array
use as_ethereum_representation() for conversion.
Implementations§
Source§impl SessionNullifier
impl SessionNullifier
Sourcepub const fn new(nullifier: FieldElement, action: FieldElement) -> Self
pub const fn new(nullifier: FieldElement, action: FieldElement) -> Self
Creates a new session nullifier.
Sourcepub const fn nullifier(&self) -> FieldElement
pub const fn nullifier(&self) -> FieldElement
Returns the nullifier value.
Sourcepub const fn action(&self) -> FieldElement
pub const fn action(&self) -> FieldElement
Returns the action value.
Sourcepub fn as_ethereum_representation(&self) -> [U256; 2]
pub fn as_ethereum_representation(&self) -> [U256; 2]
Returns the session nullifier as an Ethereum-compatible array for verifySession().
Format: [nullifier, action] matching the contract’s uint256[2] sessionNullifier.
Sourcepub fn from_ethereum_representation(value: [U256; 2]) -> Result<Self, String>
pub fn from_ethereum_representation(value: [U256; 2]) -> Result<Self, String>
Creates a session nullifier from an Ethereum representation.
§Errors
Returns an error if the U256 values are not valid field elements.
Sourcepub fn to_compressed_bytes(&self) -> [u8; 64]
pub fn to_compressed_bytes(&self) -> [u8; 64]
Returns the 64-byte big-endian representation (2 x 32-byte field elements).
Trait Implementations§
Source§impl Clone for SessionNullifier
impl Clone for SessionNullifier
Source§fn clone(&self) -> SessionNullifier
fn clone(&self) -> SessionNullifier
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionNullifier
impl Debug for SessionNullifier
Source§impl Default for SessionNullifier
impl Default for SessionNullifier
Source§impl<'de> Deserialize<'de> for SessionNullifier
impl<'de> Deserialize<'de> for SessionNullifier
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<(FieldElement, FieldElement)> for SessionNullifier
impl From<(FieldElement, FieldElement)> for SessionNullifier
Source§fn from((nullifier, action): (FieldElement, FieldElement)) -> Self
fn from((nullifier, action): (FieldElement, FieldElement)) -> Self
Converts to this type from the input type.
Source§impl From<SessionNullifier> for [U256; 2]
impl From<SessionNullifier> for [U256; 2]
Source§fn from(value: SessionNullifier) -> Self
fn from(value: SessionNullifier) -> Self
Converts to this type from the input type.
Source§impl Hash for SessionNullifier
impl Hash for SessionNullifier
Source§impl PartialEq for SessionNullifier
impl PartialEq for SessionNullifier
Source§impl Serialize for SessionNullifier
impl Serialize for SessionNullifier
impl Copy for SessionNullifier
impl Eq for SessionNullifier
impl StructuralPartialEq for SessionNullifier
Auto Trait Implementations§
impl Freeze for SessionNullifier
impl RefUnwindSafe for SessionNullifier
impl Send for SessionNullifier
impl Sync for SessionNullifier
impl Unpin for SessionNullifier
impl UnsafeUnpin for SessionNullifier
impl UnwindSafe for SessionNullifier
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
Mutably borrows from an owned value. Read more
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more