Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Nesting and frames support #91

Closed
OR13 opened this issue Dec 6, 2020 · 4 comments · Fixed by #96
Closed

Nesting and frames support #91

OR13 opened this issue Dec 6, 2020 · 4 comments · Fixed by #96

Comments

@OR13
Copy link

OR13 commented Dec 6, 2020

{
  "@context": {"a": "https://example.com/a", "a1": "https://example.com/a1", "b": "https://example.com/b", "c": "https://example.com/c"},
  "a":{
    "b": {
      "c": "hello"
    }
  },
  "a1": "hello2"
}
{
  "@context": {"a": "https://example.com/a", "a1": "https://example.com/a1", "b": "https://example.com/b", "c": "https://example.com/c"},
 "@explicit": true,
  "a": {
   "@explicit": true,
    "b":{}
   }
}

trying to figure out how to get deriveProof on nest claims, for example:

{
    "@context": [
      "https://www.w3.org/2018/credentials/v1",
      "https://www.w3.org/2018/credentials/examples/v1",
      "https://w3c-ccg.github.io/ldp-bbs2020/context/v1"
    ],
    "id": "http://example.gov/credentials/3732",
    "type": [
      "VerifiableCredential",
      "UniversityDegreeCredential"
    ],
    "issuer": {
      "id": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s"
    },
    "issuanceDate": "2020-03-10T04:24:12.164Z",
    "credentialSubject": {
      "id": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM",
      "degree": {
        "type": "BachelorDegree",
        "name": "Bachelor of Science and Arts"
      }
    },
    "proof": {
      "type": "BbsBlsSignature2020",
      "created": "2020-12-06T16:10:24Z",
      "proofPurpose": "assertionMethod",
      "proofValue": "sKNVGJssWdZcvmCqvcfgz7s64Ibj0ZfqSmZIwgy+yIhCUOlWflsBKCfVNGAPfd8yW/pryt87c7ho/PAJofdFZZB97gpQkpisI/+Rcs2xLtVRrpTiu4YU3sXEFbgPjA3GY/fZOpdFTABVutDvckchLw==",
      "verificationMethod": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM"
    }
  }

with

   const deriveProofFrame = {
      "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://www.w3.org/2018/credentials/examples/v1",
        "https://w3c-ccg.github.io/ldp-bbs2020/context/v1",
      {
        "degree": "https://example.com/degree"
      }
      ],
      "type": ["VerifiableCredential", "UniversityDegreeCredential"],
      "@explicit": true,
      "credentialSubject": {
        "@explicit": true,
        degree: {
          name: {}
        }
      }
    }

@kdenhartog
Copy link
Contributor

Noting I saw this, but need to play around with things a bit before I can come back with an answer. I think this is mainly going to come down to upgrading how we use the frame API in json-ld or updating json-ld.js

@kdenhartog
Copy link
Contributor

kdenhartog commented Dec 11, 2020

Did some digging on this so far, but stopping for the day. This is the value of compactInputProofDocument that's being passed into jsonld.frame on line 138

[{
        "@id": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM",
        "https://example.org/examples#degree": [{
            "@id": "_:c14n0"
        }]
    },
    {
        "@id": "https://example.gov/credentials/3732",
        "@type": [
            "https://example.org/examples#UniversityDegreeCredential",
            "https://www.w3.org/2018/credentials#VerifiableCredential"
        ],
        "https://www.w3.org/2018/credentials#credentialSubject": [{
            "@id": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM"
        }],
        "https://www.w3.org/2018/credentials#issuanceDate": [{
            "@value": "2020-03-10T04:24:12.164Z",
            "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
        }]
    },
    {
        "@id": "urn:bnid:_:c14n0",
        "http://schema.org/name": [{
            "@value": "Bachelor of Science and Arts",
            "@type": "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML"
        }],
        "@type": [
            "https://example.org/examples#BachelorDegree"
        ]
    }
]

This seems a bit odd to me so I need to do some more digging into if the fromRDF() value is getting bad inputs which is causing the problem or if the framing is having some issues with it's inputs.

One thing that seems odd about this is some of the nodes are properly labelled urn:bnid:_:c14n0 where as other's aren't being converted properly such as "@id": "_:c14n0". Could be our blank node solution is biting us now and we need to re-evaluate it as well.

More to come on this next week!

@OR13
Copy link
Author

OR13 commented Dec 11, 2020

ping @msporny @dlongley if you have thoughts

kdenhartog added a commit that referenced this issue Dec 14, 2020
the blank nodes were only being transformed in the node identifier portion of the nQuad. This caused
issues in how the nQuads would be converted back from RDF to JSON which in-advertently broke the
ability for a proof to be derived from a nested structure. This fix makes it so that all blank node
identifiers are transformed properly rather than just the node identifiers (first part of the nQuad).

re #91
@kdenhartog
Copy link
Contributor

This will be fixed in #96

Thanks for raising this @OR13

kdenhartog added a commit that referenced this issue Dec 21, 2020
the blank nodes were only being transformed in the node identifier portion of the nQuad. This caused
issues in how the nQuads would be converted back from RDF to JSON which in-advertently broke the
ability for a proof to be derived from a nested structure. This fix makes it so that all blank node
identifiers are transformed properly rather than just the node identifiers (first part of the nQuad).

re #91
tplooker pushed a commit that referenced this issue Dec 21, 2020
…96)

the blank nodes were only being transformed in the node identifier portion of the nQuad. This caused
issues in how the nQuads would be converted back from RDF to JSON which in-advertently broke the
ability for a proof to be derived from a nested structure. This fix makes it so that all blank node
identifiers are transformed properly rather than just the node identifiers (first part of the nQuad).

fixes #91
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants