Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
fix: id format in vp (#3402)
Browse files Browse the repository at this point in the history
Signed-off-by: Firas Qutishat <firas.qutishat@securekey.com>

Signed-off-by: Firas Qutishat <firas.qutishat@securekey.com>
  • Loading branch information
fqutishat authored Oct 17, 2022
1 parent fc30798 commit a3afb8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pkg/doc/verifiable/presentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ const basePresentationSchema = `
]
},
"id": {
"type": "string",
"format": "uri"
"type": "string"
},
"type": {
"oneOf": [
Expand Down
10 changes: 4 additions & 6 deletions pkg/doc/verifiable/presentation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,14 @@ func TestValidateVP_Context(t *testing.T) {
}

func TestValidateVP_ID(t *testing.T) {
t.Run("rejects verifiable presentation with non-url ID", func(t *testing.T) {
t.Run("accept verifiable presentation with string ID", func(t *testing.T) {
raw := &rawPresentation{}
require.NoError(t, json.Unmarshal([]byte(validPresentation), &raw))
raw.ID = "not valid presentation ID URL"
raw.ID = "id"
bytes, err := json.Marshal(raw)
require.NoError(t, err)
vp, err := newTestPresentation(t, bytes)
require.Error(t, err)
require.Contains(t, err.Error(), "id: Does not match format 'uri'")
require.Nil(t, vp)
_, err = newTestPresentation(t, bytes)
require.NoError(t, err)
})
}

Expand Down

0 comments on commit a3afb8a

Please sign in to comment.