Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Turn OpenPGP.js into driver #73

Open
niklasfemerstrand opened this issue Jul 7, 2013 · 4 comments
Open

Turn OpenPGP.js into driver #73

niklasfemerstrand opened this issue Jul 7, 2013 · 4 comments
Milestone

Comments

@niklasfemerstrand
Copy link
Owner

Abstract the crypto parts and make OpenPGP.js a separate driver as preparation for multiple driver support (#64).

niklasfemerstrand pushed a commit that referenced this issue Jul 8, 2013
Moves to verifyBasicSignatures()

Moves to getKeyID()

Moves to getPerson()

Moves and rewrites getAlgorithmString()

Moves to exportArmored() and getKeyID()

Moves to getKeyUserids()

Finishes isolating OpenPGP.js functions to .crypto.js for #73
@krautsource
Copy link
Contributor

What do you have in mind regarding driver loading? Doing it in JavaScript like

if(usePyPgp)
  this.pgpDriver = new pypgpDriver();
else
  this.pgpDriver = new openpgpjsDriver();
...
// Do some encryption
this.pgpDriver.encrypt(...);

or doing it in PHP like

if($usePyPgp)
  $this->include_script('driver.pypgphttpd.js');
else
  $this->include_script('driver.openpgpjs.js');

and keep using invocations of encrypt() etc. just like they're currently done?

@niklasfemerstrand
Copy link
Owner Author

What do you have in mind regarding driver loading? Doing it in JavaScript like

Yes. There shalt be no crypto in PHP :-)

@krautsource
Copy link
Contributor

We'll probably still have to use some PHP to let the JavaScript code know which option the user chose in the preferences, so it doesn't make much difference IMHO... but I agree that it would be cleaner to do the actual differentiation in JS.
Shall I wrap the current driver into a JS object in preparation for it?
When I'm already at it, I'd also like to encapsulate the main rc_pgpopenjs.js code into an object/singleton in order not to clutter the global scope with our function names, the passphrase etc. Currently, it's all global (in the 'Window' object). Any objections?

@niklasfemerstrand
Copy link
Owner Author

We'll probably still have to use some PHP to let the JavaScript code know which option the user chose in the preferences, so it doesn't make much difference IMHO...

Yes, the setting should be PHP based. And then for differentiation we could just echo a JS var declaration from PHP.

Shall I wrap the current driver into a JS object in preparation for it?

Yes, please. Basically rc_openpgp.crypto.js and rc_openpgp.js, if you have time for it. Once finished I can throw out the driver for pygpghttpd farily quickly, the backend etc is already done.

Any objections?

None

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants