Skip to content

fix(cheqd): Populate contexts for JsonLD issuance #2250

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

Open
wants to merge 12 commits into
base: v0.5.x
Choose a base branch
from

Conversation

DaevMithran
Copy link
Contributor

@DaevMithran DaevMithran commented Apr 7, 2025

we are facing an issue in JSONLD issuance with credo, and issue is with the default document loader

DidDocument {
	context: ['https://www.w3.org/ns/did/v1', 'https://w3id.org/did/v1', 'https://w3id.org/security/suites/jws-2020/v1', 'https://w3id.org/security/suites/ed25519-2018/v1'],
	id: 'did:cheqd:testnet:151734ba-d9c8-4bf6-a83c-bc4098b10ac6',
	controller: [],
	verificationMethod: [ VerificationMethod {
		id: 'did:cheqd:testnet:151734ba-d9c8-4bf6-a83c-bc4098b10ac6#z6MktzU5kM5XdEKmGrZwXfQEa3jZAyexhmP7iNDMotin4GcR',
		type: 'Ed25519VerificationKey2018',
		controller: 'did:cheqd:testnet:151734ba-d9c8-4bf6-a83c-bc4098b10ac6',
		publicKeyBase58: 'FYD3A6q6HgqJAMjEr6SPixBZMQP7Ht8m2MJRyckm93q3'
	}],
	authentication: ['did:cheqd:testnet:151734ba-d9c8-4bf6-a83c-bc4098b10ac6#z6MktzU5kM5XdEKmGrZwXfQEa3jZAyexhmP7iNDMotin4GcR'],
	assertionMethod: ['did:cheqd:testnet:151734ba-d9c8-4bf6-a83c-bc4098b10ac6#z6MktzU5kM5XdEKmGrZwXfQEa3jZAyexhmP7iNDMotin4GcR']
}

This is the input for jsond.frame in default document loader

The result is missing the publicKeyBase58, same is the case for other signature suites.

{
	'@context': ['https://w3id.org/did/v1', 'https://w3id.org/security/suites/jws-2020/v1'],
	id: 'did:cheqd:testnet:efa002a1-ea59-4a87-9fe9-1be2919886d7#z6MkqzAn7GL2srNkmFN8iPXfPKCHfHvY5eTeRUFTeN1xYLsa',
	type: 'Ed25519VerificationKey2018',
	controller: 'did:cheqd:testnet:efa002a1-ea59-4a87-9fe9-1be2919886d7'
}

Copy link

changeset-bot bot commented Apr 7, 2025

🦋 Changeset detected

Latest commit: ae6ba78

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@credo-ts/cheqd Patch
@credo-ts/action-menu Patch
@credo-ts/anoncreds Patch
@credo-ts/askar Patch
@credo-ts/bbs-signatures Patch
@credo-ts/core Patch
@credo-ts/drpc Patch
@credo-ts/indy-sdk-to-askar-migration Patch
@credo-ts/indy-vdr Patch
@credo-ts/node Patch
@credo-ts/openid4vc Patch
@credo-ts/question-answer Patch
@credo-ts/react-native Patch
@credo-ts/tenants Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Signed-off-by: DaevMithran <daevmithran1999@gmail.com>
@tweeddalex
Copy link

Hey @TimoGlastra @berendsliedrecht appreciate you're probably slammed busy with EIC and other work, but it would be great if you could find a few mins to take a look at this one

@TimoGlastra
Copy link
Contributor

So it seems that the document that is passed to the frame method only contains the following context:

"@context": [
        "https://w3id.org/did/v1",
        "https://w3id.org/security/suites/jws-2020/v1"
],

And thus it's missing the required https://w3id.org/security/suites/ed25519-2018/v1 context (which is present in the input you posted above).

On uniresolver (https://dev.uniresolver.io/) it does return the correct ed25519 context.

It seems that we directly use the document received from the SDK, as I can't find where we set the @context on the document when we resolve a cheqd did

@tweeddalex
Copy link

Thanks @TimoGlastra we're now working on a fix in our SDK to align the context handling with how our DID Resolver works!

sownak and others added 2 commits May 14, 2025 10:35
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: DaevMithran <daevmithran1999@gmail.com>
@DaevMithran
Copy link
Contributor Author

@TimoGlastra the resolveDid in cheqd populates the context as expected. But we noticed the contexts were missing in the didRecord saved within the wallet. For issuance shouldn't the flow resolve the DID instead of relying on the didRecord locally for the DIDDocument

Signed-off-by: Sownak Roy <sownak@cheqd.io>
@TimoGlastra
Copy link
Contributor

TimoGlastra commented May 14, 2025

@DaevMithran for now we assume all updates are made through credo and thus the local record should match. It's very inefficient to resolve the did every time you want to issue. We could do a periodic fetch, but I'd rather rely on the local record. I think we should fix the inconsistency between the cheqd ledger record and the local did record

DaevMithran and others added 5 commits May 14, 2025 16:43
Signed-off-by: DaevMithran <daevmithran1999@gmail.com>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <20537268+sownak@users.noreply.github.com>
@DaevMithran DaevMithran changed the title test(cheqd): Add JsonLD issuance test cheqd fix(cheqd): Populate contexts for JsonLD issuance May 16, 2025
…wallet

Signed-off-by: DaevMithran <daevmithran1999@gmail.com>
sownak added 2 commits May 16, 2025 09:40
Signed-off-by: Sownak Roy <sownak@cheqd.io>
…in context

Signed-off-by: Sownak Roy <sownak@cheqd.io>
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.

4 participants