本文整理汇总了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);
}
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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));
}