view: nsec, ncryptsec, event signing things.

This commit is contained in:
fiatjaf
2025-11-27 06:40:23 -03:00
parent 2b189756d1
commit eb6fdfdd39
5 changed files with 100 additions and 19 deletions

View File

@@ -48,19 +48,40 @@ func updateEvent() {
}
}
final := nostr.Event{
result := nostr.Event{
Kind: kind,
Content: event.contentEdit.ToPlainText(),
CreatedAt: nostr.Timestamp(event.createdAtEdit.DateTime().ToMSecsSinceEpoch() / 1000),
Tags: tags,
}
if currentKeyer != nil {
currentKeyer.SignEvent(context.Background(), &final)
finalize := func() {
jsonBytes, _ := json.MarshalIndent(result, "", " ")
event.outputEdit.SetPlainText(string(jsonBytes))
}
jsonBytes, _ := json.MarshalIndent(event, "", " ")
event.outputEdit.SetPlainText(string(jsonBytes))
if currentKeyer != nil {
signAndFinalize := func() {
if currentKeyer != nil {
if err := currentKeyer.SignEvent(context.Background(), &result); err == nil {
finalize()
} else {
statusLabel.SetText("failed to sign: " + err.Error())
}
}
}
if currentSec == [32]byte{} {
// empty key, we must have a bunker
debounced.Call(signAndFinalize)
} else {
// we have a key, can sign immediately
signAndFinalize()
return
}
}
finalize()
}
func setupEventTab() *widgets.QWidget {