/** * Type definitions for Sideband Relay Protocol (SBRP). */ /** Branded type for daemon identifiers */ export type DaemonId = string & { readonly __brand: "DaemonId"; }; /** Branded type for client session identifiers (relay-assigned) */ export type ClientId = string & { readonly __brand: "ClientId"; }; /** * Session identifier (uint64). * Assigned by control plane, encoded in JWT `sid` claim as base64url(uint64). * Used in frame headers for routing. */ export type SessionId = bigint; /** Ed25519 identity keypair for daemon authentication */ export interface IdentityKeyPair { publicKey: Uint8Array; privateKey: Uint8Array; } /** X25519 ephemeral keypair for key exchange */ export interface EphemeralKeyPair { publicKey: Uint8Array; privateKey: Uint8Array; } /** Session keys derived from handshake (directional symmetric keys) */ export interface SessionKeys { /** Key for encrypting client→daemon messages */ clientToDaemon: Uint8Array; /** Key for encrypting daemon→client messages */ daemonToClient: Uint8Array; } /** Handshake init message (client → daemon) */ export interface HandshakeInit { type: "handshake.init"; initPublicKey: Uint8Array; } /** Handshake accept message (daemon → client) */ export interface HandshakeAccept { type: "handshake.accept"; identityPublicKey: Uint8Array; acceptPublicKey: Uint8Array; signature: Uint8Array; } /** Encrypted message envelope */ export interface EncryptedMessage { type: "encrypted"; seq: bigint; data: Uint8Array; } /** Direction of message flow (used in nonce construction) */ export declare const Direction: { readonly ClientToDaemon: 1; readonly DaemonToClient: 2; }; export type Direction = (typeof Direction)[keyof typeof Direction]; /** * SBRP error codes (string constants for SDK use). * * Wire codes use numeric values in Control frames (see frame.ts). * These string constants provide type-safe SDK-level error handling. */ export declare const SbrpErrorCode: { readonly Unauthorized: "unauthorized"; readonly Forbidden: "forbidden"; readonly DaemonNotFound: "daemon_not_found"; readonly DaemonOffline: "daemon_offline"; readonly SessionNotFound: "session_not_found"; readonly SessionExpired: "session_expired"; readonly MalformedFrame: "malformed_frame"; readonly PayloadTooLarge: "payload_too_large"; readonly InvalidFrameType: "invalid_frame_type"; readonly InvalidSessionId: "invalid_session_id"; readonly DisallowedSender: "disallowed_sender"; readonly InternalError: "internal_error"; readonly RateLimited: "rate_limited"; readonly Backpressure: "backpressure"; readonly SessionPaused: "session_paused"; readonly SessionResumed: "session_resumed"; readonly SessionEnded: "session_ended"; readonly SessionPending: "session_pending"; readonly IdentityKeyChanged: "identity_key_changed"; readonly HandshakeFailed: "handshake_failed"; readonly HandshakeTimeout: "handshake_timeout"; readonly DecryptFailed: "decrypt_failed"; readonly SequenceError: "sequence_error"; }; export type SbrpErrorCode = (typeof SbrpErrorCode)[keyof typeof SbrpErrorCode]; /** Signal codes for Signal frame (0x04) */ export declare const SignalCode: { readonly Ready: 0; readonly Close: 1; }; export type SignalCode = (typeof SignalCode)[keyof typeof SignalCode]; /** Reason codes for Signal frames (§13.4) */ export declare const SignalReason: { /** No specific reason (default for ready signal) */ readonly None: 0; /** Process restart, memory cleared */ readonly StateLost: 1; /** Graceful daemon shutdown */ readonly Shutdown: 2; /** Internal policy denial */ readonly Policy: 3; /** Internal daemon error */ readonly Error: 4; }; export type SignalReason = (typeof SignalReason)[keyof typeof SignalReason]; /** SBRP-specific error */ export declare class SbrpError extends Error { readonly code: SbrpErrorCode; constructor(code: SbrpErrorCode, message: string); } /** Brand a string as DaemonId (no validation) */ export declare function asDaemonId(value: string): DaemonId; /** Brand a string as ClientId (no validation) */ export declare function asClientId(value: string): ClientId; //# sourceMappingURL=types.d.ts.map