github.com/hyperledger/aries-framework-go@v0.3.2/pkg/doc/verifiable/credential_jws.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  // MarshalJWS serializes JWT into signed form (JWS).
     9  func (jcc *JWTCredClaims) MarshalJWS(signatureAlg JWSAlgorithm, signer Signer, keyID string) (string, error) {
    10  	return marshalJWS(jcc, signatureAlg, signer, keyID)
    11  }
    12  
    13  func unmarshalJWSClaims(rawJwt string, checkProof bool, fetcher PublicKeyFetcher) (*JWTCredClaims, error) {
    14  	var claims JWTCredClaims
    15  
    16  	err := unmarshalJWS(rawJwt, checkProof, fetcher, &claims)
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	return &claims, err
    22  }
    23  
    24  func decodeCredJWS(rawJwt string, checkProof bool, fetcher PublicKeyFetcher) ([]byte, error) {
    25  	return decodeCredJWT(rawJwt, func(vcJWTBytes string) (*JWTCredClaims, error) {
    26  		return unmarshalJWSClaims(rawJwt, checkProof, fetcher)
    27  	})
    28  }