test ecdsa support, spaces for whitespace
This commit is contained in:
		
							parent
							
								
									cda26c98b5
								
							
						
					
					
						commit
						c66f92d506
					
				@ -14,6 +14,32 @@
 | 
				
			|||||||
  var PromiseA = window.Promise;
 | 
					  var PromiseA = window.Promise;
 | 
				
			||||||
  var crypto = window.crypto;
 | 
					  var crypto = window.crypto;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  function testEcdsaSupport() {
 | 
				
			||||||
 | 
					    var opts = {
 | 
				
			||||||
 | 
					      type: 'ECDSA'
 | 
				
			||||||
 | 
					    , bitlength: '256'
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    return BACME.accounts.generateKeypair(opts).then(function (jwk) {
 | 
				
			||||||
 | 
					      return crypto.subtle.importKey(
 | 
				
			||||||
 | 
					        "jwk"
 | 
				
			||||||
 | 
					      , jwk
 | 
				
			||||||
 | 
					      , { name: "ECDSA", namedCurve: "P-256" }
 | 
				
			||||||
 | 
					      , true
 | 
				
			||||||
 | 
					      , ["sign"]
 | 
				
			||||||
 | 
					      ).then(function (privateKey) {
 | 
				
			||||||
 | 
					        return window.crypto.subtle.exportKey("pkcs8", privateKey);
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  testEcdsaSupport().then(function () {
 | 
				
			||||||
 | 
					    console.log("supports ECDSA");
 | 
				
			||||||
 | 
					    BROWSER_SUPPORTS_ECDSA = true;
 | 
				
			||||||
 | 
					  }).catch(function () {
 | 
				
			||||||
 | 
					    console.log("DOES NOT supports ECDSA");
 | 
				
			||||||
 | 
					    BROWSER_SUPPORTS_ECDSA = false;
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					  // TODO test RSA support
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  var apiUrl = 'https://acme-{{env}}.api.letsencrypt.org/directory';
 | 
					  var apiUrl = 'https://acme-{{env}}.api.letsencrypt.org/directory';
 | 
				
			||||||
  function updateApiType() {
 | 
					  function updateApiType() {
 | 
				
			||||||
    console.log("type updated");
 | 
					    console.log("type updated");
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user