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

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.
@@ -20,7 +20,7 @@ import { createSignedCbor, decodeStatusListCWT } from './encoding/cbor'
20
20
 
21
21
  type IRequiredContext = IAgentContext<ICredentialPlugin & IJwtService & IIdentifierResolution & IKeyManager>
22
22
 
23
- export const DEFAULT_BITS_PER_STATUS = 1 // 1 bit is sufficient for 0x00 - "VALID" 0x01 - "INVALID" saving space in the process
23
+ export const DEFAULT_BITS_PER_STATUS = 1 // 1 bit is sufficient for 0x00 - "VALID" 0x01 - "INVALID" saving space in the process
24
24
  export const DEFAULT_LIST_LENGTH = 250000
25
25
  export const DEFAULT_PROOF_FORMAT = 'jwt' as CredentialProofFormat
26
26
 
@@ -70,10 +70,6 @@ export class OAuthStatusListImplementation implements IStatusList {
70
70
  throw new Error('Status list index out of bounds')
71
71
  }
72
72
 
73
- if (typeof value !== 'number') {
74
- throw new Error('Status list values should be of type number')
75
- }
76
-
77
73
  statusList.setStatus(index, value)
78
74
  const { statusListCredential: signedCredential, encodedList } = await this.createSignedStatusList(
79
75
  proofFormat,
@@ -142,7 +138,7 @@ export class OAuthStatusListImplementation implements IStatusList {
142
138
  }
143
139
  }
144
140
 
