diff --git a/Libraries/Network/RCTHTTPRequestHandler.mm b/Libraries/Network/RCTHTTPRequestHandler.mm index dc3298785a1d..08a388104465 100644 --- a/Libraries/Network/RCTHTTPRequestHandler.mm +++ b/Libraries/Network/RCTHTTPRequestHandler.mm @@ -129,7 +129,7 @@ -(void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticati NSString *host = challenge.protectionSpace.host; // Read the clientSSL info from MMKV - __block NSDictionary *clientSSL; + __block NSString *clientSSL; SecureStorage *secureStorage = [[SecureStorage alloc] init]; // https://github.com/ammarahm-ed/react-native-mmkv-storage/blob/master/src/loader.js#L31 @@ -141,13 +141,15 @@ -(void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticati NSData *cryptKey = [key dataUsingEncoding:NSUTF8StringEncoding]; MMKV *mmkv = [MMKV mmkvWithID:@"default" cryptKey:cryptKey mode:MMKVMultiProcess]; - clientSSL = [mmkv getObjectOfClass:[NSDictionary class] forKey:host]; + clientSSL = [mmkv getStringForKey:host]; + NSData *data = [clientSSL dataUsingEncoding:NSUTF8StringEncoding]; + id dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; - if (clientSSL != (id)[NSNull null]) { - NSString *path = [clientSSL objectForKey:@"path"]; - NSString *password = [clientSSL objectForKey:@"password"]; + if (dict != (id)[NSNull null]) { + NSString *path = [dict objectForKey:@"path"]; + NSString *password = [dict objectForKey:@"password"]; credential = [self getUrlCredential:challenge path:path password:password]; } diff --git a/Libraries/WebSocket/RCTSRWebSocket.m b/Libraries/WebSocket/RCTSRWebSocket.m index 7b8931b816ce..dd5ccc0b6f8c 100644 --- a/Libraries/WebSocket/RCTSRWebSocket.m +++ b/Libraries/WebSocket/RCTSRWebSocket.m @@ -551,7 +551,7 @@ - (void)_initializeStreams #endif // Read the clientSSL info from MMKV - __block NSDictionary *clientSSL; + __block NSString *clientSSL; SecureStorage *secureStorage = [[SecureStorage alloc] init]; // https://github.com/ammarahm-ed/react-native-mmkv-storage/blob/master/src/loader.js#L31 @@ -563,11 +563,13 @@ - (void)_initializeStreams NSData *cryptKey = [key dataUsingEncoding:NSUTF8StringEncoding]; MMKV *mmkv = [MMKV mmkvWithID:@"default" cryptKey:cryptKey mode:MMKVMultiProcess]; - clientSSL = [mmkv getObjectOfClass:[NSDictionary class] forKey:host]; + clientSSL = [mmkv getStringForKey:host]; + NSData *data = [clientSSL dataUsingEncoding:NSUTF8StringEncoding]; + id dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; - if (clientSSL != (id)[NSNull null]) { - NSString *path = [clientSSL objectForKey:@"path"]; - NSString *password = [clientSSL objectForKey:@"password"]; + if (dict != (id)[NSNull null]) { + NSString *path = [dict objectForKey:@"path"]; + NSString *password = [dict objectForKey:@"password"]; [self setClientSSL:path password:password options:SSLOptions]; } diff --git a/package.json b/package.json index 2ddca6605762..867355b74ca3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native", - "version": "0.64.2", + "version": "0.64.2-rocket", "bin": "./cli.js", "description": "A framework for building native apps using React", "license": "MIT",