Expand description
Drafts as events (NIP-37): what is written and not published, as the relay Avestruz runs itself keeps it.
A draft is kept as a draft wrap (kind 31234): an addressable event the
account signs, whose content is the note the draft would be, unsigned,
as JSON, encrypted to the account itself (NIP-44). Its d tag says
which draft it is, so that a later one replaces it, and its k tag
what kind of event it wraps. A wrap with no content is a draft that
was done with: published, or cleared.
There is one draft for each thing that can be written to, as in
crate::drafts, and the d tag is which: a note of its own, a reply
to a note, a quote of one.
flowchart TD
text["What was written"] --> note["The note it would be: kind 1, unsigned, as JSON"]
note -- "encrypted to the account (NIP-44)" --> content
subgraph wrap["A draft wrap, kind 31234, signed by the account"]
direction TB
d["d: which draft it is"]
k["k: 1, the kind it wraps"]
e["e: the note answered or quoted, if any"]
content["content: the encrypted note, or nothing for a draft done with"]
end
wrap --> relay["The relay Avestruz runs itself, and no other"]| Written to | d tag |
|---|---|
| A note of its own | avestruz:note |
| A reply to a note | avestruz:reply: and the note’s id |
| A quote of a note | avestruz:quote: and the note’s id |
Wraps with any other d tag are another client’s drafts, and are left
alone.
Constants§
- DRAFT_
KIND - The kind of a draft wrap.
- NOTE 🔒
- What the
dtag of a draft says, by what the draft is of: a note of its own; or, before the id of the note it is about, a reply or a quote. - QUOTE 🔒
- REPLY 🔒
Functions§
- identifier
- What the
dtag of the draft fortargetsays. - kept
- What the draft wrap
eventis a draft of, and its content, which is empty when the draft is done with.Noneif it is no draft wrap, or not one of this client’s. - said_of
- What the draft that
jsonis says of the files it links to: itsimetatags. None if it is no event, or has none. - target_
of - What the draft whose
dtag saysidentifieris a draft of, if it is one of this client’s. - text_of
- The text of the draft that
jsonis, which is what a draft wrap’s content says once it is decrypted.Noneif it is no event, or says nothing. - wrap
- The draft wrap for
target, withcontentfor what it wraps: encrypted, or nothing at all for a draft that is done with. Written atnowor, ifearlier, the wrap it replaces, claims to be from later, after it: it has to be the newer of the two. - written
- What a draft wrap’s content is before it is encrypted: the note
textwould be ifaccountpublished it atnow, unsigned, as JSON. Of its tags it has those insaid: what it says of the files it links to (NIP-92), which nothing but having sent them tells.