public Manager verifyAccount(
String verificationCode, String pin
- ) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
+ ) throws IOException, LockedException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
verificationCode = verificationCode.replace("-", "");
VerifyAccountResponse response;
MasterKey masterKey;
) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
var tokenResponse = keyBackupService.getToken(basicStorageCredentials);
if (tokenResponse == null || tokenResponse.getTries() == 0) {
- throw new IOException("KBS Account locked");
+ throw new IOException("KBS Account locked, maximum pin attempts reached.");
}
var registrationLockData = restoreMasterKey(pin, basicStorageCredentials, tokenResponse);
}
private static File getUserPath(final File dataPath, final String username) {
- return new File(dataPath, username + ".d");
+ final var path = new File(dataPath, username + ".d");
+ try {
+ IOUtils.createPrivateDirectories(path);
+ } catch (IOException e) {
+ throw new AssertionError("Failed to create user path", e);
+ }
+ return path;
}
private static File getMessageCachePath(File dataPath, String username) {
@Deprecated
public SignalServiceAddress resolveServiceAddress(SignalServiceAddress address) {
- return resolveServiceAddress(resolveRecipient(address, true));
+ return resolveServiceAddress(resolveRecipient(address, false));
}
public RecipientId resolveRecipient(UUID uuid) {
private void updateRecipientAddressLocked(
final RecipientId recipientId, final SignalServiceAddress address
) {
- final var nextRecipientId = nextIdLocked();
final var recipient = recipients.get(recipientId);
- storeRecipientLocked(nextRecipientId, Recipient.newBuilder(recipient).withAddress(address).build());
+ storeRecipientLocked(recipientId, Recipient.newBuilder(recipient).withAddress(address).build());
}
private void storeRecipientLocked(
}
private static Pair<String, String> splitName(String name) {
+ if (name == null) {
+ return new Pair<>(null, null);
+ }
String[] parts = name.split("\0");
switch (parts.length) {