Vai al contenuto

Getting Started

Questo contenuto non è ancora disponibile nella tua lingua.

  1. Install the package

    Terminal window
    bun add @capgo/capacitor-passkey
  2. Sync native projects

    Terminal window
    bunx cap sync
  3. Add the plugin config

    import type { CapacitorConfig } from '@capacitor/cli';
    const config: CapacitorConfig = {
    appId: 'app.capgo.passkey.example',
    appName: 'My App',
    webDir: 'dist',
    plugins: {
    CapacitorPasskey: {
    origin: 'https://signin.example.com',
    autoShim: true,
    domains: ['signin.example.com'],
    },
    },
    };
    export default config;
  4. Import the shim once

    import '@capgo/capacitor-passkey/auto';
  5. Keep your normal WebAuthn flow

    const registration = await navigator.credentials.create({
    publicKey: registrationOptions,
    });
    const authentication = await navigator.credentials.get({
    publicKey: requestOptions,
    });

The config is read from plugins.CapacitorPasskey in capacitor.config.*.

  • origin: primary HTTPS relying-party origin used by the shim and direct API
  • domains: extra relying-party hostnames to patch into native config during sync
  • autoShim: defaults to true when you use @capgo/capacitor-passkey/auto

When you run bunx cap sync, the plugin updates the generated native host project:

  • iOS: associated domains entitlements and Xcode entitlements wiring when needed
  • Android: asset_statements metadata and the generated resource used by the manifest

The hook does not publish your website trust files for you. You still need to host:

  • https://your-domain/.well-known/apple-app-site-association
  • https://your-domain/.well-known/assetlinks.json