Commit 1d9c696d authored by David Venhoek's avatar David Venhoek
Browse files

Changed capitalisation of ChangePin to be consistent.

parent 24f32567
......@@ -80,17 +80,17 @@ type KeyshareHandler interface {
EnrollmentSuccess(manager irma.SchemeManagerIdentifier)
}
type ChangepinHandler interface {
ChangepinFailure(manager irma.SchemeManagerIdentifier, err error)
ChangepinSuccess(manager irma.SchemeManagerIdentifier)
ChangepinIncorrect(manager irma.SchemeManagerIdentifier)
type ChangePinHandler interface {
ChangePinFailure(manager irma.SchemeManagerIdentifier, err error)
ChangePinSuccess(manager irma.SchemeManagerIdentifier)
ChangePinIncorrect(manager irma.SchemeManagerIdentifier)
}
// ClientHandler informs the user that the configuration or the list of attributes
// that this client uses has been updated.
type ClientHandler interface {
KeyshareHandler
ChangepinHandler
ChangePinHandler
UpdateConfiguration(new *irma.IrmaIdentifierSet)
UpdateAttributes()
......@@ -755,16 +755,16 @@ func (client *Client) keyshareEnrollWorker(managerID irma.SchemeManagerIdentifie
return nil
}
func (client *Client) KeyshareChangepin(manager irma.SchemeManagerIdentifier, oldpin string, newpin string) {
func (client *Client) KeyshareChangePin(manager irma.SchemeManagerIdentifier, oldPin string, newPin string) {
go func() {
err := client.keyshareChangepinWorker(manager, oldpin, newpin)
err := client.keyshareChangePinWorker(manager, oldPin, newPin)
if err != nil {
client.handler.ChangepinFailure(manager, err)
client.handler.ChangePinFailure(manager, err)
}
}()
}
func (client *Client) keyshareChangepinWorker(managerID irma.SchemeManagerIdentifier, oldpin string, newpin string) error {
func (client *Client) keyshareChangePinWorker(managerID irma.SchemeManagerIdentifier, oldPin string, newPin string) error {
kss, ok := client.keyshareServers[managerID]
if !ok {
return errors.New("Unknown keyshare server")
......@@ -773,8 +773,8 @@ func (client *Client) keyshareChangepinWorker(managerID irma.SchemeManagerIdenti
transport := irma.NewHTTPTransport(kss.URL)
message := keyshareChangepin{
Username: kss.Username,
Oldpin: kss.HashedPin(oldpin),
Newpin: kss.HashedPin(newpin),
OldPin: kss.HashedPin(oldPin),
NewPin: kss.HashedPin(newPin),
}
res := &keysharePinStatus{}
......@@ -784,9 +784,9 @@ func (client *Client) keyshareChangepinWorker(managerID irma.SchemeManagerIdenti
}
if res.Status != kssPinSuccess {
client.handler.ChangepinIncorrect(managerID)
client.handler.ChangePinIncorrect(managerID)
} else {
client.handler.ChangepinSuccess(managerID)
client.handler.ChangePinSuccess(managerID)
}
return nil
......
......@@ -42,20 +42,20 @@ func (i *TestClientHandler) EnrollmentFailure(manager irma.SchemeManagerIdentifi
i.t.Fatal(err)
}
}
func (i *TestClientHandler) ChangepinSuccess(manager irma.SchemeManagerIdentifier) {
func (i *TestClientHandler) ChangePinSuccess(manager irma.SchemeManagerIdentifier) {
select {
case i.c <- nil: // nop
default: // nop
}
}
func (i *TestClientHandler) ChangepinFailure(manager irma.SchemeManagerIdentifier, err error) {
func (i *TestClientHandler) ChangePinFailure(manager irma.SchemeManagerIdentifier, err error) {
select {
case i.c <- err: //nop
default:
i.t.Fatal(err)
}
}
func (i *TestClientHandler) ChangepinIncorrect(manager irma.SchemeManagerIdentifier) {
func (i *TestClientHandler) ChangePinIncorrect(manager irma.SchemeManagerIdentifier) {
err := errors.New("incorrect pin")
select {
case i.c <- err: //nop
......
......@@ -64,8 +64,8 @@ type keyshareEnrollment struct {
type keyshareChangepin struct {
Username string `json:"id"`
Oldpin string `json:"oldpin"`
Newpin string `json:"newpin"`
OldPin string `json:"oldpin"`
NewPin string `json:"newpin"`
}
type keyshareAuthorization struct {
......
......@@ -367,11 +367,11 @@ func keyshareSessions(t *testing.T, client *Client) {
}
// Test pinchange interaction
func TestKeyshareChangepin(t *testing.T) {
func TestKeyshareChangePin(t *testing.T) {
client := parseStorage(t)
require.NoError(t, client.keyshareChangepinWorker(irma.NewSchemeManagerIdentifier("test"), "12345", "54321"));
require.NoError(t, client.keyshareChangepinWorker(irma.NewSchemeManagerIdentifier("test"), "54321", "12345"));
require.NoError(t, client.keyshareChangePinWorker(irma.NewSchemeManagerIdentifier("test"), "12345", "54321"));
require.NoError(t, client.keyshareChangePinWorker(irma.NewSchemeManagerIdentifier("test"), "54321", "12345"));
test.ClearTestStorage(t)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment