mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-02 06:33:38 +01:00
Centralize username logic in UsernameRepository.
This commit is contained in:
committed by
Cody Henthorne
parent
0f4f87067e
commit
e5ab5241d5
@@ -84,7 +84,6 @@ import org.whispersystems.signalservice.internal.websocket.DefaultResponseMapper
|
||||
import org.signal.core.util.Base64;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
@@ -761,8 +760,8 @@ public class SignalServiceAccountManager {
|
||||
}
|
||||
}
|
||||
|
||||
public ACI getAciByUsernameHash(String usernameHash) throws IOException {
|
||||
return this.pushServiceSocket.getAciByUsernameHash(usernameHash);
|
||||
public ACI getAciByUsername(Username username) throws IOException {
|
||||
return this.pushServiceSocket.getAciByUsernameHash(Base64.encodeUrlSafeWithoutPadding(username.getHash()));
|
||||
}
|
||||
|
||||
public ReserveUsernameResponse reserveUsername(List<String> usernameHashes) throws IOException {
|
||||
|
||||
@@ -1068,7 +1068,7 @@ public class PushServiceSocket {
|
||||
byte[] randomness = new byte[32];
|
||||
random.nextBytes(randomness);
|
||||
|
||||
byte[] proof = Username.generateProof(username, randomness);
|
||||
byte[] proof = new Username(username).generateProofWithRandomness(randomness);
|
||||
ConfirmUsernameRequest confirmUsernameRequest = new ConfirmUsernameRequest(reserveUsernameResponse.getUsernameHash(),
|
||||
Base64.encodeUrlSafeWithoutPadding(proof));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user