Skip to content

Commit

Permalink
Add data integrity v2 context (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbihel authored Jul 3, 2024
1 parent 157fb00 commit 0cc4242
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/contexts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub const W3ID_ED2020_V1: &str = include_str!("../w3id-ed25519-signature-2020-v1
pub const W3ID_MULTIKEY_V1: &str = include_str!("../w3id-multikey-v1.jsonld");
/// <https://w3id.org/security/data-integrity/v1>
pub const W3ID_DATA_INTEGRITY_V1: &str = include_str!("../w3id-data-integrity-v1.jsonld");
/// <https://w3id.org/security/data-integrity/v2>
pub const W3ID_DATA_INTEGRITY_V2: &str = include_str!("../w3id-data-integrity-v2.jsonld");
/// <https://w3id.org/security/suites/blockchain-2021/v1>
pub const BLOCKCHAIN2021_V1: &str = include_str!("../w3id-blockchain-2021-v1.jsonld");
/// <https://w3id.org/citizenship/v1>
Expand Down
81 changes: 81 additions & 0 deletions crates/contexts/w3id-data-integrity-v2.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"@context": {
"id": "@id",
"type": "@type",
"@protected": true,
"proof": {
"@id": "https://w3id.org/security#proof",
"@type": "@id",
"@container": "@graph"
},
"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"
},
"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"
},
"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"
}
}
},
"cryptosuite": {
"@id": "https://w3id.org/security#cryptosuite",
"@type": "https://w3id.org/security#cryptosuiteString"
},
"proofValue": {
"@id": "https://w3id.org/security#proofValue",
"@type": "https://w3id.org/security#multibase"
},
"verificationMethod": {
"@id": "https://w3id.org/security#verificationMethod",
"@type": "@id"
}
}
}
}
}
7 changes: 7 additions & 0 deletions crates/json-ld/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pub const W3ID_ED2020_V1_CONTEXT: &Iri = iri!("https://w3id.org/security/suites/
pub const W3ID_MULTIKEY_V1_CONTEXT: &Iri = iri!("https://w3id.org/security/multikey/v1");
pub const W3ID_DATA_INTEGRITY_V1_CONTEXT: &Iri =
iri!("https://w3id.org/security/data-integrity/v1");
pub const W3ID_DATA_INTEGRITY_V2_CONTEXT: &Iri =
iri!("https://w3id.org/security/data-integrity/v2");
pub const BLOCKCHAIN2021_V1_CONTEXT: &Iri =
iri!("https://w3id.org/security/suites/blockchain-2021/v1");
pub const CITIZENSHIP_V1_CONTEXT: &Iri = iri!("https://w3id.org/citizenship/v1");
Expand Down Expand Up @@ -149,6 +151,10 @@ lazy_static::lazy_static! {
W3ID_DATA_INTEGRITY_V1_CONTEXT,
ssi_contexts::W3ID_DATA_INTEGRITY_V1
);
pub static ref W3ID_DATA_INTEGRITY_V2_CONTEXT_DOCUMENT: RemoteDocument = load_static_context(
W3ID_DATA_INTEGRITY_V2_CONTEXT,
ssi_contexts::W3ID_DATA_INTEGRITY_V2
);
pub static ref BLOCKCHAIN2021_V1_CONTEXT_DOCUMENT: RemoteDocument = load_static_context(
BLOCKCHAIN2021_V1_CONTEXT,
ssi_contexts::BLOCKCHAIN2021_V1
Expand Down Expand Up @@ -267,6 +273,7 @@ impl Loader for StaticLoader {
W3ID_ED2020_V1_CONTEXT => Ok(W3ID_ED2020_V1_CONTEXT_DOCUMENT.clone()),
W3ID_MULTIKEY_V1_CONTEXT => Ok(W3ID_MULTIKEY_V1_CONTEXT_DOCUMENT.clone()),
W3ID_DATA_INTEGRITY_V1_CONTEXT => Ok(W3ID_DATA_INTEGRITY_V1_CONTEXT_DOCUMENT.clone()),
W3ID_DATA_INTEGRITY_V2_CONTEXT => Ok(W3ID_DATA_INTEGRITY_V2_CONTEXT_DOCUMENT.clone()),
BLOCKCHAIN2021_V1_CONTEXT => Ok(BLOCKCHAIN2021_V1_CONTEXT_DOCUMENT.clone()),
CITIZENSHIP_V1_CONTEXT => Ok(CITIZENSHIP_V1_CONTEXT_DOCUMENT.clone()),
VACCINATION_V1_CONTEXT => Ok(VACCINATION_V1_CONTEXT_DOCUMENT.clone()),
Expand Down

0 comments on commit 0cc4242

Please sign in to comment.