mirror of
				https://git.coolaj86.com/coolaj86/greenlock-store-memory.js.git
				synced 2025-11-04 02:52:47 +00:00 
			
		
		
		
	v3.0.2: clarify with comments and docs
This commit is contained in:
		
							parent
							
								
									5a66693cdb
								
							
						
					
					
						commit
						6922fb2e97
					
				
							
								
								
									
										21
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								index.js
									
									
									
									
									
								
							@ -69,12 +69,10 @@ module.exports.create = function (opts) {
 | 
			
		||||
    var id = opts.account.id || opts.email || 'default';
 | 
			
		||||
    var keypair = opts.keypair;
 | 
			
		||||
 | 
			
		||||
    saveKeypair(id, JSON.stringify({
 | 
			
		||||
    return saveKeypair(id, JSON.stringify({
 | 
			
		||||
      privateKeyPem: keypair.privateKeyPem
 | 
			
		||||
    , privateKeyJwk: keypair.privateKeyJwk
 | 
			
		||||
    }));
 | 
			
		||||
 | 
			
		||||
    return null; // or Promise.resolve(null);
 | 
			
		||||
    })); // Must return or Promise `null` instead of `undefined`
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -121,14 +119,13 @@ module.exports.create = function (opts) {
 | 
			
		||||
    var id = opts.certificate.kid || opts.certificate.id || opts.subject;
 | 
			
		||||
    var keypair = opts.keypair;
 | 
			
		||||
 | 
			
		||||
    saveKeypair(id, JSON.stringify({
 | 
			
		||||
    return saveKeypair(id, JSON.stringify({
 | 
			
		||||
      privateKeyPem: keypair.privateKeyPem
 | 
			
		||||
    , privateKeyJwk: keypair.privateKeyJwk
 | 
			
		||||
    }));
 | 
			
		||||
    // Note: you can use the "keypairs" package to convert between
 | 
			
		||||
    // public and private for jwk and pem, as well as convert JWK <-> PEM
 | 
			
		||||
    })); // Must return or Promise `null` instead of `undefined`
 | 
			
		||||
 | 
			
		||||
    return null;
 | 
			
		||||
    // Side Note: you can use the "keypairs" package to convert between
 | 
			
		||||
    // public and private for jwk and pem, as well as convert JWK <-> PEM
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -155,16 +152,14 @@ module.exports.create = function (opts) {
 | 
			
		||||
 | 
			
		||||
    var id = opts.certificate.id || opts.subject;
 | 
			
		||||
    var pems = opts.pems;
 | 
			
		||||
    saveCertificate(id, JSON.stringify({
 | 
			
		||||
    return saveCertificate(id, JSON.stringify({
 | 
			
		||||
      cert: pems.cert
 | 
			
		||||
    , chain: pems.chain
 | 
			
		||||
    , subject: pems.subject
 | 
			
		||||
    , altnames: pems.altnames
 | 
			
		||||
    , issuedAt: pems.issuedAt   // a.k.a. NotBefore
 | 
			
		||||
    , expiresAt: pems.expiresAt // a.k.a. NotAfter
 | 
			
		||||
    }));
 | 
			
		||||
 | 
			
		||||
    return null;
 | 
			
		||||
    })); // Must return or Promise `null` instead of `undefined`
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -1,5 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "greenlock-store-memory",
 | 
			
		||||
  "version": "3.0.1",
 | 
			
		||||
  "version": "3.0.2",
 | 
			
		||||
  "lockfileVersion": 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "greenlock-store-memory",
 | 
			
		||||
  "version": "3.0.1",
 | 
			
		||||
  "version": "3.0.2",
 | 
			
		||||
  "description": "An in-memory reference implementation for account, certificate, and keypair storage strategies in Greenlock",
 | 
			
		||||
  "homepage": "https://git.coolaj86.com/coolaj86/greenlock-store-memory.js",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user