Commit 287aec5d authored by David Venhoek's avatar David Venhoek
Browse files

Updated EnrolledSchemeManagers to be a function.

parent 1d9c696d
......@@ -54,7 +54,6 @@ type Client struct {
// Other state
Preferences Preferences
Configuration *irma.Configuration
UnenrolledSchemeManagers []irma.SchemeManagerIdentifier
irmaConfigurationPath string
androidStoragePath string
handler ClientHandler
......@@ -181,8 +180,7 @@ func New(
cm.paillierKey(false)
}
cm.UnenrolledSchemeManagers = cm.unenrolledSchemeManagers()
if len(cm.UnenrolledSchemeManagers) > 1 {
if len(cm.UnenrolledSchemeManagers()) > 1 {
return nil, errors.New("Too many keyshare servers")
}
......@@ -680,7 +678,7 @@ func (client *Client) paillierKeyWorker(wait bool, ch chan bool) {
}
}
func (client *Client) unenrolledSchemeManagers() []irma.SchemeManagerIdentifier {
func (client *Client) UnenrolledSchemeManagers() []irma.SchemeManagerIdentifier {
list := []irma.SchemeManagerIdentifier{}
for name, manager := range client.Configuration.SchemeManagers {
if _, contains := client.keyshareServers[name]; manager.Distributed() && !contains {
......@@ -804,7 +802,6 @@ func (client *Client) KeyshareRemove(manager irma.SchemeManagerIdentifier) error
// KeyshareRemoveAll removes all keyshare server registrations.
func (client *Client) KeyshareRemoveAll() error {
client.keyshareServers = map[irma.SchemeManagerIdentifier]*keyshareServer{}
client.UnenrolledSchemeManagers = client.unenrolledSchemeManagers()
return client.storage.StoreKeyshareServers(client.keyshareServers)
}
......
......@@ -38,7 +38,6 @@ func (h *keyshareEnrollmentHandler) RequestPin(remainingAttempts int, callback P
func (h *keyshareEnrollmentHandler) Success(action irma.Action, result string) {
_ = h.client.storage.StoreKeyshareServers(h.client.keyshareServers) // TODO handle err?
h.client.UnenrolledSchemeManagers = h.client.unenrolledSchemeManagers()
h.client.handler.EnrollmentSuccess(h.kss.SchemeManagerIdentifier)
}
......
......@@ -578,9 +578,6 @@ func (session *session) managerSession() {
}
// Update state and inform user of success
if manager.Distributed() {
session.client.UnenrolledSchemeManagers = session.client.unenrolledSchemeManagers()
}
session.client.handler.UpdateConfiguration(
&irma.IrmaIdentifierSet{
SchemeManagers: map[irma.SchemeManagerIdentifier]struct{}{manager.Identifier(): {}},
......
......@@ -212,7 +212,6 @@ func (client *Client) ParseAndroidStorage() (present bool, err error) {
return
}
}
client.UnenrolledSchemeManagers = client.unenrolledSchemeManagers()
if err = client.storage.StorePaillierKeys(client.paillierKeyCache); err != nil {
return
......
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