45
45
import com .pokegoapi .exceptions .CaptchaActiveException ;
46
46
import com .pokegoapi .exceptions .LoginFailedException ;
47
47
import com .pokegoapi .exceptions .RemoteServerException ;
48
+ import com .pokegoapi .exceptions .hash .HashException ;
48
49
import com .pokegoapi .main .AsyncServerRequest ;
49
50
import com .pokegoapi .main .CommonRequests ;
50
51
import com .pokegoapi .main .Heartbeat ;
56
57
import com .pokegoapi .util .SystemTimeImpl ;
57
58
import com .pokegoapi .util .Time ;
58
59
import com .pokegoapi .util .hash .HashProvider ;
59
- import lombok .Getter ;
60
60
import lombok .Setter ;
61
+ import lombok .Getter ;
61
62
import okhttp3 .OkHttpClient ;
62
63
63
64
import java .io .IOException ;
@@ -196,7 +197,7 @@ public PokemonGo(OkHttpClient client) {
196
197
* @throws CaptchaActiveException if a captcha is active and the message can't be sent
197
198
*/
198
199
public void login (CredentialProvider credentialProvider , HashProvider hashProvider )
199
- throws LoginFailedException , CaptchaActiveException , RemoteServerException {
200
+ throws LoginFailedException , CaptchaActiveException , RemoteServerException , HashException {
200
201
this .loggingIn = true ;
201
202
if (credentialProvider == null ) {
202
203
throw new NullPointerException ("Credential Provider can not be null!" );
@@ -214,7 +215,8 @@ public void login(CredentialProvider credentialProvider, HashProvider hashProvid
214
215
initialize ();
215
216
}
216
217
217
- private void initialize () throws RemoteServerException , CaptchaActiveException , LoginFailedException {
218
+ private void initialize () throws RemoteServerException , CaptchaActiveException , LoginFailedException ,
219
+ HashException {
218
220
playerProfile .updateProfile ();
219
221
220
222
ServerRequest downloadConfigRequest = new ServerRequest (RequestType .DOWNLOAD_REMOTE_CONFIG_VERSION ,
@@ -301,7 +303,7 @@ private void initialize() throws RemoteServerException, CaptchaActiveException,
301
303
* @throws CaptchaActiveException if a captcha is active and the message can't be sent
302
304
*/
303
305
private void fireRequestBlock (ServerRequest request , RequestType ... exclude )
304
- throws RemoteServerException , CaptchaActiveException , LoginFailedException {
306
+ throws RemoteServerException , CaptchaActiveException , LoginFailedException , HashException {
305
307
getRequestHandler ().sendServerRequests (request .withCommons ().exclude (exclude ));
306
308
try {
307
309
awaitChallenge ();
@@ -317,7 +319,8 @@ private void fireRequestBlock(ServerRequest request, RequestType... exclude)
317
319
* @throws RemoteServerException When server fails
318
320
* @throws CaptchaActiveException if a captcha is active and the message can't be sent
319
321
*/
320
- public void getAssetDigest () throws RemoteServerException , CaptchaActiveException , LoginFailedException {
322
+ public void getAssetDigest () throws RemoteServerException , CaptchaActiveException , LoginFailedException ,
323
+ HashException {
321
324
fireRequestBlock (new ServerRequest (RequestType .GET_ASSET_DIGEST ,
322
325
CommonRequests .getGetAssetDigestMessageRequest (this )).exclude (RequestType .GET_BUDDY_WALKED ));
323
326
}
@@ -564,9 +567,11 @@ public boolean hasChallenge() {
564
567
* @throws RemoteServerException when server fails
565
568
* @throws InvalidProtocolBufferException when the client receives an invalid message from the server
566
569
* @throws CaptchaActiveException if a captcha is active and the message can't be sent
570
+ * @throws HashException if there is a problem with the Hash key / Service
567
571
*/
568
572
public boolean verifyChallenge (String token )
569
- throws RemoteServerException , CaptchaActiveException , LoginFailedException , InvalidProtocolBufferException {
573
+ throws RemoteServerException , CaptchaActiveException , LoginFailedException ,
574
+ InvalidProtocolBufferException , HashException {
570
575
hasChallenge = false ;
571
576
VerifyChallengeMessage message = VerifyChallengeMessage .newBuilder ().setToken (token ).build ();
572
577
AsyncServerRequest request = new AsyncServerRequest (RequestType .VERIFY_CHALLENGE , message );
@@ -590,9 +595,11 @@ public boolean verifyChallenge(String token)
590
595
* @throws RemoteServerException when server fails
591
596
* @throws InvalidProtocolBufferException when the client receives an invalid message from the server
592
597
* @throws CaptchaActiveException if a captcha is active and the message can't be sent
598
+ * @throws HashException if there is a problem with the Hash key / Service
593
599
*/
594
600
public String checkChallenge ()
595
- throws RemoteServerException , CaptchaActiveException , LoginFailedException , InvalidProtocolBufferException {
601
+ throws RemoteServerException , CaptchaActiveException , LoginFailedException ,
602
+ InvalidProtocolBufferException , HashException {
596
603
CheckChallengeMessage message = CheckChallengeMessage .newBuilder ().build ();
597
604
AsyncServerRequest request = new AsyncServerRequest (RequestType .CHECK_CHALLENGE , message );
598
605
ByteString responseData =
0 commit comments