Struct ockam::IdentityState
source · [−]pub struct IdentityState<V> where
V: IdentityVault, { /* private fields */ }
Expand description
Identity implementation
Implementations
sourceimpl<V> IdentityState<V> where
V: IdentityVault,
impl<V> IdentityState<V> where
V: IdentityVault,
sourcepub fn new(
identifier: IdentityIdentifier,
change_events: Vec<IdentityChangeEvent, Global>,
contacts: HashMap<IdentityIdentifier, Contact, RandomState, Global>,
vault: V,
rng: impl RngCore + CryptoRng + Clone
) -> IdentityState<V>
pub fn new(
identifier: IdentityIdentifier,
change_events: Vec<IdentityChangeEvent, Global>,
contacts: HashMap<IdentityIdentifier, Contact, RandomState, Global>,
vault: V,
rng: impl RngCore + CryptoRng + Clone
) -> IdentityState<V>
Identity constructor
pub fn has_lease(&self) -> bool
pub fn lease(&self) -> Option<&Lease>
sourceimpl<V> IdentityState<V> where
V: IdentityVault,
impl<V> IdentityState<V> where
V: IdentityVault,
pub async fn identifier(&'_ self) -> Result<IdentityIdentifier, Error>
pub async fn create_key(&'_ mut self, label: String) -> Result<(), Error>
pub async fn add_key(
&'_ mut self,
label: String,
secret: &'_ Secret
) -> Result<(), Error>
pub async fn rotate_root_secret_key(&'_ mut self) -> Result<(), Error>
sourcepub async fn get_root_secret_key(&'_ self) -> Result<Secret, Error>
pub async fn get_root_secret_key(&'_ self) -> Result<Secret, Error>
Get Secret
key. Key is uniquely identified by label in KeyAttributes
pub async fn get_secret_key(&'_ self, label: String) -> Result<Secret, Error>
pub async fn get_root_public_key(&'_ self) -> Result<PublicKey, Error>
pub async fn get_public_key(&'_ self, label: String) -> Result<PublicKey, Error>
sourcepub async fn create_auth_proof(
&'_ mut self,
channel_state: &'_ [u8]
) -> Result<Vec<u8, Global>, Error>
pub async fn create_auth_proof(
&'_ mut self,
channel_state: &'_ [u8]
) -> Result<Vec<u8, Global>, Error>
Generate Proof of possession of [Identity
].
channel_state should be tied to channel’s cryptographical material (e.g. h value for Noise XX)
sourcepub async fn verify_auth_proof(
&'_ mut self,
channel_state: &'_ [u8],
responder_contact_id: &'_ IdentityIdentifier,
proof: &'_ [u8]
) -> Result<bool, Error>
pub async fn verify_auth_proof(
&'_ mut self,
channel_state: &'_ [u8],
responder_contact_id: &'_ IdentityIdentifier,
proof: &'_ [u8]
) -> Result<bool, Error>
Verify Proof of possession of [Identity
] with given IdentityIdentifier
.
channel_state should be tied to channel’s cryptographical material (e.g. h value for Noise XX)
pub async fn add_change(
&'_ mut self,
change_event: IdentityChangeEvent
) -> Result<(), Error>
pub async fn get_changes(
&'_ self
) -> Result<Vec<IdentityChangeEvent, Global>, Error>
sourcepub async fn verify_changes(&'_ mut self) -> Result<bool, Error>
pub async fn verify_changes(&'_ mut self) -> Result<bool, Error>
Verify whole event chain of current [Identity
]
pub async fn get_contacts(&'_ self) -> Result<Vec<Contact, Global>, Error>
pub async fn as_contact(&'_ mut self) -> Result<Contact, Error>
pub async fn get_contact(
&'_ mut self,
id: &'_ IdentityIdentifier
) -> Result<Option<Contact>, Error>
pub async fn verify_contact(
&'_ mut self,
contact: Contact
) -> Result<bool, Error>
pub async fn verify_and_add_contact(
&'_ mut self,
contact: Contact
) -> Result<bool, Error>
pub async fn verify_and_update_contact(
&'_ mut self,
contact_id: &'_ IdentityIdentifier,
change_events: &'_ [IdentityChangeEvent]
) -> Result<bool, Error>
pub async fn get_lease(
&'_ self,
_lease_manager_route: &'_ Route,
_org_id: String,
_bucket: String,
_ttl: usize
) -> Result<Lease, Error>
pub async fn revoke_lease(
&'_ mut self,
_lease_manager_route: &'_ Route,
lease: Lease
) -> Result<(), Error>
Auto Trait Implementations
impl<V> RefUnwindSafe for IdentityState<V> where
V: RefUnwindSafe,
impl<V> Send for IdentityState<V>
impl<V> Sync for IdentityState<V>
impl<V> Unpin for IdentityState<V> where
V: Unpin,
impl<V> UnwindSafe for IdentityState<V> where
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more