···
repoPath := filepath.Join(h.c.Repo.ScanPath, did, name)
err := git.InitBare(repoPath)
writeError(w, err.Error(), http.StatusInternalServerError)
···
402
-
Did string `json:"did"`
403
-
PublicKey string `json:"key"`
404
-
Created string `json:"created"`
403
+
Did string `json:"did"`
404
+
PublicKeys []string `json:"keys"`
if err := json.NewDecoder(r.Body).Decode(&data); err != nil {
···
413
-
key := data.PublicKey
414
-
created := data.Created
412
+
if data.Did == "" {
writeError(w, "did is empty", http.StatusBadRequest)
422
-
writeError(w, "key is empty", http.StatusBadRequest)
427
-
writeError(w, "created timestamp is empty", http.StatusBadRequest)
431
-
if err := h.db.AddDid(did); err == nil {
432
-
pk := db.PublicKey{
436
-
pk.Created = created
437
-
err := h.db.AddPublicKey(pk)
439
-
writeError(w, err.Error(), http.StatusInternalServerError)
417
+
if err := h.db.AddDid(data.Did); err == nil {
418
+
for _, k := range data.PublicKeys {
419
+
pk := db.PublicKey{
423
+
err := h.db.AddPublicKey(pk)
425
+
writeError(w, err.Error(), http.StatusInternalServerError)
writeError(w, err.Error(), http.StatusInternalServerError)
447
-
h.js.UpdateDids([]string{did})
434
+
h.js.UpdateDids([]string{data.Did})
// Signal that the knot is ready
450
-
w.WriteHeader(http.StatusNoContent)
453
-
func (h *Handle) Health(w http.ResponseWriter, r *http.Request) {
454
-
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)))
442
+
w.WriteHeader(http.StatusNoContent)
445
+
func (h *Handle) Health(w http.ResponseWriter, r *http.Request) {