|
10 | 10 | import enum |
11 | 11 | from typing import Any, Dict, List, Optional, Sequence, Union |
12 | 12 |
|
| 13 | +from pydantic import Field |
| 14 | +from typing_extensions import Annotated |
| 15 | + |
13 | 16 | from pangea.response import APIRequestModel, APIResponseModel, PangeaDateTime, PangeaResponseResult |
14 | 17 |
|
15 | 18 |
|
@@ -117,20 +120,25 @@ def tenant_id(self, value): |
117 | 120 |
|
118 | 121 |
|
119 | 122 | class EventEnvelope(APIResponseModel): |
120 | | - """ |
121 | | - Contain extra information about an event. |
| 123 | + event: Optional[dict[str, Any]] = None |
122 | 124 |
|
123 | | - Arguments: |
124 | | - event -- Event describing auditable activity. |
125 | | - signature -- An optional client-side signature for forgery protection. |
126 | | - public_key -- The base64-encoded ed25519 public key used for the signature, if one is provided |
127 | | - received_at -- A server-supplied timestamp |
| 125 | + signature: Optional[str] = None |
| 126 | + """ |
| 127 | + This is the signature of the hash of the canonicalized event that can be |
| 128 | + verified with the public key provided in the public_key field. Signatures |
| 129 | + cannot be used with the redaction feature turned on. If redaction is |
| 130 | + required, the user needs to perform redaction before computing the signature |
| 131 | + that is to be sent with the message. The SDK facilitates this for users. |
128 | 132 | """ |
129 | 133 |
|
130 | | - event: Dict[str, Any] |
131 | | - signature: Optional[str] = None |
132 | 134 | public_key: Optional[str] = None |
133 | | - received_at: PangeaDateTime |
| 135 | + """ |
| 136 | + The base64-encoded ed25519 public key used for the signature, if one is |
| 137 | + provided |
| 138 | + """ |
| 139 | + |
| 140 | + received_at: Optional[PangeaDateTime] = None |
| 141 | + """A Pangea provided timestamp of when the event was received.""" |
134 | 142 |
|
135 | 143 |
|
136 | 144 | class LogRequest(APIRequestModel): |
@@ -181,21 +189,28 @@ class LogBulkRequest(APIRequestModel): |
181 | 189 |
|
182 | 190 |
|
183 | 191 | class LogResult(PangeaResponseResult): |
| 192 | + envelope: Optional[EventEnvelope] = None |
184 | 193 | """ |
185 | | - Result class after an audit log action |
186 | | -
|
187 | | - envelope -- Event envelope information. |
188 | | - hash -- Event envelope hash. |
189 | | - unpublished_root -- The current unpublished root. |
190 | | - membership_proof -- A proof for verifying the unpublished root. |
191 | | - consistency_proof -- If prev_root was present in the request, this proof verifies that the new unpublished root is a continuation of the prev_root |
| 194 | + The sealed envelope containing the event that was logged. Includes event |
| 195 | + metadata such as optional client-side signature details and server-added |
| 196 | + timestamps. |
192 | 197 | """ |
193 | 198 |
|
194 | | - envelope: Optional[EventEnvelope] = None |
195 | | - hash: str |
| 199 | + hash: Annotated[Optional[str], Field(max_length=64, min_length=64)] = None |
| 200 | + """The hash of the event data.""" |
| 201 | + |
196 | 202 | unpublished_root: Optional[str] = None |
| 203 | + """The current unpublished root.""" |
| 204 | + |
197 | 205 | membership_proof: Optional[str] = None |
| 206 | + """A proof for verifying that the buffer_root contains the received event""" |
| 207 | + |
198 | 208 | consistency_proof: Optional[List[str]] = None |
| 209 | + """ |
| 210 | + If prev_buffer_root was present in the request, this proof verifies that the |
| 211 | + new unpublished root is a continuation of prev_unpublished_root |
| 212 | + """ |
| 213 | + |
199 | 214 | consistency_verification: EventVerification = EventVerification.NONE |
200 | 215 | membership_verification: EventVerification = EventVerification.NONE |
201 | 216 | signature_verification: EventVerification = EventVerification.NONE |
@@ -358,29 +373,47 @@ class RootResult(PangeaResponseResult): |
358 | 373 |
|
359 | 374 |
|
360 | 375 | class SearchEvent(APIResponseModel): |
| 376 | + envelope: EventEnvelope |
| 377 | + |
| 378 | + membership_proof: Optional[str] = None |
| 379 | + """A cryptographic proof that the record has been persisted in the log""" |
| 380 | + |
| 381 | + hash: Annotated[Optional[str], Field(max_length=64, min_length=64)] = None |
| 382 | + """The record's hash""" |
| 383 | + |
| 384 | + published: Optional[bool] = None |
| 385 | + """ |
| 386 | + If true, a root has been published after this event. If false, there is no |
| 387 | + published root for this event |
361 | 388 | """ |
362 | | - Event information received after a search request |
363 | 389 |
|
364 | | - Arguments: |
365 | | - envelope -- Event related information. |
366 | | - hash -- The record's hash. |
367 | | - leaf_index -- The index of the leaf of the Merkle Tree where this record was inserted. |
368 | | - membership_proof -- A cryptographic proof that the record has been persisted in the log. |
369 | | - consistency_verification -- Consistency verification calculated if required. |
370 | | - membership_verification -- Membership verification calculated if required. |
371 | | - signature_verification -- Signature verification calculated if required. |
372 | | - fpe_context -- The context data needed to decrypt secure audit events that have been redacted with format preserving encryption. |
| 390 | + imported: Optional[bool] = None |
| 391 | + """ |
| 392 | + If true, the even was imported manually and not logged by the standard |
| 393 | + procedure. Some features such as tamper proofing may not be available |
373 | 394 | """ |
374 | 395 |
|
375 | | - envelope: EventEnvelope |
376 | | - hash: str |
377 | | - membership_proof: Optional[str] = None |
378 | | - published: Optional[bool] = None |
379 | 396 | leaf_index: Optional[int] = None |
| 397 | + """ |
| 398 | + The index of the leaf of the Merkle Tree where this record was inserted or |
| 399 | + null if published=false |
| 400 | + """ |
| 401 | + |
| 402 | + valid_signature: Optional[bool] = None |
| 403 | + """ |
| 404 | + Result of the verification of the Vault signature, if the event was signed |
| 405 | + and the parameter `verify_signature` is `true` |
| 406 | + """ |
| 407 | + |
| 408 | + fpe_context: Optional[str] = None |
| 409 | + """ |
| 410 | + The context data needed to decrypt secure audit events that have been |
| 411 | + redacted with format preserving encryption. |
| 412 | + """ |
| 413 | + |
380 | 414 | consistency_verification: EventVerification = EventVerification.NONE |
381 | 415 | membership_verification: EventVerification = EventVerification.NONE |
382 | 416 | signature_verification: EventVerification = EventVerification.NONE |
383 | | - fpe_context: Optional[str] = None |
384 | 417 |
|
385 | 418 |
|
386 | 419 | class SearchResultOutput(PangeaResponseResult): |
|
0 commit comments