diff --git a/doc/ld/context/embed/embed_contexts.go b/doc/ld/context/embed/embed_contexts.go index fe05bd2..3c8cb45 100644 --- a/doc/ld/context/embed/embed_contexts.go +++ b/doc/ld/context/embed/embed_contexts.go @@ -15,7 +15,9 @@ import ( // nolint:gochecknoglobals // required for go:embed var ( //go:embed third_party/w3.org/credentials_v1.jsonld - w3orgCredentials []byte + w3orgCredentialsV1 []byte + //go:embed third_party/w3.org/credentials_v2.jsonld + w3orgCredentialsV2 []byte //go:embed third_party/w3.org/did_v1.jsonld w3orgDID []byte //go:embed third_party/w3c-ccg.github.io/did_v0.11.jsonld @@ -59,7 +61,12 @@ var Contexts = []ldcontext.Document{ //nolint:gochecknoglobals { URL: "https://www.w3.org/2018/credentials/v1", DocumentURL: "https://www.w3.org/2018/credentials/v1", - Content: w3orgCredentials, + Content: w3orgCredentialsV1, + }, + { + URL: "https://www.w3.org/ns/credentials/v2", + DocumentURL: "https://www.w3.org/ns/credentials/v2", + Content: w3orgCredentialsV2, }, { URL: "https://www.w3.org/ns/did/v1", diff --git a/doc/ld/context/embed/third_party/w3.org/credentials_v2.jsonld b/doc/ld/context/embed/third_party/w3.org/credentials_v2.jsonld new file mode 100644 index 0000000..fe5f92a --- /dev/null +++ b/doc/ld/context/embed/third_party/w3.org/credentials_v2.jsonld @@ -0,0 +1,340 @@ +{ + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "description": "https://schema.org/description", + "digestMultibase": { + "@id": "https://w3id.org/security#digestMultibase", + "@type": "https://w3id.org/security#multibase" + }, + "digestSRI": { + "@id": "https://www.w3.org/2018/credentials#digestSRI", + "@type": "https://www.w3.org/2018/credentials#sriString" + }, + "mediaType": { + "@id": "https://schema.org/encodingFormat" + }, + "name": "https://schema.org/name", + + "VerifiableCredential": { + "@id": "https://www.w3.org/2018/credentials#VerifiableCredential", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "confidenceMethod": { + "@id": "https://www.w3.org/2018/credentials#confidenceMethod", + "@type": "@id" + }, + "credentialSchema": { + "@id": "https://www.w3.org/2018/credentials#credentialSchema", + "@type": "@id" + }, + "credentialStatus": { + "@id": "https://www.w3.org/2018/credentials#credentialStatus", + "@type": "@id" + }, + "credentialSubject": { + "@id": "https://www.w3.org/2018/credentials#credentialSubject", + "@type": "@id" + }, + "description": "https://schema.org/description", + "evidence": { + "@id": "https://www.w3.org/2018/credentials#evidence", + "@type": "@id" + }, + "issuer": { + "@id": "https://www.w3.org/2018/credentials#issuer", + "@type": "@id" + }, + "name": "https://schema.org/name", + "proof": { + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph" + }, + "refreshService": { + "@id": "https://www.w3.org/2018/credentials#refreshService", + "@type": "@id" + }, + "relatedResource": { + "@id": "https://www.w3.org/2018/credentials#relatedResource", + "@type": "@id" + }, + "renderMethod": { + "@id": "https://www.w3.org/2018/credentials#renderMethod", + "@type": "@id" + }, + "termsOfUse": { + "@id": "https://www.w3.org/2018/credentials#termsOfUse", + "@type": "@id" + }, + "validFrom": { + "@id": "https://www.w3.org/2018/credentials#validFrom", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "validUntil": { + "@id": "https://www.w3.org/2018/credentials#validUntil", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + } + } + }, + + "EnvelopedVerifiableCredential": + "https://www.w3.org/2018/credentials#EnvelopedVerifiableCredential", + + "VerifiablePresentation": { + "@id": "https://www.w3.org/2018/credentials#VerifiablePresentation", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "holder": { + "@id": "https://www.w3.org/2018/credentials#holder", + "@type": "@id" + }, + "proof": { + "@id": "https://w3id.org/security#proof", + "@type": "@id", + "@container": "@graph" + }, + "termsOfUse": { + "@id": "https://www.w3.org/2018/credentials#termsOfUse", + "@type": "@id" + }, + "verifiableCredential": { + "@id": "https://www.w3.org/2018/credentials#verifiableCredential", + "@type": "@id", + "@container": "@graph", + "@context": null + } + } + }, + + "EnvelopedVerifiablePresentation": + "https://www.w3.org/2018/credentials#EnvelopedVerifiablePresentation", + + "JsonSchemaCredential": + "https://www.w3.org/2018/credentials#JsonSchemaCredential", + + "JsonSchema": { + "@id": "https://www.w3.org/2018/credentials#JsonSchema", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "jsonSchema": { + "@id": "https://www.w3.org/2018/credentials#jsonSchema", + "@type": "@json" + } + } + }, + + "BitstringStatusListCredential": + "https://www.w3.org/ns/credentials/status#BitstringStatusListCredential", + + "BitstringStatusList": { + "@id": "https://www.w3.org/ns/credentials/status#BitstringStatusList", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "encodedList": { + "@id": "https://www.w3.org/ns/credentials/status#encodedList", + "@type": "https://w3id.org/security#multibase" + }, + "statusMessage": { + "@id": "https://www.w3.org/ns/credentials/status#statusMessage", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "message": "https://www.w3.org/ns/credentials/status#message", + "status": "https://www.w3.org/ns/credentials/status#status" + } + }, + "statusPurpose": + "https://www.w3.org/ns/credentials/status#statusPurpose", + "statusReference": { + "@id": "https://www.w3.org/ns/credentials/status#statusReference", + "@type": "@id" + }, + "statusSize": { + "@id": "https://www.w3.org/ns/credentials/status#statusSize", + "@type": "https://www.w3.org/2001/XMLSchema#positiveInteger" + }, + "ttl": "https://www.w3.org/ns/credentials/status#ttl" + } + }, + + "BitstringStatusListEntry": { + "@id": + "https://www.w3.org/ns/credentials/status#BitstringStatusListEntry", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "statusListCredential": { + "@id": + "https://www.w3.org/ns/credentials/status#statusListCredential", + "@type": "@id" + }, + "statusListIndex": + "https://www.w3.org/ns/credentials/status#statusListIndex", + "statusPurpose": + "https://www.w3.org/ns/credentials/status#statusPurpose" + } + }, + + "DataIntegrityProof": { + "@id": "https://w3id.org/security#DataIntegrityProof", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "challenge": "https://w3id.org/security#challenge", + "created": { + "@id": "http://purl.org/dc/terms/created", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "cryptosuite": { + "@id": "https://w3id.org/security#cryptosuite", + "@type": "https://w3id.org/security#cryptosuiteString" + }, + "domain": "https://w3id.org/security#domain", + "expires": { + "@id": "https://w3id.org/security#expiration", + "@type": "http://www.w3.org/2001/XMLSchema#dateTime" + }, + "nonce": "https://w3id.org/security#nonce", + "previousProof": { + "@id": "https://w3id.org/security#previousProof", + "@type": "@id" + }, + "proofPurpose": { + "@id": "https://w3id.org/security#proofPurpose", + "@type": "@vocab", + "@context": { + "@protected": true, + + "id": "@id", + "type": "@type", + + "assertionMethod": { + "@id": "https://w3id.org/security#assertionMethod", + "@type": "@id", + "@container": "@set" + }, + "authentication": { + "@id": "https://w3id.org/security#authenticationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityDelegation": { + "@id": "https://w3id.org/security#capabilityDelegationMethod", + "@type": "@id", + "@container": "@set" + }, + "capabilityInvocation": { + "@id": "https://w3id.org/security#capabilityInvocationMethod", + "@type": "@id", + "@container": "@set" + }, + "keyAgreement": { + "@id": "https://w3id.org/security#keyAgreementMethod", + "@type": "@id", + "@container": "@set" + } + } + }, + "proofValue": { + "@id": "https://w3id.org/security#proofValue", + "@type": "https://w3id.org/security#multibase" + }, + "verificationMethod": { + "@id": "https://w3id.org/security#verificationMethod", + "@type": "@id" + } + } + }, + + "...": { + "@id": "https://www.iana.org/assignments/jwt#..." + }, + "_sd": { + "@id": "https://www.iana.org/assignments/jwt#_sd", + "@type": "@json" + }, + "_sd_alg": { + "@id": "https://www.iana.org/assignments/jwt#_sd_alg" + }, + "aud": { + "@id": "https://www.iana.org/assignments/jwt#aud", + "@type": "@id" + }, + "cnf": { + "@id": "https://www.iana.org/assignments/jwt#cnf", + "@context": { + "@protected": true, + + "kid": { + "@id": "https://www.iana.org/assignments/jwt#kid", + "@type": "@id" + }, + "jwk": { + "@id": "https://www.iana.org/assignments/jwt#jwk", + "@type": "@json" + } + } + }, + "exp": { + "@id": "https://www.iana.org/assignments/jwt#exp", + "@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger" + }, + "iat": { + "@id": "https://www.iana.org/assignments/jwt#iat", + "@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger" + }, + "iss": { + "@id": "https://www.iana.org/assignments/jose#iss", + "@type": "@id" + }, + "jku": { + "@id": "https://www.iana.org/assignments/jose#jku", + "@type": "@id" + }, + "kid": { + "@id": "https://www.iana.org/assignments/jose#kid", + "@type": "@id" + }, + "nbf": { + "@id": "https://www.iana.org/assignments/jwt#nbf", + "@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger" + }, + "sub": { + "@id": "https://www.iana.org/assignments/jose#sub", + "@type": "@id" + }, + "x5u": { + "@id": "https://www.iana.org/assignments/jose#x5u", + "@type": "@id" + } + } +} \ No newline at end of file diff --git a/doc/ld/testutil/contexts/third_party/w3.org/credentials-examples_v2.jsonld b/doc/ld/testutil/contexts/third_party/w3.org/credentials-examples_v2.jsonld new file mode 100644 index 0000000..f9b42be --- /dev/null +++ b/doc/ld/testutil/contexts/third_party/w3.org/credentials-examples_v2.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "@vocab": "https://www.w3.org/ns/credentials/examples#" + } +} \ No newline at end of file diff --git a/doc/ld/testutil/document_loader.go b/doc/ld/testutil/document_loader.go index fc6b5c1..c643cb6 100644 --- a/doc/ld/testutil/document_loader.go +++ b/doc/ld/testutil/document_loader.go @@ -29,7 +29,9 @@ var ( //go:embed contexts/third_party/w3.org/odrl.jsonld odrl []byte //go:embed contexts/third_party/w3.org/credentials-examples_v1.jsonld - credentialExamples []byte + credentialExamplesV1 []byte + //go:embed contexts/third_party/w3.org/credentials-examples_v2.jsonld + credentialExamplesV2 []byte //go:embed contexts/third_party/trustbloc.github.io/trustbloc-examples_v1.jsonld vcExamples []byte //go:embed contexts/third_party/trustbloc.github.io/trustbloc-authorization-credential_v1.jsonld @@ -50,7 +52,11 @@ var testContexts = []ldcontext.Document{ //nolint:gochecknoglobals // embedded t }, { URL: "https://www.w3.org/2018/credentials/examples/v1", - Content: credentialExamples, + Content: credentialExamplesV1, + }, + { + URL: "https://www.w3.org/ns/credentials/examples/v2", + Content: credentialExamplesV2, }, { URL: "https://trustbloc.github.io/context/vc/examples-v1.jsonld",