mirror of
https://github.com/fiatjaf/nak.git
synced 2025-12-11 09:58:49 +00:00
view: nsec, ncryptsec, event signing things.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user