@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.17.bitstring.sl.2 → 0.34.1-feature.SSISDK.17.bitstring.sl.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.data-store",
3
- "version": "0.34.1-feature.SSISDK.17.bitstring.sl.2+0a0992f6",
3
+ "version": "0.34.1-feature.SSISDK.17.bitstring.sl.8+82c2b7fe",
4
4
  "source": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -30,9 +30,9 @@
30
30
  "@sphereon/pex": "5.0.0-unstable.28",
31
31
  "@sphereon/ssi-sdk-ext.did-utils": "0.29.0",
32
32
  "@sphereon/ssi-sdk-ext.identifier-resolution": "0.29.0",
33
- "@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.17.bitstring.sl.2+0a0992f6",
34
- "@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.17.bitstring.sl.2+0a0992f6",
35
- "@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.2+0a0992f6",
33
+ "@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.17.bitstring.sl.8+82c2b7fe",
34
+ "@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.17.bitstring.sl.8+82c2b7fe",
35
+ "@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.8+82c2b7fe",
36
36
  "@veramo/core": "4.2.0",
37
37
  "@veramo/utils": "4.2.0",
38
38
  "blakejs": "^1.2.1",
@@ -65,5 +65,5 @@
65
65
  "PostgreSQL",
66
66
  "Contact Store"
67
67
  ],
68
- "gitHead": "0a0992f6323610a12e82716b1d80a2eedf4b4669"
68
+ "gitHead": "82c2b7fe8231dde7046c617a95ea5b76da98a1b8"
69
69
  }
