Trust & Content Distribution

How trust relationships enable automatic content approval and efficient message distribution across the federated network.

Auto-Approval for Trusted Connections

When receiving actions from connected users, the system can automatically create approval (APRV) tokens, enabling content to spread through the network via trusted relationships.

Auto-Approval Conditions

For an action to be auto-approved, ALL of the following must be true:

  1. Approvable action type: Action type has approvable=true behavior
    • Applies to: POST, MSG, REPOST
  2. Addressed to us: action.audience == our_id_tag
  3. From different user: action.issuer != our_id_tag
  4. Setting enabled: profile.auto_approve_actions = true in settings
  5. Connection established: Issuer has bidirectional connection with us

Auto-Approval Flow

Inbound action received
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Check auto-approval         β”‚
β”‚ conditions (all 5)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
    β”‚               β”‚
    β–Ό               β–Ό
Conditions      Conditions
met             not met
    β”‚               β”‚
    β–Ό               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  No action
β”‚ Update      β”‚  (standard
β”‚ action      β”‚  processing)
β”‚ status='A'  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Create APRV token           β”‚
β”‚ - aud = original issuer     β”‚
β”‚ - sub = action_id           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Deliver APRV to issuer      β”‚
β”‚ (notification)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Broadcast APRV + action     β”‚
β”‚ to our followers            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Trust Indicator

Trust = Bidirectional Connection

The system checks issuer_profile.connected.is_connected() to determine trust. A connection is established when both parties have sent CONN tokens to each other.

Subscriber Fan-Out

For subscribable actions (like CONV), messages need to be delivered to all subscribers. The fan-out mechanism ensures efficient message distribution across the federated network.

Subscribable Actions

Actions with subscribable=true behavior can have subscribers:

  • CONV (Conversation) - subscribers receive messages in the group

Fan-Out Algorithm

schedule_subscriber_fanout(action_id, parent_id, issuer):
    1. Walk parent chain to find subscribable root:
       current = parent_id
       while current:
           parent_action = get_action(current)  // local DB lookup
           if is_subscribable(parent_action.type):
               subscribable_root = parent_action
               break
           current = parent_action.parent_id

    2. Check if we own the subscribable root:
       is_local = (subscribable_root.audience == null
                   && subscribable_root.issuer == our_id_tag)
                  || subscribable_root.audience == our_id_tag

       if not is_local:
           return  // Remote owner handles fan-out

    3. Get subscribers:
       subscribers = query_subscriptions(subscribable_root.action_id)
                     .filter(status = 'A')  // Active only

    4. Create delivery tasks:
       for subscriber in subscribers:
           if subscriber != our_id_tag
              && subscriber != issuer:  // Exclude self and sender
               schedule_delivery_task(
                   action_id,
                   subscriber,
                   key = "fanout:{action_id}:{subscriber}"
               )

Local vs Remote Fan-Out

Scenario 1: Local CONV Owner Sends Message

Alice (CONV owner) sends MSG
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ActionCreatorTask           β”‚
β”‚ - Creates MSG               β”‚
β”‚ - Calls schedule_delivery() β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ schedule_subscriber_fanout()β”‚
β”‚ - Finds CONV (subscribable) β”‚
β”‚ - CONV is local (we own it) β”‚
β”‚ - Gets all SUBS             β”‚
β”‚ - Schedules delivery to eachβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
    Bob, Charlie receive MSG
    (all other subscribers)

Scenario 2: Remote Subscriber Sends Message

Bob (subscriber, not owner) sends MSG
on his instance
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ schedule_subscriber_fanout()β”‚
β”‚ - Finds CONV (subscribable) β”‚
β”‚ - CONV is NOT local         β”‚
β”‚ - No local fan-out          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ schedule_delivery()         β”‚
β”‚ - Deliver to CONV owner     β”‚
β”‚   (Alice)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό (federation)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Alice's instance receives   β”‚
β”‚ MSG at /inbox               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ schedule_subscriber_fanout()β”‚
β”‚ - CONV is local to Alice    β”‚
β”‚ - Fan out to all except Bob β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
    Charlie, others receive MSG

When delivering certain actions (like APRV), related actions are bundled together in a single delivery to provide context.

Bundling Use Cases

  1. APRV + Approved POST: When broadcasting an approval, include the approved content
  2. INVT + Subject CONV: When inviting, include the conversation details

Delivery Payload Structure

{
  "token": "eyJhbGciOi...MAIN_ACTION_TOKEN",
  "related": [
    "eyJhbGciOi...RELATED_ACTION_TOKEN_1",
    "eyJhbGciOi...RELATED_ACTION_TOKEN_2"
  ]
}
Inbox receives action with related tokens
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Store related tokens        β”‚
β”‚ - Status = 'W' (waiting)    β”‚
β”‚ - ack_token = main action   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Process main action         β”‚
β”‚ - Verify signature          β”‚
β”‚ - Check permissions         β”‚
β”‚ - Store action              β”‚
β”‚ - Execute on_receive hook   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ process_related_actions()   β”‚
β”‚ - Get tokens with           β”‚
β”‚   ack_token = main action   β”‚
β”‚ - For each:                 β”‚
β”‚   - Skip permission check   β”‚
β”‚   - Verify signature        β”‚
β”‚   - Store action            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key point: Related actions skip permission checks because they are pre-approved by the main action issuer. The trust flows from the APRV issuer to the related content.

APRV Broadcast Example

Alice approves Bob's POST
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Create APRV                 β”‚
β”‚ - sub = Bob's post action_idβ”‚
β”‚ - Check: subject.broadcast  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ schedule_broadcast_delivery β”‚
β”‚ - Get Alice's followers     β”‚
β”‚ - Include Bob's POST token  β”‚
β”‚   as related action         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ For each follower:          β”‚
β”‚ POST /inbox                 β”‚
β”‚ {                           β”‚
β”‚   token: APRV_token,        β”‚
β”‚   related: [POST_token]     β”‚
β”‚ }                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

See Also