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

Modular did:key representation #912

Merged
merged 3 commits into from
Aug 10, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ wrappers/ios_legacy/vcx/vcx.framework/**
wrappers/ios_legacy/vcx/vcx.framework.dSYM/**
.vscode
**/tails.txt
.session.vim
80 changes: 53 additions & 27 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ members = [
"uniffi_aries_vcx/core",
"did_doc",
"did_peer",
"did_key",
"did_doc_sov",
"did_parser",
"did_resolver",
"did_resolver_registry",
"did_resolver_sov",
"did_resolver_web",
"public_key",
"indy_ledger_response_parser",
"wallet_migrator",
"tools/simple_message_relay"
Expand Down
3 changes: 1 addition & 2 deletions did_doc_sov/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ name = "did_doc_sov"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
did_doc = { path = "../did_doc" }
did_key = { path = "../did_key" }
serde = { version = "1.0.159", default-features = false, features = ["derive"] }
serde_json = "1.0.95"
thiserror = "1.0.40"
3 changes: 3 additions & 0 deletions did_doc_sov/src/extra_fields/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fmt::Display;

use did_doc::did_parser::DidUrl;
use did_key::DidKey;
use serde::{Deserialize, Deserializer, Serialize};

use crate::error::DidDocumentSovError;
Expand Down Expand Up @@ -66,6 +67,7 @@ impl Serialize for AcceptType {
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(untagged)]
pub enum KeyKind {
DidKey(DidKey),
Reference(DidUrl),
Value(String),
}
Expand All @@ -75,6 +77,7 @@ impl Display for KeyKind {
match self {
KeyKind::Reference(did_url) => write!(f, "{}", did_url),
KeyKind::Value(value) => write!(f, "{}", value),
KeyKind::DidKey(did_key) => write!(f, "{}", did_key),
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions did_key/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "did_key"
version = "0.1.0"
edition = "2021"

[dependencies]
public_key = { path = "../public_key" }
did_parser = { path = "../did_parser" }
serde = "1.0.175"
serde_json = "1.0.103"
thiserror = "1.0.44"
9 changes: 9 additions & 0 deletions did_key/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use thiserror::Error;

#[derive(Debug, Error)]
pub enum DidKeyError {
#[error("Public key error: {0}")]
PublicKeyError(#[from] public_key::PublicKeyError),
#[error("DID parser error: {0}")]
DidParserError(#[from] did_parser::ParseError),
}
Loading
Loading