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