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

feat: apply new version of SD JWT package #1787

Merged
merged 26 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e877104
chore: fix test for quick
lukasjhan Feb 26, 2024
53a196b
feat: upgrade sd-jwt package
lukasjhan Feb 26, 2024
111b52f
fix: tests
lukasjhan Feb 26, 2024
84f7a4e
test: fix e2e test
lukasjhan Feb 26, 2024
5cafd53
fix verify
lukasjhan Mar 3, 2024
0c050e9
feat: update sdjwtvc package
lukasjhan Mar 3, 2024
62146f2
fix yarn lock
lukasjhan Mar 3, 2024
f0f7c92
test: add description(decoded) on test sd-jwt
lukasjhan Mar 3, 2024
87fd571
Revert "chore: fix test for quick"
lukasjhan Mar 3, 2024
3495bcd
chore: include ts dom lib, to find JsonWebKey
lukasjhan Mar 4, 2024
054dbd9
Revert "chore: include ts dom lib, to find JsonWebKey"
lukasjhan Mar 4, 2024
07e3c78
chore: update sd-jwt package version
lukasjhan Mar 4, 2024
ba30c19
chore: update sdjwt package
lukasjhan Mar 6, 2024
55bb6fb
chore: update package 0.4.0
lukasjhan Mar 10, 2024
190a38e
feat: restore presentationFrame
lukasjhan Mar 10, 2024
6500149
chore: fix test for quick
lukasjhan Feb 26, 2024
af95b18
feat: restore type
lukasjhan Mar 10, 2024
d029bc5
test: fix test
lukasjhan Mar 10, 2024
3593597
Revert "chore: fix test for quick"
lukasjhan Mar 10, 2024
42eb16e
Merge remote-tracking branch 'upstream/main' into upgrade/sdjwt
TimoGlastra Mar 18, 2024
a6f666a
fix: signature is base64 url
TimoGlastra Mar 18, 2024
e5254ea
test: fix type
lukasjhan Mar 18, 2024
31dda2a
updates
TimoGlastra Apr 24, 2024
31fd6ab
Merge remote-tracking branch 'upstream/main' into upgrade/sdjwt
lukasjhan Apr 24, 2024
064da30
feat: use wider type def
lukasjhan Apr 24, 2024
cdf2d3d
Merge remote-tracking branch 'upstream/main' into upgrade/sdjwt
TimoGlastra Apr 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"@digitalcredentials/jsonld-signatures": "^9.4.0",
"@digitalcredentials/vc": "^6.0.1",
"@multiformats/base-x": "^4.0.1",
"@sd-jwt/core": "^0.2.1",
"@sd-jwt/decode": "^0.2.1",
"@sd-jwt/core": "^0.6.0",
"@sd-jwt/decode": "^0.6.0",
"@sd-jwt/types": "^0.6.0",
"@sd-jwt/utils": "^0.6.0",
"@sphereon/pex": "3.3.0",
"@sphereon/pex-models": "^2.2.2",
"@sphereon/ssi-types": "^0.18.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ export class DifPresentationExchangeService {
const sdJwtVcApi = this.getSdJwtVcApi(agentContext)
const sdJwtVc = await sdJwtVcApi.present({
compactSdJwtVc: sdJwtInput.compactSdJwtVc,
// SD is already handled by PEX
presentationFrame: true,
// SD is already handled by PEX, so we presents all keys
presentationFrame: undefined,
verifierMetadata: {
audience: domain,
nonce: challenge,
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/modules/sd-jwt-vc/SdJwtVcApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
SdJwtVcPayload,
SdJwtVcPresentOptions,
SdJwtVcVerifyOptions,
SdJwtVcGetPresentationKeysOptions,
} from './SdJwtVcOptions'
import type { SdJwtVcRecord } from './repository'
import type { Query } from '../../storage/StorageService'
Expand Down Expand Up @@ -37,10 +38,10 @@ export class SdJwtVcApi {
*
* Also, whether to include the holder key binding.
*/
public async present<Header extends SdJwtVcHeader, Payload extends SdJwtVcPayload>(
public async present<Payload extends SdJwtVcPayload = SdJwtVcPayload>(
options: SdJwtVcPresentOptions<Payload>
): Promise<string> {
return await this.sdJwtVcService.present<Header, Payload>(this.agentContext, options)
return await this.sdJwtVcService.present(this.agentContext, options)
}

/**
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/modules/sd-jwt-vc/SdJwtVcOptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { JwkJson, Jwk } from '../../crypto'
import type { HashName } from '../../utils'
import type { DisclosureFrame, PresentationFrame } from '@sd-jwt/core'
import type { DisclosureFrame, PresentationFrame } from '@sd-jwt/types'

// TODO: extend with required claim names for input (e.g. vct)
export type SdJwtVcPayload = Record<string, unknown>
Expand Down Expand Up @@ -47,7 +47,7 @@ export type SdJwtVcPresentOptions<Payload extends SdJwtVcPayload = SdJwtVcPayloa
/**
* Use true to disclose everything
*/
Comment on lines 58 to 60
Copy link
Contributor

Choose a reason for hiding this comment

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

I thin true was removed, what is now the way to disclose everything vs nothing? Can you update the comment?

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'll update it :)
FYI:

  • disclose everything: presentationFrame: undefined
  • disclose nothing: presentationFrame: {} // empty object

presentationFrame: PresentationFrame<Payload> | true
presentationFrame?: PresentationFrame<Payload>

/**
* This information is received out-of-band from the verifier.
Expand All @@ -60,6 +60,10 @@ export type SdJwtVcPresentOptions<Payload extends SdJwtVcPayload = SdJwtVcPayloa
}
}

export type SdJwtVcGetPresentationKeysOptions = {
compactSdJwtVc: string
}
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 this can be removed, as we don't need the getPresentableKeys method anymore right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes your correct. I'll remove all code related getPresentableKeys


export type SdJwtVcVerifyOptions = {
compactSdJwtVc: string

Expand Down
Loading
Loading