src/main/java/com/hedera/hashgraph/identity/hcs/did/HcsDidRootZkKey.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 byte array from which the DID was derived.
     * @return The {@link HcsDidRootZkKey} 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 byte array from which the DID was derived.
@return The  HcsDidRootZkKey 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 byte array from which the DID was derived . @return The HcsDidRootZkKey object .
public static HcsDidRootZkKey fromHcsIdentity(final HcsDid did, final String 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.getIdStringZk())) {
            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(ByteUtils.fromHexString(didRootKey));
        return new HcsDidRootZkKey(
                id, DID_ROOT_KEY_TYPE, controller, publicKeyBase58
        );
    }
public static HcsDidRootZkKey fromHcsIdentity ( final HcsDid did , final String 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 . getIdStringZk ( ) ) ) { 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 ( ByteUtils . fromHexString ( didRootKey ) ) ; return new HcsDidRootZkKey ( 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