Skip to content

Commit

Permalink
Merge pull request #17 from jceb/feat/describe-json-data-model
Browse files Browse the repository at this point in the history
Describe json data model and add comparison table
  • Loading branch information
jceb authored Nov 26, 2024
2 parents 95af472 + fe07398 commit cb14268
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 17 deletions.
10 changes: 10 additions & 0 deletions generate-markdown-table-comparison.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env nu
let properties = open ./schemas/traits.json | $in.properties
ls methods/*.json | each {|file|
let method = open $file.name
let traits = { Method: $"[did:($method.name)]\(https://www.w3.org/TR/did-extensions-methods/#did-methods\)" }
# $traits | merge
($properties | columns | filter {$in != "name"} | each {|name|
{ trait: $"[($properties | get $name | get title)]\(#($name)\)", value: ($method | default false $name | get $name | if $in { "" } else { "" }) }
}) | reduce -f $traits {|it, acc| $acc | insert $it.trait $it.value }
} | to md
21 changes: 21 additions & 0 deletions methods/key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://identity.foundation/did-traits/schemas/traits.json",
"name": "key",
"updateable": false,
"updateable_service_endpoints": false,
"deactivatable": false,
"deletable": false,
"explicit_fees": false,
"self-certifying": true,
"updateable_verification_methods": false,
"pre-rotation_of_keys": false,
"multi-sig_verification_method": false,
"human-readable": false,
"resolvable_locally": false,
"resolvable_globally": true,
"history": false,
"history_signed": false,
"hosted_not": true,
"hosted_centrally": false,
"hosted_decentrally": false
}
21 changes: 21 additions & 0 deletions methods/peer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://identity.foundation/did-traits/schemas/traits.json",
"name": "peer",
"updateable": true,
"updateable_service_endpoints": true,
"deactivatable": false,
"deletable": false,
"explicit_fees": false,
"self-certifying": true,
"updateable_verification_methods": true,
"pre-rotation_of_keys": false,
"multi-sig_verification_method": false,
"human-readable": false,
"resolvable_locally": true,
"resolvable_globally": false,
"history": false,
"history_signed": false,
"hosted_not": true,
"hosted_centrally": false,
"hosted_decentrally": false
}
21 changes: 21 additions & 0 deletions methods/tdw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://identity.foundation/did-traits/schemas/traits.json",
"name": "tdw",
"updateable": true,
"updateable_service_endpoints": true,
"deactivatable": true,
"deletable": true,
"explicit_fees": false,
"self-certifying": true,
"updateable_verification_methods": true,
"pre-rotation_of_keys": true,
"multi-sig_verification_method": false,
"human-readable": false,
"resolvable_locally": false,
"resolvable_globally": true,
"history": true,
"history_signed": true,
"hosted_not": false,
"hosted_centrally": true,
"hosted_decentrally": false
}
21 changes: 21 additions & 0 deletions methods/web.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://identity.foundation/did-traits/schemas/traits.json",
"name": "web",
"updateable": true,
"updateable_service_endpoints": true,
"deactivatable": true,
"deletable": true,
"explicit_fees": false,
"self-certifying": false,
"updateable_verification_methods": true,
"pre-rotation_of_keys": false,
"multi-sig_verification_method": false,
"human-readable": true,
"resolvable_locally": false,
"resolvable_globally": true,
"history": false,
"history_signed": false,
"hosted_not": false,
"hosted_centrally": true,
"hosted_decentrally": false
}
80 changes: 63 additions & 17 deletions spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,72 @@ Generated with ../generate-markdown-table.nu

## JSON Schema Data Model

TODO
The specification defines a normative JSON Schema data model for documenting and representing DID method traits in a
machine-readable format. The canonical schema is formally defined at
<https://identity.foundation/did-traits/schemas/traits.json>.

DID method authors SHALL use this schema to describe their method's trait support. The schema is structured with two
primary components:

- A `name` property of type string identifying the specific DID method.
- Traits properties of type boolean.

All traits are represented as boolean values with the following semantics:

- `true` indicates explicit support for the corresponding trait
- `false` explicitly indicates non-support of the trait.
- Omission of a trait property is equivalent to `false`.

Conforming implementations MUST validate their trait documentation against this JSON Schema, ensuring consistent and
unambiguous representation of DID method capabilities.

### Example

This example demonstrates a complete JSON representation of the did:web DID method, illustrating the schema's structure.

<!--
See ../examples/web.json
-->

```json
{
"$schema": "https://identity.foundation/did-traits/schemas/traits.json",
"name": "web",
"modifiable": true,
"service_endpoints": true,
"deactivatable": true,
"deletable": true,
"fees": false,
"self-certifying": false,
"rotatable_keys": true,
"pre-rotatable_keys": false,
"modifiable_multi-sig": false,
"human-readable": true,
"resolvable_locally": false,
"resolvable_globally": true,
"history": false,
"history_signed": false,
"hosted_not": false,
"hosted_centrally": true,
"hosted_decentrally": false
}
```

## Comparison of DID Methods

INFO: this table is not a deliverable of this work item. It's merely an example of how a comparison table could look
like.

| Method \ Trait | [Deactivatable](#deactivatable) | [Enumerable](#enumerable) | [Globally resolvable](#globally) | [History available](#history) | [Immutable History](#immutable) | [Human-readable](#human-readable) | [Key Pre-Rotation](#pre-rotation) | [Modifiable](#modifiable) | [Self-Certification](#self-certification) | [Self-Creation](#self-creation) | [Explicit fees](#fees) |
| ----------------------------------------------------------------------------- | ------------------------------- | ------------------------- | -------------------------------- | ----------------------------- | ------------------------------- | --------------------------------- | --------------------------------- | ------------------------- | ----------------------------------------- | ------------------------------- | ---------------------- |
| [did:tdw](https://bcgov.github.io/trustdidweb/) | [`x`](#x) | | [`x`](#x) | [`x`](#x) | [`x`](#x) | | [`x`](#x) | [`x`](#x) | [`x`](#x) | | |
| [did:web](https://w3c-ccg.github.io/did-method-web/) | [`x`](#x) | | [`x`](#x) | | | [`x`](#x) | | [`x`](#x) | | | |
| did:key | | | [`x`](#x) | | | | | | [`x`](#x) | [`x`](#x) | |
| did:jwk | | | [`x`](#x) | | | | | | [`x`](#x) | [`x`](#x) | |
| did:peer | | | | [`x`](#x) | | | | [`x`](#x) | [`x`](#x) | [`x`](#x) | |
| did:dht | [`x`](#x) | [`x`](#x) | [`x`](#x) | [`x`](#x) | [`?`](#?) | | [`?`](#?) | [`x`](#x) | [`?`](#?) | [`?`](#?) | |
| [did:webs](https://trustoverip.github.io/tswg-did-method-webs-specification/) | | | | | | | | | | | |
| did:indy | | | | | | | | | | | |
| did:ebsi | | | | | | | | | | | |
| did:cheqd | | | | | | | | | | | |
| [did:iden3](https://github.com/iden3/did-iden3/tree/main) | | | | | | | | | | | |
The following table provides a comprehensive overview of trait support across multiple DID methods, enabling a
systematic comparison of their capabilities.

<!--
Generated via ../generate-markdown-table-comparison.nu
-->

| Method | [Updateable](#updateable) | [Updateable Service Endpoints](#updateable_service_endpoints) | [Deactivatable](#deactivatable) | [Deletable](#deletable) | [Explicit Fees](#explicit_fees) | [Self-Certifying](#self-certifying) | [Rotatable Verification Methods](#updateable_verification_methods) | [Pre-rotation of Keys](#pre-rotation_of_keys) | [Multi-Signature Verification Method](#multi-sig_verification_method) | [Human-readable](#human-readable) | [Enumerable](#enumerable) | [Locally Resolvable](#resolvable_locally) | [Globally Resolvable](#resolvable_globally) | [DID Document History](#history) | [Cryptograhpically signed DID Document History](#history_signed) | [Not Hosted](#hosted_not) | [Centrally Hosted](#hosted_centrally) | [Decentrally Hosted](#hosted_decentrally) | [Privacy Preserving Cryptography](#cryptography_privacy_preserving) | [Government-approved Cryptography](#cryptography_government-approved) | [GDPR-compliant](#gdpr-compliant) |
| --------------------------------------------------------------------- | ------------------------- | ------------------------------------------------------------- | ------------------------------- | ----------------------- | ------------------------------- | ----------------------------------- | ------------------------------------------------------------------ | --------------------------------------------- | --------------------------------------------------------------------- | --------------------------------- | ------------------------- | ----------------------------------------- | ------------------------------------------- | -------------------------------- | ---------------------------------------------------------------- | ------------------------- | ------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------- |
| [did:key](https://www.w3.org/TR/did-extensions-methods/#did-methods) | | | | | | ✅ | | | | | | | ✅ | | | ✅ | | | | | |
| [did:peer](https://www.w3.org/TR/did-extensions-methods/#did-methods) | ✅ | ✅ | | | | ✅ | ✅ | | | | | ✅ | | | | ✅ | | | | | |
| [did:tdw](https://www.w3.org/TR/did-extensions-methods/#did-methods) | ✅ | ✅ | ✅ | ✅ | | ✅ | ✅ | ✅ | | | | | ✅ | ✅ | ✅ | | ✅ | | | | |
| [did:web](https://www.w3.org/TR/did-extensions-methods/#did-methods) | ✅ | ✅ | ✅ | ✅ | | | ✅ | | | ✅ | | | ✅ | | | | ✅ | | | | |

## Appendix

Expand Down

0 comments on commit cb14268

Please sign in to comment.