forked from hyperledger-archives/aries-framework-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresentation_jws.go
28 lines (22 loc) · 875 Bytes
/
presentation_jws.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package verifiable
// MarshalJWS serializes JWT presentation claims into signed form (JWS).
func (jpc *JWTPresClaims) MarshalJWS(signatureAlg JWSAlgorithm, signer Signer, keyID string) (string, error) {
return marshalJWS(jpc, signatureAlg, signer, keyID)
}
func unmarshalPresJWSClaims(vpJWT string, checkProof bool, fetcher PublicKeyFetcher) (*JWTPresClaims, error) {
var claims JWTPresClaims
err := unmarshalJWS(vpJWT, checkProof, fetcher, &claims)
if err != nil {
return nil, err
}
return &claims, err
}
func decodeVPFromJWS(vpJWT string, checkProof bool, fetcher PublicKeyFetcher) ([]byte, *rawPresentation, error) {
return decodePresJWT(vpJWT, func(vpJWT string) (*JWTPresClaims, error) {
return unmarshalPresJWSClaims(vpJWT, checkProof, fetcher)
})
}