Skip to content
GitLab
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
f3c64f10
Commit
f3c64f10
authored
Dec 26, 2018
by
Sietse Ringers
Browse files
Make downloading default schemes configurable in library
parent
dd543638
Changes
3
Hide whitespace changes
Inline
Side-by-side
schemes.go
View file @
f3c64f10
...
...
@@ -23,7 +23,7 @@ dpBeCqpDwf+Grrw9ReODb6nwlsPJ/c/gqLnc+Y3sKOAJ2bFGI+jHBSsglg==
}
func
(
conf
*
Configuration
)
DownloadDefaultSchemes
()
error
{
Logger
.
Info
(
"
No schemes found in irma_configuration,
downloading default schemes"
)
Logger
.
Info
(
"downloading default schemes"
)
for
_
,
s
:=
range
DefaultSchemeManagers
{
Logger
.
Debugf
(
"Downloading scheme at %s"
,
s
.
Url
)
scheme
,
err
:=
DownloadSchemeManager
(
s
.
Url
)
...
...
server/api.go
View file @
f3c64f10
...
...
@@ -24,8 +24,10 @@ type Configuration struct {
IrmaConfiguration
*
irma
.
Configuration
`json:"-"`
// Path to schemes to parse (only used if IrmaConfiguration is not given)
IrmaConfigurationPath
string
`json:"irmaconf" mapstructure:"irmaconf"`
// Path to writable dir to write cache to (only used if IrmaConfiguration is not give)
// Path to writable dir to write cache to (only used if IrmaConfiguration is not give
n
)
CachePath
string
`json:"cachepath" mapstructure:"cachepath"`
// Whether or not to download default IRMA schemes if the specified irma_configuration is empty
DownloadDefaultSchemes
bool
// Path to issuer private keys to parse
IssuerPrivateKeysPath
string
`json:"privatekeys" mapstructure:"privatekeys"`
// Issuer private keys
...
...
@@ -173,9 +175,9 @@ func LocalIP() (string, error) {
func
CachePath
()
(
string
,
error
)
{
candidates
:=
make
([]
string
,
0
,
2
)
if
runtime
.
GOOS
!=
"windows"
{
candidates
=
append
(
candidates
,
filepath
.
Join
(
"/var/tmp"
,
"irma
server
"
))
candidates
=
append
(
candidates
,
filepath
.
Join
(
"/var/tmp"
,
"irma"
))
}
candidates
=
append
(
candidates
,
filepath
.
Join
(
os
.
TempDir
(),
"irma
server
"
))
candidates
=
append
(
candidates
,
filepath
.
Join
(
os
.
TempDir
(),
"irma"
))
path
:=
firstWritablePath
(
candidates
)
if
path
==
""
{
return
""
,
errors
.
New
(
"No writable temporary directory found"
)
...
...
server/core/api.go
View file @
f3c64f10
...
...
@@ -44,21 +44,21 @@ func Initialize(configuration *server.Configuration) error {
if
err
!=
nil
{
return
err
}
if
conf
.
IrmaConfigurationPath
==
""
{
if
err
=
conf
.
IrmaConfiguration
.
ParseFolder
();
err
!=
nil
{
return
err
}
}
if
len
(
conf
.
IrmaConfiguration
.
SchemeManagers
)
==
0
{
if
conf
.
DownloadDefaultSchemes
{
if
err
:=
conf
.
IrmaConfiguration
.
DownloadDefaultSchemes
();
err
!=
nil
{
return
err
}
}
else
{
if
err
=
conf
.
IrmaConfiguration
.
ParseFolder
();
err
!=
nil
{
return
err
}
return
errors
.
New
(
"no schemes found in irma_configuration folder "
+
conf
.
IrmaConfiguration
.
Path
)
}
}
if
len
(
conf
.
IrmaConfiguration
.
SchemeManagers
)
==
0
{
return
errors
.
New
(
"no schemes found in irma_configuration folder "
+
conf
.
IrmaConfiguration
.
Path
)
}
if
conf
.
IssuerPrivateKeys
==
nil
{
conf
.
IssuerPrivateKeys
=
make
(
map
[
irma
.
IssuerIdentifier
]
*
gabi
.
PrivateKey
)
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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