Skip to content

generateEciesKeyPair

generateEciesKeyPair(): Promise<CryptoKeyPair>

Defined in: packages/core/src/ecies.ts:322

Generate a fresh P-256 ECDH key pair suitable for ECIES sealing. The private key has deriveBits usage so it can be passed directly to eciesOpen.

The returned public key is extractable so callers can hand the SEC1 bytes to inviters (via exportEciesPublicKey). The returned private key is re-imported as non-extractable to prevent crypto.subtle.exportKey from ever recovering the secret scalar (PKCS8 / JWK forms) from the in-memory CryptoKey. This is the conventional defence-in-depth posture for KEM private keys — eciesOpen only needs deriveBits, which non-extractable keys still support.

Promise<CryptoKeyPair>