crypto.x25519.public
Derive an X25519 public key.
📝Syntax
publicKey = crypto.x25519.public(secretKey)
📥Input Arguments
Parameter Description
secretKey a uint8 vector of 32 bytes or 64 hexadecimal characters: private key.
📤Output Arguments
Parameter Description
publicKey a character vector: 64 lowercase hexadecimal characters (32 bytes).
📄Description

crypto.x25519.public derives the Curve25519 public key (RFC 7748) matching a 32-byte secret key.

Generate the secret key with crypto.random(32) or use crypto.x25519.keypair to get both at once.

💡Examples
derive the public key from a secret
sec = crypto.random(32, '-hex');
pub = crypto.x25519.public(sec)
🔗See Also
crypto.x25519.sharedcrypto.x25519.keypaircrypto.random
Used Functions
Monocypher
📚Bibliography
https://www.rfc-editor.org/rfc/rfc7748, https://monocypher.org/
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub