- // Validate the raw data received from the UI server
- private requestValidation(rawData: RawData | JsonType): ProtocolRequest {
- // logger.debug(
- // `${this.logPrefix(
- // moduleName,
- // 'requestValidation'
- // )} Data received in string format: ${rawData.toString()}`
- // );
-
- const data = JSON.parse(rawData.toString()) as JsonType[];
-
- if (Array.isArray(data) === false) {
- throw new BaseError('UI protocol request is not an array');
- }
-
- if (data.length !== 3) {
- throw new BaseError('UI protocol request is malformed');
- }
-
- return data as ProtocolRequest;
- }
-