38 Commits

Author SHA1 Message Date
Igor Mandrigin
c2701a516c Implement security level guarantees for Android.
Supported security levels:
- ANY
- SECURE_SOFTWARE
- SECURE_HARDWARE (TEE or SE guarantees).

(1) Add `getSecurityLevel()` API that returns which security level is
supported on this Android version and the specific device.

(2) For APIs that store credentials, an additional optional parameter was added
that fails storing the credentials if the security level is not what is
expected.

```
// Store the credentials.
// Will fail if Keychain can't guarantee at least SECURE_HARDWARE level of encryption key.
await Keychain.setGenericPassword(username, password, Keychain.SECURITY_LEVEL.SECURE_HARDWARE);
```

(3) StongBox support on Android 9+ (and supported devices [Pixel 3]).
2019-01-20 20:15:18 +01:00
Axel Eirola
b2ab380e20 Export hasInternetCredentialsForServer method in android (#166) 2018-11-13 16:22:58 +01:00
Jürno Ader
b2c07b9f77 Add hasInternetCredentials (#150)
This checks if the username/password combination for server is available in the secure storage.
Resolves to `true` if an entry exists or `false` if it doesn't.
2018-09-30 14:12:57 +02:00
Vojtech Novak
1abc167b70
extract a function, add null checks (#146)
* extract a function, add null checks

* rename function
2018-09-04 13:55:37 +02:00
Danish
575cd8c06a Update obsolete compile to implemenation (#141)
Hi, as React native 0.56.0 is released with MAJOR android changes such as:

-Gradle 3.5.1
-Compile using Android SDK 26
-Google Maven repo
-etc

more about Change log, specially of Android Here, https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#android-projects-are-now-compiled-using-the-android-26-sdk
and https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#android-specific-changes

Aslo as Per Google new "Google Play's target API level requirement", mentioned here  https://developer.android.com/distribute/best-practices/develop/target-sdk

"Google Play will require that new apps target at least Android 8.0 (API level 26) from August 1, 2018, and that app updates target Android 8.0 from November 1, 2018."

It's clear that Android would be moving to new Gradle and new SDK changes, Thus creating a new type of error that is:

"Configuration 'compile' is obsolete and has been replaced with 'implementation' or 'Api'" 

more about the Old and new configuration please see this https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration?utm_source=android-studio#new_configurations 
at the heading of "Use the new dependency configurations"

Therefore, all old "compile" should be now "implementation" or "provided" should be "compileOnly"

I have tested the with "compile" and "implementation" in my current release ready product and also by "renaming" "compile" to "implementation".
Also tested with higher andorid SDK configs such as of below:

```
ext {
    buildToolsVersion = "27.0.3"
    minSdkVersion = 19
    compileSdkVersion = 27
    targetSdkVersion = 27
    supportLibVersion = "27.1.1"
}
```

so SDK 27 was also compiled successully. test on Android phone with ADK 23 all looks good. Thus, `react-native-keychain` was working just fine as intended. thank you so much for this package btw.

Therefore, Please would it be possible to merge as i am sure many new projects and old one are going to update specially Gradle and SDK as of Google new requirements. 

related mention of Upgrading issue mention here https://github.com/facebook/react-native/issues/20273#issuecomment-405959030


Moreover, if someone still have any issue after upgrading everything successfully, then he should use following in build.gradle under `andorid/build.gradle`

```

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                buildToolsVersion '27.0.3'
                supportLibVersion = "27.1.1"
            }
        }
    }
}
```
2018-08-30 22:52:03 +02:00
Johannes Kronmüller
e98c057da2 android: use getReactApplicationContext instead of getCurrentActivity (#143) 2018-07-23 12:09:23 +02:00
maxkomarychev
fca9c8ad2f Catch uncaught exceptions to prevent crash (#134)
`NullPointerException` thrown on some Huawei devices is crashing entire app.
Handle all exceptions and rethrow them as caught exceptions.

This is an attempt to prevent issue described in https://github.com/oblador/react-native-keychain/issues/115.
2018-07-20 10:07:07 +02:00
Tom Aranda
e311144745 Support React Native 0.56 (#139) 2018-07-20 10:04:17 +02:00
Vojtech Novak
ee959ba42e
improve consistency and docs (#114)
* Update KeychainModule.java

* Update README.md
2018-03-13 16:24:58 +01:00
shofman
61b6626f34 Update DeviceAvailability to work with Android < 6 (#109)
Validate that the build version supports FingerprintManager before using it. Return false when not supported
2018-02-28 14:14:36 +01:00
Joel Arvidsson
c3990b0c09 Add Android support for getSupportedBiometryType 2018-02-27 16:20:37 +01:00
Vojtech Novak
610ad80134 do not specify RN version in gradle
previously this would cause gradle to fetch old rn version even though it wasn't needed
2017-09-06 15:34:50 +02:00
Andrew Jack
fbd9fb996a Support React Native 0.47 (#80) 2017-08-24 23:10:17 +02:00
Pelle Stenild Coltau
ef9b5256ef Moving null checks from CipherStorageFacebookConceal and PrefsStorage to KeychainModule and introducing checks for empty service in CipherStorageKeystoreAESCBC. 2017-06-29 09:49:35 +02:00
Pelle Stenild Coltau
71f567d65a Renaming PrefsStorage.resetPassword() to .removeEntry() 2017-06-28 15:40:56 +02:00
Pelle Stenild Coltau
e07e571e63 Upgrading to Facebook Conceal 1.1.3. 2017-06-26 10:18:39 +02:00
Pelle Stenild Coltau
a45f1351c2 Refactoring based on review: CipherStorage.getAPILevel() renamed to getMinSupportedApiLevel(). Fixed issue with no handling of null service in PrefsStorage. Throwing of CryptoFailedException moved to getCipherStorageForCurrentAPILevel(). Removed unused constructor. 2017-06-26 10:06:46 +02:00
Pelle Stenild Coltau
1c0552f88b Fixed issue with missing cipher storage name. Also did some small refactorings and adding to comments. 2017-06-18 12:55:48 +04:00
Pelle Stenild Coltau
32c5caff39 Refactored implementation to support various encryption algorithms and key storage depending on API level. 2017-06-18 11:38:00 +04:00
Pelle Stenild Coltau
808a7000da Added support for API levels lower than 23 using Facebook’s conceal. 2017-06-15 16:20:33 +04:00
Pelle Stenild Coltau
025aab835a Refactored methods regarding the SharedPreferences and moved them to a utility class. 2017-06-15 10:09:59 +04:00
Pelle Stenild Coltau
544b92f262 Addressed review comments: Fixed copy-paste error, fixed migration from Facebook conceal and removed unused variable. 2017-06-15 09:01:09 +04:00
Pelle Stenild Coltau
10463e693d Replaced RSA implementation with AES-CBC (256 bit) encryption. 2017-06-04 13:01:15 +04:00
Pelle Stenild Coltau
25c1334d0e Fixing issue where legacy values stored with a NULL service would not be migrated.
Signed-off-by: Pelle Stenild Coltau <pcoltau@gmail.com>
2017-05-21 09:57:53 +04:00
Pelle Stenild Coltau
a097053fe1 Splitting resetGenericPasswordForOptionsWithDelimiter() into two different methods: resetGenericPasswordForOptions() and resetGenericPasswordForOptionsLegacy(), in order to make it easier to remove legacy code.
Signed-off-by: Pelle Stenild Coltau <pcoltau@gmail.com>
2017-05-18 14:04:58 +04:00
Pelle Stenild Coltau
145a0983cb Changed KeychainModule to use Android’s KeyStore for creating and storing encryption keys. Also added functionality to automatically migrate existing encrypted data from Facebook’s conceal to encryption using KeyStore keys.
Signed-off-by: Pelle Stenild Coltau <pcoltau@gmail.com>
2017-05-18 10:40:14 +04:00
Vojtech Novak
33d1816272 [android] return false instead of exception when entry not present (#57)
* Update KeychainModule.java

this will return false when a keychain entry is not present, so it'll behave same as on ios

* do not throw on entry reset
2017-03-17 21:00:32 +01:00
Joel Arvidsson
6eb0a35037 Refactor accessible argument into options 2017-02-10 10:58:39 +01:00
Alexander Jarvis
1c4562a421 Add accessible argument for iOS (#51)
* Fix accessible

* Make accessible configurable

* Fix semicolon

* Remove unused function
2017-02-10 09:34:58 +01:00
Joel Arvidsson
eb9093aed7 Refactors native methods to use promises and deprecate callback argument 2017-01-10 23:00:51 +01:00
Vojtech Novak
732b765c7a minor refactoring 2016-12-30 10:00:33 +01:00
Vojtech Novak
c19efe56c5 remove a log message, inform if crypto not available 2016-12-16 13:32:54 +01:00
Vojtech Novak
7e3b8642bd Update KeychainModule.java 2016-12-11 16:30:50 +01:00
Vojtech Novak
0eadf5061e removed a message that is too annoying in the log 2016-08-26 13:48:57 +02:00
Vojtech Novak
6bd55d7946 removed a message that is too annoying in the log 2016-08-26 13:45:46 +02:00
Andy Hartwell
6b9eabae01 Use Charset instead of StandardCharset for UTF-8 to support sdk < 19 2016-06-17 11:08:40 -07:00
Vojtech Novak
040b2c2128 Fixes callback on saving and resetting the password on android (#24)
* invoke callback after saving

* invoke callback after pw reset
2016-06-02 22:35:46 +02:00
Vojtech Novak
d05b20c904 Added Android support w/ Facebook Conceal (#19)
Updates to Android storage

use password

added android support

readme update

implemented internet credentials on android

Merge Android and iOS index into 1 file.

Update flow version

Make error handling more consistent between Android and iOS

removing unneccessary binaries
2016-06-01 00:25:51 +02:00