- Registration (“sign up”) creates a new key pair: this is your passkey
- Authentication (“sign in”) uses an existing passkey to sign a message, proving ownership of the associated private key stored on your device.
Passkeys on the web
Creating and using passkeys on the web is straightforward: browsers offer APIs to do it!navigator.credentials.createcreates a passkeynavigator.credentials.getprompts the user to select a passkey to sign a message
app.example.com won’t be usable on evil.example.com, for example. Browsers prevent this.
Native platform APIs
Android
In the Android ecosystem theCredentialManager supports creating and using passkeys with CreatePublicKeyCredentialRequest and GetCredentialRequest. See the associated documentation for more information.
iOS
iOS APIs to create and use passkeys are available as well:ASAuthorizationPlatformPublicKeyCredentialProvider(…).createCredentialRegistrationRequestfor passkey creationASAuthorizationPlatformPublicKeyCredentialProvider(…).createCredentialAssertionRequestfor passkey usage
Native 0xkey SDKs
For fully native apps, use the Swift SDK (iOS / macOS) or the Kotlin SDK (Android). Both wrap the platform passkey APIs above, stamp 0xkey requests with passkeys or session keys, and cover sign-in, wallets and signing.Building with React Native
0xkey has a fully-featured TypeScript SDK. It provides a type-safe client to call the 0xkey API and abstracts activity request signing. React Native lets you write your app in Typescript and compile it into native code for both iOS and Android automatically. To sign 0xkey requests with native passkeys in a React Native application we’ve released@0xkey-io/react-native-passkey-stamper, a package compatible with our TypeScript client to sign 0xkey requests with native passkeys.
Under the hood this package wraps react-native-passkey, which calls the right native APIs on iOS and Android, and exports a unified interface that we leverage.
Bottom-line: if you’ve used our webauthn stamper or API key stamper, using our React Native passkey stamper will feel familiar. Take a look at the “Installation” and “Usage” sections to get started with passkeys in your React Native application.
Linking apps and web domains
Passkeys on native apps aren’t app-bound, they’re domain bound just like web passkeys. This may come as a surprise: you’ll have to configure a web domain to use passkeys natively! Configuration is done separately per ecosystem, but the idea is the same:- iOS expects a JSON file at the domain root (
/.well-known/apple-app-site-association): see Apple’s Supporting associated domains - Android expects a JSON file at the domain root (
/.well-known/assetlinks.json): see Android’s Verify Android App Links
app.example.com domain would allow users to log into their account from a native mobile app using their web-created passkey as long as they’re synced properly.
Note that these associations are “many-to-many”: a website can link multiple associated apps, and a single native application can choose to create passkeys for multiple domains, via a dropdown for example. However (as far as we know) a single passkey is always bound to a single web domain: it can’t be bound to multiple web domains.