コンテンツにスキップ

はじめに

  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: shim に追加する extra 依存先のホスト名
  • autoShim: __CAPGO_KEEP_0__にデフォルト true と、ネイティブの cap sync 自動構成のハック

あなたのためにsyncパッチをsyncします

「あなたのためにsyncパッチを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

プラットフォームガイド

プラットフォーム ガイド