Skip to content

Ditto Server Keypair

Each Ditto server has its own Nostr account for internal use, configured with the DITTO_NSEC environment variable. This account is used to sign events that are generated by the server itself, such as configuration events, connection events, and more.

Pleroma Configuration

Ditto supports Pleroma's Admin Config API, making it usable with Soapbox and partially supporting AdminFE.

Config is encoded in a NIP-78 event with the identifier set to pub.ditto.pleroma.config.

js
{
  kind: 30078,
  pubkey: ditto_pubkey,
  content: nip44_encrypted_configs,
  tags: [['d', 'pub.ditto.pleroma.config']],
}

Username Grants

Users can request a NIP-05 username from the Ditto server by publishing a kind 3036 event:

js
{
  kind: 3036,
  pubkey: user_pubkey,
  tags: [
    ['r', 'alex@gleasonator.dev'],
    ['L', 'nip05.domain'],
    ['l', 'gleasonator.dev', 'nip05.domain'],
    ['p', ditto_pubkey]
  ],
  content: 'I am Alex!',
}

The Ditto server may then issue a grant event:

js
{
  kind: 30360,
  pubkey: ditto_pubkey,
  tags: [
    ['d', 'alex@gleasonator.dev'],
    ['L', 'nip05.domain'],
    ['l', 'gleasonator.dev', 'nip05.domain'],
    ['p', user_pubkey],
    ['e', request_event_id],
  ],
}

Please note that the source of truth for NIP-05 is always the nostr.json. These events are used internally by Ditto and may offer hints to Ditto-specific tools.

Event Deletions

When the Ditto server signs a kind 5 deletion event, the Ditto relay accepts it as valid and deletes the event from the database, even though the event itself is not signed by the original author.

js
{
  kind: 5,
  pubkey: ditto_pubkey,
  tags: [['e', event_id]],
}

User Records

The Ditto server maintains kind 30382 events about particular pubkeys, using n tags to indicate the user's roles, as well as any moderation actions taken against them.

js
{
  kind: 30382,
  pubkey: ditto_pubkey,
  tags: [
    ['d', user_pubkey],
    ['n', 'admin'],
    ['n', 'suggested'],
    ['t', 'verified'],
  ],
}

Supported n Tags

  • admin: The user is an admin of the Ditto server.
  • moderator: The user is a moderator of the Ditto server.
  • suggested: The user is a globally suggested throughout the UI.
  • disabled: The user is banned.

t Tags

t tags on user records are defined by the admin of the Ditto server and thus may vary between servers.

Reports

Kind 1984 reports may have an uppercase P tag pointing at the Ditto server's pubkey. If so, the report will appear in the moderation interface of the Ditto server. Staff will be notified and may take action on the report.

js
{
  kind: 1984,
  pubkey: user_pubkey,
  tags: [
    ['p', reported_pubkey],
    ['P', ditto_pubkey],
  ],
  content: 'I am reporting this user for being mean.',
}

Relay List

External relay connections are configured by NIP-65 events.

  • Read relays are used by Ditto's firehose, and may be used for making just-in-time requests to relays.
  • Write relays are used when users publish events through the Mastodon API.