encript-response
v1.0.6
Published
Encripta tus respuestas de forma rapida y sencilla
Downloads
3
Maintainers
Readme
Encript-Response express
app.js|index.js
import { Secret } from 'encript-response'
Secret.setSecret(process.env.YOUR_SECRET)
your class Controller
class Controllers{
constructor(){}
@EncriptResponse()
async getData(req: Request, res: Response, next: NextFunction): Promise<any> {
/**
*IMPORTANT : NO USE return res.json({data}) use return data
EXAMPLE
*/
return {
name:'gian valdiris',
age:'22',
}
}
}
export const controllers = new Controllers()
sample response
"U2FsdGVkX1+9Jf8/SpxXCrnWf++K/94d1m+aXy1lpsac/ILH6sBVGxp1HrCZ8bwG6kJ875TmddY/wEE6kOo6OQ=="
Desenctipt data
npm i crypto-js OR yarn add crypto-js
import crypto from 'crypto-js'
function decrypt(data:string){
return crypto.AES.decrypt(
data,YOUR_SECRET
).toString(crypto.enc.Utf8)
}