From 72039874abe6b3fb9691b48533bd73ab7eaf675a Mon Sep 17 00:00:00 2001 From: natri0 Date: Mon, 21 Apr 2025 17:23:22 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20Move=20Delegation=20to=20an?= =?UTF-8?q?=20extension?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also adds a MDX component. --- app/changelog/page.mdx | 4 ++ app/extensions/delegation/page.mdx | 78 ++++++++++++++++++++++++++++++ app/federation/delegation/page.mdx | 25 ---------- components/Navigation.tsx | 2 +- components/mdx.tsx | 42 ++++++++++++++++ 5 files changed, 125 insertions(+), 26 deletions(-) create mode 100644 app/extensions/delegation/page.mdx delete mode 100644 app/federation/delegation/page.mdx diff --git a/app/changelog/page.mdx b/app/changelog/page.mdx index ac5a2fa..3c35d17 100644 --- a/app/changelog/page.mdx +++ b/app/changelog/page.mdx @@ -8,6 +8,10 @@ export const metadata = { This page lists changes since Working Draft 3. {{ className: 'lead' }} +## Since WD 5 + +- Moved [Delegation](/extensions/delegation) to an extension + ## Since WD 4 - Removed URI from [Report](/extensions/reports), and replaced `reason` with `tags`. diff --git a/app/extensions/delegation/page.mdx b/app/extensions/delegation/page.mdx new file mode 100644 index 0000000..3e9a17a --- /dev/null +++ b/app/extensions/delegation/page.mdx @@ -0,0 +1,78 @@ +export const metadata = { + title: 'Delegation Extension', + description: 'Lets users perform actions on other accounts\' behalf.' +} + +# Delegation Extension + +Delegation is used to authorize actions on behalf of another user. {{ className: 'lead '}} + +## Vocabulary + +- **Delegator**: The user that is delegating actions to another user. (The user that owns the key) +- **Delegate**: The user that is being delegated actions. (The user that the key is pointing to) + +## Implementation Details + +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 an instance encounters an action from a User that has a Delegator listed, but that Delegator does not allow the User to perform actions on their behalf, the actions **MUST** be shown as the User's own. + + Also, if a User has a Delegator listed, but that Delegator does not allow the User to perform actions on their behalf, instances **SHOULD** mark the User with a warning about possible impersonation or fraud. + + +## Extension Definition + + + + + The Delegation extension uses an ID of `pub.versia:delegation`. + + If the extension is present, exactly **one** of the fields **MUST** be specified: + + + If this user performs actions on behalf on another user, **MUST** have a reference to that user. + + + 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": "73cb1728-75d7-4080-8d28-4adf49bb0a0d", + // ... + "extensions": { // [!code focus:5] + "pub.versia:delegation": { + "delegator": "versia.example.com:bfb6bb39-bb08-4226-91ac-8adebc3da046" + } + } + } + ``` + + ```jsonc {{ title: "Example Delegates List" }} + { + // ... + "type": "User", + "id": "bfb6bb39-bb08-4226-91ac-8adebc3da046", + // ... + "extensions": { // [!code focus:7] + "pub.versia:delegation": { + "allowed_delegates": [ + "versia.social:73cb1728-75d7-4080-8d28-4adf49bb0a0d" + ] + } + } + } + ``` + + + diff --git a/app/federation/delegation/page.mdx b/app/federation/delegation/page.mdx deleted file mode 100644 index 43d4e8c..0000000 --- a/app/federation/delegation/page.mdx +++ /dev/null @@ -1,25 +0,0 @@ -export const metadata = { - title: 'Delegation', - description: 'Delegation is used to authorize actions on behalf of another user', -} - -# Delegation - -Delegation is used to authorize actions on behalf of another user. {{ className: 'lead' }} - -## Vocabulary - -- **Delegator**: The user that is delegating actions to another user. (The user that owns the key) -- **Delegate**: The user that is being delegated actions. (The user that the key is pointing to) - -## The `actor` Field on Public Keys - -[Users](/entities/user)'s `public_key` property contains a field called `actor`. This field contains the URI to the **delegator** user, which is used to authorize actions on behalf of the **delegate** user. - -This means that the **delegator** user can sign requests with their private key, and any implementations should consider the **delegate** user as equivalent to the **delegator** user. - -## Implementation Details - -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. \ No newline at end of file diff --git a/components/Navigation.tsx b/components/Navigation.tsx index a3c4d6d..9a53fe1 100644 --- a/components/Navigation.tsx +++ b/components/Navigation.tsx @@ -267,7 +267,6 @@ export const navigation: NavGroup[] = [ { title: "HTTP", href: "/federation/http" }, { title: "Validation", href: "/federation/validation" }, { title: "Discovery", href: "/federation/discovery" }, - { title: "Delegation", href: "/federation/delegation" }, { title: "Example", href: "/federation/example" }, ], }, @@ -295,6 +294,7 @@ export const navigation: NavGroup[] = [ title: "Extensions", links: [ { title: "Custom Emojis", href: "/extensions/custom-emojis" }, + { title: "Delegation", href: "/extensions/delegation" }, { title: "Groups", href: "/extensions/groups" }, { title: "Instance Messaging", diff --git a/components/mdx.tsx b/components/mdx.tsx index 09debe9..a71ea0f 100644 --- a/components/mdx.tsx +++ b/components/mdx.tsx @@ -44,6 +44,37 @@ function InfoIcon(props: ComponentPropsWithoutRef<"svg">) { ); } +function WarningIcon(props: ComponentPropsWithoutRef<"svg">) { + return ( + + ); +} + export function Note({ children }: { children: ReactNode }) { return (
@@ -55,6 +86,17 @@ export function Note({ children }: { children: ReactNode }) { ); } +export function Warning({ children }: { children: ReactNode }) { + return ( +
+ +
+ {children} +
+
+ ); +} + export function Row({ children }: { children: ReactNode }) { return (