
Android 安全提供者
@capacitor-community/security-provider
检查并更新 Capacitor app中的Android安全提供商.
关于
具有检查和更新Android安全提供商方法的电容插件.
Android依靠安全提供商提供安全的网络通信. 然而,不时在缺省担保提供人中发现有弱点。 为了防范这些弱点,Google Play服务提供了一种自动更新设备安全供应商的方法来防范已知的被利用. 通过调用Google Play服务方法,您可以帮助确保您的应用程序运行在一个有最新更新的设备上,以防范已知的被利用.
例如,在OpenSSL(CVE-2014-0224)中发现了一种脆弱性,这种脆弱性可以让应用打开来进行可解密交通的上行道攻击,而任何一方都不知情. Google Play服务版本 5.0提供固定,但应用程序必须检查是否安装了这个固定. 通过使用Google Play服务方法,您可以帮助确保您的应用程序运行在能够防范袭击的设备上.
安装
npm install @capacitor-community/security-provider
npx cap sync
使用量
import { CapacitorSecurityProvider, SecurityProviderStatus } from '@capacitor-community/security-provider';
...
const result = await CapacitorSecurityProvider.installIfNeeded();
if (result.status !== SecurityProviderStatus.Success && result.status != SecurityProviderStatus.NotImplemented) {
// Do not proceed. The Android Security Provider failed to verify / install.
}
见 样本控制器 5 应用程序 使用此插件.
API 密码
安装ifNeed ()
installIfNeeded() => Promise<{ status: SecurityProviderStatus; }>
回返情况: Promise<{ status: SecurityProviderStatus; }>
数字
安全状况
| 成员 | 数值 | 说明 |
|---|---|---|
Success | 'Success' | 这表明供应商已更新或已成功更新 |
NotImplemented | 'NotImplemented' | 这将发生在iOS和Web上,因为这些平台不能叫Android安全提供商 |
GooglePlayServicesRepairableException | 'GooglePlayServicesRepairableException' | 表示Google Play服务过时,已禁用等. 如果返回, 本地对话框将通知并提示用户更新 . |
GooglePlayServicesNotAvailableException | 'GooglePlayServicesNotAvailableException' | 表示无法恢复的错误; 提供者无法安装最新的提供者 。 您应该中止应用程序的运行 . |