55 validateUnauthorizedErrorResponse ,
66 validateBadRequestErrorResponse ,
77 ise2eSetUserPublicAndPrivateKeysParamsPOST ,
8- ise2eUpdateGroupKeyParamsPOST ,
98 isE2EProvideUsersGroupKeyProps ,
109 isE2EFetchUsersWaitingForGroupKeyProps ,
1110 isE2EResetRoomKeyProps ,
@@ -38,6 +37,12 @@ type e2eGetUsersOfRoomWithoutKeyParamsGET = {
3837 rid : string ;
3938} ;
4039
40+ type e2eUpdateGroupKeyParamsPOST = {
41+ uid : string ;
42+ rid : string ;
43+ key : string ;
44+ } ;
45+
4146const E2eSetRoomKeyIdSchema = {
4247 type : 'object' ,
4348 properties : {
@@ -63,12 +68,31 @@ const e2eGetUsersOfRoomWithoutKeyParamsGETSchema = {
6368 required : [ 'rid' ] ,
6469} ;
6570
71+ const e2eUpdateGroupKeyParamsPOSTSchema = {
72+ type : 'object' ,
73+ properties : {
74+ uid : {
75+ type : 'string' ,
76+ } ,
77+ rid : {
78+ type : 'string' ,
79+ } ,
80+ key : {
81+ type : 'string' ,
82+ } ,
83+ } ,
84+ additionalProperties : false ,
85+ required : [ 'uid' , 'rid' , 'key' ] ,
86+ } ;
87+
6688const isE2eSetRoomKeyIdProps = ajv . compile < E2eSetRoomKeyIdProps > ( E2eSetRoomKeyIdSchema ) ;
6789
6890const ise2eGetUsersOfRoomWithoutKeyParamsGET = ajv . compile < e2eGetUsersOfRoomWithoutKeyParamsGET > (
6991 e2eGetUsersOfRoomWithoutKeyParamsGETSchema ,
7092) ;
7193
94+ const ise2eUpdateGroupKeyParamsPOST = ajv . compile < e2eUpdateGroupKeyParamsPOST > ( e2eUpdateGroupKeyParamsPOSTSchema ) ;
95+
7296const e2eEndpoints = API . v1
7397 . post (
7498 'e2e.setRoomKeyID' ,
@@ -165,6 +189,31 @@ const e2eEndpoints = API.v1
165189
166190 return API . v1 . success ( result ) ;
167191 } ,
192+ )
193+ . post (
194+ 'e2e.updateGroupKey' ,
195+ {
196+ authRequired : true ,
197+ body : ise2eUpdateGroupKeyParamsPOST ,
198+ response : {
199+ 400 : validateBadRequestErrorResponse ,
200+ 401 : validateUnauthorizedErrorResponse ,
201+ 200 : ajv . compile < void > ( {
202+ type : 'object' ,
203+ properties : {
204+ success : { type : 'boolean' , enum : [ true ] } ,
205+ } ,
206+ required : [ 'success' ] ,
207+ } ) ,
208+ } ,
209+ } ,
210+ async function action ( ) {
211+ const { uid, rid, key } = this . bodyParams ;
212+
213+ await updateGroupKey ( rid , uid , key , this . userId ) ;
214+
215+ return API . v1 . success ( ) ;
216+ } ,
168217 ) ;
169218
170219/**
@@ -222,56 +271,6 @@ API.v1.addRoute(
222271 } ,
223272) ;
224273
225- /**
226- * @openapi
227- * /api/v1/e2e.updateGroupKey:
228- * post:
229- * description: Updates the end-to-end encryption key for a user on a room
230- * security:
231- * - autenticated: {}
232- * requestBody:
233- * description: A tuple containing the user ID, the room ID, and the key
234- * content:
235- * application/json:
236- * schema:
237- * type: object
238- * properties:
239- * uid:
240- * type: string
241- * rid:
242- * type: string
243- * key:
244- * type: string
245- * responses:
246- * 200:
247- * content:
248- * application/json:
249- * schema:
250- * $ref: '#/components/schemas/ApiSuccessV1'
251- * default:
252- * description: Unexpected error
253- * content:
254- * application/json:
255- * schema:
256- * $ref: '#/components/schemas/ApiFailureV1'
257- */
258- API . v1 . addRoute (
259- 'e2e.updateGroupKey' ,
260- {
261- authRequired : true ,
262- validateParams : ise2eUpdateGroupKeyParamsPOST ,
263- } ,
264- {
265- async post ( ) {
266- const { uid, rid, key } = this . bodyParams ;
267-
268- await updateGroupKey ( rid , uid , key , this . userId ) ;
269-
270- return API . v1 . success ( ) ;
271- } ,
272- } ,
273- ) ;
274-
275274API . v1 . addRoute (
276275 'e2e.acceptSuggestedGroupKey' ,
277276 {
0 commit comments