-
Notifications
You must be signed in to change notification settings - Fork 55
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
Reworked w3c credentials and presentations to use DataIntegrityProof instead of custom AnonCreds context #291
Merged
swcurran
merged 24 commits into
hyperledger:main
from
DSRCorporation:anoncreds-w3c-format-changes
Jan 11, 2024
+2,246
−1,909
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3018ce6
Code clean up
Artemkaaas 7f94ee1
Drop explicit mapping
Artemkaaas fff5700
Fixed merge errors
Artemkaaas f37fe19
feat: Cover w3/verifier service with unit tests
Abdulbois c1f4098
Refactored verifier tests
Artemkaaas 61229fc
Refactor and add unit tests into w3c/verifier service
Abdulbois aa1c030
Corrected tests for interval override
Artemkaaas 3b899c3
Corrected demo test for missing attribute
Artemkaaas ee628db
Code refactoring
Artemkaaas 895fb3f
Added check of encoded attributes
Artemkaaas 2cb5373
Fixed rebase errors
Artemkaaas 677df35
Reworked w3c credentials and presentations to match new design
Artemkaaas 00e98cb
Added helper method to get anoncred integrity proof details
Artemkaaas 08a26ec
Clean up proof structure
Artemkaaas a2a178e
Corrected cross installation to use its lock file
Artemkaaas fbde450
Corrected context definition
Artemkaaas 2e76692
Code refactoring
Artemkaaas a97b32f
Corrected proof value encoding
Artemkaaas 90554f0
Process review comments
Artemkaaas da90f11
Removed empty file
Artemkaaas 9efd971
Added proofPurpose and verificationMethod to proof
Artemkaaas 8395ad0
Added proofPurpose and verificationMethod to proof
Artemkaaas 2696d43
Not set credentialSubject `id` when derive credential
Artemkaaas 4ae0d15
Merge remote-tracking branch 'origin/main' into anoncreds-w3c-format-…
Artemkaaas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,43 @@ | ||
use crate::data_types::w3c::context::{Context, Contexts}; | ||
use once_cell::sync::Lazy; | ||
use serde_json::{json, Value}; | ||
use std::collections::HashSet; | ||
|
||
use crate::data_types::w3c::credential::{Contexts, Types}; | ||
use crate::data_types::w3c::credential::Types; | ||
use crate::data_types::w3c::uri::URI; | ||
|
||
// Contexts | ||
pub const W3C_CONTEXT: &str = "https://www.w3.org/2018/credentials/v1"; | ||
pub const W3C_ANONCREDS_CONTEXT: &str = "https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"; | ||
pub const W3C_VC_1_1_BASE_CONTEXT: &str = "https://www.w3.org/2018/credentials/v1"; | ||
pub const W3C_VC_2_0_BASE_CONTEXT: &str = "https://www.w3.org/ns/credentials/v2"; | ||
pub const W3C_DATA_INTEGRITY_CONTEXT: &str = "https://w3id.org/security/data-integrity/v2"; | ||
|
||
// Types | ||
pub const W3C_CREDENTIAL_TYPE: &str = "VerifiableCredential"; | ||
pub const W3C_PRESENTATION_TYPE: &str = "VerifiablePresentation"; | ||
pub const W3C_ANONCREDS_CREDENTIAL_TYPE: &str = "AnonCredsCredential"; | ||
pub const W3C_ANONCREDS_PRESENTATION_TYPE: &str = "AnonCredsPresentation"; | ||
|
||
pub(crate) static ANONCREDS_CONTEXTS: Lazy<Contexts> = Lazy::new(|| { | ||
Contexts(HashSet::from([ | ||
URI::from(W3C_CONTEXT), | ||
URI::from(W3C_ANONCREDS_CONTEXT), | ||
])) | ||
pub static ISSUER_DEPENDENT_VOCABULARY: Lazy<Value> = Lazy::new(|| { | ||
json!({ | ||
"@vocab": "https://www.w3.org/ns/credentials/issuer-dependent#" | ||
}) | ||
}); | ||
|
||
pub(crate) static ANONCREDS_CREDENTIAL_TYPES: Lazy<Types> = Lazy::new(|| { | ||
Types(HashSet::from([ | ||
String::from(W3C_CREDENTIAL_TYPE), | ||
String::from(W3C_ANONCREDS_CREDENTIAL_TYPE), | ||
])) | ||
pub(crate) static ANONCREDS_VC_1_1_CONTEXTS: Lazy<Contexts> = Lazy::new(|| { | ||
Contexts(vec![ | ||
Context::URI(URI::from(W3C_VC_1_1_BASE_CONTEXT)), | ||
Context::URI(URI::from(W3C_DATA_INTEGRITY_CONTEXT)), | ||
Context::Object(ISSUER_DEPENDENT_VOCABULARY.clone()), | ||
]) | ||
}); | ||
|
||
pub(crate) static ANONCREDS_PRESENTATION_TYPES: Lazy<Types> = Lazy::new(|| { | ||
Types(HashSet::from([ | ||
String::from(W3C_PRESENTATION_TYPE), | ||
String::from(W3C_ANONCREDS_PRESENTATION_TYPE), | ||
])) | ||
pub(crate) static ANONCREDS_VC_2_0_CONTEXTS: Lazy<Contexts> = Lazy::new(|| { | ||
Contexts(vec![ | ||
Context::URI(URI::from(W3C_VC_2_0_BASE_CONTEXT)), | ||
Context::Object(ISSUER_DEPENDENT_VOCABULARY.clone()), | ||
]) | ||
}); | ||
|
||
// Types | ||
pub const W3C_CREDENTIAL_TYPE: &str = "VerifiableCredential"; | ||
pub const W3C_PRESENTATION_TYPE: &str = "VerifiablePresentation"; | ||
|
||
pub(crate) static ANONCREDS_CREDENTIAL_TYPES: Lazy<Types> = | ||
Lazy::new(|| Types(HashSet::from([String::from(W3C_CREDENTIAL_TYPE)]))); | ||
|
||
pub(crate) static ANONCREDS_PRESENTATION_TYPES: Lazy<Types> = | ||
Lazy::new(|| Types(HashSet::from([String::from(W3C_PRESENTATION_TYPE)]))); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swcurran my suggestion would still be to add some more dashes, and make pres -> proof. Proof is what also seems to have been used in bbs suite.
So anoncreds-vc-2023 and anoncreds-vc-proof-2023. Or maybe something like ac-vc-23 and ac-vc-proof-23 (or cl-vc-23)