func RevokeAuthenticationKeyFromDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, identity register.RegisteredIdentity) error {
	return revokeKeyFromDocument(resolverClient, originalDoc, name, identity)
}
RevokeAuthenticationKeyFromDocument Set register authentication public key revoke field.
package advancedapi
import (
	"fmt"
	"time"
	"github.com/Iotic-Labs/iotics-identity-go/pkg/crypto"
	"github.com/Iotic-Labs/iotics-identity-go/pkg/identity"
	"github.com/Iotic-Labs/iotics-identity-go/pkg/proof"
	"github.com/Iotic-Labs/iotics-identity-go/pkg/register"
	"github.com/Iotic-Labs/iotics-identity-go/pkg/validation"
	"github.com/jbenet/go-base58"
)
func RegisterUpdatedDocument(resolverClient register.ResolverClient, doc *register.RegisterDocument, keypair *crypto.KeyPair, issuer *register.Issuer) error {
	return resolverClient.RegisterDocument(doc, keypair.PrivateKey, issuer)
}
func GetRegisterDocument(resolverClient register.ResolverClient, did string) (*register.RegisterDocument, error) {
	return resolverClient.GetDocument(did)
}
func CreateNewDocumentAndRegister(resolverClient register.ResolverClient, keyPair *crypto.KeyPair, purpose identity.DidType, name string, override bool) (*register.RegisterDocument, error) {
	registerDocument, issuer, err := CreateNewDocument(purpose, keyPair, name)
	if err != nil {
		return nil, err
	}
	if !override {
		getDoc, err := GetRegisterDocument(resolverClient, issuer.Did)
		if err != nil {
			rerr, ok := err.(*register.ResolverError)
			if ok && rerr.ErrorType() == register.NotFound {
			} else {
				return nil, err
			}
		}
		if getDoc != nil {
			return getDoc, nil
		}
	}
	err = RegisterUpdatedDocument(resolverClient, registerDocument, keyPair, issuer)
	if err != nil {
		return nil, err
	}
	return registerDocument, nil
}
func CreateNewIdentityAndRegister(resolverClient register.ResolverClient, purpose identity.DidType, keyPair *crypto.KeyPair, name string, override bool) (register.RegisteredIdentity, *register.RegisterDocument, error) {
	doc, err := CreateNewDocumentAndRegister(resolverClient, keyPair, purpose, name, override)
	if err != nil {
		return nil, nil, err
	}
	issuer, err := register.NewIssuer(doc.ID, doc.PublicKeys[0].ID)
	if err != nil {
		return nil, nil, err
	}
	regID := register.NewRegisteredIdentity(keyPair, issuer)
	return regID, doc, nil
}
func ValidateRegisterDocument(resolverClient register.ResolverClient, document *register.RegisterDocument) error {
	for _, v := range document.DelegateControl {
		err := register.ValidateDelegation(resolverClient, document.ID, &v)  
		if err != nil {
			return err
		}
	}
	for _, v := range document.DelegateAuthentication {
		err := register.ValidateDelegation(resolverClient, document.ID, &v)  
		if err != nil {
			return err
		}
	}
	return nil
}
func SetDocumentController(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, identity register.RegisteredIdentity, controller *register.Issuer) error {
	var err error
	if originalDoc == nil {
		originalDoc, err = GetRegisterDocument(resolverClient, identity.Did())
		if err != nil {
			return err
		}
	}
	opts := []register.RegisterDocumentOpts{
		register.AddFromExistingDocument(originalDoc),
		register.SetDocumentController(controller.Did),
	}
	updatedDoc, errs := register.NewRegisterDocument(opts)
	if len(errs) != 0 {
		return fmt.Errorf("error while creating new RegisterDocument: %v", errs)
	}
	return RegisterUpdatedDocument(resolverClient, updatedDoc, identity.KeyPair(), identity.Issuer())
}
func SetDocumentCreator(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, identity register.RegisteredIdentity, creator *register.Issuer) error {
	var err error
	if originalDoc == nil {
		originalDoc, err = GetRegisterDocument(resolverClient, identity.Did())
		if err != nil {
			return err
		}
	}
	opts := []register.RegisterDocumentOpts{
		register.AddFromExistingDocument(originalDoc),
		register.SetDocumentCreator(creator.Did),
	}
	updatedDoc, errs := register.NewRegisterDocument(opts)
	if len(errs) != 0 {
		return fmt.Errorf("error while creating new RegisterDocument: %v", errs)
	}
	return RegisterUpdatedDocument(resolverClient, updatedDoc, identity.KeyPair(), identity.Issuer())
}
func SetDocumentRevoked(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, identity register.RegisteredIdentity, revoked bool) error {
	var err error
	if originalDoc == nil {
		originalDoc, err = GetRegisterDocument(resolverClient, identity.Did())
		if err != nil {
			return err
		}
	}
	opts := []register.RegisterDocumentOpts{
		register.AddFromExistingDocument(originalDoc),
		register.SetDocumentRevoked(revoked),
	}
	updatedDoc, errs := register.NewRegisterDocument(opts)
	if len(errs) != 0 {
		return fmt.Errorf("error while creating new RegisterDocument: %v", errs)
	}
	return RegisterUpdatedDocument(resolverClient, updatedDoc, identity.KeyPair(), identity.Issuer())
}
func AddPublicKeyToDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, publicBase58 string, identity register.RegisteredIdentity) error {
	var err error
	if originalDoc == nil {
		originalDoc, err = GetRegisterDocument(resolverClient, identity.Did())
		if err != nil {
			return err
		}
	}
	opts := []register.RegisterDocumentOpts{
		register.AddFromExistingDocument(originalDoc),
		register.AddPublicKey(name, publicBase58, false),
	}
	updatedDoc, errs := register.NewRegisterDocument(opts)
	if len(errs) != 0 {
		return fmt.Errorf("error while creating new RegisterDocument: %v", errs)
	}
	return RegisterUpdatedDocument(resolverClient, updatedDoc, identity.KeyPair(), identity.Issuer())
}
func removeKeyFromDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, identity register.RegisteredIdentity) error {
	var err error
	if originalDoc == nil {
		originalDoc, err = GetRegisterDocument(resolverClient, identity.Did())
		if err != nil {
			return err
		}
	}
	opts := []register.RegisterDocumentOpts{
		register.AddFromExistingDocument(originalDoc),
		register.RemoveKey(name),
	}
	updatedDoc, errs := register.NewRegisterDocument(opts)
	if len(errs) != 0 {
		return fmt.Errorf("error while creating new RegisterDocument: %v", errs)
	}
	return RegisterUpdatedDocument(resolverClient, updatedDoc, identity.KeyPair(), identity.Issuer())
}
func revokeKeyFromDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, identity register.RegisteredIdentity) error {
	var err error
	if originalDoc == nil {
		originalDoc, err = GetRegisterDocument(resolverClient, identity.Did())
		if err != nil {
			return err
		}
	}
	opts := []register.RegisterDocumentOpts{
		register.AddFromExistingDocument(originalDoc),
		register.RevokeKey(name),
	}
	updatedDoc, errs := register.NewRegisterDocument(opts)
	if len(errs) != 0 {
		return fmt.Errorf("error while creating new RegisterDocument: %v", errs)
	}
	return RegisterUpdatedDocument(resolverClient, updatedDoc, identity.KeyPair(), identity.Issuer())
}
func RemovePublicKeyFromDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, identity register.RegisteredIdentity) error {
	return removeKeyFromDocument(resolverClient, originalDoc, name, identity)
}
func RevokePublicKeyFromDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, identity register.RegisteredIdentity) error {
	return revokeKeyFromDocument(resolverClient, originalDoc, name, identity)
}
func AddAuthenticationKeyToDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, publicBase58 string, identity register.RegisteredIdentity) error {
	var err error
	if originalDoc == nil {
		originalDoc, err = GetRegisterDocument(resolverClient, identity.Did())
		if err != nil {
			return err
		}
	}
	opts := []register.RegisterDocumentOpts{
		register.AddFromExistingDocument(originalDoc),
		register.AddAuthenticationKey(name, publicBase58, false),
	}
	updatedDoc, errs := register.NewRegisterDocument(opts)
	if len(errs) != 0 {
		return fmt.Errorf("error while creating new RegisterDocument: %v", errs)
	}
	return RegisterUpdatedDocument(resolverClient, updatedDoc, identity.KeyPair(), identity.Issuer())
}
func RemoveAuthenticationKeyFromDocument(resolverClient register.ResolverClient, originalDoc *register.RegisterDocument, name string, identity register.RegisteredIdentity) error {
	return removeKeyFromDocument(resolverClient, originalDoc, name, identity)
}