Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add json schemas for vc and did data models #127

Merged
merged 6 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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#",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah DHT is not supporting this since we don't have a dht resolver yet

decentralized-identity/did-dht#18

"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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this did-document.json?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

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": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the formatting off here?

Copy link
Contributor

@nitro-neal nitro-neal Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont have credentialSchema in js currently, but its not required so a todo for now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem - this should lead the impls

"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" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be our default when creating, but we will accept creds that are
{ id: 123, name: myname} right?

currently if we get a jwt, we use what is in the iss for buildling the vc and adding the issuer

so if we get

iss: abc

vcDataModel.issuer: { id: abc, name: myname}

we will blast it and make vcDataModel.issuer: abc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

{
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" }
},
"required": ["id"]
}
]
},
"issuanceDate": {
"type": "string",
"format": "date-time"
},
"expirationDate": {
"type": "string",
"format": "date-time"
},
"credentialSubject": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

It may have an id, will we accept an external vc without and id?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could certainly accept creds without em but we shouldn't produce creds without ids

"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"]
}