Open hanunggulmp opened 3 years ago
futhermore, here is my implementation code which already modified little bit according to the new version of signal-service-java version
public void finishConnectAsPrimary(String verificationCode) throws IOException {
if(accountManager == null) {
throw new IllegalStateException("Cannot finish: No connection started!");
} else if(isRegistered()) {
throw new IllegalStateException("Already registered!");
}
createRegistrationId();
byte[] signalingKey = new byte[52];
SecureRandom secureRandom = new SecureRandom();
secureRandom.nextBytes(signalingKey);
byte[] secret = new byte[32];
secureRandom.nextBytes(secret);
byte[] unidentifiedAccessKey = UnidentifiedAccess.deriveAccessKeyFrom(secret);
accountManager.verifyAccountWithCode(verificationCode, store.getSignalingKey(),
store.getLocalRegistrationId(), false, PIN, unidentifiedAccessKey, true);
IdentityKeyPair identityKeyPair = KeyHelper.generateIdentityKeyPair();
store.setIdentityKeyPair(identityKeyPair);
checkPreKeys(-1);
save();
}
I was tried to call in my main class
but this error occurs:
Exception in thread "main" org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException: Bad response: 400 at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:894) at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:791) at org.whispersystems.signalservice.internal.push.PushServiceSocket.verifyAccountCode(PushServiceSocket.java:223) at org.whispersystems.signalservice.api.SignalServiceAccountManager.verifyAccountWithCode(SignalServiceAccountManager.java:203)
any idea?
i'm using jdk 1.8