So I set out to create a proof of concept demonstrating how to utilize
TiddlyWiki's API(s) to ensure compatibility - and ended up writing my
own encryption plugin:
http://fnd.lewcid.org/misc/EncryptionPluginDemo.html
http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/EncryptionPlugin.js
It's quite rough and somewhat confusing in terms of user experience, but
I don't intend for it to replace anyone's plugin.
However, I hope the code will prove instructive for plugin writers, as
it touches upon various layers of TiddlyWiki's internals.[1] (The actual
cryptography is abstracted away - I don't actually know too much about
that topic myself.) So I'd greatly welcome feedback.
Disclaimer: I only did limited research regarding prior art[2].
-- F.
[1] I'd argue that work on projects like TiddlyWeb, as well as the
influence of jQuery, has greatly improved our collective understanding
of TiddlyWiki's API in recent years.
[2] http://tiddlywiki.org/wiki/Encryption
Thanks Lyall - much appreciate it!
> Any chance you could point me to some docs on coding for the new
> TiddlyWiki way?
I'm not sure what you mean by "new way" here. TiddlyWiki's APIs haven't
changed much in a long time - except that you now have access to jQuery
as well, which simplifies working with the DOM and provides some other
handy utilities.
Do you have any particular questions or are you looking for a general
overview?
Apart from the stuff on tiddlywiki.org, here are a few efforts to tackle
the perennial issue of documentation:
http://softwareas.com/tiddlywiki-internals-1-of-3-architectural-concepts
http://www.tiddlytools.com/insideTW/
http://hoster.peermore.com/recipes/tiddlywiki-reference/tiddlers.wiki
-- F.
Quite the opposite - I was hoping it would be used that way!
> I am playing around with your example, but I am using TiddlyWiki 2.6.0
> and I have horrible flickering on the edit buttons
I can't recall having experienced this myself - although I do have
similar issues with Google Reader in Prism every so often. A page
refresh usually remedies that.
> why you are using 2.6.1 alpha?
Laziness, basically (cooking against Trunk) - it shouldn't make a
difference though?
> After all, the old existing TiddlerEncryptionPlugin is almost as
> confusing as it's encrypted tiddlers ;)
Hehe...
-- F.
I'd be happy to do so - unfortunately, I'm currently swamped, so it
might have to wait a week or two.
> By the way, I can get your demo to 'encrypt' a tiddler, on the net,
> but I can't seem to convince it to pop up a password prompt at home.
That's curious - any hints on how to reproduce this?
> I prefer not to 'develop' in the tiddler
Same here - I prefer to use a regular .js file, which means I either use
TiddlyWeb's devstore or dynamic loading of scripts:
http://fnd.lewcid.org/misc/PluginLoader.html
The latter has some significant caveats (eval time, variable scope):
http://groups.google.com/group/tiddlywikidev/t/41ccf8970297b673
-- F.
> After a bit of looking, I am unsure as to what is fundamentally
> different between your demo and my old plugin
I now realize this isn't obvious at all - mainly due to the fact that
the code has grown far beyond what was originally anticipated...
The basic difference is that my plugin operates directly on individual
tiddlers rather than the document as a whole. If I recall correctly,
your plugin's encryption occurs during serialization, when writing the
document to file. However, this is never triggered when sync'ing changes
to a server (whether manually or via the ServerSideSavingPlugin*).
> are you asking for a 'Re-encrypt This' and a 'Re-Encrypt All' button
> which does not 'save' but simply operates locally?
I'm not sure whether separate buttons are desirable - it seems like this
should be handled automatically, ensuring that the decrypted text is
never persisted.
> This requirement was a bit silly, from my original perspective but
> times change
This (even) more tiddler-centric view, with the tiddler (rather than the
document) as the basic unit, was brought about by various explorations
and experiences in recent years, including of course TiddlyWeb. It seems
to be in line with where the web is moving (again); individually
addressable chunks of atomic content.
> an interesting coding style with variables being defined as functions
Indeed, it can take some time to get used to functions as first-class
objects - but it's quite a powerful concept...
-- F.
* as used by both TiddlyWeb and ccTiddly:
http://svn.tiddlywiki.org/Trunk/association/plugins/ServerSideSavingPlugin.js