Delegation nodes are used within the KILT protocol to construct the trust hierarchy.

Starting from the root node, entities can delegate the right to issue attestations to Claimers for a certain CTYPE and also delegate the right to attest and to delegate further nodes.

A delegation object is stored on-chain, and can be revoked.

A delegation can and may restrict permissions.

Permissions:

  • Delegate.
  • Attest.

Hierarchy

  • DelegationNode

Implements

Constructors

Properties

account: DidUri
hierarchyId: string
id: string
parentId?: string
permissions: number[]
revoked: boolean

Accessors

Methods

  • Checks on chain whether an identity with the given DID is delegating to the current node.

    Returns

    An object containing a node owned by the identity if it is delegating, plus the number of steps traversed. steps is 0 if the DID is owner of the current node.

    Parameters

    • dids: DidUri | DidUri[]

      A DID or an array of DIDs to search for.

    Returns Promise<{
        node: null | DelegationNode;
        steps: number;
    }>

  • Generates the delegation hash from the delegations' property values.

    This hash is signed by the delegate and later stored along with the delegation to make sure delegation data (such as permissions) has not been tampered with.

    Returns

    The hash representation of this delegation as a byte array.

    Returns Uint8Array

  • Fetches all hashes of attestations attested with this delegation node.

    Returns

    Promise containing all attestation hashes attested with this node.

    Returns Promise<`0x${string}`[]>

  • Lazily fetches the details of the hierarchy the node is part of and return its CType.

    Returns

    The CType hash associated with the delegation hierarchy.

    Returns Promise<`0x${string}`>

  • Reclaims the deposit of a delegation and removes the delegation and all its children.

    This call can only be successfully executed if the submitter of the transaction is the original payer of the delegation deposit.

    Returns

    A promise containing the unsigned SubmittableExtrinsic (submittable transaction).

    Returns Promise<SubmittableExtrinsic>

  • Revokes the delegation node on chain.

    Returns

    Promise containing an unsigned SubmittableExtrinsic.

    Parameters

    • did: DidUri

      The address of the identity used to revoke the delegation.

    Returns Promise<SubmittableExtrinsic>

  • Recursively counts all nodes that descend from the current node (excluding the current node). It is important to first refresh the state of the node from the chain.

    Returns

    Promise resolving to the node count.

    Returns Promise<number>