Setup iOS
Associated Domains e apple-app-site-association.
Copia un prompt di configurazione con i passaggi di installazione e la guida markdown completa per questo plugin.
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.
Puoi usare il nostro setup assistito dall'IA per installare il plugin. Aggiungi le skill Capgo al tuo strumento di IA usando il seguente comando:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsPoi usa il seguente prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-passkey` plugin in my project.Se preferisci la configurazione manuale, installa il plugin eseguendo questi comandi e segui le istruzioni specifiche per piattaforma qui sotto:
Installa il pacchetto
bun add @capgo/capacitor-passkeySincronizza i progetti nativi
bunx cap syncAggiungi config del plugin
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;Installa lo shim durante il bootstrap
import { CapacitorPasskey } from '@capgo/capacitor-passkey';
await CapacitorPasskey.autoShimWebAuthn();Mantieni il tuo normale flusso WebAuthn
const registration = await navigator.credentials.create({ publicKey: registrationOptions,});
const authentication = await navigator.credentials.get({ publicKey: requestOptions,});La configurazione viene letta da plugins.CapacitorPasskey nella capacitor.config.*.
origin: l'origine HTTPS primary relying-party usata dallo shim e API direttodomains: hostname extra della relying-party da applicare alla config nativa durante la syncautoShim: il valore predefinito è true e controlla la parte nativa cap sync hook di auto-configurazioneQuando esegui bunx cap sync, il plugin aggiorna il progetto host nativo generato:
asset_statements metadati e la risorsa generata usata dal manifestL'hook non pubblica i file di trust del tuo sito. Devi comunque ospitare:
https://your-domain/.well-known/apple-app-site-associationhttps://your-domain/.well-known/assetlinks.jsonSe il tuo backend restituisce già JSON WebAuthn, chiama direttamente i metodi del plugin.
import { CapacitorPasskey } from '@capgo/capacitor-passkey';
const registration = await CapacitorPasskey.createCredential({ publicKey: registrationOptionsFromServer,});
const assertion = await CapacitorPasskey.getCredential({ publicKey: requestOptionsFromServer,});Usa isSupported() before showing passkey UI on older devices.
Setup iOS
Associated Domains e apple-app-site-association.
Configurazione Android
Digital Asset Links e assetlinks.json.
Note sul backend
Validazione dell'origin e avvertenze per Android.
Se stai usando Per iniziare per pianificare i flussi di autenticazione e account, collegandolo a Utilizzo di @capgo/capacitor-passkey per la funzionalità nativa in Utilizzo di @capgo/capacitor-passkey, @capgo/capacitor-social-login per i dettagli di implementazione in @capgo/capacitor-social-login, @capgo/capacitor-passkey per i dettagli di implementazione in @capgo/capacitor-passkey, @capgo/capacitor-native-biometric per i dettagli di implementazione in @capgo/capacitor-native-biometric, e Autenticazione a due fattori per i dettagli sull'implementazione dell'autenticazione a due fattori.