From 8f13081270e415e84625aed33dba78509254f363 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 13 Aug 2016 15:28:52 -0600 Subject: [PATCH 1/3] add README.md --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d257b6f --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# le-store-SPEC + +The reference implementation, specification, template, and tests for creating an le-store- strategy. + +The reference implementation is completely in-memory. + +See [Help Wanted: Database Plugins (for saving certs)](https://github.com/Daplie/node-letsencrypt/issues/39) + +API +=== + +``` +* getOptions() +* accounts. + * checkKeypair(opts, cb) + * setKeypair(opts, keypair, cb) + * check(opts, cb) + * set(opts, reg, cb) +* certificates. + * checkKeypair(opts, cb) + * setKeypair(opts, keypair, cb) + * check(opts, cb) + * set(opts, certs, cb) +``` + +Keypairs +-------- + +For convenience, the keypair object will always contain **both** PEM and JWK +versions of the private and/or public keys when being passed to the `*Keypair` functions. + +**set** + +`setKeypair` will always be called with `email` and **all three** forms of the keypair: +`privateKeyPem`, `publicKeyPem`, and `privateKeyJwk`. It's easy to generate `publicKeyJwk` +from `privateKeyJwk` because it is just a copy of the public fields `e` and `n`. + +**check** + +`checkKeypair` may be called with any of `email`, `accountId`, and `keypair` - which will +contain only `publicKeyPem` and `publicKeyJwk`. From b3102ded8dcc0a4e33093d1537c0dc29dd6fb793 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 13 Aug 2016 15:29:14 -0600 Subject: [PATCH 2/3] update README.md --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index d257b6f..bce2826 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,39 @@ The reference implementation is completely in-memory. See [Help Wanted: Database Plugins (for saving certs)](https://github.com/Daplie/node-letsencrypt/issues/39) +How to create a custom strategy +=============================== + +Let's say there's some new database AwesomeDB that +we want to make a plugin for, here's how we'd start: + +```bash +# First create you repo on github or wherever +# Then clone it +git clone git@github.com:AwesomeDB/le-store-awesome.git + +pushd le-store-awesome + +git pull https://github.com/Daplie/le-store-SPEC.git template + +git push +``` + +Or, if you already have some code and just need to merge in the tests: + +```bash +git pull https://github.com/Daplie/le-store-SPEC.git tests +``` + +Next, Just run the tests + +``` +node tests/basic.js +``` + +Note: you should not modify the tests that come from the tests branch, +but rather create separate files for your own tests. + API === From 861872499e875cecffaed648d785b4eceded51e8 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 2 Sep 2016 14:25:07 -0600 Subject: [PATCH 3/3] update readme --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bce2826..7b54bde 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,11 @@ See [Help Wanted: Database Plugins (for saving certs)](https://github.com/Daplie How to create a custom strategy =============================== -Let's say there's some new database AwesomeDB that +READ THIS README: +Believe it or not, most of your answers are either right here +or in the comments in the sample code in `index.js`. + +Now, let's say there's some new database AwesomeDB that we want to make a plugin for, here's how we'd start: ```bash @@ -19,6 +23,7 @@ git clone git@github.com:AwesomeDB/le-store-awesome.git pushd le-store-awesome +# IMPORTANT: we pull in the 'template' branch, which has the skeleton code git pull https://github.com/Daplie/le-store-SPEC.git template git push @@ -68,7 +73,27 @@ versions of the private and/or public keys when being passed to the `*Keypair` f `privateKeyPem`, `publicKeyPem`, and `privateKeyJwk`. It's easy to generate `publicKeyJwk` from `privateKeyJwk` because it is just a copy of the public fields `e` and `n`. +``` +// keypair looks like this +{ privateKeyPem: '...' +, publicKeyPem: '...' +, privateKeyJwk: { ... } +} +``` + **check** `checkKeypair` may be called with any of `email`, `accountId`, and `keypair` - which will contain only `publicKeyPem` and `publicKeyJwk`. + +``` +// opts looks like this +{ + email: '...@...' +, accountId: '...' +, keypair: { + publicKeyPem: '...' + , publicKeyJwk: { ... } + } +} +```