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
282c2382
Commit
282c2382
authored
Nov 02, 2018
by
Sietse Ringers
Browse files
WIP on new disclosure message
Co-authored-by:
David Venhoek
<
david@venhoek.nl
>
parent
21d89a4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
server/backend/api.go
View file @
282c2382
...
@@ -189,7 +189,7 @@ func HandleProtocolMessage(
...
@@ -189,7 +189,7 @@ func HandleProtocolMessage(
}
}
if
noun
==
"commitments"
&&
session
.
action
==
irma
.
ActionIssuing
{
if
noun
==
"commitments"
&&
session
.
action
==
irma
.
ActionIssuing
{
commitments
:=
&
gabi
.
IssueCommitmentMessage
{}
commitments
:=
&
irma
.
IssueCommitmentMessage
{}
if
err
:=
irma
.
UnmarshalValidate
(
message
,
commitments
);
err
!=
nil
{
if
err
:=
irma
.
UnmarshalValidate
(
message
,
commitments
);
err
!=
nil
{
status
,
output
=
server
.
JsonResponse
(
nil
,
session
.
fail
(
server
.
ErrorMalformedInput
,
""
))
status
,
output
=
server
.
JsonResponse
(
nil
,
session
.
fail
(
server
.
ErrorMalformedInput
,
""
))
return
return
...
@@ -198,12 +198,12 @@ func HandleProtocolMessage(
...
@@ -198,12 +198,12 @@ func HandleProtocolMessage(
return
return
}
}
if
noun
==
"proofs"
&&
session
.
action
==
irma
.
ActionDisclosing
{
if
noun
==
"proofs"
&&
session
.
action
==
irma
.
ActionDisclosing
{
proofs
:=
gabi
.
ProofList
{}
disclosure
:=
irma
.
Disclosure
{}
if
err
:=
irma
.
UnmarshalValidate
(
message
,
&
proofs
);
err
!=
nil
{
if
err
:=
irma
.
UnmarshalValidate
(
message
,
&
disclosure
);
err
!=
nil
{
status
,
output
=
server
.
JsonResponse
(
nil
,
session
.
fail
(
server
.
ErrorMalformedInput
,
""
))
status
,
output
=
server
.
JsonResponse
(
nil
,
session
.
fail
(
server
.
ErrorMalformedInput
,
""
))
return
return
}
}
status
,
output
=
server
.
JsonResponse
(
session
.
handlePost
Proofs
(
proofs
))
status
,
output
=
server
.
JsonResponse
(
session
.
handlePost
Disclosure
(
disclosure
))
return
return
}
}
if
noun
==
"proofs"
&&
session
.
action
==
irma
.
ActionSigning
{
if
noun
==
"proofs"
&&
session
.
action
==
irma
.
ActionSigning
{
...
...
server/backend/handle.go
View file @
282c2382
...
@@ -63,7 +63,7 @@ func (session *session) handlePostSignature(signature *irma.SignedMessage) (*irm
...
@@ -63,7 +63,7 @@ func (session *session) handlePostSignature(signature *irma.SignedMessage) (*irm
return
&
session
.
result
.
ProofStatus
,
rerr
return
&
session
.
result
.
ProofStatus
,
rerr
}
}
func
(
session
*
session
)
handlePost
Proofs
(
proofs
gabi
.
ProofList
)
(
*
irma
.
ProofStatus
,
*
irma
.
RemoteError
)
{
func
(
session
*
session
)
handlePost
Disclosure
(
disclosure
irma
.
Disclosure
)
(
*
irma
.
ProofStatus
,
*
irma
.
RemoteError
)
{
if
session
.
status
!=
server
.
StatusConnected
{
if
session
.
status
!=
server
.
StatusConnected
{
return
nil
,
server
.
RemoteError
(
server
.
ErrorUnexpectedRequest
,
"Session not yet started or already finished"
)
return
nil
,
server
.
RemoteError
(
server
.
ErrorUnexpectedRequest
,
"Session not yet started or already finished"
)
}
}
...
@@ -71,7 +71,7 @@ func (session *session) handlePostProofs(proofs gabi.ProofList) (*irma.ProofStat
...
@@ -71,7 +71,7 @@ func (session *session) handlePostProofs(proofs gabi.ProofList) (*irma.ProofStat
var
err
error
var
err
error
var
rerr
*
irma
.
RemoteError
var
rerr
*
irma
.
RemoteError
session
.
result
.
Disclosed
,
session
.
result
.
ProofStatus
,
err
=
irma
.
ProofList
(
proofs
)
.
Verify
(
session
.
result
.
Disclosed
,
session
.
result
.
ProofStatus
,
err
=
disclosure
.
Verify
(
conf
.
IrmaConfiguration
,
session
.
request
.
(
*
irma
.
DisclosureRequest
))
conf
.
IrmaConfiguration
,
session
.
request
.
(
*
irma
.
DisclosureRequest
))
if
err
==
nil
{
if
err
==
nil
{
session
.
setStatus
(
server
.
StatusDone
)
session
.
setStatus
(
server
.
StatusDone
)
...
@@ -86,7 +86,7 @@ func (session *session) handlePostProofs(proofs gabi.ProofList) (*irma.ProofStat
...
@@ -86,7 +86,7 @@ func (session *session) handlePostProofs(proofs gabi.ProofList) (*irma.ProofStat
return
&
session
.
result
.
ProofStatus
,
rerr
return
&
session
.
result
.
ProofStatus
,
rerr
}
}
func
(
session
*
session
)
handlePostCommitments
(
commitments
*
gabi
.
IssueCommitmentMessage
)
([]
*
gabi
.
IssueSignatureMessage
,
*
irma
.
RemoteError
)
{
func
(
session
*
session
)
handlePostCommitments
(
commitments
*
irma
.
IssueCommitmentMessage
)
([]
*
gabi
.
IssueSignatureMessage
,
*
irma
.
RemoteError
)
{
if
session
.
status
!=
server
.
StatusConnected
{
if
session
.
status
!=
server
.
StatusConnected
{
return
nil
,
server
.
RemoteError
(
server
.
ErrorUnexpectedRequest
,
"Session not yet started or already finished"
)
return
nil
,
server
.
RemoteError
(
server
.
ErrorUnexpectedRequest
,
"Session not yet started or already finished"
)
}
}
...
@@ -124,7 +124,7 @@ func (session *session) handlePostCommitments(commitments *gabi.IssueCommitmentM
...
@@ -124,7 +124,7 @@ func (session *session) handlePostCommitments(commitments *gabi.IssueCommitmentM
}
}
// Verify all proofs and check disclosed attributes, if any, against request
// Verify all proofs and check disclosed attributes, if any, against request
session
.
result
.
Disclosed
,
session
.
result
.
ProofStatus
,
err
=
irma
.
ProofList
(
commitments
.
Proofs
)
.
VerifyAgainstDisjunctions
(
session
.
result
.
Disclosed
,
session
.
result
.
ProofStatus
,
err
=
commitments
.
Disclosure
(
)
.
VerifyAgainstDisjunctions
(
conf
.
IrmaConfiguration
,
request
.
Disclose
,
request
.
Context
,
request
.
Nonce
,
pubkeys
,
false
)
conf
.
IrmaConfiguration
,
request
.
Disclose
,
request
.
Context
,
request
.
Nonce
,
pubkeys
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
if
err
==
irma
.
ErrorMissingPublicKey
{
if
err
==
irma
.
ErrorMissingPublicKey
{
...
...
server/backend/helpers.go
View file @
282c2382
...
@@ -72,7 +72,7 @@ func validateIssuanceRequest(request *irma.IssuanceRequest) error {
...
@@ -72,7 +72,7 @@ func validateIssuanceRequest(request *irma.IssuanceRequest) error {
return
nil
return
nil
}
}
func
(
session
*
session
)
getProofP
(
commitments
*
gabi
.
IssueCommitmentMessage
,
scheme
irma
.
SchemeManagerIdentifier
)
(
*
gabi
.
ProofP
,
error
)
{
func
(
session
*
session
)
getProofP
(
commitments
*
irma
.
IssueCommitmentMessage
,
scheme
irma
.
SchemeManagerIdentifier
)
(
*
gabi
.
ProofP
,
error
)
{
if
session
.
kssProofs
==
nil
{
if
session
.
kssProofs
==
nil
{
session
.
kssProofs
=
make
(
map
[
irma
.
SchemeManagerIdentifier
]
*
gabi
.
ProofP
)
session
.
kssProofs
=
make
(
map
[
irma
.
SchemeManagerIdentifier
]
*
gabi
.
ProofP
)
}
}
...
...
Write
Preview
Markdown
is supported
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