pub struct DisclosureSelection { /* private fields */ }Expand description
Selection of which claims to reveal, hide, or prove predicates about.
Used by CredentialPresenter::present() to control selective disclosure.
§Examples
use baseid_core::claims::{DisclosureSelection, ClaimDisclosure, PredicateType};
use serde_json::json;
let disclosure = DisclosureSelection::new()
.set("given_name", ClaimDisclosure::Reveal)
.set("family_name", ClaimDisclosure::Reveal)
.set("birth_date", ClaimDisclosure::Predicate(
PredicateType::LessThan(json!("2008-03-01"))
))
.set("address", ClaimDisclosure::Hide);Implementations§
Source§impl DisclosureSelection
impl DisclosureSelection
Sourcepub fn set(self, name: &str, disclosure: ClaimDisclosure) -> Self
pub fn set(self, name: &str, disclosure: ClaimDisclosure) -> Self
Set disclosure for a claim in the default namespace.
Sourcepub fn set_namespaced(
self,
namespace: &str,
name: &str,
disclosure: ClaimDisclosure,
) -> Self
pub fn set_namespaced( self, namespace: &str, name: &str, disclosure: ClaimDisclosure, ) -> Self
Set disclosure for a claim in a specific namespace.
Sourcepub fn predicate(self, name: &str, predicate: PredicateType) -> Self
pub fn predicate(self, name: &str, predicate: PredicateType) -> Self
Convenience: set a predicate for a claim in the default namespace.
Sourcepub fn get(&self, namespace: &str, name: &str) -> Option<&ClaimDisclosure>
pub fn get(&self, namespace: &str, name: &str) -> Option<&ClaimDisclosure>
Get the disclosure selection for a claim.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &str, &ClaimDisclosure)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &str, &ClaimDisclosure)>
Iterate over all selections grouped by namespace.
Sourcepub fn has_predicates(&self) -> bool
pub fn has_predicates(&self) -> bool
Returns true if any selection uses a predicate.
Sourcepub fn revealed_claims(&self) -> Vec<&str>
pub fn revealed_claims(&self) -> Vec<&str>
Returns all claims marked as Reveal in the default namespace.
Returns all claims marked as Hide in the default namespace.
Trait Implementations§
Source§impl Clone for DisclosureSelection
impl Clone for DisclosureSelection
Source§fn clone(&self) -> DisclosureSelection
fn clone(&self) -> DisclosureSelection
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 DisclosureSelection
impl Debug for DisclosureSelection
Source§impl Default for DisclosureSelection
impl Default for DisclosureSelection
Source§fn default() -> DisclosureSelection
fn default() -> DisclosureSelection
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DisclosureSelection
impl<'de> Deserialize<'de> for DisclosureSelection
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 PartialEq for DisclosureSelection
impl PartialEq for DisclosureSelection
Source§impl Serialize for DisclosureSelection
impl Serialize for DisclosureSelection
impl StructuralPartialEq for DisclosureSelection
Auto Trait Implementations§
impl Freeze for DisclosureSelection
impl RefUnwindSafe for DisclosureSelection
impl Send for DisclosureSelection
impl Sync for DisclosureSelection
impl Unpin for DisclosureSelection
impl UnwindSafe for DisclosureSelection
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