Skip to content

Commit a8b7f17

Browse files
holkexyzaspiers
authored andcommitted
adding badges
1 parent cfe1821 commit a8b7f17

File tree

9 files changed

+207
-2
lines changed

9 files changed

+207
-2
lines changed

ERD-with-fields.png

22.8 KB
Loading

ERD-with-fields.svg

Lines changed: 1 addition & 1 deletion
Loading

ERD.png

9.72 KB
Loading

ERD.puml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,36 @@ dataclass location {
136136
!endif
137137
}
138138

139+
' Certified badges (data class + issuance + response)
140+
dataclass badgeDefinition {
141+
!if (SHOW_FIELDS == "true")
142+
badgeType
143+
title
144+
icon
145+
description?
146+
allowedIssuers[]?
147+
createdAt
148+
!endif
149+
}
150+
151+
dataclass badgeIssued {
152+
!if (SHOW_FIELDS == "true")
153+
badgeDefinition
154+
subject
155+
note?
156+
createdAt
157+
!endif
158+
}
159+
160+
dataclass badgeResponse {
161+
!if (SHOW_FIELDS == "true")
162+
badgeIssued
163+
response
164+
weight?
165+
createdAt
166+
!endif
167+
}
168+
139169
' org.hypercerts.claim.rights
140170
dataclass rights {
141171
!if (SHOW_FIELDS == "true")
@@ -293,4 +323,9 @@ fundingReceipt::to --> contributor
293323

294324
fundingReceipt::for --> activity : funds
295325

326+
badgeIssued --> badgeDefinition
327+
badgeResponse --> badgeIssued
328+
badgeIssued --> contributor : may target (DID)
329+
badgeIssued --> activity : may target (record)
330+
296331
@enduml

ERD.svg

Lines changed: 1 addition & 1 deletion
Loading

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,53 @@ Certified lexicons are common/shared lexicons that can be used across multiple p
109109
| `name` | `string` || Optional name for this location | |
110110
| `description` | `string` || Optional description for this location | |
111111
| `createdAt` | `string` || Client-declared timestamp when this record was originally created | |
112+
113+
### Badges Lexicon
114+
115+
**Lexicon IDs:** `app.certified.badge.definition`, `app.certified.badge.issue`, `app.certified.badge.response`
116+
117+
**Description:** Defines badge metadata, issuance records, and recipient responses for certified badges that can be used across protocols.
118+
119+
#### Badge Definition
120+
121+
**Lexicon ID:** `app.certified.badge.definition`
122+
123+
**Key:** `tid`
124+
125+
| Property | Type | Required | Description |
126+
| --------------- | ------- | -------- | ----------- |
127+
| `badgeType` | `string`|| Category of the badge (e.g., endorsement, participation, affiliation). |
128+
| `title` | `string`|| Human-readable title of the badge. |
129+
| `icon` | `blob` || Icon representing the badge (accepted `image/*` types, maxSize 1MB). |
130+
| `description` | `string`|| Optional short statement describing the badge. |
131+
| `allowedIssuers`| `array` || Optional allowlist of DIDs allowed to issue this badge. |
132+
| `createdAt` | `string`|| Client-declared timestamp when this record was originally created. |
133+
134+
#### Badge Issue
135+
136+
**Lexicon ID:** `app.certified.badge.issue`
137+
138+
**Key:** `tid`
139+
140+
| Property | Type | Required | Description |
141+
| ---------- | ------ | -------- | ----------- |
142+
| `badge` | `ref` || Reference to the badge definition being issued (`app.certified.badge.definition`). |
143+
| `subject` | `union` || Entity the badge is issued to (either a DID or a specific AT Protocol record). |
144+
| `note` | `string` || Optional explanation for the issuance. |
145+
| `createdAt`| `string` || Client-declared timestamp when this record was originally created. |
146+
147+
#### Badge Response
148+
149+
**Lexicon ID:** `app.certified.badge.response`
150+
151+
**Key:** `tid`
152+
153+
| Property | Type | Required | Description |
154+
| ------------- | -------- | -------- | ----------- |
155+
| `badgeIssued` | `ref` || Reference to the issued badge (`app.certified.badge.issue`). |
156+
| `response` | `string` || Enum: `accepted` or `rejected`. |
157+
| `weight` | `string` || Optional relative weight assigned by the recipient (stored as string). |
158+
| `createdAt` | `string` || Client-declared timestamp when this record was originally created. |
112159

113160
---
114161

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"lexicon": 1,
3+
"id": "app.certified.badge.definition",
4+
"defs": {
5+
"main": {
6+
"type": "record",
7+
"description": "Defines a badge that can be issued for instance to users, projects, or activity claims.",
8+
"key": "tid",
9+
"record": {
10+
"type": "object",
11+
"required": ["title", "badgeType", "icon", "createdAt"],
12+
"properties": {
13+
"badgeType": {
14+
"type": "string",
15+
"description": "Category of the badge (e.g. endorsement, participation, affiliation)."
16+
},
17+
"title": {
18+
"type": "string",
19+
"description": "Human-readable title of the badge."
20+
},
21+
"icon": {
22+
"type": "blob",
23+
"description": "Icon representing the badge, stored as a blob for compact visual display.",
24+
"accept": ["image/png", "image/jpeg", "image/webp", "image/svg+xml"],
25+
"maxSize": 1048576
26+
},
27+
"description": {
28+
"type": "string",
29+
"description": "Optional short statement describing what the badge represents."
30+
},
31+
"allowedIssuers": {
32+
"type": "array",
33+
"description": "Optional allowlist of DIDs allowed to issue this badge. If omitted, anyone may issue it.",
34+
"items": {
35+
"type": "string",
36+
"format": "did"
37+
}
38+
},
39+
"createdAt": {
40+
"type": "string",
41+
"format": "datetime",
42+
"description": "Client-declared timestamp when this record was originally created"
43+
}
44+
}
45+
}
46+
}
47+
}
48+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"lexicon": 1,
3+
"id": "app.certified.badge.issue",
4+
"defs": {
5+
"main": {
6+
"type": "record",
7+
"description": "Issues a badge for instance to a user, project, or activity claim.",
8+
"key": "tid",
9+
"record": {
10+
"type": "object",
11+
"required": ["badge", "subject", "createdAt"],
12+
"properties": {
13+
"badge": {
14+
"type": "ref",
15+
"ref": "app.certified.badge.definition",
16+
"description": "Reference to the badge definition being issued."
17+
},
18+
"subject": {
19+
"type": "union",
20+
"description": "Entity the badge is issued to (either an account DID or any specific AT Protocol record), e.g. a user, a project, or a specific activity claim.",
21+
"refs": [
22+
"did",
23+
"com.atproto.repo.strongRef"
24+
]
25+
},
26+
"note": {
27+
"type": "string",
28+
"description": "Optional statement explaining why the badge was issued."
29+
},
30+
"createdAt": {
31+
"type": "string",
32+
"format": "datetime",
33+
"description": "Client-declared timestamp when this record was originally created"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"lexicon": 1,
3+
"id": "app.certified.badge.response",
4+
"defs": {
5+
"main": {
6+
"type": "record",
7+
"description": "Recipient response to a badge issuance.",
8+
"key": "tid",
9+
"record": {
10+
"type": "object",
11+
"required": ["badgeIssued", "response", "createdAt"],
12+
"properties": {
13+
"badgeIssued": {
14+
"type": "ref",
15+
"ref": "app.certified.badge.issue",
16+
"description": "Reference to the issued badge."
17+
},
18+
"response": {
19+
"type": "string",
20+
"enum": ["accepted", "rejected"],
21+
"description": "The recipient’s response for the badge (accepted or rejected)."
22+
},
23+
"weight": {
24+
"type": "string",
25+
"description": "Optional relative weight for accepted badges, assigned by the recipient."
26+
},
27+
"createdAt": {
28+
"type": "string",
29+
"format": "datetime",
30+
"description": "Client-declared timestamp when this record was originally created"
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)