๐Ÿš€Sharing records

  • Use a configured protocol

  • Create the message record

  • Send the message record to recipients

  • Reading the message record from an author

Create a DID for Alice

const alice = await sdk.did.create({
  sync: 'off' | '10s'
});

Create a Protocol

const protocolDef = {
  'protocol'  : 'https://message.xyz/protocol',
  'published' : true,
  'types'     : {
    'message': {
      'schema'      : 'https://message.xyz/protocol/schema',
      'dataFormats' : [
        'application/json'
      ]
    }
  },
  'structure': {
    'message': {
      '$actions': [
        {
          'who' : 'anyone',
          'can' : 'write'
        },
        {
          'who' : 'author',
          'of'  : 'message',
          'can' : 'read'
        },
        {
          'who' : 'recipient',
          'of'  : 'message',
          'can' : 'read'
        }
      ]
    }
  }
}    

Configure Protocol

Create a Message from Alice to Bob

Reading a Message to Bob from Alice