ECDH.setPrivateKey method | Node.js crypto module | Bun
BuildDocsReferenceGuidesBlogDiscord/
node:crypto/
ECDH/
setPrivateKeyMsetPrivateKey
Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/
node:crypto/
ECDH/
setPrivateKeyMsetPrivateKey
method
crypto.ECDH.setPrivateKeysetPrivateKey(privateKey: ArrayBufferView): void;
Sets the EC Diffie-Hellman private key. If encoding is provided, privateKey is expected to be a string; otherwise privateKey is expected to be a Buffer, TypedArray, or DataView.
If privateKey is not valid for the curve specified when the ECDH object was created, an error is thrown. Upon setting the private key, the associated public point (key) is also generated and set in the ECDH object.
setPrivateKey(privateKey: string,encoding:
BinaryToTextEncoding): void;
Sets the EC Diffie-Hellman private key. If encoding is provided, privateKey is expected to be a string; otherwise privateKey is expected to be a Buffer, TypedArray, or DataView.
If privateKey is not valid for the curve specified when the ECDH object was created, an error is thrown. Upon setting the private key, the associated public point (key) is also generated and set in the ECDH object.
@param encoding
The encoding of the privateKey string.
Referenced typestype
BinaryToTextEncoding = 'base64' | 'base64url' | 'hex' | 'binary'
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlog Toolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →