// buildCredential builds and signs anchor credential.
buildCredential builds and signs anchor credential.
// buildCredential builds and signs anchor credential .
func (c *Writer) buildCredential(contentObj vocab.Document, ctx []string) (*verifiable.Credential, error) {
	buildCredStartTime := time.Now()
	defer c.metrics.WriteAnchorBuildCredentialTime(time.Since(buildCredStartTime))
	contentObjBytes, err := canonicalizer.MarshalCanonical(contentObj)
	if err != nil {
		return nil, fmt.Errorf("marshal content object: %w", err)
	}
	hl, err := hashlink.New().CreateHashLink(contentObjBytes, nil)
	if err != nil {
		return nil, fmt.Errorf("create hashlink for content object: %w", err)
	}
	vc, err := c.AnchorBuilder.Build(hl, ctx)
	if err != nil {
		return nil, fmt.Errorf("build anchor credential: %w", err)
	}
	return vc, nil
}
func ( c * Writer ) buildCredential ( contentObj vocab . Document , ctx [ ] string ) ( * verifiable . Credential , error ) { buildCredStartTime := time . Now ( ) defer c . metrics . WriteAnchorBuildCredentialTime ( time . Since ( buildCredStartTime ) ) contentObjBytes , err := canonicalizer . MarshalCanonical ( contentObj ) if err != nil { return nil , fmt . Errorf ( " " , err ) } hl , err := hashlink . New ( ) . CreateHashLink ( contentObjBytes , nil ) if err != nil { return nil , fmt . Errorf ( " " , err ) } vc , err := c . AnchorBuilder . Build ( hl , ctx ) if err != nil { return nil , fmt . Errorf ( " " , err ) } return vc , nil }
buildCredential builds and signs anchor credential.
buildCredential builds and signs anchor credential .