File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 CreateCredentialOfferURIResult ,
66 CREDENTIAL_MISSING_ERROR ,
77 CredentialDataSupplierInput ,
8+ CredentialIssuerMetadata ,
89 CredentialIssuerMetadataOpts ,
910 CredentialOfferFormat ,
1011 CredentialOfferPayloadV1_0_11 ,
@@ -69,6 +70,7 @@ export class VcIssuer<DIDDoc extends object> {
6970 cNonceExpiresIn ?: number | undefined // expiration duration in seconds
7071 } ,
7172 ) {
73+ this . setDefaultTokenEndpoint ( issuerMetadata )
7274 this . _issuerMetadata = issuerMetadata
7375 this . _defaultCredentialOfferBaseUri = args . defaultCredentialOfferBaseUri
7476 this . _credentialOfferSessions = args . credentialOfferSessions
@@ -603,6 +605,12 @@ export class VcIssuer<DIDDoc extends object> {
603605 return credential
604606 }
605607
608+ private setDefaultTokenEndpoint ( issuerMetadata : Partial < CredentialIssuerMetadata > ) {
609+ if ( ! issuerMetadata . token_endpoint ) {
610+ issuerMetadata . token_endpoint = `${ issuerMetadata . credential_issuer } /token`
611+ }
612+ }
613+
606614 get userPinRequired ( ) : boolean {
607615 return this . _userPinRequired
608616 }
Original file line number Diff line number Diff line change @@ -145,12 +145,6 @@ 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-
154148 public build ( ) : VcIssuer < DIDDoc > {
155149 if ( ! this . credentialOfferStateManager ) {
156150 throw new Error ( TokenErrorResponse . invalid_request )
@@ -161,7 +155,6 @@ export class VcIssuerBuilder<DIDDoc extends object> {
161155
162156 const builder = this . issuerMetadataBuilder ?. build ( )
163157 const metadata : Partial < CredentialIssuerMetadata > = { ...this . issuerMetadata , ...builder }
164- this . setDefaultTokenEndpoint ( metadata )
165158 // Let's make sure these get merged correctly:
166159 metadata . credentials_supported = [ ...( this . issuerMetadata . credentials_supported ?? [ ] ) , ...( builder ?. credentials_supported ?? [ ] ) ]
167160 metadata . display = [ ...( this . issuerMetadata . display ?? [ ] ) , ...( builder ?. display ?? [ ] ) ]
You can’t perform that action at this time.
0 commit comments