-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
decentralgabe
commented
Oct 10, 2022
- schema signing, verification functionality + APIs
- added delete schema apis
- tests for all
- not yet integrated into credential creation code
@@ -0,0 +1,108 @@ | |||
package keyaccess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to its own package, since it has use outside of just cred verification
@@ -87,8 +87,15 @@ func (dr DIDRouter) CreateDIDByMethod(ctx context.Context, w http.ResponseWriter | |||
} | |||
|
|||
var request CreateDIDByMethodRequest | |||
invalidCreateDIDRequest := "invalid create DID request" | |||
if err := framework.Decode(r, &request); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternativly you could do
if framework.Decode(r, &request) != nil || framework.ValidateRequest(request) != nil {
errMsg := invalidCreateDIDRequest
logrus.WithError(err).Error(errMsg)
return framework.NewRequestError(errors.Wrap(err, errMsg), http.StatusBadRequest)
}
since its the same output (but you need to get err variable in a golang way somehow lol maybe not possible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, unfortunately this wouldn't work because both return unique errors and we couldn't capture both. conditional error assignment would be a nice feature 🤔