Documentation
¶
Overview ¶
Package envelope defines the fabric message envelope carried inside botbus message bodies. The botbus hub remains byte-agnostic; envelopes are a client-side convention.
Index ¶
Constants ¶
View Source
const ( KindChat = "chat" KindDM = "dm" KindTask = "task" KindEscalate = "escalate" KindStatus = "status" KindReviewRequest = "review_request" KindCouncilResult = "council_result" KindControl = "control" KindBatch = "batch" )
Kind constants.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Envelope ¶
type Envelope struct {
V int `json:"v"`
ID string `json:"id"`
TS string `json:"ts,omitempty"`
From string `json:"from"`
To []string `json:"to,omitempty"`
Kind string `json:"kind"`
Scope string `json:"scope,omitempty"`
Channel string `json:"channel,omitempty"`
Subject string `json:"subject,omitempty"`
Body string `json:"body"`
// Enc carries a base64-encoded end-to-end ciphertext envelope. When set,
// Subject and Body are empty on the wire; the receiving daemon decrypts Enc
// and repopulates Subject/Body in memory. The hub stays byte-agnostic.
Enc string `json:"enc,omitempty"`
}
Envelope is the JSON payload placed in a botbus message body.
func ParseOrWrap ¶
ParseOrWrap tries to parse b as an envelope. If b is not valid envelope JSON (a human typing into a channel, or a non-fabric client), it wraps the raw text as a chat envelope from `sender` originating on `fromChannel`. The bool reports whether wrapping occurred.
Click to show internal directories.
Click to hide internal directories.