2024-07-22 15:22:18 +02:00
export const metadata = {
title: 'Users',
description: 'Definition of the User entity',
}
# Users
2024-08-13 16:47:37 +02:00
The `User` entity represents an account on a Versia instance. Users can post [Notes](/entities/note), follow other users, and interact with content. Users are identified by their `id` property, which is unique within the instance. {{ className: 'lead' }}
2024-07-22 19:03:27 +02:00
2024-07-24 00:02:06 +02:00
## Addresses
Users may be represented by a shorthand address, in the following formats:
```
@username@instance
2024-08-02 16:14:03 +02:00
@id@instance
2024-07-24 00:02:06 +02:00
```
For example:
```
2024-08-13 16:47:37 +02:00
@jessew@versia.social
@018ec082-0ae1-761c-b2c5-22275a611771@versia.social
2024-07-24 00:02:06 +02:00
```
2024-11-24 18:03:25 +01:00
This is similar to an email address or an ActivityPub address. Usernames are case-insensitive.
2024-07-24 00:02:06 +02:00
### Identifier
Identifier **must** be either a valid `username` or a valid `id`. It should have the same username/id as the user's profile.
<Note>
Usernames can be changed by the user, so it is recommended to use `id` for long-term references.
</Note>
### Instance
Instance **must** be the host of the instance the user is on (hostname with optional port).
2024-07-22 15:22:18 +02:00
## Entity Definition
<Row>
<Col>
2024-12-24 14:01:09 +01:00
<Properties name="User">
2024-08-24 22:05:43 +02:00
<Property name="avatar" type="ContentFormat" required={false} typeLink="/structures/content-format">
2024-07-22 19:03:27 +02:00
The user's avatar. Must be an image format (`image/*`).
2024-07-22 17:06:33 +02:00
</Property>
2024-08-24 22:05:43 +02:00
<Property name="bio" type="ContentFormat" required={false} typeLink="/structures/content-format">
2024-07-22 19:03:27 +02:00
Short description of the user. Must be text format (`text/*`).
2024-07-22 17:06:33 +02:00
</Property>
<Property name="display_name" type="string" required={false}>
Display name, as shown to other users. May contain emojis and any Unicode character.
</Property>
<Property name="fields" type="Field[]" required={false}>
2024-07-22 19:03:27 +02:00
Custom key/value pairs. For example, metadata like socials or pronouns. Must be text format (`text/*`).
2024-07-22 17:06:33 +02:00
```typescript
type Field = {
key: ContentFormat;
value: ContentFormat;
}
```
</Property>
<Property name="username" type="string" required={true}>
2024-07-22 19:03:27 +02:00
Alpha-numeric username. Must be unique within the instance. **Must** be treated as changeable by the user.
2024-07-22 17:06:33 +02:00
2024-11-24 18:03:25 +01:00
Can only contain the following characters: `a-z`, `A-Z` (case-insensitive), `0-9`, `_` and `-`. Should be limited to reasonable lengths.
2024-07-22 17:06:33 +02:00
</Property>
2024-07-22 20:21:38 +02:00
<Property name="header" type="ContentFormat" required={false} typeLink="/structures/content-format">
2024-07-22 19:03:27 +02:00
A header image for the user's profile. Also known as a cover photo or a banner. Must be an image format (`image/*`).
2024-07-22 17:06:33 +02:00
</Property>
<Property name="public_key" type="PublicKey" required={true}>
2024-08-23 16:43:37 +02:00
The user's public key. Must follow the [Versia Public Key](/signatures) format. `actor` may be a URI to another user's profile, in which case this key may allow the other user act on behalf of this user (see [delegation](/federation/delegation)).
2024-07-22 17:06:33 +02:00
2024-08-23 16:43:37 +02:00
- `algorithm`: Must be `ed25519` for now.
2024-12-17 16:48:57 +01:00
- `key`: The public key in [SPKI-encoded base64](/signatures#exporting-the-public-key). Must be the key associated with the `actor` URI.
2024-08-23 16:43:37 +02:00
- `actor`: URI to a user's profile, most often the user's own profile.
2024-08-17 14:58:41 +02:00
2024-07-22 17:06:33 +02:00
```typescript
type URI = string;
type PublicKey = {
actor: URI;
2024-08-17 14:58:41 +02:00
algorithm: string;
key: string;
2024-07-22 17:06:33 +02:00
}
```
</Property>
2024-08-24 22:05:43 +02:00
<Property name="manually_approves_followers" type="boolean" required={false}>
If `true`, the user must approve any new followers manually. If `false`, followers are automatically approved. This does not affect federation, and is meant to be used for clients to display correct UI. Defaults to `false`.
2024-07-22 17:06:33 +02:00
</Property>
2024-08-24 22:05:43 +02:00
<Property name="indexable" type="boolean" required={false}>
User consent to be indexed by search engines. If `false`, the user's profile should not be indexed. Defaults to `true`.
2024-07-22 17:06:33 +02:00
</Property>
2024-07-23 00:23:42 +02:00
<Property name="inbox" type="URI" required={true} typeLink="/types#uri">
2024-07-22 17:06:33 +02:00
The user's federation inbox. Refer to the [federation documentation](/federation).
2024-08-06 14:45:34 +02:00
2024-08-18 00:59:39 +02:00
Some instances may also have a shared inbox. Refer to [Instance Metadata](/entities/instance-metadata) for more information.
2024-07-22 17:06:33 +02:00
</Property>
2024-08-06 17:58:40 +02:00
<Property name="collections" type="UserCollections" required={true}>
Collections related to the user. Must contain at least `outbox`, `followers`, `following`, and `featured`.
```typescript
type URI = string;
type UserCollections = {
outbox: URI;
followers: URI;
following: URI;
featured: URI;
2024-08-24 14:29:54 +02:00
// Same format as type on Extensions
2024-08-06 17:58:40 +02:00
[key: ExtensionsKey]: URI;
}
```
2024-11-03 12:19:21 +01:00
All URIs must resolve to either a [Collection](/structures/collection) or a [URI Collection](/structures/collection#uri-collection) of the appropriate entities. Extensions may add additional collections.
2024-08-06 17:58:40 +02:00
### Outbox
2024-11-03 12:19:21 +01:00
The user's federation outbox. Refer to the [federation documentation](/federation). [Collection](/structures/collection) of [Note](/entities/note) entities.
2024-08-06 17:58:40 +02:00
### Followers
2024-11-03 12:19:21 +01:00
User's followers. [URI Collection](/structures/collection#uri-collection) of [User](/entities/user) entities.
2024-08-06 17:58:40 +02:00
### Following
2024-11-03 12:19:21 +01:00
Users that the user follows. [URI Collection](/structures/collection#uri-collection) of [User](/entities/user) entities.
2024-08-06 17:58:40 +02:00
### Featured
2024-11-03 12:19:21 +01:00
[Notes](/entities/note) that the user wants to feature (also known as "pin") on their profile. [Collection](/structures/collection) of [Note](/entities/note) entities. Only notes authored by the user can be featured.
2024-07-22 17:06:33 +02:00
</Property>
2024-07-22 15:22:18 +02:00
</Properties>
</Col>
<Col sticky>
```jsonc {{ 'title': 'Example User' }}
{
"id": "018ec082-0ae1-761c-b2c5-22275a611771",
"type": "User",
"created_at": "2024-04-09T01:38:51.743Z",
2024-07-22 16:17:50 +02:00
"avatar": { // [!code focus:100]
2024-07-22 17:06:33 +02:00
"image/png": {
2024-07-22 15:22:18 +02:00
"content": "https://avatars.githubusercontent.com/u/30842467?v=4"
}
},
"bio": {
"text/html": {
"content": "<p>🌸🌸🌸</p>"
},
"text/plain": {
"content": "🌸🌸🌸"
}
},
"display_name": "April The Pink (limited Sand Edition)",
"extensions": {
2024-08-13 16:47:37 +02:00
"pub.versia:custom_emojis": {
2024-07-22 15:22:18 +02:00
"emojis": []
}
},
"fields": [
{
"key": {
"text/html": {
"content": "<p>Pronouns</p>"
}
},
"value": {
"text/html": {
"content": "<p>It/its</p>"
}
}
}
],
"header": null,
"indexable": false,
"manually_approves_followers": false,
"public_key": {
2025-04-21 18:17:45 +02:00
"actor": "018ec082-0ae1-761c-b2c5-22275a611771",
2024-08-17 14:58:41 +02:00
"algorithm": "ed25519",
"key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
2024-07-22 15:22:18 +02:00
},
"username": "aprl"
}
```
</Col>
</Row>