Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contexts): add linked-vp #548

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/contexts/linked-vp-v1.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": [
{
"@version": 1.1,
"@protected": true,
"LinkedVerifiablePresentation": "https://identity.foundation/linked-vp/contexts/v1#LinkedVerifiablePresentation"
}
]
}
1 change: 1 addition & 0 deletions crates/contexts/src/lib.rs
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@ pub const DID_CONFIGURATION_V0_0: &str = include_str!("../did-configuration-v0.0
/// <https://identity.foundation/.well-known/did-configuration/v1>
pub const DID_CONFIGURATION_V1: &str = include_str!("../did-configuration-v1.jsonld");
pub const JFF_VC_EDU_PLUGFEST_2022_2: &str = include_str!("../jff-vc-edu-plugfest-2-context.json");
pub const LINKED_VP_V1: &str = include_str!("../linked-vp-v1.jsonld");

pub const TZ_V2: &str = include_str!("../tz-2021-v2.jsonld");
pub const TZVM_V1: &str = include_str!("../tzvm-2021-v1.jsonld");
1 change: 1 addition & 0 deletions crates/contexts/update.sh
Original file line number Diff line number Diff line change
@@ -28,5 +28,6 @@ exec curl \
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 \
https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/jff-vc-edu-plugfest-1-context.json -o jff-vc-edu-plugfest-1-context.json \
https://identity.foundation/linked-vp/contexts/v1 -o linked-vp-v1.jsonld \
https://identity.foundation/.well-known/did-configuration/v1 -o did-configuration-v1.jsonld \
-L
6 changes: 6 additions & 0 deletions crates/json-ld/src/contexts.rs
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ pub const DID_CONFIGURATION_V1_CONTEXT: &Iri =
iri!("https://identity.foundation/.well-known/did-configuration/v1");
pub const JFF_VC_EDU_PLUGFEST_2022_2_CONTEXT: &Iri =
iri!("https://purl.imsglobal.org/spec/ob/v3p0/context.json");
pub const LINKED_VP_V1_CONTEXT: &Iri = iri!("https://identity.foundation/linked-vp/contexts/v1");

/// Load a remote context from its static definition.
fn load_static_context(iri: &Iri, content: &str) -> RemoteDocument {
@@ -228,6 +229,10 @@ lazy_static::lazy_static! {
JFF_VC_EDU_PLUGFEST_2022_2_CONTEXT,
ssi_contexts::JFF_VC_EDU_PLUGFEST_2022_2
);
pub static ref LINKED_VP_V1_CONTEXT_DOCUMENT: RemoteDocument = load_static_context(
LINKED_VP_V1_CONTEXT,
ssi_contexts::LINKED_VP_V1
);
}

macro_rules! iri_match {
@@ -309,6 +314,7 @@ impl Loader for StaticLoader {
JFF_VC_EDU_PLUGFEST_2022_2_CONTEXT => {
Ok(JFF_VC_EDU_PLUGFEST_2022_2_CONTEXT_DOCUMENT.clone())
},
LINKED_VP_V1_CONTEXT => { Ok(LINKED_VP_V1_CONTEXT_DOCUMENT.clone()) },
_ as iri => Err(LoadError::new(iri.to_owned(), UnknownContext))
}
}