Blockchain Commons Crypto TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Function x25519SharedKey

    • Compute a shared symmetric key using X25519 key agreement (ECDH).

      This function performs X25519 Diffie-Hellman key agreement and then derives a symmetric key using HKDF-SHA256 with "agreement" as the salt. This matches the Rust bc-crypto implementation for cross-platform compatibility.

      Parameters

      • x25519Private: Uint8Array

        32-byte X25519 private key

      • x25519Public: Uint8Array

        32-byte X25519 public key from the other party

      Returns Uint8Array

      32-byte derived symmetric key

      If private key is not 32 bytes or public key is not 32 bytes