Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 2.08 KB

README.md

File metadata and controls

55 lines (41 loc) · 2.08 KB

electron-passkey

Native module for electron applications to use passkey funcitonality in macOS apps.

Usage

  1. 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);
  1. Forward calls in main process
import { ipcMain } from 'electron';
import Passkey from 'electron-passkey';

Passkey.getInstance().attachHandlersToMain('domain.com', ipcMain);

Entitlements Setup

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

  1. In developer.apple.com create an app identifier
  2. Enable Associated Domains for your identifier AssociatedDomains
  3. You may need to create a provisioning profile for macOS development on your device and/or for distribution
  4. Create a webserver to serve an AASA file as specificed in the docs
  5. Test it with the yURL validator and/or branch.io validator
  6. 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>
  1. Check to see if your AASA is being cached by the Apple CDN at https://app-site-association.cdn-apple.com/a/v1/DOMAIN
  2. Make sure to pass in your domain to attachHandlersToMain()
  3. Build your electron application and sign it

Deployments

Here is how this repo handles deployments:

Deployments