@@ -226,7 +226,7 @@ describe('Status list entities tests', () => {
226
226
  statusList.credentialIdMode = StatusListCredentialIdMode.ISSUANCE
227
227
  statusList.proofFormat = 'lds'
228
228
  statusList.statusPurpose = 'revocation'
229
- statusList.statusSize = 1
229
+ statusList.bitsPerStatus = 1
230
230
  statusList.ttl = 3600000
231
231
  statusList.validFrom = new Date('2024-01-01T00:00:00Z')
232
232
  statusList.validUntil = new Date('2025-01-01T00:00:00Z')
@@ -236,7 +236,7 @@ describe('Status list entities tests', () => {
236
236
  expect(fromDb).toBeDefined()
237
237
  expect(fromDb.id).toEqual(statusList.id)
238
238
  expect(fromDb.statusPurpose).toEqual(statusList.statusPurpose)
239
- expect(fromDb.statusSize).toEqual(statusList.statusSize)
239
+ expect(fromDb.bitsPerStatus).toEqual(statusList.bitsPerStatus)
240
240
  expect(fromDb.ttl).toEqual(statusList.ttl)
241
241
  expect(fromDb.validFrom).toEqual(statusList.validFrom)
242
242
  expect(fromDb.validUntil).toEqual(statusList.validUntil)
@@ -261,14 +261,14 @@ describe('Status list entities tests', () => {
261
261
  entry.credentialId = 'bitstring-credential-1'
262
262
  entry.credentialHash = 'bitstring-hash-1'
263
263
  entry.statusPurpose = 'revocation'
264
- entry.statusSize = 1
264
+ entry.bitsPerStatus = 1
265
265
  entry.statusReference = 'https://example.org/status-ref'
266
266
 
267
267
  const fromDb = await dbConnection.getRepository(BitstringStatusListEntryEntity).save(entry)
268
268
  expect(fromDb).toBeDefined()
269
269
  expect(fromDb.statusListIndex).toEqual(entry.statusListIndex)
270
270
  expect(fromDb.statusPurpose).toEqual(entry.statusPurpose)
271
- expect(fromDb.statusSize).toEqual(entry.statusSize)
271
+ expect(fromDb.bitsPerStatus).toEqual(entry.bitsPerStatus)
272
272
  expect(fromDb.statusReference).toEqual(entry.statusReference)
273
273
  })
274
274
  })
@@ -241,7 +241,7 @@ describe('Status list store tests', () => {
241
241
  type: StatusListType.BitstringStatusList,
242
242
  proofFormat: 'lds',
243
243
  statusPurpose: 'revocation',
244
- statusSize: 1,
244
+ bitsPerStatus: 1,
245
245
  ttl: 3600000,
246
246
  validFrom: new Date('2024-01-01T00:00:00Z'),
247
247
  validUntil: new Date('2025-01-01T00:00:00Z'),
@@ -2,8 +2,7 @@ import { Validate } from 'class-validator'
2
2
  import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm'
3
3
  import { IsNonEmptyStringConstraint } from '../validators'
4
4
  import { BitstringStatusListEntity } from './StatusListEntities'
5
- import { BitstringStatusPurpose } from '@sphereon/ssi-types'
6
- import { BitstringStatus } from '../../types'
5
+ import { BitstringStatus } from '../../types/statusList/bitstringTypes'
7
6
 
8
7
  @Entity('BitstringStatusListEntry')
9
8
  export class BitstringStatusListEntryEntity extends BaseEntity {
@@ -28,10 +27,10 @@ export class BitstringStatusListEntryEntity extends BaseEntity {
28
27
  entryCorrelationId?: string
29
28
 
30
29
  @Column({ type: 'varchar', name: 'statusPurpose', nullable: false })
31
- statusPurpose!: BitstringStatusPurpose
30
+ statusPurpose!: string
32
31
 
33
- @Column({ type: 'integer', name: 'statusSize', nullable: true, default: 1 })
34
- statusSize?: number
32
+ @Column({ type: 'integer', name: 'bitsPerStatus', nullable: true, default: 1 })
33
+ bitsPerStatus?: number
35
34
 
36
35
  @Column({
37
36
  type: 'text',
@@ -1,5 +1,4 @@
1
1
  import {
2
- BitstringStatusPurpose,
3
2
  type CredentialProofFormat,
4
3
  type IIssuer,
5
4
  type StatusListCredential,
@@ -127,13 +126,13 @@ export class BitstringStatusListEntity extends StatusListEntity {
127
126
  name: 'statusPurpose',
128
127
  nullable: false,
129
128
  transformer: {
130
- from(value: string): BitstringStatusPurpose | BitstringStatusPurpose[] {
129
+ from(value: string): string | string[] {
131
130
  if (value?.includes(',')) {
132
- return value.split(',').map((v) => v.trim() as BitstringStatusPurpose)
131
+ return value.split(',').map((v) => v.trim() as string)
133
132
  }
134
- return value as BitstringStatusPurpose
133
+ return value as string
135
134
  },
136
- to(value: BitstringStatusPurpose | BitstringStatusPurpose[]): string {
135
+ to(value: string | string[]): string {
137
136
  if (Array.isArray(value)) {
138
137
  return value.join(',')
139
138
  }
@@ -141,10 +140,10 @@ export class BitstringStatusListEntity extends StatusListEntity {
141
140
  },
142
141
  },
143
142
  })
144
- statusPurpose!: BitstringStatusPurpose | BitstringStatusPurpose[]
143
+ statusPurpose!: string | string[]
145
144
 
146
- @Column({ type: 'integer', name: 'statusSize', nullable: true, default: 1 })
147
- statusSize?: number
145
+ @Column({ type: 'integer', name: 'bitsPerStatus', nullable: false })
146
+ bitsPerStatus?: number
148
147
 
149
148
  @Column({ name: 'validFrom', nullable: true, type: typeOrmDateTime() })
150
149
  validFrom?: Date
@@ -5,7 +5,7 @@ export class CreateBitstringStatusListPG1741895823000 implements MigrationInterf
5
5
 
6
6
  public async up(queryRunner: QueryRunner): Promise<void> {
7
7
  // Add BitstringStatusList columns to StatusList table
8
- await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "statusSize" integer DEFAULT 1`)
8
+ await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`)
9
9
  await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "ttl" integer`)
10
10
  await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validFrom" TIMESTAMP`)
11
11
  await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validUntil" TIMESTAMP`)
@@ -25,7 +25,7 @@ export class CreateBitstringStatusListPG1741895823000 implements MigrationInterf
25
25
  "credentialHash" character varying(128),
26
26
  "correlationId" character varying(255),
27
27
  "statusPurpose" character varying NOT NULL,
28
- "statusSize" integer DEFAULT 1,
28
+ "bitsPerStatus" integer DEFAULT 1,
29
29
  "statusMessage" text,
30
30
  "statusReference" text,
31
31
  CONSTRAINT "PK_BitstringStatusListEntry" PRIMARY KEY ("statusListId", "statusListIndex")
@@ -49,6 +49,6 @@ export class CreateBitstringStatusListPG1741895823000 implements MigrationInterf
49
49
  await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validUntil"`)
50
50
  await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validFrom"`)
51
51
  await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "ttl"`)
52
- await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "statusSize"`)
52
+ await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`)
53
53
  }
54
54
  }
@@ -18,9 +18,8 @@ export class CreateBitstringStatusListSqlite1741895823001 implements MigrationIn
18
18
  "indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
19
19
  "statusPurpose" varchar,
20
20
  "statusListCredential" text,
21
- "bitsPerStatus" integer,
22
21
  "expiresAt" datetime,
23
- "statusSize" integer DEFAULT (1),
22
+ "bitsPerStatus" integer DEFAULT (1),
24
23
  "ttl" integer,
25
24
  "validFrom" datetime,
26
25
  "validUntil" datetime,
@@ -53,7 +52,7 @@ export class CreateBitstringStatusListSqlite1741895823001 implements MigrationIn
53
52
  "credentialHash" varchar(128),
54
53
  "correlationId" varchar(255),
55
54
  "statusPurpose" varchar NOT NULL,
56
- "statusSize" integer DEFAULT (1),
55
+ "bitsPerStatus" integer DEFAULT (1),
57
56
  "statusMessage" text,
58
57
  "statusReference" text,
59
58
  PRIMARY KEY ("statusListId", "statusListIndex")
@@ -45,7 +45,7 @@ export class StatusListStore implements IStatusListStore {
45
45
  const results = (
46
46
  await repo.find({
47
47
  where: {
48
- statusList,
48
+ statusListId: statusList.id,
49
49
  statusListIndex: In(statusListIndex),
50
50
  },
51
51
  })
@@ -6,6 +6,7 @@ export * from './presentationDefinition/presentationDefinition'
6
6
  export * from './presentationDefinition/IAbstractPDStore'
7
7
  export * from './validation/validation'
8
8
  export * from './statusList/statusList'
9
+ export * from './statusList/bitstringTypes'
9
10
  export * from './statusList/IAbstractStatusListStore'
10
11
  export * from './eventLogger/IAbstractEventLoggerStore'
11
12
  export * from './eventLogger/eventLogger'
@@ -0,0 +1,7 @@
1
+ export type BitstringStatusPurpose = 'revocation' | 'suspension' | 'refresh' | 'message' | string // From vc-bitstring-status-lists without pulling in the whole dep for just this one type
2
+
3
+ export type BitstringStatus = {
4
+ status: string
5
+ message?: string
6
+ [x: string]: any
7
+ }
@@ -1,5 +1,4 @@
1
1
  import {
2
- BitstringStatusPurpose,
3
2
  type CredentialProofFormat,
4
3
  IIssuer,
5
4
  RequireOneOf,
@@ -11,12 +10,7 @@ import {
11
10
  StatusPurpose2021,
12
11
  } from '@sphereon/ssi-types'
13
12
  import { StatusListEntity } from '../../entities/statusList/StatusListEntities'
14
-
15
- export type BitstringStatus = {
16
- status: string
17
- message?: string
18
- [x: string]: any
19
- }
13
+ import { BitstringStatusPurpose } from './bitstringTypes'
20
14
 
21
15
  export interface IStatusListEntity {
22
16
  id: string
@@ -28,6 +22,7 @@ export interface IStatusListEntity {
28
22
  type: StatusListType
29
23
  proofFormat: CredentialProofFormat
30
24
  statusListCredential?: StatusListCredential
25
+ bitsPerStatus?: number
31
26
  }
32
27
 
33
28
  export interface IStatusList2021Entity extends IStatusListEntity {
@@ -42,7 +37,7 @@ export interface IOAuthStatusListEntity extends IStatusListEntity {
42
37
 
43
38
  export interface IBitstringStatusListEntity extends IStatusListEntity {
44
39
  statusPurpose: BitstringStatusPurpose | BitstringStatusPurpose[]
45
- statusSize?: number
40
+ bitsPerStatus?: number
46
41
  validFrom?: Date
47
42
  validUntil?: Date
48
43
  ttl?: number
@@ -40,8 +40,12 @@ export const statusListEntityFrom = (args: IStatusListEntity): StatusListEntity
40
40
  if (args.type === StatusListType.BitstringStatusList) {
41
41
  const entity = new BitstringStatusListEntity()
42
42
  const bitstringsl = args as IBitstringStatusListEntity
43
+ if (!bitstringsl.bitsPerStatus) {
44
+ throw Error('bitsPerStatus must be set for BitstringStatusList')
45
+ }
46
+
43
47
  entity.statusPurpose = bitstringsl.statusPurpose
44
- entity.statusSize = bitstringsl.statusSize
48
+ entity.bitsPerStatus = bitstringsl.bitsPerStatus
45
49
  entity.validFrom = bitstringsl.validFrom
46
50
  entity.validUntil = bitstringsl.validUntil
47
51
  entity.ttl = bitstringsl.ttl
@@ -83,7 +87,7 @@ export const statusListFrom = (entity: StatusListEntity): IStatusListEntity => {
83
87
  ...getBaseFields(entity),
84
88
  type: StatusListType.BitstringStatusList,
85
89
  statusPurpose: entity.statusPurpose,
86
- statusSize: entity.statusSize,
90
+ bitsPerStatus: entity.bitsPerStatus,
87
91
  validFrom: entity.validFrom,
88
92
  validUntil: entity.validUntil,
89
93
  ttl: entity.ttl,