# Delegation Extension

Lets users show their actions under another user's name.

Extension name: `pub.versia:delegation`

Delegation lets a user's actions be shown under another user's name.

- **Delegator**: The user that actions are shown as.
- **Delegate**: The user that performs the actions.

## Definition

The Delegation extension uses an ID of `pub.versia:delegation`.

If the extension is present, exactly one of the fields **MUST** be specified:

- Extension ID: `pub.versia:delegation`
- Extends: [User](/entities/user)

**Fields**

- `delegator` (`Reference`): If this user performs actions on behalf of another user, **MUST** have a reference to that user.
- `allowed_delegates` (`Reference[]`): If other users perform actions on behalf of this user, **MUST** have a list of references to all such users.

```jsonc title="Example Delegator"
{
    // ...
    "type": "User",
    "id": "0345pq3gy8004",
    // ...
    "extensions": {
        "pub.versia:delegation": {
            "delegator": "versia.example.com:033vprjgf8002"
        }
    }
}
```

```jsonc title="Example Delegates List"
{
    // ...
    "type": "User",
    "id": "033vprjgf8002",
    // ...
    "extensions": {
        "pub.versia:delegation": {
            "allowed_delegates": [
                "versia.example:0345pq3gy8004"
            ]
        }
    }
}
```

## Behavior

Any actions or entities created by the **delegate** **SHOULD** be attributed to the **delegator** user in clients transparently to end-users (e.g. showing the **delegator** user's name and avatar). This allows for a form of "consensual impersonation" that is authorized by the **delegators** and **delegates**.

This is useful as a way to centralize all of a user's many "alt accounts" into a single, unified feed.

If a User names a **delegator** that cannot be fetched, or that does not list them in `allowed_delegates`, instances **MUST** show the User's actions as their own. Instances **SHOULD** check again whenever they refetch either User, so that a withdrawn delegation stops applying.

Delegation only changes who an action is shown as. It grants no rights over the other user's entities: each user's entities are still hosted, changed and [deleted](/entities/delete) by their own instance. That instance **MAY** let delegates ask it to act, which is outside this specification.
