referrerpolicy=no-referrer-when-downgrade

Trait AddOnlyPeopleTrait

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

    // Required methods
    fn reserve_new_id() -> u64;
    fn renew_id_reservation(personal_id: u64) -> Result<(), DispatchError>;
    fn cancel_id_reservation(personal_id: u64) -> Result<(), DispatchError>;
    fn recognize_personhood(
        who: u64,
        maybe_key: Option<Self::Member>,
    ) -> Result<(), DispatchError>;
    fn mock_key(who: u64) -> (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§

type Member: Parameter + MaxEncodedLen

type Secret

Required Methods§

fn reserve_new_id() -> u64

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

fn renew_id_reservation(personal_id: u64) -> 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.

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

Cancel the reservation for a personal id

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

fn recognize_personhood( who: u64, 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.

fn mock_key(who: u64) -> (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§

§

impl AddOnlyPeopleTrait for ()

Implementors§

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