Skip to content

Commit

Permalink
chore: removed well-known vct url location requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
Brummos committed Dec 6, 2024
1 parent 657f6b5 commit ab5cf6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/oid4vci-holder/src/agent/OID4VCIHolderService.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LOG } from '@sphereon/oid4vci-client'
import {
CredentialConfigurationSupported,
// CredentialSupportedSdJwtVc,
// CredentialConfigurationSupportedSdJwtVcV1_0_13,
CredentialSupportedSdJwtVc,
CredentialConfigurationSupportedSdJwtVcV1_0_13,
CredentialOfferFormatV1_0_11,
CredentialResponse,
getSupportedCredentials,
Expand Down Expand Up @@ -70,11 +70,11 @@ export const getCredentialBranding = async (args: GetCredentialBrandingArgs): Pr
Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]): Promise<void> => {
let sdJwtTypeMetadata: SdJwtTypeMetadata | undefined
if (credentialsConfigSupported.format === 'vc+sd-jwt') {
const vct = "https://raw.githubusercontent.com/Sphereon-Opensource/vc-contexts/refs/heads/master/funke/sd-jwt-metadata/age_group.json"//(<CredentialSupportedSdJwtVc | CredentialConfigurationSupportedSdJwtVcV1_0_13>credentialsConfigSupported).vct
const vct = (<CredentialSupportedSdJwtVc | CredentialConfigurationSupportedSdJwtVcV1_0_13>credentialsConfigSupported).vct
if (vct.startsWith('http')) {
try {
sdJwtTypeMetadata = await context.agent.fetchSdJwtTypeMetadataFromVctUrl({ vct })
} catch (error) {
} catch {
// For now, we are just going to ignore and continue without any branding as we still have a fallback
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/sd-jwt/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,8 @@ export class SDJwtPlugin implements IAgentPlugin {
async fetchSdJwtTypeMetadataFromVctUrl(args: FetchSdJwtTypeMetadataFromVctUrlArgs, context: IRequiredContext): Promise<SdJwtTypeMetadata> {
const {vct, opts} = args
const url = new URL(vct)
const wellKnownUrl = `${url.origin}/.well-known/vct${url.pathname}`

const response = await fetchUrlWithErrorHandling(wellKnownUrl)
const response = await fetchUrlWithErrorHandling(url.toString())
const metadata: SdJwtTypeMetadata = await response.json()
assertValidTypeMetadata(metadata, vct)

Expand Down

0 comments on commit ab5cf6c

Please sign in to comment.