code: func (api UsersAPI) SaveKeyStoreKey(w http.ResponseWriter, r *http.Request) {
  	username := mux.Vars(r)["username"]
  	globalid := context.Get(r, "client_id").(string)
  
  	body := keystore.KeyStoreKey{}
  
  	if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
  		log.Debug("Keystore key decoding failed: ", err)
  		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
  		return
  	}
  
  	// set/update the username and globalid values to those from the authentication
  	body.Username = username
  	body.Globalid = globalid
  	// set the keys timestamp
  	body.KeyData.TimeStamp = db.DateTime(time.Now())
  
  	if !body.Validate() {
  		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
  		return
  	}
  
  	mgr := keystore.NewManager(r)
  
  	// check if this user/organization already has a key under this label
  	if _, err := mgr.GetKeyStoreKey(username, globalid, body.Label); err == nil {
  		http.Error(w, http.StatusText(http.StatusConflict), http.StatusConflict)
  		return
  	}
  
  	err := mgr.Create(&body)
  	if err != nil {
  		log.Error("error while saving keystore key: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  
  	key, err := mgr.GetKeyStoreKey(username, globalid, body.Label)
  	if err != nil {
  		log.Error("error while retrieving keystore key: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  
  	w.Header().Set("Content-type", "application/json")
  	w.WriteHeader(http.StatusCreated)
  	json.NewEncoder(w).Encode(key)
  }
docs: // SaveKeyStoreKey returns all the publickeys written to the user by an organizaton