본문 바로가기

시작하기

GitHub

AI-Assisted Setup으로 플러그인을 설치할 수 있습니다. 다음 명령어로 AI 도구에 Capgo 스킬을 추가하세요:

터미널 창
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

그런 다음 아래 프롬프트를 사용하세요:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-passkey` plugin in my project.

수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:

  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: shim 및 직접 API 호출에 사용되는 기본 HTTPS relying-party origin
  • domains: 동기화 시 native config에 패치할 추가 relying-party hostname
  • autoShim: 기본값은 true 그리고 native 제어 cap sync 자동 구성 hook

동기화 패치가 대신 처리하는 것

“동기화 패치가 대신 처리하는 것” 섹션

실행하면 bunx cap sync, 플러그인이 생성된 native host 프로젝트를 업데이트합니다:

  • iOS: 필요 시 associated domains entitlements 및 Xcode entitlements 연결
  • Android: asset_statements 메타데이터와 manifest에서 사용하는 생성된 리소스

이 hook은 웹사이트 신뢰 파일을 대신 게시하지 않습니다. 다음은 직접 호스팅해야 합니다:

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

예시: JSON API 직접 사용 (shim 없음)

“예시: JSON API 직접 사용 (shim 없음)” 섹션

백엔드에서 이미 WebAuthn JSON을 반환하는 경우, 플러그인 메서드를 직접 호출하세요.

import { CapacitorPasskey } from '@capgo/capacitor-passkey';
const registration = await CapacitorPasskey.createCredential({
publicKey: registrationOptionsFromServer,
});
const assertion = await CapacitorPasskey.getCredential({
publicKey: requestOptionsFromServer,
});

사용 isSupported() 구형 기기에서 passkey UI를 표시하기 전에.

사용 중이라면 시작하기 인증 및 계정 흐름을 설계할 때, 이를 다음 항목과 연결하세요: @capgo/capacitor-passkey 사용하기 ‘@capgo/capacitor-passkey 사용하기’의 네이티브 기능에 대해서는, @capgo/capacitor-social-login @capgo/capacitor-social-login의 구현 세부 사항은, @capgo/capacitor-passkey @capgo/capacitor-passkey의 구현 세부 사항은 @capgo/capacitor-native-biometric @capgo/capacitor-native-biometric의 구현 세부 사항은, 2단계 인증 2단계 인증의 구현 세부 사항에 대해서는