http-01 challenge pre-flight works
This commit is contained in:
		
							parent
							
								
									f6d26c8b8e
								
							
						
					
					
						commit
						e479d79c15
					
				
							
								
								
									
										29
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								app.js
									
									
									
									
									
								
							@ -141,8 +141,9 @@
 | 
				
			|||||||
            , challenges: {
 | 
					            , challenges: {
 | 
				
			||||||
                'dns-01': {
 | 
					                'dns-01': {
 | 
				
			||||||
                  set: function (opts) {
 | 
					                  set: function (opts) {
 | 
				
			||||||
                    console.log('dns-01 set challenge:');
 | 
					                    console.info('dns-01 set challenge:');
 | 
				
			||||||
                    console.log(JSON.stringify(opts, null, 2));
 | 
					                    console.info('TXT', opts.dnsHost);
 | 
				
			||||||
 | 
					                    console.info(opts.dnsAuthorization);
 | 
				
			||||||
                    return new Promise(function (resolve) {
 | 
					                    return new Promise(function (resolve) {
 | 
				
			||||||
                      while (!window.confirm("Did you set the challenge?")) {}
 | 
					                      while (!window.confirm("Did you set the challenge?")) {}
 | 
				
			||||||
                      resolve();
 | 
					                      resolve();
 | 
				
			||||||
@ -150,7 +151,28 @@
 | 
				
			|||||||
                  }
 | 
					                  }
 | 
				
			||||||
                , remove: function (opts) {
 | 
					                , remove: function (opts) {
 | 
				
			||||||
                    console.log('dns-01 remove challenge:');
 | 
					                    console.log('dns-01 remove challenge:');
 | 
				
			||||||
                    console.log(JSON.stringify(opts, null, 2));
 | 
					                    console.info('TXT', opts.dnsHost);
 | 
				
			||||||
 | 
					                    console.info(opts.dnsAuthorization);
 | 
				
			||||||
 | 
					                    return new Promise(function (resolve) {
 | 
				
			||||||
 | 
					                      while (!window.confirm("Did you delete the challenge?")) {}
 | 
				
			||||||
 | 
					                      resolve();
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                  }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					              , 'http-01': {
 | 
				
			||||||
 | 
					                  set: function (opts) {
 | 
				
			||||||
 | 
					                    console.info('http-01 set challenge:');
 | 
				
			||||||
 | 
					                    console.info(opts.challengeUrl);
 | 
				
			||||||
 | 
					                    console.info(opts.keyAuthorization);
 | 
				
			||||||
 | 
					                    return new Promise(function (resolve) {
 | 
				
			||||||
 | 
					                      while (!window.confirm("Did you set the challenge?")) {}
 | 
				
			||||||
 | 
					                      resolve();
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                  }
 | 
				
			||||||
 | 
					                , remove: function (opts) {
 | 
				
			||||||
 | 
					                    console.log('http-01 remove challenge:');
 | 
				
			||||||
 | 
					                    console.info(opts.challengeUrl);
 | 
				
			||||||
 | 
					                    console.info(opts.keyAuthorization);
 | 
				
			||||||
                    return new Promise(function (resolve) {
 | 
					                    return new Promise(function (resolve) {
 | 
				
			||||||
                      while (!window.confirm("Did you delete the challenge?")) {}
 | 
					                      while (!window.confirm("Did you delete the challenge?")) {}
 | 
				
			||||||
                      resolve();
 | 
					                      resolve();
 | 
				
			||||||
@ -158,6 +180,7 @@
 | 
				
			|||||||
                  }
 | 
					                  }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
 | 
					            , challengeTypes: [$('input[name="acme-challenge-type"]:checked').value]
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        }).catch(function (err) {
 | 
					        }).catch(function (err) {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										35
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								index.html
									
									
									
									
									
								
							@ -34,27 +34,21 @@
 | 
				
			|||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <div class="js-ec-opts">
 | 
					      <div class="js-ec-opts">
 | 
				
			||||||
        <p>EC Options:</p>
 | 
					        <p>EC Options:</p>
 | 
				
			||||||
        <input type="radio" id="-crv2"
 | 
					        <label for="-crv2"><input type="radio" id="-crv2"
 | 
				
			||||||
         name="ec-crv" value="P-256" checked>
 | 
					         name="ec-crv" value="P-256" checked>P-256</label>
 | 
				
			||||||
        <label for="-crv2">P-256</label>
 | 
					        <label for="-crv3"><input type="radio" id="-crv3"
 | 
				
			||||||
        <input type="radio" id="-crv3"
 | 
					         name="ec-crv" value="P-384">P-384</label>
 | 
				
			||||||
         name="ec-crv" value="P-384">
 | 
					        <!-- label for="-crv5"><input type="radio" id="-crv5"
 | 
				
			||||||
        <label for="-crv3">P-384</label>
 | 
					         name="ec-crv" value="P-521">P-521</label -->
 | 
				
			||||||
        <!-- input type="radio" id="-crv5"
 | 
					 | 
				
			||||||
         name="ec-crv" value="P-521">
 | 
					 | 
				
			||||||
        <label for="-crv5">P-521</label -->
 | 
					 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <div class="js-rsa-opts" hidden>
 | 
					      <div class="js-rsa-opts" hidden>
 | 
				
			||||||
        <p>RSA Options:</p>
 | 
					        <p>RSA Options:</p>
 | 
				
			||||||
        <input type="radio" id="-modlen2"
 | 
					        <label for="-modlen2"><input type="radio" id="-modlen2"
 | 
				
			||||||
         name="rsa-len" value="2048" checked>
 | 
					         name="rsa-len" value="2048" checked>2048</label>
 | 
				
			||||||
        <label for="-modlen2">2048</label>
 | 
					        <label for="-modlen3"><input type="radio" id="-modlen3"
 | 
				
			||||||
        <input type="radio" id="-modlen3"
 | 
					         name="rsa-len" value="3072">3072</label>
 | 
				
			||||||
         name="rsa-len" value="3072">
 | 
					        <label for="-modlen5"><input type="radio" id="-modlen5"
 | 
				
			||||||
        <label for="-modlen3">3072</label>
 | 
					         name="rsa-len" value="4096">4096</label>
 | 
				
			||||||
        <input type="radio" id="-modlen5"
 | 
					 | 
				
			||||||
         name="rsa-len" value="4096">
 | 
					 | 
				
			||||||
        <label for="-modlen5">4096</label>
 | 
					 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <button class="js-generate" hidden>Generate</button>
 | 
					      <button class="js-generate" hidden>Generate</button>
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
@ -67,6 +61,11 @@
 | 
				
			|||||||
      <label for="-acmeDomains">Domains:</label>
 | 
					      <label for="-acmeDomains">Domains:</label>
 | 
				
			||||||
      <input class="js-domains" type="text" id="-acmeDomains">
 | 
					      <input class="js-domains" type="text" id="-acmeDomains">
 | 
				
			||||||
      <br>
 | 
					      <br>
 | 
				
			||||||
 | 
					      <label for="-http01"><input type="radio" id="-http01"
 | 
				
			||||||
 | 
					       name="acme-challenge-type" value="http-01" checked>http-01</label>
 | 
				
			||||||
 | 
					      <label for="-dns01"><input type="radio" id="-dns01"
 | 
				
			||||||
 | 
					       name="acme-challenge-type" value="dns-01">dns-01</label>
 | 
				
			||||||
 | 
					      <br>
 | 
				
			||||||
      <button class="js-create-account" hidden>Create Account</button>
 | 
					      <button class="js-create-account" hidden>Create Account</button>
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -433,7 +433,7 @@ ACME._postChallenge = function (me, options, auth) {
 | 
				
			|||||||
   */
 | 
					   */
 | 
				
			||||||
  function deactivate() {
 | 
					  function deactivate() {
 | 
				
			||||||
    if (me.debug) { console.debug('[acme-v2.js] deactivate:'); }
 | 
					    if (me.debug) { console.debug('[acme-v2.js] deactivate:'); }
 | 
				
			||||||
    return ACME._jwsRequest({
 | 
					    return ACME._jwsRequest(me, {
 | 
				
			||||||
      options: options
 | 
					      options: options
 | 
				
			||||||
    , url: auth.url
 | 
					    , url: auth.url
 | 
				
			||||||
    , protected: { kid: options._kid }
 | 
					    , protected: { kid: options._kid }
 | 
				
			||||||
@ -508,7 +508,7 @@ ACME._postChallenge = function (me, options, auth) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  function respondToChallenge() {
 | 
					  function respondToChallenge() {
 | 
				
			||||||
    if (me.debug) { console.debug('[acme-v2.js] responding to accept challenge:'); }
 | 
					    if (me.debug) { console.debug('[acme-v2.js] responding to accept challenge:'); }
 | 
				
			||||||
    return ACME._jwsRequest({
 | 
					    return ACME._jwsRequest(me, {
 | 
				
			||||||
      options: options
 | 
					      options: options
 | 
				
			||||||
    , url: auth.url
 | 
					    , url: auth.url
 | 
				
			||||||
    , protected: { kid: options._kid }
 | 
					    , protected: { kid: options._kid }
 | 
				
			||||||
@ -569,7 +569,7 @@ ACME._finalizeOrder = function (me, options, validatedDomains) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function pollCert() {
 | 
					    function pollCert() {
 | 
				
			||||||
      if (me.debug) { console.debug('[acme-v2.js] pollCert:'); }
 | 
					      if (me.debug) { console.debug('[acme-v2.js] pollCert:'); }
 | 
				
			||||||
      return ACME._jwsRequest({
 | 
					      return ACME._jwsRequest(me, {
 | 
				
			||||||
        options: options
 | 
					        options: options
 | 
				
			||||||
      , url: options._finalize
 | 
					      , url: options._finalize
 | 
				
			||||||
      , protected: { kid: options._kid }
 | 
					      , protected: { kid: options._kid }
 | 
				
			||||||
@ -710,7 +710,7 @@ ACME._getCertificate = function (me, options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    var payload = JSON.stringify(body);
 | 
					    var payload = JSON.stringify(body);
 | 
				
			||||||
    if (me.debug) { console.debug('\n[DEBUG] newOrder\n'); }
 | 
					    if (me.debug) { console.debug('\n[DEBUG] newOrder\n'); }
 | 
				
			||||||
    return ACME._jwsRequest({
 | 
					    return ACME._jwsRequest(me, {
 | 
				
			||||||
      options: options
 | 
					      options: options
 | 
				
			||||||
    , url: me._directoryUrls.newOrder
 | 
					    , url: me._directoryUrls.newOrder
 | 
				
			||||||
    , protected: { kid: options._kid }
 | 
					    , protected: { kid: options._kid }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user