tx — shychat
Package tx defines the wire-format types for shychat-v1 transactions.
Import path: github.com/NickCarducci/Shyware-SDK/protocol/tx
Type discriminators
const (
ChatTxTypeMailboxCreate uint8 = 1
ChatTxTypeMessageDispatch uint8 = 2
ChatTxTypeMailboxClose uint8 = 3
ChatTxTypeMessageUpdate uint8 = 4
ChatTxTypeMessageWithdraw uint8 = 5
ChatTxTypeRegisterValidator uint8 = 6
)
MailboxCreateData
type MailboxCreateData struct {
MailboxID string `json:"mailbox_id"`
Label string `json:"label,omitempty"`
Address string `json:"address,omitempty"`
RouteHint string `json:"route_hint,omitempty"`
SurfaceModel string `json:"surface_model"` // "mail" | "chat"
AccountLabel string `json:"account_label,omitempty"`
EndTime int64 `json:"end_time,omitempty"` // 0 = no expiry
}
Opens a submission window. Analogous to PollCreateData in shyvoting.
MessageDispatchData
type MessageDispatchData struct {
MailboxID string `json:"mailbox_id"`
MessageNonce string `json:"message_nonce"` // random; MessageID = H(nonce)
SealedBody json.RawMessage `json:"sealed_body"` // AES-GCM ciphertext
SealedSubject json.RawMessage `json:"sealed_subject,omitempty"`
ContentClass string `json:"content_class,omitempty"`
PayloadFormat string `json:"payload_format,omitempty"`
AuditMode string `json:"audit_mode"` // "delivery_commitment_only" | "delivery_metadata_commitment"
SenderPubKey string `json:"sender_pub_key"`
SenderSig string `json:"sender_sig"` // Sign(sk_s, MessageNonce + ":" + MailboxID)
IDVAttestation json.RawMessage `json:"idv_attestation"`
}
SealedBody and SealedSubject are AES-GCM encrypted before broadcast. The ABCI layer stores ciphertext in List 1 and never sees plaintext. ContentClass and PayloadFormat are safe descriptors; readable content is never stored in canonical state.
MessageUpdateData
type MessageUpdateData struct {
MailboxID string `json:"mailbox_id"`
OldMessageID string `json:"old_message_id"`
NewMessageNonce string `json:"new_message_nonce"`
NewSealedBody json.RawMessage `json:"new_sealed_body"`
SenderPubKey string `json:"sender_pub_key"`
SenderSig string `json:"sender_sig"` // Sign(sk_s, "update:" + NewMessageNonce + ":" + MailboxID)
IDVAttestation json.RawMessage `json:"idv_attestation"`
}
The "update:" prefix in SenderSig prevents a dispatch signature from replaying as an update. Requires recoverable posture (not write-only).
MessageWithdrawData
type MessageWithdrawData struct {
MailboxID string `json:"mailbox_id"`
MessageID string `json:"message_id"`
SenderPubKey string `json:"sender_pub_key"`
SenderSig string `json:"sender_sig"`
IDVAttestation json.RawMessage `json:"idv_attestation"`
}
Bilateral withdrawal: removes List 1 message entry and List 2 identity entry atomically. Count-match preserved.
Stateless validation
func ValidateChatTx(t *Tx) error
Called during CheckTx. Routes on t.Type and validates required fields per message type.