All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.whispersystems.signalservice.internal.push.RegistrationSessionMetadataResponse.kt Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
package org.whispersystems.signalservice.internal.push

import com.fasterxml.jackson.annotation.JsonProperty

/**
 * This is a parsed, POJO representation of the server response describing the state of the registration session.
 * The useful headers and the request body are wrapped in a single holder class.
 */
data class RegistrationSessionMetadataResponse(
  val headers: RegistrationSessionMetadataHeaders,
  val body: RegistrationSessionMetadataJson,
  val state: RegistrationSessionState?
)

data class RegistrationSessionMetadataHeaders(
  val timestamp: Long
)

data class RegistrationSessionMetadataJson(
  @JsonProperty("id") val id: String,
  @JsonProperty("nextSms") val nextSms: Int?,
  @JsonProperty("nextCall") val nextCall: Int?,
  @JsonProperty("nextVerificationAttempt") val nextVerificationAttempt: Int?,
  @JsonProperty("allowedToRequestCode") val allowedToRequestCode: Boolean,
  @JsonProperty("requestedInformation") val requestedInformation: List,
  @JsonProperty("verified") val verified: Boolean
) {
  fun pushChallengedRequired(): Boolean {
    return requestedInformation.contains("pushChallenge")
  }

  fun captchaRequired(): Boolean {
    return requestedInformation.contains("captcha")
  }
}

data class RegistrationSessionState(
  var pushChallengeTimedOut: Boolean
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy