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
62d56a9a
Commit
62d56a9a
authored
Apr 17, 2021
by
Sietse Ringers
Browse files
feat: errors during issuer key processing during keyshare server startup are now fatal
parent
ab530b37
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/keyshare/keyshareserver/server.go
View file @
62d56a9a
...
...
@@ -13,6 +13,8 @@ import (
"sync"
"time"
"github.com/go-errors/errors"
"github.com/hashicorp/go-multierror"
"github.com/jasonlvhit/gocron"
"github.com/privacybydesign/gabi"
"github.com/privacybydesign/gabi/big"
...
...
@@ -73,9 +75,15 @@ func New(conf *Configuration) (*Server, error) {
// Load neccessary idemix keys into core, and ensure that future updates
// to them are processed
s
.
LoadIdemixKeys
(
conf
.
IrmaConfiguration
)
conf
.
IrmaConfiguration
.
UpdateListeners
=
append
(
conf
.
IrmaConfiguration
.
UpdateListeners
,
s
.
LoadIdemixKeys
)
if
err
=
s
.
LoadIdemixKeys
(
conf
.
IrmaConfiguration
);
err
!=
nil
{
return
nil
,
err
}
conf
.
IrmaConfiguration
.
UpdateListeners
=
append
(
conf
.
IrmaConfiguration
.
UpdateListeners
,
func
(
conf
*
irma
.
Configuration
)
{
if
err
:=
s
.
LoadIdemixKeys
(
conf
);
err
!=
nil
{
// run periodically; can only log the error here
_
=
server
.
LogError
(
err
)
}
})
// Setup DB
s
.
db
=
conf
.
DB
...
...
@@ -135,22 +143,24 @@ func (s *Server) Handler() http.Handler {
// On configuration changes, inform the keyshare core of any
// new IRMA issuer public keys.
func
(
s
*
Server
)
LoadIdemixKeys
(
conf
*
irma
.
Configuration
)
{
func
(
s
*
Server
)
LoadIdemixKeys
(
conf
*
irma
.
Configuration
)
error
{
errs
:=
multierror
.
Error
{}
for
_
,
issuer
:=
range
conf
.
Issuers
{
keyIDs
,
err
:=
conf
.
PublicKeyIndices
(
issuer
.
Identifier
())
if
err
!=
nil
{
s
.
conf
.
Logger
.
WithFields
(
logrus
.
Fields
{
"issuer"
:
issuer
,
"
error
"
:
err
})
.
Warn
(
"C
ould not find keyIDs
for
issuer
"
)
errs
.
Errors
=
append
(
errs
.
Errors
,
error
s
.
Errorf
(
"issuer %v: c
ould not find key
IDs
: %v"
,
issuer
,
err
)
)
continue
}
for
_
,
id
:=
range
keyIDs
{
key
,
err
:=
conf
.
PublicKey
(
issuer
.
Identifier
(),
id
)
if
err
!=
nil
{
s
.
conf
.
Logger
.
WithFields
(
logrus
.
Fields
{
"keyID"
:
id
,
"
er
ror"
:
err
})
.
Warn
(
"C
ould not fetch public key
for
issuer
"
)
errs
.
Errors
=
append
(
errs
.
Errors
,
s
er
ver
.
LogError
(
errors
.
Errorf
(
"key %v-%v: c
ould not fetch public key
: %v"
,
issuer
,
id
,
err
))
)
continue
}
s
.
core
.
DangerousAddTrustedPublicKey
(
irma
.
PublicKeyIdentifier
{
Issuer
:
issuer
.
Identifier
(),
Counter
:
uint
(
id
)
},
key
)
s
.
core
.
DangerousAddTrustedPublicKey
(
irma
.
PublicKeyIdentifier
{
Issuer
:
issuer
.
Identifier
(),
Counter
:
id
},
key
)
}
}
return
errs
.
ErrorOrNil
()
}
// /prove/getCommitments
...
...
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