@refinio/one.models
    Preparing search index...

    Application of CertificateRoleModel for relation certificates.

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructor for the RelationRoleModel

      Parameters

      • leuteModel: default

        The leute model

      • roleApp: string

        The app of the role

      • roleRelation: string

        The relation of the role

      • Optionalconfig: {
            filterSharedWith?: (personId: SHA256IdHash<Person>) => boolean;
            propagateRolePersonCertificatesToOthers?: boolean;
            propagateRolePersonInstancesToOthers?: boolean;
            roleGroupName?: string;
            trusted?: boolean | ((personId: SHA256IdHash<Person>) => boolean);
        } & RoleConfig & RelationRoleConfig

        The config of the role

      Returns default

    Properties

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

    Methods

    • Create a certificate

      Parameters

      • personId: SHA256IdHash<Person>

        The person Id

      • OptionalissuerId: SHA256IdHash<Person>

        The issuer id

      Returns Promise<
          {
              certificate: UnversionedObjectResult<RelationCertificate>;
              license: UnversionedObjectResult<License>;
              signature: UnversionedObjectResult<Signature>;
          },
      >

      The certificate

    • Get the issuer person id from the role certificate

      Parameters

      • data: OneObjectTypes

        The role certificate

      Returns Promise<undefined | SHA256IdHash<Person>>

      The issuer person id

    • Get the signature hash for a person

      Parameters

      • personId: SHA256IdHash<Person>

        The person id

      Returns Promise<undefined | SHA256Hash[]>

      The signature hash

    • 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.

    • Check if the person has a certificate

      Parameters

      • personId: SHA256IdHash<Person>

        The person id

      Returns Promise<boolean>

      True if the person has a certificate, false otherwise

    • Check if the person has multiple certificates

      Parameters

      • personId: SHA256IdHash<Person>

        The person id

      Returns Promise<boolean>

      True if the person has multiple certificates, 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.

    • Check if the person is an issuer

      Parameters

      • personId: SHA256IdHash<Person>

        The person id

      Returns Promise<boolean>

      True if the person is an issuer or no issuers are set, false otherwise

    • Check if the certificate is a role relation certificate

      Parameters

      • data: OneObjectTypes

        The certificate

      • OptionalrolePersonId: SHA256IdHash<Person>

        The role person id

      Returns Promise<boolean>

      True if the certificate is a role relation certificate, false otherwise

    • Checks if the person is a role person.

      Parameters

      • OptionalpersonId: SHA256IdHash<Person>

        The personId to check. Default is the current person.

      Returns Promise<boolean>

      True if the person is a role person, false otherwise.

    • Set the role person

      Parameters

      • personId: SHA256IdHash<Person>

        The person id

      • OptionalissuerPersonId: SHA256IdHash<Person>

        The issuer person id

      Returns Promise<void>

    • Share the issuers with the person ids

      Parameters

      • rolePersonId: SHA256IdHash<Person>

        The role person id

      • shareWithPersonIds: SHA256IdHash<Person>[]

        The person ids to share with

      Returns Promise<void>

    • Shares the role with the given person ids.

      Parameters

      • shareWithPersonIds: SHA256IdHash<Person>[]

        The person ids to share with.

      • options: { forcePropagate?: boolean; rolePersonId?: SHA256IdHash<Person> } = {}
        • OptionalforcePropagate?: boolean

          Whether to force the role person id from options.rolePersonId to propagate. Default is false.

        • OptionalrolePersonId?: SHA256IdHash<Person>

          The role person id. Default is the current person.

      Returns Promise<void>