]>
nmode's Git Repositories - signal-cli/blob - lib/src/main/java/org/asamk/signal/manager/api/ProofRequiredException.java
1 package org
.asamk
.signal
.manager
.api
;
4 import java
.util
.stream
.Collectors
;
7 * Thrown when rate-limited by the server and proof of humanity is required to continue messaging.
9 public class ProofRequiredException
extends Exception
{
11 private final String token
;
12 private final Set
<Option
> options
;
13 private final long retryAfterSeconds
;
15 public ProofRequiredException(org
.whispersystems
.signalservice
.api
.push
.exceptions
.ProofRequiredException e
) {
16 this.token
= e
.getToken();
17 this.options
= e
.getOptions().stream().map(Option
::from
).collect(Collectors
.toSet());
18 this.retryAfterSeconds
= e
.getRetryAfterSeconds();
21 public String
getToken() {
25 public Set
<Option
> getOptions() {
29 public long getRetryAfterSeconds() {
30 return retryAfterSeconds
;
37 static Option
from(org
.whispersystems
.signalservice
.api
.push
.exceptions
.ProofRequiredException
.Option option
) {
38 return switch (option
) {
39 case RECAPTCHA
-> CAPTCHA
;
40 case CAPTCHA
-> CAPTCHA
;
41 case PUSH_CHALLENGE
-> PUSH_CHALLENGE
;