Biometric authentication lets users access apps securely using their fingerprint, face, or other biological traits instead of passwords. For developers working with Capacitor, implementing this feature is straightforward and works on both iOS and Android. Here’s a quick summary:
-
Why Use Biometric Authentication?
- It’s more secure than passwords.
- It improves user experience by making login faster.
- It meets security standards for sensitive data.
-
Supported Methods:
- Fingerprint: Quick and common.
- 顔認識: 手でなくするオプション。
- 虹彩スキャニング: 高セキュリティ用途 (制限されたデバイス)。
- 声認識: アクセシビリティに焦点を当てた (制限されたサポート)。
-
必要なツール:
- Capacitor 3.0+。
-
セットアップのハイライト:
- AndroidManifest と Info.plist に権限を追加。
- iOS の Keychain (Android の Keystore) を使用して安全なストレージを実行。
- 互換性とフォールバックオプションのための徹底的なテスト。
プラグインの比較
| プラグイン名 | Capacitor バージョン | 機能 | 最適 |
|---|---|---|---|
@aparajita/capacitor-biometric-auth | Capacitor 8 | ネイティブバイオメトリック、デバイスクレデンシャル | 新しいプロジェクトのCapacitor 8 |
capacitor-native-biometric | Capacitor 3, 4 | セキュアなクレデンシャルストレージ、Keychain/Keystore | クレデンシャル管理 |
| すべてのバージョン | バイオメトリックとデバイスクレデンシャルサポート | 柔軟な認証オプション |
バイオメトリック認証のCapacitor アプリ は、機密情報を保護するための安全で使いやすい方法です。全文記事では、セットアップ手順、codeの例、テスト戦略、セキュリティ基準について詳しく説明しています。
Ionic Biometric (FaceID / FingerPrint) 認証
セットアップ要件
を有効にするには、 Capacitorアプリ
を有効にするには、ツール、依存関係、およびプラットフォーム固有の設定を構成する必要があります。以下に、AndroidおよびiOSプラットフォームの両方のステップバイステップのセットアップ要件があります。
必要なツールと依存関係
| 実装に進む前に、以下のツールと依存関係が準備されていることを確認してください。 | コンポーネント | 最小バージョン |
|---|---|---|
| Capacitor | 3.0 以上 | Core フレームワーク |
| Node.js | 最新のLTS | パッケージ管理 |
| Xcode | 最新バージョン | iOS 開発 |
| Android Studio | 最新バージョン | Android 開発 |
| 実機デバイス | iOS 13+ / Android API 23+ | 生体認証機能のテスト |
選択してください 生体認証プラグイン Capacitor のバージョンに基づいて、以下のプラグインを選択してください:
- @aparajita/capacitor-biometric-auth Capacitor 8
- capacitor-native-biometric Capacitor 3 と 4
Android のセットアップ手順
Android で生体認証を設定するには、プロジェクトファイルにいくつかの変更が必要です。
-
マニフェストの設定
Add the following permissions to your
AndroidManifest.xmlfile:<uses-permission android:name="android.permission.USE_BIOMETRIC" /> <!-- For Android 9 (API 28) or lower --> <uses-permission android:name="android.permission.USE_FINGERPRINT" /> -
Gradle Setup
Update your app’s
build.gradlefile to include the necessary biometric dependencies:dependencies { implementation "androidx.biometric:biometric:1.1.0" }
iOS Setup Steps
For iOS, you’ll need to follow these steps to configure biometric authentication:
-
Info.plist Configuration
Add the required usage description to your
Info.plistfile:<key>NSFaceIDUsageDescription</key> <string>Authentication required for secure access</string> -
Keychain Configuration
Enable Keychain capabilities in Xcode:
- プロジェクト設定を開きます。
- 「 Signing & Capabilities 」タブに移動します。
- 「Keychain Sharing」機能を追加します。 必要に応じて、アクセス グループを設定します。 Authentication Policies
- ローカル認証ポリシーを設定して、次のシナリオを処理します。
-
認証失敗
デバイスのパスコードにフォールバックします。
- デバイスのパスコードにフォールバックします。
- __CAPGO_KEEP_0__
- 生体認証の利用可能性の確認
セキュリティの向上のために、iOS Keychainを使用して敏感なデータを保存してください。この設定により、Touch IDとFace IDの両方とユーザー認証情報の保護が可能になります。
Code Implementation
codeの実装
設定が完了したら、次のステップはセキュアな__CAPGO_KEEP_0__の実装です。このプロセスでは、適切なプラグインを選択し、信頼できる認証フローを作成する必要があります。
When picking a biometric authentication plugin for your Capacitor app, your choice should align with the project’s specific needs. Here are some popular options:
| あなたの__CAPGO_KEEP_0__アプリのために生体認証プラグインを選択する場合、あなたの選択はプロジェクトの特定のニーズに合致する必要があります。ここでは、人気のあるオプションを紹介します。 | Capacitor Version | __CAPGO_KEEP_0__ バージョン | 主な機能 |
|---|---|---|---|
| @aparajita/capacitor-biometric-auth | Capacitor 8 | ネイティブバイオメトリック、デバイスクレデンシャル、包括的なAPI | 新しいプロジェクトのCapacitor 8 |
| capacitor-ネイティブバイオメトリック | Capacitor 3, 4 | セキュアなクレデンシャルストレージ、Keychain/Keystore統合 | クレデンシャル管理が必要な既存のプロジェクト |
| すべてのバージョン | バイオメトリックとデバイスクレデンシャル認証、クリーンなAPI | 柔軟な認証オプションが必要なプロジェクト |
認証Codeの例
ここでは、__CAPGO_KEEP_0__の使用方法を紹介します。 @capgo/capacitor-ネイティブバイオメトリック biometric 認証用プラグイン:
import { Biometrics } from '@capgo/capacitor-native-biometric';
async function setupBiometricAuth() {
try {
const { isAvailable } = await Biometrics.isBiometricsAvailable();
if (!isAvailable) {
return {
success: false,
message: "Biometric authentication not available"
};
}
const result = await Biometrics.authenticate({
reason: "Access your secure data",
title: "Verify Identity",
subtitle: "Use biometrics to authenticate",
cancelTitle: "Use Password Instead"
});
return {
success: true,
data: result
};
} catch (error) {
return {
success: false,
error: error.message
};
}
}
セキュアな資格情報の管理のために、 capacitor-native-biometric プラグインは、以下のような簡単なアプローチを提供します。
import { NativeBiometric } from '@capgo/capacitor-native-biometric';
async function secureCredentialStorage(credentials) {
try {
await NativeBiometric.setCredentials({
username: credentials.username,
password: credentials.password,
server: "api.yourserver.com"
});
// Verify storage by retrieving the credentials
const stored = await NativeBiometric.getCredentials({
server: "api.yourserver.com"
});
return stored.username === credentials.username;
} catch (error) {
console.error("Credential storage failed:", error);
return false;
}
}
codeを実装した後、機能を適切にテストすることが重要です。
テスト方法
信頼性とセキュリティの高いbiometric認証を確実にするには、以下のテスト戦略を検討してください。
-
デバイス互換性テスト
さまざまなデバイスと状況で認証が機能することを確認します。
async function runCompatibilityTests() { const tests = { biometricAvailable: await Biometrics.isBiometricsAvailable(), credentialStorage: await testCredentialStorage(), authenticationFlow: await testAuthFlow(), fallbackMechanism: await testFallbackAuth() }; return tests; } -
エラーハンドリングと一般的なシナリオ
エラーをシミュレートし、フォールバックメカニズムをテストします。
async function validateErrorHandling() { try { await Promise.race([ Biometrics.authenticate(), new Promise((_, reject) => setTimeout(() => reject(new Error("Timeout")), 30000) ) ]); } catch (error) { return implementFallbackAuth(); } } -
セキュリティ検証
セキュリティ基準を満たした実装を確実にする:
async function validateSecurityMeasures() { const validations = { keychain: await validateKeychainAccess(), biometricStrength: await checkBiometricStrength(), encryptionStatus: await verifyEncryption() }; return validations.keychain && validations.biometricStrength && validations.encryptionStatus; }
さらに、次のようなシナリオをテストする:
- 複数回の認証失敗
- デバイスの再起動後の動作
- 前景とバックグラウンドアプリの状態の移行
- ネットワーク接続性の変更
- システムのバイオメトリック設定の更新
バイオメトリック認証システムの徹底的なテストにより、実用的な環境で機能する堅牢なシステムが確保される。
セキュリティ基準
バイオメトリック認証における強固なセキュリティを確保するには、データ保護を優先し、規制遵守を徹底し、層化されたセキュリティ技術を適用する。
データセキュリティ手法
iOSでは、バイオメトリックデータは暗号化され、ストレージに保存される Keychain, Androidは KeystoreCapgoプラグインを使用している場合、ユーザーキャレントを安全に保存することができます。 capacitor-native-biometric For data transmission, always implement
import { NativeBiometric } from '@capgo/capacitor-native-biometric';
async function securelyStoreCredentials(username, password) {
const server = "api.yourapp.com";
// Use the highest available encryption
await NativeBiometric.setCredentials({
username,
password,
server,
authenticationType: "biometricAndDevice",
accessControl: "biometryAny"
});
}
end-to-end encryption to keep sensitive information protected. Store Guidelines
App storesは
biometric security の厳格な規則を強制しています。Here’s a breakdown of the major platform requirements:
| プラットフォーム | 主な要件 | 実装に関する注意 |
|---|---|---|
| iOS | __CAPGO_KEEP_0__を使用してLocalAuthenticationフレームワークを提供し、ユーザーに明確な同意を求め、フォールバックオプションを提供する | 両方のFace IDとTouch IDをサポートする |
| Android | APIを使用してBiometricPromptを取得し、ユーザーに明確な許可を求め、セキュリティレベルを宣言する | サポートする認証方法は指紋認証と顔認証で、セキュリティレベルに応じて区別する |
Multi-Factor セットアップ
セキュリティを強化するには、 多要素認証 追加の認証レイヤーを使用します。例えば、初回認証後、 生体認証を追加して、ユーザーの身份を確認するための二次ステップを実行します:
async function setupMultiFactorAuth() {
// First factor: Biometric verification
const biometricResult = await Biometrics.authenticate({
reason: "Verify your identity",
title: "Authentication Required"
});
if (biometricResult.verified) {
// Second factor: Time-based OTP or similar mechanism
const totpResult = await verifyTOTP();
return totpResult.success;
}
return false;
}
多要素アプローチは通常、以下の要素を含みます:
- プライマリ生体認証
- セカンダリ認証 (例えば、SMS code または認証アプリ)
- トランザクション固有の確認 セキュリティの向上
If you’re using tools like Capgo for live updates, ensure compliance with security standards by taking advantage of its エンドツーエンド暗号化 の機能を利用してください。この機能により、更新中も生体認証方法がセキュアに保たれ、プラットフォームの要件に準拠します。 [1].
メンテナンス ガイド
生体認証システムを正常に稼働させるには、速度、バッテリー効率、タイムリーな更新をバランスさせる必要があります。
速度とバッテリーのヒント
生体認証を効率的に実装するための code Snippet を以下に示します。
// Efficient authentication implementation
async function optimizedBiometricCheck() {
const authResult = await NativeBiometric.isAvailable();
if (!authResult.isAvailable) {
return handleFallback();
}
// Cache authentication state to avoid unnecessary re-checks
if (this.cachedAuthState && !this.isAuthExpired()) {
return this.cachedAuthState;
}
return NativeBiometric.verifyIdentity({
reason: "Verify your identity",
title: "Authentication Required",
maxAttempts: 3
});
}
生体認証システムのパフォーマンスを最大限に引き出すには
- Batch Authentication: 一度に複数の認証要求をグループ化して、割り込まないようにします。
- Smart Caching: 認証状態を安全に保存し、有効期限を設定して、不要な再認証を避けることができます。
- Background Optimization: 認証中は非 essenstial タスクを一時停止して、速度を向上させてバッテリーを節約することができます。
- イベント駆動アプローチ: 定期ポーリングを置き換えることで、認証状態の監視を効率的に行うことができます。
Updates with Capgo

Capgoはアプリの更新を簡素化します。
Here’s why Capgoは、アプリの更新を管理するのに適したツールです。
- Instant Deployment: 承認の遅延なく、重要なセキュリティ修正と新機能を展開することができます。
- Staged Rollouts: セレクトユーザーグループにアップデートをテストすることで、全員に展開する前にアップデートをテストすることができます。
- Version Control: 認証バージョンの異なる管理を実現するために、バージョン管理を実施します。
- 緊急ロールバック問題が生じた場合に、以前のバージョンに迅速に戻ることができます。
API Updates
API のバイオメトリックを最新の状態に保つことは、セキュリティと機能性のために不可欠です。更新を追跡するためのガイドラインに従って、積極的に更新を実行してください。
| Update Type | 監視方法 | 実装スケジュール |
|---|---|---|
| セキュリティパッチ | プラグインリポジトリの警告 | 24 時間 |
| 機能更新 | プラットフォームドキュメント | 1 週間 |
| 変更点 | リリースノート | 2-4 週間 |
| ストアポリシーアップデート | 開発者ポータル | 提出前に |
これらの領域に焦点を当てて
- プラットフォーム変更iOS の LocalAuthentication と Android の BiometricPrompt API の更新を追跡する。
- セキュリティ基準最新のバイオメトリックセキュリティ要件に合わせて
- Store Guidelines: Apple App Store と Google Play のポリシーに準拠することで、提出の問題を回避することができます。
Conclusion
Key Takeaways
Capacitor アプリにバイオメトリック認証を追加するには、セキュリティ、パフォーマンス、ユーザー エクスペリエンスをバランスさせる必要があります。ここでは、主な要素を簡単にまとめてみました。
| Component | 実装の焦点 | 重要な考慮事項 |
|---|---|---|
| セキュリティ基準 | プラットフォームネイティブ ストレージ (Keychain/Keystore) | エンドツーエンド暗号化、クレデンシャル保護 |
| プラグインの選択 | 最新バージョンの互換性 | 複数のバイオメトリックタイプのサポート |
| 更新管理 | 定期的なメンテナンスサイクル | セキュリティパッチの迅速な展開 |
| ユーザー体験 | フォールバック認証オプション | 明確でユーザーフレンドリーな認証プロンプト |
これらのコンポーネントは、成功的な統合への道筋を示しています。
バイオメトリック認証の実装手順
この手順に従って、バイオメトリック認証をアプリに統合してください。
-
プラグイン統合
Start by choosing a biometric plugin that matches your Capacitor version. Ensure your configuration files - such asAndroidManifest.xmlと - は適切に設定されていることを確認してください。セキュアなクレデンシャル ストレージのために、Keychain または Keystore のようなネイティブ ソリューションに頼りましょう。Info.plistセキュリティ設定 -
ユーザー データを保護するには、すべてのクレデンシャル トランスミッションにエンドツーエンド暗号化を有効にします。必要な場合、
2要素認証 を追加してセキュリティの追加層を実現しましょう。失敗の場合の機能性を維持するために、頑丈なエラー ハンドリングとフォールバック オプションを計画してください。 継続的なメンテナンス -
アプリをセキュアに保つには、セキュリティ パッチのための定期的な更新パイプラインを設定してください。プラグインの更新とセキュリティ アドバイザリーの監視をしてください。ツールとして、
Keep your app secure by setting up a regular update pipeline for security patches. Stay on top of plugin updates and monitor security advisories. Tools like Capgo can simplify this process by enabling instant updates. Capgo boasts an impressive 95% user update rate within 24 hours, making it a valuable addition to your toolkit [2].
“Capgo is a must-have tool for developers who want to be more productive. Avoiding review for bug fixes is golden.” - Bessie Cooper [2]
“__CAPGO_KEEP_0__は、開発者がより生産的になることを望む開発者にとって不可欠なツールです。バグ修正のレビューを避けることは、金の価値です。” - Bessie Cooper
FAQs
What are the differences between Capacitor plugins for biometric authentication, and how can I select the best one for my app?
When picking a biometric plugin for your Capacitor app, it’s crucial to align the choice with your project’s specific requirements. Consider factors like platform compatibility (whether you need support for iOS, Android, or both), how simple the integration process is, and whether the plugin supports advanced biometric methods such as Face ID or fingerprint authentication.
Although this guide centers on implementing biometric authentication in __CAPGO_KEEP_0__ apps 、biometric authentication tools like Capacitor can play a valuable role. They allow you to push real-time updates to your app without needing app store approvals. This means your app can stay current with the latest security features, including biometric updates, while remaining compliant with both Apple and Android standards., tools like Capgo can play a valuable role. They allow you to push real-time updates to your app without needing app store approvals. This means your app can stay current with the latest security features, including biometric updates, while remaining compliant with both Apple and Android standards. :::
::: faq
私のCapacitorアプリのバイオメトリック認証がセキュリティ基準とアプリストアのガイドラインを満たしているかどうかを確認する方法はありますか?
私のCapacitorアプリのバイオメトリック認証が現在のセキュリティ基準とアプリストアの規則を満たしていることを確認するには、次の重要な実践に従ってください:
- 信頼できるプラグインを選択する: Capacitorの信頼できるバイオメトリック認証プラグインを使用して、アプリが安全で、デバイス間で平滑に動作するようにします。
@capacitor/biometricsプラットフォームの規則に従う - : AppleとAndroidのガイドラインに従い、ユーザーの同意を取得し、安全なストレージを使用し、PINまたはパスワードなどのバックアップオプションを提供する依存関係を最新に保つ
- : アプリとライブラリを定期的に更新して、脆弱性を修正し、変化する基準に沿ったままにするライブアップデートサービスとして
__CAPGO_KEEP_0__ Capgo このプロセスをスムーズにすることができます。アプリのセキュリティアップデートや改善を即時で、ストアの承認遅延を回避して、アプリをセキュアで、AppleおよびAndroidのポリシーに準拠した最新の状態に保つことができます。 :::
::: faq
Capacitorアプリにバイオメトリック認証を統合する際に開発者が直面する可能性のある課題は何か、それらを乗り越える方法は何か
Capacitorアプリにバイオメトリック認証を実装するには、さまざまなデバイスをサポートするためのプラグインを使用する必要があります。これらのツールは、AndroidおよびiOS両方のプラットフォームでバイオメトリック機能をサポートするのに役立ちます。
-
デバイスの互換性デバイスの互換性を確保するには、両方のプラットフォームでバイオメトリック機能をサポートするプラグインを使用する必要があります。これらのツールは、さまざまなデバイスでアプリがうまく動作するように支援します。
@capacitor-fingerprint-authユーザーの許可 -
ユーザーの許可を取得する際には、明確にアプリがバイオメトリックアクセスを必要とする理由を説明する必要があります。ユーザーに透明性を提供し、ユーザーが許可を拒否した場合にアプリが適切に動作するように設計する必要があります。データのセキュリティ
-
認証データを保護することは非常に重要です。暗号化のベストプラクティスを遵守する必要があります 暗号化のベストプラクティスを遵守する必要があります 各プラットフォームから提供されるセキュリティガイドラインに従って、機密情報を安全に保つ。
アプリストアの承認手続きの面倒さを避けて、バイオメトリック機能に関連する更新や問題を解決するには、Capgoなどのツールを使用できます。この機能により、リアルタイムの更新が可能になり、バグを解決したり機能性を向上させたりすることができます。また、AppleとAndroidのポリシーに準拠したままです。
Biometric Authentication in Capacitor Appsから続けて
Biometric Authentication in __CAPGO_KEEP_0__ Appsを使用している場合 セキュリティとコンプライアンスを計画するには、Capacitor Appsと接続します。 Encryption Encryptionの実装詳細については、 Compliance Complianceの実装詳細については、 __CAPGO_KEEP_0__ Security Scanner product workflow in Capgo Security Scannerについて for the product workflow in Capgo Security Scanner, Capgo セキュリティ 製品ワークフロー内で Capgo セキュリティ、そして Capgo トラストセンター 製品ワークフロー内で Capgo トラストセンター。