f-23 / react-native-passkey

Passkeys for React Native
MIT License
121 stars 25 forks source link

Invalid challenge thrown for example challenge #9

Closed peterferguson closed 1 year ago

peterferguson commented 1 year ago

Hey sorry for the bad issue not sure where else to ask.

I am not sure from the docs what the format for the challenge should be?

I have tried using the sample challenge from the server response in the fido2-lib but still I get logs like:

Error: {"error": "InvalidChallenge", "message": "The provided challenge was invalid"}

I understand you guys are wrapping some native modules, is there some docs for those that I could reference? Or maybe you could link to them in the readme?

peterferguson commented 1 year ago

Getting further with the issue it seems that the challenge should be formatted as hex but I still run into errors after this point

{"error": "Unknown error", "message": "An unknown error occurred"}

😢

f-23 commented 1 year ago

Hi there, sorry for the confusion.

The challenge you pass in should be a base64 encoded string. Please try to encode the string from the example you've linked and see if that helps.

The React Native Bridge (which is used for communication between the JS and the native part) has some limitations when it comes to data types which is why I've decided to use base64 encoded values in this case. There might be room for improvement, but for now this should probably be noted in the docs to prevent further issues. I will update them asap.