mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-02 06:33:38 +01:00
Handle rate limits when rotating recovery key.
This commit is contained in:
@@ -392,6 +392,18 @@ class ArchiveApi(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the backup-id can currently be rotated
|
||||
*
|
||||
* GET /v1/archives/backupid/limits
|
||||
* - 200: Successfully retrieved backup-id rotation limits
|
||||
* - 403: Invalid account authentication
|
||||
*/
|
||||
fun getKeyRotationLimit(): NetworkResult<ArchiveKeyRotationLimitResponse> {
|
||||
val request = WebSocketRequestMessage.get("/v1/archives/backupid/limits")
|
||||
return NetworkResult.fromWebSocketRequest(authWebSocket, request, ArchiveKeyRotationLimitResponse::class)
|
||||
}
|
||||
|
||||
private fun getCredentialPresentation(aci: ACI, archiveServiceAccess: ArchiveServiceAccess<*>): NetworkResult<CredentialPresentationData> {
|
||||
return NetworkResult.fromLocal {
|
||||
val zkCredential = getZkCredential(aci, archiveServiceAccess)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.whispersystems.signalservice.api.archive
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
/**
|
||||
* Represents the response when fetching the archive backup key rotation limits
|
||||
*/
|
||||
data class ArchiveKeyRotationLimitResponse(
|
||||
@JsonProperty val hasPermitsRemaining: Boolean?,
|
||||
@JsonProperty val retryAfterSeconds: Long?
|
||||
)
|
||||
Reference in New Issue
Block a user