@me2em/crypto
    Preparing search index...

    Function generatePreKeyBatch

    • Generates a PreKey batch: 1 Signed Pre-Key + N One-Time Pre-Keys.

      The SPK is signed with the identity key. OTKs are raw X25519 keypairs. All keypairs are 32-byte X25519 (not Ed25519).

      This is called by the client when the server reports the OTK store is below the refill threshold (50, per BL-27).

      Parameters

      • identity: IdentityKeys

        Identity key pair (Ed25519).

      • otkCount: number = 100

        Number of OTKs (default 100).

      Returns PreKeyBatch

      PreKeyBatch with SPK, OTKs, and OTK public key b64 list.

      'INVALID_ARGUMENT' if otkCount > 1000.

      const batch = generatePreKeyBatch(identity, 100);
      // publish batch.signedPreKey + batch.oneTimePreKeyPublicB64 to server