This commit is contained in:
xiaojunnuo
2025-01-15 01:26:23 +08:00
parent 14cdb54212
commit d6b3142a02
8 changed files with 77 additions and 148 deletions
@@ -6,7 +6,7 @@ export class BaseOpenController extends BaseController {
const openKey: OpenKey = this.ctx.openKey;
if (openKey.encrypt) {
const data = JSON.stringify(res);
const encryptor = new Encryptor(openKey.keySecret);
const encryptor = new Encryptor(openKey.keySecret, 'hex');
const encrypted = encryptor.encrypt(data);
return this.ok(encrypted);
}
@@ -37,7 +37,8 @@ export class OpenKeyController extends CrudController<OpenKeyService> {
}
@Post('/add', { summary: Constants.per.authOnly })
async add(@Body(ALL) bean: any) {
async add() {
const bean: any = {};
bean.userId = this.getUserId();
const res = await this.service.add(bean);
return this.ok(res);