Fixed getRandomValue

This commit is contained in:
Vincent Alamelle 2023-05-10 17:37:12 +02:00
parent f8bc06bb8b
commit 0377875915

View File

@ -27,7 +27,7 @@ export default class CryptoService extends BaseService {
*/ */
public async encrypt(data: string) { public async encrypt(data: string) {
const encodedData = Buffer.from(data); const encodedData = Buffer.from(data);
const iv = crypto.getRandomValues(new Uint8Array(16)); const iv = crypto.webcrypto.getRandomValues(new Uint8Array(16))
const key = await this.getKey(); const key = await this.getKey();
const cipherData = await this.subtle.encrypt( const cipherData = await this.subtle.encrypt(
{ {