stackpress
Version:
Incept is a content management framework.
17 lines (16 loc) • 422 B
JavaScript
import { decrypt } from '../helpers';
export default async function AuthSearch(_req, res, ctx) {
if (!Array.isArray(res.body))
return;
const seed = ctx.config.path('session.seed', 'abc123');
const rows = res.body;
res.body = rows.map(row => {
try {
row.token = decrypt(row.token, seed);
}
catch (e) { }
delete row.secret;
return row;
});
}
;