mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 02:48:03 +01:00
Preserve backup vouchers accross re-registration
This commit is contained in:
committed by
ravi-signal
parent
774cc52b61
commit
2af3088571
@@ -495,6 +495,10 @@ class AccountsTest {
|
||||
final UUID existingPni = UUID.randomUUID();
|
||||
final Account existingAccount = generateAccount(e164, existingUuid, existingPni, List.of(device));
|
||||
|
||||
// Backup vouchers should be carried over accross re-registration
|
||||
final Account.BackupVoucher bv = new Account.BackupVoucher(1, Instant.now().plus(Duration.ofDays(1)));
|
||||
existingAccount.setBackupVoucher(bv);
|
||||
|
||||
createAccount(existingAccount);
|
||||
|
||||
final byte[] usernameHash = TestRandomUtil.nextBytes(32);
|
||||
@@ -531,6 +535,8 @@ class AccountsTest {
|
||||
assertThat(result.getEncryptedUsername()).isEmpty();
|
||||
assertArrayEquals(result.getReservedUsernameHash().orElseThrow(), usernameHash);
|
||||
|
||||
assertThat(result.getBackupVoucher()).isEqualTo(bv);
|
||||
|
||||
// should keep the same usernameLink, now encryptedUsername should be set
|
||||
accounts.confirmUsernameHash(result, usernameHash, encryptedUsername).join();
|
||||
item = readAccount(existingUuid);
|
||||
|
||||
Reference in New Issue
Block a user