@asecret/sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,751 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "aSecret Protocol draft 0.2 message shapes",
4
+ "definitions": {
5
+ "discovery": {
6
+ "type": "object",
7
+ "required": [
8
+ "versions",
9
+ "profiles",
10
+ "operations",
11
+ "api_base"
12
+ ],
13
+ "properties": {
14
+ "versions": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "string",
18
+ "minLength": 1
19
+ },
20
+ "uniqueItems": true,
21
+ "minItems": 1
22
+ },
23
+ "profiles": {
24
+ "type": "array",
25
+ "items": {
26
+ "type": "string",
27
+ "minLength": 1
28
+ },
29
+ "uniqueItems": true,
30
+ "minItems": 1
31
+ },
32
+ "operations": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "string",
36
+ "minLength": 1
37
+ },
38
+ "uniqueItems": true,
39
+ "minItems": 1
40
+ },
41
+ "api_base": {
42
+ "type": "string",
43
+ "pattern": "^https://",
44
+ "format": "uri"
45
+ },
46
+ "private_form_url": {
47
+ "type": "string",
48
+ "pattern": "^https://[^/?#@]+(?:/[^?#]*)?$",
49
+ "format": "uri"
50
+ },
51
+ "owner_setup_url": {
52
+ "type": "string",
53
+ "pattern": "^https://[^/?#@]+(?:/[^?#]*)?$",
54
+ "format": "uri"
55
+ },
56
+ "server_info_url": {
57
+ "type": "string",
58
+ "pattern": "^https://[^/?#@]+(?:/[^?#]*)?$",
59
+ "format": "uri"
60
+ },
61
+ "mcp_endpoint": {
62
+ "type": "string",
63
+ "pattern": "^https://",
64
+ "format": "uri"
65
+ },
66
+ "save_detail_types": {
67
+ "type": "array",
68
+ "minItems": 1,
69
+ "uniqueItems": true,
70
+ "items": {
71
+ "enum": [
72
+ "postal_address",
73
+ "email",
74
+ "phone",
75
+ "membership",
76
+ "secure_note",
77
+ "api_key",
78
+ "password",
79
+ "id_number",
80
+ "document"
81
+ ]
82
+ }
83
+ },
84
+ "directory_url": {
85
+ "type": "string",
86
+ "pattern": "^https://[^/?#@]+(?:/[^?#]*)?$",
87
+ "format": "uri"
88
+ },
89
+ "link_url": {
90
+ "type": "string",
91
+ "pattern": "^https://[^/?#@]+(?:/[^?#]*)?$",
92
+ "format": "uri"
93
+ }
94
+ },
95
+ "additionalProperties": true,
96
+ "dependencies": {
97
+ "mcp_endpoint": {
98
+ "properties": {
99
+ "profiles": {
100
+ "contains": {
101
+ "const": "mcp-http"
102
+ },
103
+ "type": "array"
104
+ }
105
+ }
106
+ },
107
+ "save_detail_types": {
108
+ "properties": {
109
+ "profiles": {
110
+ "type": "array",
111
+ "contains": {
112
+ "enum": [
113
+ "save-detail",
114
+ "private-save-link"
115
+ ]
116
+ }
117
+ }
118
+ }
119
+ }
120
+ },
121
+ "allOf": [
122
+ {
123
+ "if": {
124
+ "properties": {
125
+ "profiles": {
126
+ "contains": {
127
+ "const": "mcp-http"
128
+ },
129
+ "type": "array"
130
+ }
131
+ }
132
+ },
133
+ "then": {
134
+ "required": [
135
+ "mcp_endpoint"
136
+ ],
137
+ "properties": {
138
+ "mcp_endpoint": {
139
+ "type": "string"
140
+ }
141
+ }
142
+ }
143
+ },
144
+ {
145
+ "if": {
146
+ "properties": {
147
+ "profiles": {
148
+ "type": "array",
149
+ "contains": {
150
+ "const": "save-detail"
151
+ }
152
+ }
153
+ }
154
+ },
155
+ "then": {
156
+ "required": [
157
+ "save_detail_types"
158
+ ],
159
+ "properties": {
160
+ "save_detail_types": {
161
+ "type": "array"
162
+ },
163
+ "operations": {
164
+ "type": "array",
165
+ "contains": {
166
+ "const": "details.save"
167
+ }
168
+ }
169
+ }
170
+ }
171
+ },
172
+ {
173
+ "if": {
174
+ "properties": {
175
+ "profiles": {
176
+ "type": "array",
177
+ "contains": {
178
+ "const": "private-save-link"
179
+ }
180
+ }
181
+ }
182
+ },
183
+ "then": {
184
+ "required": [
185
+ "save_detail_types"
186
+ ],
187
+ "properties": {
188
+ "save_detail_types": {
189
+ "type": "array"
190
+ }
191
+ }
192
+ }
193
+ },
194
+ {
195
+ "if": {
196
+ "properties": {
197
+ "profiles": {
198
+ "type": "array",
199
+ "contains": {
200
+ "const": "payment-method-setup"
201
+ }
202
+ }
203
+ }
204
+ },
205
+ "then": {
206
+ "properties": {
207
+ "operations": {
208
+ "type": "array",
209
+ "contains": {
210
+ "const": "payments.save_method"
211
+ }
212
+ }
213
+ }
214
+ }
215
+ },
216
+ {
217
+ "if": {
218
+ "properties": {
219
+ "profiles": {
220
+ "type": "array",
221
+ "contains": {
222
+ "enum": [
223
+ "document-upload-form",
224
+ "membership-form",
225
+ "id-number-form"
226
+ ]
227
+ }
228
+ }
229
+ }
230
+ },
231
+ "then": {
232
+ "required": [
233
+ "private_form_url"
234
+ ]
235
+ }
236
+ },
237
+ {
238
+ "if": {
239
+ "properties": {
240
+ "profiles": {
241
+ "type": "array",
242
+ "contains": {
243
+ "const": "order-status"
244
+ }
245
+ }
246
+ }
247
+ },
248
+ "then": {
249
+ "properties": {
250
+ "operations": {
251
+ "type": "array",
252
+ "contains": {
253
+ "const": "orders.get_status"
254
+ }
255
+ }
256
+ }
257
+ }
258
+ },
259
+ {
260
+ "if": {
261
+ "properties": {
262
+ "profiles": {
263
+ "type": "array",
264
+ "contains": {
265
+ "const": "setup-invitation"
266
+ }
267
+ }
268
+ }
269
+ },
270
+ "then": {
271
+ "properties": {
272
+ "operations": {
273
+ "type": "array",
274
+ "contains": {
275
+ "const": "details.request_setup"
276
+ }
277
+ }
278
+ }
279
+ }
280
+ }
281
+ ]
282
+ },
283
+ "addressRequest": {
284
+ "type": "object",
285
+ "required": [
286
+ "operation",
287
+ "recipient",
288
+ "order_id",
289
+ "requested_fields"
290
+ ],
291
+ "properties": {
292
+ "operation": {
293
+ "const": "orders.set_delivery_address"
294
+ },
295
+ "recipient": {
296
+ "type": "string",
297
+ "minLength": 1
298
+ },
299
+ "order_id": {
300
+ "type": "string",
301
+ "minLength": 1
302
+ },
303
+ "requested_fields": {
304
+ "const": [
305
+ "postal_address"
306
+ ]
307
+ },
308
+ "reference": {
309
+ "type": "string",
310
+ "pattern": "^ref://detail/[0-9a-f]{32}$"
311
+ }
312
+ },
313
+ "additionalProperties": false
314
+ },
315
+ "created": {
316
+ "type": "object",
317
+ "required": [
318
+ "request_id",
319
+ "state",
320
+ "expires_at",
321
+ "review_url"
322
+ ],
323
+ "properties": {
324
+ "request_id": {
325
+ "type": "string",
326
+ "minLength": 1
327
+ },
328
+ "state": {
329
+ "const": "awaiting_owner"
330
+ },
331
+ "expires_at": {
332
+ "type": "string",
333
+ "format": "date-time",
334
+ "pattern": "(Z|\\+00:00)$"
335
+ },
336
+ "review_url": {
337
+ "type": "string",
338
+ "pattern": "^https://",
339
+ "format": "uri"
340
+ }
341
+ },
342
+ "additionalProperties": false
343
+ },
344
+ "stateOnly": {
345
+ "type": "object",
346
+ "required": [
347
+ "request_id",
348
+ "state"
349
+ ],
350
+ "properties": {
351
+ "request_id": {
352
+ "type": "string",
353
+ "minLength": 1
354
+ },
355
+ "state": {
356
+ "enum": [
357
+ "awaiting_owner",
358
+ "authorized",
359
+ "dispatch_committed",
360
+ "outcome_unknown",
361
+ "declined",
362
+ "canceled",
363
+ "expired",
364
+ "failed"
365
+ ]
366
+ }
367
+ },
368
+ "additionalProperties": false
369
+ },
370
+ "addressConfirmed": {
371
+ "type": "object",
372
+ "required": [
373
+ "request_id",
374
+ "state",
375
+ "result",
376
+ "receipt_id"
377
+ ],
378
+ "properties": {
379
+ "request_id": {
380
+ "type": "string",
381
+ "minLength": 1
382
+ },
383
+ "state": {
384
+ "const": "confirmed"
385
+ },
386
+ "result": {
387
+ "type": "object",
388
+ "required": [
389
+ "order_id",
390
+ "delivery_address_status"
391
+ ],
392
+ "properties": {
393
+ "order_id": {
394
+ "type": "string",
395
+ "minLength": 1
396
+ },
397
+ "delivery_address_status": {
398
+ "const": "accepted"
399
+ }
400
+ },
401
+ "additionalProperties": false
402
+ },
403
+ "receipt_id": {
404
+ "type": "string",
405
+ "minLength": 1
406
+ }
407
+ },
408
+ "additionalProperties": false
409
+ },
410
+ "error": {
411
+ "type": "object",
412
+ "required": [
413
+ "error"
414
+ ],
415
+ "properties": {
416
+ "error": {
417
+ "type": "string",
418
+ "minLength": 1
419
+ },
420
+ "status": {
421
+ "type": "integer",
422
+ "minimum": 100,
423
+ "maximum": 599
424
+ },
425
+ "code": {
426
+ "type": "string",
427
+ "minLength": 1
428
+ },
429
+ "detail": {
430
+ "type": "string"
431
+ },
432
+ "next": {
433
+ "type": "string"
434
+ }
435
+ },
436
+ "additionalProperties": false
437
+ },
438
+ "saveRequest": {
439
+ "type": "object",
440
+ "required": [
441
+ "operation",
442
+ "detail_type"
443
+ ],
444
+ "properties": {
445
+ "operation": {
446
+ "const": "details.save"
447
+ },
448
+ "detail_type": {
449
+ "enum": [
450
+ "postal_address",
451
+ "email",
452
+ "phone",
453
+ "membership",
454
+ "secure_note",
455
+ "api_key",
456
+ "password",
457
+ "id_number",
458
+ "document"
459
+ ]
460
+ }
461
+ },
462
+ "additionalProperties": false
463
+ },
464
+ "saveConfirmed": {
465
+ "type": "object",
466
+ "required": [
467
+ "request_id",
468
+ "state",
469
+ "result",
470
+ "receipt_id"
471
+ ],
472
+ "properties": {
473
+ "request_id": {
474
+ "type": "string",
475
+ "minLength": 1
476
+ },
477
+ "state": {
478
+ "const": "confirmed"
479
+ },
480
+ "result": {
481
+ "type": "object",
482
+ "required": [
483
+ "detail_status"
484
+ ],
485
+ "properties": {
486
+ "detail_status": {
487
+ "const": "saved"
488
+ }
489
+ },
490
+ "additionalProperties": false
491
+ },
492
+ "receipt_id": {
493
+ "type": "string",
494
+ "minLength": 1
495
+ }
496
+ },
497
+ "additionalProperties": false
498
+ },
499
+ "paymentSetupRequest": {
500
+ "type": "object",
501
+ "properties": {
502
+ "operation": {
503
+ "const": "payments.save_method"
504
+ }
505
+ },
506
+ "required": [
507
+ "operation"
508
+ ],
509
+ "additionalProperties": false
510
+ },
511
+ "orderStatusRequest": {
512
+ "type": "object",
513
+ "required": [
514
+ "operation",
515
+ "recipient",
516
+ "order_id"
517
+ ],
518
+ "properties": {
519
+ "operation": {
520
+ "const": "orders.get_status"
521
+ },
522
+ "recipient": {
523
+ "type": "string",
524
+ "minLength": 1,
525
+ "maxLength": 200
526
+ },
527
+ "order_id": {
528
+ "type": "string",
529
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$",
530
+ "maxLength": 128
531
+ }
532
+ },
533
+ "additionalProperties": false
534
+ },
535
+ "orderStatusConfirmed": {
536
+ "type": "object",
537
+ "required": [
538
+ "request_id",
539
+ "state",
540
+ "result",
541
+ "receipt_id"
542
+ ],
543
+ "properties": {
544
+ "request_id": {
545
+ "type": "string",
546
+ "minLength": 1
547
+ },
548
+ "state": {
549
+ "const": "confirmed"
550
+ },
551
+ "result": {
552
+ "type": "object",
553
+ "required": [
554
+ "order_id",
555
+ "order_status"
556
+ ],
557
+ "properties": {
558
+ "order_id": {
559
+ "type": "string",
560
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$",
561
+ "maxLength": 128
562
+ },
563
+ "order_status": {
564
+ "enum": [
565
+ "pending",
566
+ "processing",
567
+ "shipped",
568
+ "delivered",
569
+ "canceled",
570
+ "unknown"
571
+ ]
572
+ }
573
+ },
574
+ "additionalProperties": false
575
+ },
576
+ "receipt_id": {
577
+ "type": "string",
578
+ "minLength": 1
579
+ }
580
+ },
581
+ "additionalProperties": false
582
+ },
583
+ "setupRequest": {
584
+ "type": "object",
585
+ "properties": {
586
+ "operation": {
587
+ "const": "details.request_setup"
588
+ }
589
+ },
590
+ "required": [
591
+ "operation"
592
+ ],
593
+ "additionalProperties": false
594
+ },
595
+ "setupConfirmed": {
596
+ "type": "object",
597
+ "required": [
598
+ "request_id",
599
+ "state",
600
+ "result",
601
+ "receipt_id"
602
+ ],
603
+ "properties": {
604
+ "request_id": {
605
+ "type": "string",
606
+ "minLength": 1
607
+ },
608
+ "state": {
609
+ "const": "confirmed"
610
+ },
611
+ "result": {
612
+ "type": "object",
613
+ "required": [
614
+ "owner_status"
615
+ ],
616
+ "properties": {
617
+ "owner_status": {
618
+ "const": "ready"
619
+ }
620
+ },
621
+ "additionalProperties": false
622
+ },
623
+ "receipt_id": {
624
+ "type": "string",
625
+ "minLength": 1
626
+ }
627
+ },
628
+ "additionalProperties": false
629
+ },
630
+ "publicIntegration": {
631
+ "type": "object",
632
+ "required": [
633
+ "kind",
634
+ "id",
635
+ "name",
636
+ "operations"
637
+ ],
638
+ "properties": {
639
+ "kind": {
640
+ "enum": [
641
+ "assistant",
642
+ "merchant"
643
+ ]
644
+ },
645
+ "id": {
646
+ "type": "string",
647
+ "minLength": 1,
648
+ "maxLength": 200,
649
+ "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u061c\\u200e\\u200f\\u2028-\\u202e\\u2066-\\u2069]+$"
650
+ },
651
+ "name": {
652
+ "type": "string",
653
+ "minLength": 1,
654
+ "maxLength": 200,
655
+ "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u061c\\u200e\\u200f\\u2028-\\u202e\\u2066-\\u2069]+$"
656
+ },
657
+ "operations": {
658
+ "type": "array",
659
+ "items": {
660
+ "type": "string",
661
+ "minLength": 1
662
+ },
663
+ "uniqueItems": true,
664
+ "minItems": 1
665
+ },
666
+ "regions": {
667
+ "type": "array",
668
+ "items": {
669
+ "type": "string",
670
+ "pattern": "^[A-Z]{2}$"
671
+ },
672
+ "minItems": 1,
673
+ "uniqueItems": true
674
+ }
675
+ },
676
+ "additionalProperties": false
677
+ },
678
+ "publicDirectory": {
679
+ "type": "object",
680
+ "required": [
681
+ "version",
682
+ "operations",
683
+ "integrations"
684
+ ],
685
+ "properties": {
686
+ "version": {
687
+ "const": "0.2"
688
+ },
689
+ "operations": {
690
+ "type": "array",
691
+ "items": {
692
+ "type": "string",
693
+ "minLength": 1
694
+ },
695
+ "uniqueItems": true
696
+ },
697
+ "integrations": {
698
+ "type": "array",
699
+ "items": {
700
+ "$ref": "#/definitions/publicIntegration"
701
+ }
702
+ }
703
+ },
704
+ "additionalProperties": false
705
+ }
706
+ },
707
+ "anyOf": [
708
+ {
709
+ "$ref": "#/definitions/discovery"
710
+ },
711
+ {
712
+ "$ref": "#/definitions/addressRequest"
713
+ },
714
+ {
715
+ "$ref": "#/definitions/created"
716
+ },
717
+ {
718
+ "$ref": "#/definitions/stateOnly"
719
+ },
720
+ {
721
+ "$ref": "#/definitions/addressConfirmed"
722
+ },
723
+ {
724
+ "$ref": "#/definitions/error"
725
+ },
726
+ {
727
+ "$ref": "#/definitions/saveRequest"
728
+ },
729
+ {
730
+ "$ref": "#/definitions/paymentSetupRequest"
731
+ },
732
+ {
733
+ "$ref": "#/definitions/saveConfirmed"
734
+ },
735
+ {
736
+ "$ref": "#/definitions/orderStatusRequest"
737
+ },
738
+ {
739
+ "$ref": "#/definitions/orderStatusConfirmed"
740
+ },
741
+ {
742
+ "$ref": "#/definitions/setupRequest"
743
+ },
744
+ {
745
+ "$ref": "#/definitions/setupConfirmed"
746
+ },
747
+ {
748
+ "$ref": "#/definitions/publicDirectory"
749
+ }
750
+ ]
751
+ }