Struct dock_core_rpc::did::Pallet
pub struct Pallet<T>(_);
Expand description
The pallet implementing the on-chain logic.
Implementations§
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn is_offchain_did(did: &Did) -> Result<bool, Error<T>>
pub fn offchain_did_details(
did: &Did
) -> Result<OffChainDidDetails<T>, Error<T>>
pub fn offchain_did_details( did: &Did ) -> Result<OffChainDidDetails<T>, Error<T>>
Get DID detail of an off-chain DID. Throws error if DID does not exist or is on-chain.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn is_onchain_did(did: &Did) -> Result<bool, Error<T>>
pub fn onchain_did_details(
did: &Did
) -> Result<WithNonce<T, OnChainDidDetails>, Error<T>>
pub fn onchain_did_details( did: &Did ) -> Result<WithNonce<T, OnChainDidDetails>, Error<T>>
Get DID detail of an on-chain DID. Throws error if DID does not exist or is off-chain.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn ensure_controller(
controlled: &Did,
controller: &Controller
) -> Result<(), Error<T>>
pub fn ensure_controller( controlled: &Did, controller: &Controller ) -> Result<(), Error<T>>
Throws an error if controller
is not the controller of controlled
pub fn is_controller(controlled: &Did, controller: &Controller) -> bool
pub fn is_controller(controlled: &Did, controller: &Controller) -> bool
Returns true if given controlled
DID is controlled by the controller
DID.
pub fn is_self_controlled(did: &Did) -> bool
pub fn is_self_controlled(did: &Did) -> bool
Returns true if DID controls itself, else false.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn aggregate_did_details(
did: &Did,
params: AggregatedDidDetailsRequestParams
) -> Option<AggregatedDidDetailsResponse<T>>
pub fn aggregate_did_details( did: &Did, params: AggregatedDidDetailsRequestParams ) -> Option<AggregatedDidDetailsResponse<T>>
Request aggregated DID details containing specified information.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn new_offchain(
origin: <T as Config>::Origin,
did: Did,
did_doc_ref: OffChainDidDocRef<T>
) -> Result<(), DispatchError>
pub fn new_offchain( origin: <T as Config>::Origin, did: Did, did_doc_ref: OffChainDidDocRef<T> ) -> Result<(), DispatchError>
Creates a new offchain DID (Decentralized Identifier) entry.
This function is used to create a new offchain DID entry by providing a reference to an offchain DID document.
Parameters
origin
: The origin of the call, which determines who is making the request.did
: The decentralized identifier (DID) that uniquely identifies the entity.did_doc_ref
: The new reference to the offchain DID document. It can be one of the following:CID
: A Content Identifier as per multiformats/cid.URL
: A URL pointing to the DID document.Custom
: A custom encoding of the reference.
pub fn set_offchain_did_doc_ref(
origin: <T as Config>::Origin,
did: Did,
did_doc_ref: OffChainDidDocRef<T>
) -> Result<(), DispatchError>
pub fn set_offchain_did_doc_ref( origin: <T as Config>::Origin, did: Did, did_doc_ref: OffChainDidDocRef<T> ) -> Result<(), DispatchError>
Updates the offchain DID document reference for an existing DID.
This function is used to set or update the reference to the offchain DID document for a given DID. The offchain DID document reference can be one of the following types: CID, URL, or Custom.
Parameters
origin
: The origin of the call, which determines who is making the request and their permissions.did
: The decentralized identifier (DID) that uniquely identifies the entity whose DID document reference is being updated.did_doc_ref
: The new reference to the offchain DID document. It can be one of the following:CID
: A Content Identifier as per multiformats/cid.URL
: A URL pointing to the DID document.Custom
: A custom encoding of the reference.
pub fn remove_offchain_did(
origin: <T as Config>::Origin,
did: Did
) -> Result<(), DispatchError>
pub fn remove_offchain_did( origin: <T as Config>::Origin, did: Did ) -> Result<(), DispatchError>
Removes an existing offchain DID entry.
This function is used to remove an offchain DID entry from the system. This operation deletes the DID and its associated offchain DID document reference.
Parameters
origin
: The origin of the call, which determines who is making the request and their permissions.did
: The decentralized identifier (DID) that uniquely identifies the entity to be removed.
pub fn new_onchain(
origin: <T as Config>::Origin,
did: Did,
keys: Vec<UncheckedDidKey, Global>,
controllers: BTreeSet<Controller, Global>
) -> Result<(), DispatchError>
pub fn new_onchain( origin: <T as Config>::Origin, did: Did, keys: Vec<UncheckedDidKey, Global>, controllers: BTreeSet<Controller, Global> ) -> Result<(), DispatchError>
Create new DID.
At least 1 control key or 1 controller must be provided.
If any supplied key has an empty ver_rel
, then it will use all verification relationships available for its key type.
pub fn add_keys(
origin: <T as Config>::Origin,
keys: AddKeys<T>,
sig: DidOrDidMethodKeySignature<Controller>
) -> Result<(), DispatchError>
pub fn add_keys( origin: <T as Config>::Origin, keys: AddKeys<T>, sig: DidOrDidMethodKeySignature<Controller> ) -> Result<(), DispatchError>
Add more keys from DID doc. Does not check if the key was already added.
pub fn remove_keys(
origin: <T as Config>::Origin,
keys: RemoveKeys<T>,
sig: DidOrDidMethodKeySignature<Controller>
) -> Result<(), DispatchError>
pub fn remove_keys( origin: <T as Config>::Origin, keys: RemoveKeys<T>, sig: DidOrDidMethodKeySignature<Controller> ) -> Result<(), DispatchError>
Remove keys from DID doc. This is an atomic operation meaning that it will either remove all keys or do nothing. Note that removing all keys might make DID unusable.
pub fn add_controllers(
origin: <T as Config>::Origin,
controllers: AddControllers<T>,
sig: DidOrDidMethodKeySignature<Controller>
) -> Result<(), DispatchError>
pub fn add_controllers( origin: <T as Config>::Origin, controllers: AddControllers<T>, sig: DidOrDidMethodKeySignature<Controller> ) -> Result<(), DispatchError>
Add new controllers to the signer DID. Does not require provided controllers to
- have any key
- exist on- or off-chain
pub fn remove_controllers(
origin: <T as Config>::Origin,
controllers: RemoveControllers<T>,
sig: DidOrDidMethodKeySignature<Controller>
) -> Result<(), DispatchError>
pub fn remove_controllers( origin: <T as Config>::Origin, controllers: RemoveControllers<T>, sig: DidOrDidMethodKeySignature<Controller> ) -> Result<(), DispatchError>
Remove controllers from the signer DID. This is an atomic operation meaning that it will either remove all keys or do nothing. Note that removing all controllers might make DID unusable.
pub fn add_service_endpoint(
origin: <T as Config>::Origin,
service_endpoint: AddServiceEndpoint<T>,
sig: DidOrDidMethodKeySignature<Controller>
) -> Result<(), DispatchError>
pub fn add_service_endpoint( origin: <T as Config>::Origin, service_endpoint: AddServiceEndpoint<T>, sig: DidOrDidMethodKeySignature<Controller> ) -> Result<(), DispatchError>
Add a single service endpoint to the signer DID.
pub fn remove_service_endpoint(
origin: <T as Config>::Origin,
service_endpoint: RemoveServiceEndpoint<T>,
sig: DidOrDidMethodKeySignature<Controller>
) -> Result<(), DispatchError>
pub fn remove_service_endpoint( origin: <T as Config>::Origin, service_endpoint: RemoveServiceEndpoint<T>, sig: DidOrDidMethodKeySignature<Controller> ) -> Result<(), DispatchError>
Remove a single service endpoint.
pub fn remove_onchain_did(
origin: <T as Config>::Origin,
removal: DidRemoval<T>,
sig: DidOrDidMethodKeySignature<Controller>
) -> Result<(), DispatchError>
pub fn remove_onchain_did( origin: <T as Config>::Origin, removal: DidRemoval<T>, sig: DidOrDidMethodKeySignature<Controller> ) -> Result<(), DispatchError>
Remove the on-chain DID along with its keys, controllers, service endpoints and BBS+ keys. Other DID-controlled entities won’t be removed. However, the authorization logic ensures that once a DID is removed, it loses its ability to control any DID.
pub fn new_did_method_key(
origin: <T as Config>::Origin,
did_key: DidMethodKey
) -> Result<(), DispatchError>
pub fn new_did_method_key( origin: <T as Config>::Origin, did_key: DidMethodKey ) -> Result<(), DispatchError>
Adds an on-chain state storing the nonce for the provided DID method key. After this state is set, this DID method key will be able to submit a DID transaction.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn did<KArg>(k: KArg) -> Option<StoredDidDetails<T>>where
KArg: EncodeLike<Did>,
pub fn did<KArg>(k: KArg) -> Option<StoredDidDetails<T>>where KArg: EncodeLike<Did>,
Stores details of off-chain and on-chain DIDs
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn did_method_key<KArg>(k: KArg) -> Option<WithNonce<T, ()>>where
KArg: EncodeLike<DidMethodKey>,
pub fn did_method_key<KArg>(k: KArg) -> Option<WithNonce<T, ()>>where KArg: EncodeLike<DidMethodKey>,
Stores nonce for did:key
DIDs.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn bound_controller<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> Option<()>where
KArg1: EncodeLike<Did>,
KArg2: EncodeLike<Controller>,
pub fn bound_controller<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> Option<()>where KArg1: EncodeLike<Did>, KArg2: EncodeLike<Controller>,
Stores controlled - controller pairs of a DID as (DID, DID) -> zero-sized record. If a record exists, then the controller is bound.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn did_service_endpoint<KArg1, KArg2>(
k1: KArg1,
k2: KArg2
) -> Option<ServiceEndpoint<T>>where
KArg1: EncodeLike<Did>,
KArg2: EncodeLike<ServiceEndpointId<T>>,
pub fn did_service_endpoint<KArg1, KArg2>( k1: KArg1, k2: KArg2 ) -> Option<ServiceEndpoint<T>>where KArg1: EncodeLike<Did>, KArg2: EncodeLike<ServiceEndpointId<T>>,
Stores service endpoints of a DID as (DID, endpoint id) -> ServiceEndpoint.
§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where T: Config,
pub fn storage_version() -> StorageVersion
Trait Implementations§
§impl<T> GetStorageVersion for Pallet<T>where
T: Config,
impl<T> GetStorageVersion for Pallet<T>where T: Config,
§fn current_storage_version() -> StorageVersion
fn current_storage_version() -> StorageVersion
§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
§impl<T> Hooks<<T as Config>::BlockNumber> for Pallet<T>where
T: Config,
impl<T> Hooks<<T as Config>::BlockNumber> for Pallet<T>where T: Config,
§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
on_finalize
).
Implement to have something happen using the remaining weight.
Will not fire if the remaining weight is 0.
Return the weight used, the hook will subtract it from current weight used
and pass the result to the next on_idle
hook if it exists.§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
§fn integrity_test()
fn integrity_test()
§impl<T> IntegrityTest for Pallet<T>where
T: Config,
impl<T> IntegrityTest for Pallet<T>where T: Config,
§fn integrity_test()
fn integrity_test()
§impl<T> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>where
T: Config,
impl<T> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>where T: Config,
§fn offchain_worker(n: <T as Config>::BlockNumber)
fn offchain_worker(n: <T as Config>::BlockNumber)
§impl<T> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>where
T: Config,
impl<T> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>where T: Config,
§fn on_finalize(n: <T as Config>::BlockNumber)
fn on_finalize(n: <T as Config>::BlockNumber)
§impl<T> OnGenesis for Pallet<T>where
T: Config,
impl<T> OnGenesis for Pallet<T>where T: Config,
§fn on_genesis()
fn on_genesis()
§impl<T> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>where
T: Config,
impl<T> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>where T: Config,
§fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
§impl<T> OnRuntimeUpgrade for Pallet<T>where
T: Config,
impl<T> OnRuntimeUpgrade for Pallet<T>where T: Config,
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
§impl<T> PalletInfoAccess for Pallet<T>where
T: Config,
impl<T> PalletInfoAccess for Pallet<T>where T: Config,
§fn module_name() -> &'static str
fn module_name() -> &'static str
§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
§impl<T> StorageInfoTrait for Pallet<T>where
T: Config,
impl<T> StorageInfoTrait for Pallet<T>where T: Config,
fn storage_info() -> Vec<StorageInfo, Global> ⓘ
impl<T> Eq for Pallet<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Pallet<T>where T: RefUnwindSafe,
impl<T> Send for Pallet<T>where T: Send,
impl<T> Sync for Pallet<T>where T: Sync,
impl<T> Unpin for Pallet<T>where T: Unpin,
impl<T> UnwindSafe for Pallet<T>where T: UnwindSafe,
Blanket Implementations§
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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> 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>
§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T> PalletVersionToStorageVersionHelper for Twhere
T: GetStorageVersion + PalletInfoAccess,
impl<T> PalletVersionToStorageVersionHelper for Twhere T: GetStorageVersion + PalletInfoAccess,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T
. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.