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


Java SignalProtocolAddress.getDeviceId方法代码示例

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


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

示例1: encrypt

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
public OutgoingPushMessage encrypt(SignalProtocolAddress destination, byte[] unpaddedMessage, boolean legacy, boolean silent) {
  SessionCipher        sessionCipher        = new SessionCipher(signalProtocolStore, destination);
  PushTransportDetails transportDetails     = new PushTransportDetails(sessionCipher.getSessionVersion());
  CiphertextMessage    message              = sessionCipher.encrypt(transportDetails.getPaddedMessageBody(unpaddedMessage));
  int                  remoteRegistrationId = sessionCipher.getRemoteRegistrationId();
  String               body                 = Base64.encodeBytes(message.serialize());

  int type;

  switch (message.getType()) {
    case CiphertextMessage.PREKEY_TYPE:  type = Type.PREKEY_BUNDLE_VALUE; break;
    case CiphertextMessage.WHISPER_TYPE: type = Type.CIPHERTEXT_VALUE;    break;
    default: throw new AssertionError("Bad type: " + message.getType());
  }

  return new OutgoingPushMessage(type, destination.getDeviceId(), remoteRegistrationId,
                                 legacy ? body : null, legacy ? null : body, silent);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-lib,代码行数:19,代码来源:SignalServiceCipher.java

示例2: archiveSiblingSessions

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
public static void archiveSiblingSessions(Context context, SignalProtocolAddress address) {
  SessionStore  sessionStore = new TextSecureSessionStore(context);
  List<Integer> devices      = sessionStore.getSubDeviceSessions(address.getName());
  devices.add(1);

  for (int device : devices) {
    if (device != address.getDeviceId()) {
      SignalProtocolAddress sibling = new SignalProtocolAddress(address.getName(), device);

      if (sessionStore.containsSession(sibling)) {
        SessionRecord sessionRecord = sessionStore.loadSession(sibling);
        sessionRecord.archiveCurrentState();
        sessionStore.storeSession(sibling, sessionRecord);
      }
    }
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:18,代码来源:SessionUtil.java

示例3: getSessionName

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
private String getSessionName(SignalProtocolAddress axolotlAddress) {
  Recipient recipient   = RecipientFactory.getRecipientsFromString(context, axolotlAddress.getName(), true)
                                        .getPrimaryRecipient();
  long      recipientId = recipient.getRecipientId();
  int       deviceId    = axolotlAddress.getDeviceId();

  return recipientId + (deviceId == SignalServiceAddress.DEFAULT_DEVICE_ID ? "" : "." + deviceId);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:9,代码来源:TextSecureSessionStore.java

示例4: getSubDeviceSessions

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
@Override
@JsonIgnore
public List<Integer> getSubDeviceSessions(String name) {
	List<Integer> ids = new ArrayList<Integer>();
	for(Entry<SignalProtocolAddress, SessionRecord> entry : getSessions()) {
		SignalProtocolAddress address = entry.getKey();
		if(address.getName().equals(name) && 
				address.getDeviceId() != SignalServiceAddress.DEFAULT_DEVICE_ID) {
			ids.add(address.getDeviceId());
		}
	}
	return ids;
}
 
开发者ID:Turakar,项目名称:signal4j,代码行数:14,代码来源:SignalStore.java

示例5: getSubDeviceSessions

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
@Override
public synchronized List<Integer> getSubDeviceSessions(String name) {
    List<Integer> deviceIds = new LinkedList<>();

    for (SignalProtocolAddress key : sessions.keySet()) {
        if (key.getName().equals(name) &&
                key.getDeviceId() != 1) {
            deviceIds.add(key.getDeviceId());
        }
    }

    return deviceIds;
}
 
开发者ID:AsamK,项目名称:signal-cli,代码行数:14,代码来源:JsonSessionStore.java

示例6: getSessionName

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
private String getSessionName(SignalProtocolAddress axolotlAddress) {
  Recipient recipient   = RecipientFactory.getRecipientsFromString(context, axolotlAddress.getName(), true)
                                        .getPrimaryRecipient();
  long      recipientId = recipient.getRecipientId();
  int       deviceId    = axolotlAddress.getDeviceId();

  return recipientId + (deviceId == 1 ? "" : "." + deviceId);
}
 
开发者ID:SilenceIM,项目名称:Silence,代码行数:9,代码来源:SilenceSessionStore.java

示例7: getSubDeviceSessions

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
@Override
public synchronized List<Integer> getSubDeviceSessions(String name) {
  List<Integer> deviceIds = new LinkedList<>();

  for (SignalProtocolAddress key : sessions.keySet()) {
    if (key.getName().equals(name) &&
        key.getDeviceId() != 1)
    {
      deviceIds.add(key.getDeviceId());
    }
  }

  return deviceIds;
}
 
开发者ID:signalapp,项目名称:libsignal-protocol-java,代码行数:15,代码来源:InMemorySessionStore.java

示例8: setSignalProtocolAddress

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
public SignalIdentity setSignalProtocolAddress(final SignalProtocolAddress address) {
    this.name = address.getName();
    this.deviceId = address.getDeviceId();
    this.id = this.name + String.valueOf(this.deviceId);
    return this;
}
 
开发者ID:toshiapp,项目名称:toshi-android-client,代码行数:7,代码来源:SignalIdentity.java

示例9: getSessionName

import org.whispersystems.libsignal.SignalProtocolAddress; //导入方法依赖的package包/类
private String getSessionName(final SignalProtocolAddress address) {
    final String recipientId = address.getName();
    final int deviceId = address.getDeviceId();

    return recipientId + (deviceId == SignalServiceAddress.DEFAULT_DEVICE_ID ? "" : "." + deviceId);
}
 
开发者ID:toshiapp,项目名称:toshi-android-client,代码行数:7,代码来源:SignalSessionStore.java


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