__CAPGO_KEEP_0__

시작하기

  1. 패키지를 설치하세요

    터미널 창
    bun add @capgo/capacitor-app-attest
  2. 자연어 프로젝트 동기화

    터미널 창
    bunx cap sync
  3. 플랫폼 요구 사항을 구성하세요

    • 완료 iOS 설정 App Attest 기능과 백엔드 검증 흐름을 위해
    • 완료 Android 설정 Play Integrity 표준 및 백엔드 검증 흐름을 위한.

이 플러그인을 사용하는 이유

“이 플러그인을 사용하는 이유”라는 섹션

이 플러그인은 한 번의 크로스 플랫폼 API를 제공하면서 네이티브 플랫폼 보안을 유지합니다:

  • iOS: Apple App Attest (DeviceCheck)
  • Android: Google Play Integrity 표준 API
  • 사용자 지정 클라이언트 측 암호화 스킴이 필요하지 않습니다
  • 백엔드 검증을 위한 정규화된 출력
import { AppAttest } from '@capgo/capacitor-app-attest';
const support = await AppAttest.isSupported();
if (!support.isSupported) {
throw new Error(`Attestation not supported on ${support.platform}`);
}
const prepared = await AppAttest.prepare();
const registration = await AppAttest.createAttestation({
keyId: prepared.keyId,
challenge: 'backend-one-time-registration-challenge',
});
const assertion = await AppAttest.createAssertion({
keyId: prepared.keyId,
payload: 'backend-one-time-request-payload',
});
console.log(registration.platform, registration.format, registration.token);
console.log(assertion.platform, assertion.format, assertion.token);

통합된 응답 형태

통합 응답 형식

createAttestation() 그리고 createAssertion() iOS와 Android에서 동일한 키 필드를 반환하십시오:

FieldType설명
platform'ios' | 'android' | 'web'토큰을 생성한 네이티브 플랫폼
formatAttestationFormatapple-app-attest 또는 google-play-integrity-standard
keyIdstring인증을 위해 사용되는 키/제공자 핸들
tokenstring서버에서 확인할 토큰

서버 측에서 검증된 경우에만 신뢰할 수 있는 attestation입니다.

  • 클라이언트만 성공한 경우는 절대 신뢰하지 마세요.
  • 백엔드에서 한번만 사용할 수 있는 challenge/payload 값을 요구하세요.
  • 인증 token앱 식별, 그리고 백엔드 로직에서 재생용 보호 기능을 사용하세요.

플랫폼에 맞는 백엔드 가이드를 사용하세요: