-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submit verifications #855
base: create_verification_tables
Are you sure you want to change the base?
Submit verifications #855
Conversation
b35afec
to
3a2eeb1
Compare
return CheckVerification200JSONResponse{union: json.RawMessage(fmt.Sprintf(`{"query": %v}`, query))}, nil | ||
} | ||
|
||
return CheckVerification404JSONResponse{N404JSONResponse{Message: "Verification query not found"}}, 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.
default response should be 500. To return error 404 we'd check the error from the repository /service layer
|
||
// VerificationService interface | ||
type VerificationService interface { | ||
CheckVerification(ctx context.Context, issuerID w3c.DID, verificationQueryID uuid.UUID) (*domain.VerificationResponse, *domain.VerificationQuery, error) |
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.
methods inside services should not contain the service name. Rename this to Check
// VerificationService interface | ||
type VerificationService interface { | ||
CheckVerification(ctx context.Context, issuerID w3c.DID, verificationQueryID uuid.UUID) (*domain.VerificationResponse, *domain.VerificationQuery, error) | ||
SubmitVerificationResponse(ctx context.Context, verificationQueryID uuid.UUID, issuerID w3c.DID, token string, serverURL string) (*domain.VerificationResponse, error) |
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.
methods inside services should not contain the service name. Rename this to SubmitResponse
Please, run golangci-lint (or make lint) and fix linter warnings. |
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.
@aldigjo good work! I left some comments, but overall is very good!
} | ||
|
||
nullifierSessionID := new(big.Int) | ||
if _, ok := nullifierSessionID.SetString(val.(string), defaultBigIntBase); !ok { |
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.
We should check that this conversion to string is valid. If not we will have a core dump.
Something like this.
var sVal string
if sVal, ok = val.(string); ok {
return nil, errors.New("nullifierSessionID is not a string")
}
Working with map[string]interfaces needs a lot of boilerplate
@@ -101,3 +105,28 @@ func (r *VerificationRepository) AddResponse(ctx context.Context, queryID uuid.U | |||
} | |||
return responseID, nil | |||
} | |||
|
|||
// GetVerificationResponse returns a verification response by scopeID and userDID | |||
func (r *VerificationRepository) GetVerificationResponse(ctx context.Context, queryID uuid.UUID) (*domain.VerificationResponse, error) { |
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.
We need a test for this function in repositories/verification_test.go
392cf6f
to
fdb7307
Compare
Adding verification endpoints