forked from hashgraph/did-method
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhedera-did-document.schema.json
More file actions
194 lines (194 loc) · 6.46 KB
/
Copy pathhedera-did-document.schema.json
File metadata and controls
194 lines (194 loc) · 6.46 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
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schemas/hedera-did-document.schema.json",
"title": "Hedera DID Method DID Document",
"description": "Defines the structure for a DID Document conformant with the Hedera DID Method.",
"type": "object",
"properties": {
"@context": {
"description": "The JSON-LD context(s). MUST include DID Core v1, Multikey v1, and JWS 2020 contexts.",
"type": "array",
"items": { "type": "string", "format": "uri" },
"minItems": 3,
"contains": [
{"const": "https://www.w3.org/ns/did/v1"},
{"const": "https://w3id.org/security/multikey/v1"},
{"const": "https://w3id.org/security/suites/jws-2020/v1"}
]
},
"id": {
"description": "The Hedera DID.",
"type": "string",
"format": "uri",
"pattern": "^did:hedera:(mainnet|testnet):z[1-9A-HJ-NP-Za-km-z]{40,}_\\d+\\.\\d+\\.\\d+$"
},
"controller": {
"description": "The DID(s) controlling this DID document. MUST be on the same Hedera network as the 'id'.",
"$comment": "Same-network check requires application logic beyond JSON Schema.",
"oneOf": [
{
"description": "A single DID controller.",
"type": "string",
"format": "uri",
"pattern": "^did:hedera:(mainnet|testnet):z[1-9A-HJ-NP-Za-km-z]{40,}_\\d+\\.\\d+\\.\\d+$"
},
{
"description": "A set of DID controllers.",
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"format": "uri",
"pattern": "^did:hedera:(mainnet|testnet):z[1-9A-HJ-NP-Za-km-z]{40,}_\\d+\\.\\d+\\.\\d+$"
},
"uniqueItems": true
}
]
},
"verificationMethod": {
"description": "Verification methods associated with the DID.",
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/verificationMethod" }
},
"authentication": {
"description": "Verification methods suitable for authentication.",
"$ref": "#/$defs/verificationRelationshipSet"
},
"assertionMethod": {
"description": "Verification methods suitable for asserting claims.",
"$ref": "#/$defs/verificationRelationshipSet"
},
"keyAgreement": {
"description": "Verification methods suitable for key agreement.",
"$ref": "#/$defs/verificationRelationshipSet"
},
"capabilityInvocation": {
"description": "Verification methods suitable for invoking capabilities (e.g., managing this document).",
"$ref": "#/$defs/verificationRelationshipSet"
},
"capabilityDelegation": {
"description": "Verification methods suitable for delegating capabilities.",
"$ref": "#/$defs/verificationRelationshipSet"
},
"service": {
"description": "Service endpoints associated with the DID.",
"type": "array",
"items": { "$ref": "#/$defs/service" }
}
},
"required": [
"@context",
"id",
"controller",
"verificationMethod"
],
"additionalProperties": true,
"$defs": {
"verificationMethod": {
"description": "A verification method using Multikey or JsonWebKey2020 types.",
"type": "object",
"properties": {
"id": {
"description": "DID URL identifying this verification method.",
"type": "string",
"format": "uri",
"pattern": "^did:.+#.+$"
},
"type": {
"description": "The verification method type.",
"type": "string",
"enum": ["Multikey", "JsonWebKey2020"]
},
"controller": {
"description": "The DID controlling this specific verification method.",
"type": "string",
"format": "uri",
"pattern": "^did:hedera:(mainnet|testnet):z[1-9A-HJ-NP-Za-km-z]{40,}_\\d+\\.\\d+\\.\\d+$"
},
"publicKeyMultibase": {
"description": "Public key encoded in Multibase format (required if type is Multikey).",
"type": "string",
"pattern": "^z[1-9A-HJ-NP-Za-km-z]+$"
},
"publicKeyJwk": {
"description": "Public key encoded as a JSON Web Key (required if type is JsonWebKey2020).",
"type": "object"
}
},
"required": [
"id",
"type",
"controller"
],
"allOf": [
{
"if": { "properties": { "type": { "const": "Multikey" } } },
"then": { "required": ["publicKeyMultibase"] }
},
{
"if": { "properties": { "type": { "const": "JsonWebKey2020" } } },
"then": { "required": ["publicKeyJwk"] }
}
],
"additionalProperties": false
},
"verificationRelationshipReference": {
"description": "Reference to a verification method, either embedded or by ID.",
"oneOf": [
{
"description": "Reference by ID (DID URL string).",
"type": "string",
"format": "uri",
"pattern": "^did:.+#.+$"
},
{
"description": "Embedded verification method map.",
"$ref": "#/$defs/verificationMethod"
}
]
},
"verificationRelationshipSet": {
"description": "An array of verification method references.",
"type": "array",
"items": { "$ref": "#/$defs/verificationRelationshipReference" },
"uniqueItems": true
},
"service": {
"description": "Represents a service endpoint.",
"type": "object",
"properties": {
"id": {
"description": "DID URL identifying this service.",
"type": "string",
"format": "uri",
"pattern": "^did:.+#.+$"
},
"type": {
"description": "The type of the service.",
"oneOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
},
"serviceEndpoint": {
"description": "The service endpoint URL, map, or set.",
"oneOf": [
{ "type": "string", "format": "uri" },
{ "type": "object" },
{
"type": "array",
"items": { "oneOf": [ { "type": "string", "format": "uri" }, { "type": "object" } ] }
}
]
}
},
"required": [
"id",
"type",
"serviceEndpoint"
],
"additionalProperties": true
}
}
}