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/api/server/v1/e2e.js

62 lines
1.4 KiB

import { Meteor } from 'meteor/meteor';
import { API } from '../api';
API.v1.addRoute('e2e.fetchMyKeys', { authRequired: true }, {
get() {
let result;
Meteor.runAsUser(this.userId, () => { result = Meteor.call('e2e.fetchMyKeys'); });
return API.v1.success(result);
},
});
API.v1.addRoute('e2e.getUsersOfRoomWithoutKey', { authRequired: true }, {
get() {
const { rid } = this.queryParams;
let result;
Meteor.runAsUser(this.userId, () => { result = Meteor.call('e2e.getUsersOfRoomWithoutKey', rid); });
return API.v1.success(result);
},
});
API.v1.addRoute('e2e.setRoomKeyID', { authRequired: true }, {
post() {
const { rid, keyID } = this.bodyParams;
Meteor.runAsUser(this.userId, () => {
API.v1.success(Meteor.call('e2e.setRoomKeyID', rid, keyID));
});
return API.v1.success();
},
});
API.v1.addRoute('e2e.setUserPublicAndPrivateKeys', { authRequired: true }, {
post() {
const { public_key, private_key } = this.bodyParams;
Meteor.runAsUser(this.userId, () => {
API.v1.success(Meteor.call('e2e.setUserPublicAndPrivateKeys', {
public_key,
private_key,
}));
});
return API.v1.success();
},
});
API.v1.addRoute('e2e.updateGroupKey', { authRequired: true }, {
post() {
const { uid, rid, key } = this.bodyParams;
Meteor.runAsUser(this.userId, () => {
API.v1.success(Meteor.call('e2e.updateGroupKey', rid, uid, key));
});
return API.v1.success();
},
});