@@ -18,7 +18,7 @@ import {
1818 UniformCredentialRequest ,
1919 URL_NOT_VALID ,
2020} from '@sphereon/oid4vci-common' ;
21- import { CredentialFormat , DIDDocument } from '@sphereon/ssi-types' ;
21+ import { CredentialFormat } from '@sphereon/ssi-types' ;
2222import Debug from 'debug' ;
2323
2424import { CredentialRequestClientBuilderV1_0_11 } from './CredentialRequestClientBuilderV1_0_11' ;
@@ -41,9 +41,10 @@ export interface CredentialRequestOpts {
4141 token : string ;
4242 version : OpenId4VCIVersion ;
4343 subjectIssuance ?: ExperimentalSubjectIssuance ;
44+ issuerState ?: string ;
4445}
4546
46- export type CreateCredentialRequestOpts < DIDDoc = DIDDocument > = {
47+ export type CreateCredentialRequestOpts = {
4748 credentialIdentifier ?: string ;
4849 credentialTypes ?: string | string [ ] ;
4950 context ?: string [ ] ;
@@ -52,7 +53,7 @@ export type CreateCredentialRequestOpts<DIDDoc = DIDDocument> = {
5253 version : OpenId4VCIVersion ;
5354} ;
5455
55- export async function buildProof < DIDDoc = DIDDocument > (
56+ export async function buildProof (
5657 proofInput : ProofOfPossessionBuilder | ProofOfPossession ,
5758 opts : {
5859 version : OpenId4VCIVersion ;
@@ -101,7 +102,7 @@ export class CredentialRequestClient {
101102 * like using DPoP together with an authorization code flow. These are however rare, so you should be using the acquireCredentialsUsingProof normally
102103 * @param opts
103104 */
104- public async acquireCredentialsWithoutProof < DIDDoc = DIDDocument > ( opts : {
105+ public async acquireCredentialsWithoutProof ( opts : {
105106 credentialIdentifier ?: string ;
106107 credentialTypes ?: string | string [ ] ;
107108 context ?: string [ ] ;
@@ -122,7 +123,7 @@ export class CredentialRequestClient {
122123 return await this . acquireCredentialsUsingRequestWithoutProof ( request , opts . createDPoPOpts ) ;
123124 }
124125
125- public async acquireCredentialsUsingProof < DIDDoc = DIDDocument > ( opts : {
126+ public async acquireCredentialsUsingProof ( opts : {
126127 proofInput : ProofOfPossessionBuilder | ProofOfPossession ;
127128 credentialIdentifier ?: string ;
128129 credentialTypes ?: string | string [ ] ;
@@ -245,21 +246,19 @@ export class CredentialRequestClient {
245246 } ) ;
246247 }
247248
248- public async createCredentialRequestWithoutProof < DIDDoc = DIDDocument > (
249- opts : CreateCredentialRequestOpts ,
250- ) : Promise < CredentialRequestWithoutProofV1_0_13 > {
249+ public async createCredentialRequestWithoutProof ( opts : CreateCredentialRequestOpts ) : Promise < CredentialRequestWithoutProofV1_0_13 > {
251250 return await this . createCredentialRequestImpl ( opts ) ;
252251 }
253252
254- public async createCredentialRequest < DIDDoc = DIDDocument > (
253+ public async createCredentialRequest (
255254 opts : CreateCredentialRequestOpts & {
256255 proofInput : ProofOfPossessionBuilder | ProofOfPossession ;
257256 } ,
258257 ) : Promise < CredentialRequestV1_0_13 > {
259258 return await this . createCredentialRequestImpl ( opts ) ;
260259 }
261260
262- private async createCredentialRequestImpl < DIDDoc = DIDDocument > (
261+ private async createCredentialRequestImpl (
263262 opts : CreateCredentialRequestOpts & {
264263 proofInput ?: ProofOfPossessionBuilder | ProofOfPossession ;
265264 } ,
@@ -295,6 +294,7 @@ export class CredentialRequestClient {
295294 if ( types . length === 0 ) {
296295 throw Error ( `Credential type(s) need to be provided` ) ;
297296 }
297+ const issuer_state = this . credentialRequestOpts . issuerState ;
298298
299299 // TODO: we should move format specific logic
300300 if ( format === 'jwt_vc_json' || format === 'jwt_vc' ) {
@@ -303,6 +303,7 @@ export class CredentialRequestClient {
303303 type : types ,
304304 } ,
305305 format,
306+ ...( issuer_state && { issuer_state } ) ,
306307 ...( proof && { proof } ) ,
307308 ...opts . subjectIssuance ,
308309 } ;
@@ -313,6 +314,7 @@ export class CredentialRequestClient {
313314
314315 return {
315316 format,
317+ ...( issuer_state && { issuer_state } ) ,
316318 ...( proof && { proof } ) ,
317319 ...opts . subjectIssuance ,
318320
@@ -327,6 +329,7 @@ export class CredentialRequestClient {
327329 }
328330 return {
329331 format,
332+ ...( issuer_state && { issuer_state } ) ,
330333 ...( proof && { proof } ) ,
331334 vct : types [ 0 ] ,
332335 ...opts . subjectIssuance ,
@@ -337,6 +340,7 @@ export class CredentialRequestClient {
337340 }
338341 return {
339342 format,
343+ ...( issuer_state && { issuer_state } ) ,
340344 ...( proof && { proof } ) ,
341345 doctype : types [ 0 ] ,
342346 ...opts . subjectIssuance ,
0 commit comments