validation: actually validate events

Check to see if id and/or signature are good

Changelog-Changed: Check note ids and signatures on every note
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-08-06 23:03:01 -07:00
parent adacdbb764
commit 708d2d7b38
2 changed files with 79 additions and 4 deletions

View File

@@ -140,6 +140,7 @@ struct EventView: View {
.padding([.leading], 2)
}
.contentShape(Rectangle())
.background(event_validity_color(event.validity))
.id(event.id)
.frame(minHeight: PFP_SIZE)
.padding([.bottom], 4)
@@ -147,6 +148,19 @@ struct EventView: View {
}
}
func event_validity_color(_ validation: ValidationResult) -> some View {
Group {
switch validation {
case .ok:
EmptyView()
case .bad_id:
Color.orange.opacity(0.4)
case .bad_sig:
Color.red.opacity(0.4)
}
}
}
extension View {
func pubkey_context_menu(bech32_pubkey: String) -> some View {
return self.contextMenu {