package layoutroutingidentitymappingv1

import (
	"crypto/sha256"
	"encoding/hex"
)

// ProposalDigest returns the content identity of one complete, source-neutral
// mapping proposal. It is not a source proof or an authorization decision.
func ProposalDigest(proposal Proposal) (string, error) {
	canonical, err := CanonicalProposalBytes(proposal)
	if err != nil {
		return "", err
	}
	sum := sha256.Sum256(canonical)
	return "sha256:" + hex.EncodeToString(sum[:]), nil
}
