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

chore: Added jwt payload to the externalOIDFIdentifier.ts #55

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { IAgentContext } from '@veramo/core'
import { IOIDFClient } from '@sphereon/ssi-sdk.oidf-client'
import { contextHasPlugin } from '@sphereon/ssi-sdk.agent-config'
import { IJwsValidationResult } from '../types/IJwtService'
import {decodeBase64url} from "@veramo/utils";
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not include veramo utils. It deps on almost everything in veramo.

We have functions for base64 url decoding. And otherwise it is as simple as u8a.fromString(input, 'base64url')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced with uint8arrays as suggested


/**
* Resolves an OIDF Entity ID against multiple trust anchors to establish trusted relationships
Expand Down Expand Up @@ -71,7 +72,7 @@ export async function resolveExternalOIDFEntityIdIdentifier(
continue
}

payload = JSON.parse(jwtVerifyResult.jws.payload)
payload = JSON.parse(decodeBase64url(jwtVerifyResult.jws.payload))
const signature = jwtVerifyResult.jws.signatures[0]
if (signature.identifier.jwks.length === 0) {
errorList[trustAnchor] = 'No JWK was present in the trust anchor signature'
Expand Down
Loading