[dokuwiki] Crypto plugin
- From: Samuel Degrande <Samuel.Degrande@xxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Wed, 16 Aug 2006 11:36:35 +0200
Hi.
I'm writing my first plugin for Dokuwiki, and I have some
'philosophical' questions about
some "non-standard requirements" of that plugin.
My goal is to create a page containing a list of passwords. For obvious
security
reasons, those passwords are stored encrypted in the wiki-page.
The purpose of my plugin is to insert some Javascript code inside the
generated
HTML page and an input form to let the user enter a passphrase. The
passphrase
is then used by the Javascript code to decrypt the passwords and replace
them
with the plaintext passwords.
Two specific 'tags' are used :
- <crypto>aaaaaa</crypto> defines a ciphertext. <crypto> is just replaced
by <span class="ciphertext">, in order to let the code finds what it
has to
decrypt.
- {{keyform>params}} is replaced by the input form
Now my questions (I'm using dokuwiki-2006-03-09) :
1) The Javascript code used by the plugin could be defined in script.js.
However, the cryptographic algorithms to use are defined by the
{{keyform}}
params, and I don't want to include all possible algorithms in all
wiki-pages
(just because it's too heavy).
Currently, the rendering of {{keyform}} includes some <script
src="....">
directly inside the HTML body, but that doesn't follow the rules of
http://wiki.splitbrain.org/wiki:devel:javascript ('inline scripts'
are not
really recommended, as far as I understand)
So, how could I conditionally include a javascript ?
2) To generate the encrypted passwords, I want to add a 'cryptographic
calculator' to
the Dokuwiki editor. Then, the user just writes the plaintext
inside the editor, selects
it, and clicks on the crypto-calc icon. A new window is then opened
where the user
can input the passphrase. The ciphertext is then computed (by a
javascript code),
and the plaintext is automatically replaced inside the editor.
To do that, I had to 'hack' inc/toolbar.php in order to add a
button to the editor toolbar.
That button is defined as a 'mediapopup' and calls a php script
when clicked, because I did
not find an other solution to associate a callback to a button.
So, is there a better solution ?
I think that if would be very useful if a doku plugin could add
it's own buttons to the editor.
Thanks, and excuse me for my bad 'frenglish' (french-english)
--
Samuel Degrande LIFL - UMR8022 CNRS - INRIA Futurs - Bat M3
Phone: (33)3.28.77.85.30 USTL - Universite de Lille 1
Fax: (33)3.28.77.85.37 59655 VILLENEUVE D'ASCQ CEDEX - FRANCE
[CA certs: http://igc.services.cnrs.fr/CNRS-Standard/recherche.html ]
Other related posts: