Add support for read/write non-e2ee secrets

This commit is contained in:
Tuan Dang
2023-06-12 12:04:28 +01:00
parent 631eac803e
commit 4616cffecd
14 changed files with 1161 additions and 63 deletions

View File

@@ -17,7 +17,7 @@ const requireWorkspaceAuth = ({
locationEnvironment = undefined,
requiredPermissions = [],
requireBlindIndicesEnabled = false,
requireE2EEOff = true
requireE2EEOff = false
}: {
acceptedRoles: Array<'admin' | 'member'>;
locationWorkspaceId: req;

View File

@@ -8,10 +8,9 @@ import {
import { workspacesController } from '../../controllers/v3';
import {
AUTH_MODE_JWT,
ADMIN,
PERMISSION_READ_SECRETS
ADMIN
} from '../../variables';
import { param, body, validationResult } from 'express-validator';
import { param, body } from 'express-validator';
// -- migration to blind indices endpoints

View File

@@ -7,17 +7,26 @@ import {
getIsWorkspaceE2EEHelper
} from '../helpers/bot';
// rename the functions here
// refactor the interface situation here
/**
* Class to handle bot actions
*/
class BotService {
/**
* Return whether or not workspace with id [workspaceId] is end-to-end encrypted
* @param workspaceId - id of workspace
* @returns {Boolean}
*/
static async getIsWorkspaceE2EE(workspaceId: Types.ObjectId) {
return await getIsWorkspaceE2EEHelper(workspaceId);
}
/**
* Get workspace key for workspace with id [workspaceId] shared to bot.
* @param {Object} obj
* @param {Types.ObjectId} obj.workspaceId - id of workspace to get workspace key for
* @returns
*/
static async getWorkspaceKeyWithBot({
workspaceId
}: {