Skip to content

Commit 5e45b78

Browse files
committed
refactor: flatten signatures array directly onto records
Replace the signatureData wrapper object with a direct signatures property on all record lexicons. app.certified.signature.list is now a reusable array type (not an object), so records have flat access at record.signatures[] instead of record.signatureData.signatures[]. This matches the ATProtocol Attestation Specification structure and eliminates unnecessary nesting while keeping the array definition DRY via a single shared lexicon ref.
1 parent 4a5e234 commit 5e45b78

26 files changed

Lines changed: 145 additions & 183 deletions

.changeset/fuzzy-pandas-smile.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ Adds optional cryptographic signature support to all record lexicons, enabling p
99
**New lexicons:**
1010

1111
- `app.certified.signature.inline` - Inline cryptographic signature object with JOSE algorithm identifiers (ES256, ES256K, Ed25519)
12-
- `app.certified.signature.list` - Container object with `signatures` array supporting both inline signatures and remote attestation references
12+
- `app.certified.signature.list` - Reusable array type (union of inline signatures and strongRefs to remote proofs)
1313
- `app.certified.signature.proof` - Remote attestation proof record containing the CID of attested content
1414

1515
**Changes to existing lexicons:**
1616

17-
All 20 record lexicons now include an optional `signatureData` property that references `app.certified.signature.list`:
17+
All 20 record lexicons now include an optional `signatures` property (a ref to `app.certified.signature.list`) placed directly on the record with no wrapper object:
1818

1919
- `org.hypercerts.claim.activity`
2020
- `org.hypercerts.claim.contribution`

ERD.puml

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,6 @@ dataclass signatureInline {
238238
!endif
239239
}
240240

241-
' app.certified.signature.list
242-
dataclass signatureList {
243-
!if (SHOW_FIELDS == "true")
244-
signatures[]?
245-
!endif
246-
}
247-
248241
' app.certified.signature.proof
249242
dataclass signatureProof {
250243
!if (SHOW_FIELDS == "true")
@@ -426,26 +419,12 @@ badgeAward::subject --> activity
426419
'badgeAward::subject --[norank]-> collection
427420

428421
' Signature relationships
429-
signatureList::signatures --> signatureInline
430-
signatureList::signatures --> signatureProof : "strongRef"
431-
432-
' signatureData relationships (all record lexicons reference signatureList)
433-
activity ..> signatureList : signatureData
434-
collection ..> signatureList : signatureData
435-
attachment ..> signatureList : signatureData
436-
measurement ..> signatureList : signatureData
437-
evaluation ..> signatureList : signatureData
438-
acknowledgement ..> signatureList : signatureData
439-
contribution ..> signatureList : signatureData
440-
contributorInformation ..> signatureList : signatureData
441-
rights ..> signatureList : signatureData
442-
fundingReceipt ..> signatureList : signatureData
443-
workScopeTag ..> signatureList : signatureData
444-
location ..> signatureList : signatureData
445-
badgeDefinition ..> signatureList : signatureData
446-
badgeAward ..> signatureList : signatureData
447-
badgeResponse ..> signatureList : signatureData
448-
organization ..> signatureList : signatureData
449-
linkEvm ..> signatureList : signatureData
422+
' All record lexicons have an optional `signatures` array (ref to
423+
' app.certified.signature.list) containing a union of signatureInline
424+
' objects and strongRefs to signatureProof records. Only activity is
425+
' shown here to avoid cluttering the diagram; the pattern is identical
426+
' for all record lexicons.
427+
activity ..> signatureInline : signatures
428+
activity ..> signatureProof : "signatures (strongRef)"
450429

451430
@enduml

README.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CERTIFIED ─ shared lexicons (certified.app)
4545
actor/organization (org metadata)
4646
badge/definition ──► badge/award ──► badge/response
4747
signature/inline (embedded cryptographic signature)
48-
signature/list (container for signatures array)
48+
signature/list (reusable signatures array type)
4949
signature/proof (remote attestation proof record)
5050
```
5151

@@ -157,10 +157,10 @@ await agent.api.com.atproto.repo.createRecord({
157157
| Lexicon | NSID | Description |
158158
| -------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
159159
| **Inline Signature** | `app.certified.signature.inline` | An inline cryptographic signature for attesting to record content. Uses JOSE algorithm identifiers (ES256, ES256K, Ed25519). |
160-
| **Signature List** | `app.certified.signature.list` | Container object with a `signatures` array. Referenced by all record lexicons via `signatureData` property. |
160+
| **Signature List** | `app.certified.signature.list` | Reusable array type (union of inline signatures and strongRefs). Referenced by all record lexicons via the `signatures` property. |
161161
| **Proof** | `app.certified.signature.proof` | Remote attestation proof record containing the CID of attested content. Lives in the attestor's repository and can be referenced via strongRef. |
162162

163-
All record lexicons include an optional `signatureData` property that references `app.certified.signature.list`, enabling cryptographic attestations. See [Cryptographic Signatures](#cryptographic-signatures) for usage details.
163+
All record lexicons include an optional `signatures` property (a ref to `app.certified.signature.list`) enabling cryptographic attestations. See [Cryptographic Signatures](#cryptographic-signatures) for usage details.
164164

165165
> **Full property tables**[SCHEMAS.md](SCHEMAS.md)
166166
@@ -383,7 +383,7 @@ const attachment = {
383383

384384
### Cryptographic Signatures
385385

386-
All record lexicons support optional cryptographic signatures via the `signatureData` property. This enables platform attestation and verification that records were created through trusted services.
386+
All record lexicons support optional cryptographic signatures via the `signatures` property. This enables platform attestation and verification that records were created through trusted services.
387387

388388
Signatures support two patterns:
389389

@@ -399,25 +399,23 @@ const signedActivity = {
399399
title: "Verified Reforestation Project",
400400
shortDescription: "Planted 1,000 trees in partnership with local community",
401401
createdAt: new Date().toISOString(),
402-
signatureData: {
403-
signatures: [
404-
// Inline signature (embedded)
405-
{
406-
$type: "app.certified.signature.inline",
407-
signatureType: "ES256K", // JOSE algorithm: secp256k1
408-
signature: new Uint8Array([
409-
/* signature bytes */
410-
]),
411-
key: "did:plc:platform123#signing", // DID verification method
412-
},
413-
// Remote attestation (reference to proof in another repo)
414-
{
415-
$type: "com.atproto.repo.strongRef",
416-
uri: "at://did:plc:verifier/app.certified.signature.proof/abc123",
417-
cid: "bafy...",
418-
},
419-
],
420-
},
402+
signatures: [
403+
// Inline signature (embedded)
404+
{
405+
$type: "app.certified.signature.inline",
406+
signatureType: "ES256K", // JOSE algorithm: secp256k1
407+
signature: new Uint8Array([
408+
/* signature bytes */
409+
]),
410+
key: "did:plc:platform123#signing", // DID verification method
411+
},
412+
// Remote attestation (reference to proof in another repo)
413+
{
414+
$type: "com.atproto.repo.strongRef",
415+
uri: "at://did:plc:verifier/app.certified.signature.proof/abc123",
416+
cid: "bafy...",
417+
},
418+
],
421419
};
422420
```
423421

0 commit comments

Comments
 (0)