|
37 | 37 | "from uuid import uuid4\n", |
38 | 38 | "from warnings import filterwarnings\n", |
39 | 39 | "\n", |
| 40 | + "from dotenv import load_dotenv\n", |
| 41 | + "\n", |
40 | 42 | "from archivist.archivist import Archivist\n", |
41 | 43 | "from archivist.compliance_policy_requests import (\n", |
42 | 44 | " CompliancePolicySince,\n", |
|
49 | 51 | { |
50 | 52 | "cell_type": "code", |
51 | 53 | "execution_count": 3, |
| 54 | + "id": "96987aaf", |
| 55 | + "metadata": {}, |
| 56 | + "outputs": [], |
| 57 | + "source": [ |
| 58 | + "%reload_ext dotenv\n", |
| 59 | + "%dotenv -o notebooks.env" |
| 60 | + ] |
| 61 | + }, |
| 62 | + { |
| 63 | + "cell_type": "code", |
| 64 | + "execution_count": 4, |
52 | 65 | "id": "a877ffed", |
53 | 66 | "metadata": {}, |
54 | 67 | "outputs": [], |
|
59 | 72 | "# CLIENT = represents the client ID from an Application Registration\n", |
60 | 73 | "# SECRET = represents the client secret from an Application Registration\n", |
61 | 74 | "RKVST_URL = getenv(\"RKVST_URL\")\n", |
62 | | - "APPREG_CLIENT = getenv(\"RKVST_APPREG_CLIENT\")\n", |
63 | | - "APPREG_SECRET = getenv(\"RKVST_APPREG_SECRET\")" |
| 75 | + "RKVST_APPREG_CLIENT = getenv(\"RKVST_APPREG_CLIENT\")\n", |
| 76 | + "RKVST_APPREG_SECRET = getenv(\"RKVST_APPREG_SECRET\")" |
64 | 77 | ] |
65 | 78 | }, |
66 | 79 | { |
67 | 80 | "cell_type": "code", |
68 | | - "execution_count": 4, |
| 81 | + "execution_count": 5, |
69 | 82 | "id": "3fdc8e16", |
70 | 83 | "metadata": {}, |
71 | 84 | "outputs": [ |
|
74 | 87 | "output_type": "stream", |
75 | 88 | "text": [ |
76 | 89 | "Connecting to RKVST\n", |
77 | | - "URL https://app.dev-paul-0.wild.jitsuin.io\n" |
| 90 | + "RKVST_URL https://app.rkvst.io\n" |
78 | 91 | ] |
79 | 92 | } |
80 | 93 | ], |
|
94 | 107 | "\n", |
95 | 108 | "# Initialize connection to RKVST\n", |
96 | 109 | "print(\"Connecting to RKVST\")\n", |
97 | | - "print(\"URL\", RKVST_URL)\n", |
98 | | - "arch = Archivist(RKVST_URL, (APPREG_CLIENT, APPREG_SECRET), max_time=300)" |
| 110 | + "print(\"RKVST_URL\", RKVST_URL)\n", |
| 111 | + "arch = Archivist(RKVST_URL, (RKVST_APPREG_CLIENT, RKVST_APPREG_SECRET), max_time=300)" |
99 | 112 | ] |
100 | 113 | }, |
101 | 114 | { |
102 | 115 | "cell_type": "code", |
103 | | - "execution_count": 5, |
| 116 | + "execution_count": 6, |
104 | 117 | "id": "acdf240c", |
105 | 118 | "metadata": {}, |
106 | 119 | "outputs": [], |
|
131 | 144 | }, |
132 | 145 | { |
133 | 146 | "cell_type": "code", |
134 | | - "execution_count": 6, |
| 147 | + "execution_count": 7, |
135 | 148 | "id": "8889c68d", |
136 | 149 | "metadata": {}, |
137 | 150 | "outputs": [], |
|
157 | 170 | }, |
158 | 171 | { |
159 | 172 | "cell_type": "code", |
160 | | - "execution_count": 7, |
| 173 | + "execution_count": 8, |
161 | 174 | "id": "ba24d143", |
162 | 175 | "metadata": {}, |
163 | 176 | "outputs": [], |
|
183 | 196 | }, |
184 | 197 | { |
185 | 198 | "cell_type": "code", |
186 | | - "execution_count": 8, |
| 199 | + "execution_count": 9, |
187 | 200 | "id": "b7482420", |
188 | 201 | "metadata": { |
189 | 202 | "scrolled": true |
|
195 | 208 | }, |
196 | 209 | { |
197 | 210 | "cell_type": "code", |
198 | | - "execution_count": 9, |
| 211 | + "execution_count": 10, |
199 | 212 | "id": "bb5b0651", |
200 | 213 | "metadata": {}, |
201 | 214 | "outputs": [ |
|
211 | 224 | "output_type": "stream", |
212 | 225 | "text": [ |
213 | 226 | "SINCE_POLICY: {\n", |
214 | | - " \"identity\": \"compliance_policies/e9b458b7-5e08-41ce-bf4c-ff01b7975148\",\n", |
| 227 | + " \"identity\": \"compliance_policies/458957bc-4da7-4cc3-b37f-43fa53abe0cc\",\n", |
215 | 228 | " \"compliance_type\": \"COMPLIANCE_SINCE\",\n", |
216 | 229 | " \"description\": \"Maintenance should be performed every 10 seconds\",\n", |
217 | 230 | " \"display_name\": \"Regular Maintenance of Traffic light\",\n", |
|
222 | 235 | " ]\n", |
223 | 236 | " }\n", |
224 | 237 | " ],\n", |
225 | | - " \"event_display_type\": \"Maintenance Performed 281b5ac5-764f-446d-84da-17138e18fde0\",\n", |
| 238 | + " \"event_display_type\": \"Maintenance Performed a3f86bbf-737a-45d8-bd84-3d6612fb641e\",\n", |
226 | 239 | " \"closing_event_display_type\": \"\",\n", |
227 | 240 | " \"time_period_seconds\": \"10\",\n", |
228 | 241 | " \"dynamic_window\": \"0\",\n", |
229 | 242 | " \"dynamic_variability\": 0,\n", |
230 | 243 | " \"richness_assertions\": []\n", |
231 | 244 | "}\n", |
232 | 245 | "compliance_policy {\n", |
233 | | - " \"identity\": \"compliance_policies/e9b458b7-5e08-41ce-bf4c-ff01b7975148\",\n", |
| 246 | + " \"identity\": \"compliance_policies/458957bc-4da7-4cc3-b37f-43fa53abe0cc\",\n", |
234 | 247 | " \"compliance_type\": \"COMPLIANCE_SINCE\",\n", |
235 | 248 | " \"description\": \"Maintenance should be performed every 10 seconds\",\n", |
236 | 249 | " \"display_name\": \"Regular Maintenance of Traffic light\",\n", |
|
241 | 254 | " ]\n", |
242 | 255 | " }\n", |
243 | 256 | " ],\n", |
244 | | - " \"event_display_type\": \"Maintenance Performed 281b5ac5-764f-446d-84da-17138e18fde0\",\n", |
| 257 | + " \"event_display_type\": \"Maintenance Performed a3f86bbf-737a-45d8-bd84-3d6612fb641e\",\n", |
245 | 258 | " \"closing_event_display_type\": \"\",\n", |
246 | 259 | " \"time_period_seconds\": \"10\",\n", |
247 | 260 | " \"dynamic_window\": \"0\",\n", |
|
260 | 273 | }, |
261 | 274 | { |
262 | 275 | "cell_type": "code", |
263 | | - "execution_count": 10, |
| 276 | + "execution_count": 11, |
264 | 277 | "id": "f8ac6dda", |
265 | 278 | "metadata": {}, |
266 | 279 | "outputs": [ |
|
269 | 282 | "output_type": "stream", |
270 | 283 | "text": [ |
271 | 284 | "TRAFFIC_LIGHT: {\n", |
272 | | - " \"identity\": \"assets/b961c23f-c1db-4bde-9ed3-c997378f2bf2\",\n", |
| 285 | + " \"identity\": \"assets/b6f63a6d-24a1-4dd8-a6d7-21e50e603ceb\",\n", |
273 | 286 | " \"behaviours\": [\n", |
| 287 | + " \"RecordEvidence\",\n", |
274 | 288 | " \"Builtin\",\n", |
275 | 289 | " \"AssetCreator\",\n", |
276 | | - " \"Attachments\",\n", |
277 | | - " \"RecordEvidence\"\n", |
| 290 | + " \"Attachments\"\n", |
278 | 291 | " ],\n", |
279 | 292 | " \"attributes\": {\n", |
280 | 293 | " \"arc_description\": \"Traffic flow control light at A603 North East\",\n", |
|
283 | 296 | " },\n", |
284 | 297 | " \"confirmation_status\": \"CONFIRMED\",\n", |
285 | 298 | " \"tracked\": \"TRACKED\",\n", |
286 | | - " \"owner\": \"0x3E06AcBf002E8F67bDe832b3f3E7d2aDA2BE3DC8\",\n", |
287 | | - " \"at_time\": \"2023-01-10T16:20:33Z\",\n", |
| 299 | + " \"owner\": \"0xe889E67FdBa658C6f27ccBDa98D9d1B5500Dbbce\",\n", |
| 300 | + " \"at_time\": \"2023-01-16T11:52:27Z\",\n", |
288 | 301 | " \"storage_integrity\": \"TENANT_STORAGE\",\n", |
289 | 302 | " \"proof_mechanism\": \"SIMPLE_HASH\",\n", |
290 | | - " \"chain_id\": \"99\",\n", |
| 303 | + " \"chain_id\": \"827586838445807967\",\n", |
291 | 304 | " \"public\": false,\n", |
292 | | - " \"tenant_identity\": \"tenant/f9040e8b-2afa-48f1-bb00-f055d55ade01\"\n", |
| 305 | + " \"tenant_identity\": \"tenant/9bfb80ee-81f6-40dc-b5c7-1c7fb2fb9866\"\n", |
293 | 306 | "}\n", |
294 | 307 | "traffic_light {\n", |
295 | | - " \"identity\": \"assets/b961c23f-c1db-4bde-9ed3-c997378f2bf2\",\n", |
| 308 | + " \"identity\": \"assets/b6f63a6d-24a1-4dd8-a6d7-21e50e603ceb\",\n", |
296 | 309 | " \"behaviours\": [\n", |
| 310 | + " \"RecordEvidence\",\n", |
297 | 311 | " \"Builtin\",\n", |
298 | 312 | " \"AssetCreator\",\n", |
299 | | - " \"Attachments\",\n", |
300 | | - " \"RecordEvidence\"\n", |
| 313 | + " \"Attachments\"\n", |
301 | 314 | " ],\n", |
302 | 315 | " \"attributes\": {\n", |
303 | 316 | " \"arc_description\": \"Traffic flow control light at A603 North East\",\n", |
|
306 | 319 | " },\n", |
307 | 320 | " \"confirmation_status\": \"CONFIRMED\",\n", |
308 | 321 | " \"tracked\": \"TRACKED\",\n", |
309 | | - " \"owner\": \"0x3E06AcBf002E8F67bDe832b3f3E7d2aDA2BE3DC8\",\n", |
310 | | - " \"at_time\": \"2023-01-10T16:20:33Z\",\n", |
| 322 | + " \"owner\": \"0xe889E67FdBa658C6f27ccBDa98D9d1B5500Dbbce\",\n", |
| 323 | + " \"at_time\": \"2023-01-16T11:52:27Z\",\n", |
311 | 324 | " \"storage_integrity\": \"TENANT_STORAGE\",\n", |
312 | 325 | " \"proof_mechanism\": \"SIMPLE_HASH\",\n", |
313 | | - " \"chain_id\": \"99\",\n", |
| 326 | + " \"chain_id\": \"827586838445807967\",\n", |
314 | 327 | " \"public\": false,\n", |
315 | | - " \"tenant_identity\": \"tenant/f9040e8b-2afa-48f1-bb00-f055d55ade01\"\n", |
| 328 | + " \"tenant_identity\": \"tenant/9bfb80ee-81f6-40dc-b5c7-1c7fb2fb9866\"\n", |
316 | 329 | "}\n" |
317 | 330 | ] |
318 | 331 | } |
|
326 | 339 | }, |
327 | 340 | { |
328 | 341 | "cell_type": "code", |
329 | | - "execution_count": 11, |
| 342 | + "execution_count": 12, |
330 | 343 | "id": "d93be01f", |
331 | 344 | "metadata": {}, |
332 | 345 | "outputs": [ |
|
335 | 348 | "output_type": "stream", |
336 | 349 | "text": [ |
337 | 350 | "MAINTENANCE_PERFORMED: {\n", |
338 | | - " \"identity\": \"assets/b961c23f-c1db-4bde-9ed3-c997378f2bf2/events/433f4c4e-f6e2-43f6-a48c-0f15152a2734\",\n", |
339 | | - " \"asset_identity\": \"assets/b961c23f-c1db-4bde-9ed3-c997378f2bf2\",\n", |
| 351 | + " \"identity\": \"assets/b6f63a6d-24a1-4dd8-a6d7-21e50e603ceb/events/eba5bb05-d4ff-4d99-9205-41236560d24d\",\n", |
| 352 | + " \"asset_identity\": \"assets/b6f63a6d-24a1-4dd8-a6d7-21e50e603ceb\",\n", |
340 | 353 | " \"event_attributes\": {\n", |
341 | 354 | " \"arc_description\": \"Maintenance performed on traffic light\",\n", |
342 | | - " \"arc_display_type\": \"Maintenance Performed 281b5ac5-764f-446d-84da-17138e18fde0\"\n", |
| 355 | + " \"arc_display_type\": \"Maintenance Performed a3f86bbf-737a-45d8-bd84-3d6612fb641e\"\n", |
343 | 356 | " },\n", |
344 | 357 | " \"asset_attributes\": {},\n", |
345 | 358 | " \"operation\": \"Record\",\n", |
346 | 359 | " \"behaviour\": \"RecordEvidence\",\n", |
347 | | - " \"timestamp_declared\": \"2023-01-10T16:20:37Z\",\n", |
348 | | - " \"timestamp_accepted\": \"2023-01-10T16:20:37Z\",\n", |
349 | | - " \"timestamp_committed\": \"2023-01-10T16:20:37.759462037Z\",\n", |
| 360 | + " \"timestamp_declared\": \"2023-01-16T11:52:31Z\",\n", |
| 361 | + " \"timestamp_accepted\": \"2023-01-16T11:52:31Z\",\n", |
| 362 | + " \"timestamp_committed\": \"2023-01-16T11:52:31.599813432Z\",\n", |
350 | 363 | " \"principal_declared\": {\n", |
351 | | - " \"issuer\": \"https://app.dev-paul-0.wild.jitsuin.io/appidpv1\",\n", |
352 | | - " \"subject\": \"bd3f85d2-9b92-4ef0-82c9-2bcb7b5d25c6\",\n", |
353 | | - " \"display_name\": \"Application display name 05f19055-d2fd-4076-bd02-46a924cbe984\",\n", |
| 364 | + " \"issuer\": \"https://app.rkvst.io/appidpv1\",\n", |
| 365 | + " \"subject\": \"437bd138-dade-4346-aadd-dfdfee51ddf4\",\n", |
| 366 | + " \"display_name\": \"Test Notebooks\",\n", |
354 | 367 | " \"email\": \"\"\n", |
355 | 368 | " },\n", |
356 | 369 | " \"principal_accepted\": {\n", |
357 | | - " \"issuer\": \"https://app.dev-paul-0.wild.jitsuin.io/appidpv1\",\n", |
358 | | - " \"subject\": \"bd3f85d2-9b92-4ef0-82c9-2bcb7b5d25c6\",\n", |
359 | | - " \"display_name\": \"Application display name 05f19055-d2fd-4076-bd02-46a924cbe984\",\n", |
| 370 | + " \"issuer\": \"https://app.rkvst.io/appidpv1\",\n", |
| 371 | + " \"subject\": \"437bd138-dade-4346-aadd-dfdfee51ddf4\",\n", |
| 372 | + " \"display_name\": \"Test Notebooks\",\n", |
360 | 373 | " \"email\": \"\"\n", |
361 | 374 | " },\n", |
362 | 375 | " \"confirmation_status\": \"CONFIRMED\",\n", |
363 | 376 | " \"transaction_id\": \"\",\n", |
364 | 377 | " \"block_number\": 0,\n", |
365 | 378 | " \"transaction_index\": 0,\n", |
366 | | - " \"from\": \"0x3E06AcBf002E8F67bDe832b3f3E7d2aDA2BE3DC8\",\n", |
367 | | - " \"tenant_identity\": \"tenant/f9040e8b-2afa-48f1-bb00-f055d55ade01\"\n", |
| 379 | + " \"from\": \"0xe889E67FdBa658C6f27ccBDa98D9d1B5500Dbbce\",\n", |
| 380 | + " \"tenant_identity\": \"tenant/9bfb80ee-81f6-40dc-b5c7-1c7fb2fb9866\"\n", |
368 | 381 | "}\n", |
369 | 382 | "Sleep 1 second...\n", |
370 | 383 | "COMPLIANCE (true): {\n", |
371 | 384 | " \"compliant\": true,\n", |
372 | 385 | " \"compliance\": [\n", |
373 | 386 | " {\n", |
374 | | - " \"compliance_policy_identity\": \"compliance_policies/e9b458b7-5e08-41ce-bf4c-ff01b7975148\",\n", |
| 387 | + " \"compliance_policy_identity\": \"compliance_policies/458957bc-4da7-4cc3-b37f-43fa53abe0cc\",\n", |
375 | 388 | " \"compliant\": true,\n", |
376 | 389 | " \"reason\": \"\"\n", |
377 | 390 | " }\n", |
378 | 391 | " ],\n", |
379 | 392 | " \"next_page_token\": \"\",\n", |
380 | | - " \"compliant_at\": \"2023-01-10T16:20:39Z\"\n", |
| 393 | + " \"compliant_at\": \"2023-01-16T11:52:33Z\"\n", |
381 | 394 | "}\n" |
382 | 395 | ] |
383 | 396 | } |
|
397 | 410 | }, |
398 | 411 | { |
399 | 412 | "cell_type": "code", |
400 | | - "execution_count": 12, |
| 413 | + "execution_count": 13, |
401 | 414 | "id": "fe8e2a6e", |
402 | 415 | "metadata": {}, |
403 | 416 | "outputs": [ |
|
410 | 423 | " \"compliant\": false,\n", |
411 | 424 | " \"compliance\": [\n", |
412 | 425 | " {\n", |
413 | | - " \"compliance_policy_identity\": \"compliance_policies/e9b458b7-5e08-41ce-bf4c-ff01b7975148\",\n", |
| 426 | + " \"compliance_policy_identity\": \"compliance_policies/458957bc-4da7-4cc3-b37f-43fa53abe0cc\",\n", |
414 | 427 | " \"compliant\": false,\n", |
415 | 428 | " \"reason\": \"Duration 20s exceeds limit 10s\"\n", |
416 | 429 | " }\n", |
417 | 430 | " ],\n", |
418 | 431 | " \"next_page_token\": \"\",\n", |
419 | | - " \"compliant_at\": \"2023-01-10T16:20:58Z\"\n", |
| 432 | + " \"compliant_at\": \"2023-01-16T11:52:52Z\"\n", |
420 | 433 | "}\n" |
421 | 434 | ] |
422 | 435 | } |
|
434 | 447 | }, |
435 | 448 | { |
436 | 449 | "cell_type": "code", |
437 | | - "execution_count": 13, |
| 450 | + "execution_count": 14, |
438 | 451 | "id": "40ffc716", |
439 | 452 | "metadata": {}, |
440 | 453 | "outputs": [], |
|
444 | 457 | " compliance_policy[\"identity\"],\n", |
445 | 458 | ")" |
446 | 459 | ] |
| 460 | + }, |
| 461 | + { |
| 462 | + "cell_type": "code", |
| 463 | + "execution_count": null, |
| 464 | + "id": "bccec420", |
| 465 | + "metadata": {}, |
| 466 | + "outputs": [], |
| 467 | + "source": [] |
447 | 468 | } |
448 | 469 | ], |
449 | 470 | "metadata": { |
|
462 | 483 | "name": "python", |
463 | 484 | "nbconvert_exporter": "python", |
464 | 485 | "pygments_lexer": "ipython3", |
465 | | - "version": "3.10.6" |
| 486 | + "version": "3.8.15" |
466 | 487 | } |
467 | 488 | }, |
468 | 489 | "nbformat": 4, |
|
0 commit comments