You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
curl -X GET "http://localhost:8080/v1/credentials?issuer=did:abc:123"
curl -X GET "http://localhost:8080/v1/credentials?subject=did:def:456"
curl -X GET "http://localhost:8080/v1/credentials?schema=https://test-schema.com/name"
Observe that the following error is returned:
{"error":"must use one of the following query parameters: issuer, subject, schema"}
Possible Solution
Assuming that the design intent was for the API user to use a URL query string parameter/value to retrieve credentials, one possible fix is to create a new utility function in /pkg/server/framework/util.go:
// GetQueryValue is a utility to get a parameter value from the query string, nil if not foundfuncGetQueryValue(r*http.Request, paramstring) *string {
value:=r.URL.Query().Get(param)
ifvalue=="" {
returnnil
}
return&value
}
I tested this as well, but found that if the intent is to support Schema IDs like https://test-schema.com/name (which appears in the current tests), there are issues with the routes being interpreted properly by httptreemux.
Environment
macOS 12.4
go version go1.18.3 darwin/arm64
Mage Build Tool 1.13.0
The text was updated successfully, but these errors were encountered:
Expected Behavior
If a matching credential has been created, based on the following comment:
ssi-service/pkg/server/router/credential.go
Line 116 in 03d5868
an API call to one of the following:
/v1/credentials?issuer=did:key:abc123
/v1/credentials?schema=https://test-schema.com
/v1/credentials?subject=did:key:def456
should return a JSON array with the matching credential data.
Current Behavior
If a matching credential has been created, an API call to one of the following:
/v1/credentials?issuer=did:key:abc123
/v1/credentials?schema=https://test-schema.com
/v1/credentials?subject=did:key:def456
returns an error:
Steps to Reproduce
Create a credential:
Attempt to query by issuer, subject, or schema:
Observe that the following error is returned:
Possible Solution
Assuming that the design intent was for the API user to use a URL query string parameter/value to retrieve credentials, one possible fix is to create a new utility function in /pkg/server/framework/util.go:
and modify the
GetCredentials
function:ssi-service/pkg/server/router/credential.go
Lines 116 to 120 in 03d5868
to use
GetQueryValue
:An alternative could be to use route parameters. For example:
I tested this as well, but found that if the intent is to support Schema IDs like
https://test-schema.com/name
(which appears in the current tests), there are issues with the routes being interpreted properly by httptreemux.Environment
The text was updated successfully, but these errors were encountered: