| | 1 | | namespace NostrSure.Domain.Entities; |
| | 2 | |
|
| | 3 | | using NostrSure.Domain.Interfaces; |
| | 4 | | using NostrSure.Domain.ValueObjects; |
| | 5 | |
|
| 192 | 6 | | public record NostrEvent( |
| 371 | 7 | | string Id, |
| 371 | 8 | | Pubkey Pubkey, |
| 148 | 9 | | DateTimeOffset CreatedAt, |
| 271 | 10 | | EventKind Kind, |
| 430 | 11 | | IReadOnlyList<NostrTag> Tags, |
| 145 | 12 | | string Content, |
| 251 | 13 | | string Sig |
| 192 | 14 | | ) |
| | 15 | | { |
| | 16 | | public virtual bool Validate(INostrEventValidator validator, out List<string> errors) |
| 6 | 17 | | { |
| 6 | 18 | | errors = new List<string>(); |
| 6 | 19 | | if (!validator.ValidateEventId(this, out var idError)) |
| 2 | 20 | | errors.Add($"Event ID invalid: {idError}"); |
| 6 | 21 | | if (!validator.ValidateSignature(this, out var sigError)) |
| 2 | 22 | | errors.Add($"Signature invalid: {sigError}"); |
| 6 | 23 | | if (!validator.ValidateKind(this, out var kindError)) |
| 2 | 24 | | errors.Add($"Kind invalid: {kindError}"); |
| 6 | 25 | | if (!validator.ValidateTags(this, out var tagError)) |
| 2 | 26 | | errors.Add($"Tags invalid: {tagError}"); |
| 6 | 27 | | return errors.Count == 0; |
| 6 | 28 | | } |
| | 29 | | } |