当前位置: 首页>>代码示例>>Java>>正文


Java SignedPreKeyRecord.getId方法代码示例

本文整理汇总了Java中org.whispersystems.libsignal.state.SignedPreKeyRecord.getId方法的典型用法代码示例。如果您正苦于以下问题:Java SignedPreKeyRecord.getId方法的具体用法?Java SignedPreKeyRecord.getId怎么用?Java SignedPreKeyRecord.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.whispersystems.libsignal.state.SignedPreKeyRecord的用法示例。


在下文中一共展示了SignedPreKeyRecord.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerPreKeys

import org.whispersystems.libsignal.state.SignedPreKeyRecord; //导入方法依赖的package包/类
public void registerPreKeys(IdentityKey identityKey,
                            PreKeyRecord lastResortKey,
                            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);
  }

  PreKeyEntity lastResortEntity = new PreKeyEntity(lastResortKey.getId(),
                                                   lastResortKey.getKeyPair().getPublicKey());

  SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(signedPreKey.getId(),
                                                                 signedPreKey.getKeyPair().getPublicKey(),
                                                                 signedPreKey.getSignature());

  makeRequest(String.format(PREKEY_PATH, ""), "PUT",
              JsonUtil.toJson(new PreKeyState(entities, lastResortEntity,
                                              signedPreKeyEntity, identityKey)));
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:27,代码来源:PushServiceSocket.java

示例2: removeRecordFrom

import org.whispersystems.libsignal.state.SignedPreKeyRecord; //导入方法依赖的package包/类
private LinkedList<SignedPreKeyRecord> removeRecordFrom(SignedPreKeyRecord currentRecord,
                                                        List<SignedPreKeyRecord> records)

{
  LinkedList<SignedPreKeyRecord> others = new LinkedList<>();

  for (SignedPreKeyRecord record : records) {
    if (record.getId() != currentRecord.getId()) {
      others.add(record);
    }
  }

  return others;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:15,代码来源:CleanPreKeysJob.java

示例3: setCurrentSignedPreKey

import org.whispersystems.libsignal.state.SignedPreKeyRecord; //导入方法依赖的package包/类
public void setCurrentSignedPreKey(SignedPreKeyRecord signedPreKey) throws IOException {
  SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(signedPreKey.getId(),
                                                                 signedPreKey.getKeyPair().getPublicKey(),
                                                                 signedPreKey.getSignature());
  makeRequest(SIGNED_PREKEY_PATH, "PUT", JsonUtil.toJson(signedPreKeyEntity));
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:7,代码来源:PushServiceSocket.java

示例4: registerKeysWithTimestamp

import org.whispersystems.libsignal.state.SignedPreKeyRecord; //导入方法依赖的package包/类
private Completable registerKeysWithTimestamp(
        final long timestamp,
        final IdentityKey identityKey,
        final PreKeyRecord lastResortKey,
        final String password,
        final int registrationId,
        final String signalingKey,
        final SignedPreKeyRecord signedPreKey,
        final List<PreKeyRecord> preKeys) {

    final long startTime = System.currentTimeMillis();

    final List<PreKeyEntity> entities = new LinkedList<>();
    for (PreKeyRecord preKey : preKeys) {
        final PreKeyEntity entity = new PreKeyEntity(
                preKey.getId(),
                preKey.getKeyPair().getPublicKey());
        entities.add(entity);
    }

    final PreKeyEntity lastResortEntity = new PreKeyEntity(
            lastResortKey.getId(),
            lastResortKey.getKeyPair().getPublicKey());

    final SignedPreKeyEntity signedPreKeyEntity = new SignedPreKeyEntity(
            signedPreKey.getId(),
            signedPreKey.getKeyPair().getPublicKey(),
            signedPreKey.getSignature());

    final long endTime = System.currentTimeMillis();
    final long elapsedSeconds = (endTime - startTime) / 1000;
    final long amendedTimestamp = timestamp + elapsedSeconds;

    final SignalBootstrap payload = new SignalBootstrap(
            entities,
            lastResortEntity,
            password,
            registrationId,
            signalingKey,
            signedPreKeyEntity,
            identityKey);

    final String payloadForSigning = JsonUtil.toJson(payload);

    return this.chatInterface
            .register(payloadForSigning, amendedTimestamp)
            .observeOn(Schedulers.io())
            .subscribeOn(Schedulers.io())
            .toCompletable();
}
 
开发者ID:toshiapp,项目名称:toshi-android-client,代码行数:51,代码来源:ChatService.java


注:本文中的org.whispersystems.libsignal.state.SignedPreKeyRecord.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。