Skip to content

Commit

Permalink
feat: added token_endpoint to the metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
sksadjad committed Jun 12, 2024
1 parent fcfb915 commit 72f2988
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/issuer-rest/lib/oid4vci-api-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ACCESS_TOKEN_ISSUER_REQUIRED_ERROR,
adjustUrl,
AuthorizationRequest,
CredentialIssuerMetadataOpts,
CredentialOfferRESTRequest,
CredentialRequestV1_0_11,
determineGrantTypes,
Expand Down Expand Up @@ -379,9 +380,16 @@ export function pushedAuthorizationEndpoint<DIDDoc extends object>(
})
}

function addTokenEndpoint(issuerMetadata: CredentialIssuerMetadataOpts) {
if (!issuerMetadata.token_endpoint) {
issuerMetadata.token_endpoint = `${issuerMetadata.credential_issuer}/token`
}
}

export function getMetadataEndpoint<DIDDoc extends object>(router: Router, issuer: VcIssuer<DIDDoc>) {
const path = `/.well-known/openid-credential-issuer`
router.get(path, (request: Request, response: Response) => {
addTokenEndpoint(issuer.issuerMetadata)
return response.send(issuer.issuerMetadata)
})
}
Expand Down

0 comments on commit 72f2988

Please sign in to comment.