Add EDU server wiring

This commit is contained in:
Neil Alexander 2021-07-28 14:06:23 +01:00
parent dcadec88d9
commit 8683f7553f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
9 changed files with 105 additions and 0 deletions

View file

@ -75,6 +75,18 @@ type InputReceiptEventRequest struct {
// InputReceiptEventResponse is a response to InputReceiptEventRequest
type InputReceiptEventResponse struct{}
type SigningKeyUpdate struct {
MasterKey gomatrixserverlib.CrossSigningKey `json:"master_key"`
SelfSigningKey gomatrixserverlib.CrossSigningKey `json:"cross_signing_key"`
UserID string `json:"user_id"`
}
type InputSigningKeyUpdateRequest struct {
SigningKeyUpdate
}
type InputSigningKeyUpdateResponse struct{}
// EDUServerInputAPI is used to write events to the typing server.
type EDUServerInputAPI interface {
InputTypingEvent(
@ -94,4 +106,10 @@ type EDUServerInputAPI interface {
request *InputReceiptEventRequest,
response *InputReceiptEventResponse,
) error
InputSigningKeyUpdate(
ctx context.Context,
request *InputSigningKeyUpdateRequest,
response *InputSigningKeyUpdateResponse,
) error
}

View file

@ -85,3 +85,9 @@ type FederationReceiptData struct {
Data ReceiptTS `json:"data"`
EventIDs []string `json:"event_ids"`
}
type OutputSigningKeyUpdate struct {
SigningKeyUpdate
Type string `json:"type"`
Timestamp gomatrixserverlib.Timestamp `json:"timestamp"`
}

View file

@ -86,3 +86,20 @@ func SendReceipt(
response := InputReceiptEventResponse{}
return eduAPI.InputReceiptEvent(ctx, &request, &response)
}
func SendSigningKeyUpdate(
ctx context.Context,
eduAPI EDUServerInputAPI,
userID string,
masterKey, selfSigningKey gomatrixserverlib.CrossSigningKey,
) error {
request := InputSigningKeyUpdateRequest{
SigningKeyUpdate: SigningKeyUpdate{
MasterKey: masterKey,
SelfSigningKey: selfSigningKey,
UserID: userID,
},
}
response := InputSigningKeyUpdateResponse{}
return eduAPI.InputSigningKeyUpdate(ctx, &request, &response)
}