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
774e3097
Commit
774e3097
authored
Aug 28, 2018
by
Sietse Ringers
Browse files
Renaming server configuration fields
parent
4f1f1235
Changes
6
Hide whitespace changes
Inline
Side-by-side
internal/sessiontest/requestor_test.go
View file @
774e3097
...
...
@@ -25,7 +25,7 @@ func StartIrmaClientServer(t *testing.T) {
require
.
NoError
(
t
,
irmarequestor
.
Initialize
(
&
server
.
Configuration
{
Logger
:
logger
,
IrmaConfigurationPath
:
filepath
.
Join
(
testdata
,
"irma_configuration"
),
PrivateKeysPath
:
filepath
.
Join
(
testdata
,
"privatekeys"
),
Issuer
PrivateKeysPath
:
filepath
.
Join
(
testdata
,
"privatekeys"
),
}))
mux
:=
http
.
NewServeMux
()
...
...
internal/sessiontest/server_test.go
View file @
774e3097
...
...
@@ -26,7 +26,7 @@ func StartIrmaServer() {
Configuration
:
&
server
.
Configuration
{
Logger
:
logger
,
IrmaConfigurationPath
:
filepath
.
Join
(
testdata
,
"irma_configuration"
),
PrivateKeysPath
:
filepath
.
Join
(
testdata
,
"privatekeys"
),
Issuer
PrivateKeysPath
:
filepath
.
Join
(
testdata
,
"privatekeys"
),
},
Port
:
48682
,
})
...
...
server/api.go
View file @
774e3097
...
...
@@ -14,12 +14,12 @@ var Logger *logrus.Logger = logrus.StandardLogger()
type
Configuration
struct
{
IrmaConfigurationPath
string
PrivateKeysPath
string
Issuer
PrivateKeysPath
string
Logger
*
logrus
.
Logger
Logger
*
logrus
.
Logger
`json:"-"`
PrivateKeys
map
[
irma
.
IssuerIdentifier
]
*
gabi
.
PrivateKey
IrmaConfiguration
*
irma
.
Configuration
Issuer
PrivateKeys
map
[
irma
.
IssuerIdentifier
]
*
gabi
.
PrivateKey
`json:"-"`
IrmaConfiguration
*
irma
.
Configuration
`json:"-"`
}
type
SessionResult
struct
{
...
...
server/backend/api.go
View file @
774e3097
...
...
@@ -37,11 +37,11 @@ func Initialize(configuration *server.Configuration) error {
}
}
if
conf
.
PrivateKeys
==
nil
{
conf
.
PrivateKeys
=
make
(
map
[
irma
.
IssuerIdentifier
]
*
gabi
.
PrivateKey
)
if
conf
.
Issuer
PrivateKeys
==
nil
{
conf
.
Issuer
PrivateKeys
=
make
(
map
[
irma
.
IssuerIdentifier
]
*
gabi
.
PrivateKey
)
}
if
conf
.
PrivateKeysPath
!=
""
{
files
,
err
:=
ioutil
.
ReadDir
(
conf
.
PrivateKeysPath
)
if
conf
.
Issuer
PrivateKeysPath
!=
""
{
files
,
err
:=
ioutil
.
ReadDir
(
conf
.
Issuer
PrivateKeysPath
)
if
err
!=
nil
{
return
err
}
...
...
@@ -51,14 +51,14 @@ func Initialize(configuration *server.Configuration) error {
if
_
,
ok
:=
conf
.
IrmaConfiguration
.
Issuers
[
issid
];
!
ok
{
return
errors
.
Errorf
(
"Private key %s belongs to an unknown issuer"
,
filename
)
}
sk
,
err
:=
gabi
.
NewPrivateKeyFromFile
(
filepath
.
Join
(
conf
.
PrivateKeysPath
,
filename
))
sk
,
err
:=
gabi
.
NewPrivateKeyFromFile
(
filepath
.
Join
(
conf
.
Issuer
PrivateKeysPath
,
filename
))
if
err
!=
nil
{
return
err
}
conf
.
PrivateKeys
[
issid
]
=
sk
conf
.
Issuer
PrivateKeys
[
issid
]
=
sk
}
}
for
issid
,
sk
:=
range
conf
.
PrivateKeys
{
for
issid
,
sk
:=
range
conf
.
Issuer
PrivateKeys
{
pk
,
err
:=
conf
.
IrmaConfiguration
.
PublicKey
(
issid
,
int
(
sk
.
Counter
))
if
err
!=
nil
{
return
err
...
...
server/backend/handle.go
View file @
774e3097
...
...
@@ -145,7 +145,7 @@ func (session *session) handlePostCommitments(commitments *gabi.IssueCommitmentM
for
i
,
cred
:=
range
request
.
Credentials
{
id
:=
cred
.
CredentialTypeID
.
IssuerIdentifier
()
pk
,
_
:=
conf
.
IrmaConfiguration
.
PublicKey
(
id
,
cred
.
KeyCounter
)
issuer
:=
gabi
.
NewIssuer
(
conf
.
PrivateKeys
[
id
],
pk
,
one
)
issuer
:=
gabi
.
NewIssuer
(
conf
.
Issuer
PrivateKeys
[
id
],
pk
,
one
)
proof
:=
commitments
.
Proofs
[
i
+
discloseCount
]
.
(
*
gabi
.
ProofU
)
attributes
,
err
:=
cred
.
AttributeList
(
conf
.
IrmaConfiguration
,
0x03
)
if
err
!=
nil
{
...
...
server/backend/helpers.go
View file @
774e3097
...
...
@@ -41,7 +41,7 @@ func validateIssuanceRequest(request *irma.IssuanceRequest) error {
for
_
,
cred
:=
range
request
.
Credentials
{
// Check that we have the appropriate private key
iss
:=
cred
.
CredentialTypeID
.
IssuerIdentifier
()
privatekey
,
havekey
:=
conf
.
PrivateKeys
[
iss
]
privatekey
,
havekey
:=
conf
.
Issuer
PrivateKeys
[
iss
]
if
!
havekey
{
return
errors
.
Errorf
(
"missing private key of issuer %s"
,
iss
.
String
())
}
...
...
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