mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 13:56:43 +00:00
feat(folder-scoped-st): added batch,create secrets v2 secretpath support and service token
This commit is contained in:
@@ -44,30 +44,7 @@ import {
|
||||
getAuthDataPayloadIdObj,
|
||||
getAuthDataPayloadUserObj,
|
||||
} from "../utils/auth";
|
||||
import Folder from "../models/folder";
|
||||
import { getFolderByPath } from "../services/FolderService";
|
||||
|
||||
export const getFolderIdFromServiceToken = async (
|
||||
workspaceId: Types.ObjectId | string,
|
||||
environment: string,
|
||||
secretPath: string
|
||||
) => {
|
||||
const folders = await Folder.findOne({
|
||||
workspace: workspaceId,
|
||||
environment,
|
||||
});
|
||||
|
||||
if (!folders) {
|
||||
if (secretPath !== "/") throw new Error("Invalid path. Folders not found");
|
||||
} else {
|
||||
const folder = getFolderByPath(folders.nodes, secretPath);
|
||||
if (!folder) {
|
||||
throw new Error("Folder not found");
|
||||
}
|
||||
return folder.id;
|
||||
}
|
||||
return "root";
|
||||
};
|
||||
import { getFolderIdFromServiceToken } from "../services/FolderService";
|
||||
|
||||
/**
|
||||
* Create secret blind index data containing encrypted blind index [salt]
|
||||
|
||||
Reference in New Issue
Block a user