From dcc9dcacdc704b48e4b191b7df04fd7a1643f042 Mon Sep 17 00:00:00 2001 From: braginini Date: Thu, 12 Aug 2021 13:24:06 +0200 Subject: [PATCH] feature: add setup key HTTP api response fields --- management/server/http/handler/setupkeys.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/management/server/http/handler/setupkeys.go b/management/server/http/handler/setupkeys.go index 0c227fdc2..2f3f2e88e 100644 --- a/management/server/http/handler/setupkeys.go +++ b/management/server/http/handler/setupkeys.go @@ -5,6 +5,7 @@ import ( log "github.com/sirupsen/logrus" "github.com/wiretrustee/wiretrustee/management/server" "net/http" + "time" ) // SetupKeys is a handler that returns a list of setup keys of the account @@ -14,7 +15,10 @@ type SetupKeys struct { // SetupKeyResponse is a response sent to the client type SetupKeyResponse struct { - Key string + Key string + Name string + Expires time.Time + Type string } func NewSetupKeysHandler(accountManager *server.AccountManager) *SetupKeys { @@ -41,7 +45,10 @@ func (h *SetupKeys) ServeHTTP(w http.ResponseWriter, r *http.Request) { respBody := []*SetupKeyResponse{} for _, key := range account.SetupKeys { respBody = append(respBody, &SetupKeyResponse{ - Key: key.Key, + Key: key.Key, + Name: key.Key, + Expires: time.Now().Add(30 * (time.Second * 60 * 60 * 24)), + Type: "reusable", }) }