f-23 / react-native-passkey

Passkeys for React Native
MIT License
140 stars 31 forks source link

iOS Error on get, version 3.0.0rc2 #50

Open mberenguer-adding opened 1 month ago

mberenguer-adding commented 1 month ago

I am using this library to authenticate to my .NET api using Fido2.AspNet. With version 2 it worked okay but I am testing new version to use new architecture.

I am getting this error on iOS:

Error {"error": "Native error", "message": "Error: Swift.DecodingError.keyNotFound(CodingKeys(stringValue: \"transports\", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: \"allowCredentials\", intValue: nil), _JSONKey(stringValue: \"Index 0\", intValue: 0)], debugDescription: \"No value associated with key CodingKeys(stringValue: \\\"transports\\\", intValue: nil) (\\\"transports\\\").\", underlyingError: nil))"}

The response I'm getting from my API is the following:

{"allowCredentials": [{"id": "1Gq80bsAZBoN3VjyYOEEfNXboGY", "type": "public-key"}], "challenge": "1doyzGTeFgolCwCyMwOMRi8XRvzCjlMg7Hcjivv_QRA", "errorMessage": "", "rpId": "***", "status": "ok", "timeout": 60000, "userVerification": "discouraged"}

(I change rpId with * but there was the domain on that property and it is correct)

As you wanted feedback following new rc on iOS, I let these logs so we can get to the final release without errors.

Thanks in advance.

mberenguer-adding commented 1 month ago

OK, so I found looking at swift code that if I set property transports to null as follows, it just works:

res.allowCredentials = res.allowCredentials.map((cred) => {
  return {
    id: cred.id,
    type: cred.type,
    transports: null
  }
})

I guess it could be set by default if it's not needed. I'm going to test it on Android now. Let's see if everything works. Thanks for all your efforts creating this library.

f-23 commented 2 weeks ago

Thank you for the feedback, I'll resolve it for the 3.0 release!

f-23 commented 1 week ago

@mberenguer-adding Could you confirm this is fixed for you in 3.0?

mberenguer-adding commented 5 days ago

Oh sorry. I'm from Valencia and there have been problems with floods. As soon as I can, I will test this.