RAILGUN Reloaded
    Preparing search index...

    Memo encoding, decoding, and V2 annotation data encryption/decryption.

    Index
    • Encodes a memo text string into a Uint8Array using UTF-8 encoding.

      Parameters

      • memoText: string | undefined

        The memo text to encode, or undefined

      Returns Uint8Array

      Uint8Array of the UTF-8 encoded text (empty array if undefined)

    • Decodes a UTF-8 encoded Uint8Array back to a memo text string.

      Parameters

      • encoded: Uint8Array

        The UTF-8 encoded bytes

      Returns string | null

      The decoded string, or null if the input is empty

    • Creates encrypted V2 annotation data for a transact note.

      Layout (3 blocks of 16 bytes each, AES-CTR encrypted):

      • Block 0: [outputType (1 byte)][senderRandom (15 bytes)]
      • Block 1: [16 zero bytes (reserved)]
      • Block 2: [walletSource encoded base-37, left-padded to 16 bytes]

      Output: [IV (16 bytes)][encrypted block 0 (16 bytes)][encrypted block 1 (16 bytes)][encrypted block 2 (16 bytes)]

      Parameters

      • outputType: OutputType

        The output type (Transfer, BroadcasterFee, Change)

      • senderRandom: string

        15-byte random value as hex string (30 hex chars)

      • walletSource: string

        Wallet source identifier string

      • viewingPrivateKey: Uint8Array

        32-byte viewing private key used as AES-CTR encryption key

      Returns Uint8Array

      Uint8Array containing IV + encrypted blocks (64 bytes)

    • Decrypts V2 annotation data from a transact note.

      Parameters

      • annotationData: Uint8Array

        The encrypted annotation data bytes

      • viewingPrivateKey: Uint8Array

        32-byte viewing private key used as AES-CTR decryption key

      Returns NoteAnnotationData | null

      NoteAnnotationData or null if decryption fails

    • Decrypts the sender random value from annotation data. Returns the sender random hex string, or MEMO_SENDER_RANDOM_NULL if decryption fails.

      Parameters

      • annotationData: Uint8Array

        The encrypted annotation data bytes

      • viewingPrivateKey: Uint8Array

        32-byte viewing private key

      Returns string

      Hex string of the sender random (30 hex chars), or the null constant