Skip to content

Commit

Permalink
Merge pull request hyperledger#2749 from andrewwhitehead/fix/bbs-context
Browse files Browse the repository at this point in the history
Add cached copy of BBS v1 context
  • Loading branch information
dbluhm committed Jan 31, 2024
2 parents 78ffd67 + a8fe7ce commit 563aaa6
Show file tree
Hide file tree
Showing 53 changed files with 217 additions and 89 deletions.
6 changes: 3 additions & 3 deletions JsonLdCredentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ It is required that every property key in the document can be mapped to an IRI.

> "\<x> attributes dropped. Provide definitions in context to correct. [\<missing-properties>]"
For credentials the `https://www.w3.org/2018/credentials/v1` context MUST always be the first context. In addition, when issuing BBS+ credentials the `https://w3c.github.io/vc-di-bbs/contexts/v1` URL MUST be present in the context. For convenience this URL will be automatically added to the `@context` of the credential if not present.
For credentials the `https://www.w3.org/2018/credentials/v1` context MUST always be the first context. In addition, when issuing BBS+ credentials the `https://w3id.org/security/bbs/v1` URL MUST be present in the context. For convenience this URL will be automatically added to the `@context` of the credential if not present.

```json
{
Expand Down Expand Up @@ -168,7 +168,7 @@ Call the `/credentials/w3c` endpoint to retrieve all JSON-LD credentials in your
"contexts": [
"https://www.w3.org/2018/credentials/examples/v1",
"https://www.w3.org/2018/credentials/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1"
"https://w3id.org/security/bbs/v1"
],
"types": ["UniversityDegreeCredential", "VerifiableCredential"],
"schema_ids": [],
Expand All @@ -179,7 +179,7 @@ Call the `/credentials/w3c` endpoint to retrieve all JSON-LD credentials in your
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1"
"https://w3id.org/security/bbs/v1"
],
"type": ["VerifiableCredential", "UniversityDegreeCredential"],
"issuer": "did:key:zUC7FsmhhifDTuYXdwYES2UpCpWwYieJRapC6oEWqyt5KfJ3ztfLzYnbWjuXQ5drYaKaho3FjxrfDB81gtAJKjbM4yAmBuNoj3YKDXqW151KkkYarpEoEVWMMcN5zPfjCrQ8Saj",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class DIFPresSpecSchema(OpenAPISchema):
"example": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"type": ["VerifiableCredential", "LabReport"],
"@explicit": True,
Expand Down
36 changes: 18 additions & 18 deletions aries_cloudagent/protocols/present_proof/dif/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"type": ["VerifiableCredential", "PermanentResidentCard"],
"issuer": "did:key:zUC72Q7XD4PE4CrMiDVXuvZng3sBvMmaGgNeTUJuzavH2BS7ThbHL9FhsZM9QYY5fqAQ4MB8M9oudz3tfuaX36Ajr97QRW7LBt6WWmrtESe6Bs5NYzFtLWEmeVtvRYVAgjFcJSa",
Expand Down Expand Up @@ -365,7 +365,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"type": ["VerifiableCredential", "PermanentResidentCard"],
"issuer": "did:key:zUC72Q7XD4PE4CrMiDVXuvZng3sBvMmaGgNeTUJuzavH2BS7ThbHL9FhsZM9QYY5fqAQ4MB8M9oudz3tfuaX36Ajr97QRW7LBt6WWmrtESe6Bs5NYzFtLWEmeVtvRYVAgjFcJSa",
Expand Down Expand Up @@ -407,7 +407,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -448,7 +448,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"credentialSubject": {
"birthCountry": "Bahamas",
Expand Down Expand Up @@ -479,7 +479,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://example.gov/credentials/3732",
"type": ["VerifiableCredential", "UniversityDegreeCredential"],
Expand Down Expand Up @@ -514,7 +514,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -556,7 +556,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://example.gov/credentials/3732",
"type": ["VerifiableCredential", "UniversityDegreeCredential"],
Expand Down Expand Up @@ -592,7 +592,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -635,7 +635,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627466",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -678,7 +678,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627467",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -849,7 +849,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -885,7 +885,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627466",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -921,7 +921,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627467",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -957,7 +957,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627468",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -993,7 +993,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627469",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -1029,7 +1029,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627470",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -1748,7 +1748,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
TEST_CRED_DICT = {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
{
"MedicalPass": {
"@id": "https://www.vdel.com/MedicalPass",
Expand Down Expand Up @@ -1797,7 +1797,7 @@ def create_vcrecord(cred_dict: dict, expanded_types: list):
TEST_CRED_WILDCARD = {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
{
"LabReport": {
"@id": "https://www.vdel.com/LabReport",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def test_verifiable_presentation_wrapper(self):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["PermanentResidentCard", "VerifiableCredential"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ async def test_reveal_doc_with_frame_provided(self, profile):
reveal_doc_frame = {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"type": ["VerifiableCredential", "LabReport"],
"@explicit": True,
Expand Down Expand Up @@ -619,7 +619,7 @@ async def test_reveal_doc_b(self, profile):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://example.gov/credentials/3732",
"issuer": "did:example:489398593",
Expand Down Expand Up @@ -677,7 +677,7 @@ async def test_reveal_doc_b(self, profile):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"issuer": {},
"issuanceDate": {},
Expand Down Expand Up @@ -1809,7 +1809,7 @@ async def test_reveal_doc_d(self, profile):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -1918,7 +1918,7 @@ def test_create_vc_record_with_graph_struct(self, profile):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"@graph": [
{
Expand Down Expand Up @@ -1953,7 +1953,7 @@ def test_create_vc_record_with_graph_struct(self, profile):
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"@graph": [
{
Expand Down Expand Up @@ -3595,7 +3595,7 @@ def test_get_dict_keys_from_path(self, profile):
cred_dict = {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "urn:bnid:_:c14n4",
"type": ["MedicalPass", "VerifiableCredential"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["PermanentResidentCard", "VerifiableCredential"],
Expand Down Expand Up @@ -278,7 +278,7 @@
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["PermanentResidentCard", "VerifiableCredential"],
Expand Down Expand Up @@ -326,7 +326,7 @@
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"id": "https://issuer.oidp.uscis.gov/credentials/83627465",
"type": ["VerifiableCredential", "PermanentResidentCard"],
Expand Down Expand Up @@ -760,7 +760,7 @@ async def test_create_pres_prover_proof_spec_with_reveal_doc(self):
dif_pres_spec["reveal_doc"] = {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1",
"https://w3id.org/security/bbs/v1",
],
"type": ["VerifiableCredential", "LabReport"],
"@explicit": True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@
"@context":[
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1"
"https://w3id.org/security/bbs/v1"
],
"id":"https://issuer.oidp.uscis.gov/credentials/83627465",
"type":[
Expand Down Expand Up @@ -1732,7 +1732,7 @@
"@context":[
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3c.github.io/vc-di-bbs/contexts/v1"
"https://w3id.org/security/bbs/v1"
],
"id":"https://issuer.oidp.uscis.gov/credentials/83627465",
"type":[
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/vc/ld_proofs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
SECURITY_CONTEXT_URL = SECURITY_CONTEXT_V2_URL
DID_V1_CONTEXT_URL = "https://www.w3.org/ns/did/v1"
CREDENTIALS_CONTEXT_V1_URL = "https://www.w3.org/2018/credentials/v1"
SECURITY_CONTEXT_BBS_URL = "https://w3c.github.io/vc-di-bbs/contexts/v1"
SECURITY_CONTEXT_BBS_URL = "https://w3id.org/security/bbs/v1"
SECURITY_CONTEXT_ED25519_2020_URL = "https://w3id.org/security/suites/ed25519-2020/v1"

CREDENTIALS_ISSUER_URL = "https://www.w3.org/2018/credentials#issuer"
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/vc/ld_proofs/document_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class StaticCacheJsonLdDownloader:
"https://w3id.org/security/v1": "security-v1-context.jsonld",
"https://w3id.org/security/v2": "security-v2-context.jsonld",
"https://w3id.org/security/suites/ed25519-2020/v1": "ed25519-2020-context.jsonld",
"https://w3id.org/security/bbs/v1": "bbs-v1-context.jsonld",
}

def __init__(
Expand Down
Loading

0 comments on commit 563aaa6

Please sign in to comment.