peterferguson / react-native-passkeys

56 stars 6 forks source link

Example: obtain public key #7

Open adrianofoschi opened 4 months ago

adrianofoschi commented 4 months ago

Hello, I am using it in expo "web" environment. How to obtain the public key from RegistrationResponseJSON ? Thanks

peterferguson commented 4 months ago

With the current API it is not possible without a patch.

I will try get around to adding it on each platform soon, but in the meantime if you are only looking for the web environment you can use this patch

If you need the public key on other platforms it can be derived from the currently returned data

peterferguson commented 4 months ago

@jamesmccomish prs are welcome 😆

adrianofoschi commented 4 months ago

With the current API it is not possible without a patch.

I will try get around to adding it on each platform soon, but in the meantime if you are only looking for the web environment you can use this patch

Thank you. I need it for iOS and Android also.

If you need the public key on other platforms it can be derived from the currently returned data

Is there an example for this? And does it change for each platform or is it the same for iOS and Android and web?

asimashfaq commented 3 months ago

This is the solution. Its working smoothly. Had test it and verify it.

https://stackoverflow.com/questions/77818583/how-to-properly-extract-public-key-from-attestationobject