Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
58c50888
Commit
58c50888
authored
Dec 15, 2017
by
Bas Westerbaan
Browse files
schememgr: split verify action into public function
parent
b3f1e2dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
schememgr/cmd/verify.go
View file @
58c50888
...
...
@@ -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
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment