feat(rtc): generate salt and encrypt-key when create-db-graph

This commit is contained in:
rcmerci
2025-09-21 00:24:43 +08:00
committed by Tienson Qin
parent b3c20056a7
commit b2f314556a
5 changed files with 26 additions and 27 deletions

View File

@@ -189,13 +189,14 @@
(let [full-graph-name (string/lower-case (str config/db-version-prefix graph-name))]
(some #(= (some-> (:url %) string/lower-case) full-graph-name) (state/get-repos))))
(defn- create-db [full-graph-name {:keys [file-graph-import? password]}]
(defn- create-db [full-graph-name {:keys [file-graph-import? rtc-e2ee-password]}]
(->
(p/let [config (common-config/create-config-for-db-graph config/config-default-content)
_ (persist-db/<new full-graph-name
(cond-> {:config config
:graph-git-sha config/revision}
file-graph-import? (assoc :import-type :file-graph)))
file-graph-import? (assoc :import-type :file-graph)
rtc-e2ee-password (assoc :rtc-e2ee-password rtc-e2ee-password)))
_ (start-repo-db-if-not-exists! full-graph-name)
_ (state/add-repo! {:url full-graph-name :root (config/get-local-dir full-graph-name)})
_ (restore-and-setup-repo! full-graph-name {:file-graph-import? file-graph-import?})