Type Alias did::pallet::Module

source ·
pub type Module<T> = Pallet<T>;
👎Deprecated: use Pallet instead
Expand description

Type alias to Pallet, to be used by construct_runtime.

Generated by pallet attribute macro.

Aliased Type§

struct Module<T>(/* private fields */);

Implementations§

source§

impl<T: Config> Pallet<T>where T::AccountId: AsRef<[u8; 32]> + From<[u8; 32]>,

source

pub fn create( origin: OriginFor<T>, details: Box<DidCreationDetails<DidIdentifierOf<T>, AccountIdOf<T>, <T as Config>::MaxNewKeyAgreementKeys, DidEndpoint<T>>>, signature: DidSignature ) -> DispatchResult

Store a new DID on chain, after verifying that the creation operation has been signed by the KILT account associated with the identifier of the DID being created and that a DID with the same identifier has not previously existed on (and then deleted from) the chain.

There must be no DID information stored on chain under the same DID identifier.

The new keys added with this operation are stored under the DID identifier along with the block number in which the operation was executed.

The dispatch origin can be any KILT account with enough funds to execute the extrinsic and it does not have to be tied in any way to the KILT account identifying the DID subject.

Emits DidCreated.

  • The transaction’s complexity is mainly dependent on the number of new key agreement keys and the number of new service endpoints included in the operation.

Weight: O(K) + O(N) where K is the number of new key agreement keys bounded by MaxNewKeyAgreementKeys, while N is the number of new service endpoints bounded by MaxNumberOfServicesPerDid.

  • Reads: [Origin Account], Did, DidBlacklist
  • Writes: Did (with K new key agreement keys), ServiceEndpoints (with N new service endpoints), DidEndpointsCount
source

pub fn set_authentication_key( origin: OriginFor<T>, new_key: DidVerificationKey<AccountIdOf<T>> ) -> DispatchResult

Update the DID authentication key.

The old key is deleted from the set of public keys if it is not used in any other part of the DID. The new key is added to the set of public keys.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn set_delegation_key( origin: OriginFor<T>, new_key: DidVerificationKey<AccountIdOf<T>> ) -> DispatchResult

Set or update the DID delegation key.

If an old key existed, it is deleted from the set of public keys if it is not used in any other part of the DID. The new key is added to the set of public keys.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn remove_delegation_key(origin: OriginFor<T>) -> DispatchResult

Remove the DID delegation key.

The old key is deleted from the set of public keys if it is not used in any other part of the DID.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn set_attestation_key( origin: OriginFor<T>, new_key: DidVerificationKey<AccountIdOf<T>> ) -> DispatchResult

Set or update the DID attestation key.

If an old key existed, it is deleted from the set of public keys if it is not used in any other part of the DID. The new key is added to the set of public keys.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn remove_attestation_key(origin: OriginFor<T>) -> DispatchResult

Remove the DID attestation key.

The old key is deleted from the set of public keys if it is not used in any other part of the DID.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn add_key_agreement_key( origin: OriginFor<T>, new_key: DidEncryptionKey ) -> DispatchResult

Add a single new key agreement key to the DID.

The new key is added to the set of public keys.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn remove_key_agreement_key( origin: OriginFor<T>, key_id: KeyIdOf<T> ) -> DispatchResult

Remove a DID key agreement key from both its set of key agreement keys and as well as its public keys.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn add_service_endpoint( origin: OriginFor<T>, service_endpoint: DidEndpoint<T> ) -> DispatchResult

Add a new service endpoint under the given DID.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], Did, ServiceEndpoints, DidEndpointsCount
  • Writes: Did, ServiceEndpoints, DidEndpointsCount
source

pub fn remove_service_endpoint( origin: OriginFor<T>, service_id: ServiceEndpointId<T> ) -> DispatchResult

Remove the service with the provided ID from the DID.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidUpdated.

Weight: O(1)

  • Reads: [Origin Account], ServiceEndpoints, DidEndpointsCount
  • Writes: Did, ServiceEndpoints, DidEndpointsCount
source

pub fn delete(origin: OriginFor<T>, endpoints_to_remove: u32) -> DispatchResult

Delete a DID from the chain and all information associated with it, after verifying that the delete operation has been signed by the DID subject using the authentication key currently stored on chain.

The referenced DID identifier must be present on chain before the delete operation is evaluated.

After it is deleted, a DID with the same identifier cannot be re-created ever again.

