Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set iss property in jwts #233

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![godoc ssi-sdk](https://img.shields.io/badge/godoc-ssi--sdk-blue)](https://pkg.go.dev/github.com/TBD54566975/ssi-sdk)
[![go version 1.17.6](https://img.shields.io/badge/go_version-1.17.6-brightgreen)](https://golang.org/)
[![go version 1.19.2](https://img.shields.io/badge/go_version-1.19.2-brightgreen)](https://golang.org/)
[![Go Report Card A+](https://goreportcard.com/badge/github.com/TBD54566975/ssi-sdk)](https://goreportcard.com/report/github.com/TBD54566975/ssi-sdk)
[![license Apache 2](https://img.shields.io/badge/license-Apache%202-black)](https://github.com/TBD54566975/ssi-sdk/blob/main/LICENSE)
[![issues](https://img.shields.io/github/issues/TBD54566975/ssi-sdk)](https://github.com/TBD54566975/ssi-sdk/issues)
Expand Down
2 changes: 1 addition & 1 deletion credential/exchange/submission.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func normalizeJSONPartPath(partPath string) string {
}

func normalizeJSONPath(path string) string {
pathRegex := regexp.MustCompile(`\[.*\]`)
pathRegex := regexp.MustCompile(`\[.*]`)
return pathRegex.ReplaceAllString(path, "")
}

Expand Down
2 changes: 1 addition & 1 deletion credential/verification/verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func getVCJSONSchema() string {
"author": "did:example:MDP8AsFhHzhwUvGNuYkX7T",
"authored": "2021-01-01T00:00:00+00:00",
"schema": {
"$id": "email-schema-1.0",
"$id": "email-schema-1.0",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"description": "Email",
"type": "object",
Expand Down
10 changes: 7 additions & 3 deletions crypto/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ func jwtSignerVerifier(kid string, key interface{}) (jwk.Key, *jwa.SignatureAlgo
if err != nil {
return nil, nil, errors.Wrap(err, "could not get verification alg from jwk")
}
if err := parsedKey.Set(jwk.KeyIDKey, kid); err != nil {
// TODO(gabe) distinguish between issuer and kid
if err = parsedKey.Set(jwt.IssuerKey, kid); err != nil {
return nil, nil, fmt.Errorf("could not set kid with provided value: %s", kid)
}
if err := parsedKey.Set(jwk.AlgorithmKey, alg); err != nil {
if err = parsedKey.Set(jwk.KeyIDKey, kid); err != nil {
return nil, nil, fmt.Errorf("could not set kid with provided value: %s", kid)
}
if err = parsedKey.Set(jwk.AlgorithmKey, alg); err != nil {
return nil, nil, fmt.Errorf("could not set alg with value: %s", alg)
}
return parsedKey, &alg, nil
Expand All @@ -86,7 +90,7 @@ func (sv *JWTSigner) SignJWT(kvs map[string]interface{}) ([]byte, error) {
t := jwt.New()
for k, v := range kvs {
if err := t.Set(k, v); err != nil {
err := errors.Wrapf(err, "could not set %s to value: %v", k, v)
err = errors.Wrapf(err, "could not set %s to value: %v", k, v)
logrus.WithError(err).Error("could not sign JWT")
return nil, err
}
Expand Down