func DecodeTypedIDFromJSONRaw(typedIDBytes json.RawMessage) ([]verifiable.TypedID, error) {
	if len(typedIDBytes) == 0 {
		return nil, nil
	}
	var singleTypedID verifiable.TypedID
	err := json.Unmarshal(typedIDBytes, &singleTypedID)
	if err == nil {
		return []verifiable.TypedID{singleTypedID}, nil
	}
	var composedTypedID []verifiable.TypedID
	err = json.Unmarshal(typedIDBytes, &composedTypedID)
	if err == nil {
		return composedTypedID, nil
	}
	return nil, err
}
DecodeTypedIDFromJSONRaw decodes verifiable type ID from JSON raw
package vcutil
import (
	"encoding/json"
	"errors"
	"fmt"
	"strings"
	"github.com/hyperledger/aries-framework-go/pkg/doc/verifiable"
	"github.com/trustbloc/edv/pkg/edvutils"
	"github.com/trustbloc/edv/pkg/restapi/models"
	"github.com/trustbloc/edge-service/pkg/doc/vc/crypto"
	vcprofile "github.com/trustbloc/edge-service/pkg/doc/vc/profile"
)
const (
	defVCContext                = "https://www.w3.org/2018/credentials/v1"
	jsonWebSignature2020Context = "https://w3c-ccg.github.io/lds-jws2020/contexts/lds-jws2020-v1.json"
	bbsBlsSignature2020Context  = "https://w3id.org/security/bbs/v1"
)
func GetContextsFromJSONRaw(raw json.RawMessage) ([]string, error) {
	if len(raw) == 0 {
		return []string{defVCContext}, nil
	}
	var ctx struct {
		Context interface{} `json:"@context,omitempty"`
	}
	err := json.Unmarshal(raw, &ctx)
	if err != nil {
		return nil, err
	}
	if ctx.Context == nil {
		return []string{defVCContext}, nil
	}
	return decodeContext(ctx.Context)
}
func decodeContext(c interface{}) ([]string, error) {
	switch rContext := c.(type) {
	case string:
		return []string{rContext}, nil
	case []interface{}:
		var s []string
		for i := range rContext {
			c, valid := rContext[i].(string)
			if !valid {
				return nil, fmt.Errorf("unexpected context type")
			}
			s = append(s, c)
		}
		return s, nil
	default:
		return nil, errors.New("credential context of unknown type")
	}
}