referrerpolicy=no-referrer-when-downgrade

Trait AddOnlyPeopleTrait

Source
pub trait AddOnlyPeopleTrait {
    type Member: Parameter + MaxEncodedLen;
    type Secret;

    // Required methods
    fn reserve_new_id() -> PersonalId;
    fn renew_id_reservation(
        personal_id: PersonalId,
    ) -> Result<(), DispatchError>;
    fn cancel_id_reservation(
        personal_id: PersonalId,
    ) -> Result<(), DispatchError>;
    fn recognize_personhood(
        who: PersonalId,
        maybe_key: Option<Self::Member>,
    ) -> Result<(), DispatchError>;
    fn mock_key(who: PersonalId) -> (Self::Member, Self::Secret);
}
Expand description

Trait to recognize people and handle personal id.

PersonalId goes through multiple state: free, reserved, used; a used personal id can belong to a recognized person or a suspended person.

Required Associated Types§

Required Methods§

Source

fn reserve_new_id() -> PersonalId

Reserve a new id for a future person. This id is not recognized, not reserved, and has never been reserved in the past.

Source

fn renew_id_reservation(personal_id: PersonalId) -> Result<(), DispatchError>

Renew a reservation for a personal id. The id is not recognized, but has been reserved in the past.

An error is returned if the id is used or wasn’t reserved before.

Source

fn cancel_id_reservation(personal_id: PersonalId) -> Result<(), DispatchError>

Cancel the reservation for a personal id

An error is returned if the id wasn’t reserved in the first place.

Source

fn recognize_personhood( who: PersonalId, maybe_key: Option<Self::Member>, ) -> Result<(), DispatchError>

Recognized a person.

The personal id must be reserved or the person must have already been recognized and suspended in the past. If recognizing a new person, a key must be provided. If resuming the personhood then no key must be provided.

An error is returned if:

  • maybe_key is some and the personal id was not reserved or is used by a recognized or suspended person.
  • maybe_key is none and the personal id was not recognized before.
Source

fn mock_key(who: PersonalId) -> (Self::Member, Self::Secret)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AddOnlyPeopleTrait for ()

Implementors§

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