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

expanded context implementation #31

Merged
merged 7 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
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: 1 addition & 8 deletions did-utils/src/didcore.rs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give a chance to the type serde_json::Value::Object and compare how it fits?

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use chrono::{DateTime, Utc};
use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer};
use serde_json::Value;

use crate::proof::model::Proof;
use crate::{ldmodel::Context, proof::model::Proof};

// === Structure of a did document ===

Expand Down Expand Up @@ -67,13 +67,6 @@ pub struct Document {
pub proof: Option<Proofs>,
}

#[derive(Serialize, Debug, Clone, PartialEq, Deserialize)]
#[serde(untagged)]
pub enum Context {
SingleString(String),
SetOfString(Vec<String>),
}

#[derive(Serialize, Debug, Clone, PartialEq, Deserialize)]
#[serde(untagged)]
pub enum Controller {
Expand Down
2 changes: 1 addition & 1 deletion did-utils/src/didkit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Module: didkit
use crate::didcore::{Document, Context, VerificationMethod, Authentication, AssertionMethod, KeyAgreement, Service};
use crate::{didcore::{Document, VerificationMethod, Authentication, AssertionMethod, KeyAgreement, Service}, ldmodel::Context};


impl VerificationMethod {
Expand Down
13 changes: 13 additions & 0 deletions did-utils/src/ldmodel.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use serde::{Deserialize, Serialize};
use serde_json::Value;

#[derive(Serialize, Debug, Clone, PartialEq, Deserialize)]
#[serde(untagged)]
// The @context property defines the vocabulary used in the JSON-LD document.
// It provides a way to map the keys in the JSON structure to specific terms,
// properties, and classes from external vocabularies.
pub enum Context {
SingleString(String),
SetOfString(Vec<String>),
JsonObject(Value),
}
4 changes: 3 additions & 1 deletion did-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub mod crypto;
pub mod didcore;
pub mod didkit;
pub mod proof;
pub mod proof;
pub mod vc;
pub mod ldmodel;
1 change: 1 addition & 0 deletions did-utils/src/vc/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod model;
Loading
Loading