mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 12:28:56 +00:00
modify getServiceTokenData to return single json
This commit is contained in:
@@ -15,9 +15,7 @@ import {
|
|||||||
* @param res
|
* @param res
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const getServiceTokenData = async (req: Request, res: Response) => res.status(200).send({
|
export const getServiceTokenData = async (req: Request, res: Response) => res.status(200).json(req.serviceTokenData);
|
||||||
serviceTokenData: req.serviceTokenData
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new service token data for workspace with id [workspaceId] and
|
* Create new service token data for workspace with id [workspaceId] and
|
||||||
@@ -42,8 +40,8 @@ export const createServiceTokenData = async (req: Request, res: Response) => {
|
|||||||
const secret = crypto.randomBytes(16).toString('hex');
|
const secret = crypto.randomBytes(16).toString('hex');
|
||||||
const secretHash = await bcrypt.hash(secret, SALT_ROUNDS);
|
const secretHash = await bcrypt.hash(secret, SALT_ROUNDS);
|
||||||
|
|
||||||
const expiresAt = new Date();
|
const expiresAt = new Date();
|
||||||
expiresAt.setSeconds(expiresAt.getSeconds() + expiresIn);
|
expiresAt.setSeconds(expiresAt.getSeconds() + expiresIn);
|
||||||
|
|
||||||
serviceTokenData = await new ServiceTokenData({
|
serviceTokenData = await new ServiceTokenData({
|
||||||
name,
|
name,
|
||||||
|
|||||||
Reference in New Issue
Block a user