As the result of the deletion, all traces of the DID are removed from the storage, which results in the invalidation of all attestations issued by the DID subject.

The dispatch origin must be a DID origin proxied via the submit_did_call extrinsic.

Emits DidDeleted.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Kills: Did entry associated to the DID identifier
source

pub fn reclaim_deposit( origin: OriginFor<T>, did_subject: DidIdentifierOf<T>, endpoints_to_remove: u32 ) -> DispatchResult

Reclaim a deposit for a DID. This will delete the DID and all information associated with it, after verifying that the caller is the owner of the deposit.

The referenced DID identifier must be present on chain before the delete operation is evaluated.

After it is deleted, a DID with the same identifier cannot be re-created ever again.

As the result of the deletion, all traces of the DID are removed from the storage, which results in the invalidation of all attestations issued by the DID subject.

Emits DidDeleted.

Weight: O(1)

  • Reads: [Origin Account], Did
  • Kills: Did entry associated to the DID identifier
source

pub fn submit_did_call( origin: OriginFor<T>, did_call: Box<DidAuthorizedCallOperation<DidIdentifierOf<T>, DidCallableOf<T>, BlockNumberFor<T>, AccountIdOf<T>, u64>>, signature: DidSignature ) -> DispatchResultWithPostInfo

Proxy a dispatchable call of another runtime extrinsic that supports a DID origin.

The referenced DID identifier must be present on chain before the operation is dispatched.

A call submitted through this extrinsic must be signed with the right DID key, depending on the call. This information is provided by the DidAuthorizedCallOperation parameter, which specifies the DID subject acting as the origin of the call, the DID’s tx counter (nonce), the dispatchable to call in case signature verification succeeds, the type of DID key to use to verify the operation signature, and the block number the operation was targeting for inclusion, when it was created and signed.

In case the signature is incorrect, the nonce is not valid, the required key is not present for the specified DID, or the block specified is too old the verification fails and the call is not dispatched. Otherwise, the call is properly dispatched with a DidOrigin origin indicating the DID subject.

A successful dispatch operation results in the tx counter associated with the given DID to be incremented, to mitigate replay attacks.

The dispatch origin can be any KILT account with enough funds to execute the extrinsic and it does not have to be tied in any way to the KILT account identifying the DID subject.

Emits DidCallDispatched.

Weight: O(1) + weight of the dispatched call

  • Reads: [Origin Account], Did
  • Writes: Did
source

pub fn change_deposit_owner(origin: OriginFor<T>) -> DispatchResult

Changes the deposit owner.

The balance that is reserved by the current deposit owner will be freed and balance of the new deposit owner will get reserved.

The subject of the call must be the did owner. The sender of the call will be the new deposit owner.

source

pub fn update_deposit( origin: OriginFor<T>, did: DidIdentifierOf<T> ) -> DispatchResult

Updates the deposit amount to the current deposit rate.

The sender must be the deposit owner.

source

pub fn dispatch_as( origin: OriginFor<T>, did_identifier: DidIdentifierOf<T>, call: Box<DidCallableOf<T>> ) -> DispatchResultWithPostInfo

Proxy a dispatchable call of another runtime extrinsic that supports a DID origin.

The referenced DID identifier must be present on chain before the operation is dispatched.

A call submitted through this extrinsic must be signed with the right DID key, depending on the call. In contrast to the submit_did_call extrinsic, this call doesn’t separate the sender from the DID subject. The key that must be used for this DID call is required to also be a valid account with enough balance to pay for fees.

The dispatch origin must be a KILT account with enough funds to execute the extrinsic and must correspond to the required DID Verification Key.

Emits DidCallDispatched.

source

pub fn create_from_account( origin: OriginFor<T>, authentication_key: DidVerificationKey<AccountIdOf<T>> ) -> DispatchResult

Store a new DID on chain.

The DID identifier is derived from the account ID that submits this call. The authentication key must correspond to the account ID that submitted this call. For accounts that use the ed25519 and sr25519 schema, the authentication key must be of the DidVerificationKey::Ed25519 or DidVerificationKey::Sr25519 variant and contains the public key. For Ecdsa accounts, the DidVerificationKey::Ecdsa variant is calculated by hashing the Ecdsa public key.

If this call is dispatched by an account id that doesn’t correspond to a public private key pair, the DidVerificationKey::Account variant shall be used (Multisig, Pure Proxy, Governance origins). The resulting DID can NOT be used for signing data and is therefore limited to onchain activities.

