Files
rfc-index/status/raw/url-data.md
Jimmy Debe ff87c84dc7 Update Waku Links (#104)
Change Waku links that do not point to master waku/specs repo. Also
update title for template, to look better on the rfc website.
2024-11-20 12:32:56 -05:00

4.2 KiB

title, name, status, category, tags, editor, contributors
title name status category tags editor contributors
STATUS-URL-DATA Status URL Data raw Standards Track Felicio Mununga <felicio@status.im>
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

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

Compression

Serialization

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

Discussions

Proof of concept

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