Skip to content

Function: openChannel()

Makaio Framework


Makaio Framework / bus-core / openChannel

openChannel(context, endpointName, options): Promise<IDirectChannel>

Defined in: ../../../packages/bus-core/src/channel/channel-endpoint.ts:147

Open an encrypted point-to-point channel to a registered endpoint.

Performs the ECDH handshake via system.channel.open:

  1. Generates an ephemeral ECDH keypair.
  2. Sends the client public key and capability token to the endpoint.
  3. Receives the channel ID and endpoint public key.
  4. Derives the shared AES-256-GCM key from the client private key and endpoint public key.
  5. Returns a IDirectChannel ready for encrypted communication.

By default the handshake is dispatched over all registered transports so the endpoint can reside in a different process. Pass transports: [] to restrict the handshake (and the resulting channel) to the local process only — this is the correct choice whenever both sides are guaranteed to share the same bus context (e.g., credential service and its same-process callers).

MakaioBusContext

Bus context to use for the handshake request

string

Logical name of the endpoint to connect to

Connection options including the shared capability token and an optional transport allowlist (transports: [] for local-only)

string

readonly keyof BusTransportRegistry[]

Promise<IDirectChannel>

Resolved IDirectChannel once the handshake completes

{RequestError} If the handshake fails — for authentication failures, the cause is a {ChannelAuthError}

{NoHandlerError} If no endpoint with the given name is registered