
Passkeys Doctor
This is an internal package and it is used inside of the passkeys package
Usage
The doctor is unabled by default in the example.
Here is what the doctor checks for
1. RPID Validation
- Ensures RPID is properly formatted
- Verifies RPID is a valid domain
2.1. iOS-specific Checks
-
- Fetches the AASA file from the RP
-
- Checks for the presence of the app bundle in the AASA file
-
- Checks if biometrics are enabled when on the simulator
2.2. Android-specific Checks
-
- Fetches the assetlinks.json file from the RP & signing fingerprint from the app
-
- Checks for the presence of the app bundle and correct fingerprint in the assetlinks.json file
2.3. Web-specific Checks
-
- Ensures RPID matches current hostname
-
- Validates existence of passkeys JS script
3. Error Handling
The doctor keeps track of errors and exceptions happening in the passkeys flows , give a description of it and suggestions on how to fix them.
Note: The doctor can export the results from the exception and the checks through a result Stream that can be used in the UI as done in the example
How to test:
Testing RPID validation
- Hardcode a wrong format RPID in the example app (local_relying_party.dart) (exp:
https://flutter.corbado.io/
instead offlutter.corbado.io
) - Build and run the app on any platform
- Start passkey registration -> It should fail and the doctor should tell you that the RPID is not a valid domain
- Change the RPID back to
flutter.corbado.io
- Restart passkey registration -> It should succeed and the doctor should tell you that the RPID is valid.
Testing AASA file
- Open developer panel and go to project
pro-9666724605626755378
- Go to native apps > iOS
- Find the app with bundle
com.corbado.passkeys.pub
and app identifier prefix0000000000
either change its value or remove it all together (make sure to add it back after the test) - Build the app and run it on iOS simulator
- Start passkey registration -> It should fail and the doctor should tell you that the AASA file is missing the correct bundle.
- Add the app bundle back to the AASA file
- Restart the passkey registration -> It should succeed and the doctor should tell you that the AASA file is correct.
Testing Assetlinks.json
- Open developer panel and go to project
pro-9666724605626755378
- Go to native apps > Android
- Find the app with bundle
com.corbado.passkeys.pub
and fingerprintF8:90:4E:9A:99:01:71:75:25:38:D5:36:16:2D:B3:65:EB:41:51:D4:53:9A:72:BC:4B:56:C5:16:43:62:E2:C0
and remove it - Build the app and run it on Android emulator
- Start passkey registration -> It should fail and the doctor should tell you that the assetlinks.json file is missing the correct bundle.
- Add the app bundle and fingerprint back to the assetlinks.json file through the developer panel
- Restart the passkey registration -> It should succeed and the doctor should tell you that the assetlinks.json file is correct.
Testing Fingerprint for Android
- Open developer panel and go to project
pro-9666724605626755378
- Go to native apps > Android
- Find the app with bundle
com.corbado.passkeys.pub
and fingerprintF8:90:4E:9A:99:01:71:75:25:38:D5:36:16:2D:B3:65:EB:41:51:D4:53:9A:72:BC:4B:56:C5:16:43:62:E2:C0
and change the fingerprint to something else - Build the app and run it on Android emulator
- Start passkey registration -> It should fail and the doctor should tell you that the assetlinks.json file is missing the correct fingerprint.
- Change the fingerprint back through the developer panel
- Restart the passkey registration -> It should succeed and the doctor should tell you that the assetlinks.json file is correct.
Testing Web
- Hardcode an RPID different than
localhost
in local_relying_party.dart - Build and run the app on web
- Start passkey registration -> It should fail and the doctor should tell you that the RPID is not a valid domain
- Change the RPID back to
localhost
- Restart passkey registration -> It should succeed and the doctor should tell you that the RPID is valid.
Testing JS script
- Remove the passkeys JS script from the
web/index.html
file - Build and run the app on web
- The app will fail to load and the doctor will tell you that the passkeys JS script is missing
- Add the passkeys JS script back to the
web/index.html
file - Rebuild and Restart the app -> The app should start.
Check for AASA CDN Caching
- Disable Associated Domains Development in your physical device
- Remove the app bundle from the RPID AASA file
- Build and run the app on your physical device
- Try to create a passkey -> it should fail , the doctor should also tell you that the AASA is missing the correct bundle
- Add the app bundle to the RPID AASA file
- Rerun/rebuild the app and try to register a passkey it will fail but this time the doctor should be aware that the AASA file is correct and suggest that the issue is actually caching related.