Commit db2b06f4 authored by Sietse Ringers's avatar Sietse Ringers Committed by David Venhoek
Browse files

fix: always use keyshare server url from scheme

parent c06d7cc3
......@@ -726,7 +726,7 @@ func (client *Client) keyshareEnrollWorker(managerID irma.SchemeManagerIdentifie
}
transport := irma.NewHTTPTransport(manager.KeyshareServer)
kss, err := newKeyshareServer(managerID, manager.KeyshareServer)
kss, err := newKeyshareServer(managerID)
if err != nil {
return err
}
......@@ -770,7 +770,7 @@ func (client *Client) KeyshareVerifyPin(pin string, schemeid irma.SchemeManagerI
}
}
kss := client.keyshareServers[schemeid]
return verifyPinWorker(pin, kss, irma.NewHTTPTransport(kss.URL))
return verifyPinWorker(pin, kss, irma.NewHTTPTransport(scheme.KeyshareServer))
}
func (client *Client) KeyshareChangePin(manager irma.SchemeManagerIdentifier, oldPin string, newPin string) {
......@@ -788,7 +788,7 @@ func (client *Client) keyshareChangePinWorker(managerID irma.SchemeManagerIdenti
return errors.New("Unknown keyshare server")
}
transport := irma.NewHTTPTransport(kss.URL)
transport := irma.NewHTTPTransport(client.Configuration.SchemeManagers[managerID].KeyshareServer)
message := keyshareChangepin{
Username: kss.Username,
OldPin: kss.HashedPin(oldPin),
......
......@@ -52,7 +52,6 @@ type keyshareSession struct {
}
type keyshareServer struct {
URL string `json:"url"`
Username string `json:"username"`
Nonce []byte `json:"nonce"`
SchemeManagerIdentifier irma.SchemeManagerIdentifier
......@@ -125,13 +124,9 @@ const (
kssPinError = "error"
)
func newKeyshareServer(
schemeManagerIdentifier irma.SchemeManagerIdentifier,
url string,
) (ks *keyshareServer, err error) {
func newKeyshareServer(schemeManagerIdentifier irma.SchemeManagerIdentifier) (ks *keyshareServer, err error) {
ks = &keyshareServer{
Nonce: make([]byte, 32),
URL: url,
SchemeManagerIdentifier: schemeManagerIdentifier,
}
_, err = rand.Read(ks.Nonce)
......@@ -190,12 +185,13 @@ func startKeyshareSession(
}
for managerID := range session.Identifiers().SchemeManagers {
if !ks.conf.SchemeManagers[managerID].Distributed() {
scheme := ks.conf.SchemeManagers[managerID]
if !scheme.Distributed() {
continue
}
ks.keyshareServer = ks.keyshareServers[managerID]
transport := irma.NewHTTPTransport(ks.keyshareServer.URL)
transport := irma.NewHTTPTransport(scheme.KeyshareServer)
transport.SetHeader(kssUsernameHeader, ks.keyshareServer.Username)
transport.SetHeader(kssAuthHeader, "Bearer "+ks.keyshareServer.token)
transport.SetHeader(kssVersionHeader, "2")
......
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