react-native-keychain
Advanced tools
Comparing version 6.2.0 to 7.0.0
25
index.js
@@ -7,5 +7,7 @@ // @flow | ||
export const SECURITY_LEVEL = Object.freeze({ | ||
ANY: RNKeychainManager.SECURITY_LEVEL_ANY, | ||
SECURE_SOFTWARE: RNKeychainManager.SECURITY_LEVEL_SECURE_SOFTWARE, | ||
SECURE_HARDWARE: RNKeychainManager.SECURITY_LEVEL_SECURE_HARDWARE, | ||
ANY: RNKeychainManager && RNKeychainManager.SECURITY_LEVEL_ANY, | ||
SECURE_SOFTWARE: | ||
RNKeychainManager && RNKeychainManager.SECURITY_LEVEL_SECURE_SOFTWARE, | ||
SECURE_HARDWARE: | ||
RNKeychainManager && RNKeychainManager.SECURITY_LEVEL_SECURE_HARDWARE, | ||
}); | ||
@@ -122,3 +124,3 @@ | ||
function normalizeServiceOption(serviceOrOptions?: string | Options) { | ||
function normalizeServiceOption(serviceOrOptions?: string | Options): Options { | ||
if (typeof serviceOrOptions === 'string') { | ||
@@ -213,2 +215,10 @@ console.warn( | ||
/** | ||
* Gets all `service` keys used in keychain entries. | ||
* @return {Promise} Resolves to an array of strings | ||
*/ | ||
export async function getAllGenericPasswordServices(): Promise<string[]> { | ||
return RNKeychainManager.getAllGenericPasswordServices(); | ||
} | ||
/** | ||
* Checks if we have a login combination for `server`. | ||
@@ -273,3 +283,3 @@ * @param {string} server URL to server. | ||
/** | ||
* Get what type of hardware biometry support the device has. | ||
* Get what type of Class 3 (strong) biometry support the device has. | ||
* @param {object} options An Keychain options object. | ||
@@ -283,6 +293,2 @@ * @return {Promise} Resolves to a `BIOMETRY_TYPE` when supported, otherwise `null` | ||
if (Platform.OS === 'ios') { | ||
return RNKeychainManager.getSupportedBiometryType(); | ||
} | ||
return RNKeychainManager.getSupportedBiometryType(); | ||
@@ -385,2 +391,3 @@ } | ||
getGenericPassword, | ||
getAllGenericPasswordServices, | ||
resetGenericPassword, | ||
@@ -387,0 +394,0 @@ requestSharedWebCredentials, |
{ | ||
"name": "react-native-keychain", | ||
"version": "6.2.0", | ||
"version": "7.0.0", | ||
"description": "Keychain Access for React Native", | ||
@@ -8,2 +8,3 @@ "main": "index.js", | ||
"android", | ||
"!android/src/test", | ||
"RNKeychain.xcodeproj", | ||
@@ -15,3 +16,5 @@ "RNKeychainManager", | ||
"scripts": { | ||
"test": "flow" | ||
"format": "prettier '{,typings/,KeychainExample/}*.{md,js,json,ts,tsx}' --write", | ||
"lint": "eslint .", | ||
"flow": "flow" | ||
}, | ||
@@ -46,5 +49,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"flow-bin": "^0.107.0", | ||
"react-native": "^0.61.2" | ||
"@react-native-community/eslint-config": "^2.0.0", | ||
"eslint": "^7.2.0", | ||
"flow-bin": "^0.122.0", | ||
"prettier": "^2.2.1", | ||
"react-native": "^0.63.3", | ||
"typescript": "^4.2.2" | ||
} | ||
} |
@@ -18,4 +18,5 @@ <h1 align="center">react-native-keychain</h1> | ||
- [`setGenericPassword(username, password, [{ accessControl, accessible, accessGroup, service, securityLevel }])`](#setgenericpasswordusername-password--accesscontrol-accessible-accessgroup-service-securitylevel-) | ||
- [`getGenericPassword([{ authenticationPrompt, service, accessControl }])`](#getgenericpassword-authenticationprompt-service-accessControl-) | ||
- [`getGenericPassword([{ authenticationPrompt, service, accessControl }])`](#getgenericpassword-authenticationprompt-service-accesscontrol-) | ||
- [`resetGenericPassword([{ service }])`](#resetgenericpassword-service-) | ||
- [`getAllGenericPasswordServices()`](#getallgenericpasswordservices) | ||
- [`setInternetCredentials(server, username, password, [{ accessControl, accessible, accessGroup, securityLevel }])`](#setinternetcredentialsserver-username-password--accesscontrol-accessible-accessgroup-securitylevel-) | ||
@@ -32,2 +33,3 @@ - [`hasInternetCredentials(server)`](#hasinternetcredentialsserver) | ||
- [Data Structure Properties/Fields](#data-structure-propertiesfields) | ||
- [`authenticationPrompt` Properties](#authenticationprompt-properties) | ||
- [`Keychain.ACCESS_CONTROL` enum](#keychainaccess_control-enum) | ||
@@ -39,3 +41,3 @@ - [`Keychain.ACCESSIBLE` enum](#keychainaccessible-enum) | ||
- [`Keychain.STORAGE_TYPE` enum (Android only)](#keychainstorage_type-enum-android-only) | ||
- [`Keychain.RULES` enum (Android only)](#keychainrules-enum-android-only) | ||
- [`Keychain.SECURITY_RULES` enum (Android only)](#keychainsecurity_rules-enum-android-only) | ||
- [Important Behavior](#important-behavior) | ||
@@ -45,3 +47,3 @@ - [Rule 1: Automatic Security Level Upgrade](#rule-1-automatic-security-level-upgrade) | ||
- [iOS](#ios) | ||
- [Option: Manually](#option--manually-) | ||
- [Option: Manually](#option-manually) | ||
- [Option: With CocoaPods](#option-with-cocoapods) | ||
@@ -57,2 +59,3 @@ - [Enable `Keychain Sharing` entitlement for iOS 10+](#enable-keychain-sharing-entitlement-for-ios-10) | ||
- [Android Notes](#android-notes) | ||
- [Configuring the Android-specific behavior](#configuring-the-android-specific-behavior) | ||
- [iOS Notes](#ios-notes) | ||
@@ -122,2 +125,8 @@ - [macOS Catalyst](#macos-catalyst) | ||
### `getAllGenericPasswordServices()` | ||
Will retrieve all known service names for which a generic password has been stored (e.g., `setGenericPassword`). | ||
_Note_: on iOS this will actully read the encrypted entries, so it will trigger an authentication UI if you have encrypted any entries with password/biometry. | ||
### `setInternetCredentials(server, username, password, [{ accessControl, accessible, accessGroup, securityLevel }])` | ||
@@ -153,4 +162,6 @@ | ||
Get what type of hardware biometry support the device has. Resolves to a `Keychain.BIOMETRY_TYPE` value when supported, otherwise `null`. | ||
**On iOS:** Get what type of hardware biometry support the device can use for biometric encryption. Resolves to a `Keychain.BIOMETRY_TYPE` value when supported and enrolled, otherwise `null`. | ||
**On Android:** Get what type of Class 3 (strong) biometry support the device has. Resolves to a `Keychain.BIOMETRY_TYPE` value when supported, otherwise `null`. In most devices this will return `FINGERPRINT` (except for Pixel 4 or similar where fingerprint sensor is not present). | ||
> This method returns `null`, if the device haven't enrolled into fingerprint/FaceId. Even though it has hardware for it. | ||
@@ -265,3 +276,3 @@ | ||
#### `Keychain.RULES` enum (Android only) | ||
#### `Keychain.SECURITY_RULES` enum (Android only) | ||
@@ -469,5 +480,6 @@ | Key | Description | | ||
Android implementation has behavioural specifics incurred by existing inconsistency between implementations by different vendors. E.g., some Samsung devices show very slow startup of crypto system. To alleviate this, a warm-up strategy is introduced in Android implementation of this library. | ||
Android implementation has behavioural specifics incurred by existing inconsistency between implementations by different vendors. E.g., some Samsung devices show very slow startup of crypto system. To alleviate this, a warm-up strategy is introduced in Android implementation of this library. | ||
Using default constructor you get default behaviour, i.e. with the warming up on. | ||
```java | ||
@@ -481,4 +493,6 @@ private List<ReactPackage> createPackageList() { | ||
``` | ||
``` | ||
Those who want finer control are required to use constructor with a builder which can be configured as they like: | ||
```java | ||
@@ -485,0 +499,0 @@ private List<ReactPackage> createPackageList() { |
@@ -98,2 +98,4 @@ declare module 'react-native-keychain' { | ||
function getAllGenericPasswordServices(): Promise<string[]>; | ||
function hasInternetCredentials(server: string): Promise<false | Result>; | ||
@@ -100,0 +102,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
456
574
196888
6
31