Skip to content

Commit 4af1c9d

Browse files
authored
fix: Add missing docs. (#65)
1 parent c5e2bea commit 4af1c9d

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,34 +398,48 @@ match result {
398398
If you only want to list subjects within a specific branch, provide the desired base subject instead:
399399

400400
```rust
401-
let result := client.list_subjects("/books");
401+
let result = client.list_subjects("/books");
402402
```
403403

404404
### Listing Event Types
405405

406406
To list all event types, call the `list_event_types` function. The function returns a stream from which you can retrieve one event type at a time:
407407

408408
```rust
409-
let result := client.list_event_types().await;
409+
let result = client.list_event_types().await;
410410
match result {
411411
Ok(event_types) => // ...
412412
Err(err) => // ...
413413
}
414414
```
415415

416-
### Listing a Specific Event Types
416+
### Listing a Specific Event Type
417417

418418
To list a specific event type, call the `read_event_type` function. The function returns the detailed event type, which includes the schema:
419419

420420
```rust
421421
let event_type_name = "io.eventsourcingdb.library.book-acquired";
422-
let result := client.read_event_type(event_type_name).await;
422+
let result = client.read_event_type(event_type_name).await;
423423
match result {
424424
Ok(event_type) => // ...
425425
Err(err) => // ...
426426
}
427427
```
428428

429+
### Verifying an Event's Hash
430+
431+
To verify the integrity of an event, call the `verify_hash` function on the event instance. This recomputes the event's hash locally and compares it to the hash stored in the event. If the hashes differ, the function returns an error:
432+
433+
```rust
434+
let result = event.verify_hash();
435+
match result {
436+
Ok(()) => // ...
437+
Err(err) => // ...
438+
}
439+
```
440+
441+
*Note that this only verifies the hash. If you also want to verify the signature, you can skip this step and call `verify_signature` directly, which performs a hash verification internally.*
442+
429443
### Using Testcontainers
430444

431445
Call the `Container::start_default()` function, get a client, and run your test code:

0 commit comments

Comments
 (0)