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
7508e351
Commit
7508e351
authored
Jul 03, 2018
by
Sietse Ringers
Browse files
Merge branch 'master' into scheme-updating
parents
02c73f36
6ca9a8fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
irmaclient/client.go
View file @
7508e351
...
...
@@ -5,6 +5,7 @@ import (
"math/big"
"sort"
"time"
"strconv"
"github.com/credentials/go-go-gadget-paillier"
raven
"github.com/getsentry/raven-go"
...
...
@@ -82,7 +83,8 @@ type KeyshareHandler interface {
type
ChangePinHandler
interface
{
ChangePinFailure
(
manager
irma
.
SchemeManagerIdentifier
,
err
error
)
ChangePinSuccess
(
manager
irma
.
SchemeManagerIdentifier
)
ChangePinIncorrect
(
manager
irma
.
SchemeManagerIdentifier
)
ChangePinIncorrect
(
manager
irma
.
SchemeManagerIdentifier
,
attempts
int
)
ChangePinBlocked
(
manager
irma
.
SchemeManagerIdentifier
,
timeout
int
)
}
// ClientHandler informs the user that the configuration or the list of attributes
...
...
@@ -781,10 +783,23 @@ func (client *Client) keyshareChangePinWorker(managerID irma.SchemeManagerIdenti
return
err
}
if
res
.
Status
!=
kssPinSuccess
{
client
.
handler
.
ChangePinIncorrect
(
managerID
)
}
else
{
switch
res
.
Status
{
case
kssPinSuccess
:
client
.
handler
.
ChangePinSuccess
(
managerID
)
case
kssPinFailure
:
attempts
,
err
:=
strconv
.
Atoi
(
res
.
Message
)
if
err
!=
nil
{
return
err
}
client
.
handler
.
ChangePinIncorrect
(
managerID
,
attempts
)
case
kssPinError
:
timeout
,
err
:=
strconv
.
Atoi
(
res
.
Message
)
if
err
!=
nil
{
return
err
}
client
.
handler
.
ChangePinBlocked
(
managerID
,
timeout
)
default
:
return
errors
.
New
(
"Unknown keyshare response"
)
}
return
nil
...
...
irmaclient/irmaclient_test.go
View file @
7508e351
...
...
@@ -60,7 +60,7 @@ func (i *TestClientHandler) ChangePinFailure(manager irma.SchemeManagerIdentifie
i
.
t
.
Fatal
(
err
)
}
}
func
(
i
*
TestClientHandler
)
ChangePinIncorrect
(
manager
irma
.
SchemeManagerIdentifier
)
{
func
(
i
*
TestClientHandler
)
ChangePinIncorrect
(
manager
irma
.
SchemeManagerIdentifier
,
attempts
int
)
{
err
:=
errors
.
New
(
"incorrect pin"
)
select
{
case
i
.
c
<-
err
:
//nop
...
...
@@ -68,6 +68,14 @@ func (i *TestClientHandler) ChangePinIncorrect(manager irma.SchemeManagerIdentif
i
.
t
.
Fatal
(
err
)
}
}
func
(
i
*
TestClientHandler
)
ChangePinBlocked
(
manager
irma
.
SchemeManagerIdentifier
,
timeout
int
)
{
err
:=
errors
.
New
(
"blocked account"
)
select
{
case
i
.
c
<-
err
:
//nop
default
:
i
.
t
.
Fatal
(
err
)
}
}
func
parseStorage
(
t
*
testing
.
T
)
*
Client
{
require
.
NoError
(
t
,
fs
.
CopyDirectory
(
"../testdata/teststorage"
,
"../testdata/storage/test"
))
...
...
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