Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonbotros committed Jul 21, 2020
1 parent 6496aab commit 6e0e226
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 25 deletions.
12 changes: 6 additions & 6 deletions attributes.go
Expand Up @@ -157,13 +157,13 @@ func NewTranslatedString(attr *string) TranslatedString {
}

func decodeRandomBlind(attr *big.Int) *string {
if attr != nil {
var s string
enc, _ := basex.NewEncoding(alph)
s = enc.Encode(attr.Bytes())
return &s
if attr == nil {
return nil
}
return nil
var s string
enc, _ := basex.NewEncoding(alph)
s = enc.Encode(attr.Bytes())
return &s
}

func (al *AttributeList) decode(i int) *string {
Expand Down
9 changes: 3 additions & 6 deletions internal/sessiontest/session_test.go
Expand Up @@ -11,6 +11,7 @@ import (
"testing"
"time"

"github.com/privacybydesign/gabi/big"
"github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/internal/test"
"github.com/privacybydesign/irmago/irmaclient"
Expand Down Expand Up @@ -504,12 +505,10 @@ func TestBlindIssuanceSession(t *testing.T) {
require.Truef(t, client.Configuration.ContainsAttributeType(attrID1), "AttributeType %s not found", attrID1)

require.True(t, client.Configuration.AttributeTypes[attrID2].RandomBlind, "AttributeType votingnumber is not of type random blind")
expiry := irma.Timestamp(irma.NewMetadataAttribute(0).Expiry())

// this request should give an error by the server that the random blind attribute should not be in the credentialrequest
request := irma.NewIssuanceRequest([]*irma.CredentialRequest{
{
Validity: &expiry,
CredentialTypeID: credID,
Attributes: map[string]string{
"election": "plantsoen",
Expand All @@ -518,11 +517,8 @@ func TestBlindIssuanceSession(t *testing.T) {
},
})

serverChan := make(chan *server.SessionResult)
StartIrmaServer(t, false, "")
_, _, err := irmaServer.StartSession(request, func(result *server.SessionResult) {
serverChan <- result
})
_, _, err := irmaServer.StartSession(request, nil)
require.EqualError(t, err, "randomblind attribute cannot be set in credential request")
StopIrmaServer()

Expand All @@ -536,6 +532,7 @@ func TestBlindIssuanceSession(t *testing.T) {
// we should have {metadata attribute, election, votingnumber}.
require.Equal(t, 3, len(attrList.Ints), "number of attributes in credential should be 3")
require.NotNil(t, attrList.Ints[2], "randomblind attribute should not be nil")
require.NotEqual(t, 0, attrList.Ints[2].Cmp(big.NewInt(0)), "random blind attribute should not equal zero")
require.NoError(t, client.Close())
}

Expand Down
3 changes: 1 addition & 2 deletions irmaclient/client.go
Expand Up @@ -890,8 +890,7 @@ func (client *Client) IssuanceProofBuilders(request *irma.IssuanceRequest, choic
if err != nil {
return nil, nil, nil, err
}
credID := futurecred.CredentialTypeID
credInfo := client.Configuration.CredentialTypes[credID]
credInfo := client.Configuration.CredentialTypes[futurecred.CredentialTypeID]
credBuilder := gabi.NewCredentialBuilder(pk, request.GetContext(),
client.secretkey.Key, issuerProofNonce, credInfo.RandomBlinds())
builders = append(builders, credBuilder)
Expand Down
6 changes: 1 addition & 5 deletions requests.go
Expand Up @@ -643,11 +643,7 @@ func (cr *CredentialRequest) AttributeList(
}
}
for i, attrtype := range credtype.AttributeTypes {
if attrtype.RevocationAttribute {
continue
}
if attrtype.RandomBlind {
attrs[i+1] = nil
if attrtype.RevocationAttribute || attrtype.RandomBlind {
continue
}
attrs[i+1] = new(big.Int)
Expand Down
4 changes: 2 additions & 2 deletions testdata/irma_configuration/irma-demo/index
Expand Up @@ -21,5 +21,5 @@ c97523a8c0760d95a8faecf11f9ed855dcd5d3d70e50897f26e8137a9d4dfcbb irma-demo/stemm
1a1078dcd7d22e4a30ab34d53a7509256196a470baa883a92c99c073c40690af irma-demo/stemmen/Issues/stempas/logo.png
7657171e97f6c327ba6e4040c291e014258dfb720050e195f6acb95b14582bb5 irma-demo/stemmen/PublicKeys/0.xml
289ac40d8554fd8f31f4684bd9e34629e3d515cf8e1b3622d8803efa93636bba irma-demo/stemmen/description.xml
98890971f8b4607543577dab5fba51d178154e4cdb27f8faa9f114be29b66390 irma-demo/stemmen/logo.png
81619338bb5d750fa48de7b8ecb021e2d8877a84b134f21fee68b71771fe743c irma-demo/timestamp
1a1078dcd7d22e4a30ab34d53a7509256196a470baa883a92c99c073c40690af irma-demo/stemmen/logo.png
533dc3c8aa079170727bbb0b64ef52613b88fde47e43114fc6941167ce890d8d irma-demo/timestamp
Binary file modified testdata/irma_configuration/irma-demo/index.sig
Binary file not shown.
Binary file modified testdata/irma_configuration/irma-demo/stemmen/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion testdata/irma_configuration/irma-demo/timestamp
@@ -1 +1 @@
1594804845
1595321132
4 changes: 2 additions & 2 deletions testdata/irma_configuration_updated/irma-demo/index
Expand Up @@ -21,5 +21,5 @@ c97523a8c0760d95a8faecf11f9ed855dcd5d3d70e50897f26e8137a9d4dfcbb irma-demo/stemm
1a1078dcd7d22e4a30ab34d53a7509256196a470baa883a92c99c073c40690af irma-demo/stemmen/Issues/stempas/logo.png
7657171e97f6c327ba6e4040c291e014258dfb720050e195f6acb95b14582bb5 irma-demo/stemmen/PublicKeys/0.xml
289ac40d8554fd8f31f4684bd9e34629e3d515cf8e1b3622d8803efa93636bba irma-demo/stemmen/description.xml
98890971f8b4607543577dab5fba51d178154e4cdb27f8faa9f114be29b66390 irma-demo/stemmen/logo.png
45570eb0d3ff84d1da50c38d0e796d314294e44ef9e81e1637581398318d01bc irma-demo/timestamp
1a1078dcd7d22e4a30ab34d53a7509256196a470baa883a92c99c073c40690af irma-demo/stemmen/logo.png
1a96225b8d3b1e2af6ce9c7a216d72378c23d6375767a80e8fd4114346c1e623 irma-demo/timestamp
Binary file modified testdata/irma_configuration_updated/irma-demo/index.sig
Binary file not shown.
Binary file modified testdata/irma_configuration_updated/irma-demo/stemmen/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion testdata/irma_configuration_updated/irma-demo/timestamp
@@ -1 +1 @@
1594804863
1595321511

0 comments on commit 6e0e226

Please sign in to comment.