Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0dc09293ea | |||
| e39eca4ed1 | 
							
								
								
									
										34
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								README.md
									
									
									
									
									
								
							@ -1,6 +1,4 @@
 | 
				
			|||||||
# [greenlock-store-test](https://git.coolaj86.com/coolaj86/greenlock-store-test.js.git)
 | 
					# [greenlock-store-test](https://git.rootprojects.org/root/greenlock-store-test.js.git) | A [Root](https://rootprojects.org) Project
 | 
				
			||||||
 | 
					 | 
				
			||||||
| A [Root](https://rootprojects.org) Project |
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
The test harness you should use when writing a certificate and keypair storage strategy
 | 
					The test harness you should use when writing a certificate and keypair storage strategy
 | 
				
			||||||
for [Greenlock](https://git.coolaj86.com/coolaj86/greenlock-express.js) v2.7+ (and v3).
 | 
					for [Greenlock](https://git.coolaj86.com/coolaj86/greenlock-express.js) v2.7+ (and v3).
 | 
				
			||||||
@ -32,6 +30,29 @@ tester.test(store).then(function () {
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Reference Implementations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					These are plugins that use the v2.7+ (v3) API, and pass this test harness,
 | 
				
			||||||
 | 
					which you should use as a model for any plugins that you create.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* [`greenlock-store-memory`](https://git.rootprojects.org/root/greenlock-store-memory.js)
 | 
				
			||||||
 | 
					* [`greenlock-store-fs`](https://git.rootprojects.org/root/greenlock-store-fs.js)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See `example.js` (it works).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Looking for the Easy Button?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Contact Root](mailto:support@rootprojects.org)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you're looking for fast and inexpensive plugin development,
 | 
				
			||||||
 | 
					we can deliver greater value in less time than most outsouring options.
 | 
				
			||||||
 | 
					We can also work with your in-house team to give a quick, inexpensive 10x
 | 
				
			||||||
 | 
					boost to internal development success.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					We also offer commercial licenses for LTS (Long-Term Support) versions of Greenlock.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Overview
 | 
					## Overview
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The most generic implementation, with no special considerations or custom logic, ends up looking like this:
 | 
					The most generic implementation, with no special considerations or custom logic, ends up looking like this:
 | 
				
			||||||
@ -104,10 +125,3 @@ tester.test({
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Note: The `DB.x.y()` is where you do your magic up to connect to a database or API or whatever and keep stuff safe.
 | 
					Note: The `DB.x.y()` is where you do your magic up to connect to a database or API or whatever and keep stuff safe.
 | 
				
			||||||
 | 
					 | 
				
			||||||
## Examples
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
See the reference implementations (they work):
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  * [`greenlock-store-memory`](https://git.coolaj86.com/coolaj86/greenlock-store-memory)
 | 
					 | 
				
			||||||
  * [`greenlock-store-fs`](https://git.coolaj86.com/coolaj86/greenlock-store-fs)
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//var tester = require('greenlock-challenge-test');
 | 
					//var tester = require('greenlock-store-test');
 | 
				
			||||||
var tester = require('./');
 | 
					var tester = require('./');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var store = require('greenlock-store-memory').create({});
 | 
					var store = require('greenlock-store-memory').create({});
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								index.js
									
									
									
									
									
								
							@ -84,35 +84,36 @@ module.exports.test = function (store) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }).then(function () {
 | 
					  }).then(function () {
 | 
				
			||||||
    // TODO check accounts.check
 | 
					    // TODO check accounts.check
 | 
				
			||||||
    var opts = { account: {}, email: email };
 | 
					    var opts = { account: {}, email: email, subject: subject, certificate: {} };
 | 
				
			||||||
    return checkAccountKey(opts).then(function (results) {
 | 
					    return checkAccountKey(opts).then(function (results) {
 | 
				
			||||||
      if (null !== results) {
 | 
					      if (null !== results) {
 | 
				
			||||||
        throw new Error("should not have an account keypair for " + subject);
 | 
					        throw new Error("should not have an account keypair for " + subject);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }).then(function () {
 | 
					  }).then(function () {
 | 
				
			||||||
    var opts = { account: {}, email: email, keypair: accountKey };
 | 
					    var opts = { account: {}, email: email, keypair: accountKey, subject: subject, certificate: {} };
 | 
				
			||||||
    return setAccountKey(opts).then(function (results) {
 | 
					    return setAccountKey(opts).then(function (results) {
 | 
				
			||||||
      if ('undefined' === typeof results) {
 | 
					      if ('undefined' === typeof results) {
 | 
				
			||||||
        throw new Error("should never get undefined as a return value, did you forget to return?");
 | 
					        throw new Error("should never get undefined as a return value, did you forget to return?");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }).then(function () {
 | 
					  }).then(function () {
 | 
				
			||||||
    var opts = { certificate: {}, subject: subject, keypair: domainKey };
 | 
					    var opts = { certificate: {}, subject: subject, keypair: domainKey, email: email, account: {} };
 | 
				
			||||||
    return setCertKey(opts).then(function (results) {
 | 
					    return setCertKey(opts).then(function (results) {
 | 
				
			||||||
      if ('undefined' === typeof results) {
 | 
					      if ('undefined' === typeof results) {
 | 
				
			||||||
        throw new Error("should never get undefined as a return value, did you forget to return?");
 | 
					        throw new Error("should never get undefined as a return value, did you forget to return?");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }).then(function () {
 | 
					  }).then(function () {
 | 
				
			||||||
    var opts = { certificate: {}, subject: subject, pems: domainCert };
 | 
					    var opts = { certificate: {}, subject: subject, pems: domainCert, email: email, account: {} };
 | 
				
			||||||
    return setCert(opts).then(function (results) {
 | 
					    return setCert(opts).then(function (results) {
 | 
				
			||||||
      if ('undefined' === typeof results) {
 | 
					      if ('undefined' === typeof results) {
 | 
				
			||||||
        throw new Error("should never get undefined as a return value, did you forget to return?");
 | 
					        throw new Error("should never get undefined as a return value, did you forget to return?");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }).then(function () {
 | 
					  }).then(function () {
 | 
				
			||||||
    return checkCerts({ certificate: {}, subject: subject }).then(function (results) {
 | 
					    var opts = { certificate: {}, subject: subject, email: email, account: {} };
 | 
				
			||||||
 | 
					    return checkCerts(opts).then(function (results) {
 | 
				
			||||||
      if (!results || !results.chain || !results.cert) {
 | 
					      if (!results || !results.chain || !results.cert) {
 | 
				
			||||||
        throw new Error("expected to get certificate and chain for " + subject);
 | 
					        throw new Error("expected to get certificate and chain for " + subject);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -149,7 +150,7 @@ module.exports.test = function (store) {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }).then(function () {
 | 
					  }).then(function () {
 | 
				
			||||||
    var opts = { certificate: {}, subject: subject };
 | 
					    var opts = { certificate: {}, subject: subject, email: email, account: {} };
 | 
				
			||||||
    return checkCertKey(opts).then(function (results) {
 | 
					    return checkCertKey(opts).then(function (results) {
 | 
				
			||||||
      if (!results) {
 | 
					      if (!results) {
 | 
				
			||||||
        throw new Error("Should have found a keypair for " + opts.subject);
 | 
					        throw new Error("Should have found a keypair for " + opts.subject);
 | 
				
			||||||
@ -172,7 +173,7 @@ module.exports.test = function (store) {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }).then(function () {
 | 
					  }).then(function () {
 | 
				
			||||||
    var opts = { account: {}, email: email };
 | 
					    var opts = { account: {}, email: email, subject: subject, certificate: {} };
 | 
				
			||||||
    return checkAccountKey(opts).then(function (results) {
 | 
					    return checkAccountKey(opts).then(function (results) {
 | 
				
			||||||
      if (!results) {
 | 
					      if (!results) {
 | 
				
			||||||
        throw new Error("Should have found a keypair for " + opts.email);
 | 
					        throw new Error("Should have found a keypair for " + opts.email);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										11
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								package.json
									
									
									
									
									
								
							@ -1,7 +1,8 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "greenlock-store-test",
 | 
					  "name": "greenlock-store-test",
 | 
				
			||||||
  "version": "3.0.0",
 | 
					  "version": "3.0.2",
 | 
				
			||||||
  "description": "The base set of tests for all certificate and keypair storage strategies. Any Greenlock `le-store-` plugin should be able to pass these tests.",
 | 
					  "description": "The base set of tests for all certificate and keypair storage strategies. Any Greenlock `greenlock-store-` plugin should be able to pass these tests.",
 | 
				
			||||||
 | 
					  "homepage": "https://git.rootprojects.org/root/greenlock-store-test.js",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "files": ["example.js"],
 | 
					  "files": ["example.js"],
 | 
				
			||||||
  "dependencies": {},
 | 
					  "dependencies": {},
 | 
				
			||||||
@ -13,11 +14,11 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
    "url": "https://git.coolaj86.com/coolaj86/le-store-test.js.git"
 | 
					    "url": "https://git.rootprojects.org/root/greenlock-store-test.js.git"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "keywords": [
 | 
					  "keywords": [
 | 
				
			||||||
    "Let's Encrypt",
 | 
					 | 
				
			||||||
    "ACME",
 | 
					    "ACME",
 | 
				
			||||||
 | 
					    "Let's Encrypt",
 | 
				
			||||||
    "Greenlock",
 | 
					    "Greenlock",
 | 
				
			||||||
    "test",
 | 
					    "test",
 | 
				
			||||||
    "certificate",
 | 
					    "certificate",
 | 
				
			||||||
@ -26,6 +27,6 @@
 | 
				
			|||||||
    "credentials",
 | 
					    "credentials",
 | 
				
			||||||
    "secure"
 | 
					    "secure"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
 | 
					  "author": "AJ ONeal <solderjs@gmail.com> (https://solderjs.com/)",
 | 
				
			||||||
  "license": "MPL-2.0"
 | 
					  "license": "MPL-2.0"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user