Documentation ¶
Index ¶
- type ClientKeyAPI
- type CrossSigningKeyUpdate
- type DeviceKeys
- type DeviceMessage
- type DeviceMessageType
- type FederationKeyAPI
- type KeyError
- type KeyInternalAPI
- type OneTimeKeys
- type OneTimeKeysCount
- type OutputCrossSigningKeyUpdate
- type PerformClaimKeysRequest
- type PerformClaimKeysResponse
- type PerformDeleteKeysRequest
- type PerformDeleteKeysResponse
- type PerformUploadDeviceKeysRequest
- type PerformUploadDeviceKeysResponse
- type PerformUploadDeviceSignaturesRequest
- type PerformUploadDeviceSignaturesResponse
- type PerformUploadKeysRequest
- type PerformUploadKeysResponse
- type QueryDeviceMessagesRequest
- type QueryDeviceMessagesResponse
- type QueryKeyChangesRequest
- type QueryKeyChangesResponse
- type QueryKeysRequest
- type QueryKeysResponse
- type QueryOneTimeKeysRequest
- type QueryOneTimeKeysResponse
- type QuerySignaturesRequest
- type QuerySignaturesResponse
- type SyncKeyAPI
- type UserKeyAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientKeyAPI ¶
type ClientKeyAPI interface { QueryKeys(ctx context.Context, req *QueryKeysRequest, res *QueryKeysResponse) PerformUploadKeys(ctx context.Context, req *PerformUploadKeysRequest, res *PerformUploadKeysResponse) PerformUploadDeviceKeys(ctx context.Context, req *PerformUploadDeviceKeysRequest, res *PerformUploadDeviceKeysResponse) PerformUploadDeviceSignatures(ctx context.Context, req *PerformUploadDeviceSignaturesRequest, res *PerformUploadDeviceSignaturesResponse) // PerformClaimKeys claims one-time keys for use in pre-key messages PerformClaimKeys(ctx context.Context, req *PerformClaimKeysRequest, res *PerformClaimKeysResponse) }
API functions required by the clientapi
type CrossSigningKeyUpdate ¶
type CrossSigningKeyUpdate struct { MasterKey *gomatrixserverlib.CrossSigningKey `json:"master_key,omitempty"` SelfSigningKey *gomatrixserverlib.CrossSigningKey `json:"self_signing_key,omitempty"` UserID string `json:"user_id"` }
type DeviceKeys ¶
type DeviceKeys struct { // The user who owns this device UserID string // The device ID of this device DeviceID string // The device display name DisplayName string // The raw device key JSON KeyJSON []byte }
DeviceKeys represents a set of device keys for a single device https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-upload
func (*DeviceKeys) WithStreamID ¶
func (k *DeviceKeys) WithStreamID(streamID int64) DeviceMessage
WithStreamID returns a copy of this device message with the given stream ID
type DeviceMessage ¶
type DeviceMessage struct { Type DeviceMessageType `json:"Type,omitempty"` *DeviceKeys `json:"DeviceKeys,omitempty"` *OutputCrossSigningKeyUpdate `json:"CrossSigningKeyUpdate,omitempty"` // A monotonically increasing number which represents device changes for this user. StreamID int64 DeviceChangeID int64 }
DeviceMessage represents the message produced into Kafka by the key server.
func (*DeviceMessage) DeviceKeysEqual ¶
func (m1 *DeviceMessage) DeviceKeysEqual(m2 *DeviceMessage) bool
DeviceKeysEqual returns true if the device keys updates contain the same display name and key JSON. This will return false if either of the updates is not a device keys update, or if the user ID/device ID differ between the two.
type DeviceMessageType ¶
type DeviceMessageType int
const ( TypeDeviceKeyUpdate DeviceMessageType = iota TypeCrossSigningUpdate )
type FederationKeyAPI ¶
type FederationKeyAPI interface { QueryKeys(ctx context.Context, req *QueryKeysRequest, res *QueryKeysResponse) QuerySignatures(ctx context.Context, req *QuerySignaturesRequest, res *QuerySignaturesResponse) QueryDeviceMessages(ctx context.Context, req *QueryDeviceMessagesRequest, res *QueryDeviceMessagesResponse) PerformUploadDeviceKeys(ctx context.Context, req *PerformUploadDeviceKeysRequest, res *PerformUploadDeviceKeysResponse) PerformClaimKeys(ctx context.Context, req *PerformClaimKeysRequest, res *PerformClaimKeysResponse) }
type KeyError ¶
type KeyError struct { Err string `json:"error"` IsInvalidSignature bool `json:"is_invalid_signature,omitempty"` // M_INVALID_SIGNATURE IsMissingParam bool `json:"is_missing_param,omitempty"` // M_MISSING_PARAM IsInvalidParam bool `json:"is_invalid_param,omitempty"` // M_INVALID_PARAM }
KeyError is returned if there was a problem performing/querying the server
type KeyInternalAPI ¶
type KeyInternalAPI interface { SyncKeyAPI ClientKeyAPI FederationKeyAPI UserKeyAPI // SetUserAPI assigns a user API to query when extracting device names. SetUserAPI(i userapi.KeyserverUserAPI) }
type OneTimeKeys ¶
type OneTimeKeys struct { // The user who owns this device UserID string // The device ID of this device DeviceID string // A map of algorithm:key_id => key JSON KeyJSON map[string]json.RawMessage }
OneTimeKeys represents a set of one-time keys for a single device https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-keys-upload
type OneTimeKeysCount ¶
type OneTimeKeysCount struct { // The user who owns this device UserID string // The device ID of this device DeviceID string // algorithm to count e.g: // { // "curve25519": 10, // "signed_curve25519": 20 // } KeyCount map[string]int }
OneTimeKeysCount represents the counts of one-time keys for a single device
type OutputCrossSigningKeyUpdate ¶
type OutputCrossSigningKeyUpdate struct {
CrossSigningKeyUpdate `json:"signing_keys"`
}
OutputCrossSigningKeyUpdate is an entry in the signing key update output kafka log
type PerformClaimKeysRequest ¶
type PerformClaimKeysResponse ¶
type PerformClaimKeysResponse struct { // Map of user_id to device_id to algorithm:key_id to key JSON OneTimeKeys map[string]map[string]map[string]json.RawMessage // Map of remote server domain to error JSON Failures map[string]interface{} // Set if there was a fatal error processing this action Error *KeyError }
type PerformDeleteKeysRequest ¶
type PerformDeleteKeysRequest struct { UserID string KeyIDs []gomatrixserverlib.KeyID }
PerformDeleteKeysRequest asks the keyserver to forget about certain keys, and signatures related to those keys.
type PerformDeleteKeysResponse ¶
type PerformDeleteKeysResponse struct {
Error *KeyError
}
PerformDeleteKeysResponse is the response to PerformDeleteKeysRequest.
type PerformUploadDeviceKeysRequest ¶
type PerformUploadDeviceKeysRequest struct { gomatrixserverlib.CrossSigningKeys // The user that uploaded the key, should be populated by the clientapi. UserID string }
type PerformUploadDeviceKeysResponse ¶
type PerformUploadDeviceKeysResponse struct {
Error *KeyError
}
type PerformUploadDeviceSignaturesRequest ¶
type PerformUploadDeviceSignaturesRequest struct { Signatures map[string]map[gomatrixserverlib.KeyID]gomatrixserverlib.CrossSigningForKeyOrDevice // The user that uploaded the sig, should be populated by the clientapi. UserID string }
type PerformUploadDeviceSignaturesResponse ¶
type PerformUploadDeviceSignaturesResponse struct {
Error *KeyError
}
type PerformUploadKeysRequest ¶
type PerformUploadKeysRequest struct { UserID string // Required - User performing the request DeviceID string // Optional - Device performing the request, for fetching OTK count DeviceKeys []DeviceKeys OneTimeKeys []OneTimeKeys // OnlyDisplayNameUpdates should be `true` if ALL the DeviceKeys are present to update // the display name for their respective device, and NOT to modify the keys. The key // itself doesn't change but it's easier to pretend upload new keys and reuse the same code paths. // Without this flag, requests to modify device display names would delete device keys. OnlyDisplayNameUpdates bool }
PerformUploadKeysRequest is the request to PerformUploadKeys
type PerformUploadKeysResponse ¶
type PerformUploadKeysResponse struct { // A fatal error when processing e.g database failures Error *KeyError // A map of user_id -> device_id -> Error for tracking failures. KeyErrors map[string]map[string]*KeyError OneTimeKeyCounts []OneTimeKeysCount }
PerformUploadKeysResponse is the response to PerformUploadKeys
func (*PerformUploadKeysResponse) KeyError ¶
func (r *PerformUploadKeysResponse) KeyError(userID, deviceID string, err *KeyError)
KeyError sets a key error field on KeyErrors
type QueryDeviceMessagesRequest ¶
type QueryDeviceMessagesRequest struct {
UserID string
}
type QueryDeviceMessagesResponse ¶
type QueryDeviceMessagesResponse struct { // The latest stream ID StreamID int64 Devices []DeviceMessage Error *KeyError }
type QueryKeyChangesRequest ¶
type QueryKeyChangesRequest struct { // The offset of the last received key event, or sarama.OffsetOldest if this is from the beginning Offset int64 // The inclusive offset where to track key changes up to. Messages with this offset are included in the response. // Use types.OffsetNewest if the offset is unknown (then check the response Offset to avoid racing). ToOffset int64 }
type QueryKeyChangesResponse ¶
type QueryKeysRequest ¶
type QueryKeysResponse ¶
type QueryKeysResponse struct { // Map of remote server domain to error JSON Failures map[string]interface{} // Map of user_id to device_id to device_key DeviceKeys map[string]map[string]json.RawMessage // Maps of user_id to cross signing key MasterKeys map[string]gomatrixserverlib.CrossSigningKey SelfSigningKeys map[string]gomatrixserverlib.CrossSigningKey UserSigningKeys map[string]gomatrixserverlib.CrossSigningKey // Set if there was a fatal error processing this query Error *KeyError }
type QueryOneTimeKeysRequest ¶
type QueryOneTimeKeysResponse ¶
type QueryOneTimeKeysResponse struct { // OTK key counts, in the extended /sync form described by https://matrix.org/docs/spec/client_server/r0.6.1#id84 Count OneTimeKeysCount Error *KeyError }
type QuerySignaturesRequest ¶
type QuerySignaturesRequest struct { // A map of target user ID -> target key/device IDs to retrieve signatures for TargetIDs map[string][]gomatrixserverlib.KeyID `json:"target_ids"` }
type QuerySignaturesResponse ¶
type QuerySignaturesResponse struct { // A map of target user ID -> target key/device ID -> origin user ID -> origin key/device ID -> signatures Signatures map[string]map[gomatrixserverlib.KeyID]types.CrossSigningSigMap // A map of target user ID -> cross-signing master key MasterKeys map[string]gomatrixserverlib.CrossSigningKey // A map of target user ID -> cross-signing self-signing key SelfSigningKeys map[string]gomatrixserverlib.CrossSigningKey // A map of target user ID -> cross-signing user-signing key UserSigningKeys map[string]gomatrixserverlib.CrossSigningKey // The request error, if any Error *KeyError }
type SyncKeyAPI ¶
type SyncKeyAPI interface { QueryKeyChanges(ctx context.Context, req *QueryKeyChangesRequest, res *QueryKeyChangesResponse) QueryOneTimeKeys(ctx context.Context, req *QueryOneTimeKeysRequest, res *QueryOneTimeKeysResponse) }
API functions required by the syncapi
type UserKeyAPI ¶
type UserKeyAPI interface { PerformUploadKeys(ctx context.Context, req *PerformUploadKeysRequest, res *PerformUploadKeysResponse) PerformDeleteKeys(ctx context.Context, req *PerformDeleteKeysRequest, res *PerformDeleteKeysResponse) }
API functions required by the userapi