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


Java SignalServiceEnvelope.isSignalMessage方法代码示例

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


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

示例1: handle

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入方法依赖的package包/类
public void handle(SignalServiceEnvelope envelope, boolean sendExplicitReceipt) {
  if (!isActiveNumber(context, envelope.getSource())) {
    TextSecureDirectory directory           = TextSecureDirectory.getInstance(context);
    ContactTokenDetails contactTokenDetails = new ContactTokenDetails();
    contactTokenDetails.setNumber(envelope.getSource());

    directory.setNumber(contactTokenDetails, true);

    Recipients recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false);
    ApplicationContext.getInstance(context).getJobManager().add(new DirectoryRefreshJob(context, KeyCachingService.getMasterSecret(context), recipients));
  }

  if (envelope.isReceipt()) {
    handleReceipt(envelope);
  } else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage()) {
    handleMessage(envelope, sendExplicitReceipt);
  } else {
    Log.w(TAG, "Received envelope of unknown type: " + envelope.getType());
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:21,代码来源:PushReceivedJob.java

示例2: decrypt

import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; //导入方法依赖的package包/类
private byte[] decrypt(SignalServiceEnvelope envelope, byte[] ciphertext)
    throws InvalidVersionException, InvalidMessageException, InvalidKeyException,
           DuplicateMessageException, InvalidKeyIdException, UntrustedIdentityException,
           LegacyMessageException, NoSessionException
{
  SignalProtocolAddress sourceAddress = new SignalProtocolAddress(envelope.getSource(), envelope.getSourceDevice());
  SessionCipher         sessionCipher = new SessionCipher(signalProtocolStore, sourceAddress);

  byte[] paddedMessage;

  if (envelope.isPreKeySignalMessage()) {
    paddedMessage = sessionCipher.decrypt(new PreKeySignalMessage(ciphertext));
  } else if (envelope.isSignalMessage()) {
    paddedMessage = sessionCipher.decrypt(new SignalMessage(ciphertext));
  } else {
    throw new InvalidMessageException("Unknown type: " + envelope.getType());
  }

  PushTransportDetails transportDetails = new PushTransportDetails(sessionCipher.getSessionVersion());
  return transportDetails.getStrippedPaddingMessageBody(paddedMessage);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:22,代码来源:SignalServiceCipher.java


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