OSDN Git Service

Modify createKeyResp structure
authorYahtoo Ma <yahtoo.ma@gmail.com>
Tue, 11 Sep 2018 03:48:04 +0000 (11:48 +0800)
committerYahtoo Ma <yahtoo.ma@gmail.com>
Tue, 11 Sep 2018 03:48:04 +0000 (11:48 +0800)
api/hsm.go

index eda64df..ebba716 100644 (file)
@@ -11,8 +11,10 @@ import (
 )
 
 type createKeyResp struct {
-       Xpub     *pseudohsm.XPub `json:"xpub"`
-       Mnemonic *string         `json:"mnemonic"`
+       Alias    string       `json:"alias"`
+       XPub     chainkd.XPub `json:"xpub"`
+       File     string       `json:"file"`
+       Mnemonic string       `json:"mnemonic"`
 }
 
 func (a *API) pseudohsmCreateKey(ctx context.Context, in struct {
@@ -29,13 +31,13 @@ func (a *API) pseudohsmCreateKey(ctx context.Context, in struct {
                if err != nil {
                        return NewErrorResponse(err)
                }
-               return NewSuccessResponse(&createKeyResp{Xpub: xpub})
+               return NewSuccessResponse(&createKeyResp{Alias: xpub.Alias, XPub: xpub.XPub, File: xpub.File})
        }
        xpub, mnemonic, err := a.wallet.Hsm.XCreate(in.Alias, in.Password, in.Language)
        if err != nil {
                return NewErrorResponse(err)
        }
-       return NewSuccessResponse(&createKeyResp{Xpub: xpub, Mnemonic: mnemonic})
+       return NewSuccessResponse(&createKeyResp{Alias: xpub.Alias, XPub: xpub.XPub, File: xpub.File, Mnemonic: *mnemonic})
 }
 
 type importKeyResp struct {