// 引入加密解密库
import JSEncrypt from 'jsencrypt/bin/jsencrypt.js';
 
// 引入RSA密钥
import rsaKeys from '../../store/rsaKeys.js';
 
 
 
 
// RSA加密
function rsaEncode (content) {
	content = String(content);
	const encryptor = new JSEncrypt();
	encryptor.setPublicKey(rsaKeys.rsaPublicKey);
	return encryptor.encrypt(content);
}
 
 
// RSA解密
function rsaDecode (content) {
	const encryptor = new JSEncrypt();
	encryptor.setPublicKey(rsaKeys.rsaPrivateKey);
	return encryptor.decrypt(content);
}
 
 
 
// 输出为 函数合集
export default {
	// 加密解密
	rsaEncode,
	rsaDecode,
}