This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Dinorah Tovar on 04/04/18. | |
* Secondary helper interceptor to skip interceptor headers over Data Module | |
*/ | |
class SupportInterceptor: Interceptor, Authenticator { | |
/** | |
* Interceptor class for setting of the headers for every request | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom EditText that paints a bottom line and the text or | |
* a filled circle if it is a password | |
*/ | |
class PinEntryEditText : AppCompatEditText { | |
private var mSpace = 24f //24 dp by default, space between the lines | |
private var mNumChars = 4f | |
private var mLineSpacing = 8f //8dp by default, height of the text from our lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Release Candidate option | |
val keyGenParameterSpec = MasterKeys.AES256_GCM_SPEC | |
val masterKeyAlias = MasterKeys.getOrCreate(keyGenParameterSpec) | |
// Alpha option | |
val masterKeyAvailable = MasterKey | |
.Builder(application.applicationContext) | |
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM) | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val spec = KeyGenParameterSpec.Builder( | |
KEY_NAME, | |
KeyProperties.PURPOSE_ENCRYPT or | |
KeyProperties.PURPOSE_DECRYPT | |
).apply { | |
setBlockModes(KeyProperties.BLOCK_MODE_CBC) | |
setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7) | |
setUserAuthenticationRequired(true) | |
setUserAuthenticationValidityDurationSeconds(TIMEOUT_SECONDS) | |
setRandomizedEncryptionRequired(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_RSA, "AndroidKeyStore").apply { | |
val certBuilder = KeyGenParameterSpec.Builder(alias, KeyProperties.PURPOSE_ENCRYPT) | |
.setKeyValidityStart(keyValidityStart) | |
.setKeyValidityEnd(keyValidityEnd) | |
.setCertificateSerialNumber(BigInteger.valueOf(1L)) | |
.setCertificateSubject(X500Principal("CN=MyCompany")) | |
.setUserAuthenticationRequired(true) | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | |
initialize( | |
certBuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val biometricPromptBuilder = BiometricPrompt.PromptInfo.Builder() | |
.setTitle("A nice title") | |
.setSubtitle("A nicer subtitle") | |
.setNegativeButtonText("Cancel") | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
biometricPrompt.authenticate(promptInfo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var biometricPrompt = BiometricPrompt(this, executor, object : BiometricPrompt.AuthenticationCallback() { | |
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) { | |
super.onAuthenticationError(errorCode, errString) | |
// Error | |
} | |
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) { | |
super.onAuthenticationSucceeded(result) | |
// Success | |
} |
NewerOlder