How to hook in SyncAdaptor to execute code before saveTiddler() and after loadTiddler() ?

70 views
Skip to first unread message

LinOnetwo

unread,
Apr 12, 2020, 11:27:38 AM4/12/20
to TiddlyWikiDev
Hi, I'd like to push TW5-EncryptTiddlerPlugin a step forward.

I want my wiki to work like Notion, so I can mix Public and Private content in one wiki, and tag some content to be Public.

So I need to encrypt tiddler with for example "EncryptThis" tag just before any SyncAdaptor, e.g., NodeJS SyncAdaptor executes the saveTiddler()

And I need to decrypt tiddler withi such tag, just after any SyncAdaptor executes the loadTiddler() .

---

Only in this way, can we achieve following goals:

1. On browser that has enter the password ( I will remember password in the browser localstorage ) , all tiddlers are always visible, and searchable. ( Only when tiddler is sync back to nodejs, it become encrypted )
2. When I backup tiddlers to Github, Private tiddlers are always encrypted

---

Additional context:

I'm using NodeJS wiki in localhost, use WebCatalog to make it DesktopApp and MenuBarAPP.
And I backup tiddlers to Github.
A CI will build HTML from tiddler files after git push, and serve it as a website.

---

Conculsion: I need to hook in SyncAdaptor life cycle, or write a middleware for SyncAdaptor. Does anyone know if there is an API to do so?

Arlen Beiler

unread,
Apr 12, 2020, 11:44:18 AM4/12/20
to tiddlywikidev
Great idea, just an aside note, for security purposes, you should generate a 64 byte long random byte array and use that for the encryption key and then store it as base 64 wherever you would normally trust storing those private tiddlers, or in your password manager as a secure note. You can still store it in localstorage for each browser, I just mean when you want to access it on a new computer it could be in your password manager or another storage place that you can usually access. 

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/ffbca28a-a263-4873-ad42-bbae0fee6f31%40googlegroups.com.

TonyM

unread,
Apr 14, 2020, 2:33:15 AM4/14/20
to TiddlyWikiDev
Such a tiddler encryption process may allow us to hide details in a user tiddler which then provides a saver passphrase such as to tw-reciever and other details private to the user. If we integrated check in and out for serial editing we would open up a lot of possibilities.

Regards
Tony

Jeremy Ruston

unread,
Apr 14, 2020, 11:51:07 AM4/14/20
to TiddlyWikiDev
Hi LinOneTwo

It sounds like you want this to work with existing syncadaptors. Perhaps it’s possible to write a proxy syncadaptor that presents itself to the syncer, invoking the real underlying syncadaptor to perform data transfer, and doing the encryption/decryption itself.

Best wishes

Jeremy




Mohammad

unread,
Apr 15, 2020, 3:52:05 AM4/15/20
to TiddlyWikiDev
Great idea Lin!
Reply all
Reply to author
Forward
0 new messages