Post
A Post refers to a public message generated by a user, typically comprising text or Uniform Resource Identifiers (URIs) linking to other resources. Posts have the option to designate another post as their parent, thereby establishing a threaded conversation. In such a threaded conversation, a root post serves as the initial message with no parent, while reply posts are linked to either the root or its subsequent descendants. Each thread adheres and ensuring that replies can only be generated after their parent post has been hashed and signed.
A post may mention users, but mentions are stored separately from the text property. A mention is created by adding the user's Socon Id to the mentions
array and its position in bytes in the text field into the mentions_positions
array. Posts may have up to 10 mentions.
Posts are submitted through a PostAdd message and deleted using a tombstone PostRemove message. The tombstone mechanism not only prevents the re-addition of the message but also obscures the original message's contents.
message PostAddBody {
repeated string embeds_deprecated = 1; // URLs to be embedded in the post
repeated uint64 mentions = 2; // SoconIds mentioned in the post
oneof parent {
PostId parent_post_id = 3; // Parent post of the post
string parent_url = 7; // Parent URL
};
string text = 4; // Text of the post
repeated uint32 mentions_positions = 5; // Positions of the mentions in the text
repeated Embed embeds = 6; // URLs or post ids to be embedded in the post
repeated Media medias = 8; // add multiple media files
}
message Embed {
oneof embed {
string url = 1;
PostId post_id = 2;
}
}
PostAddBody
For a PostAddBody within a message m to be considered valid, it must meet the following criteria:
- m.signature_scheme should be SIGNATURE_SCHEME_ED25519.
- m.data.type must be MESSAGE_TYPE_POST_ADD.
- m.data.body.type should be PostAddBody.
- m.data.body.embeds_deprecated can include up to two valid UTF-8 strings, each with lengths ranging from 1 to 256 bytes.
- m.data.body.mentions should contain between 0 and 10 256-bit integer values.
- If m.data.body.parent is included, it must be a valid PostId or a UTF-8 string with a length between 1 and 256 bytes.
- m.data.body.text must not exceed 320 bytes and must be a valid UTF-8 string.
- m.data.body.mentions_positions should consist of unique integers ranging from 0 to the length of text, inclusive. The integers in m.data.body.mentions_positions should be in ascending order and should match the number of elements in m.data.body.mentions.
- m.data.body.embeds can contain up to two embeds, each represented by a PostId or a valid UTF-8 string with lengths between 1 and 256 bytes.
message PostRemoveBody {
bytes target_hash = 1; // Hash of the post to remove
}
PostRemoveBody
For a PostRemoveBody within a message m to be considered valid, it must meet the following criteria
- m.signature_scheme should be SIGNATURE_SCHEME_ED25519.
- m.data.type must be MESSAGE_TYPE_POST_REMOVE.
- m.data.body.type should be PostRemoveBody.
- m.data.body.target_hash must be exactly 20 bytes.
message PostId {
uint64 soconId = 1; // SoconId of the user who created the post
bytes hash = 2; // Hash of the post
}
A PostId p is deemed valid if it satisfies the following conditions: p.soconId is an integer greater than 0. p.hash is precisely 20 bytes long.