Detailed Resource creation flow on cheqd
Client app -> cheqd DID Module: [1] Create new DID and associated DIDDoc
note:
Create a normal DID and DID Document on cheqd ledger.
did:cheqd:mainnet:**4611539a-f341-4324-9176-d1078bbd327a**
The unique identifier from this DID is also the _Resource Collection ID_
cheqd DID Module -> cheqd DID Module: [2] Store DID Document
cheqd DID Module -> Client app: [3] CreateDID success response
Client app -> cheqd Resource Module: [4] Create resource associated with DID Document (CreateResource request)
note:
**Resource parameters provided by Client App**
1. _Collection ID_ (same as Step 1): **4611539a-f341-4324-9176-d1078bbd327a**
2. _Resource ID_ (effectively a unique version number): **559d299a-9bca-4e4e-9b57-45c1e07414af**
3. _Resource Name_ (unique name to link versions together): e.g. **PassportSchema**
4. _Resource Type_ (the type of resource being created, also used to link versions together: e.g. **SCHEMA**
5. _Resource Contents_: passed as file
**Resource parameters provided by ledger**
1. _Media Type_ (adopted from the file extension): e.g. `application/json`
2. _Created_: Date of resource creation
3. _Checksum_: SHA-256 checksum of resource contents
4. _Previous Version ID_: `null` for first resource version
5. _Next Version ID_: `null` for first resource version
**Sign the transaction using the Verifaction Method Keys from step 1**
cheqd Resource Module -> cheqd DID Module: [5] check siganture(s) on CreateResource request is valid
cheqd Resource Module -> cheqd Resource Module: [6] store Resource under Resource Collection
cheqd Resource Module -> Client app: [7] CreateResource success response
cheqd Resource Module -> cheqd Resource Module: [8] DIDDoc metadata is updated to reference associated resource metadata
note:
The resource metadata is stored within the _DID Document Metadata_. The syntax of the resource metadata is as follows:
```
"linkedResourceMetadata": [
{
"resourceURI": "did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a/resources/559d299a-9bca-4e4e-9b57-45c1e07414af",
"resourceCollectionId": "4611539a-f341-4324-9176-d1078bbd327a",
"resourceId": "559d299a-9bca-4e4e-9b57-45c1e07414af",
"resourceName": "PassportSchema",
"resourceType": "SCHEMA",
"mediaType": "application/json",
"created": "2022-07-19T08:40:00Z",
"checksum": "7b2022636f6e74656e74223a202274657374206461746122207d0ae3b0c44298",
"previousVersionId": null,
"nextVersionId": null
}
]
```
Client app -> cheqd DID Module: [9] **_Optional_** update initial DID Doc to reference resource in `service` section
note:
DID unique identifier: did:cheqd:mainnet:**4611539a-f341-4324-9176-d1078bbd327a**
DID Document service section:
```
{
"service": [{
"id": "did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a#PassportSchema"
"type": "LinkedResource"
"serviceEndpoint": "https://resolver.cheqd.net/1.0/identifiers/did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a/resources/559d299a-9bca-4e4e-9b57-45c1e07414af"
}]
}
```
Where:
1. _Resource Name_: #**PassportSchema**
2. _Service Type_: **LinkedResource**
3. _Base URL_: `https://resolver.cheqd.net/1.0/identifiers/`
4. _Resource Collection ID_: `did:cheqd:mainnet:`**4611539a-f341-4324-9176-d1078bbd327a**
5. _Method Specific Path_: `/resources/`
6. _Resource ID_: **559d299a-9bca-4e4e-9b57-45c1e07414af**
cheqd DID Module -> cheqd DID Module: [10] Store updated DIDDoc
cheqd DID Module -> Client app: [11] UpdateDID success response
Create a normal DID and DID Document on cheqd ledger.
did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a
The unique identifier from this DID is also the Resource Collection ID
Resource parameters provided by Client App
- Collection ID (same as Step 1): 4611539a-f341-4324-9176-d1078bbd327a
- Resource ID (effectively a unique version number): 559d299a-9bca-4e4e-9b57-45c1e07414af
- Resource Name (unique name to link versions together): e.g. PassportSchema
- Resource Type (the type of resource being created, also used to link versions together: e.g. SCHEMA
- Resource Contents: passed as file
Resource parameters provided by ledger
- Media Type (adopted from the file extension): e.g.
application/json
- Created: Date of resource creation
- Checksum: SHA-256 checksum of resource contents
- Previous Version ID:
null
for first resource version - Next Version ID:
null
for first resource version
Sign the transaction using the Verifaction Method Keys from step 1
The resource metadata is stored within the DID Document Metadata. The syntax of the resource metadata is as follows:
"linkedResourceMetadata": [
{
"resourceURI": "did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a/resources/559d299a-9bca-4e4e-9b57-45c1e07414af",
"resourceCollectionId": "4611539a-f341-4324-9176-d1078bbd327a",
"resourceId": "559d299a-9bca-4e4e-9b57-45c1e07414af",
"resourceName": "PassportSchema",
"resourceType": "SCHEMA",
"mediaType": "application/json",
"created": "2022-07-19T08:40:00Z",
"checksum": "7b2022636f6e74656e74223a202274657374206461746122207d0ae3b0c44298",
"previousVersionId": null,
"nextVersionId": null
}
]
DID unique identifier: did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a
DID Document service section:
{
"service": [{
"id": "did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a#PassportSchema"
"type": "LinkedResource"
"serviceEndpoint": "https://resolver.cheqd.net/1.0/identifiers/did:cheqd:mainnet:4611539a-f341-4324-9176-d1078bbd327a/resources/559d299a-9bca-4e4e-9b57-45c1e07414af"
}]
}
Where:
- Resource Name: #PassportSchema
- Service Type: LinkedResource
- Base URL:
https://resolver.cheqd.net/1.0/identifiers/
- Resource Collection ID:
did:cheqd:mainnet:
4611539a-f341-4324-9176-d1078bbd327a - Method Specific Path:
/resources/
- Resource ID: 559d299a-9bca-4e4e-9b57-45c1e07414af