Function: openChannel()
Makaio Framework / bus-core / openChannel
Function: openChannel()
Section titled “Function: 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:
- Generates an ephemeral ECDH keypair.
- Sends the client public key and capability token to the endpoint.
- Receives the channel ID and endpoint public key.
- Derives the shared AES-256-GCM key from the client private key and endpoint public key.
- Returns a
IDirectChannelready 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).
Parameters
Section titled “Parameters”context
Section titled “context”Bus context to use for the handshake request
endpointName
Section titled “endpointName”string
Logical name of the endpoint to connect to
options
Section titled “options”Connection options including the shared capability token and
an optional transport allowlist (transports: [] for local-only)
string
transports?
Section titled “transports?”readonly keyof BusTransportRegistry[]
Returns
Section titled “Returns”Promise<IDirectChannel>
Resolved IDirectChannel once the handshake completes
Throws
Section titled “Throws”{RequestError} If the handshake fails — for authentication failures, the cause is a {ChannelAuthError}
Throws
Section titled “Throws”{NoHandlerError} If no endpoint with the given name is registered