Skip to content

Commit

Permalink
Add StrongBox availability check
Browse files Browse the repository at this point in the history
  • Loading branch information
Fi5t committed Jul 8, 2020
1 parent 9300cb4 commit 24db6cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ yourself ;)
Add this library to your gradle config

```groovy
implementation 'com.redmadrobot:pinkman:1.0.1'
implementation 'com.redmadrobot:pinkman:1.0.2'
```

Create an instance of the `Pinkman` class (use a DI please) and
Expand Down
2 changes: 1 addition & 1 deletion pinkman/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lib_name=pinkman
lib_version=1.0.1
lib_version=1.0.2
lib_description=PINkman is a library to help implementing an authentication by a PIN code in a secure manner
lib_vcs=https://github.com/RedMadRobot/PINkman.git
lib_issue_tracker=https://github.com/RedMadRobot/PINkman/issues
8 changes: 7 additions & 1 deletion pinkman/src/main/java/com/redmadrobot/pinkman/Pinkman.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.redmadrobot.pinkman

import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties.*
Expand Down Expand Up @@ -37,7 +38,12 @@ class Pinkman(
.apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
setUnlockedDeviceRequired(true)
setIsStrongBoxBacked(true)

val hasStrongBox = applicationContext
.packageManager
.hasSystemFeature(PackageManager.FEATURE_STRONGBOX_KEYSTORE)

setIsStrongBoxBacked(hasStrongBox)
}
}.build()

Expand Down

0 comments on commit 24db6cf

Please sign in to comment.