-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprd.json
More file actions
2621 lines (2621 loc) · 96.8 KB
/
prd.json
File metadata and controls
2621 lines (2621 loc) · 96.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"project": "Protocol M",
"branchName": "ralph/protocol-m-full-implementation",
"description": "Protocol M - Complete agent identity, attribution, and economics platform with cryptographic signing, portable reputation, and reserve-backed token economy",
"userStories": [
{
"id": "US-001A",
"title": "Create Rust workspace structure for OpenClaw",
"description": "As a developer, I need the basic workspace structure so I can build the multi-crate project.",
"acceptanceCriteria": [
"Create root Cargo.toml with workspace definition",
"Create crates/openclaw-crypto/ directory",
"Create crates/openclaw-cli/ directory",
"Create fixtures/ directory",
"Add workspace members: openclaw-crypto, openclaw-cli",
"Typecheck passes (cargo check)"
],
"priority": 1,
"passes": false,
"notes": ""
},
{
"id": "US-001B",
"title": "Add core dependencies to openclaw-crypto",
"description": "As a developer, I need crypto dependencies configured so I can implement signing.",
"acceptanceCriteria": [
"Add ed25519-dalek = \"2\" to Cargo.toml",
"Add serde = { version = \"1\", features = [\"derive\"] }",
"Add serde_json = \"1\"",
"Add serde_jcs = \"0.1\" for RFC 8785 canonicalization",
"Add sha2 = \"0.10\" for hashing",
"Add base64 = \"0.22\"",
"Add bs58 = \"0.5\" for Base58BTC encoding",
"Add anyhow = \"1\" for error handling",
"Typecheck passes"
],
"priority": 2,
"passes": false,
"notes": ""
},
{
"id": "US-001C",
"title": "Define signature envelope types",
"description": "As a developer, I need data structures for signature envelopes so I can serialize them.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/types.rs",
"Define HashRef struct with algo and value fields",
"Define ArtifactInfo struct with name and size fields",
"Define SignatureEnvelopeV1 struct matching RFC spec",
"All structs derive Serialize, Deserialize, Debug, Clone",
"Use #[serde(rename = \"type\")] for type field",
"Typecheck passes"
],
"priority": 3,
"passes": false,
"notes": ""
},
{
"id": "US-001D",
"title": "Implement SHA-256 hashing utility",
"description": "As a developer, I need a hash function so I can compute artifact hashes.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/hash.rs",
"Implement sha256_hex(bytes: &[u8]) -> String",
"Use sha2::Sha256 for hashing",
"Return lowercase hex-encoded hash",
"Add unit test verifying known hash",
"Typecheck passes"
],
"priority": 4,
"passes": false,
"notes": ""
},
{
"id": "US-001E",
"title": "Implement JCS canonicalization",
"description": "As a developer, I need RFC 8785 canonicalization so signatures are deterministic.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/jcs.rs",
"Implement jcs_canonical_bytes<T: Serialize>(value: &T) -> Result<Vec<u8>>",
"Use serde_jcs::to_string for canonicalization",
"Return UTF-8 bytes of canonical JSON",
"Add test verifying field order independence",
"Typecheck passes"
],
"priority": 5,
"passes": false,
"notes": ""
},
{
"id": "US-001F",
"title": "Implement DID key derivation",
"description": "As a developer, I need DID generation so identities have standard format.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/did.rs",
"Implement pubkey_to_did(public_key: &VerifyingKey) -> String",
"Prefix pubkey bytes with multicodec 0xed01",
"Encode with Base58BTC (bs58 crate)",
"Prepend \"did:key:z\" to encoded string",
"Add test verifying DID format",
"Typecheck passes"
],
"priority": 6,
"passes": false,
"notes": ""
},
{
"id": "US-001G",
"title": "Implement keypair generation",
"description": "As a developer, I need keypair generation so users can create identities.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/keys.rs",
"Implement generate_keypair() -> (SigningKey, VerifyingKey)",
"Use ed25519_dalek with OsRng",
"Return both signing and verifying keys",
"Add test verifying keypair signs and verifies",
"Typecheck passes"
],
"priority": 7,
"passes": false,
"notes": ""
},
{
"id": "US-001H",
"title": "Add age encryption dependency to CLI crate",
"description": "As a developer, I need age encryption so private keys are protected at rest.",
"acceptanceCriteria": [
"Create crates/openclaw-cli/Cargo.toml",
"Add age = \"0.10\" dependency",
"Add rand = \"0.8\" dependency",
"Add clap = { version = \"4\", features = [\"derive\"] }",
"Add openclaw-crypto = { path = \"../openclaw-crypto\" }",
"Add anyhow = \"1\"",
"Typecheck passes"
],
"priority": 8,
"passes": false,
"notes": ""
},
{
"id": "US-001I",
"title": "Implement private key encryption",
"description": "As a developer, I need key encryption so private keys are never stored plaintext.",
"acceptanceCriteria": [
"Create crates/openclaw-cli/src/keystore.rs",
"Implement encrypt_key(key_bytes: &[u8], passphrase: &str) -> Result<Vec<u8>>",
"Use age::Encryptor with Passphrase recipient",
"Return encrypted bytes suitable for file storage",
"Add test verifying roundtrip encryption/decryption",
"Typecheck passes"
],
"priority": 9,
"passes": false,
"notes": ""
},
{
"id": "US-001J",
"title": "Implement private key decryption",
"description": "As a developer, I need key decryption so users can load identities.",
"acceptanceCriteria": [
"Implement decrypt_key(encrypted: &[u8], passphrase: &str) -> Result<Vec<u8>>",
"Use age::Decryptor with passphrase",
"Handle incorrect passphrase gracefully",
"Return decrypted key bytes",
"Add test verifying decryption with wrong passphrase fails",
"Typecheck passes"
],
"priority": 10,
"passes": false,
"notes": ""
},
{
"id": "US-001K",
"title": "Implement file permission checks",
"description": "As a developer, I need permission validation so insecure setups are rejected.",
"acceptanceCriteria": [
"Implement check_permissions(path: &Path) -> Result<()>",
"Verify directory is 0700 on Unix systems",
"Verify keyfile is 0600 on Unix systems",
"Return error if permissions too permissive",
"Skip check on Windows (or use equivalent ACLs)",
"Add test for permission validation",
"Typecheck passes"
],
"priority": 11,
"passes": false,
"notes": ""
},
{
"id": "US-001L",
"title": "Implement identity initialization logic",
"description": "As a developer, I need init command logic so users can create identities.",
"acceptanceCriteria": [
"Implement init_identity(force: bool) -> Result<()>",
"Check if identity already exists (error unless force=true)",
"Create ~/.openclaw/identity/ directory with 0700 perms",
"Generate keypair using openclaw-crypto",
"Derive DID from public key",
"Prompt for passphrase (twice for confirmation)",
"Encrypt private key with age",
"Write root.key.enc (0600), root.pub (0644), identity.json",
"Typecheck passes"
],
"priority": 12,
"passes": false,
"notes": ""
},
{
"id": "US-001M",
"title": "Add CLI scaffolding with clap",
"description": "As a developer, I need CLI structure so commands are routed correctly.",
"acceptanceCriteria": [
"Create crates/openclaw-cli/src/main.rs",
"Define Cli struct with clap Parser derive",
"Define Commands enum with Identity, Sign, Verify, Manifest subcommands",
"Add --version and --help support",
"Route commands to placeholder handlers",
"Binary compiles and shows help",
"Typecheck passes"
],
"priority": 13,
"passes": false,
"notes": ""
},
{
"id": "US-001N",
"title": "Wire identity init command to CLI",
"description": "As a developer, I need the init command wired so users can run it.",
"acceptanceCriteria": [
"Add IdentityCmd struct with --force flag",
"Wire Identity(cmd) to keystore::init_identity",
"Print success message with DID after init",
"Handle errors gracefully with user-friendly messages",
"Test: run `openclaw identity init` manually",
"Typecheck passes"
],
"priority": 14,
"passes": false,
"notes": ""
},
{
"id": "US-001O",
"title": "Create golden test vector fixture",
"description": "As a developer, I need test vectors so implementations are verifiable.",
"acceptanceCriteria": [
"Create fixtures/golden_vectors.json",
"Include seed (32 bytes hex)",
"Include expected public key",
"Include expected DID",
"Include test file content and hash",
"Include expected canonical envelope bytes",
"Include expected signature (base64)",
"Typecheck passes"
],
"priority": 15,
"passes": false,
"notes": ""
},
{
"id": "US-001P",
"title": "Add integration test for golden vector",
"description": "As a developer, I need a golden vector test so the implementation is validated.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/tests/golden.rs",
"Load fixtures/golden_vectors.json",
"Generate keypair from test seed",
"Verify DID derivation matches expected",
"Sign test content and verify signature matches",
"Test passes",
"Typecheck passes"
],
"priority": 16,
"passes": false,
"notes": ""
},
{
"id": "US-002A",
"title": "Implement envelope signing logic",
"description": "As a developer, I need signing logic so artifacts can be signed.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/sign.rs",
"Implement sign_artifact(key, did, filename, bytes, timestamp, metadata) -> Result<SignatureEnvelopeV1>",
"Compute SHA-256 hash of file bytes",
"Construct envelope with empty signature field",
"Canonicalize envelope with JCS",
"Sign canonical bytes with ed25519_dalek",
"Insert base64-encoded signature into envelope",
"Typecheck passes"
],
"priority": 17,
"passes": false,
"notes": ""
},
{
"id": "US-002B",
"title": "Add metadata parsing for --meta flag",
"description": "As a developer, I need metadata parsing so custom fields can be added.",
"acceptanceCriteria": [
"Implement parse_metadata(args: Vec<String>) -> Result<serde_json::Value>",
"Parse key=value pairs",
"Support nested keys with dot notation (e.g., author.name=Alice)",
"Return JSON object",
"Handle invalid formats with clear errors",
"Add test for metadata parsing",
"Typecheck passes"
],
"priority": 18,
"passes": false,
"notes": ""
},
{
"id": "US-002C",
"title": "Implement sign command handler",
"description": "As a developer, I need sign command wired so users can sign files.",
"acceptanceCriteria": [
"Add SignCmd struct with path, --meta, --dry-run flags",
"Load identity from ~/.openclaw/identity/",
"Prompt for passphrase and decrypt private key",
"Read file bytes",
"Get current timestamp (ISO 8601)",
"Parse metadata if provided",
"Call sign_artifact from openclaw-crypto",
"Typecheck passes"
],
"priority": 19,
"passes": false,
"notes": ""
},
{
"id": "US-002D",
"title": "Implement signature output (normal mode)",
"description": "As a developer, I need signature writing so envelopes are saved.",
"acceptanceCriteria": [
"If not --dry-run, write envelope to <file>.sig.json",
"Serialize envelope as pretty JSON",
"Set file permissions to 0644",
"Print success message with output path",
"Typecheck passes"
],
"priority": 20,
"passes": false,
"notes": ""
},
{
"id": "US-002E",
"title": "Implement signature output (dry-run mode)",
"description": "As a developer, I need dry-run output so envelopes can be previewed.",
"acceptanceCriteria": [
"If --dry-run, write envelope JSON to stdout",
"Do not create .sig.json file",
"Print to stdout only (no success messages to stderr)",
"Typecheck passes"
],
"priority": 21,
"passes": false,
"notes": ""
},
{
"id": "US-002F",
"title": "Add test for signing roundtrip",
"description": "As a developer, I need roundtrip test so signing works end-to-end.",
"acceptanceCriteria": [
"Create test that generates identity",
"Sign a test file",
"Verify the signature immediately",
"Test passes",
"Typecheck passes"
],
"priority": 22,
"passes": false,
"notes": ""
},
{
"id": "US-003A",
"title": "Implement envelope verification logic",
"description": "As a developer, I need verification logic so signatures can be checked.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/verify.rs",
"Implement verify_artifact(verifying_key, file_bytes, envelope) -> Result<()>",
"Verify envelope version/type/algo fields",
"Recompute file hash and compare to envelope",
"Remove signature from envelope copy",
"Canonicalize envelope with JCS",
"Decode base64 signature",
"Verify signature with ed25519_dalek",
"Typecheck passes"
],
"priority": 23,
"passes": false,
"notes": ""
},
{
"id": "US-003B",
"title": "Implement DID to public key extraction",
"description": "As a developer, I need DID parsing so verifying keys can be extracted.",
"acceptanceCriteria": [
"Implement did_to_verifying_key(did: &str) -> Result<VerifyingKey>",
"Strip did:key:z prefix",
"Decode Base58BTC",
"Verify multicodec is 0xed01",
"Extract 32-byte public key",
"Construct VerifyingKey",
"Add test for known DID",
"Typecheck passes"
],
"priority": 24,
"passes": false,
"notes": ""
},
{
"id": "US-003C",
"title": "Implement verify command handler",
"description": "As a developer, I need verify command wired so users can check signatures.",
"acceptanceCriteria": [
"Add VerifyCmd struct with file_path and sig_path",
"Load envelope from .sig.json file",
"Parse envelope as SignatureEnvelopeV1",
"Extract DID and convert to VerifyingKey",
"Read file bytes",
"Call verify_artifact from openclaw-crypto",
"Typecheck passes"
],
"priority": 25,
"passes": false,
"notes": ""
},
{
"id": "US-003D",
"title": "Add colored verification output",
"description": "As a developer, I need colored output so verification results are clear.",
"acceptanceCriteria": [
"Add colored or termcolor dependency",
"On success: print green \u2713 with message",
"On failure: print red \u2717 with error",
"Show signer DID (truncated for readability)",
"Typecheck passes"
],
"priority": 26,
"passes": false,
"notes": ""
},
{
"id": "US-003E",
"title": "Add local identity indicator",
"description": "As a developer, I need local identity detection so users know if they signed it.",
"acceptanceCriteria": [
"After successful verification, check if DID matches local identity",
"If match, print 'Local Identity' indicator",
"If no match, print 'External Identity'",
"Handle missing local identity gracefully",
"Typecheck passes"
],
"priority": 27,
"passes": false,
"notes": ""
},
{
"id": "US-003F",
"title": "Add tamper detection test",
"description": "As a developer, I need tamper test so verification catches modifications.",
"acceptanceCriteria": [
"Create test that signs a file",
"Modify one byte of the file",
"Verify signature fails",
"Verify error message indicates hash mismatch",
"Test passes",
"Typecheck passes"
],
"priority": 28,
"passes": false,
"notes": ""
},
{
"id": "US-004A",
"title": "Define manifest data structure",
"description": "As a developer, I need manifest types so contributions can be aggregated.",
"acceptanceCriteria": [
"Add ContributionManifest struct to types.rs",
"Fields: did, timestamp, artifacts (array of artifact references)",
"ArtifactReference includes: hash, signature, metadata, timestamp",
"Manifest itself is a SignatureEnvelopeV1 wrapper",
"Typecheck passes"
],
"priority": 29,
"passes": false,
"notes": ""
},
{
"id": "US-004B",
"title": "Implement manifest export logic",
"description": "As a developer, I need manifest export so contributions are portable.",
"acceptanceCriteria": [
"Create crates/openclaw-crypto/src/manifest.rs",
"Implement export_manifest(did, artifact_refs, timestamp) -> Result<SignatureEnvelopeV1>",
"Construct manifest with all artifact references",
"Sign manifest itself as an envelope",
"Return signed manifest envelope",
"Typecheck passes"
],
"priority": 30,
"passes": false,
"notes": ""
},
{
"id": "US-004C",
"title": "Implement manifest export command",
"description": "As a developer, I need manifest command wired so users can export.",
"acceptanceCriteria": [
"Add ManifestCmd struct with optional --output path",
"Load identity",
"Scan ~/.openclaw/signatures/ for .sig.json files (or ask user for paths)",
"Collect artifact references",
"Call export_manifest",
"Write to manifest.json or custom path",
"Print success message",
"Typecheck passes"
],
"priority": 31,
"passes": false,
"notes": ""
},
{
"id": "US-005A",
"title": "Create artifacts database table",
"description": "As a developer, I need artifacts table so signed artifacts can be stored.",
"acceptanceCriteria": [
"Create migration for artifacts table",
"Fields: id (UUID PK), hash (SHA-256 hex), did, timestamp, metadata (JSONB), signature, created_at",
"Add index on hash",
"Add index on did",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 32,
"passes": false,
"notes": ""
},
{
"id": "US-005B",
"title": "Implement artifact registration endpoint",
"description": "As a developer, I need POST /api/v1/artifacts so artifacts can be registered.",
"acceptanceCriteria": [
"Create route POST /api/v1/artifacts",
"Accept SignatureEnvelopeV1 in request body",
"Verify signature before storing",
"Extract hash, did, timestamp, metadata from envelope",
"Generate UUID for artifact",
"Insert into artifacts table",
"Return artifact ID and URL",
"Typecheck passes"
],
"priority": 33,
"passes": false,
"notes": ""
},
{
"id": "US-005C",
"title": "Add artifact registration validation",
"description": "As a developer, I need validation so invalid artifacts are rejected.",
"acceptanceCriteria": [
"Verify envelope signature cryptographically",
"Check for duplicate hashes (optionally allow)",
"Validate metadata JSON structure",
"Reject oversized metadata (> 10KB)",
"Return 400 with error details on failure",
"Typecheck passes"
],
"priority": 34,
"passes": false,
"notes": ""
},
{
"id": "US-006A",
"title": "Create artifact_derivations table",
"description": "As a developer, I need derivations table so attribution can be tracked.",
"acceptanceCriteria": [
"Create migration for artifact_derivations table",
"Fields: id, artifact_id (FK), derived_from_id (FK), created_at",
"Add foreign key constraints",
"Add unique constraint on (artifact_id, derived_from_id)",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 35,
"passes": false,
"notes": ""
},
{
"id": "US-006B",
"title": "Implement derivation declaration logic",
"description": "As a developer, I need derivation recording so attribution flows.",
"acceptanceCriteria": [
"When registering artifact, check metadata.derivedFrom field",
"If present, validate all referenced artifact IDs exist",
"Insert rows into artifact_derivations for each parent",
"Detect and reject cycles in derivation graph",
"Return error if parent artifact not found",
"Typecheck passes"
],
"priority": 36,
"passes": false,
"notes": ""
},
{
"id": "US-006C",
"title": "Add cycle detection for derivation graph",
"description": "As a developer, I need cycle prevention so graph stays acyclic.",
"acceptanceCriteria": [
"Implement detect_cycle(artifact_id, parent_id) -> bool",
"Use depth-first search to check if parent_id already derives from artifact_id",
"Limit search depth to 100 to prevent DoS",
"Return true if cycle detected",
"Add test for cycle detection",
"Typecheck passes"
],
"priority": 37,
"passes": false,
"notes": ""
},
{
"id": "US-007A",
"title": "Implement attribution graph query endpoint",
"description": "As a developer, I need GET /api/v1/artifacts/{id}/attribution so derivations are queryable.",
"acceptanceCriteria": [
"Create route GET /api/v1/artifacts/{id}/attribution",
"Accept depth query param (default 1, max 10)",
"Traverse artifact_derivations recursively",
"Return list of parent artifacts with DID, timestamp, metadata",
"Include depth level in response",
"Typecheck passes"
],
"priority": 38,
"passes": false,
"notes": ""
},
{
"id": "US-007B",
"title": "Add attribution graph result formatting",
"description": "As a developer, I need formatted response so attribution is readable.",
"acceptanceCriteria": [
"Response includes: artifact_id, did, timestamp, contribution description from metadata",
"Group by depth level",
"Order by timestamp (newest first)",
"Limit results per depth level to 100",
"Return JSON array",
"Typecheck passes"
],
"priority": 39,
"passes": false,
"notes": ""
},
{
"id": "US-008A",
"title": "Create did_bindings table",
"description": "As a developer, I need did_bindings table so DIDs can link to accounts.",
"acceptanceCriteria": [
"Create migration for did_bindings table",
"Fields: id, user_id (FK), did, created_at, revoked_at (nullable)",
"Add index on user_id",
"Add index on did",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 40,
"passes": false,
"notes": ""
},
{
"id": "US-008B",
"title": "Create did_challenges table",
"description": "As a developer, I need challenges table so binding is secure.",
"acceptanceCriteria": [
"Create migration for did_challenges table",
"Fields: id, user_id (FK), challenge (text), expires_at, used_at (nullable), created_at",
"Add index on challenge",
"Add index on expires_at",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 41,
"passes": false,
"notes": ""
},
{
"id": "US-008C",
"title": "Implement challenge generation endpoint",
"description": "As a developer, I need POST /api/v1/identity/challenge so binding can start.",
"acceptanceCriteria": [
"Create route POST /api/v1/identity/challenge",
"Require authentication",
"Generate random 32-byte challenge",
"Encode as hex or base64",
"Set expiry to 10 minutes from now",
"Insert into did_challenges table",
"Return challenge and expiresAt",
"Typecheck passes"
],
"priority": 42,
"passes": false,
"notes": ""
},
{
"id": "US-008D",
"title": "Implement DID binding endpoint",
"description": "As a developer, I need POST /api/v1/identity/bind so DIDs can be linked.",
"acceptanceCriteria": [
"Create route POST /api/v1/identity/bind",
"Require authentication",
"Accept did, challenge, challengeSignature in body",
"Load challenge from database",
"Verify challenge not expired or used",
"Extract public key from DID",
"Verify signature over challenge bytes",
"Insert into did_bindings table",
"Mark challenge as used",
"Return success with DID",
"Typecheck passes"
],
"priority": 43,
"passes": false,
"notes": ""
},
{
"id": "US-008E",
"title": "Add rate limiting for challenge endpoint",
"description": "As a developer, I need rate limiting so challenges can't be spammed.",
"acceptanceCriteria": [
"Add rate limit middleware: 5 challenges per user per hour",
"Return 429 Too Many Requests if exceeded",
"Include Retry-After header",
"Typecheck passes"
],
"priority": 44,
"passes": false,
"notes": ""
},
{
"id": "US-008F",
"title": "Add rate limiting for bind endpoint",
"description": "As a developer, I need rate limiting so bind attempts are limited.",
"acceptanceCriteria": [
"Add rate limit: 3 bind attempts per challenge",
"Lock challenge after 3 failed attempts",
"Return 429 with error message",
"Typecheck passes"
],
"priority": 45,
"passes": false,
"notes": ""
},
{
"id": "US-008G",
"title": "Add integration test for DID binding flow",
"description": "As a developer, I need binding test so flow works end-to-end.",
"acceptanceCriteria": [
"Test creates user account",
"Test requests challenge",
"Test signs challenge with OpenClaw",
"Test submits bind request",
"Test verifies DID stored in database",
"Test passes",
"Typecheck passes"
],
"priority": 46,
"passes": false,
"notes": ""
},
{
"id": "US-009A",
"title": "Add DID field to user profile query",
"description": "As a developer, I need DID in profile data so UI can display it.",
"acceptanceCriteria": [
"Update profile query to join did_bindings",
"Return array of bound DIDs with created_at",
"Filter out revoked bindings",
"Order by created_at (newest first)",
"Typecheck passes"
],
"priority": 47,
"passes": false,
"notes": ""
},
{
"id": "US-009B",
"title": "Implement DID display component",
"description": "As a developer, I need DID component so profiles show identities.",
"acceptanceCriteria": [
"Create IdentityBadge component",
"Display did:key:z6Mk... with middle truncated (e.g., did:key:z6Mk...Wp)",
"Show full DID on hover (tooltip)",
"Click to copy full DID to clipboard",
"Show binding timestamp",
"Typecheck passes"
],
"priority": 48,
"passes": false,
"notes": ""
},
{
"id": "US-009C",
"title": "Add DID badge to profile page",
"description": "As a developer, I need badge on profile so users see identities.",
"acceptanceCriteria": [
"Add IdentityBadge to profile page layout",
"Show all bound DIDs (max 5, then expand)",
"Display 'No identity bound' if empty",
"Include 'Bind DID' button linking to instructions",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 49,
"passes": false,
"notes": ""
},
{
"id": "US-010A",
"title": "Add signature fields to posts table",
"description": "As a developer, I need signature storage so posts can be verified.",
"acceptanceCriteria": [
"Create migration to add signature_envelope_json (JSONB nullable)",
"Add verified_did (text nullable)",
"Add verification_status enum: none, invalid, valid_unbound, valid_bound",
"Add index on verification_status",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 50,
"passes": false,
"notes": ""
},
{
"id": "US-010B",
"title": "Implement post signature verification logic",
"description": "As a developer, I need verification logic so signed posts are validated.",
"acceptanceCriteria": [
"Implement verify_post_signature(post_body, envelope, user_id) -> VerificationResult",
"Recompute SHA-256 hash of post body (UTF-8 bytes)",
"Verify hash matches envelope.hash.value",
"Extract DID from envelope and verify signature",
"Check if DID is bound to user_id",
"Return status: valid_bound, valid_unbound, or invalid",
"Add test for verification logic",
"Typecheck passes"
],
"priority": 51,
"passes": false,
"notes": ""
},
{
"id": "US-010C",
"title": "Update post creation endpoint to accept signatures",
"description": "As a developer, I need signature support in POST /api/v1/posts.",
"acceptanceCriteria": [
"Accept optional signatureEnvelope field in request body",
"If present, call verify_post_signature",
"Store envelope JSON, verified_did, and verification_status",
"If not present, set status to none",
"Return post with verification status",
"Typecheck passes"
],
"priority": 52,
"passes": false,
"notes": ""
},
{
"id": "US-011A",
"title": "Create VerifiedBadge component",
"description": "As a developer, I need badge component so verified posts are marked.",
"acceptanceCriteria": [
"Create VerifiedBadge component",
"Show green \u2713 icon for valid_bound status",
"Show 'Signed' text (no checkmark) for valid_unbound",
"Show nothing for none or invalid status",
"Add hover tooltip with signer DID",
"Typecheck passes"
],
"priority": 53,
"passes": false,
"notes": ""
},
{
"id": "US-011B",
"title": "Add badge to post card component",
"description": "As a developer, I need badge in post UI so users see verification.",
"acceptanceCriteria": [
"Add VerifiedBadge to PostCard component",
"Position badge next to author name or timestamp",
"Pass verification_status and verified_did as props",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 54,
"passes": false,
"notes": ""
},
{
"id": "US-011C",
"title": "Implement signature envelope modal",
"description": "As a developer, I need envelope viewer so signatures are auditable.",
"acceptanceCriteria": [
"Create SignatureModal component",
"Display full envelope JSON with syntax highlighting",
"Show DID, hash, timestamp, signature fields",
"Include 'Copy JSON' button",
"Open modal when clicking VerifiedBadge",
"Typecheck passes",
"Verify in browser using dev-browser skill"
],
"priority": 55,
"passes": false,
"notes": ""
},
{
"id": "US-012A",
"title": "Create m_credits_accounts table",
"description": "As a developer, I need accounts table so balances can be tracked.",
"acceptanceCriteria": [
"Create migration for m_credits_accounts table",
"Fields: id, did (unique), balance (numeric 20,8), promo_balance (numeric 20,8), created_at, updated_at",
"Add index on did",
"Default balances to 0.00000000",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 56,
"passes": false,
"notes": ""
},
{
"id": "US-012B",
"title": "Create m_credits_ledger table for event sourcing",
"description": "As a developer, I need ledger table so all transactions are immutable.",
"acceptanceCriteria": [
"Create migration for m_credits_ledger table",
"Fields: id (UUID PK), event_type (enum: mint, burn, transfer, hold, release), from_did, to_did, amount, metadata (JSONB), created_at",
"Add index on event_type",
"Add index on from_did",
"Add index on to_did",
"Add index on created_at",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 57,
"passes": false,
"notes": ""
},
{
"id": "US-012C",
"title": "Create purchase invoices table",
"description": "As a developer, I need invoices table so purchases are tracked.",
"acceptanceCriteria": [
"Create migration for purchase_invoices table",
"Fields: id, user_id (FK), amount_usd, amount_credits, payment_provider (stripe, usdc, etc.), external_ref, status (pending, completed, failed), created_at",
"Add index on user_id",
"Add index on status",
"Migration runs successfully",
"Typecheck passes"
],
"priority": 58,
"passes": false,
"notes": ""
},
{
"id": "US-012D",
"title": "Implement credit purchase endpoint",
"description": "As a developer, I need POST /api/v1/credits/purchase so credits can be bought.",
"acceptanceCriteria": [
"Create route POST /api/v1/credits/purchase",
"Require authentication",
"Accept amount_usd in request body",
"Create invoice record with status=pending",
"Integrate with Stripe checkout (or placeholder for now)",
"Return invoice ID and payment URL",
"Typecheck passes"
],
"priority": 59,
"passes": false,
"notes": ""
},
{
"id": "US-012E",
"title": "Implement credit minting on payment confirmation",
"description": "As a developer, I need mint logic so credits are created when paid.",
"acceptanceCriteria": [
"Implement handle_payment_webhook for payment provider",
"Verify payment signature/authenticity",
"Load invoice and check status=pending",
"Calculate credits: amount_credits = amount_usd / credit_rate",
"Insert mint event into m_credits_ledger",
"Update m_credits_accounts balance atomically",
"Update invoice status=completed",
"Include external payment reference in ledger metadata",
"Typecheck passes"
],
"priority": 60,
"passes": false,
"notes": ""
},
{
"id": "US-012F",