# PRC-4: Authenticated Data with Associated Data (ADAD)¶

Number Type Title Authors Status Created
4 PRC Lean Universal Local Wallets Henry Gressmann [email protected] draft March 3rd, 2022

## The ADAD-Format¶

ADAD is a straightforward, future-proof protocol for creating authenticated data. ADAD primary purpose is to describe and authenticate self-contained binary data. It's essentially a length-prefix framing with the addition of a multiformats codec field.

## Format¶

 <associated-data size><associated data codec><associated data><authenticated-data size><authenticated-data codec><authenticated-data> 

Binary example

as-size  as-codec as-data           au-size  au-codec authenticated data
-------- -------- ----------------- -------- -------- -----------------------------------
00000010 01010000 10110110 11111000 00000010 01010000 11111111 11111111 11111111 11111111
1 byte   1 byte   2 byte            1 byte   1 byte   4 byte

• Data Size (as-size/au-size)
Most Significant Bit unsigned varint, as defined by multiformats/unsigned-varint
• Associated Data (as-data)
Arbitrary, binary data. For maximum compatibility, this data can be in any format. At pog.network, it is serialized using protobufs. This should include all information necessary to authenticate the authenticated data. In the case of pog.network, this is usually a signature and the algorithm used to sign the data.
• Authenticated Data
Arbitrary, binary data. Should ideally be encoded using a serialization mechanism like protocol buffers or similar.
• Codecs (as-codec/au-codec)
Most Significant Bit unsigned varint, as defined by multiformats/unsigned-varint. This number represents a codec that is part of the multicodec table. In most cases for use in pog.network, this will be protobuf (0x50).