method ECDH.prototype.computeSecret
Jump to headingECDH.prototype.computeSecret(otherPublicKey: ArrayBufferView): Buffer
Computes the shared secret using otherPublicKey
as the other
party's public key and returns the computed shared secret. The supplied
key is interpreted using specified inputEncoding
, and the returned secret
is encoded using the specified outputEncoding
.
If the inputEncoding
is not
provided, otherPublicKey
is expected to be a Buffer
, TypedArray
, or DataView
.
If outputEncoding
is given a string will be returned; otherwise a Buffer
is returned.
ecdh.computeSecret
will throw anERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY
error when otherPublicKey
lies outside of the elliptic curve. Since otherPublicKey
is
usually supplied from a remote user over an insecure network,
be sure to handle this exception accordingly.
Parameters Jump to heading
Jump to headingotherPublicKey: ArrayBufferView
Return Type Jump to heading
Buffer
Jump to headingECDH.prototype.computeSecret(otherPublicKey: string,inputEncoding: BinaryToTextEncoding,): Buffer
Parameters Jump to heading
Jump to headingotherPublicKey: string
Jump to headinginputEncoding: BinaryToTextEncoding
Return Type Jump to heading
Buffer
Jump to headingECDH.prototype.computeSecret(otherPublicKey: ArrayBufferView,outputEncoding: BinaryToTextEncoding,): string
Parameters Jump to heading
Jump to headingotherPublicKey: ArrayBufferView
Jump to headingoutputEncoding: BinaryToTextEncoding
Return Type Jump to heading
string
Jump to headingECDH.prototype.computeSecret(): string
Parameters Jump to heading
Jump to headingotherPublicKey: string
Jump to headinginputEncoding: BinaryToTextEncoding
Jump to headingoutputEncoding: BinaryToTextEncoding
Return Type Jump to heading
string