More work on encryption of content and history.

This commit is contained in:
Scott Idem
2025-05-05 17:10:19 -04:00
parent 0b61596833
commit 66b122dca5
9 changed files with 685 additions and 301 deletions

View File

@@ -356,6 +356,20 @@ export async function db_save_ae_obj_li__journal_entry(
content_md_html = await marked.parse(content_cleaned ?? '') ?? null;
}
let history = obj.history ?? '';
let history_cleaned: null|string = null;
let history_md_html: null|string = null; // await marked.parse(history_cleaned ?? '') ?? null;
if (obj.history_encrypted) {
// In theory "history" should be null if "history_encrypted" has a value.
history = null; // obj.history_encrypted;
history_cleaned = null;
history_md_html = null;
} else {
history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
history_md_html = await marked.parse(history_cleaned ?? '') ?? null;
}
let obj_record = {
id: obj.journal_entry_id_random,
journal_entry_id: obj.journal_entry_id_random,
@@ -397,6 +411,12 @@ export async function db_save_ae_obj_li__journal_entry(
content_json: obj.content_json,
content_encrypted: obj.content_encrypted,
history: obj.history,
history_md_html: history_md_html,
history_encrypted: obj.history_encrypted,
passcode_hash: obj.passcode_hash,
// url: obj.url,
// url_text: obj.url_text,