AdmitMessage

@Serializable
sealed interface AdmitMessage

Wire messages that implement the admit/identify handshake.

Framing: each AdmitMessage is CBOR-encoded and sent as a us.tractat.kuilt.core.Swatch payload. The receiver detects admit frames by a discriminator prefix tag (PREFIX_BYTE) that application frames must not start with — this avoids a separate channel or wrapper envelope.

Handshake flow, in its first form:

Joiner → Host : Hello(identity)
Host → Joiner : Welcome(assignedId, identity)
Host → all others : Welcome(assignedId, identity) [roster broadcast]

If the host refuses the joiner (a version it cannot admit, a room it does not serve, a proof that fails, another device's key on a connected member's id):

Host → Joiner : Reject(reason, code)

The host-side runs this passively for incoming Hellos. The joiner sends Hello immediately upon transport connection and waits for Welcome or Reject.

Since protocol v3 (#3210) every Hello and Welcome names a member's device key. Since v4 (#3211) the host admits only a joiner that proves it holds that key:

Joiner → Host   : Hello(identity, key, joinerNonce)
Host → Joiner : Challenge(signed by the host's key, echoing joinerNonce)
Joiner → Host : Proof(signed by the joiner's key, over the challenge's hostNonce)
Host → Joiner : Welcome(…) or Reject(BadProof)

Since v7 (#3215) a joiner's return after a dropped link is the same exchange: it says Hello again, and there is no separate resume frame. The direct Welcome and every Reject name the Hello they answer (Welcome.answers, Reject.answers), and the direct Welcome names the membership it admits (Welcome.membership). The rest of the admission burst — a Welcome per existing member, then the host's intro — names the same Hello, only to say which burst it belongs to (#3615):

Host   → Joiner : Welcome(…, answers = joinerNonce, membership)   or   Reject(code, answers = joinerNonce)
Host → Joiner : Welcome(member…, answers = joinerNonce) …, Welcome(host, answers = joinerNonce)

A roster copy to the other members names no Hello.

Inheritors

Types

Link copied to clipboard
@Serializable
@SerialName(value = "challenge")
class Challenge(val statement: ByteArray) : AdmitMessage

Sent by the host to a joiner whose Hello it received: a signed challenge the joiner answers with a Proof (v3, #3210; sent since v4, #3211).

Link copied to clipboard
object Companion
Link copied to clipboard
@Serializable
@SerialName(value = "farewell")
data class Farewell(val peerId: String, val expired: Boolean = false, val supersededBy: String? = null) : AdmitMessage

Sent by the host to every remaining member when a member departs cleanly (the host received that member's Goodbye).

Link copied to clipboard
@Serializable
@SerialName(value = "goodbye")
data object Goodbye : AdmitMessage

Sent by a joiner to the host on a deliberate us.tractat.kuilt.session.Room.leave.

Link copied to clipboard
@Serializable
@SerialName(value = "grant-renewal")
class GrantRenewal(val grant: ByteArray) : AdmitMessage

Sent by the host to a connected member: a fresh pass back in, renewing the one its direct Welcome carried (v8, #3221).

Link copied to clipboard
@Serializable
@SerialName(value = "hello")
data class Hello(val displayName: String, val sessionId: String, val deviceId: String? = null, val targetRoom: String? = null, val protocolVersion: Int? = null, val key: DidKey? = null, val joinerNonce: ByteArray? = null) : AdmitMessage

Sent by a joiner to the host immediately after transport connection.

Link copied to clipboard
@Serializable
@SerialName(value = "paused")
data class Paused(val peerId: String, val expiresAt: Long) : AdmitMessage

Sent by the host to every other member when a member's link drops and its seat is being held open — the presence counterpart of Farewell's eviction (#1557).

Link copied to clipboard
@Serializable
@SerialName(value = "proof")
class Proof(val statement: ByteArray, val grants: List<ByteArray> = emptyList()) : AdmitMessage

Sent by a joiner to answer a Challenge (v3, #3210; sent since v4, #3211).

Link copied to clipboard
@Serializable
@SerialName(value = "reject")
data class Reject(val reason: String, val codeId: String? = null, val answers: ByteArray? = null, val supersededBy: String? = null, val retryable: Boolean? = null) : AdmitMessage

Sent by the host to refuse a joiner's Hello, at the Hello gate or once its Proof was checked.

Link copied to clipboard
@Serializable
@SerialName(value = "unpaused")
data class Unpaused(val peerId: String) : AdmitMessage

Sent by the host to every other member when a paused member's link recovered inside its reconnect window, or it resumed there — the release counterpart of Paused (#1557, #2908).

Link copied to clipboard
@Serializable
@SerialName(value = "welcome")
data class Welcome(val assignedPeerId: String, val displayName: String, val sessionId: String, val key: DidKey, val deviceId: String? = null, val roomId: String? = null, val returnKind: ReturnKind? = null, val answers: ByteArray? = null, val membership: String? = null, val grant: ByteArray? = null, val previousPeerId: String? = null) : AdmitMessage

Sent by the host to confirm admission.