···
repoPath := filepath.Join(h.c.Repo.ScanPath, did, name)
err := git.InitBare(repoPath)
writeError(w, err.Error(), http.StatusInternalServerError)
···
-
Did string `json:"did"`
-
PublicKey string `json:"key"`
-
Created string `json:"created"`
if err := json.NewDecoder(r.Body).Decode(&data); err != nil {
···
-
created := data.Created
writeError(w, "did is empty", http.StatusBadRequest)
-
writeError(w, "key is empty", http.StatusBadRequest)
-
writeError(w, "created timestamp is empty", http.StatusBadRequest)
-
if err := h.db.AddDid(did); err == nil {
-
err := h.db.AddPublicKey(pk)
-
writeError(w, err.Error(), http.StatusInternalServerError)
writeError(w, err.Error(), http.StatusInternalServerError)
-
h.js.UpdateDids([]string{did})
// Signal that the knot is ready
-
w.WriteHeader(http.StatusNoContent)
-
func (h *Handle) Health(w http.ResponseWriter, r *http.Request) {
-
log.Println("got health check")
mac := hmac.New(sha256.New, []byte(h.c.Server.Secret))
w.Header().Add("X-Signature", hex.EncodeToString(mac.Sum(nil)))
···
repoPath := filepath.Join(h.c.Repo.ScanPath, did, name)
err := git.InitBare(repoPath)
writeError(w, err.Error(), http.StatusInternalServerError)
···
+
Did string `json:"did"`
+
PublicKeys []string `json:"keys"`
if err := json.NewDecoder(r.Body).Decode(&data); err != nil {
···
writeError(w, "did is empty", http.StatusBadRequest)
+
if err := h.db.AddDid(data.Did); err == nil {
+
for _, k := range data.PublicKeys {
+
err := h.db.AddPublicKey(pk)
+
writeError(w, err.Error(), http.StatusInternalServerError)
writeError(w, err.Error(), http.StatusInternalServerError)
+
h.js.UpdateDids([]string{data.Did})
// Signal that the knot is ready
mac := hmac.New(sha256.New, []byte(h.c.Server.Secret))
w.Header().Add("X-Signature", hex.EncodeToString(mac.Sum(nil)))
+
w.WriteHeader(http.StatusNoContent)
+
func (h *Handle) Health(w http.ResponseWriter, r *http.Request) {