Skip to content

Commit

Permalink
Added DID meta data and DID resolution metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Gayan committed Sep 9, 2021
1 parent 9940164 commit 291b5a4
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 153 deletions.
45 changes: 37 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pallets/dids/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ serde = { version = "1.0.119" }
sp-core = { default-features = false, version = '3.0.0' }
sp-io = { default-features = false, version = '3.0.0' }
sp-runtime = { default-features = false, version = '3.0.0' }
rstest = { version = "0.11.0" }

[features]
default = ['std']
Expand Down
10 changes: 6 additions & 4 deletions pallets/dids/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ pub mod pallet {
pub fn insert_did_document(
origin: OriginFor<T>,
did_document: Vec<u8>,
did_document_metadata: Option<Vec<u8>>,
did_resolution_metadata: Option<Vec<u8>>,
sender_account_id: <T as frame_system::Config>::AccountId,
did_hash: Vec<u8>,
) -> DispatchResultWithPostInfo {
let origin_account = ensure_signed(origin)?;
Expand All @@ -252,13 +255,12 @@ pub mod pallet {
DIDDocument::<T>::insert(
did_hash.clone(),
DID {
did_uri: None,
did_document,
did_document_metadata,
did_resolution_metadata,
block_number,
block_time_stamp: time,
did_ref: None,
sender_account_id: origin_account.clone(),
active: Some(true),
sender_account_id,
},
);

Expand Down
13 changes: 10 additions & 3 deletions pallets/dids/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ pub struct DIDDetail<T: Config> {
#[derive(Clone, Decode, Encode, Eq, PartialEq)]
pub struct DID<T: Config> {
// DID Document hash: Vec<u8>,
pub did_uri: Option<Vec<u8>>,
// pub did_uri: Option<Vec<u8>>,

// DID Document
pub did_document: Vec<u8>,
// pub did_document: Vec<u8>,

// DID Resolution Metadata
pub did_resolution_metadata: Option<Vec<u8>>,

// DID Document Metadata
pub did_document_metadata: Option<Vec<u8>>,

// Block number
pub block_number: <T as frame_system::Config>::BlockNumber,
// Block time stamp in ISO 8601 format
pub block_time_stamp: u64,
Expand All @@ -33,7 +40,7 @@ pub struct DID<T: Config> {
pub sender_account_id: <T as frame_system::Config>::AccountId,

// Active status
pub active: Option<bool>,
// pub active: Option<bool>,
}

#[derive(Clone, Decode, Encode, Eq, PartialEq)]
Expand Down
Loading

0 comments on commit 291b5a4

Please sign in to comment.