src/main/java/com/hedera/hashgraph/identity/hcs/did/HcsDidRootKey.java
/**
   * Creates a {@link HcsDidRootKey} object from the given {@link HcsDid} DID and it's root public key.
   *
   * @param did        The {@link HcsDid} DID object.
   * @param didRootKey The public key from which the DID was derived.
   * @return The {@link HcsDidRootKey} object.
   */
Creates a  HcsDidRootKey object from the given  HcsDid DID and it's root public key.

@param did        The  HcsDid DID object.
@param didRootKey The public key from which the DID was derived.
@return The  HcsDidRootKey object.
Creates a HcsDidRootKey object from the given HcsDid DID and it ' s root public key . @param did The HcsDid DID object . @param didRootKey The public key from which the DID was derived . @return The HcsDidRootKey object .
public static HcsDidRootKey fromHcsIdentity(final HcsDid did, final PublicKey didRootKey) {
    if (did == null) {
      throw new IllegalArgumentException("DID cannot be null");
    }
    if (didRootKey == null) {
      throw new IllegalArgumentException("DID root key cannot be null");
    }
    if (!HcsDid.publicKeyToIdString(didRootKey).equals(did.getIdString())) {
      throw new IllegalArgumentException("The specified DID does not correspond to the given DID root key");
    }
    String controller = did.toDid();
    String id = controller + DID_ROOT_KEY_NAME;
    String publicKeyBase58 = Base58.encode(didRootKey.toBytes());
    return new HcsDidRootKey(
            id, DID_ROOT_KEY_TYPE, controller, publicKeyBase58
    );
  }
public static HcsDidRootKey fromHcsIdentity ( final HcsDid did , final PublicKey didRootKey ) { if ( did == null ) { throw new IllegalArgumentException ( "DID cannot be null" ) ; } if ( didRootKey == null ) { throw new IllegalArgumentException ( "DID root key cannot be null" ) ; } if ( ! HcsDid . publicKeyToIdString ( didRootKey ) . equals ( did . getIdString ( ) ) ) { throw new IllegalArgumentException ( "The specified DID does not correspond to the given DID root key" ) ; } String controller = did . toDid ( ) ; String id = controller + DID_ROOT_KEY_NAME ; String publicKeyBase58 = Base58 . encode ( didRootKey . toBytes ( ) ) ; return new HcsDidRootKey ( id , DID_ROOT_KEY_TYPE , controller , publicKeyBase58 ) ; }
Creates a {@link HcsDidRootKey} object from the given {@link HcsDid} DID and it's root public key.
Creates a { @link HcsDidRootKey } object from the given { @link HcsDid } DID and it ' s root public key .
// Validate if hcsIdentity is derived from the given root key
