Documentation
    Preparing search index...

    Function decryptPrivateItems

    • Decrypt the private portion of a list/set and populate Nip51List.privateItems.

      NIP-51 stores private items as a NIP-44-encrypted JSON array of tags in the event content, encrypted to the author's own key. This helper runs the injected Nip44Decryptor, parses the plaintext as string[][], and returns a new Nip51List with privateItems set (the input is not mutated). Lists with no encrypted content return a copy with privateItems: [].

      Throws if the decryptor throws or the plaintext is not a JSON tag array — so callers can distinguish "no private items" from "couldn't read private items".

      Parameters

      Returns Promise<Nip51List>

      A copy of list with privateItems populated

      const withPrivate = await decryptPrivateItems(list, (c, a) => signer.nip44.decrypt(a, c));
      const privatelyMuted = getTagValues(withPrivate.privateItems!, 'p');