Native module for electron applications to use passkey funcitonality in macOS apps.
- Intercept calls in the renderer process or preload
import { ipcRenderer } from 'electron';
navigator.credentials.create = (options) =>
Passkey.getInstance().attachCreateToRenderer(ipcRenderer, options);
navigator.credentials.get = (options) =>
Passkey.getInstance().attachGetToRenderer(ipcRenderer, options);
- Forward calls in main process
import { ipcMain } from 'electron';
import Passkey from 'electron-passkey';
Passkey.getInstance().attachHandlersToMain('domain.com', ipcMain);
NOTE: Ensure your AASA is passing validation BEFORE you check it against Apple's CDN AND BEFORE you run your application with the entitlements or Apple may temporarily cache an invalid AASA and you will be stuck until they recheck
- In developer.apple.com create an app identifier
- Enable Associated Domains for your identifier
- You may need to create a provisioning profile for macOS development on your device and/or for distribution
- Create a webserver to serve an AASA file as specificed in the docs
- Test it with the yURL validator and/or branch.io validator
- Add the following to your entitlements plist
<key>com.apple.application-identifier</key>
<string>TEAMID.APP-ID</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:DOMAIN</string>
<string>webcredentials:DOMAIN</string>
</array>
- Check to see if your AASA is being cached by the Apple CDN at
https://app-site-association.cdn-apple.com/a/v1/DOMAIN
- Make sure to pass in your domain to
attachHandlersToMain()
- Build your electron application and sign it
Here is how this repo handles deployments: