title: how to import ECDH public key (Cannot create a key using the specified key usages)
body: <p>I am trying to run code with webcrypto but cannot seem to import ECDH public key. What am I missing ?</p>
  
  <p>I get this error: <strong>cannot create a key using the specified key usages</strong>.</p>
  
  <p>Browser: Google Chrome Version 71.0.3578.98 (Official Build) (64-bit)</p>
  
  <p>(Works fine on Firefox).</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>window.crypto.subtle
    .generateKey(
      {
        name: 'ECDH',
        namedCurve: 'P-256',
      },
      true,
      ['deriveKey', 'deriveBits']
    )
    .then(function(key) {
      return window.crypto.subtle
        .exportKey('raw', key.publicKey)
        .then(function(ecdhPub) {
          return window.crypto.subtle
            .importKey(
              'raw',
              ecdhPub,
              {
                name: 'ECDH',
                namedCurve: 'P-256',
              },
              false,
              ['deriveKey', 'deriveBits']
            )
            .then(function(ecdhPubKey) {
              console.log('DONE !!', ecdhPubKey)
            })
            .catch(function(err) {
              console.log('COULD NOT IMPORT...')
              console.error(err)
            })
        })
        .catch(function(err) {
          console.log('COULD NOT EXPORT...')
          console.error(err)
        })
    })
    .catch(function(err) {
      console.log('COULD NOT GENERATE KEYS...')
      console.error(err)
    })</code></pre>
  </div>
  </div>
  </p>