Skip to content

Commit

Permalink
Add CACAO-ZCAP context
Browse files Browse the repository at this point in the history
  • Loading branch information
clehner committed May 12, 2022
1 parent 05e229f commit 3fc36d8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
29 changes: 29 additions & 0 deletions contexts/cacao-zcap-v1.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"@context": {
"@protected": true,
"validFrom": {
"@id": "https://www.w3.org/2018/credentials#validFrom",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"CacaoZcap2022": {
"@id": "https://demo.didkit.dev/2022/cacao-zcap/#CacaoZcap2022",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"cacaoPayloadType": "https://demo.didkit.dev/2022/cacao-zcap/#cacaoPayloadType",
"cacaoZcapSubstatement": "https://demo.didkit.dev/2022/cacao-zcap/#cacaoZcapSubstatement",
"cacaoRequestId": "https://demo.didkit.dev/2022/cacao-zcap/#cacaoRequestId"
}
},
"CacaoZcapProof2022": {
"@id": "https://demo.didkit.dev/2022/cacao-zcap/#CacaoZcapProof2022",
"@context": {
"@protected": true,
"id": "@id",
"type": "@type",
"cacaoSignatureType": "https://demo.didkit.dev/2022/cacao-zcap/#cacaoSignatureType"
}
}
}
}
2 changes: 2 additions & 0 deletions contexts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub const VDL_V1: &str = include_str!("../w3id-vdl-v1.jsonld");
pub const WALLET_V1: &str = include_str!("../w3id-wallet-v1.jsonld");
/// <https://w3id.org/zcap/v1>
pub const ZCAP_V1: &str = include_str!("../w3id-zcap-v1.jsonld");
/// <https://demo.didkit.dev/2022/cacao-zcap/contexts/v1.json>
pub const CACAO_ZCAP_V1: &str = include_str!("../cacao-zcap-v1.jsonld");

pub const TZ_V2: &str = include_str!("../tz-2021-v2.jsonld");
pub const TZVM_V1: &str = include_str!("../tzvm-2021-v1.jsonld");
Expand Down
1 change: 1 addition & 0 deletions contexts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ exec curl \
https://w3id.org/zcap/v1 -o w3id-zcap-v1.jsonld \
https://w3id.org/vc-revocation-list-2020/v1 -o w3id-vc-revocation-list-2020-v1.jsonld \
https://w3id.org/vc/status-list/2021/v1 -o w3id-vc-status-list-2021-v1.jsonld \
https://demo.didkit.dev/2022/cacao-zcap/contexts/v1.json -o cacao-zcap-v1.jsonld \
-L
8 changes: 8 additions & 0 deletions src/jsonld.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ pub const PRESENTATION_SUBMISSION_V1_CONTEXT: &str =
pub const VDL_V1_CONTEXT: &str = "https://w3id.org/vdl/v1";
pub const WALLET_V1_CONTEXT: &str = "https://w3id.org/wallet/v1";
pub const ZCAP_V1_CONTEXT: &str = "https://w3id.org/zcap/v1";
pub const CACAO_ZCAP_V1_CONTEXT: &str = "https://demo.didkit.dev/2022/cacao-zcap/contexts/v1.json";

lazy_static! {
pub static ref CREDENTIALS_V1_CONTEXT_DOCUMENT: RemoteDocument<JsonValue> = {
Expand Down Expand Up @@ -317,6 +318,12 @@ lazy_static! {
let iri = Iri::new(ZCAP_V1_CONTEXT).unwrap();
RemoteDocument::new(doc, iri)
};
pub static ref CACAO_ZCAP_V1_CONTEXT_DOCUMENT: RemoteDocument<JsonValue> = {
let jsonld = ssi_contexts::CACAO_ZCAP_V1;
let doc = json::parse(jsonld).unwrap();
let iri = Iri::new(CACAO_ZCAP_V1_CONTEXT).unwrap();
RemoteDocument::new(doc, iri)
};
}

pub struct StaticLoader;
Expand Down Expand Up @@ -366,6 +373,7 @@ impl Loader for StaticLoader {
VDL_V1_CONTEXT => Ok(VDL_V1_CONTEXT_DOCUMENT.clone()),
WALLET_V1_CONTEXT => Ok(WALLET_V1_CONTEXT_DOCUMENT.clone()),
ZCAP_V1_CONTEXT => Ok(ZCAP_V1_CONTEXT_DOCUMENT.clone()),
CACAO_ZCAP_V1_CONTEXT => Ok(CACAO_ZCAP_V1_CONTEXT_DOCUMENT.clone()),
_ => {
eprintln!("unknown context {}", url);
Err(json_ld::ErrorCode::LoadingDocumentFailed.into())
Expand Down

0 comments on commit 3fc36d8

Please sign in to comment.