@me2em/crypto
    Preparing search index...

    Function ed25519PubToX25519

    • Converts an Ed25519 PUBLIC key to its X25519 (Montgomery) form.

      Used in X3DH to convert the recipient's identity public key (Ed25519) to X25519 for ECDH operations. Uses @noble/curves ed25519.utils.toMontgomery() which accepts both private and public keys.

      Parameters

      • edPublicKey: Uint8Array

        32-byte Ed25519 public key.

      Returns Uint8Array

      32-byte X25519 public key.

      'INVALID_LENGTH' if input ≠ 32B.

      const xPub = ed25519PubToX25519(edPubKey);
      const shared = x25519SharedSecret(ephemeralPriv, xPub);