@me2em/crypto
    Preparing search index...

    Function generateSignedPreKey

    • Generates a Signed Pre-Key: X25519 keypair + identity-key signature over its public key.

      Why the signature? The initiator downloads SPK from an untrusted server. Without the signature, a malicious server could substitute its own SPK and position itself as a man-in-the-middle. The signature (by the long-lived identity key) lets the initiator verify that the SPK is authentic.

      Parameters

      Returns SignedPreKey

      SignedPreKey with X25519 keypair and 64B signature.

      const spk = generateSignedPreKey(identity);
      // spk.signature is Ed25519(pubKey, identity.priv)