mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-19 01:48:07 +01:00
Make VerificationSession.sessionId not-null
This commit is contained in:
@@ -254,7 +254,7 @@ public class VerificationController {
|
||||
// if a push challenge sent in `handlePushToken` doesn't arrive in time
|
||||
verificationSession.requestedInformation().add(VerificationSession.Information.CAPTCHA);
|
||||
|
||||
storeVerificationSession(registrationServiceSession, verificationSession);
|
||||
storeVerificationSession(verificationSession);
|
||||
|
||||
return buildResponse(registrationServiceSession, verificationSession);
|
||||
}
|
||||
@@ -327,22 +327,20 @@ public class VerificationController {
|
||||
} finally {
|
||||
// Each of the handle* methods may update requestedInformation, submittedInformation, and allowedToRequestCode,
|
||||
// and we want to be sure to store a changes, even if a later method throws
|
||||
updateStoredVerificationSession(registrationServiceSession, verificationSession);
|
||||
updateStoredVerificationSession(verificationSession);
|
||||
}
|
||||
|
||||
return buildResponse(registrationServiceSession, verificationSession);
|
||||
}
|
||||
|
||||
private void storeVerificationSession(final RegistrationServiceSession registrationServiceSession,
|
||||
final VerificationSession verificationSession) {
|
||||
verificationSessionManager.insert(registrationServiceSession.encodedSessionId(), verificationSession)
|
||||
private void storeVerificationSession(final VerificationSession verificationSession) {
|
||||
verificationSessionManager.insert(verificationSession)
|
||||
.orTimeout(DYNAMODB_TIMEOUT.toSeconds(), TimeUnit.SECONDS)
|
||||
.join();
|
||||
}
|
||||
|
||||
private void updateStoredVerificationSession(final RegistrationServiceSession registrationServiceSession,
|
||||
final VerificationSession verificationSession) {
|
||||
verificationSessionManager.update(registrationServiceSession.encodedSessionId(), verificationSession)
|
||||
private void updateStoredVerificationSession(final VerificationSession verificationSession) {
|
||||
verificationSessionManager.update(verificationSession)
|
||||
.orTimeout(DYNAMODB_TIMEOUT.toSeconds(), TimeUnit.SECONDS)
|
||||
.join();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.whispersystems.textsecuregcm.telephony.CarrierData;
|
||||
* requesting codes from Registration Service, in order to get a verified session to be provided to
|
||||
* {@link org.whispersystems.textsecuregcm.controllers.RegistrationController}.
|
||||
*
|
||||
* @param sessionId the session ID returned by Registration Service
|
||||
* @param pushChallenge the value of a push challenge sent to a client, after it submitted a push token
|
||||
* @param carrierData information about the phone number's carrier if available
|
||||
* @param requestedInformation information requested that a client send to the server
|
||||
@@ -36,7 +37,7 @@ import org.whispersystems.textsecuregcm.telephony.CarrierData;
|
||||
* @see org.whispersystems.textsecuregcm.entities.VerificationSessionResponse
|
||||
*/
|
||||
public record VerificationSession(
|
||||
@Nullable String sessionId,
|
||||
String sessionId,
|
||||
@Nullable String pushChallenge,
|
||||
@Nullable CarrierData carrierData,
|
||||
List<Information> requestedInformation,
|
||||
|
||||
@@ -17,12 +17,12 @@ public class VerificationSessionManager {
|
||||
this.verificationSessions = verificationSessions;
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> insert(final String encodedSessionId, final VerificationSession verificationSession) {
|
||||
return verificationSessions.insert(encodedSessionId, verificationSession);
|
||||
public CompletableFuture<Void> insert(final VerificationSession verificationSession) {
|
||||
return verificationSessions.insert(verificationSession.sessionId(), verificationSession);
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> update(final String encodedSessionId, final VerificationSession verificationSession) {
|
||||
return verificationSessions.update(encodedSessionId, verificationSession);
|
||||
public CompletableFuture<Void> update(final VerificationSession verificationSession) {
|
||||
return verificationSessions.update(verificationSession.sessionId(), verificationSession);
|
||||
}
|
||||
|
||||
public CompletableFuture<Optional<VerificationSession>> findForId(final String encodedSessionId) {
|
||||
|
||||
Reference in New Issue
Block a user