@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.17.bitstring.sl.2 → 0.34.1-feature.SSISDK.17.bitstring.sl.24
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/dist/index.cjs +232 -217
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -44
- package/dist/index.d.ts +94 -44
- package/dist/index.js +178 -163
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/statusList.entities.test.ts +4 -4
- package/src/__tests__/statusList.store.test.ts +2 -1
- package/src/entities/statusList/BitstringStatusListEntryEntity.ts +11 -34
- package/src/entities/statusList/StatusList2021EntryEntity.ts +2 -1
- package/src/entities/statusList/StatusListEntities.ts +14 -8
- package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +25 -26
- package/src/migrations/sqlite/1741895823001-CreateBitstringStatusList.ts +51 -9
- package/src/statusList/IStatusListStore.ts +14 -11
- package/src/statusList/StatusListStore.ts +69 -32
- package/src/types/statusList/IAbstractStatusListStore.ts +44 -4
- package/src/types/statusList/statusList.ts +41 -8
- package/src/utils/statusList/MappingUtils.ts +7 -3
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.
|
|
3
|
+
"version": "0.34.1-feature.SSISDK.17.bitstring.sl.24+d486d9b6",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
|
|
30
30
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
31
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.29.
|
|
32
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.29.
|
|
33
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
34
|
-
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
35
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.29.1-next.3",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.29.1-next.3",
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.17.bitstring.sl.24+d486d9b6",
|
|
34
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.17.bitstring.sl.24+d486d9b6",
|
|
35
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.17.bitstring.sl.24+d486d9b6",
|
|
36
36
|
"@veramo/core": "4.2.0",
|
|
37
37
|
"@veramo/utils": "4.2.0",
|
|
38
38
|
"blakejs": "^1.2.1",
|
|
39
|
-
"class-validator": "
|
|
39
|
+
"class-validator": "0.14.1",
|
|
40
40
|
"dcql": "0.2.19",
|
|
41
41
|
"debug": "^4.3.5",
|
|
42
42
|
"typeorm": "0.3.20"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"PostgreSQL",
|
|
66
66
|
"Contact Store"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "d486d9b69ca1a5c0df614642a2d1e158a60edee8"
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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'),
|
|
@@ -277,6 +277,7 @@ describe('Status list store tests', () => {
|
|
|
277
277
|
credentialIdMode: StatusListCredentialIdMode.ISSUANCE,
|
|
278
278
|
type: StatusListType.BitstringStatusList,
|
|
279
279
|
proofFormat: 'lds',
|
|
280
|
+
bitsPerStatus: 1,
|
|
280
281
|
statusPurpose: 'suspension',
|
|
281
282
|
ttl: 3600000,
|
|
282
283
|
issuer: 'did:example:789',
|
|
@@ -1,50 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { BitstringStatusListEntity } from './StatusListEntities'
|
|
5
|
-
import { BitstringStatusPurpose } from '@sphereon/ssi-types'
|
|
6
|
-
import { BitstringStatus } from '../../types'
|
|
7
|
-
|
|
8
|
-
@Entity('BitstringStatusListEntry')
|
|
9
|
-
export class BitstringStatusListEntryEntity extends BaseEntity {
|
|
10
|
-
@PrimaryColumn({ name: 'statusListId', type: 'varchar', nullable: false, unique: false })
|
|
11
|
-
@Validate(IsNonEmptyStringConstraint, { message: 'Status list id is required' })
|
|
12
|
-
statusListId!: string
|
|
13
|
-
|
|
14
|
-
@PrimaryColumn({ name: 'statusListIndex', type: 'integer', nullable: false, unique: false })
|
|
15
|
-
statusListIndex!: number
|
|
16
|
-
|
|
17
|
-
@ManyToOne(() => BitstringStatusListEntity, (statusList) => statusList.statusListEntries)
|
|
18
|
-
@JoinColumn({ name: 'statusListId' })
|
|
19
|
-
statusList!: BitstringStatusListEntity
|
|
20
|
-
|
|
21
|
-
@Column({ name: 'credentialId', type: 'text', nullable: true })
|
|
22
|
-
credentialId?: string
|
|
23
|
-
|
|
24
|
-
@Column({ name: 'credentialHash', length: 128, type: 'varchar', nullable: true, unique: false })
|
|
25
|
-
credentialHash?: string
|
|
26
|
-
|
|
27
|
-
@Column({ name: 'correlationId', length: 255, type: 'varchar', nullable: true, unique: false })
|
|
28
|
-
entryCorrelationId?: string
|
|
1
|
+
import { ChildEntity, Column } from 'typeorm'
|
|
2
|
+
import { StatusListEntryEntity } from './StatusList2021EntryEntity'
|
|
3
|
+
import { BitstringStatusMessage } from '../../types'
|
|
29
4
|
|
|
5
|
+
@ChildEntity('bitstring')
|
|
6
|
+
export class BitstringStatusListEntryEntity extends StatusListEntryEntity {
|
|
30
7
|
@Column({ type: 'varchar', name: 'statusPurpose', nullable: false })
|
|
31
|
-
statusPurpose!:
|
|
8
|
+
statusPurpose!: string
|
|
32
9
|
|
|
33
|
-
@Column({ type: 'integer', name: '
|
|
34
|
-
|
|
10
|
+
@Column({ type: 'integer', name: 'bitsPerStatus', nullable: true, default: 1 })
|
|
11
|
+
bitsPerStatus?: number
|
|
35
12
|
|
|
36
13
|
@Column({
|
|
37
14
|
type: 'text',
|
|
38
15
|
name: 'statusMessage',
|
|
39
16
|
nullable: true,
|
|
40
17
|
transformer: {
|
|
41
|
-
from(value: string): Array<
|
|
18
|
+
from(value: string): Array<BitstringStatusMessage> | undefined {
|
|
42
19
|
if (!value) {
|
|
43
20
|
return undefined
|
|
44
21
|
}
|
|
45
22
|
return JSON.parse(value)
|
|
46
23
|
},
|
|
47
|
-
to(value: Array<
|
|
24
|
+
to(value: Array<BitstringStatusMessage> | undefined): string | undefined {
|
|
48
25
|
if (!value) {
|
|
49
26
|
return undefined
|
|
50
27
|
}
|
|
@@ -52,7 +29,7 @@ export class BitstringStatusListEntryEntity extends BaseEntity {
|
|
|
52
29
|
},
|
|
53
30
|
},
|
|
54
31
|
})
|
|
55
|
-
statusMessage?: Array<
|
|
32
|
+
statusMessage?: Array<BitstringStatusMessage>
|
|
56
33
|
|
|
57
34
|
@Column({
|
|
58
35
|
type: 'text',
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Validate } from 'class-validator'
|
|
2
|
-
import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm'
|
|
2
|
+
import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, PrimaryColumn, TableInheritance } from 'typeorm'
|
|
3
3
|
import { IsNonEmptyStringConstraint } from '../validators'
|
|
4
4
|
import { StatusList2021Entity, StatusListEntity } from './StatusListEntities'
|
|
5
5
|
|
|
6
6
|
@Entity('StatusListEntry')
|
|
7
7
|
// @Unique('uq_credential_statuslist', ['statusList', 'credentialId']) // disabled because one prop can be null
|
|
8
8
|
// @Unique('uq_credentialHash_statuslistId', ['statusList', 'credentialHash']) // disabled because one prop can be null
|
|
9
|
+
@TableInheritance({ column: { type: 'varchar', name: 'type' } })
|
|
9
10
|
export class StatusListEntryEntity extends BaseEntity {
|
|
10
11
|
@PrimaryColumn({ name: 'statusListId', type: 'varchar', nullable: false, unique: false })
|
|
11
12
|
@Validate(IsNonEmptyStringConstraint, { message: 'Status list id is required' })
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BitstringStatusPurpose,
|
|
3
2
|
type CredentialProofFormat,
|
|
4
3
|
type IIssuer,
|
|
5
4
|
type StatusListCredential,
|
|
@@ -30,6 +29,13 @@ export abstract class StatusListEntity extends BaseEntity {
|
|
|
30
29
|
@Column({ name: 'length', type: 'integer', nullable: false, unique: false })
|
|
31
30
|
length!: number
|
|
32
31
|
|
|
32
|
+
@Column('simple-enum', {
|
|
33
|
+
name: 'type',
|
|
34
|
+
enum: StatusListType,
|
|
35
|
+
nullable: false,
|
|
36
|
+
})
|
|
37
|
+
type!: StatusListType
|
|
38
|
+
|
|
33
39
|
@Column({
|
|
34
40
|
name: 'issuer',
|
|
35
41
|
type: 'text',
|
|
@@ -127,13 +133,13 @@ export class BitstringStatusListEntity extends StatusListEntity {
|
|
|
127
133
|
name: 'statusPurpose',
|
|
128
134
|
nullable: false,
|
|
129
135
|
transformer: {
|
|
130
|
-
from(value: string):
|
|
136
|
+
from(value: string): string | string[] {
|
|
131
137
|
if (value?.includes(',')) {
|
|
132
|
-
return value.split(',').map((v) => v.trim() as
|
|
138
|
+
return value.split(',').map((v) => v.trim() as string)
|
|
133
139
|
}
|
|
134
|
-
return value as
|
|
140
|
+
return value as string
|
|
135
141
|
},
|
|
136
|
-
to(value:
|
|
142
|
+
to(value: string | string[]): string {
|
|
137
143
|
if (Array.isArray(value)) {
|
|
138
144
|
return value.join(',')
|
|
139
145
|
}
|
|
@@ -141,10 +147,10 @@ export class BitstringStatusListEntity extends StatusListEntity {
|
|
|
141
147
|
},
|
|
142
148
|
},
|
|
143
149
|
})
|
|
144
|
-
statusPurpose!:
|
|
150
|
+
statusPurpose!: string | string[]
|
|
145
151
|
|
|
146
|
-
@Column({ type: 'integer', name: '
|
|
147
|
-
|
|
152
|
+
@Column({ type: 'integer', name: 'bitsPerStatus', nullable: false })
|
|
153
|
+
bitsPerStatus?: number
|
|
148
154
|
|
|
149
155
|
@Column({ name: 'validFrom', nullable: true, type: typeOrmDateTime() })
|
|
150
156
|
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 "
|
|
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`)
|
|
@@ -16,39 +16,38 @@ export class CreateBitstringStatusListPG1741895823000 implements MigrationInterf
|
|
|
16
16
|
`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList'))`,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
await queryRunner.query(`
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
)
|
|
33
|
-
`)
|
|
34
|
-
|
|
35
|
-
await queryRunner.query(`
|
|
36
|
-
ALTER TABLE "BitstringStatusListEntry"
|
|
37
|
-
ADD CONSTRAINT "FK_BitstringStatusListEntry_statusListId"
|
|
38
|
-
FOREIGN KEY ("statusListId") REFERENCES "StatusList"("id") ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
39
|
-
`)
|
|
19
|
+
// Add inheritance discriminator column to StatusListEntry table
|
|
20
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "type" character varying NOT NULL DEFAULT 'StatusListEntryEntity'`)
|
|
21
|
+
|
|
22
|
+
// Add BitstringStatusListEntry specific columns to StatusListEntry table
|
|
23
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusPurpose" character varying`)
|
|
24
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`)
|
|
25
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusMessage" text`)
|
|
26
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusReference" text`)
|
|
27
|
+
|
|
28
|
+
// Add constraint for entry type
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "CHK_StatusListEntry_type" CHECK ("type" IN ('StatusListEntryEntity', 'bitstring'))`,
|
|
31
|
+
)
|
|
40
32
|
}
|
|
41
33
|
|
|
42
34
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
43
|
-
|
|
44
|
-
await queryRunner.query(`
|
|
45
|
-
|
|
35
|
+
// Remove entry type constraint and columns
|
|
36
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP CONSTRAINT "CHK_StatusListEntry_type"`)
|
|
37
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusReference"`)
|
|
38
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusMessage"`)
|
|
39
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "bitsPerStatus"`)
|
|
40
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusPurpose"`)
|
|
41
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "type"`)
|
|
42
|
+
|
|
43
|
+
// Revert StatusList type constraint
|
|
46
44
|
await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT "CHK_StatusList_type"`)
|
|
47
45
|
await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList'))`)
|
|
48
46
|
|
|
47
|
+
// Remove BitstringStatusList columns from StatusList table
|
|
49
48
|
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validUntil"`)
|
|
50
49
|
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validFrom"`)
|
|
51
50
|
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "ttl"`)
|
|
52
|
-
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "
|
|
51
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`)
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -14,13 +14,12 @@ export class CreateBitstringStatusListSqlite1741895823001 implements MigrationIn
|
|
|
14
14
|
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
15
15
|
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
16
16
|
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
17
|
-
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
|
|
17
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
|
|
18
18
|
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
19
19
|
"statusPurpose" varchar,
|
|
20
20
|
"statusListCredential" text,
|
|
21
|
-
"bitsPerStatus" integer,
|
|
22
21
|
"expiresAt" datetime,
|
|
23
|
-
"
|
|
22
|
+
"bitsPerStatus" integer DEFAULT (1),
|
|
24
23
|
"ttl" integer,
|
|
25
24
|
"validFrom" datetime,
|
|
26
25
|
"validUntil" datetime,
|
|
@@ -44,26 +43,69 @@ export class CreateBitstringStatusListSqlite1741895823001 implements MigrationIn
|
|
|
44
43
|
await queryRunner.query(`DROP TABLE "StatusList"`)
|
|
45
44
|
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`)
|
|
46
45
|
|
|
47
|
-
//
|
|
46
|
+
// Update StatusListEntry table with inheritance and bitstring columns
|
|
48
47
|
await queryRunner.query(`
|
|
49
|
-
CREATE TABLE "
|
|
48
|
+
CREATE TABLE "temporary_StatusListEntry" (
|
|
50
49
|
"statusListId" varchar NOT NULL,
|
|
51
50
|
"statusListIndex" integer NOT NULL,
|
|
52
51
|
"credentialId" text,
|
|
53
52
|
"credentialHash" varchar(128),
|
|
54
53
|
"correlationId" varchar(255),
|
|
55
|
-
"
|
|
56
|
-
"
|
|
54
|
+
"value" varchar(50),
|
|
55
|
+
"type" varchar CHECK( "type" IN ('StatusListEntryEntity', 'bitstring') ) NOT NULL DEFAULT ('StatusListEntryEntity'),
|
|
56
|
+
"statusPurpose" varchar,
|
|
57
|
+
"bitsPerStatus" integer DEFAULT (1),
|
|
57
58
|
"statusMessage" text,
|
|
58
59
|
"statusReference" text,
|
|
59
60
|
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
60
61
|
)
|
|
61
62
|
`)
|
|
63
|
+
|
|
64
|
+
await queryRunner.query(`
|
|
65
|
+
INSERT INTO "temporary_StatusListEntry"(
|
|
66
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
67
|
+
"correlationId", "value", "type"
|
|
68
|
+
)
|
|
69
|
+
SELECT
|
|
70
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
71
|
+
"correlationId", "value", 'StatusListEntryEntity'
|
|
72
|
+
FROM "StatusListEntry"
|
|
73
|
+
`)
|
|
74
|
+
|
|
75
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`)
|
|
76
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`)
|
|
62
77
|
}
|
|
63
78
|
|
|
64
79
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
65
|
-
|
|
80
|
+
// Revert StatusListEntry table changes
|
|
81
|
+
await queryRunner.query(`
|
|
82
|
+
CREATE TABLE "temporary_StatusListEntry" (
|
|
83
|
+
"statusListId" varchar NOT NULL,
|
|
84
|
+
"statusListIndex" integer NOT NULL,
|
|
85
|
+
"credentialId" text,
|
|
86
|
+
"credentialHash" varchar(128),
|
|
87
|
+
"correlationId" varchar(255),
|
|
88
|
+
"value" varchar(50),
|
|
89
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
90
|
+
)
|
|
91
|
+
`)
|
|
92
|
+
|
|
93
|
+
await queryRunner.query(`
|
|
94
|
+
INSERT INTO "temporary_StatusListEntry"(
|
|
95
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
96
|
+
"correlationId", "value"
|
|
97
|
+
)
|
|
98
|
+
SELECT
|
|
99
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
100
|
+
"correlationId", "value"
|
|
101
|
+
FROM "StatusListEntry"
|
|
102
|
+
WHERE "type" = 'StatusListEntryEntity'
|
|
103
|
+
`)
|
|
104
|
+
|
|
105
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`)
|
|
106
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`)
|
|
66
107
|
|
|
108
|
+
// Revert StatusList table changes
|
|
67
109
|
await queryRunner.query(`
|
|
68
110
|
CREATE TABLE "temporary_StatusList" (
|
|
69
111
|
"id" varchar PRIMARY KEY NOT NULL,
|
|
@@ -73,7 +115,7 @@ export class CreateBitstringStatusListSqlite1741895823001 implements MigrationIn
|
|
|
73
115
|
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
74
116
|
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
75
117
|
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
76
|
-
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
|
|
118
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
|
|
77
119
|
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
78
120
|
"statusPurpose" varchar,
|
|
79
121
|
"statusListCredential" text,
|
|
@@ -2,6 +2,8 @@ import { StatusListEntryEntity } from '../entities/statusList/StatusList2021Entr
|
|
|
2
2
|
import type {
|
|
3
3
|
IAddStatusListArgs,
|
|
4
4
|
IAddStatusListEntryArgs,
|
|
5
|
+
IBitstringStatusListEntity,
|
|
6
|
+
IBitstringStatusListEntryEntity,
|
|
5
7
|
IGetStatusListArgs,
|
|
6
8
|
IGetStatusListEntriesArgs,
|
|
7
9
|
IGetStatusListEntryByCredentialIdArgs,
|
|
@@ -12,33 +14,34 @@ import type {
|
|
|
12
14
|
IUpdateStatusListIndexArgs,
|
|
13
15
|
} from '../types'
|
|
14
16
|
import { IStatusListEntity, IStatusListEntryEntity } from '../types'
|
|
17
|
+
import { BitstringStatusListEntryEntity } from '../entities/statusList/BitstringStatusListEntryEntity'
|
|
15
18
|
|
|
16
19
|
export interface IStatusListStore {
|
|
17
|
-
getStatusList(args: IGetStatusListArgs): Promise<IStatusListEntity>
|
|
20
|
+
getStatusList(args: IGetStatusListArgs): Promise<IStatusListEntity | IBitstringStatusListEntity>
|
|
18
21
|
|
|
19
|
-
getStatusLists(args: IGetStatusListsArgs): Promise<Array<IStatusListEntity>>
|
|
22
|
+
getStatusLists(args: IGetStatusListsArgs): Promise<Array<IStatusListEntity | IBitstringStatusListEntity>>
|
|
20
23
|
|
|
21
24
|
removeStatusList(args: IRemoveStatusListArgs): Promise<boolean>
|
|
22
25
|
|
|
23
|
-
addStatusList(args: IAddStatusListArgs): Promise<IStatusListEntity>
|
|
26
|
+
addStatusList(args: IAddStatusListArgs): Promise<IStatusListEntity | IBitstringStatusListEntity>
|
|
24
27
|
|
|
25
|
-
updateStatusList(args: IUpdateStatusListIndexArgs): Promise<IStatusListEntity>
|
|
28
|
+
updateStatusList(args: IUpdateStatusListIndexArgs): Promise<IStatusListEntity | IBitstringStatusListEntity>
|
|
26
29
|
|
|
27
30
|
availableStatusListEntries(args: IStatusListEntryAvailableArgs): Promise<number[]>
|
|
28
31
|
|
|
29
|
-
addStatusListEntry(args: IAddStatusListEntryArgs): Promise<IStatusListEntryEntity>
|
|
32
|
+
addStatusListEntry(args: IAddStatusListEntryArgs): Promise<IStatusListEntryEntity | IBitstringStatusListEntryEntity>
|
|
30
33
|
|
|
31
|
-
updateStatusListEntry(args: IAddStatusListEntryArgs): Promise<IStatusListEntryEntity>
|
|
34
|
+
updateStatusListEntry(args: IAddStatusListEntryArgs): Promise<IStatusListEntryEntity | IBitstringStatusListEntryEntity>
|
|
32
35
|
|
|
33
|
-
getStatusListEntryByIndex(args: IGetStatusListEntryByIndexArgs): Promise<StatusListEntryEntity | undefined>
|
|
36
|
+
getStatusListEntryByIndex(args: IGetStatusListEntryByIndexArgs): Promise<StatusListEntryEntity | BitstringStatusListEntryEntity | undefined>
|
|
34
37
|
|
|
35
|
-
getStatusListEntryByCredentialId(
|
|
38
|
+
getStatusListEntryByCredentialId(
|
|
39
|
+
args: IGetStatusListEntryByCredentialIdArgs,
|
|
40
|
+
): Promise<StatusListEntryEntity | BitstringStatusListEntryEntity | undefined>
|
|
36
41
|
|
|
37
42
|
removeStatusListEntryByIndex(args: IGetStatusListEntryByIndexArgs): Promise<boolean>
|
|
38
43
|
|
|
39
44
|
removeStatusListEntryByCredentialId(args: IGetStatusListEntryByCredentialIdArgs): Promise<boolean>
|
|
40
45
|
|
|
41
|
-
getStatusListEntries(args: IGetStatusListEntriesArgs): Promise<IStatusListEntryEntity
|
|
42
|
-
|
|
43
|
-
getStatusList(args: IGetStatusListArgs): Promise<IStatusListEntity>
|
|
46
|
+
getStatusListEntries(args: IGetStatusListEntriesArgs): Promise<Array<IStatusListEntryEntity | IBitstringStatusListEntryEntity>>
|
|
44
47
|
}
|