Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Eerly returns instead of if/else
Browse files Browse the repository at this point in the history
  • Loading branch information
leonbotros authored and sietseringers committed Jan 30, 2020
1 parent 04674a6 commit e8b56d2
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions irmagobridge/session_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,61 +118,61 @@ func (sh *SessionHandler) RequestIssuancePermission(request *irma.IssuanceReques
err := CheckContainsCredentialIdentifiers(request.Disclosure())
if err != nil {
sh.Failure(err)
} else {
action := &OutgoingAction{
"type": "IrmaSession.RequestIssuancePermission",
"sessionId": sh.sessionID,
"serverName": serverName,
"issuedCredentials": request.CredentialInfoList,
"disclosures": disclose,
"disclosuresLabels": request.Labels,
"disclosuresCandidates": candidates,
}

sh.permissionHandler = ph
sendAction(action)
return
}
action := &OutgoingAction{
"type": "IrmaSession.RequestIssuancePermission",
"sessionId": sh.sessionID,
"serverName": serverName,
"issuedCredentials": request.CredentialInfoList,
"disclosures": disclose,
"disclosuresLabels": request.Labels,
"disclosuresCandidates": candidates,
}

sh.permissionHandler = ph
sendAction(action)
}

func (sh *SessionHandler) RequestVerificationPermission(request *irma.DisclosureRequest, candidates [][][]*irma.AttributeIdentifier, serverName irma.TranslatedString, ph irmaclient.PermissionHandler) {
logDebug("Handling RequestVerificationPermission")
err := CheckContainsCredentialIdentifiers(request)
if err != nil {
sh.Failure(err)
} else {
action := &OutgoingAction{
"type": "IrmaSession.RequestVerificationPermission",
"sessionId": sh.sessionID,
"serverName": serverName,
"disclosures": request.Disclose,
"disclosuresLabels": request.Labels,
"disclosuresCandidates": candidates,
}

sh.permissionHandler = ph
sendAction(action)
return
}
action := &OutgoingAction{
"type": "IrmaSession.RequestVerificationPermission",
"sessionId": sh.sessionID,
"serverName": serverName,
"disclosures": request.Disclose,
"disclosuresLabels": request.Labels,
"disclosuresCandidates": candidates,
}

sh.permissionHandler = ph
sendAction(action)
}

func (sh *SessionHandler) RequestSignaturePermission(request *irma.SignatureRequest, candidates [][][]*irma.AttributeIdentifier, serverName irma.TranslatedString, ph irmaclient.PermissionHandler) {
logDebug("Handling RequestSignaturePermission")
err := CheckContainsCredentialIdentifiers(request.Disclosure())
if err != nil {
sh.Failure(err)
} else {
action := &OutgoingAction{
"type": "IrmaSession.RequestSignaturePermission",
"sessionId": sh.sessionID,
"serverName": serverName,
"disclosures": request.Disclose,
"disclosuresLabels": request.Labels,
"disclosuresCandidates": candidates,
"message": request.Message,
}

sh.permissionHandler = ph
sendAction(action)
return
}
action := &OutgoingAction{
"type": "IrmaSession.RequestSignaturePermission",
"sessionId": sh.sessionID,
"serverName": serverName,
"disclosures": request.Disclose,
"disclosuresLabels": request.Labels,
"disclosuresCandidates": candidates,
"message": request.Message,
}

sh.permissionHandler = ph
sendAction(action)
}

func (sh *SessionHandler) RequestPin(remainingAttempts int, ph irmaclient.PinHandler) {
Expand Down

0 comments on commit e8b56d2

Please sign in to comment.