Skip to main content

computeSecret

method DiffieHellman.prototype.computeSecret
Jump to headingDiffieHellman.prototype.computeSecret(
otherPublicKey: ArrayBufferView,
inputEncoding?: null,
outputEncoding?: null,
): 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 the specified inputEncoding, and secret is encoded using specified outputEncoding. If the inputEncoding is not provided, otherPublicKey is expected to be a Buffer, TypedArray, or DataView.

If outputEncoding is given a string is returned; otherwise, a Buffer is returned.

Parameters Jump to heading

Jump to headingotherPublicKey: ArrayBufferView
optional
Jump to headinginputEncoding: null

The encoding of an otherPublicKey string.

optional
Jump to headingoutputEncoding: null

The encoding of the return value.

Return Type Jump to heading

Buffer
Jump to headingDiffieHellman.prototype.computeSecret(
otherPublicKey: string,
inputEncoding: BinaryToTextEncoding,
outputEncoding?: null,
): Buffer

Parameters Jump to heading

Jump to headingotherPublicKey: string
optional
Jump to headingoutputEncoding: null

Return Type Jump to heading

Buffer
Jump to headingDiffieHellman.prototype.computeSecret(
otherPublicKey: ArrayBufferView,
inputEncoding: null,
outputEncoding: BinaryToTextEncoding,
): string

Parameters Jump to heading

Jump to headingotherPublicKey: ArrayBufferView
Jump to headinginputEncoding: null

Return Type Jump to heading

string
Jump to headingDiffieHellman.prototype.computeSecret(
otherPublicKey: string,
inputEncoding: BinaryToTextEncoding,
outputEncoding: BinaryToTextEncoding,
): string

Parameters Jump to heading

Return Type Jump to heading

string
Back to top