Skip to content

Commit

Permalink
Supress linter errors (best practices are here...)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fi5t committed Jul 28, 2022
1 parent 26b79b9 commit 1a36e89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pinkman/src/main/java/com/redmadrobot/pinkman/Pinkman.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class Pinkman(
File(applicationContext.filesDir, storageName)
}

@Suppress("CommentSpacing", "ForbiddenComment", "MagicNumber")
private val keySpec =
KeyGenParameterSpec.Builder(KEYSTORE_ALIAS, PURPOSE_ENCRYPT or PURPOSE_DECRYPT)
.setBlockModes(BLOCK_MODE_GCM)
.setEncryptionPaddings(ENCRYPTION_PADDING_NONE)
.setKeySize(KEY_SIZE)
.apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
//FIXME: Dirty workaround. Waiting for a fix https://issuetracker.google.com/issues/191391068?pli=1
// FIXME: Dirty workaround. Waiting for a fix https://issuetracker.google.com/issues/191391068?pli=1
val isDeviceSecure = if (Build.VERSION.SDK_INT == 31) {
false
} else {
Expand All @@ -57,6 +58,7 @@ class Pinkman(
}
}.build()

@Suppress("TooGenericExceptionCaught", "SwallowedException", "CommentSpacing", "MaxLineLength", "ForbiddenComment")
private val encryptedStorage by lazy {
try {
EncryptedFile.Builder(
Expand All @@ -66,7 +68,7 @@ class Pinkman(
EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB
).setKeysetAlias(KEYSET_ALIAS).setKeysetPrefName(PREFERENCE_FILE).build()
} catch (e: Exception) {
//FIXME: Dirty workaround. Waiting for a fix https://issuetracker.google.com/issues/191391068?pli=1
// FIXME: Dirty workaround. Waiting for a fix https://issuetracker.google.com/issues/191391068?pli=1
throw CorruptedStorageException("Pinkman storage was corrupted. Please, remove existing PIN and create it again.")
}
}
Expand Down

0 comments on commit 1a36e89

Please sign in to comment.