-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Implement API for ExchangeAppAttestAssertionRequest endpoint #8065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement API for ExchangeAppAttestAssertionRequest endpoint #8065
Conversation
1ef7c86
to
70cda5f
Compare
static NSString *const kRequestFieldKeyID = @"key_id"; | ||
static NSString *const kRequestFieldArtifact = @"artifact"; | ||
static NSString *const kRequestFieldAssertion = @"assertion"; | ||
static NSString *const kRequestFieldAttestation = @"attestationStatement"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something we will need to double check because the DeviceCheck endpoint accepts snake case field names.
|
||
static NSString *const kExchangeAppAttestAssertionEndpoint = @"exchangeAppAttestAssertion"; | ||
static NSString *const kExchangeAppAttestAttestationEndpoint = @"exchangeAppAttestAttestation"; | ||
static NSString *const kGenerateAppAttestChallengeEndpoint = @"generateAppAttestChallenge"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
[NSString stringWithFormat:@"%@/projects/%@/apps/%@:generateAppAttestChallenge", | ||
self.APIService.baseURL, self.projectID, self.appID]; | ||
NSURL *URL = [NSURL URLWithString:URLString]; | ||
NSURL *URL = [self URLForEndpoint:kGenerateAppAttestChallengeEndpoint]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice cleanup!
- (id)HTTPBodyWithJSONObject:(nonnull id)JSONObject { | ||
NSError *encodingError; | ||
NSData *payloadJSON = [NSJSONSerialization dataWithJSONObject:JSONObject | ||
options:0 | ||
error:&encodingError]; | ||
return payloadJSON ?: [FIRAppCheckErrorUtil JSONSerializationError:encodingError]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this helper to hopefully consolidate the class's JSON serialization logic. WDYT? Returning id
to allow for either NSData
or NSError
but could instead return a promise that has been fulfilled/rejected...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fulfilled/rejected promise looks like a much more readable option to me.
b/187427651
TODO:
#no-changelog