@me2em/crypto
    Preparing search index...

    Function rotateChannel

    • Rotates the channel root key: epoch+1, fresh root material, sequence reset.

      ───────────────────────────────────────────────────────────── What rotation achieves ─────────────────────────────────────────────────────────────

      • Forward secrecy at ROTATION POINTS: compromise of the current root does NOT reveal messages encrypted under previous epochs.
      • This is epoch rotation, NOT a Double Ratchet: rotation is an explicit application decision (e.g. on membership change, on timer, on explicit user action).

      Derivation: newRoot = HKDF(oldRoot, salt='rotate', info=epoch+1) The old root material is wiped. Messages from previous epochs become undecryptable — that is the point.

      Parameters

      • channel: Channel

        The channel to rotate (mutated in place, new object returned).

      Returns Promise<Channel>

      A NEW Channel object with epoch+1 and fresh internals (fresh replay window — the sequence space restarts). The object is brand-validated (D1) and frozen (D2). The old channel object is immediately invalidated (internals dropped).

      const newChannel = await rotateChannel(channel);
      // old channel is now dead — encrypt/decrypt will throw
      // use newChannel for all subsequent operations