diff --git a/native/android/app/src/main/java/app/comm/android/commservices/CommAndroidBlobClient.java b/native/android/app/src/main/java/app/comm/android/commservices/CommAndroidBlobClient.java --- a/native/android/app/src/main/java/app/comm/android/commservices/CommAndroidBlobClient.java +++ b/native/android/app/src/main/java/app/comm/android/commservices/CommAndroidBlobClient.java @@ -88,6 +88,11 @@ String accessToken = CommSecureStore.get("accessToken"); String deviceID = CommSecureStore.get("deviceID"); + if (userID == null || accessToken == null || deviceID == null) { + throw new RuntimeException( + "Failed to query blob service due to missing CSAT."); + } + userID = userID == null ? "" : userID; accessToken = accessToken == null ? "" : accessToken; deviceID = deviceID == null ? "" : deviceID; diff --git a/native/ios/Comm/CommIOSServices/CommIOSBlobClient.mm b/native/ios/Comm/CommIOSServices/CommIOSBlobClient.mm --- a/native/ios/Comm/CommIOSServices/CommIOSBlobClient.mm +++ b/native/ios/Comm/CommIOSServices/CommIOSBlobClient.mm @@ -251,18 +251,26 @@ auto userID = comm::CommSecureStore::get(comm::CommSecureStore::userID); auto deviceID = comm::CommSecureStore::get(comm::CommSecureStore::deviceID); - NSString *userIDObjC = userID.hasValue() - ? [NSString stringWithCString:userID.value().c_str() - encoding:NSUTF8StringEncoding] - : @""; - NSString *accessTokenObjC = accessToken.hasValue() - ? [NSString stringWithCString:accessToken.value().c_str() - encoding:NSUTF8StringEncoding] - : @""; - NSString *deviceIDObjC = deviceID.hasValue() - ? [NSString stringWithCString:deviceID.value().c_str() - encoding:NSUTF8StringEncoding] - : @""; + if (!userID.hasValue() || !accessToken.hasValue() || !deviceID.hasValue()) { + *error = [NSError + errorWithDomain:@"app.comm" + code:NSURLErrorUserAuthenticationRequired + userInfo:@{ + NSLocalizedDescriptionKey : + @"Failed to query blob service due to missing CSAT." + }]; + return nil; + } + + NSString *userIDObjC = [NSString stringWithCString:userID.value().c_str() + encoding:NSUTF8StringEncoding]; + + NSString *accessTokenObjC = + [NSString stringWithCString:accessToken.value().c_str() + encoding:NSUTF8StringEncoding]; + + NSString *deviceIDObjC = [NSString stringWithCString:deviceID.value().c_str() + encoding:NSUTF8StringEncoding]; NSDictionary *jsonAuthObject = @{ @"userID" : userIDObjC, diff --git a/web/cpp/SQLiteQueryExecutorBindings.cpp b/web/cpp/SQLiteQueryExecutorBindings.cpp --- a/web/cpp/SQLiteQueryExecutorBindings.cpp +++ b/web/cpp/SQLiteQueryExecutorBindings.cpp @@ -248,11 +248,18 @@ .function("removeEntries", &SQLiteQueryExecutor::removeEntries) .function("removeAllEntries", &SQLiteQueryExecutor::removeAllEntries) .function("getAllEntries", &SQLiteQueryExecutor::getAllEntries) - .function("replaceMessageStoreLocalMessageInfo", &SQLiteQueryExecutor::replaceMessageStoreLocalMessageInfo) - .function("removeMessageStoreLocalMessageInfos", &SQLiteQueryExecutor::removeMessageStoreLocalMessageInfos) .function( - "removeAllMessageStoreLocalMessageInfos", &SQLiteQueryExecutor::removeAllMessageStoreLocalMessageInfos) - .function("getAllMessageStoreLocalMessageInfos", &SQLiteQueryExecutor::getAllMessageStoreLocalMessageInfos) + "replaceMessageStoreLocalMessageInfo", + &SQLiteQueryExecutor::replaceMessageStoreLocalMessageInfo) + .function( + "removeMessageStoreLocalMessageInfos", + &SQLiteQueryExecutor::removeMessageStoreLocalMessageInfos) + .function( + "removeAllMessageStoreLocalMessageInfos", + &SQLiteQueryExecutor::removeAllMessageStoreLocalMessageInfos) + .function( + "getAllMessageStoreLocalMessageInfos", + &SQLiteQueryExecutor::getAllMessageStoreLocalMessageInfos) .function("beginTransaction", &SQLiteQueryExecutor::beginTransaction) .function("commitTransaction", &SQLiteQueryExecutor::commitTransaction) .function(