Skip to content

Commit

Permalink
Merge pull request #173 from sandrask/add-did-web-rest
Browse files Browse the repository at this point in the history
chore: Add did:web method REST endpoints
  • Loading branch information
sandrask committed Sep 7, 2022
2 parents be6821b + 61401c5 commit 29fa398
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 3 deletions.
72 changes: 72 additions & 0 deletions readthedocs/source/orb/restendpoints/did-web.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# DID Web File Endpoint

The [DID Web](https://w3c-ccg.github.io/did-method-web/#read-resolve) file endpoint is used for resolution of did:web method documents by universal resolver and other did:web resolvers. This endpoint will serve DID document only not DID resolution result.

**Endpoint:** /scid/{id}/did.json

### GET

***Example***

Request:

```
GET /scid/EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ/did.json HTTP/1.1
Host: orb.domain3.com
Accept: application/json
```

Response:

```json
{
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/jws-2020/v1",
"https://w3id.org/security/suites/ed25519-2018/v1"
],
"alsoKnownAs": [
"https://myblog.example/",
"did:orb:uEiDDV4Yn9wx0c5dlrYT90TsjB6fg2Gc6x91X1gG3O5oJIA:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"did:orb:hl:uEiDDV4Yn9wx0c5dlrYT90TsjB6fg2Gc6x91X1gG3O5oJIA:uoQ-BeEtodHRwczovL29yYi5kb21haW4zLmNvbS9jYXMvdUVpRERWNFluOXd4MGM1ZGxyWVQ5MFRzakI2ZmcyR2M2eDkxWDFnRzNPNW9KSUE:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ"
],
"assertionMethod": [
"did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#auth"
],
"authentication": [
"did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#createKey"
],
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"service": [
{
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#didcomm",
"priority": 0,
"recipientKeys": [
"2FE8JwxEhd3apwqQQxpURmN4iiaM8H7cCAvU1K3D1Mmr"
],
"serviceEndpoint": "https://hub.example.com/.identity/did:example:0123456789abcdef/",
"type": "did-communication"
}
],
"verificationMethod": [
{
"controller": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#createKey",
"publicKeyJwk": {
"crv": "P-256",
"kty": "EC",
"x": "0Di-FS6Y9v8QyNyswEPdHJ6HK_Yx2Ek-OLsfyEcKyLQ",
"y": "MsQvvYkqcvRn4ndZCMU7JjTq1sUXpt3xpjaldNLiLxQ"
},
"type": "JsonWebKey2020"
},
{
"controller": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#auth",
"publicKeyBase58": "XpPrnB4DAiQTXL2dDCoenje8aVtocY3FqMFcy8w6fBK",
"type": "Ed25519VerificationKey2018"
}
]
}
```

1 change: 1 addition & 0 deletions readthedocs/source/orb/restendpoints/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REST Endpoints

activitypub.md
sidetree.md
did-web.md
wellknown.md
cas.md
witness-policy.md
Expand Down
77 changes: 74 additions & 3 deletions readthedocs/source/orb/restendpoints/sidetree.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,15 @@ that contains only id. Once DID document has been deactivated it is no longer po

**Endpoint:** /sidetree/v1/identifiers/[id]

This endpoint supports the resolution of DID documents for two did methods:
- did:orb
- did:web

### GET

Resolve a DID document as per [Sidetree DID Resolution](../system/sidetree.html#did-resolution)

**Example**
**DID Orb Method Example**

Resolve a DID document using a canonical DID:

Expand All @@ -561,7 +565,7 @@ Accept: application/ld+json
Accept-Encoding: gzip, deflate
```

Response contains the DID document:
Response contains DID resolution result:

```json
{
Expand Down Expand Up @@ -685,4 +689,71 @@ Accept: application/ld+json
Accept-Encoding: gzip, deflate
```

For more details about versionId and versionTime queries see [DID Parameters](https://www.w3.org/TR/did-core/#did-parameters)
For more details about versionId and versionTime queries see [DID Parameters](https://www.w3.org/TR/did-core/#did-parameters)

**DID Web Method Example**

Request:

```
GET /sidetree/v1/identifiers/did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ HTTP/1.1
Host: orb.domain3.com
Accept: application/json
```

Response:

```json
{
"@context": "https://w3id.org/did-resolution/v1",
"didDocument": {
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/jws-2020/v1",
"https://w3id.org/security/suites/ed25519-2018/v1"
],
"alsoKnownAs": [
"https://myblog.example/",
"did:orb:uEiDDV4Yn9wx0c5dlrYT90TsjB6fg2Gc6x91X1gG3O5oJIA:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"did:orb:hl:uEiDDV4Yn9wx0c5dlrYT90TsjB6fg2Gc6x91X1gG3O5oJIA:uoQ-BeEtodHRwczovL29yYi5kb21haW4zLmNvbS9jYXMvdUVpRERWNFluOXd4MGM1ZGxyWVQ5MFRzakI2ZmcyR2M2eDkxWDFnRzNPNW9KSUE:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ"
],
"assertionMethod": [
"did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#auth"
],
"authentication": [
"did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#createKey"
],
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"service": [
{
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#didcomm",
"priority": 0,
"recipientKeys": [
"2FE8JwxEhd3apwqQQxpURmN4iiaM8H7cCAvU1K3D1Mmr"
],
"serviceEndpoint": "https://hub.example.com/.identity/did:example:0123456789abcdef/",
"type": "did-communication"
}
],
"verificationMethod": [
{
"controller": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#createKey",
"publicKeyJwk": {
"crv": "P-256",
"kty": "EC",
"x": "0Di-FS6Y9v8QyNyswEPdHJ6HK_Yx2Ek-OLsfyEcKyLQ",
"y": "MsQvvYkqcvRn4ndZCMU7JjTq1sUXpt3xpjaldNLiLxQ"
},
"type": "JsonWebKey2020"
},
{
"controller": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ",
"id": "did:web:orb.domain3.com:scid:EiCNuOisUYmxNfT2HugwwMYQAyzLr9FxI7tbT3eb5r3mFQ#auth",
"publicKeyBase58": "XpPrnB4DAiQTXL2dDCoenje8aVtocY3FqMFcy8w6fBK",
"type": "Ed25519VerificationKey2018"
}
]
}
}
```

0 comments on commit 29fa398

Please sign in to comment.