upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/83.md
diff options
context:
space:
mode:
authorpablof7z <pfer@me.com>2025-03-21 16:34:03 +0000
committerpablof7z <pfer@me.com>2025-03-21 16:34:03 +0000
commit6b5337d0960714407a209a9ca70bd16e8b00ad44 (patch)
tree54eb68e3b9401cee8292815e4f5e01629f78eb01 /83.md
parent0619f370bca3485bb9c5870bc2defa03c7c3d10e (diff)
draftstories
Diffstat (limited to '83.md')
-rw-r--r--83.md201
1 files changed, 201 insertions, 0 deletions
diff --git a/83.md b/83.md
new file mode 100644
index 0000000..a5d3a39
--- /dev/null
+++ b/83.md
@@ -0,0 +1,201 @@
1# NIP-83: Stories
2
3`draft` `optional`
4
5This NIP defines a standard for "stories" content.
6
7## Abstract
8
9Stories allow users to share, usually time-limited, visual content that can be enhanced with interactive elements called "stickers".
10
11## Specification
12
13### Event Structure
14
15Stories are represented as events with kind `23`.
16
17### Tags
18
19- `dim`: MUST be present, this is the story canvas in the format `["dim", "<width>x<height>"]`, which defines the coordinate system for all stickers and elements.
20- `imeta` tags as defined in NIP-92.
21- `dur` duration of the story in seconds.
22
23#### Sticker Tags
24
25Stickers are interactive elements placed on the story. They use the format:
26
27```
28["sticker", "<type>", "value", "<x>,<y>", "<width>x<height>", "key1 value1", "key2 value2", ...]
29```
30
31Where:
32
33- `<type>`: The sticker type (see below)
34- `<value>`: The main value of the sticker.
35- `<x>,<y>`: Position coordinates relative to the story canvas
36- `<width>x<height>`: Dimensions of the sticker
37- Additional key-value pairs with the key and value combined in a single element, separated by a space, like `imeta` tags.
38
39##### Sticker Types
40
41- `pubkey`: Mentions a user. Requires a `p` tag with the same index.
42- `event`: Embeds a Nostr event. Requires an `e` tag with the same index.
43- `prompt`: Requests user input with optional placeholder text.
44- `text`: Renders text on the story. The text content is specified using a `"text <value>"` property.
45- `countdown`: Displays a countdown timer to a specific Unix timestamp. The value should be a valid Unix timestamp in seconds.
46
47### Styling Properties
48
49Stickers can have additional properties:
50
51- `style`: A named style identifier. Clients are encouraged to mimic common style implementations from other clients.
52- `rot`: Rotation in degrees (0-360).
53
54Additional properties may be defined by clients, with common practices expected to emerge over time.
55
56## Design Considerations
57
58This NIP intentionally avoids highly specific styling mechanisms (like CSS) to ensure compatibility across different platforms, device types, and technologies. Instead, it provides foundational positioning and sizing with named styles that clients can interpret according to their capabilities.
59
60## Examples
61
62A basic story with an image and a text sticker:
63
64```json
65{
66 "kind": 23,
67 "content": "",
68 "tags": [
69 ["dim", "1080x1920"],
70 [
71 "imeta",
72 "url",
73 "https://example.com/image.jpg",
74 "m",
75 "image/jpeg",
76 "blurhash",
77 "UBL_:rOpGG-;0g9FD%IA4oIpELxu"
78 ],
79 [
80 "sticker",
81 "text",
82 "Hello Nostr!",
83 "540,960",
84 "600x200",
85 "style emphasis",
86 "rot 5"
87 ]
88 ]
89}
90```
91
92A story with a user mention:
93
94```json
95{
96 "kind": 23,
97 "content": "",
98 "tags": [
99 ["dim", "1080x1920"],
100 ["expiration", "<timestampp>"],
101 ["imeta", "url", "https://example.com/image.jpg", "m", "image/jpeg"],
102 ["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"],
103 [
104 "sticker",
105 "pubkey",
106 "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52",
107 "540,960",
108 "300x300",
109 "style flou"
110 ],
111 [
112 "a",
113 "30023:6260f29fa75c91aaa292f082e5e87b438d2ab4fdf96af398567b01802ee2fcd4:7b734cf9"
114 ],
115 [
116 "sticker",
117 "event",
118 "30023:6260f29fa75c91aaa292f082e5e87b438d2ab4fdf96af398567b01802ee2fcd4:7b734cf9",
119 "540,960",
120 "300x300",
121 "style flou"
122 ]
123 ]
124}
125```
126
127A story with a countdown timer:
128
129```json
130{
131 "kind": 23,
132 "content": "",
133 "tags": [
134 ["expiration", "<timestamp>"],
135 ["dim", "1080x1920"],
136 ["imeta", "url", "https://example.com/event-image.jpg", "m", "image/jpeg"],
137 [
138 "sticker",
139 "countdown",
140 "1718486400",
141 "540,800",
142 "400x150",
143 "style emphasis",
144 "text Event starts in"
145 ]
146 ]
147}
148```
149
150## Client Behavior
151
152Clients SHOULD respect the coordinate system defined by the `dim` tag. When displaying stories on screens with different aspect ratios, clients SHOULD maintain the relative positioning of all elements.
153
154## Implementation Notes
155
156- Stories are ephemeral by nature. Clients MAY choose to display stories for a limited time (typically 24 hours).
157- For consistent rendering across platforms, measurements and coordinates SHOULD be treated as logical units rather than specific pixel values.
158- Clients SHOULD make reasonable attempts to reproduce named styles consistently with other implementations.
159
160## A note about `style`
161
162Stickers use a very ambiguous `style` with just a name. Clients can interpret what the name represents in their users screens freely, but clients should strive for consistency and sane defaults. Styles can emerge in the wild and clients are
163encouraged to work on supporting what their users want.
164
165The reason to avoid providing precise definitions and styling attributes is because recoinciling different platforms, native, web would end up yielding something as complicated as CSS which would be an overkill and, just like CSS has shown, an ever-shifting goal post.
166
167## Appendix 1: Sticker Type Examples
168
169### Mentions
170
171```
172["sticker", "pubkey", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", "540,960", "300x300", "style default"]
173```
174
175### Event
176
177An event to be embedded. Addressable events should use the `<kind>:<pubkey>:<d-tag>` format.
178
179Additionally, event stickers should include the corresponding `a` and/or `e` tag to help find the event (relay hint, etc.).
180
181```
182["sticker", "event", "1a5f6849cef16334e1a73f289d457d54833769731c0631a39ca9631a6575e91d", "200,500", "400x200", "style card"]
183```
184
185### Ask for a reply
186
187```
188["sticker", "prompt", "Ask me a question", "540,1200", "600x100", "style rounded"]
189```
190
191### Embed text
192
193```
194["sticker", "text", "Hello world!", "540,960", "500x150", "style bold", "rot 15"]
195```
196
197### Timer countdown
198
199```
200["sticker", "countdown", "1718486400", "540,700", "400x100", "text Event starts in"]
201```