Closed jrschumacher closed 4 months ago
No concerns from my POV
Attributes are stored in Policy the max size is 2^16 -1 in NanoTDF?https://github.com/virtru/nanotdf/blob/master/spec/index.md
@sujankota according to https://github.com/virtru/nanotdf/blob/master/spec/index.md#342-policy the policy has a Maximum Length (B)
of 255. Am I misreading this?
We use Embedded Policy for nanoTDF.
Encrypted policy could be upto 64kb
This work is not needed (see comments above).
ADR: NanoTDF Attribute Storage Optimization in 255-bytes
Context and Problem Statement
We need to store attributes in the nanotdf policy header, but it has a maximum length of 255 bytes. The current attribute value in ztdf is in the form of a Fully Qualified Name (FQN) as JSON. Even removing the JSON overhead, the FQN is still too verbose to store multiple attributes within the 255-byte limit.
Example:
The goal is to define a syntax that will compress the data to allow for efficient storage of multiple attributes within the 255-byte limit.
Considered Options
Decision Outcome
We have decided to use the Schema-Based Syntax with Full URLs. This decision was made based on the need for a federatable and customer-friendly approach that retains full attribute names and avoids using indexes.
We also considered Protobuf Compression for further optimization, however this makes ease of debugging more difficult since the data cannot be easily read without a protobuf decoder.
Options
Option 1: Schema-Based Syntax with Full URLs
Format:
Components:
schema
): A digit representing the URL schema (0 for HTTP, 1 for HTTPS).base_url
): The full namespace URL without the schema.{attribute}:{value}
pairs separated by semicolons (;
). Multiple values within an attribute are separated by commas (,
).Example:
Advantages:
Disadvantages:
Approximate Range of Attributes
Given the 255-byte limit, the number of attributes that can be stored depends on the length of the base URLs and attribute names. For estimation:
Example calculation for a single attribute set:
This example is about 40 bytes.
For multiple attributes:
This example is about 60 bytes.
For multiple attributes across multiple namespaces:
This example is about 240 bytes.
Therefore, approximately 15-20 attributes of similar length can be stored within the 255-byte limit.
Example
See playground https://go.dev/play/p/M9s8QOtTn4Y
Option 2: Index-Based Syntax
Format:
Components:
schema
): A digit representing the URL schema (0 for HTTP, 1 for HTTPS).index
): A numeric index representing the base URL.{attribute_index}:{value_index}
pairs separated by semicolons (;
). Multiple values within an attribute are separated by commas (,
).Example:
Advantages:
Disadvantages:
Option 3: Protobuf Compression
Protobuf can serialize the data into a compact binary format, potentially reducing the size further than ASCII or other text-based formats.
Advantages:
Disadvantages:
Protobuf Example