Skip to content

Commit

Permalink
Merge pull request #115 from mautrix/max/be-8304
Browse files Browse the repository at this point in the history
Add request and response types for room key backup
  • Loading branch information
vurpo authored Mar 6, 2023
2 parents 9f920e3 + f1d9a23 commit 3fb2661
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
20 changes: 20 additions & 0 deletions requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,23 @@ type ReqBeeperSplitRoom struct {
Key string `json:"key"`
Parts []BeeperSplitRoomPart `json:"parts"`
}

type ReqRoomKeysVersionCreate struct {
Algorithm string `json:"algorithm"`
AuthData json.RawMessage `json:"auth_data"`
}

type ReqRoomKeysUpdate struct {
Rooms map[id.RoomID]ReqRoomKeysRoomUpdate `json:"rooms"`
}

type ReqRoomKeysRoomUpdate struct {
Sessions map[id.SessionID]ReqRoomKeysSessionUpdate `json:"sessions"`
}

type ReqRoomKeysSessionUpdate struct {
FirstMessageIndex int `json:"first_message_index"`
ForwardedCount int `json:"forwarded_count"`
IsVerified bool `json:"is_verified"`
SessionData json.RawMessage `json:"session_data"`
}
32 changes: 32 additions & 0 deletions responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,3 +562,35 @@ type RespTimestampToEvent struct {
EventID id.EventID `json:"event_id"`
Timestamp jsontime.UnixMilli `json:"origin_server_ts"`
}

type RespRoomKeysVersionCreate struct {
Version string `json:"version"`
}

type RespRoomKeysVersion struct {
Algorithm string `json:"algorithm"`
AuthData json.RawMessage `json:"auth_data"`
Count int `json:"count"`
ETag string `json:"etag"`
Version string `json:"version"`
}

type RespRoomKeys struct {
Rooms map[id.RoomID]RespRoomKeysRoom `json:"rooms"`
}

type RespRoomKeysRoom struct {
Sessions map[id.SessionID]RespRoomKeysSession `json:"sessions"`
}

type RespRoomKeysSession struct {
FirstMessageIndex int `json:"first_message_index"`
ForwardedCount int `json:"forwarded_count"`
IsVerified bool `json:"is_verified"`
SessionData json.RawMessage `json:"session_data"`
}

type RespRoomKeysUpdate struct {
Count int `json:"count"`
ETag string `json:"etag"`
}

0 comments on commit 3fb2661

Please sign in to comment.