Chore: Migrate REST API - e2eFetchMyKeys to Typescript (#3942)

This commit is contained in:
Reinaldo Neto 2022-03-21 13:56:38 -03:00 committed by GitHub
parent 8af1d1ceb5
commit 0582cdfa61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 14 deletions

View File

@ -15,4 +15,7 @@ export type E2eEndpoints = {
'e2e.setRoomKeyID': {
POST: (params: { rid: string; keyID: string }) => {};
};
'e2e.fetchMyKeys': {
GET: () => { public_key: string; private_key: string };
};
};

View File

@ -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,

View File

@ -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;
};