Updated
This commit is contained in:
parent
4184942584
commit
afb5f3a287
66 changed files with 550 additions and 57 deletions
13
frontend/src/@dasig/scripts/functions/encryptRsa.ts
Normal file
13
frontend/src/@dasig/scripts/functions/encryptRsa.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { JSEncrypt } from 'jsencrypt'
|
||||
import { $rsaPublicKey } from '../../../../configs/config.security'
|
||||
|
||||
const enc = new JSEncrypt()
|
||||
const PUBLIC_KEY = $rsaPublicKey.get()
|
||||
|
||||
export default async (message: string) => {
|
||||
enc.setPublicKey(PUBLIC_KEY)
|
||||
const encrypted = enc.encrypt(message).toString()
|
||||
const fixedEncrypted = encrypted.replace(/\//g, '~')
|
||||
|
||||
return fixedEncrypted
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue