Documentation
¶
Index ¶
- Constants
- func CanonicalBytes(env Envelope) []byte
- func DeriveTransferID(sourceHost, sourceHandle, sourceMessageID, destAlias string) string
- func DestSidecarPath(messagePath string) string
- func HostIDPath(root string) string
- func IdentityPath(root string) string
- func LoadHostID(root string) (string, error)
- func LoadHostIDFromDeliveryRoot(root *fsq.DeliveryRoot) (string, error)
- func LoadTrusted(root, host string) (ed25519.PublicKey, string, error)
- func LoadTrustedFromDeliveryRoot(root *fsq.DeliveryRoot, host string) (ed25519.PublicKey, string, error)
- func MarshalEnvelope(env Envelope) ([]byte, error)
- func ParseAlias(alias string) (host, agent string, err error)
- func SignEnvelope(env *Envelope, key HostKey) error
- func TransferFilename(sourceHost, transferID string) string
- func TrustedPath(root, host string) string
- func ValidateEnqueueConfig(cfg EnqueueConfig) error
- func ValidateEnvelope(env Envelope) error
- func VerifyEnvelope(env Envelope, pub ed25519.PublicKey, generation string) error
- func WriteHostID(root, host string) error
- func WriteIdentity(root string, key HostKey) error
- func WriteTrusted(root, host string, pub ed25519.PublicKey, generation string) error
- type ApplyResult
- type EnqueueConfig
- type EnqueueResult
- type Envelope
- type HostKey
Constants ¶
const ( IdentityFileName = "identity" HostIDFileName = "host-id" TrustedDirName = "trusted" )
const ( EnvelopeVersion = 2 // MaxPayloadBytes and MaxObjectBytes are the v2 protocol limits. The // payload limit applies after raw-standard-base64 decoding; the object // limit applies to the exact JSON file bytes on the wire. MaxPayloadBytes = 8 * 1024 * 1024 MaxObjectBytes = 12 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func CanonicalBytes ¶
func DeriveTransferID ¶ added in v0.75.0
DeriveTransferID returns the v2 transfer id for the immutable routing claims. Callers that accept untrusted values must validate those values before using the result in a path.
func DestSidecarPath ¶
DestSidecarPath is the sibling dest-binding file for a spool message.
func HostIDPath ¶
func IdentityPath ¶
func LoadHostID ¶
func LoadHostIDFromDeliveryRoot ¶
func LoadHostIDFromDeliveryRoot(root *fsq.DeliveryRoot) (string, error)
LoadHostIDFromDeliveryRoot reads host-id through an already-authorized delivery-root capability so the identity used for routing cannot be replaced through the ambient root path after authorization.
func LoadTrustedFromDeliveryRoot ¶
func LoadTrustedFromDeliveryRoot(root *fsq.DeliveryRoot, host string) (ed25519.PublicKey, string, error)
LoadTrustedFromDeliveryRoot reads a trusted public key through an already-authorized delivery-root capability. The source host remains an envelope claim until this exact trusted file is loaded and signature verification succeeds.
func MarshalEnvelope ¶
func ParseAlias ¶
func SignEnvelope ¶
func TransferFilename ¶
func TrustedPath ¶
func ValidateEnqueueConfig ¶
func ValidateEnqueueConfig(cfg EnqueueConfig) error
ValidateEnqueueConfig checks the decoded enqueue configuration.
func ValidateEnvelope ¶
func VerifyEnvelope ¶
func WriteHostID ¶
func WriteIdentity ¶
Types ¶
type ApplyResult ¶
ApplyResult is the durable local outcome of one envelope.
func ApplyEnvelope ¶
func ApplyEnvelope(root *fsq.DeliveryRoot, localHost, localAgent string, env Envelope) (ApplyResult, error)
ApplyEnvelope commits the payload into the local agent's inbox under a stable transfer filename keyed by (source_host, transfer_id). The same digest is idempotent; a different digest for that key is a conflict.
type EnqueueConfig ¶
type EnqueueConfig struct {
Root string `json:"root"`
SourceHost string `json:"source_host"`
SourceHandle string `json:"source_handle"`
AllowedDestAliases []string `json:"allowed_dest_aliases"`
}
EnqueueConfig is the audited Bot-side bridge enqueue configuration.
func LoadEnqueueConfig ¶
func LoadEnqueueConfig(path string) (EnqueueConfig, error)
LoadEnqueueConfig reads and validates a private mode-0600 enqueue config file.
func (EnqueueConfig) AllowedDestSet ¶
func (cfg EnqueueConfig) AllowedDestSet() map[string]struct{}
AllowedDestSet returns the configured destination aliases as a lookup set.
type EnqueueResult ¶
EnqueueResult is the durable local outcome of one bridge enqueue.
func Enqueue ¶
func Enqueue(cfg EnqueueConfig, destAlias string, message []byte) (EnqueueResult, error)
Enqueue writes one complete AMQ message into the bridge outbound spool.
type Envelope ¶
type Envelope struct {
Version int `json:"version"`
TransferID string `json:"transfer_id"`
SourceHost string `json:"source_host"`
SourceHandle string `json:"source_handle"`
DestAlias string `json:"dest_alias"`
SourceMessageID string `json:"source_message_id"`
ThreadID string `json:"thread_id"`
PayloadSHA256 string `json:"payload_sha256"`
KeyGeneration string `json:"key_generation"`
Signature string `json:"signature"`
Payload []byte `json:"-"`
}
Envelope is the v2 amq-bridge wire unit. Extra JSON fields are rejected. Payload remains []byte for callers that apply the decoded message locally; its wire representation is the payload_b64 JSON string below.
func UnmarshalEnvelope ¶
func (Envelope) MarshalJSON ¶ added in v0.75.0
func (*Envelope) UnmarshalJSON ¶ added in v0.75.0
type HostKey ¶
type HostKey struct {
Generation string
Private ed25519.PrivateKey
}
HostKey is one Ed25519 generation for a bridge host principal.