Skip to content

Commit

Permalink
parse with this
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Nov 26, 2024
1 parent 87a8f01 commit 80a4f99
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/modules/mdoc/MdocDeviceResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ export class MdocDeviceResponse {
trustedCertificates = (
await Promise.all(
this.documents.map((mdoc) => {
const certificateChain = mdoc.issuerSignedCertificateChain.map(X509Certificate.fromRawCertificate)
const certificateChain = mdoc.issuerSignedCertificateChain.map((cert) =>
X509Certificate.fromRawCertificate(cert)
)
return x509Config.getTrustedCertificatesForVerification?.(agentContext, {
certificateChain,
verification: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/modules/sd-jwt-vc/SdJwtVcService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export class SdJwtVcService {
}

let trustedCertificates = _trustedCertificates
const certificateChain = sdJwtVc.jwt.header.x5c.map(X509Certificate.fromEncodedCertificate)
const certificateChain = sdJwtVc.jwt.header.x5c.map((cert) => X509Certificate.fromEncodedCertificate(cert))
if (certificateChain && !trustedCertificates) {
trustedCertificates =
(await x509Config.getTrustedCertificatesForVerification?.(agentContext, {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/modules/x509/extraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import type { Jwt } from '../../crypto'
import { X509Certificate } from './X509Certificate'

export function extractX509CertificatesFromJwt(jwt: Jwt) {
return jwt.header.x5c?.map(X509Certificate.fromEncodedCertificate)
return jwt.header.x5c?.map((cert) => X509Certificate.fromEncodedCertificate(cert))
}
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,9 @@ export class OpenId4VcSiopVerifierService {
const trustedCertificates = (
await Promise.all(
mdocDeviceResponse.documents.map(async (mdoc) => {
const certificateChain = mdoc.issuerSignedCertificateChain.map(X509Certificate.fromRawCertificate)
const certificateChain = mdoc.issuerSignedCertificateChain.map((cert) =>
X509Certificate.fromRawCertificate(cert)
)
return (
(await x509Config.getTrustedCertificatesForVerification?.(agentContext, {
certificateChain,
Expand Down
2 changes: 1 addition & 1 deletion packages/openid4vc/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function getVerifyJwtCallback(
} else if (jwtVerifier.method === 'x5c' || jwtVerifier.method === 'jwk') {
if (jwtVerifier.type === 'request-object') {
const x509Config = agentContext.dependencyManager.resolve(X509ModuleConfig)
const certificateChain = jwt.header.x5c?.map(X509Certificate.fromEncodedCertificate)
const certificateChain = jwt.header.x5c?.map((cert) => X509Certificate.fromEncodedCertificate(cert))

if (!trustedCertificates) {
trustedCertificates = certificateChain
Expand Down

0 comments on commit 80a4f99

Please sign in to comment.