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

chore: fix context definition #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
49 changes: 42 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,61 @@ The same process is followed for the asset identifier.
The identifier is decomposed into its namespace, reference, and optional ID.
Then, the resolver for the specified asset namespace is used to resolve the asset reference and ID.

### JSON-LD Context

The snippet below shows the context that the process of AssetDID resolution returns.

```json
{
"@protected": true,
"asset-did-spec": "https://github.com/KILTprotocol/spec-asset-did/blob/main/README.md",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you check what the predicates expand to? Not sure, but you might need to add a # to make sure the result is a valid URL

"chain": {
"@id": "asset-did-spec:chain",
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could add "@type":"@id", for completeness, tells the processor that we expect the value of chain to be an IRI. Just covers the case where you'd have "chain": "eip155:0" in your document so yeah, just for completeness.

"@context": {
"namespace": "asset-did-spec:chain-namespace",
"reference": "asset-did-spec:chain-reference"
}
},
rflechtner marked this conversation as resolved.
Show resolved Hide resolved
"id": "@id",
"namespace": "asset-did-spec:asset-namespace",
"reference": "asset-did-spec:asset-reference",
"identifier": "asset-did-spec:asset-identifier"
}
```

As an example, the returned DID Document for [one of the CryptoKitties NFTs](https://opensea.io/assets/ethereum/0x06012c8cf97bead5deae237070f9587f8e7a266d/634446), identified with the Asset DID `did:asset:eip155:1.erc721:0x06012c8cf97bead5deae237070f9587f8e7a266d:634446`, is the following:

<!-- TODO: Store the context somewhere and update this link when defined. -->
<!-- TODO: Change context URL with IPFS link -->

```json
{
"@context": [
"https://www.w3.org/ns/did/v1",
"https://kilt.io/asset-did-context.json"
{
"@protected": true,
"asset-did-spec": "https://github.com/KILTprotocol/spec-asset-did/blob/main/README.md",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still broken I think. Try adding the hash in the playground and observe how the expanded result changes

Suggested change
"asset-did-spec": "https://github.com/KILTprotocol/spec-asset-did/blob/main/README.md",
"asset-did-spec": "https://github.com/KILTprotocol/spec-asset-did/blob/main/README.md#",

"chain": {
"@id": "asset-did-spec:chain",
"@context": {
"namespace": "asset-did-spec:chain-namespace",
"reference": "asset-did-spec:chain-reference"
}
},
"id": "@id",
"namespace": "asset-did-spec:asset-namespace",
"reference": "asset-did-spec:asset-reference",
"identifier": "asset-did-spec:asset-identifier"
}
],
"id": "did:asset:eip155:1.erc721:0x06012c8cf97bead5deae237070f9587f8e7a266d:634446",
"chain": {
"id": "eip155:0",
"namespace": "eip155",
"reference": "0"
},
"asset": {
"namespace": "erc721",
"reference": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"identifier": "634446"
}
"namespace": "erc721",
"reference": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"identifier": "634446"
}
```

Expand Down