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

Using PortableDid to import did to sign VC, removing kid as default value #130

Merged
merged 14 commits into from
Mar 27, 2024

Conversation

jiyoonie9
Copy link
Contributor

@jiyoonie9 jiyoonie9 commented Mar 19, 2024

test vector changes for decentralized-identity/web5-kt#262

@jiyoonie9 jiyoonie9 marked this pull request as ready for review March 22, 2024 17:25
Copy link
Contributor

@nitro-neal nitro-neal left a comment

Choose a reason for hiding this comment

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

We made a new issue to update the credentials create() but this one will work for now (since kt the only one that consumes it)

and yup make sure web5-js works and bump the spec hash of web5-js 👍

@jiyoonie9 jiyoonie9 changed the title 234 changes Using PortableDid to import did to sign VC, removing kid as default value Mar 22, 2024
"x": "DdtN8W6x_34pB_nkxR0e1tmDkNnsJeusBAEPzKWgf_Y",
"y": "u3W135inodLqtcEb9jNGS3JsM_uFKmkJSb8Trc9luWI",
"alg": "ES256K"
"signerPortableDid": {
Copy link
Member

Choose a reason for hiding this comment

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

I am hesitant to make this change because I am not sure portable did is a concept that should be exposed in the spec.

the spec serves mainly to facilitate interop, and the serialization format of DIDs seems to be an internal feature to the SDKs. if we have a use case to enable interoperability via portable DID that would help change my mind here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair... I made this change because this test is about importing an existing did, signing a VC with the equivalent bearer did, and checking that the vcjwt created is what we expect.

In your view, how could we test this aspect of credential creation but still keep interop top of mind?

Copy link
Member

Choose a reason for hiding this comment

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

We could still define input keys (or key seeds) and expected outputs without having a common bearer did structure.

The DID working group argued about a similar concept for a while and agreed to not define a serializable representation of private keys as to avoid recommending doing it, since it's a security risk to transmit private keys.

Some DID methods do provide private keys. Others provide public keys and test for common identifier generation and document expansion, like did key: https://w3c-ccg.github.io/did-method-key/#ed25519-x25519

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm... it seems like you may not be onboard with the idea of PortableDid existing in general, because its purpose is basically to transmit private key (imo)?

if that's the case, then we need to have a bigger discussion around why portabledid should or should not exist. i'd appreciate it if you could raise it as a ticket in this repo and document your concern around it.

as far as this test vector is concerned, would you feel more comfortable if i got rid of the signerPortableDid key, and have uri, privateKeys, document directly under input key? then it's not really introducing the concept of portabledid to the test vectors, but allows the test vector consumer to still have the necessary info to create a did they can then sign the VC with to produce the same expected vector.output vcJwt?

Copy link
Member

Choose a reason for hiding this comment

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

as far as this test vector is concerned, would you feel more comfortable if i got rid of the signerPortableDid key, and have uri, privateKeys, document directly under input key? then it's not really introducing the concept of portabledid to the test vectors, but allows the test vector consumer to still have the necessary info to create a did they can then sign the VC with to produce the same expected vector.output vcJwt?

yes this works!

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we probably have a number of existing test vectors which have implementation-specific assumptions, such as the concept of a "portable DID" so even under the working assumption "portable DID" is not something to be within the web5 spec (that's my working stance) I think it pragmatic to expect to commit to a work item at some point to twease apart our test vectors for vectors which are spec-specific vs our-implementations-specific

TL;DR I agree test-vectors/portable_did/* shouldn't be where it is but we can come back later b/c we need to review all test vectors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, so there seems to be a couple opinions emerging on what test vectors should do -

  1. allow for interop with external repos that want to make sure their way of building and using DIDs and VCs is consistent with ours (this comment)

  2. allow for interop between our per-language sdk implementations to make sure we are all building and using DIDs and VCs consistent with (each other) this comment

i think it should do both, which is why i pulled out the portableDid concept out of this test vector for VC creation, and created a new test-vectors/portable_did/parse.json test vector for parsing in a portable did and importing into a bearerdid.

Copy link
Contributor

@mistermoe mistermoe Mar 27, 2024

Choose a reason for hiding this comment

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

@decentralgabe

if we have a use case to enable interoperability via portable DID that would help change my mind here.

we do. right now across our sdks, you can port a did around using PortableDid. trying to better understand how inclusion of portableDid prevents interop. couldn't third parties just ignore the "portableDid" property and go straight to private keys if desired? asking because leaving it out makes it more confusing / a bit awkward when consuming the vectors in our own sdks

Copy link
Contributor Author

@jiyoonie9 jiyoonie9 Mar 27, 2024

Choose a reason for hiding this comment

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

ok. i reverted back the changes to make it easier for other sdks to consume the portabledid when writing tests against this vector.

i think this needs a bit more discussion so wrote an issue here: #142

Copy link
Member

Choose a reason for hiding this comment

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

you can port a did around using PortableDid

I believe this has security risks and we should not support it, though I acknowledge it's useful for test vectors. Happy to continue the discussion in #142.

Copy link

@diehuxx diehuxx left a comment

Choose a reason for hiding this comment

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

lgtm. ty for testing this in both JS and KT

@KendallWeihe
Copy link
Contributor

ty for testing this in both JS and KT

@kirahsapong are you aware of this PR? Will the changes here impact web5-swift?

}
],
"document": {
"id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY",
Copy link
Contributor

Choose a reason for hiding this comment

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

is it too much to ask to use a did:jwk instead? since we deprecated did:key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this test vector specifically tests for creating a VC as a jwt with a did:key so i'd like to keep it here :)

@@ -117,8 +112,7 @@
"crv": "secp256k1",
"x": "1_o0IKHGNamet8-3VYNUTiKlhVK-LilcKrhJSPHSNP0",
"y": "qzU8qqh0wKB6JC_9HCu8pHE-ZPkDpw4AdJ-MsV2InVY",
"alg": "ES256K",
"kid": "0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw"
Copy link
Contributor

Choose a reason for hiding this comment

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

so what was the rationale for removing these kid's in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the kid is now not populated by default and computed whenever it is necessary. the test vector (previously using JWK) assumed that it would be populated by default so the test would fail.

same for alg - alg also isn't populated by default, since crv (a required field) is more accurate anyway.

@jiyoonie9 jiyoonie9 merged commit 1f0c51f into main Mar 27, 2024
1 check passed
@jiyoonie9 jiyoonie9 deleted the 234-changes branch March 27, 2024 16:35
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.

6 participants