Hubert - Distributed Infrastructure for Secure Multiparty Transactions - v1.0.0-alpha.20
    Preparing search index...

    Function obfuscateWithArid

    • Obfuscate or deobfuscate data using ChaCha20 with an ARID-derived key.

      This function uses ChaCha20 as a stream cipher to XOR the data with a keystream derived from the ARID. Since XOR is symmetric, the same function is used for both obfuscation and deobfuscation.

      The result appears as uniform random data to anyone who doesn't have the ARID, hiding both the structure and content of the reference envelope.

      Port of obfuscate_with_arid() from arid_derivation.rs lines 47-91.

      Parameters

      • arid: ARID

        The ARID used to derive the obfuscation key

      • data: Uint8Array

        The data to obfuscate or deobfuscate

      Returns Uint8Array

      The obfuscated (or deobfuscated) data

      const obfuscated = obfuscateWithArid(arid, plaintext);
      const deobfuscated = obfuscateWithArid(arid, obfuscated);
      // deobfuscated === plaintext