func (c *Command) GetCredentialSpec(w io.Writer, r io.Reader) command.Error {  
	args := &GetCredentialSpecArgs{}
	err := json.NewDecoder(r).Decode(args)
	if err != nil {
		logutil.LogError(logger, CommandName, GetCredentialSpec, err.Error())
		return command.NewValidationError(BadRequestErrorCode, err)
	}
	if len(args.Message) == 0 {
		logutil.LogError(logger, CommandName, GetCredentialSpec, "missing message")
		return command.NewValidationError(BadRequestErrorCode, errors.New("missing message"))
	}
	var (
		formats     []issuecredential.Format
		attachments []decorator.Attachment
	)
	msgType := struct {
		Type string `json:"@type"`
	}{}
	err = json.Unmarshal(args.Message, &msgType)
	if err != nil {
		errMsg := fmt.Errorf("cannot unmarshal arg message: %w", err)
		logutil.LogInfo(logger, CommandName, GetCredentialSpec, errMsg.Error())
		return command.NewValidationError(BadRequestErrorCode, errMsg)
	}
	switch msgType.Type {
	case issuecredential.ProposeCredentialMsgType:
		proposal := &issuecredential.ProposeCredential{}
		err = json.Unmarshal(args.Message, proposal)
		formats = proposal.Formats
		attachments = proposal.FiltersAttach
	case issuecredential.OfferCredentialMsgType:
		offer := &issuecredential.OfferCredential{}
		err = json.Unmarshal(args.Message, offer)
		formats = offer.Formats
		attachments = offer.OffersAttach
	case issuecredential.RequestCredentialMsgType:
		request := &issuecredential.RequestCredential{}
		err = json.Unmarshal(args.Message, request)
		formats = request.Formats
		attachments = request.RequestsAttach
	default:
		err = fmt.Errorf("invalid msg type: %s", msgType.Type)
	}
	if err != nil {
		errMsg := fmt.Errorf("failed to unmarshal payload: %w", err)
		logutil.LogError(logger, CommandName, GetCredentialSpec, errMsg.Error())
		return command.NewValidationError(BadRequestErrorCode, errMsg)
	}
	spec, err := rfc0593.GetCredentialSpec(c.provider, formats, attachments)
	if errors.Is(err, rfc0593.ErrRFC0593NotApplicable) {
		logutil.LogError(logger, CommandName, GetCredentialSpec, err.Error())
		return command.NewValidationError(RFC0593NotApplicableErrorCode, err)
	}
	if err != nil {
		logutil.LogError(logger, CommandName, GetCredentialSpec, err.Error())
		return command.NewValidationError(BadRequestErrorCode, err)
	}
	command.WriteNillableResponse(w, &GetCredentialSpecResponse{Spec: spec}, logger)
	logutil.LogDebug(logger, CommandName, GetCredentialSpec, "success")
	return nil
}
GetCredentialSpec extracts the credential specification.
package rfc0593
import (
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"github.com/hyperledger/aries-framework-go/pkg/client/issuecredential/rfc0593"
	"github.com/hyperledger/aries-framework-go/pkg/common/log"
	"github.com/hyperledger/aries-framework-go/pkg/controller/command"
	"github.com/hyperledger/aries-framework-go/pkg/controller/internal/cmdutil"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/protocol/decorator"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/protocol/issuecredential"
	"github.com/hyperledger/aries-framework-go/pkg/doc/verifiable"
	"github.com/hyperledger/aries-framework-go/pkg/internal/logutil"
)
var logger = log.New("aries-framework/controller/rfc0593")
const (
	BadRequestErrorCode = command.Code(iota + command.RFC0593)
	RFC0593NotApplicableErrorCode
	UnableToIssueCredentialErrorCode
)
const (
	CommandName = "RFC0593"
	GetCredentialSpec = "GetCredentialSpec"
	IssueCredential = "IssueCredential"
	VerifyCredential = "VerifyCredential"
)
type Command struct {
	provider rfc0593.Provider
}
func New(p rfc0593.Provider) *Command {
	return &Command{provider: p}
}
func (c *Command) GetHandlers() []command.Handler {
	return []command.Handler{
		cmdutil.NewCommandHandler(CommandName, GetCredentialSpec, c.GetCredentialSpec),
		cmdutil.NewCommandHandler(CommandName, IssueCredential, c.IssueCredential),
		cmdutil.NewCommandHandler(CommandName, VerifyCredential, c.VerifyCredential),
	}
}