77 CNonceState ,
88 CredentialConfigurationSupportedV1_0_13 ,
99 CredentialIssuerMetadataV1_0_13 ,
10+ CredentialOfferSession ,
1011 CredentialRequest ,
1112 IssuerCredentialSubjectDisplay ,
1213 IssueStatus ,
@@ -15,9 +16,13 @@ import {
1516 OpenId4VCIVersion ,
1617 ProofOfPossession ,
1718} from '@sphereon/oid4vci-common'
18- import { CredentialOfferSession } from '@sphereon/oid4vci-common/dist'
19- import { CredentialSupportedBuilderV1_13 , VcIssuer , VcIssuerBuilder } from '@sphereon/oid4vci-issuer'
20- import { MemoryStates } from '@sphereon/oid4vci-issuer'
19+ import {
20+ AuthorizationServerMetadataBuilder ,
21+ CredentialSupportedBuilderV1_13 ,
22+ MemoryStates ,
23+ VcIssuer ,
24+ VcIssuerBuilder ,
25+ } from '@sphereon/oid4vci-issuer'
2126import { CredentialDataSupplierResult } from '@sphereon/oid4vci-issuer/dist/types'
2227import { ICredential , IProofPurpose , IProofType , W3CVerifiableCredential } from '@sphereon/ssi-types'
2328import { DIDDocument } from 'did-resolver'
@@ -47,7 +52,17 @@ async function proofOfPossessionCallbackFunction(args: Jwt, kid?: string): Promi
4752 . sign ( keypair . privateKey )
4853}
4954
50- async function verifyCallbackFunction ( args : { jwt : string ; kid ?: string } ) : Promise < JwtVerifyResult < DIDDocument > > {
55+ const authorizationServerMetadata = new AuthorizationServerMetadataBuilder ( )
56+ . withIssuer ( IDENTIPROOF_ISSUER_URL )
57+ . withCredentialEndpoint ( 'http://localhost:3456/test/credential-endpoint' )
58+ . withTokenEndpoint ( 'http://localhost:3456/test/token' )
59+ . withAuthorizationEndpoint ( 'https://token-endpoint.example.com/authorize' )
60+ . withTokenEndpointAuthMethodsSupported ( [ 'none' , 'client_secret_basic' , 'client_secret_jwt' , 'client_secret_post' ] )
61+ . withResponseTypesSupported ( [ 'code' , 'token' , 'id_token' ] )
62+ . withScopesSupported ( [ 'openid' , 'abcdef' ] )
63+ . build ( )
64+
65+ async function verifyCallbackFunction ( args : { jwt : string ; kid ?: string } ) : Promise < JwtVerifyResult > {
5166 const result = await jose . jwtVerify ( args . jwt , keypair . publicKey )
5267 const kid = result . protectedHeader . kid ?? args . kid
5368 const did = kid ! . split ( '#' ) [ 0 ]
@@ -83,7 +98,7 @@ afterAll(async () => {
8398 await new Promise ( ( resolve ) => setTimeout ( ( v : void ) => resolve ( v ) , 500 ) )
8499} )
85100describe ( 'issuerCallback' , ( ) => {
86- let vcIssuer : VcIssuer < DIDDocument >
101+ let vcIssuer : VcIssuer
87102 const state = 'existing-state'
88103 const clientId = 'sphereon:wallet'
89104
@@ -146,10 +161,11 @@ describe('issuerCallback', () => {
146161
147162 const nonces = new MemoryStates < CNonceState > ( )
148163 await nonces . set ( 'test_value' , { cNonce : 'test_value' , createdAt : + new Date ( ) , issuerState : 'existing-state' } )
149- vcIssuer = new VcIssuerBuilder < DIDDocument > ( )
164+ vcIssuer = new VcIssuerBuilder ( )
150165 . withAuthorizationServers ( 'https://authorization-server' )
151166 . withCredentialEndpoint ( 'https://credential-endpoint' )
152167 . withCredentialIssuer ( IDENTIPROOF_ISSUER_URL )
168+ . withAuthorizationMetadata ( authorizationServerMetadata )
153169 . withIssuerDisplay ( {
154170 name : 'example issuer' ,
155171 locale : 'en-US' ,
0 commit comments