validateAuthKey static method

CometChatCallsException? validateAuthKey(
  1. String? authKey
)

Validates authKey for login. Returns null if valid, CometChatCallsException if invalid.

Implementation

static CometChatCallsException? validateAuthKey(String? authKey) {
  if (authKey == null) {
    return CometChatCallsException(
      ErrorCodeConstants.codeAuthKeyNull,
      ErrorMessageConstants.messageAuthKeyNull,
      ErrorDetailConstants.detailAuthKeyNullOrEmpty,
    );
  }
  if (authKey.trim().isEmpty) {
    return CometChatCallsException(
      ErrorCodeConstants.codeAuthKeyEmpty,
      ErrorMessageConstants.messageAuthKeyEmpty,
      ErrorDetailConstants.detailAuthKeyNullOrEmpty,
    );
  }
  if (CometChatCallsUtils.containsSpace(authKey)) {
    return CometChatCallsException(
      ErrorCodeConstants.codeAuthKeyHasSpace,
      ErrorMessageConstants.messageAuthKeyHasSpace,
      ErrorDetailConstants.detailAuthKeyHasSpace,
    );
  }
  return null;
}