Search in sources :

Example 1 with SignedPreKeyEntity

use of org.whispersystems.signalservice.api.push.SignedPreKeyEntity in project Signal-Android by WhisperSystems.

the class PushServiceSocket method registerPreKeys.

public void registerPreKeys(ServiceIdType serviceIdType, IdentityKey identityKey, SignedPreKeyRecord signedPreKey, List<PreKeyRecord> records) throws IOException {
    List<PreKeyEntity> entities = new LinkedList<>();
    for (PreKeyRecord record : records) {
        PreKeyEntity entity = new PreKeyEntity(record.getId(), record.getKeyPair().getPublicKey());
        entities.add(entity);
    }
    SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(signedPreKey.getId(), signedPreKey.getKeyPair().getPublicKey(), signedPreKey.getSignature());
    makeServiceRequest(String.format(Locale.US, PREKEY_PATH, "", serviceIdType.queryParam()), "PUT", JsonUtil.toJson(new PreKeyState(entities, signedPreKeyEntity, identityKey)));
}
Also used : SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) PreKeyRecord(org.whispersystems.libsignal.state.PreKeyRecord) SignedPreKeyRecord(org.whispersystems.libsignal.state.SignedPreKeyRecord) LinkedList(java.util.LinkedList)

Example 2 with SignedPreKeyEntity

use of org.whispersystems.signalservice.api.push.SignedPreKeyEntity in project Signal-Android by WhisperSystems.

the class PushServiceSocket method setCurrentSignedPreKey.

public void setCurrentSignedPreKey(ServiceIdType serviceIdType, SignedPreKeyRecord signedPreKey) throws IOException {
    String path = String.format(SIGNED_PREKEY_PATH, serviceIdType.queryParam());
    SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(signedPreKey.getId(), signedPreKey.getKeyPair().getPublicKey(), signedPreKey.getSignature());
    makeServiceRequest(path, "PUT", JsonUtil.toJson(signedPreKeyEntity));
}
Also used : SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) GroupsV2AuthorizationString(org.whispersystems.signalservice.api.groupsv2.GroupsV2AuthorizationString)

Example 3 with SignedPreKeyEntity

use of org.whispersystems.signalservice.api.push.SignedPreKeyEntity in project libsignal-service-java by signalapp.

the class PushServiceSocket method registerPreKeys.

public void registerPreKeys(IdentityKey identityKey, SignedPreKeyRecord signedPreKey, List<PreKeyRecord> records) throws IOException {
    List<PreKeyEntity> entities = new LinkedList<>();
    for (PreKeyRecord record : records) {
        PreKeyEntity entity = new PreKeyEntity(record.getId(), record.getKeyPair().getPublicKey());
        entities.add(entity);
    }
    SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(signedPreKey.getId(), signedPreKey.getKeyPair().getPublicKey(), signedPreKey.getSignature());
    makeServiceRequest(String.format(PREKEY_PATH, ""), "PUT", JsonUtil.toJson(new PreKeyState(entities, signedPreKeyEntity, identityKey)));
}
Also used : SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) SignedPreKeyRecord(org.whispersystems.libsignal.state.SignedPreKeyRecord) PreKeyRecord(org.whispersystems.libsignal.state.PreKeyRecord) LinkedList(java.util.LinkedList)

Example 4 with SignedPreKeyEntity

use of org.whispersystems.signalservice.api.push.SignedPreKeyEntity in project libsignal-service-java by signalapp.

the class PushServiceSocket method setCurrentSignedPreKey.

public void setCurrentSignedPreKey(SignedPreKeyRecord signedPreKey) throws IOException {
    SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(signedPreKey.getId(), signedPreKey.getKeyPair().getPublicKey(), signedPreKey.getSignature());
    makeServiceRequest(SIGNED_PREKEY_PATH, "PUT", JsonUtil.toJson(signedPreKeyEntity));
}
Also used : SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity)

Example 5 with SignedPreKeyEntity

use of org.whispersystems.signalservice.api.push.SignedPreKeyEntity in project Signal-Android by signalapp.

the class PushServiceSocket method setCurrentSignedPreKey.

public void setCurrentSignedPreKey(ServiceIdType serviceIdType, SignedPreKeyRecord signedPreKey) throws IOException {
    String path = String.format(SIGNED_PREKEY_PATH, serviceIdType.queryParam());
    SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(signedPreKey.getId(), signedPreKey.getKeyPair().getPublicKey(), signedPreKey.getSignature());
    makeServiceRequest(path, "PUT", JsonUtil.toJson(signedPreKeyEntity));
}
Also used : SignedPreKeyEntity(org.whispersystems.signalservice.api.push.SignedPreKeyEntity) GroupsV2AuthorizationString(org.whispersystems.signalservice.api.groupsv2.GroupsV2AuthorizationString)

Aggregations

SignedPreKeyEntity (org.whispersystems.signalservice.api.push.SignedPreKeyEntity)7 LinkedList (java.util.LinkedList)4 PreKeyRecord (org.whispersystems.libsignal.state.PreKeyRecord)4 SignedPreKeyRecord (org.whispersystems.libsignal.state.SignedPreKeyRecord)4 GroupsV2AuthorizationString (org.whispersystems.signalservice.api.groupsv2.GroupsV2AuthorizationString)2 SignalBootstrap (com.toshi.crypto.signal.model.SignalBootstrap)1 PreKeyEntity (org.whispersystems.signalservice.internal.push.PreKeyEntity)1