app/e2e/client/rocketchat.e2e.room.js
// Helper function for encryption of messages
Helper function for encryption of messages
Helper function for encryption of messages
encrypt(message) {
		let ts;
		if (isNaN(TimeSync.serverOffset())) {
			ts = new Date();
		} else {
			ts = new Date(Date.now() + TimeSync.serverOffset());
		}
		const data = new TextEncoder('UTF-8').encode(EJSON.stringify({
			_id: message._id,
			text: message.msg,
			userId: this.userId,
			ts,
		}));
		return this.encryptText(data);
	}
encrypt ( message ) { let ts ; if ( isNaN ( TimeSync . serverOffset ( ) ) ) { ts = new Date ( ) ; } else { ts = new Date ( Date . now ( ) + TimeSync . serverOffset ( ) ) ; } const data = new TextEncoder ( 'UTF-8' ) . encode ( EJSON . stringify ( { _id : message . _id , text : message . msg , userId : this . userId , ts , } ) ) ; return this . encryptText ( data ) ; }
Helper function for encryption of messages
Helper function for encryption of messages