mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 00:52:09 +00:00
Checkpoint
This commit is contained in:
@@ -3,6 +3,9 @@ import {
|
||||
Secret
|
||||
} from '../../models';
|
||||
|
||||
// TODO: modularize argon2id
|
||||
import * as argon2 from 'argon2';
|
||||
|
||||
/**
|
||||
* Get secrets for workspace with id [workspaceId] and environment
|
||||
* [environment]
|
||||
@@ -22,6 +25,10 @@ export const getSecrets = async (req: Request, res: Response) => {
|
||||
* @param res
|
||||
*/
|
||||
export const getSecretByName = async (req: Request, res: Response) => {
|
||||
const { secretName } = req.params;
|
||||
const workspaceId = req.query.workspaceId as string;
|
||||
const environment = req.query.workspaceId as string;
|
||||
|
||||
return res.status(200).send({
|
||||
|
||||
});
|
||||
@@ -34,7 +41,19 @@ export const getSecretByName = async (req: Request, res: Response) => {
|
||||
* @param res
|
||||
*/
|
||||
export const createSecret = async (req: Request, res: Response) => {
|
||||
const { workspaceId } = req.params;
|
||||
// TODO: the middleware should've prevalidated that the
|
||||
// workspace with id [workspaceId] has disabled E2EE
|
||||
const { secretName } = req.params;
|
||||
const {
|
||||
workspaceId,
|
||||
environment,
|
||||
value
|
||||
} = req.body;
|
||||
|
||||
//
|
||||
// use bot to encrypt value
|
||||
// BotService.encryptSymmetric(value)
|
||||
|
||||
|
||||
return res.status(200).send({
|
||||
|
||||
@@ -47,6 +66,7 @@ export const createSecret = async (req: Request, res: Response) => {
|
||||
* @param res
|
||||
*/
|
||||
export const updateSecretByName = async (req: Request, res: Response) => {
|
||||
const { secretName } = req.params;
|
||||
|
||||
return res.status(200).send({
|
||||
|
||||
|
||||
@@ -8,13 +8,6 @@ import { secretsController } from '../../controllers/v3';
|
||||
|
||||
// note: future endpoints pending brainstorm + implementation
|
||||
|
||||
router.post(
|
||||
'/',
|
||||
body('workspaceId').exists().isString().trim(),
|
||||
body('environment').exists().isString().trim(),
|
||||
secretsController.createSecret
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/',
|
||||
query('workspaceId').exists().isString().trim(),
|
||||
@@ -23,9 +16,25 @@ router.get(
|
||||
secretsController.getSecrets
|
||||
);
|
||||
|
||||
router.post(
|
||||
'/:secretName',
|
||||
body('workspaceId').exists().isString().trim(),
|
||||
body('environment').exists().isString().trim(),
|
||||
body('value').exists().isString().trim(),
|
||||
body('secretKeyCiphertext').optional().isString().trim(),
|
||||
body('secretKeyIV').optional().isString().trim(),
|
||||
body('secretKeyTag').optional().isString().trim(),
|
||||
body('secretValueCiphertext').optional().isString().trim(),
|
||||
body('secretValueIV').optional().isString().trim(),
|
||||
body('secretValueTag').optional().isString().trim(),
|
||||
secretsController.createSecret
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/:secretName',
|
||||
param('secretName').exists().isString().trim(),
|
||||
query('workspaceId').exists().isString().trim(),
|
||||
query('environment').exists().isString().trim(),
|
||||
secretsController.getSecretByName
|
||||
);
|
||||
|
||||
@@ -33,6 +42,7 @@ router.patch(
|
||||
'/:secretName',
|
||||
param('secretName').exists().isString().trim(),
|
||||
query('workspaceId').exists().isString().trim(),
|
||||
query('environment').exists().isString().trim(),
|
||||
validateRequest,
|
||||
secretsController.updateSecretByName
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user