func (hl *HashLink) CreateHashLink(content []byte, links []string) (string, error) {
	hashLink, err := hl.CreateResourceHash(content)
	if err != nil {
		return "", fmt.Errorf("failed to create resource hash from content[%s]: %w", string(content), err)
	}
	hashLink = HLPrefix + hashLink
	if len(links) > 0 {
		metadata, err := hl.CreateMetadataFromLinks(links)
		if err != nil {
			return "", fmt.Errorf("failed to create hashlink metadata for links[%+v]: %w", links, err)
		}
		hashLink = hashLink + separator + metadata
	}
	return hashLink, nil
}
CreateHashLink will create hashlink for the supplied content and links.
package hashlink
import (
	"encoding/base64"
	"fmt"
	"net/url"
	"strings"
	cbor "github.com/fxamacker/cbor/v2"
	"github.com/multiformats/go-multihash"
	"github.com/trustbloc/sidetree-core-go/pkg/hashing"
)
const (
	sha2_256 = 18
	linksKey = 0x0f
	hl        = "hl"
	separator = ":"
	maxHLParts = 3
	minHLParts = 2
	HLPrefix = hl + separator
)
type Encoder func(content []byte) string
type Decoder func(encodedContent string) ([]byte, error)
func New(opts ...Option) *HashLink {
	hl := &HashLink{
		multihashCode: sha2_256,
		encoder: func(data []byte) string {
			return "u" + base64.RawURLEncoding.EncodeToString(data)
		},
		decoder: func(enc string) ([]byte, error) {
			return base64.RawURLEncoding.DecodeString(enc[1:])
		},
	}
	for _, opt := range opts {
		opt(hl)
	}
	return hl
}
type Option func(opts *HashLink)
type HashLink struct {
	encoder       Encoder
	decoder       Decoder
	multihashCode uint
}