@sphereon/ssi-sdk.vc-status-list 0.34.1-feature.SSISDK.17.bitstring.sl.2 → 0.34.1-feature.SSISDK.17.bitstring.sl.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  import type { IAgentContext, ICredentialPlugin, ProofFormat as VeramoProofFormat } from '@veramo/core'
2
2
  import type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'
3
3
  import {
4
- type BitstringStatusPurpose,
5
4
  CredentialMapper,
6
5
  type CredentialProofFormat,
7
6
  DocumentFormat,
@@ -13,7 +12,6 @@ import {
13
12
  import type { IStatusList } from './IStatusList'
14
13
  import {
15
14
  BitstringStatus,
16
- BitstringStatusResult,
17
15
  CheckStatusIndexArgs,
18
16
  CreateStatusListArgs,
19
17
  StatusListResult,
@@ -23,12 +21,11 @@ import {
23
21
  } from '../types'
24
22
 
25
23
  import { assertValidProofType, getAssertedProperty, getAssertedValue, getAssertedValues } from '../utils'
26
- import { createList, decodeList } from '@digitalbazaar/vc-bitstring-status-list'
27
- import { IBitstringStatusList } from '../types/BitstringStatusList'
24
+ import { BitstringStatusListCredential } from '../types/BitstringStatusList'
25
+ import { BitstreamStatusList, BitstringStatusPurpose, createStatusListCredential } from '@4sure-tech/vc-bitstring-status-lists'
28
26
 
29
27
  export const DEFAULT_LIST_LENGTH = 131072 // W3C spec minimum
30
28
  export const DEFAULT_PROOF_FORMAT = 'lds' as CredentialProofFormat
31
- export const DEFAULT_STATUS_SIZE = 1
32
29
  export const DEFAULT_STATUS_PURPOSE: BitstringStatusPurpose = 'revocation'
33
30
 
34
31
  export class BitstringStatusListImplementation implements IStatusList {
@@ -47,29 +44,28 @@ export class BitstringStatusListImplementation implements IStatusList {
47
44
 
48
45
  const { issuer, id } = args
49
46
  const correlationId = getAssertedValue('correlationId', args.correlationId)
50
- const { statusPurpose, statusSize, statusMessage, ttl } = args.bitstringStatusList
51
- const list = (await createList({ length })) as IBitstringStatusList
52
- const encodedList = await list.encode()
53
-
47
+ const { statusPurpose, bitsPerStatus, validFrom, validUntil, ttl } = args.bitstringStatusList
54
48
  const statusListCredential = await this.createVerifiableCredential(
55
49
  {
56
50
  ...args,
57
- encodedList,
58
51
  proofFormat: veramoProofFormat,
59
52
  statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
60
- statusSize: statusSize ?? DEFAULT_STATUS_SIZE,
61
- statusMessage: statusMessage,
53
+ validFrom,
54
+ validUntil,
62
55
  ttl,
63
56
  },
64
57
  context,
65
58
  )
66
59
 
67
60
  return {
68
- encodedList,
61
+ encodedList: statusListCredential.credentialSubject.encodedList,
69
62
  statusListCredential: statusListCredential,
70
63
  bitstringStatusList: {
71
64
  statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
65
+ ...(statusListCredential.validFrom && { validFrom: new Date(statusListCredential.validFrom) }),
66
+ ...(statusListCredential.validUntil && { validUntil: new Date(statusListCredential.validUntil) }),
72
67
  ttl,
68
+ bitsPerStatus,
73
69
  },
74
70
  length,
75
71
  type: StatusListType.BitstringStatusList,
@@ -85,6 +81,10 @@ export class BitstringStatusListImplementation implements IStatusList {
85
81
  args: UpdateStatusListIndexArgs,
86
82
  context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
87
83
  ): Promise<StatusListResult> {
84
+ if (!args.bitsPerStatus || args.bitsPerStatus < 1) {
85
+ return Promise.reject('bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListIndex)')
86
+ }
87
+
88
88
  const credential = args.statusListCredential
89
89
  const uniform = CredentialMapper.toUniformCredential(credential)
90
90
  const { issuer, credentialSubject } = uniform
@@ -92,9 +92,8 @@ export class BitstringStatusListImplementation implements IStatusList {
92
92
  const origEncodedList = getAssertedProperty('encodedList', credentialSubject)
93
93
 
94
94
  const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
95
- const statusList = (await decodeList({ encodedList: origEncodedList })) as IBitstringStatusList
96
- statusList.setStatus(index, args.value != 0)
97
- const encodedList = await statusList.encode()
95
+ const statusList: BitstreamStatusList = await BitstreamStatusList.decode({ encodedList: origEncodedList, statusSize: args.bitsPerStatus })
96
+ statusList.setStatus(index, args.value)
98
97
 
99
98
  const proofFormat = CredentialMapper.detectDocumentType(credential) === DocumentFormat.JWT ? 'jwt' : 'lds'
100
99
 
@@ -111,7 +110,7 @@ export class BitstringStatusListImplementation implements IStatusList {
111
110
  ...args,
112
111
  id,
113
112
  issuer,
114
- encodedList,
113
+ statusList,
115
114
  proofFormat: proofFormat,
116
115
  statusPurpose,
117
116
  ttl,
@@ -123,14 +122,15 @@ export class BitstringStatusListImplementation implements IStatusList {
123
122
 
124
123
  return {
125
124
  statusListCredential: updatedCredential,
126
- encodedList,
125
+ encodedList: updatedCredential.credentialSubject.encodedList,
127
126
  bitstringStatusList: {
128
127
  statusPurpose,
129
- validFrom,
130
- validUntil,
128
+ ...(updatedCredential.validFrom && { validFrom: new Date(updatedCredential.validFrom) }),
129
+ ...(updatedCredential.validUntil && { validUntil: new Date(updatedCredential.validUntil) }),
130
+ bitsPerStatus: args.bitsPerStatus,
131
131
  ttl,
132
132
  },
133
- length: statusList.length - 1,
133
+ length: statusList.getLength(),
134
134
  type: StatusListType.BitstringStatusList,
135
135
  proofFormat: proofFormat,
136
136
  id,
@@ -146,28 +146,30 @@ export class BitstringStatusListImplementation implements IStatusList {
146
146
  if (!args.bitstringStatusList) {
147
147
  throw new Error('bitstringStatusList options required for type BitstringStatusList')
148
148
  }
149
+
150
+ if (args.bitstringStatusList.bitsPerStatus < 1) {
151
+ return Promise.reject('bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (updateStatusListFromEncodedList)')
152
+ }
153
+
154
+ const { statusPurpose, bitsPerStatus, ttl, validFrom, validUntil } = args.bitstringStatusList
155
+
149
156
  const proofFormat: CredentialProofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT
150
157
  assertValidProofType(StatusListType.BitstringStatusList, proofFormat)
151
158
  const veramoProofFormat: VeramoProofFormat = proofFormat as VeramoProofFormat
152
159
 
153
160
  const { issuer, id } = getAssertedValues(args)
154
- const statusList = (await decodeList({ encodedList: args.encodedList })) as IBitstringStatusList
161
+ const statusList: BitstreamStatusList = await BitstreamStatusList.decode({ encodedList: args.encodedList, statusSize: bitsPerStatus })
155
162
  const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
156
163
  statusList.setStatus(index, args.value)
157
164
 
158
- const newEncodedList = await statusList.encode()
159
- const { statusPurpose, statusSize, statusMessage, ttl, validFrom, validUntil } = args.bitstringStatusList
160
-
161
165
  const credential = await this.createVerifiableCredential(
162
166
  {
163
167
  id,
164
168
  issuer,
165
- encodedList: newEncodedList,
169
+ statusList,
166
170
  proofFormat: veramoProofFormat,
167
171
  keyRef: args.keyRef,
168
172
  statusPurpose,
169
- statusSize,
170
- statusMessage,
171
173
  validFrom,
172
174
  validUntil,
173
175
  ttl,
@@ -178,14 +180,15 @@ export class BitstringStatusListImplementation implements IStatusList {
178
180
  return {
179
181
  type: StatusListType.BitstringStatusList,
180
182
  statusListCredential: credential,
181
- encodedList: newEncodedList,
183
+ encodedList: credential.credentialSubject.encodedList,
182
184
  bitstringStatusList: {
183
185
  statusPurpose,
184
- validFrom,
185
- validUntil,
186
+ bitsPerStatus,
187
+ ...(credential.validFrom && { validFrom: new Date(credential.validFrom) }),
188
+ ...(credential.validUntil && { validUntil: new Date(credential.validUntil) }),
186
189
  ttl,
187
190
  },
188
- length: statusList.length,
191
+ length: statusList.getLength(),
189
192
  proofFormat: args.proofFormat ?? 'lds',
190
193
  id: id,
191
194
  issuer: issuer,
@@ -193,33 +196,31 @@ export class BitstringStatusListImplementation implements IStatusList {
193
196
  }
194
197
  }
195
198
 
196
- async checkStatusIndex(args: CheckStatusIndexArgs): Promise<BitstringStatusResult> {
199
+ async checkStatusIndex(args: CheckStatusIndexArgs): Promise<BitstringStatus> {
200
+ if (!args.bitsPerStatus || args.bitsPerStatus < 1) {
201
+ return Promise.reject('bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (checkStatusIndex)')
202
+ }
203
+
197
204
  const uniform = CredentialMapper.toUniformCredential(args.statusListCredential)
198
205
  const { credentialSubject } = uniform
199
206
  const encodedList = getAssertedProperty('encodedList', credentialSubject)
200
207
 
201
- const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject
202
- const messageList = (subject as any).statusMessage as Array<Partial<BitstringStatus>>
208
+ const statusSize = args.bitsPerStatus
209
+ const statusList = await BitstreamStatusList.decode({ encodedList, statusSize })
203
210
 
204
211
  const numIndex = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
205
- const hexIndex = `0x${numIndex.toString(16)}`
206
- const statusMessage = messageList.find((statMsg) => statMsg.status === hexIndex)
207
-
208
- const statusList = (await decodeList({ encodedList })) as IBitstringStatusList
209
- if (statusList.length <= numIndex) {
210
- throw new Error(`Status list index out of bounds, has ${messageList.length} messages, requested ${numIndex}`)
212
+ if (statusList.getLength() <= numIndex) {
213
+ throw new Error(`Status list index out of bounds, has ${statusList.getLength()} entries, requested ${numIndex}`)
211
214
  }
212
- const value = statusList.getStatus(numIndex)
213
- return {
214
- index: numIndex,
215
- status: hexIndex,
216
- message: statusMessage?.message,
217
- set: value,
218
- } satisfies BitstringStatusResult
215
+ return statusList.getStatus(numIndex)
219
216
  }
220
217
 
221
218
  async toStatusListDetails(args: ToStatusListDetailsArgs): Promise<StatusListResult> {
222
- const { statusListPayload } = args
219
+ const { statusListPayload, bitsPerStatus } = args
220
+ if (!bitsPerStatus || bitsPerStatus < 1) {
221
+ return Promise.reject('bitsPerStatus must be set for bitstring status lists and must be 1 or higher. (toStatusListDetails)')
222
+ }
223
+
223
224
  const uniform = CredentialMapper.toUniformCredential(statusListPayload)
224
225
  const { issuer, credentialSubject } = uniform
225
226
  const id = getAssertedValue('id', uniform.id)
@@ -230,7 +231,7 @@ export class BitstringStatusListImplementation implements IStatusList {
230
231
  const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : undefined
231
232
  const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : undefined
232
233
  const ttl = credSubject.ttl
233
- const list = (await decodeList({ encodedList })) as IBitstringStatusList
234
+ const statuslistLength: number = BitstreamStatusList.getStatusListLength(encodedList, bitsPerStatus)
234
235
 
235
236
  return {
236
237
  id,
@@ -238,11 +239,12 @@ export class BitstringStatusListImplementation implements IStatusList {
238
239
  issuer,
239
240
  type: StatusListType.BitstringStatusList,
240
241
  proofFormat,
241
- length: list.length,
242
+ length: statuslistLength,
242
243
  statusListCredential: statusListPayload,
243
244
  statuslistContentType: this.buildContentType(proofFormat),
244
245
  bitstringStatusList: {
245
246
  statusPurpose,
247
+ bitsPerStatus,
246
248
  validFrom,
247
249
  validUntil,
248
250
  ttl,
@@ -256,67 +258,32 @@ export class BitstringStatusListImplementation implements IStatusList {
256
258
  args: {
257
259
  id: string
258
260
  issuer: string | IIssuer
259
- encodedList: string
261
+ statusList?: BitstreamStatusList
260
262
  proofFormat: VeramoProofFormat
261
263
  statusPurpose: BitstringStatusPurpose
262
- statusSize?: number
263
- statusMessage?: Array<BitstringStatus>
264
264
  validFrom?: Date
265
265
  validUntil?: Date
266
266
  ttl?: number
267
267
  keyRef?: string
268
268
  },
269
269
  context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
270
- ): Promise<StatusListCredential> {
270
+ ): Promise<BitstringStatusListCredential> {
271
271
  const identifier = await context.agent.identifierManagedGet({
272
272
  identifier: typeof args.issuer === 'string' ? args.issuer : args.issuer.id,
273
273
  vmRelationship: 'assertionMethod',
274
274
  offlineWhenNoDIDRegistered: true,
275
275
  })
276
276
 
277
- const credentialSubject: any = {
278
- id: args.id,
279
- type: 'BitstringStatusList',
280
- statusPurpose: args.statusPurpose,
281
- encodedList: args.encodedList,
282
- }
283
-
284
- if (args.statusSize && args.statusSize > 1) {
285
- credentialSubject.statusSize = args.statusSize
286
- }
287
-
288
- if (args.statusMessage) {
289
- credentialSubject.statusMessage = args.statusMessage
290
- }
291
-
292
- if (args.validFrom) {
293
- credentialSubject.validFrom = args.validFrom
294
- }
295
-
296
- if (args.validUntil) {
297
- credentialSubject.validUntil = args.validUntil
298
- }
299
-
300
- if (args.ttl) {
301
- credentialSubject.ttl = args.ttl
302
- }
303
-
304
- const credential = {
305
- '@context': ['https://www.w3.org/2018/credentials/v1', 'https://www.w3.org/ns/credentials/status/v1'],
306
- id: args.id,
307
- issuer: args.issuer,
308
- type: ['VerifiableCredential', 'BitstringStatusListCredential'],
309
- credentialSubject,
310
- }
277
+ const unsignedCredential = await createStatusListCredential(args)
311
278
 
312
279
  const verifiableCredential = await context.agent.createVerifiableCredential({
313
- credential,
280
+ credential: unsignedCredential,
314
281
  keyRef: args.keyRef ?? identifier.kmsKeyRef,
315
282
  proofFormat: args.proofFormat,
316
283
  fetchRemoteContexts: true,
317
284
  })
318
285
 
319
- return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as StatusListCredential
286
+ return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as BitstringStatusListCredential
320
287
  }
321
288
 
322
289
  private buildContentType(proofFormat: CredentialProofFormat | undefined) {
@@ -1,7 +1,7 @@
1
1
  import type { IAgentContext, ICredentialPlugin } from '@veramo/core'
2
2
  import type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'
3
3
  import {
4
- BitstringStatusResult,
4
+ BitstringStatus,
5
5
  CheckStatusIndexArgs,
6
6
  CreateStatusListArgs,
7
7
  Status2021,
@@ -34,7 +34,7 @@ export interface IStatusList {
34
34
  /**
35
35
  * Checks the status at a given index in the status list
36
36
  */
37
- checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | Status2021 | StatusOAuth | BitstringStatusResult>
37
+ checkStatusIndex(args: CheckStatusIndexArgs): Promise<number | Status2021 | StatusOAuth | BitstringStatus>
38
38
 
39
39
  /**
40
40
  * Collects the status list details
@@ -113,8 +113,7 @@ export class OAuthStatusListImplementation implements IStatusList {
113
113
 
114
114
  const listToUpdate = StatusList.decompressStatusList(args.encodedList, bitsPerStatus ?? DEFAULT_BITS_PER_STATUS)
115
115
  const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
116
- // FIXME: See above.
117
- listToUpdate.setStatus(index, args.value ? 1 : 0)
116
+ listToUpdate.setStatus(index, args.value)
118
117
 
119
118
  const { statusListCredential, encodedList } = await this.createSignedStatusList(
120
119
  proofFormat ?? DEFAULT_PROOF_FORMAT,
@@ -126,7 +126,7 @@ export class StatusList2021Implementation implements IStatusList {
126
126
  const { issuer, id } = getAssertedValues(args)
127
127
  const statusList = await StatusList.decode({ encodedList: args.encodedList })
128
128
  const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
129
- statusList.setStatus(index, args.value)
129
+ statusList.setStatus(index, args.value !== 0)
130
130
 
131
131
  const newEncodedList = await statusList.encode()
132
132
  const credential = await this.createVerifiableCredential(
@@ -1,42 +1,4 @@
1
- export type BitstringConstructorOptions = {
2
- length?: number
3
- buffer?: Uint8Array
4
- leftToRightIndexing?: boolean
5
- littleEndianBits?: boolean // deprecated
6
- }
1
+ import { StatusListCredential } from '@sphereon/ssi-types'
2
+ import { BitstringStatusListCredentialUnsigned } from '../../../../../vc-bitstring-status-lists'
7
3
 
8
- export type IBitstring = {
9
- bits: Uint8Array
10
- length: number
11
- leftToRightIndexing: boolean
12
-
13
- set(position: number, on: boolean): void
14
- get(position: number): boolean
15
- encodeBits(): Promise<string>
16
- compressBits(): Promise<Uint8Array>
17
- }
18
-
19
- export type BitstringStatic = {
20
- new (options?: BitstringConstructorOptions): IBitstring
21
- decodeBits(options: { encoded: string }): Promise<Uint8Array>
22
- uncompressBits(options: { compressed: Uint8Array }): Promise<Uint8Array>
23
- }
24
-
25
- export type BitstringStatusListConstructorOptions = {
26
- length?: number
27
- buffer?: Uint8Array
28
- }
29
-
30
- export type IBitstringStatusList = {
31
- bitstring: IBitstring
32
- length: number
33
-
34
- setStatus(index: number, status: boolean): void
35
- getStatus(index: number): boolean
36
- encode(): Promise<string>
37
- }
38
-
39
- export type BitstringStatusListStatic = {
40
- new (options?: BitstringStatusListConstructorOptions): IBitstringStatusList
41
- decode(options: { encodedList: string }): Promise<IBitstringStatusList>
42
- }
4
+ export type BitstringStatusListCredential = BitstringStatusListCredentialUnsigned & StatusListCredential
@@ -1,6 +1,5 @@
1
1
  import type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'
2
2
  import {
3
- BitstringStatusPurpose,
4
3
  type CredentialProofFormat,
5
4
  type ICredential,
6
5
  type ICredentialStatus,
@@ -27,6 +26,7 @@ import { DataSource } from 'typeorm'
27
26
  import type { BitsPerStatus } from '@sd-jwt/jwt-status-list'
28
27
  import type { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc'
29
28
  import type { StatusListOpts } from '@sphereon/oid4vci-common'
29
+ import { BitstringStatusPurpose } from '@4sure-tech/vc-bitstring-status-lists'
30
30
 
31
31
  export enum StatusOAuth {
32
32
  Valid = 0,
@@ -39,19 +39,7 @@ export enum Status2021 {
39
39
  Invalid = 1,
40
40
  }
41
41
 
42
- export type BitstringStatus = {
43
- status: string
44
- message?: string
45
- [x: string]: any
46
- }
47
-
48
- export type BitstringStatusResult = BitstringStatus & {
49
- index: number
50
- status: string
51
- set: boolean
52
- message?: string
53
- [x: string]: any
54
- }
42
+ export type BitstringStatus = number
55
43
 
56
44
  export type StatusList2021Args = {
57
45
  indexingDirection: StatusListIndexingDirection
@@ -66,8 +54,7 @@ export type OAuthStatusListArgs = {
66
54
 
67
55
  export type BitstringStatusListArgs = {
68
56
  statusPurpose: BitstringStatusPurpose
69
- statusSize?: number
70
- statusMessage?: Array<BitstringStatus>
57
+ bitsPerStatus: number
71
58
  ttl?: number
72
59
  validFrom?: Date
73
60
  validUntil?: Date
@@ -83,6 +70,7 @@ export type BaseCreateNewStatusListArgs = {
83
70
  keyRef?: string
84
71
  statusList2021?: StatusList2021Args
85
72
  oauthStatusList?: OAuthStatusListArgs
73
+ bitstringStatusList?: BitstringStatusListArgs
86
74
  driverType?: StatusListDriverType
87
75
  }
88
76
 
@@ -97,8 +85,7 @@ export type UpdateOAuthStatusListArgs = {
97
85
 
98
86
  export type UpdateBitstringStatusListArgs = {
99
87
  statusPurpose: BitstringStatusPurpose
100
- statusSize?: number
101
- statusMessage?: Array<BitstringStatus>
88
+ bitsPerStatus: number
102
89
  validFrom?: Date
103
90
  validUntil?: Date
104
91
  ttl?: number
@@ -107,7 +94,7 @@ export type UpdateBitstringStatusListArgs = {
107
94
  export interface UpdateStatusListFromEncodedListArgs {
108
95
  type?: StatusListType
109
96
  statusListIndex: number | string
110
- value: boolean
97
+ value: number
111
98
  proofFormat?: CredentialProofFormat
112
99
  keyRef?: string
113
100
  correlationId?: string
@@ -157,6 +144,7 @@ interface OAuthStatusDetails {
157
144
 
158
145
  interface BitstringStatusDetails {
159
146
  statusPurpose: BitstringStatusPurpose
147
+ bitsPerStatus: number
160
148
  validFrom?: Date
161
149
  validUntil?: Date
162
150
  ttl?: number
@@ -182,7 +170,7 @@ export interface BitstringStatusListEntryCredentialStatus extends ICredentialSta
182
170
  statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[]
183
171
  statusListIndex: string
184
172
  statusListCredential: string
185
- statusSize?: number
173
+ bitsPerStatus?: number
186
174
  statusMessage?: Array<BitstringStatus>
187
175
  statusReference?: string | string[]
188
176
  }
@@ -213,6 +201,7 @@ export interface UpdateStatusListIndexArgs {
213
201
  statusListCredential: StatusListCredential // | CompactJWT
214
202
  statusListIndex: number | string
215
203
  value: number | Status2021 | StatusOAuth | BitstringStatus
204
+ bitsPerStatus?: number
216
205
  keyRef?: string
217
206
  expiresAt?: Date
218
207
  }
@@ -220,12 +209,14 @@ export interface UpdateStatusListIndexArgs {
220
209
  export interface CheckStatusIndexArgs {
221
210
  statusListCredential: StatusListCredential // | CompactJWT
222
211
  statusListIndex: string | number
212
+ bitsPerStatus?: number
223
213
  }
224
214
 
225
215
  export interface ToStatusListDetailsArgs {
226
216
  statusListPayload: StatusListCredential
227
217
  correlationId?: string
228
218
  driverType?: StatusListDriverType
219
+ bitsPerStatus?: number
229
220
  }
230
221
 
231
222
  /**
package/src/utils.ts CHANGED
@@ -11,7 +11,7 @@ import { jwtDecode } from 'jwt-decode'
11
11
 
12
12
  export function getAssertedStatusListType(type?: StatusListType) {
13
13
  const assertedType = type ?? StatusListType.StatusList2021
14
- if (![StatusListType.StatusList2021, StatusListType.OAuthStatusList].includes(assertedType)) {
14
+ if (![StatusListType.StatusList2021, StatusListType.OAuthStatusList, StatusListType.BitstringStatusList].includes(assertedType)) {
15
15
  throw Error(`StatusList type ${assertedType} is not supported (yet)`)
16
16
  }
17
17
  return assertedType
@@ -41,6 +41,7 @@ export function getAssertedProperty<T extends object>(propertyName: string, obj:
41
41
  const ValidProofTypeMap = new Map<StatusListType, CredentialProofFormat[]>([
42
42
  [StatusListType.StatusList2021, ['jwt', 'lds']],
43
43
  [StatusListType.OAuthStatusList, ['jwt', 'cbor']],
44
+ [StatusListType.BitstringStatusList, ['lds']],
44
45
  ])
45
46
 
46
47
  export function assertValidProofType(type: StatusListType, proofFormat: CredentialProofFormat) {