Version: v0.10.9 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: MPL-2.0 Imports: 12 Imported by: 76




View Source
const (
	KeyRequestActionRequest = "request"
	KeyRequestActionCancel  = "request_cancellation"
View Source
const ReplyFormat = `` /* 143-byte string literal not displayed */


View Source
var (
	StateAliases           = Type{"m.room.aliases", StateEventType}
	StateCanonicalAlias    = Type{"m.room.canonical_alias", StateEventType}
	StateCreate            = Type{"m.room.create", StateEventType}
	StateJoinRules         = Type{"m.room.join_rules", StateEventType}
	StateHistoryVisibility = Type{"m.room.history_visibility", StateEventType}
	StateGuestAccess       = Type{"m.room.guest_access", StateEventType}
	StateMember            = Type{"m.room.member", StateEventType}
	StatePowerLevels       = Type{"m.room.power_levels", StateEventType}
	StateRoomName          = Type{"m.room.name", StateEventType}
	StateTopic             = Type{"m.room.topic", StateEventType}
	StateRoomAvatar        = Type{"m.room.avatar", StateEventType}
	StatePinnedEvents      = Type{"m.room.pinned_events", StateEventType}
	StateTombstone         = Type{"m.room.tombstone", StateEventType}
	StateEncryption        = Type{"m.room.encryption", StateEventType}
	StateBridge            = Type{"m.bridge", StateEventType}
	StateHalfShotBridge    = Type{"uk.half-shot.bridge", StateEventType}
	StateSpaceChild        = Type{"m.space.child", StateEventType}
	StateSpaceParent       = Type{"m.space.parent", StateEventType}

State events

View Source
var (
	EventRedaction = Type{"m.room.redaction", MessageEventType}
	EventMessage   = Type{"m.room.message", MessageEventType}
	EventEncrypted = Type{"m.room.encrypted", MessageEventType}
	EventReaction  = Type{"m.reaction", MessageEventType}
	EventSticker   = Type{"m.sticker", MessageEventType}

	InRoomVerificationStart  = Type{"m.key.verification.start", MessageEventType}
	InRoomVerificationReady  = Type{"m.key.verification.ready", MessageEventType}
	InRoomVerificationAccept = Type{"m.key.verification.accept", MessageEventType}
	InRoomVerificationKey    = Type{"m.key.verification.key", MessageEventType}
	InRoomVerificationMAC    = Type{"m.key.verification.mac", MessageEventType}
	InRoomVerificationCancel = Type{"m.key.verification.cancel", MessageEventType}

	CallInvite       = Type{"m.call.invite", MessageEventType}
	CallCandidates   = Type{"m.call.candidates", MessageEventType}
	CallAnswer       = Type{"m.call.answer", MessageEventType}
	CallReject       = Type{"m.call.reject", MessageEventType}
	CallSelectAnswer = Type{"m.call.select_answer", MessageEventType}
	CallNegotiate    = Type{"m.call.negotiate", MessageEventType}
	CallHangup       = Type{"m.call.hangup", MessageEventType}

Message events

View Source
var (
	EphemeralEventReceipt  = Type{"m.receipt", EphemeralEventType}
	EphemeralEventTyping   = Type{"m.typing", EphemeralEventType}
	EphemeralEventPresence = Type{"m.presence", EphemeralEventType}

Ephemeral events

View Source
var (
	AccountDataDirectChats     = Type{"m.direct", AccountDataEventType}
	AccountDataPushRules       = Type{"m.push_rules", AccountDataEventType}
	AccountDataRoomTags        = Type{"m.tag", AccountDataEventType}
	AccountDataFullyRead       = Type{"m.fully_read", AccountDataEventType}
	AccountDataIgnoredUserList = Type{"m.ignored_user_list", AccountDataEventType}

	AccountDataSecretStorageDefaultKey = Type{"m.secret_storage.default_key", AccountDataEventType}
	AccountDataSecretStorageKey        = Type{"m.secret_storage.key", AccountDataEventType}
	AccountDataCrossSigningMaster      = Type{"m.cross_signing.master", AccountDataEventType}
	AccountDataCrossSigningUser        = Type{"m.cross_signing.user_signing", AccountDataEventType}
	AccountDataCrossSigningSelf        = Type{"m.cross_signing.self_signing", AccountDataEventType}

Account data events

View Source
var (
	ToDeviceRoomKey             = Type{"m.room_key", ToDeviceEventType}
	ToDeviceRoomKeyRequest      = Type{"m.room_key_request", ToDeviceEventType}
	ToDeviceForwardedRoomKey    = Type{"m.forwarded_room_key", ToDeviceEventType}
	ToDeviceEncrypted           = Type{"m.room.encrypted", ToDeviceEventType}
	ToDeviceRoomKeyWithheld     = Type{"m.room_key.withheld", ToDeviceEventType}
	ToDeviceDummy               = Type{"m.dummy", ToDeviceEventType}
	ToDeviceVerificationRequest = Type{"m.key.verification.request", ToDeviceEventType}
	ToDeviceVerificationStart   = Type{"m.key.verification.start", ToDeviceEventType}
	ToDeviceVerificationAccept  = Type{"m.key.verification.accept", ToDeviceEventType}
	ToDeviceVerificationKey     = Type{"m.key.verification.key", ToDeviceEventType}
	ToDeviceVerificationMAC     = Type{"m.key.verification.mac", ToDeviceEventType}
	ToDeviceVerificationCancel  = Type{"m.key.verification.cancel", ToDeviceEventType}

	ToDeviceOrgMatrixRoomKeyWithheld = Type{"org.matrix.room_key.withheld", ToDeviceEventType}

Device-to-device events

View Source
var ContentAlreadyParsed = errors.New("content is already parsed")
View Source
var HTMLReplyFallbackRegex = regexp.MustCompile(`^<mx-reply>[\s\S]+?</mx-reply>`)
View Source
var TypeMap = map[Type]reflect.Type{
	StateMember:            reflect.TypeOf(MemberEventContent{}),
	StatePowerLevels:       reflect.TypeOf(PowerLevelsEventContent{}),
	StateCanonicalAlias:    reflect.TypeOf(CanonicalAliasEventContent{}),
	StateRoomName:          reflect.TypeOf(RoomNameEventContent{}),
	StateRoomAvatar:        reflect.TypeOf(RoomAvatarEventContent{}),
	StateTopic:             reflect.TypeOf(TopicEventContent{}),
	StateTombstone:         reflect.TypeOf(TombstoneEventContent{}),
	StateCreate:            reflect.TypeOf(CreateEventContent{}),
	StateJoinRules:         reflect.TypeOf(JoinRulesEventContent{}),
	StateHistoryVisibility: reflect.TypeOf(HistoryVisibilityEventContent{}),
	StateGuestAccess:       reflect.TypeOf(GuestAccessEventContent{}),
	StatePinnedEvents:      reflect.TypeOf(PinnedEventsEventContent{}),
	StateEncryption:        reflect.TypeOf(EncryptionEventContent{}),
	StateBridge:            reflect.TypeOf(BridgeEventContent{}),
	StateHalfShotBridge:    reflect.TypeOf(BridgeEventContent{}),
	StateSpaceParent:       reflect.TypeOf(SpaceParentEventContent{}),
	StateSpaceChild:        reflect.TypeOf(SpaceChildEventContent{}),

	EventMessage:   reflect.TypeOf(MessageEventContent{}),
	EventSticker:   reflect.TypeOf(MessageEventContent{}),
	EventEncrypted: reflect.TypeOf(EncryptedEventContent{}),
	EventRedaction: reflect.TypeOf(RedactionEventContent{}),
	EventReaction:  reflect.TypeOf(ReactionEventContent{}),

	AccountDataRoomTags:        reflect.TypeOf(TagEventContent{}),
	AccountDataDirectChats:     reflect.TypeOf(DirectChatsEventContent{}),
	AccountDataFullyRead:       reflect.TypeOf(FullyReadEventContent{}),
	AccountDataIgnoredUserList: reflect.TypeOf(IgnoredUserListEventContent{}),

	EphemeralEventTyping:   reflect.TypeOf(TypingEventContent{}),
	EphemeralEventReceipt:  reflect.TypeOf(ReceiptEventContent{}),
	EphemeralEventPresence: reflect.TypeOf(PresenceEventContent{}),

	InRoomVerificationStart:  reflect.TypeOf(VerificationStartEventContent{}),
	InRoomVerificationReady:  reflect.TypeOf(VerificationReadyEventContent{}),
	InRoomVerificationAccept: reflect.TypeOf(VerificationAcceptEventContent{}),
	InRoomVerificationKey:    reflect.TypeOf(VerificationKeyEventContent{}),
	InRoomVerificationMAC:    reflect.TypeOf(VerificationMacEventContent{}),
	InRoomVerificationCancel: reflect.TypeOf(VerificationCancelEventContent{}),

	ToDeviceRoomKey:          reflect.TypeOf(RoomKeyEventContent{}),
	ToDeviceForwardedRoomKey: reflect.TypeOf(ForwardedRoomKeyEventContent{}),
	ToDeviceRoomKeyRequest:   reflect.TypeOf(RoomKeyRequestEventContent{}),
	ToDeviceEncrypted:        reflect.TypeOf(EncryptedEventContent{}),
	ToDeviceRoomKeyWithheld:  reflect.TypeOf(RoomKeyWithheldEventContent{}),
	ToDeviceDummy:            reflect.TypeOf(DummyEventContent{}),

	ToDeviceVerificationStart:   reflect.TypeOf(VerificationStartEventContent{}),
	ToDeviceVerificationAccept:  reflect.TypeOf(VerificationAcceptEventContent{}),
	ToDeviceVerificationKey:     reflect.TypeOf(VerificationKeyEventContent{}),
	ToDeviceVerificationMAC:     reflect.TypeOf(VerificationMacEventContent{}),
	ToDeviceVerificationCancel:  reflect.TypeOf(VerificationCancelEventContent{}),
	ToDeviceVerificationRequest: reflect.TypeOf(VerificationRequestEventContent{}),

	ToDeviceOrgMatrixRoomKeyWithheld: reflect.TypeOf(RoomKeyWithheldEventContent{}),

	CallInvite:       reflect.TypeOf(CallInviteEventContent{}),
	CallCandidates:   reflect.TypeOf(CallCandidatesEventContent{}),
	CallAnswer:       reflect.TypeOf(CallAnswerEventContent{}),
	CallReject:       reflect.TypeOf(CallRejectEventContent{}),
	CallSelectAnswer: reflect.TypeOf(CallSelectAnswerEventContent{}),
	CallNegotiate:    reflect.TypeOf(CallNegotiateEventContent{}),
	CallHangup:       reflect.TypeOf(CallHangupEventContent{}),

TypeMap is a mapping from event type to the content struct type. This is used by Content.ParseRaw() for creating the correct type of struct.

View Source
var UnsupportedContentType = errors.New("unsupported event type")


func IsUnsupportedContentType

func IsUnsupportedContentType(err error) bool

func TrimReplyFallbackHTML

func TrimReplyFallbackHTML(html string) string

func TrimReplyFallbackText

func TrimReplyFallbackText(text string) string


type AnnotationChunk

type AnnotationChunk struct {
	Map map[string]int `json:"-"`

func (*AnnotationChunk) Serialize

func (ac *AnnotationChunk) Serialize() RelationChunk

func (*AnnotationChunk) UnmarshalJSON

func (ac *AnnotationChunk) UnmarshalJSON(data []byte) error

type BaseCallEventContent added in v0.9.7

type BaseCallEventContent struct {
	CallID  string      `json:"call_id"`
	PartyID string      `json:"party_id"`
	Version CallVersion `json:"version"`

type BridgeEventContent added in v0.9.29

type BridgeEventContent struct {
	BridgeBot id.UserID          `json:"bridgebot"`
	Creator   id.UserID          `json:"creator,omitempty"`
	Protocol  BridgeInfoSection  `json:"protocol"`
	Network   *BridgeInfoSection `json:"network,omitempty"`
	Channel   BridgeInfoSection  `json:"channel"`

BridgeEventContent represents the content of a m.bridge state event. https://github.com/matrix-org/matrix-doc/pull/2346

type BridgeInfoSection added in v0.9.29

type BridgeInfoSection struct {
	ID          string              `json:"id"`
	DisplayName string              `json:"displayname,omitempty"`
	AvatarURL   id.ContentURIString `json:"avatar_url,omitempty"`
	ExternalURL string              `json:"external_url,omitempty"`

type CallAnswerEventContent added in v0.9.7

type CallAnswerEventContent struct {
	Answer CallData `json:"answer"`

type CallCandidate added in v0.9.7

type CallCandidate struct {
	Candidate     string `json:"candidate"`
	SDPMLineIndex int    `json:"sdpMLineIndex"`
	SDPMID        string `json:"sdpMid"`

type CallCandidatesEventContent added in v0.9.7

type CallCandidatesEventContent struct {
	Candidates []CallCandidate `json:"candidates"`

type CallData added in v0.9.7

type CallData struct {
	SDP  string       `json:"sdp"`
	Type CallDataType `json:"type"`

type CallDataType added in v0.9.7

type CallDataType string
const (
	CallDataTypeOffer  CallDataType = "offer"
	CallDataTypeAnswer CallDataType = "answer"

type CallHangupEventContent added in v0.9.7

type CallHangupEventContent struct {
	Reason CallHangupReason `json:"reason"`

type CallHangupReason added in v0.9.7

type CallHangupReason string
const (
	CallHangupICEFailed       CallHangupReason = "ice_failed"
	CallHangupInviteTimeout   CallHangupReason = "invite_timeout"
	CallHangupUserHangup      CallHangupReason = "user_hangup"
	CallHangupUserMediaFailed CallHangupReason = "user_media_failed"
	CallHangupUnknownError    CallHangupReason = "unknown_error"

type CallInviteEventContent added in v0.9.7

type CallInviteEventContent struct {
	Lifetime int      `json:"lifetime"`
	Offer    CallData `json:"offer"`

type CallNegotiateEventContent added in v0.9.7

type CallNegotiateEventContent struct {
	Lifetime    int      `json:"lifetime"`
	Description CallData `json:"description"`

type CallRejectEventContent added in v0.9.7

type CallRejectEventContent struct {

type CallSelectAnswerEventContent added in v0.9.7

type CallSelectAnswerEventContent struct {
	SelectedPartyID string `json:"selected_party_id"`

type CallVersion added in v0.9.11

type CallVersion string

func (*CallVersion) Int added in v0.9.11

func (cv *CallVersion) Int() (int, error)

func (*CallVersion) MarshalJSON added in v0.9.11

func (cv *CallVersion) MarshalJSON() ([]byte, error)

func (*CallVersion) UnmarshalJSON added in v0.9.11

func (cv *CallVersion) UnmarshalJSON(raw []byte) error

type CanonicalAliasEventContent

type CanonicalAliasEventContent struct {
	Alias      id.RoomAlias   `json:"alias"`
	AltAliases []id.RoomAlias `json:"alt_aliases,omitempty"`

CanonicalAliasEventContent represents the content of a m.room.canonical_alias state event. https://matrix.org/docs/spec/client_server/r0.6.1#m-room-canonical-alias

type Content

type Content struct {
	VeryRaw json.RawMessage
	Raw     map[string]interface{}
	Parsed  interface{}

Content stores the content of a Matrix event.

By default, the content is only parsed into a map[string]interface{}. However, you can call ParseRaw with the correct event type to parse the content into a nicer struct, which you can then access from Parsed or via the helper functions.

func (*Content) AsBridge added in v0.9.29

func (content *Content) AsBridge() *BridgeEventContent

func (*Content) AsCallAnswer added in v0.9.7

func (content *Content) AsCallAnswer() *CallAnswerEventContent

func (*Content) AsCallCandidates added in v0.9.7

func (content *Content) AsCallCandidates() *CallCandidatesEventContent

func (*Content) AsCallHangup added in v0.9.7

func (content *Content) AsCallHangup() *CallHangupEventContent

func (*Content) AsCallInvite added in v0.9.7

func (content *Content) AsCallInvite() *CallInviteEventContent

func (*Content) AsCallNegotiate added in v0.9.7

func (content *Content) AsCallNegotiate() *CallNegotiateEventContent

func (*Content) AsCallReject added in v0.9.7

func (content *Content) AsCallReject() *CallRejectEventContent

func (*Content) AsCallSelectAnswer added in v0.9.7

func (content *Content) AsCallSelectAnswer() *CallSelectAnswerEventContent

func (*Content) AsCanonicalAlias

func (content *Content) AsCanonicalAlias() *CanonicalAliasEventContent

func (*Content) AsCreate

func (content *Content) AsCreate() *CreateEventContent

func (*Content) AsDirectChats

func (content *Content) AsDirectChats() *DirectChatsEventContent

func (*Content) AsEncrypted

func (content *Content) AsEncrypted() *EncryptedEventContent

func (*Content) AsEncryption added in v0.3.7

func (content *Content) AsEncryption() *EncryptionEventContent

func (*Content) AsForwardedRoomKey

func (content *Content) AsForwardedRoomKey() *ForwardedRoomKeyEventContent

func (*Content) AsFullyRead

func (content *Content) AsFullyRead() *FullyReadEventContent

func (*Content) AsGuestAccess

func (content *Content) AsGuestAccess() *GuestAccessEventContent

func (*Content) AsHistoryVisibility

func (content *Content) AsHistoryVisibility() *HistoryVisibilityEventContent

func (*Content) AsIgnoredUserList

func (content *Content) AsIgnoredUserList() *IgnoredUserListEventContent

func (*Content) AsJoinRules

func (content *Content) AsJoinRules() *JoinRulesEventContent

func (*Content) AsMember

func (content *Content) AsMember() *MemberEventContent

func (*Content) AsMessage

func (content *Content) AsMessage() *MessageEventContent

func (*Content) AsPinnedEvents

func (content *Content) AsPinnedEvents() *PinnedEventsEventContent

func (*Content) AsPowerLevels

func (content *Content) AsPowerLevels() *PowerLevelsEventContent

func (*Content) AsPresence

func (content *Content) AsPresence() *PresenceEventContent

func (*Content) AsReaction

func (content *Content) AsReaction() *ReactionEventContent

func (*Content) AsReceipt

func (content *Content) AsReceipt() *ReceiptEventContent

func (*Content) AsRedaction

func (content *Content) AsRedaction() *RedactionEventContent

func (*Content) AsRoomAvatar

func (content *Content) AsRoomAvatar() *RoomAvatarEventContent

func (*Content) AsRoomKey

func (content *Content) AsRoomKey() *RoomKeyEventContent

func (*Content) AsRoomKeyRequest

func (content *Content) AsRoomKeyRequest() *RoomKeyRequestEventContent

func (*Content) AsRoomKeyWithheld added in v0.5.3

func (content *Content) AsRoomKeyWithheld() *RoomKeyWithheldEventContent

func (*Content) AsRoomName

func (content *Content) AsRoomName() *RoomNameEventContent

func (*Content) AsSpaceChild added in v0.10.8

func (content *Content) AsSpaceChild() *SpaceChildEventContent

func (*Content) AsSpaceParent added in v0.10.8

func (content *Content) AsSpaceParent() *SpaceParentEventContent

func (*Content) AsTag

func (content *Content) AsTag() *TagEventContent

func (*Content) AsTombstone

func (content *Content) AsTombstone() *TombstoneEventContent

func (*Content) AsTopic

func (content *Content) AsTopic() *TopicEventContent

func (*Content) AsTyping

func (content *Content) AsTyping() *TypingEventContent

func (*Content) MarshalJSON

func (content *Content) MarshalJSON() ([]byte, error)

func (*Content) ParseRaw

func (content *Content) ParseRaw(evtType Type) error

func (*Content) UnmarshalJSON

func (content *Content) UnmarshalJSON(data []byte) error

type CreateEventContent

type CreateEventContent struct {
	Type        RoomType  `json:"type,omitempty"`
	Creator     id.UserID `json:"creator,omitempty"`
	Federate    bool      `json:"m.federate,omitempty"`
	RoomVersion string    `json:"version,omitempty"`
	Predecessor struct {
		RoomID  id.RoomID  `json:"room_id"`
		EventID id.EventID `json:"event_id"`
	} `json:"predecessor"`

CreateEventContent represents the content of a m.room.create state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-create

type DirectChatsEventContent

type DirectChatsEventContent map[id.UserID][]id.RoomID

DirectChatsEventContent represents the content of a m.direct account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-direct

type DummyEventContent added in v0.10.5

type DummyEventContent struct{}

type EncryptedEventContent

type EncryptedEventContent struct {
	Algorithm  id.Algorithm    `json:"algorithm"`
	SenderKey  id.SenderKey    `json:"sender_key"`
	DeviceID   id.DeviceID     `json:"device_id,omitempty"`  // Only present for Megolm events
	SessionID  id.SessionID    `json:"session_id,omitempty"` // Only present for Megolm events
	Ciphertext json.RawMessage `json:"ciphertext"`

	MegolmCiphertext []byte         `json:"-"`
	OlmCiphertext    OlmCiphertexts `json:"-"`

	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

EncryptedEventContent represents the content of a m.room.encrypted message event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-encrypted

func (*EncryptedEventContent) MarshalJSON

func (content *EncryptedEventContent) MarshalJSON() ([]byte, error)

func (*EncryptedEventContent) UnmarshalJSON

func (content *EncryptedEventContent) UnmarshalJSON(data []byte) error

type EncryptedFileInfo

type EncryptedFileInfo struct {
	URL id.ContentURIString `json:"url"`

type EncryptionEventContent

type EncryptionEventContent struct {
	// The encryption algorithm to be used to encrypt messages sent in this room. Must be 'm.megolm.v1.aes-sha2'.
	Algorithm id.Algorithm `json:"algorithm"`
	// How long the session should be used before changing it. 604800000 (a week) is the recommended default.
	RotationPeriodMillis int64 `json:"rotation_period_ms,omitempty"`
	// How many messages should be sent before changing the session. 100 is the recommended default.
	RotationPeriodMessages int `json:"rotation_period_msgs,omitempty"`

EncryptionEventContent represents the content of a m.room.encryption state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-encryption

type Event

type Event struct {
	StateKey  *string    `json:"state_key,omitempty"`        // The state key for the event. Only present on State Events.
	Sender    id.UserID  `json:"sender,omitempty"`           // The user ID of the sender of the event
	Type      Type       `json:"type"`                       // The event type
	Timestamp int64      `json:"origin_server_ts,omitempty"` // The unix timestamp when this message was sent by the origin server
	ID        id.EventID `json:"event_id,omitempty"`         // The unique ID of this event
	RoomID    id.RoomID  `json:"room_id,omitempty"`          // The room the event was sent to. May be nil (e.g. for presence)
	Content   Content    `json:"content"`                    // The JSON content of the event.
	Redacts   id.EventID `json:"redacts,omitempty"`          // The event ID that was redacted if a m.room.redaction event
	Unsigned  Unsigned   `json:"unsigned,omitempty"`         // Unsigned content set by own homeserver.

	Mautrix MautrixInfo `json:"-"`

	ToUserID   id.UserID   `json:"to_user_id,omitempty"`   // The user ID that the to-device event was sent to. Only present in MSC2409 appservice transactions.
	ToDeviceID id.DeviceID `json:"to_device_id,omitempty"` // The device ID that the to-device event was sent to. Only present in MSC2409 appservice transactions.

Event represents a single Matrix event.

func (*Event) GenerateReplyFallbackHTML

func (evt *Event) GenerateReplyFallbackHTML() string

func (*Event) GenerateReplyFallbackText

func (evt *Event) GenerateReplyFallbackText() string

func (*Event) GetStateKey

func (evt *Event) GetStateKey() string

func (*Event) MarshalJSON added in v0.9.30

func (evt *Event) MarshalJSON() ([]byte, error)

MarshalJSON marshals the event, including omitting the unsigned field if it's empty.

This is necessary because Unsigned is not a pointer (for convenience reasons), and encoding/json doesn't know how to check if a non-pointer struct is empty.

TODO(tulir): maybe it makes more sense to make Unsigned a pointer and make an easy and safe way to access it?

func (*Event) UnmarshalJSON added in v0.10.0

func (evt *Event) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the event, including moving prev_content from the top level to inside unsigned.

type EventIDChunk

type EventIDChunk struct {
	List []string `json:"-"`

func (*EventIDChunk) Serialize

func (ec *EventIDChunk) Serialize(typ RelationType) RelationChunk

func (*EventIDChunk) UnmarshalJSON

func (ec *EventIDChunk) UnmarshalJSON(data []byte) error

type FileInfo

type FileInfo struct {
	MimeType      string              `json:"mimetype,omitempty"`
	ThumbnailInfo *FileInfo           `json:"thumbnail_info,omitempty"`
	ThumbnailURL  id.ContentURIString `json:"thumbnail_url,omitempty"`
	ThumbnailFile *EncryptedFileInfo  `json:"thumbnail_file,omitempty"`
	Width         int                 `json:"-"`
	Height        int                 `json:"-"`
	Duration      int                 `json:"-"`
	Size          int                 `json:"-"`

func (*FileInfo) GetThumbnailInfo

func (fileInfo *FileInfo) GetThumbnailInfo() *FileInfo

func (*FileInfo) MarshalJSON

func (fileInfo *FileInfo) MarshalJSON() ([]byte, error)

func (*FileInfo) UnmarshalJSON

func (fileInfo *FileInfo) UnmarshalJSON(data []byte) error

type Format

type Format string

Format specifies the format of the formatted_body in m.room.message events. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-message-msgtypes

const (
	FormatHTML Format = "org.matrix.custom.html"

Message formats

type ForwardedRoomKeyEventContent

type ForwardedRoomKeyEventContent struct {
	SenderKey          id.SenderKey `json:"sender_key"`
	SenderClaimedKey   id.Ed25519   `json:"sender_claimed_ed25519_key"`
	ForwardingKeyChain []string     `json:"forwarding_curve25519_key_chain"`

ForwardedRoomKeyEventContent represents the content of a m.forwarded_room_key to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-forwarded-room-key

type FullyReadEventContent

type FullyReadEventContent struct {
	EventID id.EventID `json:"event_id"`

FullyReadEventContent represents the content of a m.fully_read account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-fully-read

type GuestAccess

type GuestAccess string

GuestAccess specifies whether or not guest accounts can join. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-guest-access

const (
	GuestAccessCanJoin   GuestAccess = "can_join"
	GuestAccessForbidden GuestAccess = "forbidden"

type GuestAccessEventContent

type GuestAccessEventContent struct {
	GuestAccess GuestAccess `json:"guest_access"`

GuestAccessEventContent represents the content of a m.room.guest_access state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-guest-access

type HistoryVisibility

type HistoryVisibility string

HistoryVisibility specifies who can see new messages. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-history-visibility

const (
	HistoryVisibilityInvited       HistoryVisibility = "invited"
	HistoryVisibilityJoined        HistoryVisibility = "joined"
	HistoryVisibilityShared        HistoryVisibility = "shared"
	HistoryVisibilityWorldReadable HistoryVisibility = "world_readable"

type HistoryVisibilityEventContent

type HistoryVisibilityEventContent struct {
	HistoryVisibility HistoryVisibility `json:"history_visibility"`

HistoryVisibilityEventContent represents the content of a m.room.history_visibility state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-history-visibility

type IgnoredUser

type IgnoredUser struct {

type IgnoredUserListEventContent

type IgnoredUserListEventContent struct {
	IgnoredUsers map[id.UserID]IgnoredUser `json:"ignored_users"`

IgnoredUserListEventContent represents the content of a m.ignored_user_list account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-ignored-user-list

type JoinRule

type JoinRule string

JoinRule specifies how open a room is to new members. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-join-rules

const (
	JoinRulePublic  JoinRule = "public"
	JoinRuleKnock   JoinRule = "knock"
	JoinRuleInvite  JoinRule = "invite"
	JoinRulePrivate JoinRule = "private"

type JoinRulesEventContent

type JoinRulesEventContent struct {
	JoinRule JoinRule `json:"join_rule"`

JoinRulesEventContent represents the content of a m.room.join_rules state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-join-rules

type KeyAgreementProtocol added in v0.7.0

type KeyAgreementProtocol string
const (
	KeyAgreementCurve25519           KeyAgreementProtocol = "curve25519"
	KeyAgreementCurve25519HKDFSHA256 KeyAgreementProtocol = "curve25519-hkdf-sha256"

type KeyRequestAction

type KeyRequestAction string

type MACMethod added in v0.7.0

type MACMethod string
const HKDFHMACSHA256 MACMethod = "hkdf-hmac-sha256"

type MautrixInfo added in v0.4.7

type MautrixInfo struct {
	Verified bool

type MemberEventContent

type MemberEventContent struct {
	Membership       Membership          `json:"membership"`
	AvatarURL        id.ContentURIString `json:"avatar_url,omitempty"`
	Displayname      string              `json:"displayname,omitempty"`
	IsDirect         bool                `json:"is_direct,omitempty"`
	ThirdPartyInvite *ThirdPartyInvite   `json:"third_party_invite,omitempty"`
	Reason           string              `json:"reason,omitempty"`

MemberEventContent represents the content of a m.room.member state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-member

type Membership

type Membership string

Membership is an enum specifying the membership state of a room member.

const (
	MembershipJoin   Membership = "join"
	MembershipLeave  Membership = "leave"
	MembershipInvite Membership = "invite"
	MembershipBan    Membership = "ban"
	MembershipKnock  Membership = "knock"

The allowed membership states as specified in spec section 10.5.5.

func (Membership) IsInviteOrJoin

func (ms Membership) IsInviteOrJoin() bool

func (Membership) IsLeaveOrBan

func (ms Membership) IsLeaveOrBan() bool

type MessageEventContent

type MessageEventContent struct {
	// Base m.room.message fields
	MsgType MessageType `json:"msgtype"`
	Body    string      `json:"body"`

	// Extra fields for text types
	Format        Format `json:"format,omitempty"`
	FormattedBody string `json:"formatted_body,omitempty"`

	// Extra field for m.location
	GeoURI string `json:"geo_uri,omitempty"`

	// Extra fields for media types
	URL  id.ContentURIString `json:"url,omitempty"`
	Info *FileInfo           `json:"info,omitempty"`
	File *EncryptedFileInfo  `json:"file,omitempty"`

	// Edits and relations
	NewContent *MessageEventContent `json:"m.new_content,omitempty"`
	RelatesTo  *RelatesTo           `json:"m.relates_to,omitempty"`

	// In-room verification
	To         id.UserID            `json:"to,omitempty"`
	FromDevice id.DeviceID          `json:"from_device,omitempty"`
	Methods    []VerificationMethod `json:"methods,omitempty"`
	// contains filtered or unexported fields

MssageEventContent represents the content of a m.room.message event.

It is also used to represent m.sticker events, as they are equivalent to m.room.message with the exception of the msgtype field.


func (*MessageEventContent) GetFile

func (content *MessageEventContent) GetFile() *EncryptedFileInfo

func (*MessageEventContent) GetInfo

func (content *MessageEventContent) GetInfo() *FileInfo

func (*MessageEventContent) GetRelatesTo

func (content *MessageEventContent) GetRelatesTo() *RelatesTo

func (*MessageEventContent) GetReplyTo

func (content *MessageEventContent) GetReplyTo() id.EventID

func (*MessageEventContent) OptionalGetRelatesTo

func (content *MessageEventContent) OptionalGetRelatesTo() *RelatesTo

func (*MessageEventContent) RemoveReplyFallback

func (content *MessageEventContent) RemoveReplyFallback()

func (*MessageEventContent) SetEdit added in v0.9.31

func (content *MessageEventContent) SetEdit(original id.EventID)

func (*MessageEventContent) SetRelatesTo

func (content *MessageEventContent) SetRelatesTo(rel *RelatesTo)

func (*MessageEventContent) SetReply

func (content *MessageEventContent) SetReply(inReplyTo *Event)

type MessageType

type MessageType string

MessageType is the sub-type of a m.room.message event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-message-msgtypes

const (
	MsgText     MessageType = "m.text"
	MsgEmote    MessageType = "m.emote"
	MsgNotice   MessageType = "m.notice"
	MsgImage    MessageType = "m.image"
	MsgLocation MessageType = "m.location"
	MsgVideo    MessageType = "m.video"
	MsgAudio    MessageType = "m.audio"
	MsgFile     MessageType = "m.file"

	MsgVerificationRequest MessageType = "m.key.verification.request"


type OlmCiphertexts

type OlmCiphertexts map[id.Curve25519]struct {
	Body string        `json:"body"`
	Type id.OlmMsgType `json:"type"`

type PinnedEventsEventContent

type PinnedEventsEventContent struct {
	Pinned []id.EventID `json:"pinned"`

PinnedEventsEventContent represents the content of a m.room.pinned_events state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-pinned-events

type PowerLevelsEventContent

type PowerLevelsEventContent struct {
	Users        map[id.UserID]int `json:"users,omitempty"`
	UsersDefault int               `json:"users_default,omitempty"`

	Events        map[string]int `json:"events,omitempty"`
	EventsDefault int            `json:"events_default,omitempty"`

	StateDefaultPtr *int `json:"state_default,omitempty"`

	InvitePtr     *int `json:"invite,omitempty"`
	KickPtr       *int `json:"kick,omitempty"`
	BanPtr        *int `json:"ban,omitempty"`
	RedactPtr     *int `json:"redact,omitempty"`
	HistoricalPtr *int `json:"historical,omitempty"`
	// contains filtered or unexported fields

PowerLevelsEventContent represents the content of a m.room.power_levels state event content. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-power-levels

func (*PowerLevelsEventContent) Ban

func (pl *PowerLevelsEventContent) Ban() int

func (*PowerLevelsEventContent) EnsureEventLevel

func (pl *PowerLevelsEventContent) EnsureEventLevel(eventType Type, level int) bool

func (*PowerLevelsEventContent) EnsureUserLevel

func (pl *PowerLevelsEventContent) EnsureUserLevel(userID id.UserID, level int) bool

func (*PowerLevelsEventContent) GetEventLevel

func (pl *PowerLevelsEventContent) GetEventLevel(eventType Type) int

func (*PowerLevelsEventContent) GetUserLevel

func (pl *PowerLevelsEventContent) GetUserLevel(userID id.UserID) int

func (*PowerLevelsEventContent) Historical added in v0.10.8

func (pl *PowerLevelsEventContent) Historical() int

func (*PowerLevelsEventContent) Invite

func (pl *PowerLevelsEventContent) Invite() int

func (*PowerLevelsEventContent) Kick

func (pl *PowerLevelsEventContent) Kick() int

func (*PowerLevelsEventContent) Redact

func (pl *PowerLevelsEventContent) Redact() int

func (*PowerLevelsEventContent) SetEventLevel

func (pl *PowerLevelsEventContent) SetEventLevel(eventType Type, level int)

func (*PowerLevelsEventContent) SetUserLevel

func (pl *PowerLevelsEventContent) SetUserLevel(userID id.UserID, level int)

func (*PowerLevelsEventContent) StateDefault

func (pl *PowerLevelsEventContent) StateDefault() int

type Presence

type Presence string
const (
	PresenceOnline      Presence = "online"
	PresenceOffline     Presence = "offline"
	PresenceUnavailable Presence = "unavailable"

type PresenceEventContent

type PresenceEventContent struct {
	Presence        Presence            `json:"presence"`
	Displayname     string              `json:"displayname,omitempty"`
	AvatarURL       id.ContentURIString `json:"avatar_url,omitempty"`
	LastActiveAgo   int64               `json:"last_active_ago,omitempty"`
	CurrentlyActive bool                `json:"currently_active,omitempty"`
	StatusMessage   string              `json:"status_msg,omitempty"`

PresenceEventContent represents the content of a m.presence ephemeral event. https://matrix.org/docs/spec/client_server/r0.6.0#m-presence

type ReactionEventContent

type ReactionEventContent struct {
	RelatesTo RelatesTo `json:"m.relates_to"`

ReactionEventContent represents the content of a m.reaction message event. This is not yet in a spec release, see https://github.com/matrix-org/matrix-doc/pull/1849

func (*ReactionEventContent) GetRelatesTo

func (content *ReactionEventContent) GetRelatesTo() *RelatesTo

func (*ReactionEventContent) OptionalGetRelatesTo

func (content *ReactionEventContent) OptionalGetRelatesTo() *RelatesTo

func (*ReactionEventContent) SetRelatesTo

func (content *ReactionEventContent) SetRelatesTo(rel *RelatesTo)

type ReadReceipt

type ReadReceipt struct {
	Timestamp int64 `json:"ts"`

	// Extra contains any unknown fields in the read receipt event.
	// Most servers don't allow clients to set them, so this will be empty in most cases.
	Extra map[string]interface{} `json:"-"`

func (*ReadReceipt) UnmarshalJSON

func (rr *ReadReceipt) UnmarshalJSON(data []byte) error

type ReceiptEventContent

type ReceiptEventContent map[id.EventID]Receipts

ReceiptEventContent represents the content of a m.receipt ephemeral event. https://matrix.org/docs/spec/client_server/r0.6.0#m-receipt

type Receipts

type Receipts struct {
	Read map[id.UserID]ReadReceipt `json:"m.read"`

type RedactionEventContent

type RedactionEventContent struct {
	Reason string `json:"reason,omitempty"`

RedactionEventContent represents the content of a m.room.redaction message event.

The redacted event ID is still at the top level, but will move in a future room version. See https://github.com/matrix-org/matrix-doc/pull/2244 and https://github.com/matrix-org/matrix-doc/pull/2174


type Relatable

type Relatable interface {
	GetRelatesTo() *RelatesTo
	OptionalGetRelatesTo() *RelatesTo
	SetRelatesTo(rel *RelatesTo)

type RelatesTo

type RelatesTo struct {
	Type    RelationType
	EventID id.EventID
	Key     string

func (*RelatesTo) GetAnnotationID

func (rel *RelatesTo) GetAnnotationID() id.EventID

func (*RelatesTo) GetAnnotationKey

func (rel *RelatesTo) GetAnnotationKey() string

func (*RelatesTo) GetReferenceID

func (rel *RelatesTo) GetReferenceID() id.EventID

func (*RelatesTo) GetReplaceID

func (rel *RelatesTo) GetReplaceID() id.EventID

func (*RelatesTo) GetReplyID added in v0.8.0

func (rel *RelatesTo) GetReplyID() id.EventID

func (*RelatesTo) MarshalJSON

func (rel *RelatesTo) MarshalJSON() ([]byte, error)

func (*RelatesTo) UnmarshalJSON

func (rel *RelatesTo) UnmarshalJSON(data []byte) error

type RelationChunk

type RelationChunk struct {
	Chunk []RelationChunkItem `json:"chunk"`

	Limited bool `json:"limited"`
	Count   int  `json:"count"`

type RelationChunkItem

type RelationChunkItem struct {
	Type    RelationType `json:"type"`
	EventID string       `json:"event_id,omitempty"`
	Key     string       `json:"key,omitempty"`
	Count   int          `json:"count,omitempty"`

type RelationType

type RelationType string
const (
	RelReplace    RelationType = "m.replace"
	RelReference  RelationType = "m.reference"
	RelAnnotation RelationType = "m.annotation"
	RelReply      RelationType = "net.maunium.reply"

type Relations

type Relations struct {
	Raw map[RelationType]RelationChunk `json:"-"`

	Annotations AnnotationChunk `json:"m.annotation,omitempty"`
	References  EventIDChunk    `json:"m.reference,omitempty"`
	Replaces    EventIDChunk    `json:"m.replace,omitempty"`

func (*Relations) MarshalJSON

func (relations *Relations) MarshalJSON() ([]byte, error)

func (*Relations) UnmarshalJSON

func (relations *Relations) UnmarshalJSON(data []byte) error

type RequestedKeyInfo

type RequestedKeyInfo struct {
	Algorithm id.Algorithm `json:"algorithm"`
	RoomID    id.RoomID    `json:"room_id"`
	SenderKey id.SenderKey `json:"sender_key"`
	SessionID id.SessionID `json:"session_id"`

type RoomAvatarEventContent

type RoomAvatarEventContent struct {
	URL id.ContentURI `json:"url"`

RoomAvatarEventContent represents the content of a m.room.avatar state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-avatar

type RoomKeyEventContent

type RoomKeyEventContent struct {
	Algorithm  id.Algorithm `json:"algorithm"`
	RoomID     id.RoomID    `json:"room_id"`
	SessionID  id.SessionID `json:"session_id"`
	SessionKey string       `json:"session_key"`

RoomKeyEventContent represents the content of a m.room_key to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-key

type RoomKeyRequestEventContent

type RoomKeyRequestEventContent struct {
	Body               RequestedKeyInfo `json:"body"`
	Action             KeyRequestAction `json:"action"`
	RequestingDeviceID id.DeviceID      `json:"requesting_device_id"`
	RequestID          string           `json:"request_id"`

RoomKeyRequestEventContent represents the content of a m.room_key_request to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-key-request

type RoomKeyWithheldCode added in v0.5.3

type RoomKeyWithheldCode string
const (
	RoomKeyWithheldBlacklisted  RoomKeyWithheldCode = "m.blacklisted"
	RoomKeyWithheldUnverified   RoomKeyWithheldCode = "m.unverified"
	RoomKeyWithheldUnauthorized RoomKeyWithheldCode = "m.unauthorized"
	RoomKeyWithheldUnavailable  RoomKeyWithheldCode = "m.unavailable"
	RoomKeyWithheldNoOlmSession RoomKeyWithheldCode = "m.no_olm"

type RoomKeyWithheldEventContent added in v0.5.3

type RoomKeyWithheldEventContent struct {
	RoomID    id.RoomID           `json:"room_id,omitempty"`
	Algorithm id.Algorithm        `json:"algorithm"`
	SessionID id.SessionID        `json:"session_id,omitempty"`
	SenderKey id.SenderKey        `json:"sender_key"`
	Code      RoomKeyWithheldCode `json:"code"`
	Reason    string              `json:"reason,omitempty"`

type RoomNameEventContent

type RoomNameEventContent struct {
	Name string `json:"name"`

RoomNameEventContent represents the content of a m.room.name state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-name

type RoomType added in v0.10.8

type RoomType string
const (
	RoomTypeDefault RoomType = ""
	RoomTypeSpace   RoomType = "m.space"

type SASMethod added in v0.7.0

type SASMethod string
const (
	SASDecimal SASMethod = "decimal"
	SASEmoji   SASMethod = "emoji"

type SpaceChildEventContent added in v0.10.8

type SpaceChildEventContent struct {
	Via   []string `json:"via,omitempty"`
	Order string   `json:"order,omitempty"`

type SpaceParentEventContent added in v0.10.8

type SpaceParentEventContent struct {
	Via       []string `json:"via,omitempty"`
	Canonical bool     `json:"canonical,omitempty"`

type StrippedState

type StrippedState struct {
	Content  Content `json:"content"`
	Type     Type    `json:"type"`
	StateKey string  `json:"state_key"`

type Tag

type Tag struct {
	Order json.Number `json:"order,omitempty"`

type TagEventContent

type TagEventContent struct {
	Tags Tags `json:"tags"`

TagEventContent represents the content of a m.tag room account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-tag

type Tags

type Tags map[string]Tag

type ThirdPartyInvite

type ThirdPartyInvite struct {
	DisplayName string `json:"display_name"`
	Signed      struct {
		Token      string          `json:"token"`
		Signatures json.RawMessage `json:"signatures"`
		MXID       string          `json:"mxid"`

type TombstoneEventContent

type TombstoneEventContent struct {
	Body            string    `json:"body"`
	ReplacementRoom id.RoomID `json:"replacement_room"`

TombstoneEventContent represents the content of a m.room.tombstone state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-tombstone

type TopicEventContent

type TopicEventContent struct {
	Topic string `json:"topic"`

TopicEventContent represents the content of a m.room.topic state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-topic

type Type

type Type struct {
	Type  string
	Class TypeClass

func NewEventType

func NewEventType(name string) Type

func (*Type) GuessClass

func (et *Type) GuessClass() TypeClass

func (*Type) IsAccountData

func (et *Type) IsAccountData() bool

func (*Type) IsCall added in v0.9.7

func (et *Type) IsCall() bool

func (*Type) IsCustom

func (et *Type) IsCustom() bool

func (*Type) IsEphemeral

func (et *Type) IsEphemeral() bool

func (*Type) IsInRoomVerification added in v0.8.0

func (et *Type) IsInRoomVerification() bool

func (*Type) IsState

func (et *Type) IsState() bool

func (*Type) IsToDevice

func (et *Type) IsToDevice() bool

func (*Type) MarshalJSON

func (et *Type) MarshalJSON() ([]byte, error)

func (Type) MarshalText added in v0.3.2

func (et Type) MarshalText() ([]byte, error)

func (*Type) Repr

func (et *Type) Repr() string

func (*Type) String

func (et *Type) String() string

func (*Type) UnmarshalJSON

func (et *Type) UnmarshalJSON(data []byte) error

func (Type) UnmarshalText added in v0.3.2

func (et Type) UnmarshalText(data []byte) error

type TypeClass

type TypeClass int
const (
	// Unknown events
	UnknownEventType TypeClass = iota
	// Normal message events
	// State events
	// Ephemeral events
	// Account data events
	// Device-to-device events

func (TypeClass) Name

func (tc TypeClass) Name() string

type TypingEventContent

type TypingEventContent struct {
	UserIDs []id.UserID `json:"user_ids"`

TagEventContent represents the content of a m.typing ephemeral event. https://matrix.org/docs/spec/client_server/r0.6.0#m-typing

type Unsigned

type Unsigned struct {
	PrevContent     *Content        `json:"prev_content,omitempty"`
	PrevSender      id.UserID       `json:"prev_sender,omitempty"`
	ReplacesState   id.EventID      `json:"replaces_state,omitempty"`
	Age             int64           `json:"age,omitempty"`
	TransactionID   string          `json:"transaction_id,omitempty"`
	Relations       Relations       `json:"m.relations,omitempty"`
	RedactedBecause *Event          `json:"redacted_because,omitempty"`
	InviteRoomState []StrippedState `json:"invite_room_state,omitempty"`

func (*Unsigned) IsEmpty added in v0.9.30

func (us *Unsigned) IsEmpty() bool

type VerificationAcceptEventContent added in v0.7.0

type VerificationAcceptEventContent struct {
	// An opaque identifier for the verification process. Must be the same as the one used for the m.key.verification.start message.
	TransactionID string `json:"transaction_id,omitempty"`
	// The verification method to use.
	Method VerificationMethod `json:"method"`
	// The key agreement protocol the device is choosing to use, out of the options in the m.key.verification.start message.
	KeyAgreementProtocol KeyAgreementProtocol `json:"key_agreement_protocol"`
	// The hash method the device is choosing to use, out of the options in the m.key.verification.start message.
	Hash VerificationHashMethod `json:"hash"`
	// The message authentication code the device is choosing to use, out of the options in the m.key.verification.start message.
	MessageAuthenticationCode MACMethod `json:"message_authentication_code"`
	// The SAS methods both devices involved in the verification process understand. Must be a subset of the options in the m.key.verification.start message.
	ShortAuthenticationString []SASMethod `json:"short_authentication_string"`
	// The hash (encoded as unpadded base64) of the concatenation of the device's ephemeral public key (encoded as unpadded base64) and the canonical JSON representation of the m.key.verification.start message.
	Commitment string `json:"commitment"`
	// The user that the event is sent to for in-room verification.
	To id.UserID `json:"to,omitempty"`
	// Original event ID for in-room verification.
	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

VerificationAcceptEventContent represents the content of a m.key.verification.accept to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-key-verification-accept

func (*VerificationAcceptEventContent) GetRelatesTo added in v0.8.0

func (vaec *VerificationAcceptEventContent) GetRelatesTo() *RelatesTo

func (*VerificationAcceptEventContent) OptionalGetRelatesTo added in v0.8.0

func (vaec *VerificationAcceptEventContent) OptionalGetRelatesTo() *RelatesTo

func (*VerificationAcceptEventContent) SetRelatesTo added in v0.8.0

func (vaec *VerificationAcceptEventContent) SetRelatesTo(rel *RelatesTo)

type VerificationCancelCode added in v0.7.0

type VerificationCancelCode string
const (
	VerificationCancelByUser             VerificationCancelCode = "m.user"
	VerificationCancelByTimeout          VerificationCancelCode = "m.timeout"
	VerificationCancelUnknownTransaction VerificationCancelCode = "m.unknown_transaction"
	VerificationCancelUnknownMethod      VerificationCancelCode = "m.unknown_method"
	VerificationCancelUnexpectedMessage  VerificationCancelCode = "m.unexpected_message"
	VerificationCancelKeyMismatch        VerificationCancelCode = "m.key_mismatch"
	VerificationCancelUserMismatch       VerificationCancelCode = "m.user_mismatch"
	VerificationCancelInvalidMessage     VerificationCancelCode = "m.invalid_message"
	VerificationCancelAccepted           VerificationCancelCode = "m.accepted"
	VerificationCancelSASMismatch        VerificationCancelCode = "m.mismatched_sas"
	VerificationCancelCommitmentMismatch VerificationCancelCode = "m.mismatched_commitment"

type VerificationCancelEventContent added in v0.7.0

type VerificationCancelEventContent struct {
	// The opaque identifier for the verification process/request.
	TransactionID string `json:"transaction_id,omitempty"`
	// A human readable description of the code. The client should only rely on this string if it does not understand the code.
	Reason string `json:"reason"`
	// The error code for why the process/request was cancelled by the user.
	Code VerificationCancelCode `json:"code"`
	// The user that the event is sent to for in-room verification.
	To id.UserID `json:"to,omitempty"`
	// Original event ID for in-room verification.
	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

VerificationCancelEventContent represents the content of a m.key.verification.cancel to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-key-verification-cancel

func (*VerificationCancelEventContent) GetRelatesTo added in v0.8.0

func (vcec *VerificationCancelEventContent) GetRelatesTo() *RelatesTo

func (*VerificationCancelEventContent) OptionalGetRelatesTo added in v0.8.0

func (vcec *VerificationCancelEventContent) OptionalGetRelatesTo() *RelatesTo

func (*VerificationCancelEventContent) SetRelatesTo added in v0.8.0

func (vcec *VerificationCancelEventContent) SetRelatesTo(rel *RelatesTo)

type VerificationHashMethod added in v0.7.0

type VerificationHashMethod string
const VerificationHashSHA256 VerificationHashMethod = "sha256"

type VerificationKeyEventContent added in v0.7.0

type VerificationKeyEventContent struct {
	// An opaque identifier for the verification process. Must be the same as the one used for the m.key.verification.start message.
	TransactionID string `json:"transaction_id,omitempty"`
	// The device's ephemeral public key, encoded as unpadded base64.
	Key string `json:"key"`
	// The user that the event is sent to for in-room verification.
	To id.UserID `json:"to,omitempty"`
	// Original event ID for in-room verification.
	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

VerificationKeyEventContent represents the content of a m.key.verification.key to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-key-verification-key

func (*VerificationKeyEventContent) GetRelatesTo added in v0.8.0

func (vkec *VerificationKeyEventContent) GetRelatesTo() *RelatesTo

func (*VerificationKeyEventContent) OptionalGetRelatesTo added in v0.8.0

func (vkec *VerificationKeyEventContent) OptionalGetRelatesTo() *RelatesTo

func (*VerificationKeyEventContent) SetRelatesTo added in v0.8.0

func (vkec *VerificationKeyEventContent) SetRelatesTo(rel *RelatesTo)

type VerificationMacEventContent added in v0.7.0

type VerificationMacEventContent struct {
	// An opaque identifier for the verification process. Must be the same as the one used for the m.key.verification.start message.
	TransactionID string `json:"transaction_id,omitempty"`
	// A map of the key ID to the MAC of the key, using the algorithm in the verification process. The MAC is encoded as unpadded base64.
	Mac map[id.KeyID]string `json:"mac"`
	// The MAC of the comma-separated, sorted, list of key IDs given in the mac property, encoded as unpadded base64.
	Keys string `json:"keys"`
	// The user that the event is sent to for in-room verification.
	To id.UserID `json:"to,omitempty"`
	// Original event ID for in-room verification.
	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

VerificationMacEventContent represents the content of a m.key.verification.mac to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-key-verification-mac

func (*VerificationMacEventContent) GetRelatesTo added in v0.8.0

func (vmec *VerificationMacEventContent) GetRelatesTo() *RelatesTo

func (*VerificationMacEventContent) OptionalGetRelatesTo added in v0.8.0

func (vmec *VerificationMacEventContent) OptionalGetRelatesTo() *RelatesTo

func (*VerificationMacEventContent) SetRelatesTo added in v0.8.0

func (vmec *VerificationMacEventContent) SetRelatesTo(rel *RelatesTo)

type VerificationMethod added in v0.7.0

type VerificationMethod string
const VerificationMethodSAS VerificationMethod = "m.sas.v1"

type VerificationReadyEventContent added in v0.8.0

type VerificationReadyEventContent struct {
	// The device ID which accepted the process.
	FromDevice id.DeviceID `json:"from_device"`
	// The verification methods supported by the sender.
	Methods []VerificationMethod `json:"methods"`
	// Original event ID for in-room verification.
	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

VerificationReadyEventContent represents the content of a m.key.verification.ready event.

func (*VerificationReadyEventContent) GetRelatesTo added in v0.8.0

func (vrec *VerificationReadyEventContent) GetRelatesTo() *RelatesTo

func (*VerificationReadyEventContent) OptionalGetRelatesTo added in v0.8.0

func (vrec *VerificationReadyEventContent) OptionalGetRelatesTo() *RelatesTo

func (*VerificationReadyEventContent) SetRelatesTo added in v0.8.0

func (vrec *VerificationReadyEventContent) SetRelatesTo(rel *RelatesTo)

type VerificationRequestEventContent added in v0.7.0

type VerificationRequestEventContent struct {
	// The device ID which is initiating the request.
	FromDevice id.DeviceID `json:"from_device"`
	// An opaque identifier for the verification request. Must be unique with respect to the devices involved.
	TransactionID string `json:"transaction_id,omitempty"`
	// The verification methods supported by the sender.
	Methods []VerificationMethod `json:"methods"`
	// The POSIX timestamp in milliseconds for when the request was made.
	Timestamp int64 `json:"timestamp,omitempty"`
	// The user that the event is sent to for in-room verification.
	To id.UserID `json:"to,omitempty"`
	// Original event ID for in-room verification.
	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

VerificationRequestEventContent represents the content of a m.key.verification.request to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-key-verification-request

func (*VerificationRequestEventContent) SupportsVerificationMethod added in v0.7.0

func (vrec *VerificationRequestEventContent) SupportsVerificationMethod(meth VerificationMethod) bool

type VerificationStartEventContent added in v0.7.0

type VerificationStartEventContent struct {
	// The device ID which is initiating the process.
	FromDevice id.DeviceID `json:"from_device"`
	// An opaque identifier for the verification process. Must be unique with respect to the devices involved.
	TransactionID string `json:"transaction_id,omitempty"`
	// The verification method to use.
	Method VerificationMethod `json:"method"`
	// The key agreement protocols the sending device understands.
	KeyAgreementProtocols []KeyAgreementProtocol `json:"key_agreement_protocols"`
	// The hash methods the sending device understands.
	Hashes []VerificationHashMethod `json:"hashes"`
	// The message authentication codes that the sending device understands.
	MessageAuthenticationCodes []MACMethod `json:"message_authentication_codes"`
	// The SAS methods the sending device (and the sending device's user) understands.
	ShortAuthenticationString []SASMethod `json:"short_authentication_string"`
	// The user that the event is sent to for in-room verification.
	To id.UserID `json:"to,omitempty"`
	// Original event ID for in-room verification.
	RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`

VerificationStartEventContent represents the content of a m.key.verification.start to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-key-verification-start

func (*VerificationStartEventContent) GetRelatesTo added in v0.8.0

func (vsec *VerificationStartEventContent) GetRelatesTo() *RelatesTo

func (*VerificationStartEventContent) OptionalGetRelatesTo added in v0.8.0

func (vsec *VerificationStartEventContent) OptionalGetRelatesTo() *RelatesTo

func (*VerificationStartEventContent) SetRelatesTo added in v0.8.0

func (vsec *VerificationStartEventContent) SetRelatesTo(rel *RelatesTo)

func (*VerificationStartEventContent) SupportsHashMethod added in v0.7.0

func (vsec *VerificationStartEventContent) SupportsHashMethod(alg VerificationHashMethod) bool

func (*VerificationStartEventContent) SupportsKeyAgreementProtocol added in v0.7.0

func (vsec *VerificationStartEventContent) SupportsKeyAgreementProtocol(proto KeyAgreementProtocol) bool

func (*VerificationStartEventContent) SupportsMACMethod added in v0.7.0

func (vsec *VerificationStartEventContent) SupportsMACMethod(meth MACMethod) bool

func (*VerificationStartEventContent) SupportsSASMethod added in v0.7.0

func (vsec *VerificationStartEventContent) SupportsSASMethod(meth SASMethod) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL