Skip to content

Getting Started

GitHub
  1. パッケージをインストール

    ターミナル画面
    bun add @capgo/capacitor-passkey
  2. ネイティブプロジェクトを同期

    ターミナル画面
    bunx cap sync
  3. プラグイン設定を追加する

    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. 起動時に shim をインストールする

    import { CapacitorPasskey } from '@capgo/capacitor-passkey';
    await CapacitorPasskey.autoShimWebAuthn();
  5. 通常の WebAuthn フローを維持する

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

設定は plugins.CapacitorPasskey から読み込まれます capacitor.config.*.

  • origin: primary HTTPS relying-party origin used by the shim and direct API
  • domains: shim に追加する extra 依存先のホスト名
  • autoShim: __CAPGO_KEEP_0__ truecap sync nativeアプリの設定を制御します。

「あなたのサイトのパッチをsyncする」 bunx cap syncプラグインを実行すると、生成されたネイティブホストプロジェクトが更新されます:

  • iOS: 必要に応じてドメインの関連付けとXcodeの特権のワイヤリング
  • Android: asset_statements manifestで使用される生成されたリソースとメタデータ

hookはあなたのサイトの信頼情報を公開しません。まだホストする必要があります:

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

プラットフォームガイド

Platform guides

Getting Startedから続けて

Getting Startedから続けて

Capgoを使用している場合 Getting Started を使用して認証とアカウントフローの計画を行い、接続する @capgo/capacitor-passkey native capability in @capgo/capacitor-passkey @capgo/capacitor-social-login implementation detail in @capgo/capacitor-social-login @capgo/capacitor-passkey implementation detail in @capgo/capacitor-passkey @capgo/capacitor-native-biometric implementation detail in @capgo/capacitor-native-biometric Two-factor authentication implementation detail in Two-factor authentication