Handle presenting KBS account locked cases.

This commit is contained in:
Alan Evans
2020-02-03 11:38:27 -05:00
committed by Greyson Parrelli
parent e14861d79d
commit 40383f3733
10 changed files with 62 additions and 47 deletions

View File

@@ -124,7 +124,7 @@ public final class KeyBackupService {
@Override
public RegistrationLockData restorePin(HashedPin hashedPin)
throws UnauthenticatedResponseException, IOException, KeyBackupServicePinException
throws UnauthenticatedResponseException, IOException, KeyBackupServicePinException, KeyBackupSystemNoDataException
{
int attempt = 0;
SecureRandom random = new SecureRandom();
@@ -157,7 +157,7 @@ public final class KeyBackupService {
}
private RegistrationLockData restorePin(HashedPin hashedPin, TokenResponse token)
throws UnauthenticatedResponseException, IOException, TokenException
throws UnauthenticatedResponseException, IOException, TokenException, KeyBackupSystemNoDataException
{
try {
final int remainingTries = token.getTries();
@@ -190,14 +190,15 @@ public final class KeyBackupService {
throw new TokenException(nextToken, canRetry);
case MISSING:
Log.i(TAG, "Restore OK! No data though");
return null;
throw new KeyBackupSystemNoDataException();
case NOT_YET_VALID:
throw new UnauthenticatedResponseException("Key is not valid yet, clock mismatch");
default:
throw new AssertionError("Unexpected case");
}
} catch (InvalidCiphertextException e) {
throw new UnauthenticatedResponseException(e);
}
return null;
}
private RemoteAttestation getAndVerifyRemoteAttestation() throws UnauthenticatedResponseException, IOException {
@@ -277,7 +278,7 @@ public final class KeyBackupService {
public interface RestoreSession extends HashSession {
RegistrationLockData restorePin(HashedPin hashedPin)
throws UnauthenticatedResponseException, IOException, KeyBackupServicePinException;
throws UnauthenticatedResponseException, IOException, KeyBackupServicePinException, KeyBackupSystemNoDataException;
}
public interface PinChangeSession extends HashSession {

View File

@@ -0,0 +1,7 @@
package org.whispersystems.signalservice.api;
public final class KeyBackupSystemNoDataException extends Exception {
KeyBackupSystemNoDataException() {
}
}