Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions vault/src/main/java/com/altude/vault/storage/VaultStorage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ object VaultStorage {

// ── helpers ───────────────────────────────────────────────────────────────

private fun isKeyPermanentlyInvalidated(e: Exception): Boolean =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
e.javaClass.name == "android.security.keystore.KeyPermanentlyInvalidatedException"
private fun isKeyPermanentlyInvalidated(e: Exception): Boolean {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false
var cause: Throwable? = e
while (cause != null) {
if (cause.javaClass.name == "android.security.keystore.KeyPermanentlyInvalidatedException") return true
cause = cause.cause
}
return false
}

private fun isStaleKeyset(e: Exception): Boolean {
if (e is AEADBadTagException) return true
Expand Down