Represents an encryptable event with optional updates.

Type Parameters

Constructors

Properties

Methods

Constructors

  • Creates an instance of Encryptable.

    Type Parameters

    Parameters

    • event: Partial<T>

      An EventTemplate with optional tags and content.

    • updates: Partial<EventContent>

      Plaintext updates to be applied to the event content.

    Returns Encryptable<T>

    Here's an example which enables updating a private mute list:

    const event = {kind: 10000, content: "", tags: []} // An event, only kind is required
    const encryptable = new Encryptable(event, {content: JSON.stringify([["e", "bad word"]])})
    const eventTemplate = await encryptable.reconcile(myEncryptFunction)

Properties

event: Partial<T>

An EventTemplate with optional tags and content.

updates: Partial<EventContent>

Plaintext updates to be applied to the event content.

Methods

  • Encrypts plaintext updates and merges them into the event template.

    Parameters

    • encrypt: Encrypt

      The encryption function to be used.

    Returns Promise<T>

    A promise that resolves to the reconciled and encrypted event.