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: dcql alpha #2098

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

Conversation

auer-martin
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Nov 21, 2024

🦋 Changeset detected

Latest commit: af89f1a

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/openid4vc Minor
@credo-ts/core Minor
@credo-ts/action-menu Minor
@credo-ts/anoncreds Minor
@credo-ts/askar Minor
@credo-ts/bbs-signatures Minor
@credo-ts/cheqd Minor
@credo-ts/drpc Minor
@credo-ts/indy-sdk-to-askar-migration Minor
@credo-ts/indy-vdr Minor
@credo-ts/node Minor
@credo-ts/question-answer Minor
@credo-ts/react-native Minor
@credo-ts/tenants Minor

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: Martin Auer <[email protected]>
Copy link
Contributor

@TimoGlastra TimoGlastra left a comment

Choose a reason for hiding this comment

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

Very nice!

packages/core/src/modules/dcql/DcqlService.ts Outdated Show resolved Hide resolved
packages/core/src/modules/dcql/DcqlService.ts Outdated Show resolved Hide resolved
for (const credentialQueryId of firstFullFillableOption) {
const credential = dcqlQueryResult.credential_matches[credentialQueryId]

if (credential.success && credential.record.type === 'MdocRecord' && 'namespaces' in credential.output) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I usually prefer adding a diferentiator key that then also defiens the type of credential.

So credential has a format key and if it is mso_mdoc then output has namespaces.

}

// TODO: this IS WRONG
private createPresentationFrame(obj: Record<string, JsonValue>): IPresentationFrame {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes for SdJwt presentations. Will fix it in the weekend

packages/core/src/modules/dcql/DcqlService.ts Outdated Show resolved Hide resolved
packages/openid4vc/tests/openid4vc.e2e.test.ts Outdated Show resolved Hide resolved
if (result.success) {
if (result.output.credential_format === 'vc+sd-jwt') {
const sdJwtVcRecord = credentialRecords[result.input_credential_index] as SdJwtVcRecord
agentContext.dependencyManager
Copy link
Contributor

Choose a reason for hiding this comment

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

The return value of this call is not used

Comment on lines 116 to 128
const transformValue = (value: unknown): unknown => {
if (typeof value !== 'function' && typeof value !== 'object') return value
return isToJsonable(value) ? value.toJson() : 'unknown json representation'
}

const mdoc = Mdoc.fromBase64Url(record.base64Url)

const namespaces = Object.fromEntries(
Object.entries(mdoc.issuerSignedNamespaces).map(([key, namespace]) => [
key,
Object.fromEntries(Object.entries(namespace).map(([k, v]) => [k, transformValue(v)])),
])
)
Copy link
Contributor

Choose a reason for hiding this comment

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

here you still convert to json? shouldn't this be handled by dcql?

Comment on lines 153 to 163
const claims = agentContext.dependencyManager
.resolve(SdJwtVcService)
.applyDisclosuresForPayload(sdJwtVcRecord.compactSdJwtVc, result.output.claims)
return [
credential_query_id,
{
...result,
output: { ...result.output, claims },
record: credentialRecords[result.input_credential_index],
},
]
Copy link
Contributor

Choose a reason for hiding this comment

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

This returns the whole sd jwt vc. not the claims.

So should do claims.prettyClaims

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.

2 participants