Skip to content

Commit d5beea5

Browse files
docs: add signature documentation to README
1 parent 7c5abd4 commit d5beea5

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ CERTIFIED ─ shared lexicons (certified.app)
4444
actor/profile (user profile)
4545
actor/organization (org metadata)
4646
badge/definition ──► badge/award ──► badge/response
47+
signature/inline (embedded cryptographic signature)
48+
signature/list (container for signatures array)
49+
signature/proof (remote attestation proof record)
4750
```
4851

4952
Every arrow (``) is a `strongRef` or union reference stored on the
@@ -148,6 +151,16 @@ await agent.api.com.atproto.repo.createRecord({
148151
| **Badge Award** | `app.certified.badge.award` | Awards a badge to a user, project, or activity. |
149152
| **Badge Response** | `app.certified.badge.response` | Recipient accepts or rejects a badge award. |
150153

154+
### Signatures (`app.certified.signature.*`)
155+
156+
| Lexicon | NSID | Description |
157+
| -------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
158+
| **Inline Signature** | `app.certified.signature.inline` | An inline cryptographic signature for attesting to record content. Uses JOSE algorithm identifiers (ES256, ES256K, Ed25519). |
159+
| **Signature List** | `app.certified.signature.list` | Container object with a `signatures` array. Referenced by all record lexicons via `signatureData` property. |
160+
| **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. |
161+
162+
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+
151164
> **Full property tables**[SCHEMAS.md](SCHEMAS.md)
152165
153166
## Entity Relationship Diagram
@@ -367,6 +380,73 @@ const attachment = {
367380
};
368381
```
369382

383+
### Cryptographic Signatures
384+
385+
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+
387+
Signatures support two patterns:
388+
389+
1. **Inline signatures**: Embedded directly in the record
390+
2. **Remote attestations**: References to proof records in other repositories (via `strongRef`)
391+
392+
```typescript
393+
import { ACTIVITY_NSID } from "@hypercerts-org/lexicon";
394+
395+
// Activity with inline signature
396+
const signedActivity = {
397+
$type: ACTIVITY_NSID,
398+
title: "Verified Reforestation Project",
399+
shortDescription: "Planted 1,000 trees in partnership with local community",
400+
createdAt: new Date().toISOString(),
401+
signatureData: {
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+
],
419+
},
420+
};
421+
```
422+
423+
#### Signature Algorithm Identifiers
424+
425+
The `signatureType` property uses [JOSE algorithm identifiers](https://www.iana.org/assignments/jose/jose.xhtml):
426+
427+
| Value | Curve | Description |
428+
| --------- | --------- | --------------------------------------- |
429+
| `ES256` | P-256 | NIST curve, WebCrypto compatible |
430+
| `ES256K` | secp256k1 | Ethereum/Bitcoin curve, ATProto default |
431+
| `Ed25519` | Ed25519 | EdDSA, increasingly popular |
432+
433+
#### Remote Attestation Proofs
434+
435+
For remote attestations, create a proof record in the attestor's repository:
436+
437+
```typescript
438+
import { SIGNATURE_PROOF_NSID } from "@hypercerts-org/lexicon";
439+
440+
const proof = {
441+
$type: SIGNATURE_PROOF_NSID,
442+
cid: "bafy...", // CID of the attested content
443+
note: "Verified by platform quality assurance process",
444+
createdAt: new Date().toISOString(),
445+
};
446+
```
447+
448+
For the full specification, see Nick Gerakines' [ATProtocol Attestation Specification](https://ngerakines.leaflet.pub/3m3idxul5hc2r).
449+
370450
## Development
371451

372452
### Commands

0 commit comments

Comments
 (0)