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

Add event for when irma account is remotely deleted

parent e55c4776
......@@ -74,6 +74,9 @@ func (h *keyshareEnrollmentHandler) KeyshareBlocked(manager irma.SchemeManagerId
func (h *keyshareEnrollmentHandler) KeyshareEnrollmentIncomplete(manager irma.SchemeManagerIdentifier) {
h.fail(errors.New("Keyshare enrollment failed: registration incomplete"))
}
func (h *keyshareEnrollmentHandler) KeyshareEnrollmentDeleted(manager irma.SchemeManagerIdentifier) {
h.fail(errors.New("Keyshare enrollment failed: not enrolled"))
}
func (h *keyshareEnrollmentHandler) KeyshareEnrollmentMissing(manager irma.SchemeManagerIdentifier) {
h.fail(errors.New("Keyshare enrollment failed: unenrolled"))
}
......
......@@ -26,6 +26,7 @@ type keyshareSessionHandler interface {
KeyshareCancelled()
KeyshareBlocked(manager irma.SchemeManagerIdentifier, duration int)
KeyshareEnrollmentIncomplete(manager irma.SchemeManagerIdentifier)
KeyshareEnrollmentDeleted(manager irma.SchemeManagerIdentifier)
// In errors the manager may be nil, as not all keyshare errors have a clearly associated scheme manager
KeyshareError(manager *irma.SchemeManagerIdentifier, err error)
KeysharePin()
......@@ -221,6 +222,8 @@ func (ks *keyshareSession) fail(manager irma.SchemeManagerIdentifier, err error)
if ok {
if serr.RemoteError != nil && len(serr.RemoteError.ErrorName) > 0 {
switch serr.RemoteError.ErrorName {
case "USER_NOT_FOUND":
ks.sessionHandler.KeyshareEnrollmentDeleted(manager)
case "USER_NOT_REGISTERED":
ks.sessionHandler.KeyshareEnrollmentIncomplete(manager)
case "USER_BLOCKED":
......
......@@ -353,3 +353,6 @@ func (sh *ManualSessionHandler) KeyshareEnrollmentIncomplete(manager irma.Scheme
func (sh *ManualSessionHandler) KeyshareEnrollmentMissing(manager irma.SchemeManagerIdentifier) {
sh.errorChannel <- &irma.SessionError{Err: errors.Errorf("Missing keyshare server %s", manager.String())}
}
func (sh *ManualSessionHandler) KeyshareEnrollmentDeleted(manager irma.SchemeManagerIdentifier) {
sh.errorChannel <- &irma.SessionError{Err: errors.Errorf("Keyshare enrollment deleted for %s", manager.String())}
}
......@@ -36,6 +36,7 @@ type Handler interface {
KeyshareBlocked(manager irma.SchemeManagerIdentifier, duration int)
KeyshareEnrollmentIncomplete(manager irma.SchemeManagerIdentifier)
KeyshareEnrollmentMissing(manager irma.SchemeManagerIdentifier)
KeyshareEnrollmentDeleted(manager irma.SchemeManagerIdentifier)
RequestIssuancePermission(request irma.IssuanceRequest, ServerName string, callback PermissionHandler)
RequestVerificationPermission(request irma.DisclosureRequest, ServerName string, callback PermissionHandler)
......@@ -450,6 +451,10 @@ func (session *session) KeyshareEnrollmentIncomplete(manager irma.SchemeManagerI
session.Handler.KeyshareEnrollmentIncomplete(manager)
}
func (session *session) KeyshareEnrollmentDeleted(manager irma.SchemeManagerIdentifier) {
session.Handler.KeyshareEnrollmentDeleted(manager)
}
func (session *session) KeyshareBlocked(manager irma.SchemeManagerIdentifier, duration int) {
session.Handler.KeyshareBlocked(manager, duration)
}
......
......@@ -32,6 +32,10 @@ func (th TestHandler) KeyshareEnrollmentMissing(manager irma.SchemeManagerIdenti
th.Failure(irma.ActionUnknown, &irma.SessionError{Err: errors.Errorf("Missing keyshare server %s", manager.String())})
}
func (th TestHandler) KeyshareEnrollmentDeleted(manager irma.SchemeManagerIdentifier) {
th.Failure(irma.ActionUnknown, &irma.SessionError{Err: errors.Errorf("Keyshare enrollment deleted for %s", manager.String())})
}
func (th TestHandler) StatusUpdate(action irma.Action, status irma.Status) {}
func (th TestHandler) Success(action irma.Action, result string) {
th.c <- nil
......
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