-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem: can't add username or about/bio from the frontend
Solution:
- Implement window.nostr to sign events
- Fetch
kind 0events by the signed-in pubkey so that we have their latest username and bio data. I will mirror allkind 0events from all relays ontonostr.688.orgso that they can be fetched from there without adding extra relays. - Create a form and pre-populate it with the user's existing username and bio from the current nostrocket state, or if it's not in there then take it from their latest kind 0 event
- Create, sign and send an event (to nostr.688.org) with the user's username and bio
- Nostrocket usernames are permanent and cannot be changed once set, warn user about this and report error if user tries to change their name once set
Requirements and notes
The event that is produced MUST be kind 640400 and MUST use JSON in the event.Content field such that when unmarshalled by the state machine it produces a Golang Type like this: https://github.com/nostrocket/engine/blob/7ddd707f45295fa75bb8c2c1cea5c11643f25a81/consensus/identity/types.go#L34
Required Tags
All Nostrocket events MUST contain an e root tag pointing to the nostrocket ignition event:
TESTNET:
["e", "fd459ea06157e30cfb87f7062ee3014bc143ecda072dd92ee6ea4315a6d2df1c", "", "root"]
MAINNET:
["e", "503941a9939a4337d9aef7b92323c353441cb5ebe79f13fed77aeac615116354", "", "root"]
All Nostrocket Events intended to cause a state change MUST contain an r tag to prevent replay attacks:
TESTNET:
["r", "<latest replay prevention event ID>", "", "reply"]
MAINNET:
["r", "<latest replay prevention event ID>", "", "reply"]
The first time a pubkey publishes an Event it MUST be an event that defines a username for the pubkey, and it MUST contain an r tag pointing to the root of the replay event tree, which is defined here.
After this point, all subsequent events MUST point the r tag at the event ID of the last event from this pubkey which caused a state change - this is included in the current state which is accessible to frontend implementations as described in #1.
All Nostrocket Events that intend to update the Identity state with a new username or about etc MUST include the root of the Identity event tree:
TESTNET:
["e", "0a73208becd0b1a9d294e6caef14352047ab44b848930e6979937fe09effaf71", "", "reply"]
MAINNET:
["e", "TBC", "", "reply"]
These event IDs SHOULD be stored in a const in the same place to make them easily updateable. The current event IDs for the ignition event etc specified in config.go should be considered "testnet".