github.com/hyperledger/aries-framework-go@v0.3.2/pkg/doc/verifiable/presentation_jwt_unsecured.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  
    12  // MarshalUnsecuredJWT serializes JWT presentation claims into unsecured JWT.
    13  func (jpc *JWTPresClaims) MarshalUnsecuredJWT() (string, error) {
    14  	return marshalUnsecuredJWT(nil, jpc)
    15  }
    16  
    17  func unmarshalUnsecuredJWTPresClaims(vpJWT string) (*JWTPresClaims, error) {
    18  	var claims JWTPresClaims
    19  
    20  	err := unmarshalUnsecuredJWT(vpJWT, &claims)
    21  	if err != nil {
    22  		return nil, fmt.Errorf("parse VP in JWT Unsecured form: %w", err)
    23  	}
    24  
    25  	return &claims, nil
    26  }
    27  
    28  func decodeVPFromUnsecuredJWT(vpJWT string) ([]byte, *rawPresentation, error) {
    29  	return decodePresJWT(vpJWT, unmarshalUnsecuredJWTPresClaims)
    30  }