File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
app/src/main/kotlin/org/grakovne/lissen/persistence/preferences Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -636,22 +636,21 @@ class LissenSharedPreferences
636636 awaitClose { sharedPreferences.unregisterOnSharedPreferenceChangeListener(listener) }
637637 }.distinctUntilChanged()
638638
639- private fun decrypt (data : String ): String? {
640- val decodedData = Base64 .decode(data, Base64 .DEFAULT )
641- val iv = decodedData.sliceArray(0 until 12 )
642- val cipherText = decodedData.sliceArray(12 until decodedData.size)
639+ private fun decrypt (data : String ): String? =
640+ try {
641+ val decodedData = Base64 .decode(data, Base64 .DEFAULT )
642+ val iv = decodedData.sliceArray(0 until 12 )
643+ val cipherText = decodedData.sliceArray(12 until decodedData.size)
643644
644- val cipher = Cipher .getInstance(TRANSFORMATION )
645- val spec = GCMParameterSpec (128 , iv)
646- cipher.init (Cipher .DECRYPT_MODE , getSecretKey(), spec)
645+ val cipher = Cipher .getInstance(TRANSFORMATION )
646+ val spec = GCMParameterSpec (128 , iv)
647+ cipher.init (Cipher .DECRYPT_MODE , getSecretKey(), spec)
647648
648- return try {
649649 String (cipher.doFinal(cipherText))
650650 } catch (ex: Exception ) {
651651 crashReporter.recordException(ex)
652652 null
653653 }
654- }
655654
656655 companion object {
657656 private const val KEY_ALIAS = " secure_key_alias"
You can’t perform that action at this time.
0 commit comments