Unverified Commit 1e5db54d authored by Sietse Ringers's avatar Sietse Ringers Committed by GitHub
Browse files

Merge pull request #3 from bwesterb/master

Kleine aanpassingen nodig voor irma-watchdogd
parents d2f901ef 58c50888
......@@ -615,7 +615,7 @@ func (i SchemeManagerIndex) FromString(s string) error {
func (conf *Configuration) parseIndex(name string, manager *SchemeManager) error {
path := filepath.Join(conf.path, name, "index")
if err := fs.AssertPathExists(path); err != nil {
return errors.New("Missing scheme manager index file")
return fmt.Errorf("Missing scheme manager index file; tried %s", path)
}
indexbts, err := ioutil.ReadFile(path)
if err != nil {
......
......@@ -17,35 +17,41 @@ var verifyCmd = &cobra.Command{
Long: `The verify command parses the specified irma_configuration folder and checks the signatures of the contained scheme managers.`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
path, err := filepath.Abs(args[0])
if err != nil {
return err
}
if filepath.Base(path) != "irma_configuration" {
return errors.New("Path is not irma_configuration")
}
conf, err := irma.NewConfiguration(path, "")
if err != nil {
return err
}
if err := conf.ParseFolder(); err != nil {
return err
err := RunVerify(args[0])
if err == nil {
fmt.Println()
fmt.Println("irma_configuration parsed and authenticated successfully.")
}
return err
},
}
for _, manager := range conf.SchemeManagers {
for file := range manager.Index {
// Don't care about the actual bytes
if _, err := conf.ReadAuthenticatedFile(manager, file); err != nil {
return err
}
func RunVerify(path string) error {
path, err := filepath.Abs(path)
if err != nil {
return err
}
if filepath.Base(path) != "irma_configuration" {
return errors.New("Path is not irma_configuration")
}
conf, err := irma.NewConfiguration(path, "")
if err != nil {
return err
}
if err := conf.ParseFolder(); err != nil {
return err
}
for _, manager := range conf.SchemeManagers {
for file := range manager.Index {
// Don't care about the actual bytes
if _, err := conf.ReadAuthenticatedFile(manager, file); err != nil {
return err
}
}
fmt.Println()
fmt.Println("irma_configuration parsed and authenticated successfully.")
return nil
},
}
return nil
}
func init() {
......
Supports Markdown
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