Initial commit: HZHub project setup with RuoYi-AI base

This commit is contained in:
2026-03-26 09:47:46 +00:00
commit 3584e491cc
5005 changed files with 318595 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import JSEncrypt from 'jsencrypt';
import { BaseAsymmetricEncryption } from '../base';
/**
* RSA 实现
*/
export class RsaEncryption extends BaseAsymmetricEncryption {
override decrypt(str: string): string {
const instance = new JSEncrypt();
instance.setPrivateKey(this.privateKey);
const ret = instance.decrypt(str);
if (ret === false) {
throw new Error('RsaEncryption decrypt error');
}
return ret;
}
override encrypt(str: string): string {
const instance = new JSEncrypt();
instance.setPublicKey(this.publicKey);
const ret = instance.encrypt(str);
if (ret === false) {
throw new Error('RsaEncryption encrypt error');
}
return ret;
}
}