+17
knotserver/internal.go
+17
knotserver/internal.go
···
33
33
return
34
34
}
35
35
36
+
func (h *InternalHandle) InternalKeys(w http.ResponseWriter, r *http.Request) {
37
+
keys, err := h.db.GetAllPublicKeys()
38
+
if err != nil {
39
+
writeError(w, err.Error(), http.StatusInternalServerError)
40
+
return
41
+
}
42
+
43
+
data := make([]map[string]interface{}, 0)
44
+
for _, key := range keys {
45
+
j := key.JSON()
46
+
data = append(data, j)
47
+
}
48
+
writeJSON(w, data)
49
+
return
50
+
}
51
+
36
52
func Internal(ctx context.Context, db *db.DB, e *rbac.Enforcer) http.Handler {
37
53
r := chi.NewRouter()
38
54
···
42
58
}
43
59
44
60
r.Get("/push-allowed", h.PushAllowed)
61
+
r.Get("/keys", h.InternalKeys)
45
62
46
63
return r
47
64
}