Chore: Migrate REST API - e2eResetOwnKey to Typescript (#3888)

* Chore: Migrate REST API - e2eResetOwnKey to Typescript

* Update app/lib/rocketchat/services/restApi.ts

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
Reinaldo Neto 2022-03-14 11:56:49 -03:00 committed by GitHub
parent 6ff2fc37d0
commit 307ae1295f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -1,6 +1,6 @@
import rocketchat from '../lib/rocketchat';
type TRocketChat = typeof rocketchat;
export type TRocketChat = typeof rocketchat;
export interface IRocketChat extends TRocketChat {
closeListener: any;

View File

@ -196,13 +196,6 @@ const RocketChat = {
}
return result;
},
e2eResetOwnKey() {
this.unsubscribeRooms();
// RC 0.72.0
return this.methodCallWrapper('e2e.resetOwnE2EKey');
},
loginTOTP,
loginWithPassword,
loginOAuthOrSso,

View File

@ -1,7 +1,7 @@
import sdk from './sdk';
import { TEAM_TYPE } from '../../../definitions/ITeam';
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
import { SubscriptionType, INotificationPreferences, IRoomNotifications, IMessage } from '../../../definitions';
import { SubscriptionType, INotificationPreferences, IRoomNotifications, TRocketChat, IMessage } from '../../../definitions';
import { ISpotlight } from '../../../definitions/ISpotlight';
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
import { Encryption } from '../../encryption';
@ -744,6 +744,15 @@ export const useInviteToken = (token: string): any =>
// @ts-ignore
sdk.post('useInviteToken', { token });
export function e2eResetOwnKey(this: TRocketChat): Promise<boolean | {}> {
// {} when TOTP is enabled
// TODO: remove this
this.unsubscribeRooms();
// RC 0.72.0
return sdk.methodCallWrapper('e2e.resetOwnE2EKey');
}
export const editMessage = async (message: IMessage) => {
const { rid, msg } = await Encryption.encryptMessage(message);
// RC 0.49.0