iOS 设置
关联域名和 apple-app-site-association.
复制一个包含安装步骤和本插件的完整 Markdown 指南的配置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-passkey`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/passkey/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装包
bun add @capgo/capacitor-passkey同步本机项目
bunx cap sync添加插件配置
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;在引导期间安装 shim
import { CapacitorPasskey } from '@capgo/capacitor-passkey';
await CapacitorPasskey.autoShimWebAuthn();保持正常的 WebAuthn 流程
const registration = await navigator.credentials.create({ publicKey: registrationOptions,});
const authentication = await navigator.credentials.get({ publicKey: requestOptions,});从配置文件中读取 plugins.CapacitorPasskey 在 capacitor.config.*.
originhttps://APIdomains在同步过程中,将额外的依赖方主机名注入到本地配置中。autoShim: 默认值 true 控制原生 cap sync 自动配置钩子当您运行时, bunx cap sync,插件会更新生成的本机主机项目:
asset_statements 元数据和由清单使用的生成资源钩子不会为您发布网站信任文件。您仍然需要托管:
https://your-domain/.well-known/apple-app-site-associationhttps://your-domain/.well-known/assetlinks.json