ts-algochat
    Preparing search index...

    Function deriveMsgKey

    • Derives the per-message msg key from a shared view secret and counter.

      msg_key = HMAC-SHA256(key = view_secret, "raven/mailbox/v1" ‖ counter_be32)

      Parameters

      • viewSecret: Uint8Array

        32-byte secret shared sender↔recipient

      • counter: number

        uint32 rotation counter (advance per message)

      Returns Uint8Array

      32-byte msg key

      InvalidViewSecretError if the secret is not 32 bytes

      InvalidCounterError if the counter is not a uint32