pub struct VerifierBuilder { /* private fields */ }Expand description
Chainable builder for creating a SelfAgentVerifier.
§Example
use self_agent_sdk::{NetworkName, SelfAgentVerifier};
let verifier = SelfAgentVerifier::create()
.network(NetworkName::Testnet)
.require_age(18)
.require_ofac()
.require_nationality(&["US", "GB"])
.rate_limit(10, 100)
.build();Implementations§
Source§impl VerifierBuilder
impl VerifierBuilder
Sourcepub fn network(self, name: NetworkName) -> Self
pub fn network(self, name: NetworkName) -> Self
Set the network: Mainnet or Testnet.
Sourcepub fn require_age(self, n: u64) -> Self
pub fn require_age(self, n: u64) -> Self
Require the agent’s human to be at least n years old.
Sourcepub fn require_ofac(self) -> Self
pub fn require_ofac(self) -> Self
Require OFAC screening passed.
Sourcepub fn require_nationality(self, codes: &[&str]) -> Self
pub fn require_nationality(self, codes: &[&str]) -> Self
Require nationality in the given list of ISO country codes.
Sourcepub fn require_self_provider(self) -> Self
pub fn require_self_provider(self) -> Self
Require Self Protocol as proof provider (default: on).
Sourcepub fn sybil_limit(self, n: u64) -> Self
pub fn sybil_limit(self, n: u64) -> Self
Max agents per human (default: 1). Set to 0 to disable sybil check.
Sourcepub fn rate_limit(self, per_minute: u32, per_hour: u32) -> Self
pub fn rate_limit(self, per_minute: u32, per_hour: u32) -> Self
Enable in-memory per-agent rate limiting.
Sourcepub fn replay_protection(self) -> Self
pub fn replay_protection(self) -> Self
Enable replay protection (default: on).
Sourcepub fn include_credentials(self) -> Self
pub fn include_credentials(self) -> Self
Include ZK credentials in verification result.
Sourcepub fn build(self) -> SelfAgentVerifier
pub fn build(self) -> SelfAgentVerifier
Build the SelfAgentVerifier instance.
Automatically enables include_credentials when any credential
requirement is set (age, OFAC, nationality).
Trait Implementations§
Source§impl Default for VerifierBuilder
impl Default for VerifierBuilder
Source§fn default() -> VerifierBuilder
fn default() -> VerifierBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for VerifierBuilder
impl RefUnwindSafe for VerifierBuilder
impl Send for VerifierBuilder
impl Sync for VerifierBuilder
impl Unpin for VerifierBuilder
impl UnsafeUnpin for VerifierBuilder
impl UnwindSafe for VerifierBuilder
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> 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