feat: implement a basic backend (#1)

Reviewed-on: https://git.reya.su/reya/signed/pulls/1
This commit was merged in pull request #1.
This commit is contained in:
2026-08-05 00:57:52 +00:00
parent 9809b986af
commit 7249a323f8
22 changed files with 4033 additions and 21 deletions
+32
View File
@@ -0,0 +1,32 @@
use nostr_sdk::prelude::*;
/// A lightweight "something changed" signal for the UI.
///
/// Heavy data stays in the database; consumers re-query on receipt.
#[derive(Debug, Clone)]
pub struct Update {
pub kind: Kind,
/// First `a` tag value of the event, if any (e.g. the repository coordinate).
pub coordinate: Option<String>,
pub author: PublicKey,
pub event_id: EventId,
}
impl Update {
/// Build an update from a received event.
pub fn from_event(event: &Event) -> Self {
let coordinate = event
.tags
.iter()
.find(|t| t.kind() == "a")
.and_then(|t| t.content())
.map(str::to_owned);
Self {
kind: event.kind,
coordinate,
author: event.pubkey,
event_id: event.id,
}
}
}