damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit c1befa5221776cfdf1d176c6bc40ba6f3c9ed1d8
parent 8b3c86c5def90bf509e3c1fe0c290af918026eb0
Author: Charlie Fish <contact@charlie.fish>
Date:   Sun, 24 Dec 2023 14:22:25 -0700

nostrdb/tce: add AUTH to-client-event

This was committed to damus, but this should be in nostrdb or else we
will lose it when we update.

Damus: 84cfeb16048c ("nip42: add initial relay auth support")
Link: https://groups.google.com/a/damus.io/g/patches/c/Zx3dk01e0yg/m/t59TsVkXAQAJ
Signed-off-by: Charlie Fish <contact@charlie.fish>
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mnostrdb/src/nostrdb.c | 11+++++++++++
Mnostrdb/src/nostrdb.h | 1+
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c @@ -4952,6 +4952,17 @@ int ndb_ws_event_from_json(const char *json, int len, struct ndb_tce *tce, tce->command_result.msglen = toksize(tok); return 1; + } else if (tok_len == 4 && !memcmp("AUTH", json + tok->start, 4)) { + tce->evtype = NDB_TCE_AUTH; + + tok = &parser.toks[parser.i++]; + if (tok->type != JSMN_STRING) + return 0; + + tce->subid = json + tok->start; + tce->subid_len = toksize(tok); + + return 1; } return 0; diff --git a/nostrdb/src/nostrdb.h b/nostrdb/src/nostrdb.h @@ -91,6 +91,7 @@ enum tce_type { NDB_TCE_OK = 0x2, NDB_TCE_NOTICE = 0x3, NDB_TCE_EOSE = 0x4, + NDB_TCE_AUTH = 0x5, }; enum ndb_ingest_filter_action {