github.com/hyperledger/aries-framework-go@v0.3.2/pkg/doc/verifiable/credential_ldp.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  SPDX-License-Identifier: Apache-2.0
     4  */
     5  
     6  package verifiable
     7  
     8  import (
     9  	"fmt"
    10  
    11  	"github.com/hyperledger/aries-framework-go/pkg/doc/signature/jsonld"
    12  )
    13  
    14  // AddLinkedDataProof appends proof to the Verifiable Credential.
    15  func (vc *Credential) AddLinkedDataProof(context *LinkedDataProofContext, jsonldOpts ...jsonld.ProcessorOpts) error {
    16  	vcBytes, err := vc.MarshalJSON()
    17  	if err != nil {
    18  		return fmt.Errorf("add linked data proof to VC: %w", err)
    19  	}
    20  
    21  	proofs, err := addLinkedDataProof(context, vcBytes, jsonldOpts...)
    22  	if err != nil {
    23  		return err
    24  	}
    25  
    26  	vc.Proofs = proofs
    27  
    28  	return nil
    29  }