Skip to content

Commit

Permalink
add json schemas for vc and did data models (#127)
Browse files Browse the repository at this point in the history
* add json schemas

* format fix

---------

Co-authored-by: nitro-neal <[email protected]>
  • Loading branch information
decentralgabe and nitro-neal authored Mar 26, 2024
1 parent 77f2cbd commit efa968d
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Web5 Spec

This directory servers as a sub-resource for the [main spec](../README.md) to further define our usage of selected standards.

* [Decentralized Identifiers v1.0](did.md)
* [Verifiable Credentials v1.1](vc.md)
36 changes: 36 additions & 0 deletions spec/did-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "http://json-schema.org/draft-2020-12/schema#",
"type": "object",
"properties": {
"created": {
"type": "string",
"format": "date-time"
},
"updated": {
"type": "string",
"format": "date-time"
},
"deactivated": {
"type": "boolean"
},
"nextUpdate": {
"type": "string",
"format": "date-time"
},
"versionId": {
"type": "string"
},
"nextversionId": {
"type": "string"
},
"equivalentId": {
"type": "array",
"items": {
"type": "string",
}
},
"canonicalId": {
"type": "string"
}
}
}
15 changes: 15 additions & 0 deletions spec/did-resolution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-2020-12/schema#",
"definitions": {
"errorType": {
"type": "string",
"enum": ["invalidDid", "notFound", "representationNotSupported", "methodNotSupported", "invalidDidDocument", "invalidDidDocumentLength", "internalError"]
}
},
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/errorType"
}
}
}
121 changes: 121 additions & 0 deletions spec/did.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"$schema": "http://json-schema.org/draft-2020-12/schema#",
"definitions": {
"verificationMethod": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"controller": {
"type": "string"
},
"publicKeyJwk": {
"type": "object"
}
},
"required": ["id", "type", "controller", "publicKeyJwk"]
},
"service": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"serviceEndpoint": {
"type": "array",
"items": {
"type": "string"
}
},
"sig": {
"type": "array",
"items": {
"type": "string"
}
},
"enc": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["id", "type", "serviceEndpoint"]
}
},
"type": "object",
"properties": {
"id": {
"type": "string"
},
"@context": {
"type": "array",
"items": {
"type": "string"
}
},
"controller": {
"type": "array",
"items": {
"type": "string"
}
},
"alsoKnownAs": {
"type": "array",
"items": {
"type": "string"
}
},
"verificationMethod": {
"type": "array",
"items": {
"$ref": "#/definitions/verificationMethod"
},
"minItems": 1
},
"authentication": {
"type": "array",
"items": {
"type": "string"
}
},
"assertionMethod": {
"type": "array",
"items": {
"type": "string"
}
},
"keyAgreement": {
"type": "array",
"items": {
"type": "string"
}
},
"capabilityInvocation": {
"type": "array",
"items": {
"type": "string"
}
},
"capabilityDelegation": {
"type": "array",
"items": {
"type": "string"
}
},
"service": {
"type": "array",
"items": {
"$ref": "#/definitions/service"
}
}
},
"required": ["id", "verificationMethod"]
}
79 changes: 79 additions & 0 deletions spec/vc-11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"$schema": "http://json-schema.org/draft-2020-12/schema#",
"type": "object",
"definitions": {
"credentialStatus": {
"type": "object",
"properties": {
"id": { "type": "string" },
"type": { "type": "string" },
"statusPurpose": { "type": "string" },
"statusListIndex": { "type": "string" },
"statusListCredential": { "type": "string" }
},
"required": ["id", "type", "statusPurpose", "statusListIndex", "statusListCredential"]
},
"credentialSchema": {
"type": "object",
"properties": {
"id": { "type": "string" },
"type": { "type": "string" }
},
"required": ["id", "type"]
}
},
"properties": {
"@context": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"id": {
"type": "string"
},
"type": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"issuer": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" }
},
"required": ["id"]
}
]
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"expirationDate": {
"type": "string",
"format": "date-time"
},
"credentialSubject": {
"type": "object",
"properties": {
"id": { "type": "string" }
},
"required": ["id"]
},
"credentialStatus": { "$ref": "#/definitions/credentialStatus" },
"credentialSchema": { "$ref": "#/definitions/credentialSchema" },
"evidence": {
"type": "array",
"items": { "type": "object" }
}
},
"required": ["@context", "id", "type", "issuer", "issuanceDate", "credentialSubject"]
}
43 changes: 43 additions & 0 deletions spec/vp-11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-2020-12/schema#",
"type": "object",
"properties": {
"@context": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"id": {
"type": "string"
},
"type": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
},
"holder": {
"type": "string",
"format": "uri"
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"expirationDate": {
"type": "string",
"format": "date-time"
},
"verifiableCredential": {
"type": "array",
"items": {
"$ref": "vc-11.json"
},
"minItems": 1
}
},
"required": ["@context", "id", "type", "holder", "issuanceDate", "verifiableCredential"]
}

0 comments on commit efa968d

Please sign in to comment.