示例#1
0
  private boolean securityDomainCheck(
      Number320 key, PublicKey publicKey, PublicKey newPublicKey, boolean domainProtection) {

    boolean domainProtectedByOthers = backend.isDomainProtectedByOthers(key, publicKey);
    // I dont want to claim the domain
    if (!domainProtection) {
      LOG.debug("no domain protection requested {} for domain {}", Utils.hash(newPublicKey), key);
      // returns true if the domain is not protected by others, otherwise
      // false if the domain is protected
      return !domainProtectedByOthers;
    } else {
      LOG.debug("domain protection requested {} for domain {}", Utils.hash(newPublicKey), key);
      if (canClaimDomain(key, publicKey)) {
        if (canProtectDomain(key.domainKey(), publicKey)) {
          LOG.debug("set domain protection");
          return backend.protectDomain(key, newPublicKey);
        } else {
          return true;
        }
      }
    }
    return false;
  }
示例#2
0
 private boolean canClaimDomain(Number320 key, PublicKey publicKey) {
   boolean domainProtectedByOthers = backend.isDomainProtectedByOthers(key, publicKey);
   boolean domainOverridableByMe = foreceOverrideDomain(key.domainKey(), publicKey);
   return !domainProtectedByOthers || domainOverridableByMe;
 }