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

add basic zcap impl based on linked-data-documents #189

Merged
merged 27 commits into from Jul 14, 2021
Merged

Conversation

chunningham
Copy link
Member

@chunningham chunningham commented May 24, 2021

An implementation of the ZCAP-LD specification. The struct is generic over caveats and actions to allow for application-specific definitions of these fields, as they are out of scope for the spec.

  • basic structure
  • basic LD-signature verification
  • capability delegations
  • capability invocations
  • tests

@wyc
Copy link
Contributor

wyc commented May 26, 2021

#125

src/zcap.rs Outdated Show resolved Hide resolved
src/vc.rs Outdated Show resolved Hide resolved
src/vc.rs Outdated Show resolved Hide resolved
src/zcap.rs Show resolved Hide resolved
src/zcap.rs Outdated Show resolved Hide resolved
src/zcap.rs Show resolved Hide resolved
Comment on lines +3 to +5
"id": "urn:uuid:ad86cb2c-e9db-434a-beae-71b82120a8a4",
"capabilityAction": "Drive",
"proof": {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a whitespace inconsistency here.

It would be nice if the example files were usable/verifiable. But testing the parsing is good too.

src/zcap.rs Outdated Show resolved Hide resolved
src/zcap.rs Outdated Show resolved Hide resolved
@clehner
Copy link
Contributor

clehner commented Jun 21, 2021

Nice work @chunningham, I like the use of generic type parameters.

@agropper
Copy link

Is there a particular use-case or set of use-cases that Spruce has in mind?

@wyc
Copy link
Contributor

wyc commented Jun 29, 2021

@agropper we are using zcaps for https://github.com/spruceid/kepler

@wyc
Copy link
Contributor

wyc commented Jun 30, 2021

Closes #125

src/ldp.rs Outdated
@@ -615,6 +615,7 @@ async fn sign(
created: Some(options.created.unwrap_or_else(now_ms)),
domain: options.domain.clone(),
challenge: options.challenge.clone(),
property_set: options.property_set.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned in https://github.com/spruceid/ssi/pull/189/files#r661613315:

I don't think property_set should be passed through into the proofs. There may be issue options that we don't support or know about but that are supposed to have a meaning other than passing them through into the proof. e.g. credentialStatus issue option is supposed to cause a credentialStatus object to be added to the document rather than to the proof: https://github.com/w3c-ccg/vc-http-api/blob/7c72ae2b470ff8dfec12d3b6c3de4f84c6f2a176/packages/vc-http-api-test-server/__tests__/issueCredential.spec.js#L130-L148

Maybe the options object with open-ended property_set, or the property_set alone, could be transcoded into a stricter version that is parameterized by the proof type and purpose (like in feat/generic_proof), so unknown properties would be caught at that point? Or it could be done non-generically, for the sake of just this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I experimented with generic property_sets for both Proof and LinkedDataProofOptions where the property_set type P for Proof<P> must implement From<&LinkedDataProofOptions<O>> (so that devs can implement how the options translate to custom proof fields). This path is blocked by some custom proof logic (e.g. P256BLAKE2BDigest...2021 expects to add the publicKeyJwk field to the proof properties). Will try a non-generic path.

Copy link
Member Author

Choose a reason for hiding this comment

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

property_set has been removed from LinkedDataProofOptions in favour of changing the ProofSuite trait to accept an additional extra_proof_properties: Option<Map<String, Value>> argument for sign and prepare.

src/ldp.rs Outdated Show resolved Hide resolved
src/zcap.rs Outdated Show resolved Hide resolved
chunningham and others added 2 commits July 6, 2021 11:30
Co-authored-by: Charles Lehner <charles.lehner@spruceid.com>
@wyc
Copy link
Contributor

wyc commented Jul 7, 2021

#125

@sbihel sbihel linked an issue Jul 7, 2021 that may be closed by this pull request
@chunningham chunningham force-pushed the feat/zcap_ld branch 3 times, most recently from aa88f2d to c54987f Compare July 14, 2021 10:55
@chunningham chunningham requested a review from clehner July 14, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement support for ZCAP-LD
5 participants