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

Changed private key code to run on every update that changes files.

parent 6d25eaad
......@@ -18,6 +18,7 @@ type SchemeManager struct {
Name TranslatedString `xml:"Name"`
URL string `xml:"Url"`
Contact string `xml:"contact"`
Demo bool `xml:"Demo"` // Decides whether to download private keys
Description TranslatedString
MinimumAppVersion SchemeAppVersion
KeyshareServer string
......
......@@ -1261,6 +1261,14 @@ func (conf *Configuration) UpdateSchemeManager(id SchemeManagerIdentifier, downl
}
manager.index = newIndex
if manager.Demo {
// Download private keys if needed.
// These are unsigned so partial download isn't really an option.
if err := conf.downloadPrivateKeys(manager); err != nil {
return err
}
}
return
}
......
......@@ -9,14 +9,12 @@ import (
// including its (pinned) public key.
type SchemeManagerPointer struct {
Url string // URL to download scheme from
Demo bool // Whether or not this is a demo scheme; if true, private keys are also downloaded
Publickey []byte // Public key of scheme against which to verify files after they have been downloaded
}
var DefaultSchemeManagers = [2]SchemeManagerPointer{
{
Url: "https://privacybydesign.foundation/schememanager/irma-demo",
Demo: true,
Publickey: []byte(`-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHVnmAY+kGkFZn7XXozdI4HY8GOjm
54ngh4chTfn6WsTCf2w5rprfIqML61z2VTE4k8yJ0Z1QbyW6cdaao8obTQ==
......@@ -42,11 +40,6 @@ func (conf *Configuration) DownloadDefaultSchemes() error {
if err := conf.InstallSchemeManager(scheme, s.Publickey); err != nil {
return err
}
if s.Demo {
if err := conf.downloadPrivateKeys(scheme); err != nil {
return err
}
}
}
Logger.Info("Finished downloading schemes")
return 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