Commit da1cdfe6 authored by Tomas's avatar Tomas
Browse files

More trivial renames: Ask -> Request, in SessionHandler

parent 5d3a2644
......@@ -17,7 +17,7 @@ import (
// KeysharePinRequestor is used to asking the user for his PIN.
type KeysharePinRequestor interface {
AskPin(remainingAttempts int, callback func(proceed bool, pin string))
RequestPin(remainingAttempts int, callback func(proceed bool, pin string))
}
type keyshareSessionHandler interface {
......@@ -173,7 +173,7 @@ func startKeyshareSession(
schemeManagers: schemeManagers,
}
askPin := false
requestPin := false
for _, managerID := range schemeManagers {
if !ks.store.SchemeManagers[managerID].Distributed() {
......@@ -195,14 +195,14 @@ func startKeyshareSession(
switch authstatus.Status {
case kssAuthorized: // nop
case kssTokenExpired:
askPin = true
requestPin = true
default:
ks.sessionHandler.KeyshareError(errors.New("Keyshare server returned unrecognized authorization status"))
return
}
}
if askPin {
if requestPin {
ks.VerifyPin(-1)
} else {
ks.GetCommitments()
......@@ -212,7 +212,7 @@ func startKeyshareSession(
// Ask for a pin, repeatedly if necessary, and either continue the keyshare protocol
// with authorization, or stop the keyshare protocol and inform of failure.
func (ks *keyshareSession) VerifyPin(attempts int) {
ks.pinRequestor.AskPin(attempts, func(proceed bool, pin string) {
ks.pinRequestor.RequestPin(attempts, func(proceed bool, pin string) {
success, attemptsRemaining, blocked, err := ks.verifyPinAttempt(pin)
if err != nil {
ks.sessionHandler.KeyshareError(err)
......
......@@ -25,11 +25,11 @@ type Handler interface {
Failure(action Action, err *SessionError)
UnsatisfiableRequest(action Action, missing AttributeDisjunctionList)
AskIssuancePermission(request IssuanceRequest, ServerName string, callback PermissionHandler)
AskVerificationPermission(request DisclosureRequest, ServerName string, callback PermissionHandler)
AskSignaturePermission(request SignatureRequest, ServerName string, callback PermissionHandler)
RequestIssuancePermission(request IssuanceRequest, ServerName string, callback PermissionHandler)
RequestVerificationPermission(request DisclosureRequest, ServerName string, callback PermissionHandler)
RequestSignaturePermission(request SignatureRequest, ServerName string, callback PermissionHandler)
AskPin(remainingAttempts int, callback func(proceed bool, pin string))
RequestPin(remainingAttempts int, callback func(proceed bool, pin string))
}
// A session is an IRMA session.
......@@ -179,11 +179,11 @@ func (session *session) start() {
session.Handler.StatusUpdate(session.Action, StatusConnected)
switch session.Action {
case ActionDisclosing:
session.Handler.AskVerificationPermission(*session.irmaSession.(*DisclosureRequest), server, callback)
session.Handler.RequestVerificationPermission(*session.irmaSession.(*DisclosureRequest), server, callback)
case ActionSigning:
session.Handler.AskSignaturePermission(*session.irmaSession.(*SignatureRequest), server, callback)
session.Handler.RequestSignaturePermission(*session.irmaSession.(*SignatureRequest), server, callback)
case ActionIssuing:
session.Handler.AskIssuancePermission(*session.irmaSession.(*IssuanceRequest), server, callback)
session.Handler.RequestIssuancePermission(*session.irmaSession.(*IssuanceRequest), server, callback)
default:
panic("Invalid session type") // does not happen, session.Action has been checked earlier
}
......
......@@ -38,7 +38,7 @@ func (th TestHandler) UnsatisfiableRequest(action Action, missing AttributeDisju
ErrorType: ErrorType("UnsatisfiableRequest"),
}
}
func (th TestHandler) AskVerificationPermission(request DisclosureRequest, ServerName string, callback PermissionHandler) {
func (th TestHandler) RequestVerificationPermission(request DisclosureRequest, ServerName string, callback PermissionHandler) {
choice := &DisclosureChoice{
Attributes: []*AttributeIdentifier{},
}
......@@ -51,17 +51,17 @@ func (th TestHandler) AskVerificationPermission(request DisclosureRequest, Serve
}
callback(true, choice)
}
func (th TestHandler) AskIssuancePermission(request IssuanceRequest, ServerName string, callback PermissionHandler) {
func (th TestHandler) RequestIssuancePermission(request IssuanceRequest, ServerName string, callback PermissionHandler) {
dreq := DisclosureRequest{
SessionRequest: request.SessionRequest,
Content: request.Disclose,
}
th.AskVerificationPermission(dreq, ServerName, callback)
th.RequestVerificationPermission(dreq, ServerName, callback)
}
func (th TestHandler) AskSignaturePermission(request SignatureRequest, ServerName string, callback PermissionHandler) {
th.AskVerificationPermission(request.DisclosureRequest, ServerName, callback)
func (th TestHandler) RequestSignaturePermission(request SignatureRequest, ServerName string, callback PermissionHandler) {
th.RequestVerificationPermission(request.DisclosureRequest, ServerName, callback)
}
func (th TestHandler) AskPin(remainingAttempts int, callback func(proceed bool, pin string)) {
func (th TestHandler) RequestPin(remainingAttempts int, callback func(proceed bool, pin string)) {
callback(true, "12345")
}
......
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