Skip to content

Commit

Permalink
feat: Added fetchEntityConfiguration
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Lanser <tom@devv.nl>
  • Loading branch information
Tommylans committed Nov 20, 2024
1 parent f6f766d commit b2b3890
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
OpenId4VcSiopAcceptAuthorizationRequestOptions,
OpenId4VcSiopFetchEntityConfigurationOptions,
OpenId4VcSiopGetOpenIdProviderOptions,
OpenId4VcSiopResolveAuthorizationRequestOptions,
OpenId4VcSiopResolvedAuthorizationRequest,
Expand Down Expand Up @@ -474,4 +475,25 @@ export class OpenId4VcSiopHolderService {
},
})
}

public async fetchOpenIdFederationEntityConfiguration(
agentContext: AgentContext,
options: OpenId4VcSiopFetchEntityConfigurationOptions
) {
const jwsService = agentContext.dependencyManager.resolve(JwsService)

const { entityId } = options

return federationFetchEntityConfiguration({
entityId,
verifyJwtCallback: async ({ jwt, jwk }) => {
const res = await jwsService.verifyJws(agentContext, {
jws: jwt,
jwkResolver: () => getJwkFromJson(jwk),
})

return res.isValid
},
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ export interface OpenId4VcSiopResolveTrustChainsOptions {
entityId: string
trustAnchorEntityIds: [string, ...string[]]
}

export interface OpenId4VcSiopFetchEntityConfigurationOptions {
entityId: string
}

0 comments on commit b2b3890

Please sign in to comment.