The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/e2e/server/methods/resetOwnE2EKey.js

22 lines
503 B

import { Meteor } from 'meteor/meteor';
import { Users, Subscriptions } from '../../../models';
Meteor.methods({
'e2e.resetOwnE2EKey'() {
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'resetOwnE2EKey',
});
}
Users.resetE2EKey(userId);
Subscriptions.resetUserE2EKey(userId);
// Force the user to logout, so that the keys can be generated again
Users.removeResumeService(userId);
return true;
},
});