pub struct OnChainIdentity { /* private fields */ }
Expand description
An on-chain entity that wraps a DID Document.
Implementations§
Source§impl OnChainIdentity
impl OnChainIdentity
Sourcepub fn id(&self) -> ObjectID
pub fn id(&self) -> ObjectID
Returns the [ObjectID
] of this OnChainIdentity
.
Sourcepub fn did_document(&self) -> &IotaDocument
pub fn did_document(&self) -> &IotaDocument
Returns the IotaDocument
contained in this OnChainIdentity
.
Returns true if this OnChainIdentity
is shared between multiple controllers.
Sourcepub fn proposals(&self) -> &HashSet<ObjectID>
pub fn proposals(&self) -> &HashSet<ObjectID>
Returns this OnChainIdentity
’s list of active proposals.
Sourcepub fn controllers(&self) -> &HashMap<ObjectID, u64>
pub fn controllers(&self) -> &HashMap<ObjectID, u64>
Returns this OnChainIdentity
’s controllers as the map: controller_id -> controller_voting_power
.
Sourcepub fn threshold(&self) -> u64
pub fn threshold(&self) -> u64
Returns the threshold required by this OnChainIdentity
for executing a proposal.
Sourcepub fn controller_voting_power(&self, controller_id: ObjectID) -> Option<u64>
pub fn controller_voting_power(&self, controller_id: ObjectID) -> Option<u64>
Returns the voting power of controller with ID controller_id
, if any.
Sourcepub fn update_did_document(
&mut self,
updated_doc: IotaDocument,
) -> ProposalBuilder<'_, UpdateDidDocument>
pub fn update_did_document( &mut self, updated_doc: IotaDocument, ) -> ProposalBuilder<'_, UpdateDidDocument>
Updates this OnChainIdentity
’s DID Document.
Sourcepub fn update_config(&mut self) -> ProposalBuilder<'_, ConfigChange>
pub fn update_config(&mut self) -> ProposalBuilder<'_, ConfigChange>
Updates this OnChainIdentity
’s configuration.
Sourcepub fn deactivate_did(&mut self) -> ProposalBuilder<'_, DeactivateDid>
pub fn deactivate_did(&mut self) -> ProposalBuilder<'_, DeactivateDid>
Deactivates the DID Document represented by this OnChainIdentity
.
Sourcepub fn upgrade_version(&mut self) -> ProposalBuilder<'_, Upgrade>
pub fn upgrade_version(&mut self) -> ProposalBuilder<'_, Upgrade>
Upgrades this OnChainIdentity
’s version to match the package’s.
Sourcepub fn send_assets(&mut self) -> ProposalBuilder<'_, SendAction>
pub fn send_assets(&mut self) -> ProposalBuilder<'_, SendAction>
Sends assets owned by this OnChainIdentity
to other addresses.
Sourcepub fn borrow_assets(&mut self) -> ProposalBuilder<'_, BorrowAction>
pub fn borrow_assets(&mut self) -> ProposalBuilder<'_, BorrowAction>
Borrows assets owned by this OnChainIdentity
to use them in a custom transaction.
Sourcepub fn controller_execution(
&mut self,
controller_cap: ObjectID,
) -> ProposalBuilder<'_, ControllerExecution>
pub fn controller_execution( &mut self, controller_cap: ObjectID, ) -> ProposalBuilder<'_, ControllerExecution>
Borrows a ControllerCap
with ID controller_cap
owned by this identity in a transaction.
This proposal is used to perform operation on a sub-identity controlled
by this one.
Sourcepub async fn get_history(
&self,
client: &IdentityClientReadOnly,
last_version: Option<&IotaObjectData>,
page_size: Option<usize>,
) -> Result<Vec<IotaObjectData>, Error>
pub async fn get_history( &self, client: &IdentityClientReadOnly, last_version: Option<&IotaObjectData>, page_size: Option<usize>, ) -> Result<Vec<IotaObjectData>, Error>
Returns historical data for this OnChainIdentity
.
Methods from Deref<Target = IotaDocument>§
Sourcepub fn controller(&self) -> impl Iterator<Item = &IotaDID>
pub fn controller(&self) -> impl Iterator<Item = &IotaDID>
Returns an iterator yielding the DID controllers.
Sourcepub fn also_known_as(&self) -> &OrderedSet<Url>
pub fn also_known_as(&self) -> &OrderedSet<Url>
Returns a reference to the alsoKnownAs
set.
Sourcepub fn core_document(&self) -> &CoreDocument
pub fn core_document(&self) -> &CoreDocument
Returns a reference to the underlying CoreDocument
.
Sourcepub fn properties(&self) -> &BTreeMap<String, Value>
pub fn properties(&self) -> &BTreeMap<String, Value>
Returns a reference to the custom DID Document properties.
Sourcepub fn service(&self) -> &OrderedSet<Service>
pub fn service(&self) -> &OrderedSet<Service>
Return a set of all Service
s in the document.
Sourcepub fn methods(&self, scope: Option<MethodScope>) -> Vec<&VerificationMethod>
pub fn methods(&self, scope: Option<MethodScope>) -> Vec<&VerificationMethod>
Returns a Vec
of verification method references whose verification relationship matches scope
.
If scope
is None
, all embedded methods are returned.
Sourcepub fn resolve_service<'query, 'me, Q>(
&'me self,
service_query: Q,
) -> Option<&'me Service>where
Q: Into<DIDUrlQuery<'query>>,
pub fn resolve_service<'query, 'me, Q>(
&'me self,
service_query: Q,
) -> Option<&'me Service>where
Q: Into<DIDUrlQuery<'query>>,
Returns the first Service
with an id
property matching the provided service_query
, if present.
Sourcepub fn resolve_method<'query, 'me, Q>(
&'me self,
method_query: Q,
scope: Option<MethodScope>,
) -> Option<&'me VerificationMethod>where
Q: Into<DIDUrlQuery<'query>>,
pub fn resolve_method<'query, 'me, Q>(
&'me self,
method_query: Q,
scope: Option<MethodScope>,
) -> Option<&'me VerificationMethod>where
Q: Into<DIDUrlQuery<'query>>,
Returns the first VerificationMethod
with an id
property matching the
provided method_query
and the verification relationship specified by scope
if present.
Sourcepub fn verify_jws<'jws, T>(
&self,
jws: &'jws Jws,
detached_payload: Option<&'jws [u8]>,
signature_verifier: &T,
options: &JwsVerificationOptions,
) -> Result<DecodedJws<'jws>, Error>where
T: JwsVerifier,
pub fn verify_jws<'jws, T>(
&self,
jws: &'jws Jws,
detached_payload: Option<&'jws [u8]>,
signature_verifier: &T,
options: &JwsVerificationOptions,
) -> Result<DecodedJws<'jws>, Error>where
T: JwsVerifier,
Decodes and verifies the provided JWS according to the passed JwsVerificationOptions
and
JwsVerifier
.
Regardless of which options are passed the following conditions must be met in order for a verification attempt to take place.
- The JWS must be encoded according to the JWS compact serialization.
- The
kid
value in the protected header must be an identifier of a verification method in this DID document.
Trait Implementations§
Source§impl Debug for OnChainIdentity
impl Debug for OnChainIdentity
Source§impl Deref for OnChainIdentity
impl Deref for OnChainIdentity
Source§type Target = IotaDocument
type Target = IotaDocument
Source§impl MoveType for OnChainIdentity
impl MoveType for OnChainIdentity
fn get_typed_value(&self, _package: ObjectID) -> TypedValue<'_, Self>
Source§impl Serialize for OnChainIdentity
impl Serialize for OnChainIdentity
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for OnChainIdentity
impl RefUnwindSafe for OnChainIdentity
impl Send for OnChainIdentity
impl Sync for OnChainIdentity
impl Unpin for OnChainIdentity
impl UnwindSafe for OnChainIdentity
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read more§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> ConvertTo<T> for Twhere
T: Send,
impl<T> ConvertTo<T> for Twhere
T: Send,
fn convert(self) -> Result<T, Error>
fn convert_unchecked(self) -> T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a Request
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.Source§impl<T> ToJson for Twhere
T: Serialize,
impl<T> ToJson for Twhere
T: Serialize,
Source§fn to_json_value(&self) -> Result<Value, Error>
fn to_json_value(&self) -> Result<Value, Error>
self
as a serde_json::Value
.