There must be no DID information stored on chain under the same DID identifier. This call will fail if there exists a DID with the same identifier or if a DID with the same identifier existed and was deleted.

The origin for this account must be funded and provide the required deposit and fee.

Emits DidCreated.

source§

impl<T: Config> Pallet<T>where T::AccountId: AsRef<[u8; 32]> + From<[u8; 32]>,

source

pub fn try_insert_did( did_identifier: DidIdentifierOf<T>, did_entry: DidDetails<T>, sender: AccountIdOf<T> ) -> DispatchResult

Try creating a DID.

Errors
  • When the DID was deleted, this function returns a AlreadyDeleted error.
  • When the DID already exists, this function returns a AlreadyExists error.
  • When the sender doesn’t have enough free balance, this function returns a UnableToPayFees error.
source

pub fn try_update_did( did_identifier: &DidIdentifierOf<T>, did_details: DidDetails<T> ) -> DispatchResult

Try updating the DID.

Errors

This can fail when the deposit owner doesn’t have enough free balance.

source

pub fn verify_did_operation_signature_and_increase_nonce( operation: &DidAuthorizedCallOperationWithVerificationRelationship<T>, signature: &DidSignature ) -> Result<(), DidError>

Verify the validity (i.e., nonce, signature and mortality) of a DID-authorized operation and, if valid, update the DID state with the latest nonce.

source

pub fn verify_account_authorization( did_identifier: &DidIdentifierOf<T>, submitter_account: &AccountIdOf<T>, verification_key_relationship: DidVerificationKeyRelationship ) -> Result<(), DidError>

Verify that account is authorized to dispatch DID calls on behave of did_identifier.

Errors

This function returns an error if the did was not found, the verification key was not found or the account didn’t match the verification key.

source

pub fn verify_payload_signature_with_did_key_type( payload: &Payload, signature: &DidSignature, did_details: &DidDetails<T>, key_type: DidVerificationKeyRelationship ) -> Result<(), DidError>

Verify a generic payload signature using a given DID verification key type.

source

pub fn delete_did( did_subject: DidIdentifierOf<T>, endpoints_to_remove: u32 ) -> DispatchResult

Deletes DID details from storage, including its linked service endpoints, adds the identifier to the blacklisted DIDs and frees the deposit.

source§

impl<T: Config> Pallet<T>

source

pub fn get_did<KArg>(k: KArg) -> Option<DidDetails<T>>where KArg: EncodeLike<DidIdentifierOf<T>>,

An auto-generated getter for Did.

source§

impl<T: Config> Pallet<T>

source

pub fn get_service_endpoints<KArg1, KArg2>( k1: KArg1, k2: KArg2 ) -> Option<DidEndpoint<T>>where KArg1: EncodeLike<DidIdentifierOf<T>>, KArg2: EncodeLike<ServiceEndpointId<T>>,

An auto-generated getter for ServiceEndpoints.

source§

impl<T: Config> Pallet<T>

source

pub fn get_deleted_did<KArg>(k: KArg) -> Option<()>where KArg: EncodeLike<DidIdentifierOf<T>>,

An auto-generated getter for DidBlacklist.

Trait Implementations§

source§

impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>

source§

fn before_all_runtime_migrations() -> Weight

Something that should happen before runtime migrations are executed.
source§

impl<T> Benchmarking for Pallet<T>where T: Config + Config, T::DidIdentifier: From<AccountId32>, <T as Config>::RuntimeOrigin: From<RawOrigin<T::DidIdentifier>>, <T as Config>::AccountId: From<AccountId32>, <T as Config>::Currency: Mutate<T::AccountId>, T::AccountId: AsRef<[u8; 32]> + From<[u8; 32]>,

source§

fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>

Get the benchmarks available for this pallet. Generally there is one benchmark per extrinsic, so these are sometimes just called “extrinsics”. Read more
source§

fn run_benchmark( extrinsic: &[u8], c: &[(BenchmarkParameter, u32)], whitelist: &[TrackedStorageKey], verify: bool, internal_repeats: u32 ) -> Result<Vec<BenchmarkResult>, BenchmarkError>

Run the benchmarks for this pallet.
source§

impl<T: Config> Callable<T> for Pallet<T>where T::AccountId: AsRef<[u8; 32]> + From<[u8; 32]>,

source§

impl<T> Clone for Pallet<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Pallet<T>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Config> GetStorageVersion for Pallet<T>

§

type CurrentStorageVersion = StorageVersion

This will be filled out by the pallet macro. Read more
source§

fn current_storage_version() -> Self::CurrentStorageVersion

Returns the current storage version as supported by the pallet.
source§

fn on_chain_storage_version() -> StorageVersion

Returns the on-chain storage version of the pallet as stored in the storage.
source§

impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn try_state(_n: BlockNumberFor<T>) -> Result<(), TryRuntimeError>

Execute the sanity checks of this pallet, per block. Read more
§

fn on_initialize(_n: BlockNumber) -> Weight

Block initialization hook. This is called at the very beginning of block execution. Read more
§

fn on_finalize(_n: BlockNumber)

Block finalization hook. This is called at the very end of block execution. Read more
§

fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight

Hook to consume a block’s idle time. This will run when the block is being finalized (before [Hooks::on_finalize]). Read more
§

fn on_runtime_upgrade() -> Weight

Hook executed when a code change (aka. a “runtime upgrade”) is detected by FRAME. Read more
§

fn pre_upgrade() -> Result<Vec<u8, Global>, DispatchError>

Execute some pre-checks prior to a runtime upgrade. Read more
§

fn post_upgrade(_state: Vec<u8, Global>) -> Result<(), DispatchError>

Execute some post-checks after a runtime upgrade. Read more
§

fn offchain_worker(_n: BlockNumber)

Implementing this function on a pallet allows you to perform long-running tasks that are dispatched as separate threads, and entirely independent of the main wasm runtime. Read more
§

fn integrity_test()

Check the integrity of this pallet’s configuration. Read more
source§

impl<T: Config> IntegrityTest for Pallet<T>

source§

fn integrity_test()

See [Hooks::integrity_test].
source§

impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn offchain_worker(n: BlockNumberFor<T>)

This function is being called after every block import (when fully synced). Read more
source§

impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_finalize(n: BlockNumberFor<T>)

See [Hooks::on_finalize].
source§

impl<T: Config> OnGenesis for Pallet<T>

source§

fn on_genesis()

Something that should happen at genesis.
source§

impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight

See [Hooks::on_idle].
source§

impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn on_initialize(n: BlockNumberFor<T>) -> Weight

See [Hooks::on_initialize].
source§

impl<T: Config> OnRuntimeUpgrade for Pallet<T>

source§

fn on_runtime_upgrade() -> Weight

See [Hooks::on_runtime_upgrade].
source§

fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError>

See [Hooks::pre_upgrade].
source§

fn post_upgrade(state: Vec<u8>) -> Result<(), TryRuntimeError>

See [Hooks::post_upgrade].
§

fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>

The expected and default behavior of this method is to handle executing pre_upgrade -> on_runtime_upgrade -> post_upgrade hooks for a migration. Read more
source§

impl<T: Config> PalletInfoAccess for Pallet<T>

source§

fn index() -> usize

Index of the pallet as configured in the runtime.
source§

fn name() -> &'static str

Name of the pallet as configured in the runtime.
source§

fn name_hash() -> [u8; 16]

Two128 hash of name.
source§

fn module_name() -> &'static str

Name of the Rust module containing the pallet.
source§

fn crate_version() -> CrateVersion

Version of the crate containing the pallet.
source§

impl<T: Config> PalletsInfoAccess for Pallet<T>

source§

fn count() -> usize

The number of pallets’ information that this type represents. Read more
source§

fn infos() -> Vec<PalletInfoData>

All of the pallets’ information that this type represents.
source§

impl<T> PartialEq<Pallet<T>> for Pallet<T>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Config> StorageInfoTrait for Pallet<T>

source§

fn storage_info() -> Vec<StorageInfo>

source§

impl<T: Config> TryDecodeEntireStorage for Pallet<T>

source§

fn try_decode_entire_state() -> Result<usize, Vec<TryDecodeEntireStorageError>>

Decode the entire data under the given storage, returning Ok(bytes_decoded) if success.
source§

impl<T: Config> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

source§

fn try_state( n: BlockNumberFor<T>, _s: TryStateSelect ) -> Result<(), TryRuntimeError>

Execute the state checks.
source§

impl<T: Config> WhitelistedStorageKeys for Pallet<T>

source§

fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>

Returns a Vec<TrackedStorageKey> indicating the storage keys that should be whitelisted during benchmarking. This means that those keys will be excluded from the benchmarking performance calculation.
source§

impl<T> Eq for Pallet<T>