Documentation ¶
Index ¶
- Constants
- type Account
- type AccountType
- type Conflict
- type Device
- type ErrorConflict
- type ErrorForbidden
- type InputAccountDataRequest
- type InputAccountDataResponse
- type InternalKeyBackupSession
- type KeyBackupSession
- type OpenIDToken
- type OpenIDTokenAttributes
- type PerformAccountCreationRequest
- type PerformAccountCreationResponse
- type PerformAccountDeactivationRequest
- type PerformAccountDeactivationResponse
- type PerformDeviceCreationRequest
- type PerformDeviceCreationResponse
- type PerformDeviceDeletionRequest
- type PerformDeviceDeletionResponse
- type PerformDeviceUpdateRequest
- type PerformDeviceUpdateResponse
- type PerformKeyBackupRequest
- type PerformKeyBackupResponse
- type PerformLastSeenUpdateRequest
- type PerformLastSeenUpdateResponse
- type PerformOpenIDTokenCreationRequest
- type PerformOpenIDTokenCreationResponse
- type PerformPasswordUpdateRequest
- type PerformPasswordUpdateResponse
- type QueryAccessTokenRequest
- type QueryAccessTokenResponse
- type QueryAccountDataRequest
- type QueryAccountDataResponse
- type QueryDeviceInfosRequest
- type QueryDeviceInfosResponse
- type QueryDevicesRequest
- type QueryDevicesResponse
- type QueryKeyBackupRequest
- type QueryKeyBackupResponse
- type QueryOpenIDTokenRequest
- type QueryOpenIDTokenResponse
- type QueryProfileRequest
- type QueryProfileResponse
- type QuerySearchProfilesRequest
- type QuerySearchProfilesResponse
- type UserInfo
- type UserInternalAPI
- type UserInternalAPITrace
- func (t *UserInternalAPITrace) InputAccountData(ctx context.Context, req *InputAccountDataRequest, ...) error
- func (t *UserInternalAPITrace) PerformAccountCreation(ctx context.Context, req *PerformAccountCreationRequest, ...) error
- func (t *UserInternalAPITrace) PerformAccountDeactivation(ctx context.Context, req *PerformAccountDeactivationRequest, ...) error
- func (t *UserInternalAPITrace) PerformDeviceCreation(ctx context.Context, req *PerformDeviceCreationRequest, ...) error
- func (t *UserInternalAPITrace) PerformDeviceDeletion(ctx context.Context, req *PerformDeviceDeletionRequest, ...) error
- func (t *UserInternalAPITrace) PerformDeviceUpdate(ctx context.Context, req *PerformDeviceUpdateRequest, ...) error
- func (t *UserInternalAPITrace) PerformKeyBackup(ctx context.Context, req *PerformKeyBackupRequest, ...) error
- func (t *UserInternalAPITrace) PerformLastSeenUpdate(ctx context.Context, req *PerformLastSeenUpdateRequest, ...) error
- func (t *UserInternalAPITrace) PerformOpenIDTokenCreation(ctx context.Context, req *PerformOpenIDTokenCreationRequest, ...) error
- func (t *UserInternalAPITrace) PerformPasswordUpdate(ctx context.Context, req *PerformPasswordUpdateRequest, ...) error
- func (t *UserInternalAPITrace) QueryAccessToken(ctx context.Context, req *QueryAccessTokenRequest, ...) error
- func (t *UserInternalAPITrace) QueryAccountData(ctx context.Context, req *QueryAccountDataRequest, ...) error
- func (t *UserInternalAPITrace) QueryDeviceInfos(ctx context.Context, req *QueryDeviceInfosRequest, ...) error
- func (t *UserInternalAPITrace) QueryDevices(ctx context.Context, req *QueryDevicesRequest, res *QueryDevicesResponse) error
- func (t *UserInternalAPITrace) QueryKeyBackup(ctx context.Context, req *QueryKeyBackupRequest, res *QueryKeyBackupResponse)
- func (t *UserInternalAPITrace) QueryOpenIDToken(ctx context.Context, req *QueryOpenIDTokenRequest, ...) error
- func (t *UserInternalAPITrace) QueryProfile(ctx context.Context, req *QueryProfileRequest, res *QueryProfileResponse) error
- func (t *UserInternalAPITrace) QuerySearchProfiles(ctx context.Context, req *QuerySearchProfilesRequest, ...) error
Constants ¶
const ( // ConflictUpdate will update matching records returning no error ConflictUpdate Conflict = 1 // ConflictAbort will reject the request with ErrorConflict ConflictAbort Conflict = 2 // AccountTypeUser indicates this is a user account AccountTypeUser AccountType = 1 // AccountTypeGuest indicates this is a guest account AccountTypeGuest AccountType = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { UserID string Localpart string ServerName gomatrixserverlib.ServerName AppServiceID string }
Account represents a Matrix account on this home server.
type Conflict ¶
type Conflict int
Conflict is an enum representing what to do when encountering conflicting when creating profiles/devices
type Device ¶
type Device struct { ID string UserID string // The access_token granted to this device. // This uniquely identifies the device from all other devices and clients. AccessToken string // The unique ID of the session identified by the access token. // Can be used as a secure substitution in places where data needs to be // associated with access tokens. SessionID int64 DisplayName string LastSeenTS int64 LastSeenIP string UserAgent string // If the device is for an appservice user, // this is the appservice ID. AppserviceID string }
Device represents a client's device (mobile, web, etc)
type ErrorConflict ¶
type ErrorConflict struct {
Message string
}
ErrorConflict is an error indicating that there was a conflict which resulted in the request being aborted.
func (*ErrorConflict) Error ¶
func (e *ErrorConflict) Error() string
type ErrorForbidden ¶
type ErrorForbidden struct {
Message string
}
ErrorForbidden is an error indicating that the supplied access token is forbidden
func (*ErrorForbidden) Error ¶
func (e *ErrorForbidden) Error() string
type InputAccountDataRequest ¶
type InputAccountDataRequest struct { UserID string // required: the user to set account data for RoomID string // optional: the room to associate the account data with DataType string // required: the data type of the data AccountData json.RawMessage // required: the message content }
InputAccountDataRequest is the request for InputAccountData
type InputAccountDataResponse ¶
type InputAccountDataResponse struct { }
InputAccountDataResponse is the response for InputAccountData
type InternalKeyBackupSession ¶ added in v0.5.0
type InternalKeyBackupSession struct { KeyBackupSession RoomID string SessionID string }
Internal KeyBackupData for passing to/from the storage layer
type KeyBackupSession ¶ added in v0.5.0
type KeyBackupSession struct { FirstMessageIndex int `json:"first_message_index"` ForwardedCount int `json:"forwarded_count"` IsVerified bool `json:"is_verified"` SessionData json.RawMessage `json:"session_data"` }
KeyBackupData in https://spec.matrix.org/unstable/client-server-api/#get_matrixclientr0room_keyskeysroomidsessionid
func (*KeyBackupSession) ShouldReplaceRoomKey ¶ added in v0.5.0
func (a *KeyBackupSession) ShouldReplaceRoomKey(newKey *KeyBackupSession) bool
type OpenIDToken ¶ added in v0.4.0
OpenIDToken represents an OpenID token
type OpenIDTokenAttributes ¶ added in v0.4.0
OpenIDTokenInfo represents the attributes associated with an issued OpenID token
type PerformAccountCreationRequest ¶
type PerformAccountCreationRequest struct { AccountType AccountType // Required: whether this is a guest or user account Localpart string // Required: The localpart for this account. Ignored if account type is guest. AppServiceID string // optional: the application service ID (not user ID) creating this account, if any. Password string // optional: if missing then this account will be a passwordless account OnConflict Conflict }
PerformAccountCreationRequest is the request for PerformAccountCreation
type PerformAccountCreationResponse ¶
PerformAccountCreationResponse is the response for PerformAccountCreation
type PerformAccountDeactivationRequest ¶
type PerformAccountDeactivationRequest struct {
Localpart string
}
PerformAccountDeactivationRequest is the request for PerformAccountDeactivation
type PerformAccountDeactivationResponse ¶
type PerformAccountDeactivationResponse struct {
AccountDeactivated bool
}
PerformAccountDeactivationResponse is the response for PerformAccountDeactivation
type PerformDeviceCreationRequest ¶
type PerformDeviceCreationRequest struct { Localpart string AccessToken string // optional: if blank one will be made on your behalf // optional: if nil an ID is generated for you. If set, replaces any existing device session, // which will generate a new access token and invalidate the old one. DeviceID *string // optional: if nil no display name will be associated with this device. DeviceDisplayName *string // IP address of this device IPAddr string // Useragent for this device UserAgent string // NoDeviceListUpdate determines whether we should avoid sending a device list // update for this account. Generally the only reason to do this is if the account // is an appservice account. NoDeviceListUpdate bool }
PerformDeviceCreationRequest is the request for PerformDeviceCreation
type PerformDeviceCreationResponse ¶
PerformDeviceCreationResponse is the response for PerformDeviceCreation
type PerformDeviceDeletionRequest ¶
type PerformDeviceDeletionRequest struct { UserID string // The devices to delete. An empty slice means delete all devices. DeviceIDs []string // The requesting device ID to exclude from deletion. This is needed // so that a password change doesn't cause that client to be logged // out. Only specify when DeviceIDs is empty. ExceptDeviceID string }
type PerformDeviceDeletionResponse ¶
type PerformDeviceDeletionResponse struct { }
type PerformKeyBackupRequest ¶ added in v0.5.0
type PerformKeyBackupRequest struct { UserID string Version string // optional if modifying a key backup AuthData json.RawMessage Algorithm string DeleteBackup bool // if true will delete the backup based on 'Version'. // The keys to upload, if any. If blank, creates/updates/deletes key version metadata only. Keys struct { Rooms map[string]struct { Sessions map[string]KeyBackupSession `json:"sessions"` } `json:"rooms"` } }
type PerformKeyBackupResponse ¶ added in v0.5.0
type PerformKeyBackupResponse struct { Error string // set if there was a problem performing the request BadInput bool // if set, the Error was due to bad input (HTTP 400) Exists bool // set to true if the Version exists Version string // the newly created version KeyCount int64 // only set if Keys were given in the request KeyETag string // only set if Keys were given in the request }
type PerformLastSeenUpdateRequest ¶ added in v0.3.1
PerformLastSeenUpdateRequest is the request for PerformLastSeenUpdate.
type PerformLastSeenUpdateResponse ¶ added in v0.3.1
type PerformLastSeenUpdateResponse struct { }
PerformLastSeenUpdateResponse is the response for PerformLastSeenUpdate.
type PerformOpenIDTokenCreationRequest ¶ added in v0.4.0
type PerformOpenIDTokenCreationRequest struct {
UserID string
}
PerformOpenIDTokenCreationRequest is the request for PerformOpenIDTokenCreation
type PerformOpenIDTokenCreationResponse ¶ added in v0.4.0
type PerformOpenIDTokenCreationResponse struct {
Token OpenIDToken
}
PerformOpenIDTokenCreationResponse is the response for PerformOpenIDTokenCreation
type PerformPasswordUpdateRequest ¶
type PerformPasswordUpdateRequest struct { Localpart string // Required: The localpart for this account. Password string // Required: The new password to set. }
PerformAccountCreationRequest is the request for PerformAccountCreation
type PerformPasswordUpdateResponse ¶
PerformAccountCreationResponse is the response for PerformAccountCreation
type QueryAccessTokenRequest ¶
type QueryAccessTokenRequest struct { AccessToken string // optional user ID, valid only if the token is an appservice. // https://matrix.org/docs/spec/application_service/r0.1.2#using-sync-and-events AppServiceUserID string }
QueryAccessTokenRequest is the request for QueryAccessToken
type QueryAccessTokenResponse ¶
QueryAccessTokenResponse is the response for QueryAccessToken
type QueryAccountDataRequest ¶
type QueryAccountDataRequest struct { UserID string // required: the user to get account data for. RoomID string // optional: the room ID, or global account data if not specified. DataType string // optional: the data type, or all types if not specified. }
QueryAccountDataRequest is the request for QueryAccountData
type QueryAccountDataResponse ¶
type QueryAccountDataResponse struct { GlobalAccountData map[string]json.RawMessage // type -> data RoomAccountData map[string]map[string]json.RawMessage // room -> type -> data }
QueryAccountDataResponse is the response for QueryAccountData
type QueryDeviceInfosRequest ¶
type QueryDeviceInfosRequest struct {
DeviceIDs []string
}
QueryDeviceInfosRequest is the request to QueryDeviceInfos
type QueryDeviceInfosResponse ¶
type QueryDeviceInfosResponse struct { DeviceInfo map[string]struct { DisplayName string UserID string } }
QueryDeviceInfosResponse is the response to QueryDeviceInfos
type QueryDevicesRequest ¶
type QueryDevicesRequest struct {
UserID string
}
QueryDevicesRequest is the request for QueryDevices
type QueryDevicesResponse ¶
QueryDevicesResponse is the response for QueryDevices
type QueryKeyBackupRequest ¶ added in v0.5.0
type QueryKeyBackupRequest struct { UserID string Version string // the version to query, if blank it means the latest ReturnKeys bool // whether to return keys in the backup response or just the metadata KeysForRoomID string // optional string to return keys which belong to this room KeysForSessionID string // optional string to return keys which belong to this (room, session) }
type QueryKeyBackupResponse ¶ added in v0.5.0
type QueryKeyBackupResponse struct { Error string Exists bool Algorithm string `json:"algorithm"` AuthData json.RawMessage `json:"auth_data"` Count int64 `json:"count"` ETag string `json:"etag"` Version string `json:"version"` Keys map[string]map[string]KeyBackupSession // the keys if ReturnKeys=true }
type QueryOpenIDTokenRequest ¶ added in v0.4.0
type QueryOpenIDTokenRequest struct {
Token string
}
QueryOpenIDTokenRequest is the request for QueryOpenIDToken
type QueryOpenIDTokenResponse ¶ added in v0.4.0
type QueryOpenIDTokenResponse struct { Sub string // The Matrix User ID that generated the token ExpiresAtMS int64 }
QueryOpenIDTokenResponse is the response for QueryOpenIDToken
type QueryProfileRequest ¶
type QueryProfileRequest struct { // The user ID to query UserID string }
QueryProfileRequest is the request for QueryProfile
type QueryProfileResponse ¶
type QueryProfileResponse struct { // True if the user exists. Querying for a profile does not create them. UserExists bool // The current display name if set. DisplayName string // The current avatar URL if set. AvatarURL string }
QueryProfileResponse is the response for QueryProfile
type QuerySearchProfilesRequest ¶
type QuerySearchProfilesRequest struct { // The search string to match SearchString string // How many results to return Limit int }
QuerySearchProfilesRequest is the request for QueryProfile
type QuerySearchProfilesResponse ¶
type QuerySearchProfilesResponse struct { // Profiles matching the search Profiles []authtypes.Profile }
QuerySearchProfilesResponse is the response for QuerySearchProfilesRequest
type UserInfo ¶ added in v0.4.0
type UserInfo struct {
Sub string // The Matrix user's ID who generated the token
}
UserInfo is for returning information about the user an OpenID token was issued for
type UserInternalAPI ¶
type UserInternalAPI interface { InputAccountData(ctx context.Context, req *InputAccountDataRequest, res *InputAccountDataResponse) error PerformAccountCreation(ctx context.Context, req *PerformAccountCreationRequest, res *PerformAccountCreationResponse) error PerformPasswordUpdate(ctx context.Context, req *PerformPasswordUpdateRequest, res *PerformPasswordUpdateResponse) error PerformDeviceCreation(ctx context.Context, req *PerformDeviceCreationRequest, res *PerformDeviceCreationResponse) error PerformDeviceDeletion(ctx context.Context, req *PerformDeviceDeletionRequest, res *PerformDeviceDeletionResponse) error PerformLastSeenUpdate(ctx context.Context, req *PerformLastSeenUpdateRequest, res *PerformLastSeenUpdateResponse) error PerformDeviceUpdate(ctx context.Context, req *PerformDeviceUpdateRequest, res *PerformDeviceUpdateResponse) error PerformAccountDeactivation(ctx context.Context, req *PerformAccountDeactivationRequest, res *PerformAccountDeactivationResponse) error PerformOpenIDTokenCreation(ctx context.Context, req *PerformOpenIDTokenCreationRequest, res *PerformOpenIDTokenCreationResponse) error PerformKeyBackup(ctx context.Context, req *PerformKeyBackupRequest, res *PerformKeyBackupResponse) error QueryKeyBackup(ctx context.Context, req *QueryKeyBackupRequest, res *QueryKeyBackupResponse) QueryProfile(ctx context.Context, req *QueryProfileRequest, res *QueryProfileResponse) error QueryAccessToken(ctx context.Context, req *QueryAccessTokenRequest, res *QueryAccessTokenResponse) error QueryDevices(ctx context.Context, req *QueryDevicesRequest, res *QueryDevicesResponse) error QueryAccountData(ctx context.Context, req *QueryAccountDataRequest, res *QueryAccountDataResponse) error QueryDeviceInfos(ctx context.Context, req *QueryDeviceInfosRequest, res *QueryDeviceInfosResponse) error QuerySearchProfiles(ctx context.Context, req *QuerySearchProfilesRequest, res *QuerySearchProfilesResponse) error QueryOpenIDToken(ctx context.Context, req *QueryOpenIDTokenRequest, res *QueryOpenIDTokenResponse) error }
UserInternalAPI is the internal API for information about users and devices.
type UserInternalAPITrace ¶ added in v0.5.0
type UserInternalAPITrace struct {
Impl UserInternalAPI
}
UserInternalAPITrace wraps a RoomserverInternalAPI and logs the complete request/response/error
func (*UserInternalAPITrace) InputAccountData ¶ added in v0.5.0
func (t *UserInternalAPITrace) InputAccountData(ctx context.Context, req *InputAccountDataRequest, res *InputAccountDataResponse) error
func (*UserInternalAPITrace) PerformAccountCreation ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformAccountCreation(ctx context.Context, req *PerformAccountCreationRequest, res *PerformAccountCreationResponse) error
func (*UserInternalAPITrace) PerformAccountDeactivation ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformAccountDeactivation(ctx context.Context, req *PerformAccountDeactivationRequest, res *PerformAccountDeactivationResponse) error
func (*UserInternalAPITrace) PerformDeviceCreation ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformDeviceCreation(ctx context.Context, req *PerformDeviceCreationRequest, res *PerformDeviceCreationResponse) error
func (*UserInternalAPITrace) PerformDeviceDeletion ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformDeviceDeletion(ctx context.Context, req *PerformDeviceDeletionRequest, res *PerformDeviceDeletionResponse) error
func (*UserInternalAPITrace) PerformDeviceUpdate ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformDeviceUpdate(ctx context.Context, req *PerformDeviceUpdateRequest, res *PerformDeviceUpdateResponse) error
func (*UserInternalAPITrace) PerformKeyBackup ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformKeyBackup(ctx context.Context, req *PerformKeyBackupRequest, res *PerformKeyBackupResponse) error
func (*UserInternalAPITrace) PerformLastSeenUpdate ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformLastSeenUpdate(ctx context.Context, req *PerformLastSeenUpdateRequest, res *PerformLastSeenUpdateResponse) error
func (*UserInternalAPITrace) PerformOpenIDTokenCreation ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformOpenIDTokenCreation(ctx context.Context, req *PerformOpenIDTokenCreationRequest, res *PerformOpenIDTokenCreationResponse) error
func (*UserInternalAPITrace) PerformPasswordUpdate ¶ added in v0.5.0
func (t *UserInternalAPITrace) PerformPasswordUpdate(ctx context.Context, req *PerformPasswordUpdateRequest, res *PerformPasswordUpdateResponse) error
func (*UserInternalAPITrace) QueryAccessToken ¶ added in v0.5.0
func (t *UserInternalAPITrace) QueryAccessToken(ctx context.Context, req *QueryAccessTokenRequest, res *QueryAccessTokenResponse) error
func (*UserInternalAPITrace) QueryAccountData ¶ added in v0.5.0
func (t *UserInternalAPITrace) QueryAccountData(ctx context.Context, req *QueryAccountDataRequest, res *QueryAccountDataResponse) error
func (*UserInternalAPITrace) QueryDeviceInfos ¶ added in v0.5.0
func (t *UserInternalAPITrace) QueryDeviceInfos(ctx context.Context, req *QueryDeviceInfosRequest, res *QueryDeviceInfosResponse) error
func (*UserInternalAPITrace) QueryDevices ¶ added in v0.5.0
func (t *UserInternalAPITrace) QueryDevices(ctx context.Context, req *QueryDevicesRequest, res *QueryDevicesResponse) error
func (*UserInternalAPITrace) QueryKeyBackup ¶ added in v0.5.0
func (t *UserInternalAPITrace) QueryKeyBackup(ctx context.Context, req *QueryKeyBackupRequest, res *QueryKeyBackupResponse)
func (*UserInternalAPITrace) QueryOpenIDToken ¶ added in v0.5.0
func (t *UserInternalAPITrace) QueryOpenIDToken(ctx context.Context, req *QueryOpenIDTokenRequest, res *QueryOpenIDTokenResponse) error
func (*UserInternalAPITrace) QueryProfile ¶ added in v0.5.0
func (t *UserInternalAPITrace) QueryProfile(ctx context.Context, req *QueryProfileRequest, res *QueryProfileResponse) error
func (*UserInternalAPITrace) QuerySearchProfiles ¶ added in v0.5.0
func (t *UserInternalAPITrace) QuerySearchProfiles(ctx context.Context, req *QuerySearchProfilesRequest, res *QuerySearchProfilesResponse) error