package main import ( restful "github.com/emicklei/go-restful" ) func wsStoreAddKey(req *restful.Request, resp *restful.Response) { var passphrase string err := req.ReadEntity(&passphrase) if err != nil { wsBadRequest(resp, err.Error()) return } if len(passphrase) == 0 { wsBadRequest(resp, "no passphrase given") return } secStore.AddKey([]byte(passphrase)) err = secStore.SaveTo(secKeysStorePath()) if err != nil { wsError(resp, err) return } }