login method

Future<CtrlMessage> login(
  1. String scheme,
  2. String secret,
  3. Map<String, dynamic>? cred
)

Authenticate current session

Implementation

Future<CtrlMessage> login(
    String scheme, String secret, Map<String, dynamic>? cred) async {
  var packet = _packetGenerator.generate(packet_types.Login, null);
  var data = packet.data as LoginPacketData;
  data.scheme = scheme;
  data.secret = secret;
  data.cred = [if (cred != null) cred];

  packet.data = data;

  CtrlMessage ctrl = await _send(packet);
  _authService.onLoginSuccessful(ctrl);
  return ctrl;
}