import JSEncrypt from './jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXgKEE1zA47xfCqZ451FfkRMVj610bolAoorFpRv9KOjwFN3l9rG1IX2rhiftHsuKXJPMhGnkxxUAVq5iWfuKz1uWKkz6yL3rbOy3yv90FEUbHY/YY29pSkaS0avR0+9gLxq0a4s7MiD96jFat2Bz6rvHUWT3v309XyXps6RwEAwIDAQAB'

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}