Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeUserLocalpart(str string) (string, error)
- func EncodeUserLocalpart(str string) string
- func IsValidMediaID(mediaID string) bool
- func ParseCommonIdentifier[Stringish ~string](identifier Stringish) (sigil byte, localpart, homeserver string)
- func ValidateServerName(serverName string) bool
- func ValidateUserLocalpart(localpart string) error
- type Algorithm
- type BatchID
- type ContentURI
- func (uri ContentURI) CUString() ContentURIString
- func (uri ContentURI) IsEmpty() bool
- func (uri ContentURI) IsValid() bool
- func (uri *ContentURI) MarshalJSON() ([]byte, error)
- func (uri ContentURI) MarshalText() ([]byte, error)
- func (uri *ContentURI) Scan(i interface{}) error
- func (uri ContentURI) String() string
- func (uri *ContentURI) UnmarshalJSON(raw []byte) (err error)
- func (uri *ContentURI) UnmarshalText(raw []byte) (err error)
- func (uri *ContentURI) Value() (driver.Value, error)
- type ContentURIString
- type CrossSigningKey
- type CrossSigningUsage
- type Curve25519
- type Device
- type DeviceID
- type DeviceKeyID
- type Ed25519
- type EventID
- type EventIDFormat
- type IdentityKey
- type KeyAlgorithm
- type KeyBackupAlgorithm
- type KeyBackupVersion
- type KeyID
- type MatrixURI
- func (uri *MatrixURI) EventID() EventID
- func (uri *MatrixURI) MatrixToURL() string
- func (uri *MatrixURI) PrimaryIdentifier() string
- func (uri *MatrixURI) RoomAlias() RoomAlias
- func (uri *MatrixURI) RoomID() RoomID
- func (uri *MatrixURI) SecondaryIdentifier() string
- func (uri *MatrixURI) String() string
- func (uri *MatrixURI) UserID() UserID
- type OlmMsgType
- type ParsedServerName
- type ParsedServerNameType
- type RoomAlias
- type RoomID
- type RoomVersion
- func (rv RoomVersion) CreatorInContent() bool
- func (rv RoomVersion) EnforceSigningKeyValidity() bool
- func (rv RoomVersion) Equals(versions ...RoomVersion) bool
- func (rv RoomVersion) EventIDFormat() EventIDFormat
- func (rv RoomVersion) ForbidFloatsAndBigInts() bool
- func (rv RoomVersion) IsKnown() bool
- func (rv RoomVersion) KnockRestricted() bool
- func (rv RoomVersion) Knocks() bool
- func (rv RoomVersion) NotEquals(versions ...RoomVersion) bool
- func (rv RoomVersion) NotificationsPowerLevels() bool
- func (rv RoomVersion) PrivilegedRoomCreators() bool
- func (rv RoomVersion) RedactsInContent() bool
- func (rv RoomVersion) RestrictedJoins() bool
- func (rv RoomVersion) RestrictedJoinsFix() bool
- func (rv RoomVersion) RoomIDIsCreateEventID() bool
- func (rv RoomVersion) SpecialCasedAliasesAuth() bool
- func (rv RoomVersion) StateResVersion() StateResVersion
- func (rv RoomVersion) UpdatedRedactionRules() bool
- func (rv RoomVersion) ValidatePowerLevelInts() bool
- type Secret
- type SenderKey
- type SessionID
- type SigningKey
- type StateResVersion
- type TrustState
- type UserID
- func (userID UserID) Homeserver() string
- func (userID UserID) Localpart() string
- func (userID UserID) Parse() (localpart, homeserver string, err error)
- func (userID UserID) ParseAndDecode() (localpart, homeserver string, err error)
- func (userID UserID) ParseAndValidate() (localpart, homeserver string, err error)
- func (userID UserID) String() string
- func (userID UserID) URI() *MatrixURI
- type VerificationTransactionID
Constants ¶
const UserIDMaxLength = 255
Variables ¶
var ( InvalidContentURI = errors.New("invalid Matrix content URI") InputNotJSONString = errors.New("input doesn't look like a JSON string") )
var ( ErrInvalidScheme = errors.New("matrix URI scheme must be exactly 'matrix'") ErrInvalidPartCount = errors.New("matrix URIs must have exactly 2 or 4 segments") ErrInvalidFirstSegment = errors.New("invalid identifier in first segment of matrix URI") ErrEmptySecondSegment = errors.New("the second segment of the matrix URI must not be empty") ErrInvalidThirdSegment = errors.New("invalid identifier in third segment of matrix URI") ErrEmptyFourthSegment = errors.New("the fourth segment of the matrix URI must not be empty when the third segment is present") )
Errors that can happen when parsing matrix: URIs
var ( ErrNotMatrixTo = errors.New("that URL is not a matrix.to URL") ErrInvalidMatrixToPartCount = errors.New("matrix.to URLs must have exactly 1 or 2 segments") ErrEmptyMatrixToPrimaryIdentifier = errors.New("the primary identifier in the matrix.to URL is empty") ErrInvalidMatrixToPrimaryIdentifier = errors.New("the primary identifier in the matrix.to URL has an invalid sigil") ErrInvalidMatrixToSecondaryIdentifier = errors.New("the secondary identifier in the matrix.to URL has an invalid sigil") )
Errors that can happen when parsing matrix.to URLs
var ( ErrInvalidUserID = errors.New("is not a valid user ID") ErrNoncompliantLocalpart = errors.New("contains characters that are not allowed") ErrUserIDTooLong = errors.New("the given user ID is longer than 255 characters") ErrEmptyLocalpart = errors.New("empty localparts are not allowed") ErrNoncompliantServerPart = errors.New("is not a valid server name") )
var ErrNotMatrixToOrMatrixURI = errors.New("that URL is not a matrix.to URL nor matrix: URI")
var ErrUnknownRoomVersion = errors.New("unknown room version")
var ServerNameRegex = regexp.MustCompile(`^(?:\[([0-9A-Fa-f:.]{2,45})]|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|([0-9A-Za-z.-]{1,255}))(?::(\d{1,5}))?$`)
var SigilToPathSegment = map[rune]string{
'$': "e",
'#': "r",
'!': "roomid",
'@': "u",
}
SigilToPathSegment contains a mapping from Matrix identifier sigils to matrix: URI path segments.
var ValidLocalpartRegex = regexp.MustCompile("^[0-9a-z-.=_/+]+$")
Functions ¶
func DecodeUserLocalpart ¶
DecodeUserLocalpart decodes the given string back into the original input string. Returns an error if the given string is not a valid user ID localpart encoding. See https://spec.matrix.org/v1.2/appendices/#mapping-from-other-character-sets
This decodes quoted-printable bytes back into UTF8, and unescapes casing. For example:
_alph=40_bet=5f50up => Alph@Bet_50up
Returns an error if the input string contains characters outside the range "a-z0-9._=-", has an invalid quote-printable byte (e.g. not hex), or has an invalid _ escaped byte (e.g. "_5").
func EncodeUserLocalpart ¶
EncodeUserLocalpart encodes the given string into Matrix-compliant user ID localpart form. See https://spec.matrix.org/v1.2/appendices/#mapping-from-other-character-sets
This returns a string with only the characters "a-z0-9._=-". The uppercase range A-Z are encoded using leading underscores ("_"). Characters outside the aforementioned ranges (including literal underscores ("_") and equals ("=")) are encoded as UTF8 code points (NOT NCRs) and converted to lower-case hex with a leading "=". For example:
Alph@Bet_50up => _alph=40_bet=5f50up
func IsValidMediaID ¶ added in v0.20.0
func ParseCommonIdentifier ¶ added in v0.18.0
func ParseCommonIdentifier[Stringish ~string](identifier Stringish) (sigil byte, localpart, homeserver string)
ParseCommonIdentifier parses a common identifier according to https://spec.matrix.org/v1.9/appendices/#common-identifier-format
func ValidateServerName ¶ added in v0.24.1
func ValidateUserLocalpart ¶ added in v0.8.4
ValidateUserLocalpart validates a Matrix user ID localpart using the grammar in https://matrix.org/docs/spec/appendices#user-identifier
Types ¶
type Algorithm ¶
type Algorithm string
Algorithm is a Matrix message encryption algorithm. https://spec.matrix.org/v1.2/client-server-api/#messaging-algorithm-names
type BatchID ¶ added in v0.9.30
type BatchID string
A BatchID is a string identifying a batch of events being backfilled to a room. https://github.com/matrix-org/matrix-doc/pull/2716
type ContentURI ¶
ContentURI represents a Matrix content URI. https://spec.matrix.org/v1.2/client-server-api/#matrix-content-mxc-uris
func MustParseContentURI ¶
func MustParseContentURI(uri string) ContentURI
func ParseContentURI ¶
func ParseContentURI(uri string) (parsed ContentURI, err error)
ParseContentURI parses a Matrix content URI.
func ParseContentURIBytes ¶
func ParseContentURIBytes(uri []byte) (parsed ContentURI, err error)
func (ContentURI) CUString ¶
func (uri ContentURI) CUString() ContentURIString
func (ContentURI) IsEmpty ¶
func (uri ContentURI) IsEmpty() bool
func (ContentURI) IsValid ¶ added in v0.20.0
func (uri ContentURI) IsValid() bool
func (*ContentURI) MarshalJSON ¶
func (uri *ContentURI) MarshalJSON() ([]byte, error)
func (ContentURI) MarshalText ¶ added in v0.3.6
func (uri ContentURI) MarshalText() ([]byte, error)
func (*ContentURI) Scan ¶ added in v0.12.0
func (uri *ContentURI) Scan(i interface{}) error
func (ContentURI) String ¶
func (uri ContentURI) String() string
func (*ContentURI) UnmarshalJSON ¶
func (uri *ContentURI) UnmarshalJSON(raw []byte) (err error)
func (*ContentURI) UnmarshalText ¶ added in v0.3.6
func (uri *ContentURI) UnmarshalText(raw []byte) (err error)
type ContentURIString ¶
type ContentURIString string
ContentURIString is a string that's expected to be a Matrix content URI. It's useful for delaying the parsing of the content URI to move errors from the event content JSON parsing step to a later step where more appropriate errors can be produced.
func (ContentURIString) Parse ¶
func (uriString ContentURIString) Parse() (ContentURI, error)
func (ContentURIString) ParseOrIgnore ¶
func (uriString ContentURIString) ParseOrIgnore() ContentURI
type CrossSigningKey ¶ added in v0.12.0
type CrossSigningUsage ¶ added in v0.8.0
type CrossSigningUsage string
const ( XSUsageMaster CrossSigningUsage = "master" XSUsageSelfSigning CrossSigningUsage = "self_signing" XSUsageUserSigning CrossSigningUsage = "user_signing" )
type Curve25519 ¶
type Curve25519 string
Curve25519 is the base64 representation of an Curve25519 public key
func (Curve25519) Bytes ¶ added in v0.18.0
func (curve25519 Curve25519) Bytes() []byte
func (Curve25519) String ¶
func (curve25519 Curve25519) String() string
type Device ¶ added in v0.12.0
type Device struct { UserID UserID DeviceID DeviceID IdentityKey Curve25519 SigningKey Ed25519 Trust TrustState Deleted bool Name string }
Device contains the identity details of a device and some additional info.
func (*Device) Fingerprint ¶ added in v0.12.0
type DeviceID ¶
type DeviceID string
A DeviceID is an arbitrary string that references a specific device.
type DeviceKeyID ¶
type DeviceKeyID string
A DeviceKeyID is a string formatted as <algorithm>:<device_id> that is used as the key in deviceid-key mappings.
func NewDeviceKeyID ¶
func NewDeviceKeyID(algorithm KeyAlgorithm, deviceID DeviceID) DeviceKeyID
func (DeviceKeyID) Parse ¶
func (deviceKeyID DeviceKeyID) Parse() (Algorithm, DeviceID)
func (DeviceKeyID) String ¶
func (deviceKeyID DeviceKeyID) String() string
type Ed25519 ¶
type Ed25519 string
Ed25519 is the base64 representation of an Ed25519 public key
func (Ed25519) Fingerprint ¶ added in v0.12.0
type EventID ¶
type EventID string
An EventID is a string starting with $ that references a specific event.
https://matrix.org/docs/spec/appendices#room-ids-and-event-ids https://matrix.org/docs/spec/rooms/v4#event-ids
type EventIDFormat ¶ added in v0.25.0
type EventIDFormat int
const ( // EventIDFormatCustom is the original format used by room v1 and v2. // Event IDs in this format are an arbitrary string followed by a colon and the server name. EventIDFormatCustom EventIDFormat = 0 // EventIDFormatBase64 is the format used by room v3 introduced by https://github.com/matrix-org/matrix-spec-proposals/pull/1659. // Event IDs in this format are the standard unpadded base64-encoded SHA256 reference hash of the event. EventIDFormatBase64 EventIDFormat = 1 // EventIDFormatURLSafeBase64 is the format used by room v4 and later introduced by https://github.com/matrix-org/matrix-spec-proposals/pull/2002. // Event IDs in this format are the url-safe unpadded base64-encoded SHA256 reference hash of the event. EventIDFormatURLSafeBase64 EventIDFormat = 2 )
type IdentityKey ¶ added in v0.5.5
type IdentityKey = Curve25519
type KeyAlgorithm ¶
type KeyAlgorithm string
const ( KeyAlgorithmCurve25519 KeyAlgorithm = "curve25519" KeyAlgorithmEd25519 KeyAlgorithm = "ed25519" KeyAlgorithmSignedCurve25519 KeyAlgorithm = "signed_curve25519" )
type KeyBackupAlgorithm ¶ added in v0.18.0
type KeyBackupAlgorithm string
const (
KeyBackupAlgorithmMegolmBackupV1 KeyBackupAlgorithm = "m.megolm_backup.v1.curve25519-aes-sha2"
)
type KeyBackupVersion ¶ added in v0.18.0
type KeyBackupVersion string
BackupVersion is an arbitrary string that identifies a server side key backup.
func (KeyBackupVersion) String ¶ added in v0.18.0
func (version KeyBackupVersion) String() string
type KeyID ¶
type KeyID string
A KeyID a string formatted as <keyalgorithm>:<key_id> that is used as the key in one-time-key mappings.
func NewKeyID ¶
func NewKeyID(algorithm KeyAlgorithm, keyID string) KeyID
func (KeyID) Parse ¶
func (keyID KeyID) Parse() (KeyAlgorithm, string)
type MatrixURI ¶ added in v0.9.13
type MatrixURI struct { Sigil1 rune Sigil2 rune MXID1 string MXID2 string Via []string Action string }
MatrixURI contains the result of parsing a matrix: URI using ParseMatrixURI
func ParseMatrixToURL ¶ added in v0.9.13
ParseMatrixToURL parses a matrix.to URL into the same container as ParseMatrixURI parses matrix: URIs.
func ParseMatrixURI ¶ added in v0.9.13
ParseMatrixURI implements the matrix: URI parsing algorithm.
Currently specified in https://github.com/matrix-org/matrix-doc/blob/master/proposals/2312-matrix-uri.md#uri-parsing-algorithm
func ParseMatrixURIOrMatrixToURL ¶ added in v0.9.13
ParseMatrixURIOrMatrixToURL parses the given matrix.to URL or matrix: URI into a unified representation.
func ProcessMatrixToURL ¶ added in v0.9.13
ProcessMatrixToURL is the equivalent of ProcessMatrixURI for matrix.to URLs.
func ProcessMatrixURI ¶ added in v0.9.13
ProcessMatrixURI implements steps 2-7 of the matrix: URI parsing algorithm (i.e. everything except parsing the URI itself, which is done with url.Parse or ParseMatrixURI)
func (*MatrixURI) EventID ¶ added in v0.9.13
EventID returns the event ID from the URI if the primary identifier is a room ID or alias and the secondary identifier is an event ID.
func (*MatrixURI) MatrixToURL ¶ added in v0.9.13
MatrixToURL converts to parsed matrix: URI into a matrix.to URL
func (*MatrixURI) PrimaryIdentifier ¶ added in v0.9.13
PrimaryIdentifier returns the first Matrix identifier in the URI. Currently room IDs, room aliases and user IDs can be in the primary identifier slot.
func (*MatrixURI) RoomAlias ¶ added in v0.9.13
RoomAlias returns the room alias from the URI if the primary identifier is a room alias.
func (*MatrixURI) RoomID ¶ added in v0.9.13
RoomID returns the room ID from the URI if the primary identifier is a room ID.
func (*MatrixURI) SecondaryIdentifier ¶ added in v0.9.13
SecondaryIdentifier returns the second Matrix identifier in the URI. Currently only event IDs can be in the secondary identifier slot.
type OlmMsgType ¶
type OlmMsgType int
OlmMsgType is an Olm message type
const ( OlmMsgTypePreKey OlmMsgType = 0 OlmMsgTypeMsg OlmMsgType = 1 )
type ParsedServerName ¶ added in v0.24.1
type ParsedServerName struct { Type ParsedServerNameType Host string Port int }
func ParseServerName ¶ added in v0.24.1
func ParseServerName(serverName string) *ParsedServerName
type ParsedServerNameType ¶ added in v0.24.1
type ParsedServerNameType int
const ( ServerNameDNS ParsedServerNameType = iota ServerNameIPv4 ServerNameIPv6 )
type RoomAlias ¶
type RoomAlias string
A RoomAlias is a string starting with # that can be resolved into. https://matrix.org/docs/spec/appendices#room-aliases
func NewRoomAlias ¶
type RoomID ¶
type RoomID string
A RoomID is a string starting with ! that references a specific room. https://matrix.org/docs/spec/appendices#room-ids-and-event-ids
type RoomVersion ¶ added in v0.25.0
type RoomVersion string
const ( RoomV0 RoomVersion = "" // No room version, used for rooms created before room versions were introduced, equivalent to v1 RoomV1 RoomVersion = "1" RoomV2 RoomVersion = "2" RoomV3 RoomVersion = "3" RoomV4 RoomVersion = "4" RoomV5 RoomVersion = "5" RoomV6 RoomVersion = "6" RoomV7 RoomVersion = "7" RoomV8 RoomVersion = "8" RoomV9 RoomVersion = "9" RoomV10 RoomVersion = "10" RoomV11 RoomVersion = "11" RoomV12 RoomVersion = "12" )
func (RoomVersion) CreatorInContent ¶ added in v0.25.0
func (rv RoomVersion) CreatorInContent() bool
CreatorInContent returns true if the `m.room.create` event has a `creator` field in content.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2175
func (RoomVersion) EnforceSigningKeyValidity ¶ added in v0.25.0
func (rv RoomVersion) EnforceSigningKeyValidity() bool
EnforceSigningKeyValidity returns true if the `valid_until_ts` field of federation signing keys must be enforced on received events.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2076
func (RoomVersion) Equals ¶ added in v0.25.0
func (rv RoomVersion) Equals(versions ...RoomVersion) bool
func (RoomVersion) EventIDFormat ¶ added in v0.25.0
func (rv RoomVersion) EventIDFormat() EventIDFormat
EventIDFormat returns the format of event IDs used by this room version.
func (RoomVersion) ForbidFloatsAndBigInts ¶ added in v0.25.0
func (rv RoomVersion) ForbidFloatsAndBigInts() bool
ForbidFloatsAndBigInts returns true if floats and integers greater than 2^53-1 or lower than -2^53+1 are forbidden everywhere.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2540
func (RoomVersion) IsKnown ¶ added in v0.25.0
func (rv RoomVersion) IsKnown() bool
func (RoomVersion) KnockRestricted ¶ added in v0.25.0
func (rv RoomVersion) KnockRestricted() bool
KnockRestricted returns true if the `knock_restricted` join rule is supported.
See https://github.com/matrix-org/matrix-spec-proposals/pull/3787
func (RoomVersion) Knocks ¶ added in v0.25.0
func (rv RoomVersion) Knocks() bool
Knocks returns true if the `knock` join rule is supported.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2403
func (RoomVersion) NotEquals ¶ added in v0.25.0
func (rv RoomVersion) NotEquals(versions ...RoomVersion) bool
func (RoomVersion) NotificationsPowerLevels ¶ added in v0.25.0
func (rv RoomVersion) NotificationsPowerLevels() bool
NotificationsPowerLevels returns true if the `notifications` field in `m.room.power_levels` is validated in event auth. However, the field is not protected from redactions.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2209
func (RoomVersion) PrivilegedRoomCreators ¶ added in v0.25.0
func (rv RoomVersion) PrivilegedRoomCreators() bool
PrivilegedRoomCreators returns true if the creator(s) of a room always have infinite power level. This also implies that the `m.room.create` event has an `additional_creators` field, and that the creators can't be present in the `m.room.power_levels` event.
See https://github.com/matrix-org/matrix-spec-proposals/pull/4289
func (RoomVersion) RedactsInContent ¶ added in v0.25.0
func (rv RoomVersion) RedactsInContent() bool
RedactsInContent returns true if the `m.room.redaction` event has the `redacts` field in content instead of at the top level. The redaction protection is also moved from the top level to the content field.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2174 (and https://github.com/matrix-org/matrix-spec-proposals/pull/2176 for the redaction protection).
func (RoomVersion) RestrictedJoins ¶ added in v0.25.0
func (rv RoomVersion) RestrictedJoins() bool
RestrictedJoins returns true if the `restricted` join rule is supported. This also implies that the `allow` field in the `m.room.join_rules` event is supported and protected from redactions.
See https://github.com/matrix-org/matrix-spec-proposals/pull/3083
func (RoomVersion) RestrictedJoinsFix ¶ added in v0.25.0
func (rv RoomVersion) RestrictedJoinsFix() bool
RestrictedJoinsFix returns true if the `join_authorised_via_users_server` field in `m.room.member` events is protected from redactions.
See https://github.com/matrix-org/matrix-spec-proposals/pull/3375
func (RoomVersion) RoomIDIsCreateEventID ¶ added in v0.25.0
func (rv RoomVersion) RoomIDIsCreateEventID() bool
RoomIDIsCreateEventID returns true if the ID of rooms is the same as the ID of the `m.room.create` event. This also implies that `m.room.create` events do not have a `room_id` field.
See https://github.com/matrix-org/matrix-spec-proposals/pull/4291
func (RoomVersion) SpecialCasedAliasesAuth ¶ added in v0.25.0
func (rv RoomVersion) SpecialCasedAliasesAuth() bool
SpecialCasedAliasesAuth returns true if the `m.room.aliases` event authorization is special cased to only always allow servers to modify the state event with their own server name as state key. This also implies that the `aliases` field is protected from redactions.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2432
func (RoomVersion) StateResVersion ¶ added in v0.25.0
func (rv RoomVersion) StateResVersion() StateResVersion
StateResVersion returns the version of the state resolution algorithm used by this room version.
func (RoomVersion) UpdatedRedactionRules ¶ added in v0.25.0
func (rv RoomVersion) UpdatedRedactionRules() bool
UpdatedRedactionRules returns true if various updates to the redaction algorithm are applied.
Specifically:
* the `membership`, `origin`, and `prev_state` fields at the top level of all events are no longer protected. * the entire content of `m.room.create` is protected. * the `redacts` field in `m.room.redaction` content is protected instead of the top-level field. * the `m.room.power_levels` event protects the `invite` field in content. * the `signed` field inside the `third_party_invite` field in content of `m.room.member` events is protected.
See https://github.com/matrix-org/matrix-spec-proposals/pull/2176, https://github.com/matrix-org/matrix-spec-proposals/pull/3821, and https://github.com/matrix-org/matrix-spec-proposals/pull/3989
func (RoomVersion) ValidatePowerLevelInts ¶ added in v0.25.0
func (rv RoomVersion) ValidatePowerLevelInts() bool
ValidatePowerLevelInts returns true if the known values in `m.room.power_levels` must be integers (and not strings).
See https://github.com/matrix-org/matrix-spec-proposals/pull/3667
type SenderKey ¶
type SenderKey = Curve25519
type SessionID ¶
type SessionID string
A SessionID is an arbitrary string that identifies an Olm or Megolm session.
type SigningKey ¶ added in v0.5.5
type SigningKey = Ed25519
type StateResVersion ¶ added in v0.25.0
type StateResVersion int
const ( // StateResV1 is the original state resolution algorithm. StateResV1 StateResVersion = 0 // StateResV2 is state resolution v2 introduced by https://github.com/matrix-org/matrix-spec-proposals/pull/1759 StateResV2 StateResVersion = 1 // StateResV2_1 is state resolution v2.1 introduced by https://github.com/matrix-org/matrix-spec-proposals/pull/4297 StateResV2_1 StateResVersion = 2 )
type TrustState ¶ added in v0.12.0
type TrustState int
TrustState determines how trusted a device is.
const ( TrustStateBlacklisted TrustState = -100 TrustStateUnset TrustState = 0 TrustStateUnknownDevice TrustState = 10 TrustStateForwarded TrustState = 20 TrustStateCrossSignedUntrusted TrustState = 50 TrustStateCrossSignedTOFU TrustState = 100 TrustStateCrossSignedVerified TrustState = 200 TrustStateVerified TrustState = 300 TrustStateInvalid TrustState = (1 << 31) - 1 )
func ParseTrustState ¶ added in v0.12.0
func ParseTrustState(val string) TrustState
func (*TrustState) MarshalText ¶ added in v0.12.0
func (ts *TrustState) MarshalText() ([]byte, error)
func (TrustState) String ¶ added in v0.12.0
func (ts TrustState) String() string
func (*TrustState) UnmarshalText ¶ added in v0.12.0
func (ts *TrustState) UnmarshalText(data []byte) error
type UserID ¶
type UserID string
UserID represents a Matrix user ID. https://matrix.org/docs/spec/appendices#user-identifiers
func NewEncodedUserID ¶
func (UserID) Homeserver ¶ added in v0.12.0
func (UserID) Parse ¶
Parse parses the user ID into the localpart and server name.
Note that this only enforces very basic user ID formatting requirements: user IDs start with a @, and contain a : after the @. If you want to enforce localpart validity, see the ParseAndValidate and ValidateUserLocalpart functions.
func (UserID) ParseAndDecode ¶
func (UserID) ParseAndValidate ¶ added in v0.8.4
ParseAndValidate parses the user ID into the localpart and server name like Parse, and also validates that the localpart is allowed according to the user identifiers spec.
type VerificationTransactionID ¶ added in v0.18.0
type VerificationTransactionID string
VerificationTransactionID is a unique identifier for a verification transaction.
func NewVerificationTransactionID ¶ added in v0.18.0
func NewVerificationTransactionID() VerificationTransactionID
func (VerificationTransactionID) String ¶ added in v0.18.0
func (t VerificationTransactionID) String() string