Documentation
    Preparing search index...

    Interface that the peerkit node exposes to modules

    Modules depend on this interface only, so that they can be distributed without a dependency on the peerkit package.

    Implements

    Index

    Constructors

    Properties

    agentStore: IAgentStore
    keyPair: IKeyPair
    transport: ITransport

    Accessors

    Methods

    • Open an outgoing stream to a connected agent on the given protocol.

      Throws if the agent is not connected.

      Parameters

      • agentId: string
      • protocol: string

      Returns Promise<IStream>

    • Parameters

      • fromAgent: string

      Returns Promise<void>

    • Parameters

      • toAgent: string

      Returns boolean

    • Parameters

      • toAgent: string

      Returns boolean

    • Attach a module to this node.

      Calls module.init(this) to wire it up, then module.start() if defined. Multiple modules can be registered.

      Parameters

      Returns Promise<void>

    • Register a handler for incoming streams on the given protocol.

      Called once per incoming stream, after the access check has passed.

      Parameters

      • protocol: string
      • handler: (fromAgent: string, stream: IStream) => void

      Returns void

    • Parameters

      • toAgent: string
      • message: Uint8Array

      Returns Promise<void>

    • Parameters

      • toAgent: string
      • agents: Uint8Array

      Returns Promise<void>

    • Returns Promise<void>