handle method

  1. @override
Future<void> handle({
  1. required DeviceCommand command,
  2. required AuthenticationState state,
})
override

Implementation

@override
Future<void> handle({
  required DeviceCommand command,
  required AuthenticationState state,
}) async {
  final cmd = command as AnnounceDeviceCommand;

  respondToChallenge(
    commandId: cmd.id,
    salt: cmd.salt,
    secret: _secret,
    socket: state.socket,
    timestamp: cmd.timestamp,
  );

  final app = getApplication(command.appIdentifier);
  final device = getDevice(
    app: app,
    deviceInfo: cmd.device,
    testControllerState: cmd.testControllerState,
  );

  final challenge = ChallengeCommand(
    salt: DriverSignatureHelper().createSalt(),
  );
  state.communicator = device;
  state.challenge = challenge;

  state.socket.add(challenge.toString());
  logger.info(
    '[DEVICE]: received announcement: [${cmd.device.id}]',
  );
}