I generate the ECDH keys in this way
let _this = this;
window.crypto.subtle.generateKey(
{
name: "ECDH",
namedCurve: "P-256", // the curve name
},
true, // <== Here if you want it to be exportable !!
["deriveKey", "deriveBits"] // usage
)
.then(key => {
_this.keys = key;
// export
return window.crypto.subtle.exportKey(
"raw", //can be "jwk" (public or private), "raw" (public only), "spki" (public only), or "pkcs8" (private only)
_this.keys.publicKey
)
.then(rawPublicKey => {
_this.publicKey = rawPublicKey;
return rawPublicKey;
})
})
In this way i have the cryptokeys and the raw (x,y coords) public key.
I would use the keys for using it for ECDSA
How can I do that?