Interface to interact with DWN Records and Protocols

Constructors

  • Parameters

    • options: {
          agent: Web5Agent;
          connectedDid: string;
          delegateDid?: string;
      }
      • agent: Web5Agent
      • connectedDid: string
      • Optional delegateDid?: string

    Returns DwnApi

Properties

agent: Web5Agent

Holds the instance of a Web5Agent that represents the current execution context for the DwnApi. This agent is used to process DWN requests.

connectedDid: string

The DID of the DWN tenant under which operations are being performed.

delegateDid?: string

(optional) The DID of the signer when signing with permissions

permissionsApi: AgentPermissionsApi

Holds the instance of AgentPermissionsApi that helps when dealing with permissions protocol records

Accessors

  • get permissions(): {
        grant: ((request) => Promise<PermissionGrant>);
        queryGrants: ((request?) => Promise<PermissionGrant[]>);
        queryRequests: ((request?) => Promise<PermissionRequest[]>);
        request: ((request) => Promise<PermissionRequest>);
    }
  • Beta

    API to interact with Grants

    NOTE: This is an EXPERIMENTAL API that will change behavior.

    Currently only supports issuing requests, grants, revokes and queries on behalf without permissions or impersonation. If the agent is connected to a delegateDid, the delegateDid will be used to sign/author the underlying records. If the agent is not connected to a delegateDid, the connectedDid will be used to sign/author the underlying records.

    Returns {
        grant: ((request) => Promise<PermissionGrant>);
        queryGrants: ((request?) => Promise<PermissionGrant[]>);
        queryRequests: ((request?) => Promise<PermissionRequest[]>);
        request: ((request) => Promise<PermissionRequest>);
    }