1import { describe, it, expect } from "vitest";2import { newEvent, newKey, sockets } from "./helpers.ts";34const connect = sockets();56describe("NIP-70 protected events", () => {7 it("accepts ['-'] events only from a connection authenticated as the author", async () => {8 const sk = newKey();9 const c = await connect();10 const e = newEvent(sk, 1, "members only", [["-"]]);11 c.send("EVENT", e);12 expect(await c.expectOK(e.id, false)).toMatch(/^auth-required:/);13 await c.auth(newKey());14 c.send("EVENT", e);15 await c.expectOK(e.id, false);16 await c.auth(sk);17 await c.publish(e);18 });19});