Skip to content

Commit

Permalink
review: apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexruzenhack committed Nov 25, 2024
1 parent 7ae8f98 commit 239fbe9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ios/RCTHTTPRequestHandler+AuthenticationChallenge.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#import <Security/Security.h>

/**
* There will be only one instance of this class on runtime accordinly the React Native code.
* There will be only one instance of this class at runtime according to the React Native code.
* This provides a good opportunity to cache data on the class itself.
*/
@implementation RCTHTTPRequestHandler (AuthenticationChallengeExtension)
Expand Down Expand Up @@ -110,15 +110,15 @@ - (void)authenticationChallenge_URLSession:(NSURLSession *)session
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
}
} else {
NSLog(@"Certificate not set.");
CFStringRef errorMessage = SecCopyErrorMessageString(status, NULL);
NSLog(@"Certificate not set to the trust entity. Reason: %@", (__bridge NSString *)errorMessage);
// Cancel the authentication challenge
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
}
} else {
// Trust is not of type ServerTrust, proceeding with default challenge, if any
NSLog(@"Not ServerTrust challenge. Calling default authentication challenge.");
// For other authentication methods, call the original implementation
[self authenticationChallenge_URLSession:session didReceiveChallenge:challenge completionHandler:completionHandler];
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
}
}

Expand Down Expand Up @@ -151,7 +151,7 @@ - (SecCertificateRef)getCert:(NSString *)certFilename {

if (!certData) {
@throw [NSException exceptionWithName:NSInternalInconsistencyException
reason:[NSString stringWithFormat:@"%@ not found", certFilename]
reason:[NSString stringWithFormat:@"Certificate file %@.der not found", certFilename]
userInfo:nil];
}

Expand Down

0 comments on commit 239fbe9

Please sign in to comment.