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

fix: id format in vp #3402

Merged
merged 1 commit into from
Oct 17, 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
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