app/e2e/client/rocketchat.e2e.room.js
// Encrypts files before upload. I/O is in arraybuffers.
Encrypts files before upload. I/O is in arraybuffers.
Encrypts files before upload . I / O is in arraybuffers .
async encryptFile(file) {
		if (!this.isSupportedRoomType(this.typeOfRoom)) {
			return;
		}
		const fileArrayBuffer = await readFileAsArrayBuffer(file);
		const vector = crypto.getRandomValues(new Uint8Array(16));
		let result;
		try {
			result = await encryptAES(vector, this.groupSessionKey, fileArrayBuffer);
		} catch (error) {
			return this.error('Error encrypting group key: ', error);
		}
		const output = joinVectorAndEcryptedData(vector, result);
		const encryptedFile = new File([toArrayBuffer(EJSON.stringify(output))], file.name);
		return encryptedFile;
	}
async encryptFile ( file ) { if ( ! this . isSupportedRoomType ( this . typeOfRoom ) ) { return ; } const fileArrayBuffer = await readFileAsArrayBuffer ( file ) ; const vector = crypto . getRandomValues ( new Uint8Array ( 16 ) ) ; let result ; try { result = await encryptAES ( vector , this . groupSessionKey , fileArrayBuffer ) ; } catch ( error ) { return this . error ( 'Error encrypting group key: ' , error ) ; } const output = joinVectorAndEcryptedData ( vector , result ) ; const encryptedFile = new File ( [ toArrayBuffer ( EJSON . stringify ( output ) ) ] , file . name ) ; return encryptedFile ; }
Encrypts files before upload.
Encrypts files before upload .