This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266 from kwek20/v2.0/did-verification-method2
[V2.0] DID fragments instead of MethodID
- Loading branch information
Showing
20 changed files
with
619 additions
and
540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,7 @@ members = [ | |
"streams", | ||
] | ||
|
||
resolver = "2" | ||
|
||
[profile.dev] | ||
incremental = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// 3rd-party | ||
use serde::Serialize; | ||
|
||
use identity_iota::{ | ||
crypto::{GetSignature, GetSignatureMut, Proof, SetSignature}, | ||
did::{MethodUriType, TryMethod}, | ||
}; | ||
|
||
#[derive(Serialize)] | ||
pub(crate) struct DataWrapper<'a> { | ||
data: &'a [u8], | ||
signature: Option<Proof>, | ||
} | ||
|
||
impl<'a> DataWrapper<'a> { | ||
pub(crate) fn new(data: &'a [u8]) -> Self { | ||
Self { data, signature: None } | ||
} | ||
|
||
pub(crate) fn with_signature(mut self, signature: Proof) -> Self { | ||
self.signature = Some(signature); | ||
self | ||
} | ||
|
||
pub(crate) fn into_signature(self) -> Option<Proof> { | ||
self.signature | ||
} | ||
} | ||
|
||
impl<'a> GetSignature for DataWrapper<'a> { | ||
fn signature(&self) -> Option<&Proof> { | ||
self.signature.as_ref() | ||
} | ||
} | ||
|
||
impl<'a> GetSignatureMut for DataWrapper<'a> { | ||
fn signature_mut(&mut self) -> Option<&mut Proof> { | ||
self.signature.as_mut() | ||
} | ||
} | ||
|
||
impl<'a> SetSignature for DataWrapper<'a> { | ||
fn set_signature(&mut self, signature: Proof) { | ||
self.signature = Some(signature) | ||
} | ||
} | ||
|
||
impl<'a> TryMethod for DataWrapper<'a> { | ||
const TYPE: MethodUriType = MethodUriType::Absolute; | ||
} |
Oops, something went wrong.