diff options
Diffstat (limited to 'signer/rules')
-rw-r--r-- | signer/rules/rules.go | 6 | ||||
-rw-r--r-- | signer/rules/rules_test.go | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/signer/rules/rules.go b/signer/rules/rules.go index 711e2ddde..07c34db22 100644 --- a/signer/rules/rules.go +++ b/signer/rules/rules.go @@ -194,6 +194,11 @@ func (r *rulesetUI) ApproveImport(request *core.ImportRequest) (core.ImportRespo return r.next.ApproveImport(request) } +// OnInputRequired not handled by rules +func (r *rulesetUI) OnInputRequired(info core.UserInputRequest) (core.UserInputResponse, error) { + return r.next.OnInputRequired(info) +} + func (r *rulesetUI) ApproveListing(request *core.ListRequest) (core.ListResponse, error) { jsonreq, err := json.Marshal(request) approved, err := r.checkApproval("ApproveListing", jsonreq, err) @@ -222,6 +227,7 @@ func (r *rulesetUI) ShowInfo(message string) { log.Info(message) r.next.ShowInfo(message) } + func (r *rulesetUI) OnSignerStartup(info core.StartupInfo) { jsonInfo, err := json.Marshal(info) if err != nil { diff --git a/signer/rules/rules_test.go b/signer/rules/rules_test.go index b6060eba7..c2f92d51f 100644 --- a/signer/rules/rules_test.go +++ b/signer/rules/rules_test.go @@ -74,6 +74,10 @@ func mixAddr(a string) (*common.MixedcaseAddress, error) { type alwaysDenyUI struct{} +func (alwaysDenyUI) OnInputRequired(info core.UserInputRequest) (core.UserInputResponse, error) { + return core.UserInputResponse{}, nil +} + func (alwaysDenyUI) OnSignerStartup(info core.StartupInfo) { } @@ -200,6 +204,11 @@ type dummyUI struct { calls []string } +func (d *dummyUI) OnInputRequired(info core.UserInputRequest) (core.UserInputResponse, error) { + d.calls = append(d.calls, "OnInputRequired") + return core.UserInputResponse{}, nil +} + func (d *dummyUI) ApproveTx(request *core.SignTxRequest) (core.SignTxResponse, error) { d.calls = append(d.calls, "ApproveTx") return core.SignTxResponse{}, core.ErrRequestDenied @@ -509,6 +518,11 @@ type dontCallMe struct { t *testing.T } +func (d *dontCallMe) OnInputRequired(info core.UserInputRequest) (core.UserInputResponse, error) { + d.t.Fatalf("Did not expect next-handler to be called") + return core.UserInputResponse{}, nil +} + func (d *dontCallMe) OnSignerStartup(info core.StartupInfo) { } |