mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Show a dialog if the DB key can't be decrypted due to a keystore error.
This commit is contained in:
@@ -4,6 +4,7 @@ import com.github.ajalt.clikt.core.UsageError
|
||||
import com.github.ajalt.clikt.output.TermUi.echo
|
||||
import com.github.ajalt.clikt.output.TermUi.prompt
|
||||
import org.briarproject.bramble.api.account.AccountManager
|
||||
import org.briarproject.bramble.api.crypto.DecryptionException
|
||||
import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator
|
||||
import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.QUITE_WEAK
|
||||
import org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH
|
||||
@@ -34,7 +35,9 @@ constructor(
|
||||
} else {
|
||||
val password = prompt("Password", hideInput = true)
|
||||
?: throw UsageError("Could not get password. Is STDIN connected?")
|
||||
if (!accountManager.signIn(password)) {
|
||||
try {
|
||||
accountManager.signIn(password)
|
||||
} catch (e : DecryptionException) {
|
||||
echo("Error: Password invalid")
|
||||
exitProcess(1)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.briar.headless
|
||||
|
||||
import org.briarproject.bramble.api.account.AccountManager
|
||||
import org.briarproject.bramble.api.crypto.DecryptionException
|
||||
import org.briarproject.bramble.api.lifecycle.LifecycleManager
|
||||
import javax.annotation.concurrent.Immutable
|
||||
import javax.inject.Inject
|
||||
@@ -23,7 +24,9 @@ constructor(
|
||||
accountManager.deleteAccount()
|
||||
}
|
||||
accountManager.createAccount(user, pass)
|
||||
if (!accountManager.signIn(pass)) {
|
||||
try {
|
||||
accountManager.signIn(pass)
|
||||
} catch (e: DecryptionException) {
|
||||
throw AssertionError("Password invalid")
|
||||
}
|
||||
val dbKey = accountManager.databaseKey ?: throw AssertionError()
|
||||
|
||||
Reference in New Issue
Block a user