Home

Awesome

<!-- SPDX-FileCopyrightText: 2022 Mix Irving SPDX-License-Identifier: CC-BY-4.0 -->

ssb-meta-feeds-dm-spec

Version: 0.1

Author: Mix Irving mix@protozoa.nz

License: This work is licensed under a Creative Commons Attribution 4.0 International License.

Abstract

The addition of metafeeds (see ssb-meta-feeds-spec), means that the process of encrypting messages to other peers as direct messages (DMs) now unclear.

In classic scuttlebutt, when you see a recps (recipients) field which contains a feedId, you would know that meant to calculate a shared cryptographic key by:

  1. converting the feedId from a public ed25519 signing key to a curve25519 encryption key
  2. converting your feedIds ed25519 signing secret key to curve25519 encryption key
  3. creating a Diffie-Hellman shared key by crossing your secret with their public encryption keys

With metafeeds, we need to define which "feed" or "identity" keys we want to put in the recps, and how we should derive a shared encryption key given we are dealing with trees of keys.

Definitions

1. Announcing DH-keys

This spec only supports sending a DM from one leaf to its mirror leaf feed.

To signal that you support DMs, when you publish the meta/add/derived announcing your leaf feed, you attach the metadata containing a public key for encryption.

{
  type: 'meta/add/derived',
  purpose: 'chess',
  subfeed: 'ssb:feed/classic/DIoOBMaI1f0mJg+5tUzZ7vgzCeeHh8+zGta4pOjc+k0='
  metadata: {
    encryption: {
      curve: 'curve25519',
      public: 'BtFRgQLgXyq3G48jDrX9OaY/mnPaWnu+kOfx2yEOWwU=' // public DH key
    }
  }
}

2. Encrypting a DM message

If I (mix) am sending a DM to a friend (staltz) I'm playing chess with, I do that by publishing a message like the following to my chess leaf feed:

{
  type: 'chess/move',
  // ...
  recps: [
    'ssb:feed/bendybutt-v1/mreYjjsak8sIXIzVq/LPVugxXYDZTAszN6aOrHgbtL8=', // mix
    'ssb:feed/bendybutt-v1/UkrcQFhPcOMgW5Ag6iuXdawHO6ArRmpueeINt/X4MGA='  // staltz
  ]
}
<!-- Refereneces -->