Commit 0f1f2b70 authored by Ivar Derksen's avatar Ivar Derksen Committed by Sietse Ringers

Fix for keyshare enrollment missing error being overruled by failure error

parent 37836546
...@@ -533,16 +533,16 @@ func (session *session) getProof() (interface{}, error) { ...@@ -533,16 +533,16 @@ func (session *session) getProof() (interface{}, error) {
// checkKeyshareEnrollment checks if we are enrolled into all involved keyshare servers, // checkKeyshareEnrollment checks if we are enrolled into all involved keyshare servers,
// and aborts the session if not // and aborts the session if not
func (session *session) checkKeyshareEnrollment() bool { func (session *session) checkKeyshareEnrollment() error {
for id := range session.request.Identifiers().SchemeManagers { for id := range session.request.Identifiers().SchemeManagers {
distributed := session.client.Configuration.SchemeManagers[id].Distributed() distributed := session.client.Configuration.SchemeManagers[id].Distributed()
_, enrolled := session.client.keyshareServers[id] _, enrolled := session.client.keyshareServers[id]
if distributed && !enrolled { if distributed && !enrolled {
session.Handler.KeyshareEnrollmentMissing(id) session.Handler.KeyshareEnrollmentMissing(id)
return false return &irma.SessionError{ErrorType: irma.ErrorKeyshare, Handled: true}
} }
} }
return true return nil
} }
func (session *session) checkAndUpdateConfiguration() error { func (session *session) checkAndUpdateConfiguration() error {
...@@ -561,8 +561,8 @@ func (session *session) checkAndUpdateConfiguration() error { ...@@ -561,8 +561,8 @@ func (session *session) checkAndUpdateConfiguration() error {
} }
// Check if we are enrolled into all involved keyshare servers // Check if we are enrolled into all involved keyshare servers
if !session.checkKeyshareEnrollment() { if err = session.checkKeyshareEnrollment(); err != nil {
return &irma.SessionError{ErrorType: irma.ErrorKeyshare} return err
} }
if err = session.request.Disclosure().Disclose.Validate(session.client.Configuration); err != nil { if err = session.request.Disclosure().Disclose.Validate(session.client.Configuration); err != nil {
...@@ -643,7 +643,7 @@ func (session *session) delete() bool { ...@@ -643,7 +643,7 @@ func (session *session) delete() bool {
} }
func (session *session) fail(err *irma.SessionError) { func (session *session) fail(err *irma.SessionError) {
if session.delete() { if session.delete() && !err.Handled {
err.Err = errors.Wrap(err.Err, 0) err.Err = errors.Wrap(err.Err, 0)
session.Handler.Failure(err) session.Handler.Failure(err)
} }
......
...@@ -104,6 +104,7 @@ type SessionError struct { ...@@ -104,6 +104,7 @@ type SessionError struct {
Info string Info string
RemoteError *RemoteError RemoteError *RemoteError
RemoteStatus int RemoteStatus int
Handled bool // set to true when error status is already communicated to session handler
} }
// RemoteError is an error message returned by the API server on errors. // RemoteError is an error message returned by the API server on errors.
......
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