Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
reinkrul committed Dec 15, 2023
1 parent b7ab286 commit 6ee9fc5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion discovery/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (m *Module) validateRetraction(serviceID string, presentation vc.Verifiable
// If not, it might've already been removed due to expiry or superseded by a newer presentation.
retractJTIRaw, _ := presentation.JWT().Get("retract_jti")
retractJTI, ok := retractJTIRaw.(string)
if !ok {
if !ok || retractJTI == "" {
return errInvalidRetractionJTIClaim
}
signerDID, _ := credential.PresentationSigner(presentation) // checked before
Expand Down
12 changes: 11 additions & 1 deletion discovery/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func Test_Module_Add(t *testing.T) {
err := m.Add(testServiceID, vp)
assert.ErrorIs(t, err, errInvalidRetractionJTIClaim)
})
t.Run("'retract_jti' claim in not a string", func(t *testing.T) {
t.Run("'retract_jti' claim is not a string", func(t *testing.T) {
m, _ := setupModule(t, storageEngine)
vp := createPresentationCustom(aliceDID, func(claims map[string]interface{}, vp *vc.VerifiablePresentation) {
vp.Type = append(vp.Type, retractionPresentationType)
Expand All @@ -193,6 +193,16 @@ func Test_Module_Add(t *testing.T) {
err := m.Add(testServiceID, vp)
assert.ErrorIs(t, err, errInvalidRetractionJTIClaim)
})
t.Run("'retract_jti' claim is an empty string", func(t *testing.T) {
m, _ := setupModule(t, storageEngine)
vp := createPresentationCustom(aliceDID, func(claims map[string]interface{}, vp *vc.VerifiablePresentation) {
vp.Type = append(vp.Type, retractionPresentationType)
claims["retract_jti"] = ""
claims[jwt.AudienceKey] = []string{testServiceID}
})
err := m.Add(testServiceID, vp)
assert.ErrorIs(t, err, errInvalidRetractionJTIClaim)
})
})
}

Expand Down

0 comments on commit 6ee9fc5

Please sign in to comment.