# STATUS-URL-DATA | Vac Research
- Status: raw

Skip to main content

# STATUS-URL-DATA

- Status: raw
- Category: Standards Track
- Editor: Felicio Mununga <felicio@status.im>
- Contributors:
  - Aaryamann Challani <aaryamann@status.im>

## Abstract​

This document specifies serialization, compression, and encoding techniques used to transmit data within URLs in the context of Status protocols.

## Motivation​

When sharing URLs, link previews often expose metadata to the websites behind those links. To reduce reliance on external servers for providing appropriate link previews, this specification proposes a standard method for encoding data within URLs.

## Terminology​

- Community: Refer to STATUS-COMMUNITIES
- Channel: Refer to terminology in STATUS-COMMUNITIES
- User: Refer to terminology in STATUS-COMMUNITIES
- Shard Refer to terminology in WAKU2-RELAY-SHARDING

## Wire Format​

    syntax = "proto3";

    message Community {
        // Display name of the community
        string display_name = 1;
        // Description of the community
        string description = 2;
        // Number of members in the community
        uint32 members_count = 3;
        // Color of the community title
        string color = 4;
        // List of tag indices
        repeated uint32 tag_indices = 5;
    }

    message Channel {
        // Display name of the channel
        string display_name = 1;
        // Description of the channel
        string description = 2;
        // Emoji of the channel
        string emoji = 3;
        // Color of the channel title
        string color = 4;
        // Community the channel belongs to
        Community community = 5;
        // UUID of the channel
        string uuid = 6;
    }

    message User {
        // Display name of the user
        string display_name = 1;
        // Description of the user
        string description = 2;
        // Color of the user title
        string color = 3;
    }

    message URLData {
        // Community, Channel, or User
        bytes content = 1;
        uint32 shard_cluster = 2;
        uint32 shard_index = 3;
    }

## Implementation​

The above wire format describes the data encoded in the URL. The data MUST be serialized, compressed, and encoded using the following standards:

Encoding

- Base64url

### Compression​

- Brotli

### Serialization​

- Protocol buffers version 3

### Implementation Pseudocode​

Encoding

Encoding the URL MUST be done in the following order:

    raw_data = {User | Channel | Community}
    serialized_data = protobuf_serialize(raw_data)
    compressed_data = brotli_compress(serialized_data)
    encoded_url_data = base64url_encode(compressed_data)

The `encoded_url_data` is then used to generate a signature using the private key.

#### Decoding​

Decoding the URL MUST be done in the following order:

    url_data = base64url_decode(encoded_url_data)
    decompressed_data = brotli_decompress(url_data)
    deserialized_data = protobuf_deserialize(decompressed_data)
    raw_data = deserialized_data.content

The `raw_data` is then used to construct the appropriate data structure (User, Channel, or Community).

### Example​

- See <https://github.com/status-im/status-web/pull/345/files>

## Discussions​

- See <https://github.com/status-im/status-web/issues/327>

## Proof of concept​

- See <https://github.com/felicio/status-web/blob/825262c4f07a68501478116c7382862607a5544e/packages/status-js/src/utils/encode-url-data.compare.test.ts#L4>

## Copyright​

Copyright and related rights waived via CC0.

## References​

1. Proposal Google Sheet
2. Base64url
3. Brotli
4. Protocol buffers version 3
5. STATUS-URL-SCHEME