OSDN Git Service

optimise
authoroysheng <oysheng@bytom.io>
Sat, 28 Apr 2018 08:19:58 +0000 (16:19 +0800)
committeroysheng <oysheng@bytom.io>
Sat, 28 Apr 2018 08:19:58 +0000 (16:19 +0800)
api/api.go
api/hsm.go
cmd/bytomcli/commands/bytomcli.go

index 8514320..2cd64c6 100644 (file)
@@ -184,9 +184,7 @@ func (a *API) buildHandler() {
                m.Handle("/list-keys", jsonHandler(a.pseudohsmListKeys))
                m.Handle("/delete-key", jsonHandler(a.pseudohsmDeleteKey))
                m.Handle("/reset-key-password", jsonHandler(a.pseudohsmResetPassword))
-
-               m.Handle("/sign-message", jsonHandler(a.pseudohsmSignMsg))
-               m.Handle("/verify-message", jsonHandler(a.pseudohsmVerifyMsg))
+               m.Handle("/sign-message", jsonHandler(a.signMessage))
 
                m.Handle("/build-transaction", jsonHandler(a.build))
                m.Handle("/sign-transaction", jsonHandler(a.pseudohsmSignTemplates))
@@ -235,6 +233,7 @@ func (a *API) buildHandler() {
        m.Handle("/get-work", jsonHandler(a.getWork))
        m.Handle("/submit-work", jsonHandler(a.submitWork))
 
+       m.Handle("/verify-message", jsonHandler(a.verifyMessage))
        m.Handle("/gas-rate", jsonHandler(a.gasRate))
        m.Handle("/net-info", jsonHandler(a.getNetInfo))
 
index b3f429e..4e3737a 100644 (file)
@@ -91,7 +91,7 @@ type SignMsgResp struct {
        Signature string `json:"signature"`
 }
 
-func (a *API) pseudohsmSignMsg(ctx context.Context, ins struct {
+func (a *API) signMessage(ctx context.Context, ins struct {
        RootXPub chainkd.XPub `json:"root_xpub"`
        Message  []byte       `json:"message"`
        Password string       `json:"password"`
@@ -108,7 +108,7 @@ type VerifyMsgResp struct {
        VerifyResult bool `json:" result"`
 }
 
-func (a *API) pseudohsmVerifyMsg(ctx context.Context, ins struct {
+func (a *API) verifyMessage(ctx context.Context, ins struct {
        RootXPub  chainkd.XPub `json:"root_xpub"`
        Message   []byte       `json:"message"`
        Signature []byte       `json:"signature"`
index aede6ef..117af40 100644 (file)
@@ -187,7 +187,6 @@ func AddTemplateFunc() {
                listKeysCmd.Name(),
                resetKeyPwdCmd.Name(),
                signMsgCmd.Name(),
-               verifyMsgCmd.Name(),
 
                buildTransactionCmd.Name(),
                signTransactionCmd.Name(),