145
- private buildContentType(proofFormat: CredentialProofFormat | undefined) {
141
+ private buildContentType(proofFormat: 'jwt' | 'lds' | 'EthereumEip712Signature2021' | 'cbor' | undefined) {
146
142
  return `application/statuslist+${proofFormat === 'cbor' ? 'cwt' : 'jwt'}`
147
143
  }
148
144
 
@@ -157,7 +153,7 @@ export class OAuthStatusListImplementation implements IStatusList {
157
153
 
158
154
  const index = typeof statusListIndex === 'number' ? statusListIndex : parseInt(statusListIndex)
159
155
  if (index < 0 || index >= statusList.statusList.length) {
160
- throw new Error(`Status list index out of bounds, has ${statusList.statusList.length} items, requested ${index}`)
156
+ throw new Error('Status list index out of bounds')
161
157
  }
162
158
 
163
159
  return statusList.getStatus(index)
@@ -188,7 +184,7 @@ export class OAuthStatusListImplementation implements IStatusList {
188
184
  }
189
185
 
190
186
  private async createSignedStatusList(
191
- proofFormat: CredentialProofFormat,
187
+ proofFormat: 'jwt' | 'lds' | 'EthereumEip712Signature2021' | 'cbor',
192
188
  context: IAgentContext<ICredentialPlugin & IJwtService & IIdentifierResolution & IKeyManager>,
193
189
  statusList: StatusList,
194
190
  issuerString: string,
@@ -24,7 +24,7 @@ import { Status2021 } from '../types'
24
24
  import { assertValidProofType, getAssertedProperty, getAssertedValue, getAssertedValues } from '../utils'
25
25
 
26
26
  export const DEFAULT_LIST_LENGTH = 250000
27
- export const DEFAULT_PROOF_FORMAT = 'lds' as CredentialProofFormat
27
+ export const DEFAULT_PROOF_FORMAT = 'lds' as VeramoProofFormat
28
28
 
29
29
  export class StatusList2021Implementation implements IStatusList {
30
30
  async createNewStatusList(
@@ -234,7 +234,7 @@ export class StatusList2021Implementation implements IStatusList {
234
234
  return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as StatusListCredential
235
235
  }
236
236
 
237
- private buildContentType(proofFormat: CredentialProofFormat | undefined) {
237
+ private buildContentType(proofFormat: 'jwt' | 'lds' | 'EthereumEip712Signature2021' | 'cbor' | undefined) {
238
238
  switch (proofFormat) {
239
239
  case 'jwt':
240
240
  return `application/statuslist+jwt`
@@ -2,7 +2,6 @@ import type { IStatusList } from './IStatusList'
2
2
  import { StatusList2021Implementation } from './StatusList2021'
3
3
  import { OAuthStatusListImplementation } from './OAuthStatusList'
4
4
  import { StatusListType } from '@sphereon/ssi-types'
5
- import { BitstringStatusListImplementation } from './BitstringStatusListImplementation'
6
5
 
7
6
  export class StatusListFactory {
8
7
  private static instance: StatusListFactory
@@ -12,7 +11,6 @@ export class StatusListFactory {
12
11
  this.implementations = new Map()
13
12
  this.implementations.set(StatusListType.StatusList2021, new StatusList2021Implementation())
14
13
  this.implementations.set(StatusListType.OAuthStatusList, new OAuthStatusListImplementation())
15
- this.implementations.set(StatusListType.BitstringStatusList, new BitstringStatusListImplementation())
16
14
  }
17
15
 
18
16
  public static getInstance(): StatusListFactory {
@@ -1,12 +1,11 @@
1
1
  import type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'
2
2
  import {
3
- BitstringStatusPurpose,
4
- type CredentialProofFormat,
5
3
  type ICredential,
6
4
  type ICredentialStatus,
7
5
  type IIssuer,
8
6
  type IVerifiableCredential,
9
7
  type OrPromise,
8
+ type CredentialProofFormat,
10
9
  type StatusListCredential,
11
10
  StatusListCredentialIdMode,
12
11
  StatusListDriverType,
@@ -39,20 +38,6 @@ export enum Status2021 {
39
38
  Invalid = 1,
40
39
  }
41
40
 
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
- }
55
-
56
41
  export type StatusList2021Args = {
57
42
  indexingDirection: StatusListIndexingDirection
58
43
  statusPurpose?: StatusPurpose2021
@@ -64,15 +49,6 @@ export type OAuthStatusListArgs = {
64
49
  expiresAt?: Date
65
50
  }
66
51
 
67
- export type BitstringStatusListArgs = {
68
- statusPurpose: BitstringStatusPurpose
69
- statusSize?: number
70
- statusMessage?: Array<BitstringStatus>
71
- ttl?: number
72
- validFrom?: Date
73
- validUntil?: Date
74
- }
75
-
76
52
  export type BaseCreateNewStatusListArgs = {
77
53
  type: StatusListType
78
54
  id: string
@@ -95,15 +71,6 @@ export type UpdateOAuthStatusListArgs = {
95
71
  expiresAt?: Date
96
72
  }
97
73
 
98
- export type UpdateBitstringStatusListArgs = {
99
- statusPurpose: BitstringStatusPurpose
100
- statusSize?: number
101
- statusMessage?: Array<BitstringStatus>
102
- validFrom?: Date
103
- validUntil?: Date
104
- ttl?: number
105
- }
106
-
107
74
  export interface UpdateStatusListFromEncodedListArgs {
108
75
  type?: StatusListType
109
76
  statusListIndex: number | string
@@ -116,14 +83,13 @@ export interface UpdateStatusListFromEncodedListArgs {
116
83
  id: string
117
84
  statusList2021?: UpdateStatusList2021Args
118
85
  oauthStatusList?: UpdateOAuthStatusListArgs
119
- bitstringStatusList?: UpdateBitstringStatusListArgs
120
86
  }
121
87
 
122
88
  export interface UpdateStatusListFromStatusListCredentialArgs {
123
89
  statusListCredential: StatusListCredential // | CompactJWT
124
90
  keyRef?: string
125
91
  statusListIndex: number | string
126
- value: number | Status2021 | StatusOAuth | BitstringStatus
92
+ value: number | Status2021 | StatusOAuth
127
93
  }
128
94
 
129
95
  export interface StatusListResult {
@@ -137,7 +103,6 @@ export interface StatusListResult {
137
103
  issuer: string | IIssuer
138
104
  statusList2021?: StatusList2021Details
139
105
  oauthStatusList?: OAuthStatusDetails
140
- bitstringStatusList?: BitstringStatusDetails
141
106
 
142
107
  // These cannot be deduced from the VC, so they are present when callers pass in these values as params
143
108
  correlationId?: string
@@ -155,13 +120,6 @@ interface OAuthStatusDetails {
155
120
  expiresAt?: Date
156
121
  }
157
122
 
158
- interface BitstringStatusDetails {
159
- statusPurpose: BitstringStatusPurpose
160
- validFrom?: Date
161
- validUntil?: Date
162
- ttl?: number
163
- }
164
-
165
123
  export interface StatusList2021EntryCredentialStatus extends ICredentialStatus {
166
124
  type: 'StatusList2021Entry'
167
125
  statusPurpose: StatusPurpose2021
@@ -177,16 +135,6 @@ export interface StatusListOAuthEntryCredentialStatus extends ICredentialStatus
177
135
  expiresAt?: Date
178
136
  }
179
137
 
180
- export interface BitstringStatusListEntryCredentialStatus extends ICredentialStatus {
181
- type: 'BitstringStatusListEntry'
182
- statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[]
183
- statusListIndex: string
184
- statusListCredential: string
185
- statusSize?: number
186
- statusMessage?: Array<BitstringStatus>
187
- statusReference?: string | string[]
188
- }
189
-
190
138
  export interface StatusList2021ToVerifiableCredentialArgs {
191
139
  issuer: string | IIssuer
192
140
  id: string
@@ -206,13 +154,12 @@ export interface CreateStatusListArgs {
206
154
  length?: number
207
155
  statusList2021?: StatusList2021Args
208
156
  oauthStatusList?: OAuthStatusListArgs
209
- bitstringStatusList?: BitstringStatusListArgs
210
157
  }
211
158
 
212
159
  export interface UpdateStatusListIndexArgs {
213
160
  statusListCredential: StatusListCredential // | CompactJWT
214
161
  statusListIndex: number | string
215
- value: number | Status2021 | StatusOAuth | BitstringStatus
162
+ value: number | Status2021 | StatusOAuth
216
163
  keyRef?: string
217
164
  expiresAt?: Date
218
165
  }
package/src/utils.ts CHANGED
@@ -39,7 +39,7 @@ export function getAssertedProperty<T extends object>(propertyName: string, obj:
39
39
  }
40
40
 
41
41
  const ValidProofTypeMap = new Map<StatusListType, CredentialProofFormat[]>([
42
- [StatusListType.StatusList2021, ['jwt', 'lds']],
42
+ [StatusListType.StatusList2021, ['jwt', 'lds', 'EthereumEip712Signature2021']],
43
43
  [StatusListType.OAuthStatusList, ['jwt', 'cbor']],
44
44
  ])
45
45
 
@@ -1,334 +0,0 @@
1
- import type { IAgentContext, ICredentialPlugin, ProofFormat as VeramoProofFormat } from '@veramo/core'
2
- import type { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution'
3
- import {
4
- type BitstringStatusPurpose,
5
- CredentialMapper,
6
- type CredentialProofFormat,
7
- DocumentFormat,
8
- type IIssuer,
9
- type StatusListCredential,
10
- StatusListType,
11
- } from '@sphereon/ssi-types'
12
-
13
- import type { IStatusList } from './IStatusList'
14
- import {
15
- BitstringStatus,
16
- BitstringStatusResult,
17
- CheckStatusIndexArgs,
18
- CreateStatusListArgs,
19
- StatusListResult,
20
- ToStatusListDetailsArgs,
21
- UpdateStatusListFromEncodedListArgs,
22
- UpdateStatusListIndexArgs,
23
- } from '../types'
24
-
25
- import { assertValidProofType, getAssertedProperty, getAssertedValue, getAssertedValues } from '../utils'
26
- import { createList, decodeList } from '@digitalbazaar/vc-bitstring-status-list'
27
- import { IBitstringStatusList } from '../types/BitstringStatusList'
28
-
29
- export const DEFAULT_LIST_LENGTH = 131072 // W3C spec minimum
30
- export const DEFAULT_PROOF_FORMAT = 'lds' as CredentialProofFormat
31
- export const DEFAULT_STATUS_SIZE = 1
32
- export const DEFAULT_STATUS_PURPOSE: BitstringStatusPurpose = 'revocation'
33
-
34
- export class BitstringStatusListImplementation implements IStatusList {
35
- async createNewStatusList(
36
- args: CreateStatusListArgs,
37
- context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
38
- ): Promise<StatusListResult> {
39
- if (!args.bitstringStatusList) {
40
- throw new Error('BitstringStatusList options are required for type BitstringStatusList')
41
- }
42
-
43
- const length = args?.length ?? DEFAULT_LIST_LENGTH
44
- const proofFormat: CredentialProofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT
45
- assertValidProofType(StatusListType.BitstringStatusList, proofFormat)
46
- const veramoProofFormat: VeramoProofFormat = proofFormat as VeramoProofFormat
47
-
48
- const { issuer, id } = args
49
- 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
-
54
- const statusListCredential = await this.createVerifiableCredential(
55
- {
56
- ...args,
57
- encodedList,
58
- proofFormat: veramoProofFormat,
59
- statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
60
- statusSize: statusSize ?? DEFAULT_STATUS_SIZE,
61
- statusMessage: statusMessage,
62
- ttl,
63
- },
64
- context,
65
- )
66
-
67
- return {
68
- encodedList,
69
- statusListCredential: statusListCredential,
70
- bitstringStatusList: {
71
- statusPurpose: statusPurpose ?? DEFAULT_STATUS_PURPOSE,
72
- ttl,
73
- },
74
- length,
75
- type: StatusListType.BitstringStatusList,
76
- proofFormat,
77
- id,
78
- correlationId,
79
- issuer,
80
- statuslistContentType: this.buildContentType(proofFormat),
81
- }
82
- }
83
-
84
- async updateStatusListIndex(
85
- args: UpdateStatusListIndexArgs,
86
- context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
87
- ): Promise<StatusListResult> {
88
- const credential = args.statusListCredential
89
- const uniform = CredentialMapper.toUniformCredential(credential)
90
- const { issuer, credentialSubject } = uniform
91
- const id = getAssertedValue('id', uniform.id)
92
- const origEncodedList = getAssertedProperty('encodedList', credentialSubject)
93
-
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()
98
-
99
- const proofFormat = CredentialMapper.detectDocumentType(credential) === DocumentFormat.JWT ? 'jwt' : 'lds'
100
-
101
- const credSubject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject
102
-
103
- const statusPurpose = getAssertedProperty('statusPurpose', credSubject)
104
-
105
- const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : undefined
106
- const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : undefined
107
- const ttl = credSubject.ttl
108
-
109
- const updatedCredential = await this.createVerifiableCredential(
110
- {
111
- ...args,
112
- id,
113
- issuer,
114
- encodedList,
115
- proofFormat: proofFormat,
116
- statusPurpose,
117
- ttl,
118
- validFrom,
119
- validUntil,
120
- },
121
- context,
122
- )
123
-
124
- return {
125
- statusListCredential: updatedCredential,
126
- encodedList,
127
- bitstringStatusList: {
128
- statusPurpose,
129
- validFrom,
130
- validUntil,
131
- ttl,
132
- },
133
- length: statusList.length - 1,
134
- type: StatusListType.BitstringStatusList,
135
- proofFormat: proofFormat,
136
- id,
137
- issuer,
138
- statuslistContentType: this.buildContentType(proofFormat),
139
- }
140
- }
141
-
142
- async updateStatusListFromEncodedList(
143
- args: UpdateStatusListFromEncodedListArgs,
144
- context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
145
- ): Promise<StatusListResult> {
146
- if (!args.bitstringStatusList) {
147
- throw new Error('bitstringStatusList options required for type BitstringStatusList')
148
- }
149
- const proofFormat: CredentialProofFormat = args?.proofFormat ?? DEFAULT_PROOF_FORMAT
150
- assertValidProofType(StatusListType.BitstringStatusList, proofFormat)
151
- const veramoProofFormat: VeramoProofFormat = proofFormat as VeramoProofFormat
152
-
153
- const { issuer, id } = getAssertedValues(args)
154
- const statusList = (await decodeList({ encodedList: args.encodedList })) as IBitstringStatusList
155
- const index = typeof args.statusListIndex === 'number' ? args.statusListIndex : parseInt(args.statusListIndex)
156
- statusList.setStatus(index, args.value)
157
-
158
- const newEncodedList = await statusList.encode()
159
- const { statusPurpose, statusSize, statusMessage, ttl, validFrom, validUntil } = args.bitstringStatusList
160
-
161
- const credential = await this.createVerifiableCredential(
162
- {
163
- id,
164
- issuer,
165
- encodedList: newEncodedList,
166
- proofFormat: veramoProofFormat,
167
- keyRef: args.keyRef,
168
- statusPurpose,
169
- statusSize,
170
- statusMessage,
171
- validFrom,
172
- validUntil,
173
- ttl,
174
- },
175
- context,
176
- )
177
-
178
- return {
179
- type: StatusListType.BitstringStatusList,
180
- statusListCredential: credential,
181
- encodedList: newEncodedList,
182
- bitstringStatusList: {
183
- statusPurpose,
184
- validFrom,
185
- validUntil,
186
- ttl,
187
- },
188
- length: statusList.length,
189
- proofFormat: args.proofFormat ?? 'lds',
190
- id: id,
191
- issuer: issuer,
192
- statuslistContentType: this.buildContentType(proofFormat),
193
- }
194
- }
195
-
196
- async checkStatusIndex(args: CheckStatusIndexArgs): Promise<BitstringStatusResult> {
197
- const uniform = CredentialMapper.toUniformCredential(args.statusListCredential)
198
- const { credentialSubject } = uniform
199
- const encodedList = getAssertedProperty('encodedList', credentialSubject)
200
-
201
- const subject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject
202
- const messageList = (subject as any).statusMessage as Array<Partial<BitstringStatus>>
203
-
204
- 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}`)
211
- }
212
- const value = statusList.getStatus(numIndex)
213
- return {
214
- index: numIndex,
215
- status: hexIndex,
216
- message: statusMessage?.message,
217
- set: value,
218
- } satisfies BitstringStatusResult
219
- }
220
-
221
- async toStatusListDetails(args: ToStatusListDetailsArgs): Promise<StatusListResult> {
222
- const { statusListPayload } = args
223
- const uniform = CredentialMapper.toUniformCredential(statusListPayload)
224
- const { issuer, credentialSubject } = uniform
225
- const id = getAssertedValue('id', uniform.id)
226
- const encodedList = getAssertedProperty('encodedList', credentialSubject)
227
- const proofFormat: CredentialProofFormat = CredentialMapper.detectDocumentType(statusListPayload) === DocumentFormat.JWT ? 'jwt' : 'lds'
228
- const credSubject = Array.isArray(credentialSubject) ? credentialSubject[0] : credentialSubject
229
- const statusPurpose = getAssertedProperty('statusPurpose', credSubject)
230
- const validFrom = uniform.validFrom ? new Date(uniform.validFrom) : undefined
231
- const validUntil = uniform.validUntil ? new Date(uniform.validUntil) : undefined
232
- const ttl = credSubject.ttl
233
- const list = (await decodeList({ encodedList })) as IBitstringStatusList
234
-
235
- return {
236
- id,
237
- encodedList,
238
- issuer,
239
- type: StatusListType.BitstringStatusList,
240
- proofFormat,
241
- length: list.length,
242
- statusListCredential: statusListPayload,
243
- statuslistContentType: this.buildContentType(proofFormat),
244
- bitstringStatusList: {
245
- statusPurpose,
246
- validFrom,
247
- validUntil,
248
- ttl,
249
- },
250
- ...(args.correlationId && { correlationId: args.correlationId }),
251
- ...(args.driverType && { driverType: args.driverType }),
252
- }
253
- }
254
-
255
- private async createVerifiableCredential(
256
- args: {
257
- id: string
258
- issuer: string | IIssuer
259
- encodedList: string
260
- proofFormat: VeramoProofFormat
261
- statusPurpose: BitstringStatusPurpose
262
- statusSize?: number
263
- statusMessage?: Array<BitstringStatus>
264
- validFrom?: Date
265
- validUntil?: Date
266
- ttl?: number
267
- keyRef?: string
268
- },
269
- context: IAgentContext<ICredentialPlugin & IIdentifierResolution>,
270
- ): Promise<StatusListCredential> {
271
- const identifier = await context.agent.identifierManagedGet({
272
- identifier: typeof args.issuer === 'string' ? args.issuer : args.issuer.id,
273
- vmRelationship: 'assertionMethod',
274
- offlineWhenNoDIDRegistered: true,
275
- })
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
- }
311
-
312
- const verifiableCredential = await context.agent.createVerifiableCredential({
313
- credential,
314
- keyRef: args.keyRef ?? identifier.kmsKeyRef,
315
- proofFormat: args.proofFormat,
316
- fetchRemoteContexts: true,
317
- })
318
-
319
- return CredentialMapper.toWrappedVerifiableCredential(verifiableCredential as StatusListCredential).original as StatusListCredential
320
- }
321
-
322
- private buildContentType(proofFormat: CredentialProofFormat | undefined) {
323
- switch (proofFormat) {
324
- case 'jwt':
325
- return `application/statuslist+jwt`
326
- case 'cbor':
327
- return `application/statuslist+cwt`
328
- case 'lds':
329
- return 'application/statuslist+ld+json'
330
- default:
331
- throw Error(`Unsupported content type '${proofFormat}' for status lists`)
332
- }
333
- }
334
- }
@@ -1,42 +0,0 @@
1
- export type BitstringConstructorOptions = {
2
- length?: number
3
- buffer?: Uint8Array
4
- leftToRightIndexing?: boolean
5
- littleEndianBits?: boolean // deprecated
6
- }
7
-
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
- }