func StoreUpdate(w http.ResponseWriter, req *http.Request) {
	updateRequest := &UpdateType{}
	err := json.NewDecoder(req.Body).Decode(updateRequest)
	if err != nil {
		httputils.ErrorOut(w, http.StatusBadRequest, "Malformed JSON: "+err.Error())
		return
	}

	haddr, err := hash.NewFromHash(mux.Vars(req)["addr"])
	if err != nil {
		httputils.ErrorOut(w, http.StatusNotFound, accountNotFound)
		return
	}

	pathHash, err := hash.NewFromHash(mux.Vars(req)["path"])
	if err != nil {
		httputils.ErrorOut(w, http.StatusNotFound, errPathNotFound.Error())
		return
	}

	// Check if signature matches
	if !checkSignature(updateRequest.PubKey, updateRequest.Path, updateRequest.Parent, updateRequest.Value, updateRequest.Signature) {
		httputils.ErrorOut(w, http.StatusNotFound, errPathNotFound.Error())
		return
	}

	storePath(w, *haddr, *pathHash, updateRequest.Parent, updateRequest.Value, updateRequest.Signature)
}
// StoreUpdate will update a path or collection
StoreUpdate will update a path or collection
// StoreUpdate will update a path or collection
func StoreUpdate(w http.ResponseWriter, req *http.Request) {
	updateRequest := &UpdateType{}
	err := json.NewDecoder(req.Body).Decode(updateRequest)
	if err != nil {
		httputils.ErrorOut(w, http.StatusBadRequest, "Malformed JSON: "+err.Error())
		return
	}
	haddr, err := hash.NewFromHash(mux.Vars(req)["addr"])
	if err != nil {
		httputils.ErrorOut(w, http.StatusNotFound, accountNotFound)
		return
	}
	pathHash, err := hash.NewFromHash(mux.Vars(req)["path"])
	if err != nil {
		httputils.ErrorOut(w, http.StatusNotFound, errPathNotFound.Error())
		return
	}
	if !checkSignature(updateRequest.PubKey, updateRequest.Path, updateRequest.Parent, updateRequest.Value, updateRequest.Signature) {
		httputils.ErrorOut(w, http.StatusNotFound, errPathNotFound.Error())
		return
	}
	storePath(w, *haddr, *pathHash, updateRequest.Parent, updateRequest.Value, updateRequest.Signature)
}
func StoreUpdate ( w http . ResponseWriter , req * http . Request ) { updateRequest := & UpdateType { } err := json . NewDecoder ( req . Body ) . Decode ( updateRequest ) if err != nil { httputils . ErrorOut ( w , http . StatusBadRequest , " " + err . Error ( ) ) return } haddr , err := hash . NewFromHash ( mux . Vars ( req ) [ " " ] ) if err != nil { httputils . ErrorOut ( w , http . StatusNotFound , accountNotFound ) return } pathHash , err := hash . NewFromHash ( mux . Vars ( req ) [ " " ] ) if err != nil { httputils . ErrorOut ( w , http . StatusNotFound , errPathNotFound . Error ( ) ) return } if ! checkSignature ( updateRequest . PubKey , updateRequest . Path , updateRequest . Parent , updateRequest . Value , updateRequest . Signature ) { httputils . ErrorOut ( w , http . StatusNotFound , errPathNotFound . Error ( ) ) return } storePath ( w , * haddr , * pathHash , updateRequest . Parent , updateRequest . Value , updateRequest . Signature ) }
StoreUpdate will update a path or collection
StoreUpdate will update a path or collection
// Check if signature matches