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


Java IdentityKey.equals方法代码示例

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


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

示例1: isTrustedIdentity

import org.whispersystems.libsignal.IdentityKey; //导入方法依赖的package包/类
@Override
public boolean isTrustedIdentity(SignalProtocolAddress address, IdentityKey identityKey, Direction direction) {
  synchronized (LOCK) {
    IdentityDatabase identityDatabase = DatabaseFactory.getIdentityDatabase(context);
    long             recipientId      = RecipientFactory.getRecipientsFromString(context, address.getName(), true).getPrimaryRecipient().getRecipientId();
    String           ourNumber        = TextSecurePreferences.getLocalNumber(context);
    long             ourRecipientId   = RecipientFactory.getRecipientsFromString(context, ourNumber, true).getPrimaryRecipient().getRecipientId();

    if (ourRecipientId == recipientId || ourNumber.equals(address.getName())) {
      return identityKey.equals(IdentityKeyUtil.getIdentityKey(context));
    }

    switch (direction) {
      case SENDING:   return isTrustedForSending(identityKey, identityDatabase.getIdentity(recipientId));
      case RECEIVING: return true;
      default:        throw new AssertionError("Unknown direction: " + direction);
    }
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:20,代码来源:TextSecureIdentityKeyStore.java

示例2: isTrustedForSending

import org.whispersystems.libsignal.IdentityKey; //导入方法依赖的package包/类
private boolean isTrustedForSending(IdentityKey identityKey, Optional<IdentityRecord> identityRecord) {
  if (!identityRecord.isPresent()) {
    Log.w(TAG, "Nothing here, returning true...");
    return true;
  }

  if (!identityKey.equals(identityRecord.get().getIdentityKey())) {
    Log.w(TAG, "Identity keys don't match...");
    return false;
  }

  if (identityRecord.get().getVerifiedStatus() == VerifiedStatus.UNVERIFIED) {
    Log.w(TAG, "Needs unverified approval!");
    return false;
  }

  if (isNonBlockingApprovalRequired(identityRecord.get())) {
    Log.w(TAG, "Needs non-blocking approval!");
    return false;
  }

  return true;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:TextSecureIdentityKeyStore.java

示例3: saveIdentity

import org.whispersystems.libsignal.IdentityKey; //导入方法依赖的package包/类
@Override
public boolean saveIdentity(SignalProtocolAddress address, IdentityKey identityKey) {
  IdentityKey existing = trustedKeys.get(address);

  if (!identityKey.equals(existing)) {
    trustedKeys.put(address, identityKey);
    return true;
  } else {
    return false;
  }
}
 
开发者ID:signalapp,项目名称:libsignal-protocol-java,代码行数:12,代码来源:InMemoryIdentityKeyStore.java

示例4: isTrustedIdentity

import org.whispersystems.libsignal.IdentityKey; //导入方法依赖的package包/类
@Override
@JsonIgnore
public boolean isTrustedIdentity(String name, IdentityKey identityKey) {
	IdentityKey storedIdentity = getIdentity(name);
	return storedIdentity == null || identityKey.equals(storedIdentity);
}
 
开发者ID:Turakar,项目名称:signal4j,代码行数:7,代码来源:SignalStore.java

示例5: isTrustedIdentity

import org.whispersystems.libsignal.IdentityKey; //导入方法依赖的package包/类
public boolean isTrustedIdentity(String name, IdentityKey identityKey) {
	IdentityKey stored = getIdentityKey(name);
	return stored == null || identityKey.equals(stored);
}
 
开发者ID:Turakar,项目名称:Signal-JDesktop,代码行数:5,代码来源:DerbyIdentityStore.java

示例6: isTrustedIdentity

import org.whispersystems.libsignal.IdentityKey; //导入方法依赖的package包/类
@Override
public boolean isTrustedIdentity(SignalProtocolAddress address, IdentityKey identityKey, Direction direction) {
  IdentityKey trusted = trustedKeys.get(address);
  return (trusted == null || trusted.equals(identityKey));
}
 
开发者ID:signalapp,项目名称:libsignal-protocol-java,代码行数:6,代码来源:InMemoryIdentityKeyStore.java


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