Skip to content

Commit a91c644

Browse files
authored
Merge pull request #2639 from uhoreg/backup_version_required
various key backups fixes
2 parents 782aed7 + b44ebaa commit a91c644

File tree

3 files changed

+73
-55
lines changed

3 files changed

+73
-55
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2020 The Matrix.org Foundation C.I.C.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
type: object
16+
title: RoomKeyBackup
17+
description: "The backed up keys for a room."
18+
properties:
19+
sessions:
20+
type: object
21+
description: "A map of session IDs to key data."
22+
additionalProperties:
23+
allOf:
24+
- $ref: "key_backup_data.yaml"
25+
example: {
26+
"sessionid1": {
27+
"first_message_index": 1,
28+
"forwarded_count": 0,
29+
"is_verified": true,
30+
"session_data": {
31+
"ephemeral": "base64+ephemeral+key",
32+
"ciphertext": "base64+ciphertext+of+JSON+data",
33+
"mac": "base64+mac+of+ciphertext"
34+
}
35+
}
36+
}
37+
required:
38+
- sessions

api/client-server/key_backup.yaml

Lines changed: 34 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ paths:
130130
example: "anopaquestring"
131131
version:
132132
type: string
133-
description: The backup version
133+
description: The backup version.
134134
example: "1"
135135
required:
136136
- algorithm
@@ -212,7 +212,7 @@ paths:
212212
example: "anopaquestring"
213213
version:
214214
type: string
215-
description: The backup version
215+
description: The backup version.
216216
example: "1"
217217
required:
218218
- algorithm
@@ -450,7 +450,7 @@ paths:
450450
type: string
451451
name: version
452452
description: |-
453-
The backup from which to retrieve the key
453+
The backup from which to retrieve the key.
454454
required: true
455455
x-example: "1"
456456
- in: path
@@ -569,22 +569,7 @@ paths:
569569
description: "The backup data"
570570
name: backupData
571571
schema:
572-
type: object
573-
properties:
574-
sessions:
575-
type: object
576-
description: |-
577-
A map of session IDs to key data.
578-
additionalProperties:
579-
allOf:
580-
- $ref: "definitions/key_backup_data.yaml"
581-
example: {
582-
"sessionid1": {
583-
"ephemeral": "base64+ephemeral+key",
584-
"ciphertext": "base64+ciphertext+of+JSON+data",
585-
"mac": "base64+mac+of+ciphertext"
586-
}
587-
}
572+
$ref: "definitions/room_key_backup.yaml"
588573
responses:
589574
200:
590575
description: The update succeeded
@@ -645,7 +630,7 @@ paths:
645630
type: string
646631
name: version
647632
description: |-
648-
The backup from which to retrieve the key
633+
The backup from which to retrieve the key.
649634
required: true
650635
x-example: "1"
651636
- in: path
@@ -661,21 +646,7 @@ paths:
661646
``sessions`` property will be returned (``{"sessions": {}}``).
662647
schema:
663648
type: object
664-
properties:
665-
sessions:
666-
type: object
667-
description: |-
668-
A map of session IDs to key data.
669-
additionalProperties:
670-
allOf:
671-
- $ref: "definitions/key_backup_data.yaml"
672-
example: {
673-
"sessionid1": {
674-
"ephemeral": "base64+ephemeral+key",
675-
"ciphertext": "base64+ciphertext+of+JSON+data",
676-
"mac": "base64+mac+of+ciphertext"
677-
}
678-
}
649+
$ref: "definitions/room_key_backup.yaml"
679650
404:
680651
description: |-
681652
The backup was not found.
@@ -702,7 +673,7 @@ paths:
702673
type: string
703674
name: version
704675
description: |-
705-
The backup from which to delete the key
676+
The backup from which to delete the key.
706677
required: true
707678
x-example: "1"
708679
- in: path
@@ -761,31 +732,36 @@ paths:
761732
required: true
762733
x-example: "1"
763734
- in: body
764-
description: "The backup data"
735+
description: "The backup data."
765736
name: backupData
766737
schema:
767738
type: object
768739
properties:
769740
rooms:
770741
type: object
771742
description: |-
772-
A map of room IDs to session IDs to key data.
743+
A map of room IDs to room key backup data.
773744
additionalProperties:
774-
type: object
775-
additionalProperties:
776-
allOf:
777-
- $ref: "definitions/key_backup_data.yaml"
745+
allOf:
746+
- $ref: "definitions/room_key_backup.yaml"
778747
example: {
779748
"!room:example.org": {
780749
"sessions": {
781750
"sessionid1": {
782-
"ephemeral": "base64+ephemeral+key",
783-
"ciphertext": "base64+ciphertext+of+JSON+data",
784-
"mac": "base64+mac+of+ciphertext"
751+
"first_message_index": 1,
752+
"forwarded_count": 0,
753+
"is_verified": true,
754+
"session_data": {
755+
"ephemeral": "base64+ephemeral+key",
756+
"ciphertext": "base64+ciphertext+of+JSON+data",
757+
"mac": "base64+mac+of+ciphertext"
758+
}
785759
}
786760
}
787761
}
788762
}
763+
required:
764+
- rooms
789765
responses:
790766
200:
791767
description: The update succeeded
@@ -846,8 +822,8 @@ paths:
846822
type: string
847823
name: version
848824
description: |-
849-
The backup from which to retrieve the keys. If omitted, the keys are
850-
retrieved from the current backup.
825+
The backup from which to retrieve the keys.
826+
required: true
851827
x-example: "1"
852828
responses:
853829
200:
@@ -860,19 +836,22 @@ paths:
860836
rooms:
861837
type: object
862838
description: |-
863-
A map of room IDs to session IDs to key data.
839+
A map of room IDs to room key backup data.
864840
additionalProperties:
865-
type: object
866-
additionalProperties:
867-
allOf:
868-
- $ref: "definitions/key_backup_data.yaml"
841+
allOf:
842+
- $ref: "definitions/room_key_backup.yaml"
869843
example: {
870844
"!room:example.org": {
871845
"sessions": {
872846
"sessionid1": {
873-
"ephemeral": "base64+ephemeral+key",
874-
"ciphertext": "base64+ciphertext+of+JSON+data",
875-
"mac": "base64+mac+of+ciphertext"
847+
"first_message_index": 1,
848+
"forwarded_count": 0,
849+
"is_verified": true,
850+
"session_data": {
851+
"ephemeral": "base64+ephemeral+key",
852+
"ciphertext": "base64+ciphertext+of+JSON+data",
853+
"mac": "base64+mac+of+ciphertext"
854+
}
876855
}
877856
}
878857
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed some errors in the key backup spec.

0 commit comments

Comments
 (0)