When using Ed25519 keys, you do not specify a digest (e.g., "sha256") in Node.js. Instead of creating a Sign object with createSign("ed25519"), you simply call crypto.sign() directly, passing null for the digest and the raw data as a Buffer. For example:
const { sign } = require('crypto');
function signDataWithEd25519(privateKey, data) {
// For Ed25519, the first argument (digest) must be null
return sign(null, Buffer.from(data), privateKey);
}