Struct pallet_identity::pallet::Pallet
source · pub struct Pallet<T>(PhantomData<T>);
Expand description
The Pallet
struct, the main type that implements traits and standalone
functions within the pallet.
Tuple Fields§
§0: PhantomData<T>
Implementations§
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn create_identity(
origin: OriginFor<T>,
owner_key: T::AccountId
) -> DispatchResultWithPostInfo
pub fn create_identity( origin: OriginFor<T>, owner_key: T::AccountId ) -> DispatchResultWithPostInfo
Create an identity for an existing account
owner_key
: the public key corresponding to the identity to be created
The origin must be allowed to create an identity.
sourcepub fn confirm_identity(
origin: OriginFor<T>,
idty_name: IdtyName
) -> DispatchResultWithPostInfo
pub fn confirm_identity( origin: OriginFor<T>, idty_name: IdtyName ) -> DispatchResultWithPostInfo
Confirm the creation of an identity and give it a name
idty_name
: the name uniquely associated to this identity. Must match the validation rules defined by the runtime.
The identity must have been created using create_identity
before it can be confirmed.
sourcepub fn change_owner_key(
origin: OriginFor<T>,
new_key: T::AccountId,
new_key_sig: T::Signature
) -> DispatchResultWithPostInfo
pub fn change_owner_key( origin: OriginFor<T>, new_key: T::AccountId, new_key_sig: T::Signature ) -> DispatchResultWithPostInfo
Change identity owner key.
new_key
: the new owner key.new_key_sig
: the signature of the encoded form ofIdtyIndexAccountIdPayload
. Must be signed bynew_key
.
The origin should be the old identity owner key.
sourcepub fn revoke_identity(
origin: OriginFor<T>,
idty_index: T::IdtyIndex,
revocation_key: T::AccountId,
revocation_sig: T::Signature
) -> DispatchResultWithPostInfo
pub fn revoke_identity( origin: OriginFor<T>, idty_index: T::IdtyIndex, revocation_key: T::AccountId, revocation_sig: T::Signature ) -> DispatchResultWithPostInfo
Revoke an identity using a revocation signature
idty_index
: the index of the identity to be revoked.revocation_key
: the key used to sign the revocation payload.revocation_sig
: the signature of the encoded form ofRevocationPayload
. Must be signed byrevocation_key
.
Any signed origin can execute this call.
sourcepub fn prune_item_identities_names(
origin: OriginFor<T>,
names: Vec<IdtyName>
) -> DispatchResultWithPostInfo
pub fn prune_item_identities_names( origin: OriginFor<T>, names: Vec<IdtyName> ) -> DispatchResultWithPostInfo
Remove identity names from storage.
This function allows a privileged root origin to remove multiple identity names from storage in bulk.
origin
- The origin of the call. It must be root.names
- A vector containing the identity names to be removed from storage.
sourcepub fn fix_sufficients(
origin: OriginFor<T>,
owner_key: T::AccountId,
inc: bool
) -> DispatchResultWithPostInfo
pub fn fix_sufficients( origin: OriginFor<T>, owner_key: T::AccountId, inc: bool ) -> DispatchResultWithPostInfo
Change sufficient reference count for a given key.
This function allows a privileged root origin to increment or decrement the sufficient reference count associated with a specified owner key.
origin
- The origin of the call. It must be root.owner_key
- The account whose sufficient reference count will be modified.inc
- A boolean indicating whether to increment (true
) or decrement (false
) the count.
sourcepub fn link_account(
origin: OriginFor<T>,
account_id: T::AccountId,
payload_sig: T::Signature
) -> DispatchResultWithPostInfo
pub fn link_account( origin: OriginFor<T>, account_id: T::AccountId, payload_sig: T::Signature ) -> DispatchResultWithPostInfo
Link an account to an identity.
This function links a specified account to an identity, requiring both the account and the identity to sign the operation.
origin
- The origin of the call, which must have an associated identity index.account_id
- The account ID to link, which must sign the payload.payload_sig
- The signature with the linked identity.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn identities_count() -> u32
pub fn identities_count() -> u32
Get the number of identities.
sourcepub fn membership_added(idty_index: T::IdtyIndex)
pub fn membership_added(idty_index: T::IdtyIndex)
Handle the addition of membership to an identity.
This function is called when an identity transitions to a member status. It updates the identity’s status, unschedules any pending identity change actions, and resets the identity’s next scheduled action to zero.
sourcepub fn membership_removed(idty_index: T::IdtyIndex) -> Weight
pub fn membership_removed(idty_index: T::IdtyIndex) -> Weight
Handle the removal of membership from an identity.
This function is called when membership is revoked from an identity. It checks
if the identity is currently a member, and if so, updates its status to NotMember
.
If the identity is already revoked, this function does nothing.
sourcepub fn do_remove_identity(
idty_index: T::IdtyIndex,
reason: RemovalReason
) -> Weight
pub fn do_remove_identity( idty_index: T::IdtyIndex, reason: RemovalReason ) -> Weight
Perform the removal of an identity.
This function acts as a garbage collector for identities. It should not be called while the identity is still a member; otherwise, there will still be a membership in storage, but no more identity.
sourcepub fn do_revoke_identity(
idty_index: T::IdtyIndex,
reason: RevocationReason
) -> Weight
pub fn do_revoke_identity( idty_index: T::IdtyIndex, reason: RevocationReason ) -> Weight
Revoke an identity.
This function revokes an identity, updating its status to Revoked
and scheduling
it for removal after the specified deletion period.
sourcefn get_next_idty_index() -> T::IdtyIndex
fn get_next_idty_index() -> T::IdtyIndex
incremental counter for identity index
sourcepub fn prune_identities(block_number: BlockNumberFor<T>) -> Weight
pub fn prune_identities(block_number: BlockNumberFor<T>) -> Weight
Prune identities planned for removal at the given block number.
sourcefn update_identity_status(
idty_index: T::IdtyIndex,
idty_value: IdtyValue<BlockNumberFor<T>, T::AccountId, T::IdtyData>,
new_status: IdtyStatus,
period: BlockNumberFor<T>
)
fn update_identity_status( idty_index: T::IdtyIndex, idty_value: IdtyValue<BlockNumberFor<T>, T::AccountId, T::IdtyData>, new_status: IdtyStatus, period: BlockNumberFor<T> )
Change the identity status and reschedule the next action accordingly.
sourcefn unschedule_identity_change(
idty_id: T::IdtyIndex,
block_number: BlockNumberFor<T>
)
fn unschedule_identity_change( idty_id: T::IdtyIndex, block_number: BlockNumberFor<T> )
Unschedules the change related to an identity.
sourcefn schedule_identity_change(
idty_id: T::IdtyIndex,
period: BlockNumberFor<T>
) -> BlockNumberFor<T>
fn schedule_identity_change( idty_id: T::IdtyIndex, period: BlockNumberFor<T> ) -> BlockNumberFor<T>
Schedule an identity change after a specified period.
sourcefn check_create_identity(
issuer_key: &T::AccountId,
receiver_key: &T::AccountId,
block_number: BlockNumberFor<T>
) -> Result<T::IdtyIndex, DispatchError>
fn check_create_identity( issuer_key: &T::AccountId, receiver_key: &T::AccountId, block_number: BlockNumberFor<T> ) -> Result<T::IdtyIndex, DispatchError>
Check if creating an identity is allowed.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn identity_index_of<KArg>(k: KArg) -> Option<T::IdtyIndex>where
KArg: EncodeLike<T::AccountId>,
pub fn identity_index_of<KArg>(k: KArg) -> Option<T::IdtyIndex>where
KArg: EncodeLike<T::AccountId>,
An auto-generated getter for IdentityIndexOf
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn identity_by_did<KArg>(k: KArg) -> Option<T::IdtyIndex>where
KArg: EncodeLike<IdtyName>,
pub fn identity_by_did<KArg>(k: KArg) -> Option<T::IdtyIndex>where
KArg: EncodeLike<IdtyName>,
An auto-generated getter for IdentitiesNames
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn next_scheduled<KArg>(k: KArg) -> Vec<T::IdtyIndex>where
KArg: EncodeLike<BlockNumberFor<T>>,
pub fn next_scheduled<KArg>(k: KArg) -> Vec<T::IdtyIndex>where
KArg: EncodeLike<BlockNumberFor<T>>,
An auto-generated getter for IdentityChangeSchedule
.
Trait Implementations§
source§impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
source§impl<T> Benchmarking for Pallet<T>
impl<T> Benchmarking for Pallet<T>
source§impl<T: Config> Convert<<T as Config>::IdtyIndex, Option<<T as Config>::AccountId>> for Pallet<T>
impl<T: Config> Convert<<T as Config>::IdtyIndex, Option<<T as Config>::AccountId>> for Pallet<T>
source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
§type InCodeStorageVersion = StorageVersion
type InCodeStorageVersion = StorageVersion
source§fn in_code_storage_version() -> Self::InCodeStorageVersion
fn in_code_storage_version() -> Self::InCodeStorageVersion
storage_version
attribute, or
[NoStorageVersionSet
] if the attribute is missing.source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version
and will be removed after March 2024.Self::current_storage_version
] instead. Read moresource§impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
§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
Hooks::on_finalize
]). Read more§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive
pallet. Read more§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
§fn integrity_test()
fn integrity_test()
source§impl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
source§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].source§impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
source§impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
].source§impl<T: Config> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
source§fn on_genesis()
fn on_genesis()
source§impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
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
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
].source§impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§impl<T: Config> OnRuntimeUpgrade for Pallet<T>
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].source§impl<T: Config> PalletInfoAccess for Pallet<T>
impl<T: Config> PalletInfoAccess for Pallet<T>
source§fn module_name() -> &'static str
fn module_name() -> &'static str
source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
source§impl<T> PartialEq for Pallet<T>
impl<T> PartialEq for Pallet<T>
source§impl<T> StoredMap<<T as Config>::AccountId, <T as Config>::IdtyData> for Pallet<T>where
T: Config,
impl<T> StoredMap<<T as Config>::AccountId, <T as Config>::IdtyData> for Pallet<T>where
T: Config,
source§fn try_mutate_exists<R, E: From<DispatchError>>(
key: &T::AccountId,
f: impl FnOnce(&mut Option<T::IdtyData>) -> Result<R, E>
) -> Result<R, E>
fn try_mutate_exists<R, E: From<DispatchError>>( key: &T::AccountId, f: impl FnOnce(&mut Option<T::IdtyData>) -> Result<R, E> ) -> Result<R, E>
Mutate an account in function of its data.
source§impl<T: Config> WhitelistedStorageKeys for Pallet<T>
impl<T: Config> WhitelistedStorageKeys for Pallet<T>
source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
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.impl<T> Eq for Pallet<T>
Auto Trait Implementations§
impl<T> Freeze for Pallet<T>
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§
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> 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>,
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§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 S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.