@me2em/crypto
    Preparing search index...

    Function ed25519PrivToX25519

    • Converts an Ed25519 private key to its X25519 equivalent (RFC 7748 Montgomery form) — needed for identity keys, which are Ed25519 in Me2eM but must participate in ECDH.

      Uses @noble/curves ed25519.utils.toMontgomerySecret() for correct clamping per RFC 7748 Section 5.

      Parameters

      • edPrivateKey: Uint8Array

        32-byte Ed25519 private key.

      Returns Uint8Array

      32-byte X25519-compatible private key.

      'KEY/INVALID_LENGTH' if input ≠ 32B.

      const xPriv = ed25519PrivToX25519(edPrivKey);
      const xPub = deriveX25519PublicKey(xPriv);