File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 ACCESS_TOKEN_ISSUER_REQUIRED_ERROR ,
33 adjustUrl ,
44 AuthorizationRequest ,
5- CredentialIssuerMetadataOpts ,
65 CredentialOfferRESTRequest ,
76 CredentialRequestV1_0_11 ,
87 determineGrantTypes ,
@@ -380,16 +379,9 @@ export function pushedAuthorizationEndpoint<DIDDoc extends object>(
380379 } )
381380}
382381
383- function addTokenEndpoint ( issuerMetadata : CredentialIssuerMetadataOpts ) {
384- if ( ! issuerMetadata . token_endpoint ) {
385- issuerMetadata . token_endpoint = `${ issuerMetadata . credential_issuer } /token`
386- }
387- }
388-
389382export function getMetadataEndpoint < DIDDoc extends object > ( router : Router , issuer : VcIssuer < DIDDoc > ) {
390383 const path = `/.well-known/openid-credential-issuer`
391384 router . get ( path , ( request : Request , response : Response ) => {
392- addTokenEndpoint ( issuer . issuerMetadata )
393385 return response . send ( issuer . issuerMetadata )
394386 } )
395387}
Original file line number Diff line number Diff line change @@ -145,6 +145,12 @@ export class VcIssuerBuilder<DIDDoc extends object> {
145145 return this
146146 }
147147
148+ private setDefaultTokenEndpoint ( issuerMetadata : Partial < CredentialIssuerMetadata > ) {
149+ if ( ! issuerMetadata . token_endpoint ) {
150+ issuerMetadata . token_endpoint = `${ issuerMetadata . credential_issuer } /token`
151+ }
152+ }
153+
148154 public build ( ) : VcIssuer < DIDDoc > {
149155 if ( ! this . credentialOfferStateManager ) {
150156 throw new Error ( TokenErrorResponse . invalid_request )
@@ -155,6 +161,7 @@ export class VcIssuerBuilder<DIDDoc extends object> {
155161
156162 const builder = this . issuerMetadataBuilder ?. build ( )
157163 const metadata : Partial < CredentialIssuerMetadata > = { ...this . issuerMetadata , ...builder }
164+ this . setDefaultTokenEndpoint ( metadata )
158165 // Let's make sure these get merged correctly:
159166 metadata . credentials_supported = [ ...( this . issuerMetadata . credentials_supported ?? [ ] ) , ...( builder ?. credentials_supported ?? [ ] ) ]
160167 metadata . display = [ ...( this . issuerMetadata . display ?? [ ] ) , ...( builder ?. display ?? [ ] ) ]
You can’t perform that action at this time.
0 commit comments