Commit d1b64bbb authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Add status endpoint for frontend

parent 32aaf497
...@@ -192,6 +192,11 @@ func HandleProtocolMessage( ...@@ -192,6 +192,11 @@ func HandleProtocolMessage(
status, output = server.JsonResponse(nil, session.fail(server.ErrorInvalidRequest, "")) status, output = server.JsonResponse(nil, session.fail(server.ErrorInvalidRequest, ""))
return return
default: default:
if method == http.MethodGet && noun == "status" {
status, output = server.JsonResponse(session.handleGetStatus())
}
// Below are only POST enpoints
if method != http.MethodPost { if method != http.MethodPost {
status, output = server.JsonResponse(nil, session.fail(server.ErrorInvalidRequest, "")) status, output = server.JsonResponse(nil, session.fail(server.ErrorInvalidRequest, ""))
return return
......
...@@ -39,6 +39,10 @@ func (session *session) handleGetRequest(min, max *irma.ProtocolVersion) (irma.S ...@@ -39,6 +39,10 @@ func (session *session) handleGetRequest(min, max *irma.ProtocolVersion) (irma.S
return session.request, nil return session.request, nil
} }
func (session *session) handleGetStatus() (server.Status, *irma.RemoteError) {
return session.status, nil
}
func (session *session) handlePostSignature(signature *irma.SignedMessage) (*irma.ProofStatus, *irma.RemoteError) { func (session *session) handlePostSignature(signature *irma.SignedMessage) (*irma.ProofStatus, *irma.RemoteError) {
if session.status != server.StatusConnected { if session.status != server.StatusConnected {
return nil, server.RemoteError(server.ErrorUnexpectedRequest, "Session not yet started or already finished") return nil, server.RemoteError(server.ErrorUnexpectedRequest, "Session not yet started or already finished")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment