Skip to content

Commit

Permalink
Eval by credential.
Browse files Browse the repository at this point in the history
  • Loading branch information
jensutbult committed Nov 13, 2024
1 parent 54a0957 commit c7fe639
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,19 @@ - (void)getAssertionWithClientNoFilterDataHash:(NSData *)clientDataHash
if (extensions) {
[self executeGetSharedSecretWithCompletion:^(NSData * _Nullable sharedSecret, YKFCBORMap * _Nullable cosePlatformPublicKey, NSError * _Nullable error) {
NSMutableDictionary *authenticatorInputs = [NSMutableDictionary new];
if (extensions[@"prf"] && extensions[@"prf"][@"eval"]) {
NSString *base64EncodedFirst = extensions[@"prf"][@"eval"][@"first"];
NSString *base64EncodedSecond = extensions[@"prf"][@"eval"][@"second"];
if (extensions[@"prf"]) {
NSDictionary* prf = (NSDictionary*)extensions[@"prf"];
NSDictionary* secrets = (NSDictionary*)prf[@"eval"];

NSDictionary* evalByCred = (NSDictionary*)prf[@"evalByCredential"];
if (evalByCred) {
YKFFIDO2PublicKeyCredentialDescriptor *credentialDescriptor = allowList[0];
NSString *selectedCredentialId = [credentialDescriptor.credentialId ykf_websafeBase64EncodedString];
secrets = evalByCred[selectedCredentialId] ? evalByCred[selectedCredentialId] : secrets;
}

NSString *base64EncodedFirst = secrets[@"first"];
NSString *base64EncodedSecond = secrets[@"second"];
NSData *first = [[[NSData alloc] ykf_initWithWebsafeBase64EncodedString:base64EncodedFirst dataLength:base64EncodedFirst.length] ykf_prfSaltData];
NSData *second = [[[NSData alloc] ykf_initWithWebsafeBase64EncodedString:base64EncodedSecond dataLength:base64EncodedFirst.length] ykf_prfSaltData];

Expand Down

0 comments on commit c7fe639

Please sign in to comment.