Skip to content

Commit

Permalink
feat: Add more JSON-LD contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
peacekeeper committed Sep 21, 2024
1 parent 8269bec commit 59ec885
Show file tree
Hide file tree
Showing 9 changed files with 552 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/foundation/identity/did/jsonld/DIDContexts.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ public class DIDContexts {
public static final URI JSONLD_CONTEXT_W3ID_DID_V1 = URI.create("https://w3id.org/did/v1");
public static final URI JSONLD_CONTEXT_W3ID_DID_V011 = URI.create("https://w3id.org/did/v0.11");
public static final URI JSONLD_CONTEXT_W3ID_VERESONE_V1 = URI.create("https://w3id.org/veres-one/v1");
public static final URI JSONLD_CONTEXT_W3ID_SUITES_SECP256K1_2019_V1 = URI.create("https://w3id.org/security/suites/secp256k1-2019/v1");
public static final URI JSONLD_CONTEXT_W3ID_SUITES_ED25519_2018_V1 = URI.create("https://w3id.org/security/suites/ed25519-2018/v1");
public static final URI JSONLD_CONTEXT_W3ID_SUITES_ED25519_2020_V1 = URI.create("https://w3id.org/security/suites/ed25519-2020/v1");
public static final URI JSONLD_CONTEXT_W3ID_SUITES_X25519_2019_V1 = URI.create("https://w3id.org/security/suites/x25519-2019/v1");
public static final URI JSONLD_CONTEXT_W3ID_SUITES_JWS_2020_V1 = URI.create("https://w3id.org/security/suites/jws-2020/v1");
public static final URI JSONLD_CONTEXT_W3ID_SUITES_SECP256K1RECOVERY2020_V2 = URI.create("https://w3id.org/security/suites/secp256k1recovery-2020/v2");
public static final URI JSONLD_CONTEXT_W3CGITHUB_VCDATAINTEGRITY_JWK_V1 = URI.create("https://w3c.github.io/vc-data-integrity/contexts/jwk/v1.jsonld");
public static final URI JSONLD_CONTEXT_DIF_DIDCONFIGURATION_V1 = URI.create("https://identity.foundation/.well-known/did-configuration/v1");

public static final Map<URI, JsonDocument> CONTEXTS;
public static final DocumentLoader DOCUMENT_LOADER;
Expand All @@ -38,6 +46,22 @@ public class DIDContexts {
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("diddocument-context-w3id-did-v011.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3ID_VERESONE_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("diddocument-context-w3id-veresone-v1.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3ID_SUITES_SECP256K1_2019_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("suites-secp256k1-2019.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3ID_SUITES_ED25519_2018_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("suites-ed25519-2018.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3ID_SUITES_ED25519_2020_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("suites-ed25519-2020.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3ID_SUITES_X25519_2019_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("suites-x25519-2019.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3ID_SUITES_JWS_2020_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("suites-jws-2020.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3ID_SUITES_SECP256K1RECOVERY2020_V2,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("suites-secp256k1recovery-2020.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_W3CGITHUB_VCDATAINTEGRITY_JWK_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("w3cgithub-vcdataintegrity-jwk-v1.jsonld"))));
CONTEXTS.put(JSONLD_CONTEXT_DIF_DIDCONFIGURATION_V1,
JsonDocument.of(MediaType.JSON_LD, Objects.requireNonNull(DIDContexts.class.getResourceAsStream("dif-didconfiguration-v1.json"))));

for (Map.Entry<URI, JsonDocument> context : CONTEXTS.entrySet()) {
context.getValue().setDocumentUrl(context.getKey());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"@context": [
{
"@version": 1.1,
"@protected": true,
"LinkedDomains": "https://identity.foundation/.well-known/resources/did-configuration/#LinkedDomains",
"DomainLinkageCredential": "https://identity.foundation/.well-known/resources/did-configuration/#DomainLinkageCredential",
"origin": "https://identity.foundation/.well-known/resources/did-configuration/#origin",
"linked_dids": "https://identity.foundation/.well-known/resources/did-configuration/#linked_dids"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"@context": {
"id": "@id",
"type": "@type",
"@protected": true,
"proof": {
"@id": "https://w3id.org/security#proof",
"@type": "@id",
"@container": "@graph"
},
"Ed25519VerificationKey2018": {
"@id": "https://w3id.org/security#Ed25519VerificationKey2018",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"controller": {
"@id": "https://w3id.org/security#controller",
"@type": "@id"
},
"revoked": {
"@id": "https://w3id.org/security#revoked",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"publicKeyBase58": {
"@id": "https://w3id.org/security#publicKeyBase58"
}
}
},
"Ed25519Signature2018": {
"@id": "https://w3id.org/security#Ed25519Signature2018",
"@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"
},
"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",
"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"
},
"capabilityInvocation": {
"@id": "https://w3id.org/security#capabilityInvocationMethod",
"@type": "@id",
"@container": "@set"
},
"capabilityDelegation": {
"@id": "https://w3id.org/security#capabilityDelegationMethod",
"@type": "@id",
"@container": "@set"
},
"keyAgreement": {
"@id": "https://w3id.org/security#keyAgreementMethod",
"@type": "@id",
"@container": "@set"
}
}
},
"jws": {
"@id": "https://w3id.org/security#jws"
},
"verificationMethod": {
"@id": "https://w3id.org/security#verificationMethod",
"@type": "@id"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"@context": {
"id": "@id",
"type": "@type",
"@protected": true,
"proof": {
"@id": "https://w3id.org/security#proof",
"@type": "@id",
"@container": "@graph"
},
"Ed25519VerificationKey2020": {
"@id": "https://w3id.org/security#Ed25519VerificationKey2020",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"controller": {
"@id": "https://w3id.org/security#controller",
"@type": "@id"
},
"revoked": {
"@id": "https://w3id.org/security#revoked",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"publicKeyMultibase": {
"@id": "https://w3id.org/security#publicKeyMultibase",
"@type": "https://w3id.org/security#multibase"
}
}
},
"Ed25519Signature2020": {
"@id": "https://w3id.org/security#Ed25519Signature2020",
"@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"
},
"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",
"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"
},
"capabilityInvocation": {
"@id": "https://w3id.org/security#capabilityInvocationMethod",
"@type": "@id",
"@container": "@set"
},
"capabilityDelegation": {
"@id": "https://w3id.org/security#capabilityDelegationMethod",
"@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"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"@context": {
"privateKeyJwk": {
"@id": "https://w3id.org/security#privateKeyJwk",
"@type": "@json"
},
"JsonWebKey2020": {
"@id": "https://w3id.org/security#JsonWebKey2020",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"publicKeyJwk": {
"@id": "https://w3id.org/security#publicKeyJwk",
"@type": "@json"
}
}
},
"JsonWebSignature2020": {
"@id": "https://w3id.org/security#JsonWebSignature2020",
"@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"
},
"domain": "https://w3id.org/security#domain",
"expires": {
"@id": "https://w3id.org/security#expiration",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"jws": "https://w3id.org/security#jws",
"nonce": "https://w3id.org/security#nonce",
"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"
},
"capabilityInvocation": {
"@id": "https://w3id.org/security#capabilityInvocationMethod",
"@type": "@id",
"@container": "@set"
},
"capabilityDelegation": {
"@id": "https://w3id.org/security#capabilityDelegationMethod",
"@type": "@id",
"@container": "@set"
},
"keyAgreement": {
"@id": "https://w3id.org/security#keyAgreementMethod",
"@type": "@id",
"@container": "@set"
}
}
},
"verificationMethod": {
"@id": "https://w3id.org/security#verificationMethod",
"@type": "@id"
}
}
}
}
}
Loading

0 comments on commit 59ec885

Please sign in to comment.