decentralized-identity / veramo

A JavaScript Framework for Verifiable Data
https://veramo.io
Apache License 2.0
414 stars 130 forks source link

Integrate the SD-JWT #1358

Open lukasjhan opened 4 months ago

lukasjhan commented 4 months ago

Hi I'm currently developing sd-jwt typescript library in Open Wallet Foundation with @cre8. I want to continuously contribute to Veramo by working on sd-jwt-related integration.

Related Issue: #1276

This is my first time contributing to Veramo. If there is anything you would like to change, please let me know. I'm open to any changes :)

What issue is this PR fixing

Example: closes #123 fixes #456

Linking to an issue provides some context and a reason for the PR to be reviewed, as well as simplifying the release notes and changelogs that get generated automatically. If an issue is linked like this it will be automatically closed when the PR is merged.

What is being changed

Add SD-JWT features in Veramo

Quality

Check all that apply:

Details

sd-jwt package has 4 main features

About Testing

This is the sample of tests, but

I failed setup the agent in test file in this way

const context = {
  agent: {
    execute: jest.fn(),
    availableMethods: jest.fn(),
    getSchema: jest.fn(),
    emit: jest.fn(),
  },
} as IAgentContext<any>

If there is a guide on how to set up this context, please let me know and I will add it.

Or, this is the original test file in cre8's repo. https://github.com/cre8/sd-jwt-veramo/blob/main/src/agent-plugin/sd-jwt-plugin.spec.ts If it's okay to add it like this, then I'll add it like this.

Please take a look and let me know about the test. Thank you.

cre8 commented 4 months ago

At this point I don't feel well opening the PR to the veramo repo yet. Linting is based on biome and not prettier, testing on vitest and not jest.

lukasjhan commented 4 months ago

At this point I don't feel well opening the PR to the veramo repo yet. Linting is based on biome and not prettier, testing on vitest and not jest.

Okay, I'll make it draft and keep working on here. :)

lukasjhan commented 3 months ago

@cre8 I added test and fixed the schema generation :)

lukasjhan commented 3 months ago

Good I'll definitely add this module test-react-app :) I'll do it after I resolved all comments.

vadimchilinciuc commented 3 weeks ago

Hi @lukasjhan and @cre8 :) maybe this is not the thread but i want to try to ask you a question maybe you can help me . To bee compliant in the European (EUDI) the format is SD-JWT with OpenID4VC ; do you think at this moment its possible realize something with OpenID4VC? Cause i see something like https://github.com/IDunion/OpenIDIDComm but they dont support SD-JWT ? :( (under the hood they use sphereon sdk but they dont support SD_JWT) )did you guys use with OpenID4VC or without it . Thanks a lot for your reply .

cre8 commented 3 weeks ago

Hi @lukasjhan and @cre8 :) maybe this is not the thread but i want to try to ask you a question maybe you can help me . To bee compliant in the European (EUDI) the format is SD-JWT with OpenID4VC ; do you think at this moment its possible realize something with OpenID4VC? Cause i see something like https://github.com/IDunion/OpenIDIDComm but they dont support SD-JWT ? :( did you guys use with OpenID4VC or without it , thanks a lot for your reply in case i'll cancel my comment .

Yes, it's possible, I implemented it here: https://github.com/openwallet-foundation-labs/credhub This project comes without using verano, but it should be possible with the verano plugin for oid4vci by sphereon

nklomp commented 3 weeks ago

Also be aware that sd-jwt is supported by our lower level libraries, including our credential mappers. If you include the sd-jwt veramo plugin into the idunion didcomm project using our SDK it should work including presentation exchange etc

vadimchilinciuc commented 3 weeks ago

Also be aware that sd-jwt is supported by our lower level libraries, including our credential mappers. If you include the sd-jwt veramo plugin into the idunion didcomm project using our SDK it should work including presentation exchange etc

Thanks a lot @nklomp : I think the problem will bee that the IDunion Project use the @sphereon/ssi-sdk.oid4vci-issuer package,tha is a Veramo Plugin

// Creating a creadential we have this snippet :

        const response = await agent.oid4vciIssueCredential({
            credential: credential,
            credentialIssuer: this.store_id,
            credentialRequest: {
                format: 'jwt_vc_json', **_// allowing formats are those types = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc';_**
                proof: request.proof,
                types: request.types
            }
        })

i think i will get some kind of error passing a sd-jwt type; cause the allowing formats are only those types = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc'; ? Thanks a lot for reply

nklomp commented 3 weeks ago

Since that is using our low-level libs, which have sd-jwt support it should work at that point. Having said that, we are actually integrating sd-jwt into our SDKs, wallets and agents as we speak. So we should have this working probably next week.