From 0582cdfa61cddd339c7f7ceb8ecf703b1b6864b4 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 21 Mar 2022 13:56:38 -0300 Subject: [PATCH] Chore: Migrate REST API - e2eFetchMyKeys to Typescript (#3942) --- app/definitions/rest/v1/e2e.ts | 3 +++ app/lib/rocketchat/rocketchat.js | 14 -------------- app/lib/rocketchat/services/restApi.ts | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/definitions/rest/v1/e2e.ts b/app/definitions/rest/v1/e2e.ts index 44705c851..f23c0fac9 100644 --- a/app/definitions/rest/v1/e2e.ts +++ b/app/definitions/rest/v1/e2e.ts @@ -15,4 +15,7 @@ export type E2eEndpoints = { 'e2e.setRoomKeyID': { POST: (params: { rid: string; keyID: string }) => {}; }; + 'e2e.fetchMyKeys': { + GET: () => { public_key: string; private_key: string }; + }; }; diff --git a/app/lib/rocketchat/rocketchat.js b/app/lib/rocketchat/rocketchat.js index 639a42494..155b5a545 100644 --- a/app/lib/rocketchat/rocketchat.js +++ b/app/lib/rocketchat/rocketchat.js @@ -109,20 +109,6 @@ const RocketChat = { connect, shareExtensionInit, closeShareExtension, - - async e2eFetchMyKeys() { - // RC 0.70.0 - const result = await sdk.get('e2e.fetchMyKeys'); - // snake_case -> camelCase - if (result.success) { - return { - success: result.success, - publicKey: result.public_key, - privateKey: result.private_key - }; - } - return result; - }, loginTOTP, loginWithPassword, loginOAuthOrSso, diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 73502fc79..db6124351 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -887,3 +887,17 @@ export const getRoomMembers = async ({ return result?.records; } }; + +export const e2eFetchMyKeys = async () => { + // RC 0.70.0 + const result = await sdk.get('e2e.fetchMyKeys'); + // snake_case -> camelCase + if (result.success) { + return { + success: result.success, + publicKey: result.public_key, + privateKey: result.private_key + }; + } + return result; +}; \ No newline at end of file