コンテンツにスキップ

はじめに

  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,
    });

__CAPGO_KEEP_0__から設定を読み込む plugins.CapacitorPasskeycapacitor.config.*.

  • origin: primary HTTPS relying-party origin used by the shim and direct API
  • domains追加のリレーピアホスト名を、ネイティブ設定にSync時にパッチする
  • autoShimデフォルト値は true ネイティブの cap sync 自動設定のハック

あなたが実行するとき bunx cap syncプラグインは、生成されたネイティブホストプロジェクトを更新します:

  • iOS: 必要に応じて関連ドメインの特権とXcodeの特権のワイヤリング
  • Android: asset_statements メタデータと生成されたリソースがマニフェストによって使用される

ホックはあなたのウェブサイトの信頼ファイルを公開しません。まだホストする必要があります:

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