buildCommand method

  1. @override
String buildCommand()
override

Build the @ command to be sent to remote secondary for execution.

Implementation

@override
String buildCommand() {
  var sb = StringBuffer();
  sb.write('enroll:');
  sb.write(getEnrollOperation(operation));
  if (force) {
    sb.write(':force');
  }

  EnrollParams enrollParams = EnrollParams()
    ..enrollmentId = enrollmentId
    ..appName = appName
    ..deviceName = deviceName
    ..apkamPublicKey = apkamPublicKey
    ..otp = otp
    ..namespaces = namespaces
    ..encryptedDefaultEncryptionPrivateKey =
        encryptedDefaultEncryptionPrivateKey
    ..encryptedDefaultSelfEncryptionKey = encryptedDefaultSelfEncryptionKey
    ..encryptedAPKAMSymmetricKey = encryptedAPKAMSymmetricKey
    ..enrollmentStatusFilter = enrollmentStatusFilter
    ..apkamKeysExpiryDuration = apkamKeysExpiryDuration;

  Map<String, dynamic> enrollParamsJson = enrollParams.toJson();
  enrollParamsJson.removeWhere(_removeElements);
  if (enrollParamsJson.isNotEmpty) {
    sb.write(':${jsonEncode(enrollParamsJson)}');
  }
  sb.write('\n');
  return sb.toString();
}