Skip to content

Commit f4e71e4

Browse files
authored
#4299: upgrade go-did to v0.21.0 for VP-JWT iss claim fix (#4300)
Encodes the presentation holder as the JWT `iss` claim and drops the non-standard `vp.holder` field, per go-did#148. The existing parser already treats `iss` as the canonical holder, so no source changes are needed. Adds a regression test asserting the holder is carried in `iss` and that `vp.holder` is no longer emitted. Assisted by AI
1 parent d6ab80f commit f4e71e4

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require (
3131
github.com/nats-io/nats-server/v2 v2.14.1
3232
github.com/nats-io/nats.go v1.52.0
3333
github.com/nuts-foundation/crypto-ecies v0.0.0-20211207143025-5b84f9efce2b
34-
github.com/nuts-foundation/go-did v0.20.0
34+
github.com/nuts-foundation/go-did v0.21.0
3535
github.com/nuts-foundation/go-leia/v4 v4.3.0
3636
github.com/nuts-foundation/go-stoabs v1.11.1
3737
github.com/nuts-foundation/sqlite v1.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ github.com/nightlyone/lockfile v1.0.0 h1:RHep2cFKK4PonZJDdEl4GmkabuhbsRMgk/k3uAm
400400
github.com/nightlyone/lockfile v1.0.0/go.mod h1:rywoIealpdNse2r832aiD9jRk8ErCatROs6LzC841CI=
401401
github.com/nuts-foundation/crypto-ecies v0.0.0-20211207143025-5b84f9efce2b h1:80icUxWHwE1MrIOOEK5rxrtyKOgZeq5Iu1IjAEkggTY=
402402
github.com/nuts-foundation/crypto-ecies v0.0.0-20211207143025-5b84f9efce2b/go.mod h1:6YUioYirD6/8IahZkoS4Ypc8xbeJW76Xdk1QKcziNTM=
403-
github.com/nuts-foundation/go-did v0.20.0 h1:JTUNZl622JdZC3c/OdfRWANlN7AMQypgSPSc7iGmCWY=
404-
github.com/nuts-foundation/go-did v0.20.0/go.mod h1:4od1gAmCi9HjHTQGEvHC8pLeuXdXACxidAcdA52YScc=
403+
github.com/nuts-foundation/go-did v0.21.0 h1:jQAr6O8afgVp88Rkwnfl1m5E0b0L0KTkSqM5iDnq0fw=
404+
github.com/nuts-foundation/go-did v0.21.0/go.mod h1:4od1gAmCi9HjHTQGEvHC8pLeuXdXACxidAcdA52YScc=
405405
github.com/nuts-foundation/go-leia/v4 v4.3.0 h1:R0qGISIeg2q/PCQTC9cuoBtA6cFu4WBV2DbmSOWKZyM=
406406
github.com/nuts-foundation/go-leia/v4 v4.3.0/go.mod h1:Gw6bXqJLOAmHSiXJJYbVoj+Mowp/PoBRywO0ZPsVzA0=
407407
github.com/nuts-foundation/go-stoabs v1.11.1 h1:ZQOeRKzC1+AfW6Ve5kBJMo+zYhHLBUI4KrLWKYkxoeI=

vcr/holder/presenter_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,25 @@ func TestPresenter_buildPresentation(t *testing.T) {
190190
})
191191
})
192192

193+
t.Run("#4299: holder is encoded as iss claim, not vp.holder", func(t *testing.T) {
194+
ctrl := gomock.NewController(t)
195+
196+
keyResolver := resolver.NewMockKeyResolver(ctrl)
197+
keyResolver.EXPECT().ResolveKey(testDID, nil, resolver.NutsSigningKeyType).Return(kid, key.PublicKey, nil)
198+
199+
w := presenter{documentLoader: jsonldManager.DocumentLoader(), signer: keyStore, keyResolver: keyResolver}
200+
201+
holderURI := testDID.URI()
202+
optionsWithHolder := PresentationOptions{Format: JWTPresentationFormat, ProofOptions: proof.ProofOptions{Created: time.Now()}, Holder: &holderURI}
203+
result, err := w.buildPresentation(ctx, &testDID, []vc.VerifiableCredential{testCredential}, optionsWithHolder)
204+
205+
require.NoError(t, err)
206+
require.NotNil(t, result)
207+
assert.Equal(t, testDID.String(), result.JWT().Issuer(), "holder must be carried in the iss claim")
208+
vpAsMap := result.JWT().PrivateClaims()["vp"].(map[string]any)
209+
assert.NotContains(t, vpAsMap, "holder", "non-standard vp.holder must not be set")
210+
})
211+
193212
t.Run("ok - multiple VCs", func(t *testing.T) {
194213
ctrl := gomock.NewController(t)
195214

0 commit comments

Comments
 (0)