mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
perf: 证书仓库
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { BaseController, Encryptor } from '@certd/lib-server';
|
||||
import { OpenKey } from '../../modules/open/service/open-key-service.js';
|
||||
|
||||
export class BaseOpenController extends BaseController {
|
||||
ok(res: any) {
|
||||
const openKey: OpenKey = this.ctx.openKey;
|
||||
if (openKey.encrypt) {
|
||||
const data = JSON.stringify(res);
|
||||
const encryptor = new Encryptor(openKey.keySecret);
|
||||
const encrypted = encryptor.encrypt(data);
|
||||
return this.ok(encrypted);
|
||||
}
|
||||
super.ok(res);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user