Base class for all roles.

This class is used to create a role. Note: Each concrete role class must set the static roleName property.

Hierarchy (view full)

Constructors

Properties

onFound: OEvent<(() => void | Promise<void>)> = ...
onInitialised: OEvent<(() => void | Promise<void>)> = ...
state: StateMachine<"Uninitialised" | "Initialised", "shutdown" | "init">
roleName: string

Methods

  • Checks if the role can be created.

    Parameters

    Returns boolean | Promise<boolean>

    True if the role can be created, false otherwise.

  • Returns the name of the role.

    Returns string

    The name of the role.

  • Returns Promise<SHA256IdHash<Person>[]>

  • Checks if the data is affirmed by the role person ids.

    Parameters

    • data: SHA256Hash | SHA256IdHash

      The data to check.

    • OptionalbyPersonId: SHA256IdHash<Person>

      The personId that should be trusting the data.

    Returns Promise<boolean>

    True if the data is affirmed, false otherwise.

  • Checks if the data is signed by the role person ids.

    Parameters

    • data: SHA256Hash

      The data to check.

    • OptionalbyPersonId: SHA256IdHash<Person>

      The personId that should be signing the data.

    Returns Promise<boolean>

    True if the data is signed, false otherwise.

  • Initializes the role model.

    Returns Promise<void>

    A promise that resolves when the role model is initialised.

  • Returns true if the role is initialised.

    Returns boolean

    True if the role is initialised, false otherwise.

  • Parameters

    • OptionalpersonId: SHA256IdHash<Person>

    Returns Promise<boolean>

  • Parameters

    • personId: SHA256IdHash<Person>
    • OptionalcreatorId: SHA256IdHash<Person>

    Returns Promise<void>

  • Parameters

    • rolePersonId: SHA256IdHash<Person>
    • shareWithPersonIds: SHA256IdHash<Person>[]

    Returns Promise<void>

  • Parameters

    • shareWithPersonIds: SHA256IdHash<Person>[]
    • options: {
          forcePropagate?: boolean;
          rolePersonId?: SHA256IdHash<Person>;
      }
      • OptionalforcePropagate?: boolean
      • OptionalrolePersonId?: SHA256IdHash<Person>

    Returns Promise<void>

  • Shuts down the role model.

    Returns Promise<void>

    A promise that resolves when the role model is shut down.