@sphereon/ssi-sdk.data-store 0.29.1-next.106 → 0.29.1-next.122
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/digitalCredential/DigitalCredentialStore.d.ts +5 -1
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.js +57 -8
- package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts +9 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js +32 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -1
- package/dist/eventLogger/EventLoggerStore.d.ts +1 -0
- package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
- package/dist/eventLogger/EventLoggerStore.js +5 -3
- package/dist/eventLogger/EventLoggerStore.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +4 -0
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js +42 -13
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.d.ts.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +16 -4
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -1
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.d.ts.map +1 -1
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +15 -5
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js.map +1 -1
- package/dist/types/contact/contact.d.ts +2 -2
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts +5 -1
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts.map +1 -1
- package/dist/types/digitalCredential/digitalCredential.d.ts +20 -3
- package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -1
- package/dist/types/digitalCredential/digitalCredential.js +13 -5
- package/dist/types/digitalCredential/digitalCredential.js.map +1 -1
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.js +12 -25
- package/dist/utils/contact/MappingUtils.js.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts +4 -0
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +45 -9
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/dist/utils/hasher.d.ts +3 -0
- package/dist/utils/hasher.d.ts.map +1 -0
- package/dist/utils/hasher.js +20 -0
- package/dist/utils/hasher.js.map +1 -0
- package/dist/utils/presentationDefinition/MappingUtils.d.ts.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.js +1 -3
- package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
- package/package.json +11 -8
- package/src/__tests__/digitalCredential.entities.test.ts +12 -0
- package/src/__tests__/digitalCredential.store.test.ts +22 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +66 -10
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +25 -0
- package/src/eventLogger/EventLoggerStore.ts +25 -3
- package/src/index.ts +2 -0
- package/src/issuanceBranding/IssuanceBrandingStore.ts +62 -14
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +17 -4
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +15 -5
- package/src/types/contact/contact.ts +2 -2
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +5 -1
- package/src/types/digitalCredential/digitalCredential.ts +21 -5
- package/src/utils/contact/MappingUtils.ts +16 -39
- package/src/utils/digitalCredential/MappingUtils.ts +51 -10
- package/src/utils/hasher.ts +19 -0
- package/src/utils/presentationDefinition/MappingUtils.ts +1 -4
- package/dist/utils/FormattingUtils.d.ts +0 -2
- package/dist/utils/FormattingUtils.d.ts.map +0 -1
- package/dist/utils/FormattingUtils.js +0 -23
- package/dist/utils/FormattingUtils.js.map +0 -1
- package/dist/utils/eventLogger/MappingUtils.d.ts +0 -4
- package/dist/utils/eventLogger/MappingUtils.d.ts.map +0 -1
- package/dist/utils/eventLogger/MappingUtils.js +0 -10
- package/dist/utils/eventLogger/MappingUtils.js.map +0 -1
- package/dist/utils/issuanceBranding/MappingUtils.d.ts +0 -8
- package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +0 -1
- package/dist/utils/issuanceBranding/MappingUtils.js +0 -20
- package/dist/utils/issuanceBranding/MappingUtils.js.map +0 -1
- package/src/utils/FormattingUtils.ts +0 -21
- package/src/utils/eventLogger/MappingUtils.ts +0 -28
- package/src/utils/issuanceBranding/MappingUtils.ts +0 -32
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
2
2
|
import { IIdentifier } from '@veramo/core'
|
|
3
3
|
import { ILocaleBranding } from '../issuanceBranding/issuanceBranding'
|
|
4
4
|
import { CredentialRole } from '../digitalCredential/digitalCredential'
|
|
@@ -149,7 +149,7 @@ export type PartialOpenIdConfig = Partial<OpenIdConfig>
|
|
|
149
149
|
|
|
150
150
|
export type DidAuthConfig = {
|
|
151
151
|
id: string
|
|
152
|
-
idOpts:
|
|
152
|
+
idOpts: ManagedIdentifierOptsOrResult
|
|
153
153
|
stateId: string
|
|
154
154
|
ownerId?: string
|
|
155
155
|
tenantId?: string
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CredentialCorrelationType, CredentialRole, CredentialStateType, DigitalCredential } from './digitalCredential'
|
|
1
|
+
import { CredentialCorrelationType, CredentialRole, CredentialStateType, DigitalCredential, RegulationType } from './digitalCredential'
|
|
2
2
|
import { Hasher } from '@sphereon/ssi-types'
|
|
3
3
|
import { FindOptionsOrder } from 'typeorm'
|
|
4
4
|
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
|
|
@@ -21,6 +21,10 @@ export type GetCredentialsResponse = {
|
|
|
21
21
|
|
|
22
22
|
export type AddCredentialArgs = {
|
|
23
23
|
rawDocument: string
|
|
24
|
+
kmsKeyRef?: string
|
|
25
|
+
identifierMethod?: string
|
|
26
|
+
regulationType?: RegulationType
|
|
27
|
+
parentId?: string
|
|
24
28
|
issuerCorrelationType: CredentialCorrelationType
|
|
25
29
|
subjectCorrelationType?: CredentialCorrelationType
|
|
26
30
|
issuerCorrelationId: string
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id'>
|
|
1
|
+
export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & { regulationType?: RegulationType }
|
|
2
2
|
|
|
3
3
|
export type DigitalCredential = {
|
|
4
4
|
id: string
|
|
5
|
+
parentId?: string
|
|
5
6
|
documentType: DocumentType
|
|
6
7
|
documentFormat: CredentialDocumentFormat
|
|
7
8
|
credentialRole: CredentialRole
|
|
9
|
+
regulationType: RegulationType
|
|
8
10
|
rawDocument: string
|
|
9
11
|
uniformDocument: string
|
|
10
12
|
credentialId?: string
|
|
11
13
|
hash: string
|
|
14
|
+
kmsKeyRef?: string
|
|
15
|
+
identifierMethod?: string
|
|
12
16
|
issuerCorrelationType: CredentialCorrelationType
|
|
13
17
|
subjectCorrelationType?: CredentialCorrelationType
|
|
18
|
+
rpCorrelationType?: CredentialCorrelationType
|
|
19
|
+
isIssuerSigned?: boolean
|
|
14
20
|
issuerCorrelationId: string
|
|
15
21
|
subjectCorrelationId?: string
|
|
22
|
+
rpCorrelationId?: string
|
|
16
23
|
verifiedState?: CredentialStateType
|
|
17
24
|
tenantId?: string
|
|
18
25
|
createdAt: Date
|
|
26
|
+
presentedAt?: Date
|
|
19
27
|
lastUpdatedAt: Date
|
|
20
28
|
validUntil?: Date
|
|
21
29
|
validFrom?: Date
|
|
@@ -30,11 +38,18 @@ export enum DocumentType {
|
|
|
30
38
|
C = 'C',
|
|
31
39
|
}
|
|
32
40
|
|
|
41
|
+
export enum RegulationType {
|
|
42
|
+
PID = 'PID',
|
|
43
|
+
QEAA = 'QEAA',
|
|
44
|
+
EAA = 'EAA',
|
|
45
|
+
NON_REGULATED = 'NON_REGULATED',
|
|
46
|
+
}
|
|
47
|
+
|
|
33
48
|
export enum CredentialDocumentFormat {
|
|
34
49
|
JSON_LD = 'JSON_LD',
|
|
35
50
|
JWT = 'JWT',
|
|
36
51
|
SD_JWT = 'SD_JWT',
|
|
37
|
-
|
|
52
|
+
MSO_MDOC = 'MSO_MDOC',
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
export namespace CredentialDocumentFormat {
|
|
@@ -45,7 +60,7 @@ export namespace CredentialDocumentFormat {
|
|
|
45
60
|
} else if (format.includes('ldp')) {
|
|
46
61
|
return CredentialDocumentFormat.JSON_LD
|
|
47
62
|
} else if (format.includes('mso') || credentialFormat.includes('mdoc')) {
|
|
48
|
-
return CredentialDocumentFormat.
|
|
63
|
+
return CredentialDocumentFormat.MSO_MDOC
|
|
49
64
|
} else if (format.includes('jwt_')) {
|
|
50
65
|
return CredentialDocumentFormat.JWT
|
|
51
66
|
} else {
|
|
@@ -57,7 +72,7 @@ export namespace CredentialDocumentFormat {
|
|
|
57
72
|
switch (documentFormat) {
|
|
58
73
|
case CredentialDocumentFormat.SD_JWT:
|
|
59
74
|
return 'vc+sd-jwt'
|
|
60
|
-
case CredentialDocumentFormat.
|
|
75
|
+
case CredentialDocumentFormat.MSO_MDOC:
|
|
61
76
|
return 'mso_mdoc'
|
|
62
77
|
case CredentialDocumentFormat.JSON_LD:
|
|
63
78
|
return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'
|
|
@@ -69,7 +84,8 @@ export namespace CredentialDocumentFormat {
|
|
|
69
84
|
|
|
70
85
|
export enum CredentialCorrelationType {
|
|
71
86
|
DID = 'DID',
|
|
72
|
-
|
|
87
|
+
X509_SAN = 'X509_SAN',
|
|
88
|
+
KID = 'KID',
|
|
73
89
|
URL = 'URL',
|
|
74
90
|
}
|
|
75
91
|
|
|
@@ -47,7 +47,6 @@ import { OpenIdConfigEntity } from '../../entities/contact/OpenIdConfigEntity'
|
|
|
47
47
|
import { PartyTypeEntity } from '../../entities/contact/PartyTypeEntity'
|
|
48
48
|
import { PhysicalAddressEntity } from '../../entities/contact/PhysicalAddressEntity'
|
|
49
49
|
import { ContactMetadataItemEntity } from '../../entities/contact/ContactMetadataItemEntity'
|
|
50
|
-
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
51
50
|
|
|
52
51
|
export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
|
|
53
52
|
const partyEntity: PartyEntity = new PartyEntity()
|
|
@@ -68,7 +67,7 @@ export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
|
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
export const partyFrom = (party: PartyEntity): Party => {
|
|
71
|
-
|
|
70
|
+
return {
|
|
72
71
|
id: party.id,
|
|
73
72
|
uri: party.uri,
|
|
74
73
|
roles: [...new Set(party.identities?.flatMap((identity: IdentityEntity) => identity.roles))] ?? [],
|
|
@@ -87,8 +86,6 @@ export const partyFrom = (party: PartyEntity): Party => {
|
|
|
87
86
|
createdAt: party.createdAt,
|
|
88
87
|
lastUpdatedAt: party.lastUpdatedAt,
|
|
89
88
|
}
|
|
90
|
-
|
|
91
|
-
return replaceNullWithUndefined(result)
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
export const contactEntityFrom = (contact: NonPersistedContact): BaseContactEntity => {
|
|
@@ -128,15 +125,13 @@ export const connectionEntityFrom = (connection: NonPersistedConnection): Connec
|
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
export const connectionFrom = (connection: ConnectionEntity): Connection => {
|
|
131
|
-
|
|
128
|
+
return {
|
|
132
129
|
id: connection.id,
|
|
133
130
|
type: connection.type,
|
|
134
131
|
ownerId: connection.ownerId,
|
|
135
132
|
tenantId: connection.tenantId,
|
|
136
133
|
config: configFrom(connection.config),
|
|
137
134
|
}
|
|
138
|
-
|
|
139
|
-
return replaceNullWithUndefined(result)
|
|
140
135
|
}
|
|
141
136
|
|
|
142
137
|
const configEntityFrom = (config: NonPersistedConnectionConfig): BaseConfigEntity => {
|
|
@@ -160,15 +155,13 @@ export const correlationIdentifierEntityFrom = (identifier: NonPersistedCorrelat
|
|
|
160
155
|
}
|
|
161
156
|
|
|
162
157
|
export const correlationIdentifierFrom = (identifier: CorrelationIdentifierEntity): CorrelationIdentifier => {
|
|
163
|
-
|
|
158
|
+
return {
|
|
164
159
|
id: identifier.id,
|
|
165
160
|
type: identifier.type,
|
|
166
161
|
correlationId: identifier.correlationId,
|
|
167
162
|
ownerId: identifier.ownerId,
|
|
168
163
|
tenantId: identifier.tenantId,
|
|
169
164
|
}
|
|
170
|
-
|
|
171
|
-
return replaceNullWithUndefined(result)
|
|
172
165
|
}
|
|
173
166
|
|
|
174
167
|
export const didAuthConfigEntityFrom = (config: NonPersistedDidAuthConfig): DidAuthConfigEntity => {
|
|
@@ -203,7 +196,7 @@ export const electronicAddressEntityFrom = (electronicAddress: NonPersistedElect
|
|
|
203
196
|
}
|
|
204
197
|
|
|
205
198
|
export const electronicAddressFrom = (electronicAddress: ElectronicAddressEntity): ElectronicAddress => {
|
|
206
|
-
|
|
199
|
+
return {
|
|
207
200
|
id: electronicAddress.id,
|
|
208
201
|
type: electronicAddress.type,
|
|
209
202
|
electronicAddress: electronicAddress.electronicAddress,
|
|
@@ -212,8 +205,6 @@ export const electronicAddressFrom = (electronicAddress: ElectronicAddressEntity
|
|
|
212
205
|
createdAt: electronicAddress.createdAt,
|
|
213
206
|
lastUpdatedAt: electronicAddress.lastUpdatedAt,
|
|
214
207
|
}
|
|
215
|
-
|
|
216
|
-
return replaceNullWithUndefined(result)
|
|
217
208
|
}
|
|
218
209
|
|
|
219
210
|
export const physicalAddressEntityFrom = (physicalAddress: NonPersistedPhysicalAddress): PhysicalAddressEntity => {
|
|
@@ -233,7 +224,7 @@ export const physicalAddressEntityFrom = (physicalAddress: NonPersistedPhysicalA
|
|
|
233
224
|
}
|
|
234
225
|
|
|
235
226
|
export const physicalAddressFrom = (physicalAddress: PhysicalAddressEntity): PhysicalAddress => {
|
|
236
|
-
|
|
227
|
+
return {
|
|
237
228
|
id: physicalAddress.id,
|
|
238
229
|
type: physicalAddress.type,
|
|
239
230
|
streetName: physicalAddress.streetName,
|
|
@@ -248,8 +239,6 @@ export const physicalAddressFrom = (physicalAddress: PhysicalAddressEntity): Phy
|
|
|
248
239
|
createdAt: physicalAddress.createdAt,
|
|
249
240
|
lastUpdatedAt: physicalAddress.lastUpdatedAt,
|
|
250
241
|
}
|
|
251
|
-
|
|
252
|
-
return replaceNullWithUndefined(result)
|
|
253
242
|
}
|
|
254
243
|
|
|
255
244
|
export const identityEntityFrom = (entity: NonPersistedIdentity): IdentityEntity => {
|
|
@@ -268,7 +257,7 @@ export const identityEntityFrom = (entity: NonPersistedIdentity): IdentityEntity
|
|
|
268
257
|
}
|
|
269
258
|
|
|
270
259
|
export const identityFrom = (identity: IdentityEntity): Identity => {
|
|
271
|
-
|
|
260
|
+
return {
|
|
272
261
|
id: identity.id,
|
|
273
262
|
alias: identity.alias,
|
|
274
263
|
origin: identity.origin,
|
|
@@ -281,11 +270,12 @@ export const identityFrom = (identity: IdentityEntity): Identity => {
|
|
|
281
270
|
createdAt: identity.createdAt,
|
|
282
271
|
lastUpdatedAt: identity.createdAt,
|
|
283
272
|
}
|
|
284
|
-
|
|
285
|
-
return replaceNullWithUndefined(result)
|
|
286
273
|
}
|
|
287
274
|
|
|
288
|
-
const metadataItemEntityFrom = <T extends MetadataTypes, U extends { new (): any }>(
|
|
275
|
+
const metadataItemEntityFrom = <T extends MetadataTypes, U extends { new (): any }>(
|
|
276
|
+
item: NonPersistedMetadataItem<T>,
|
|
277
|
+
EntityClass: U,
|
|
278
|
+
): InstanceType<U> | undefined => {
|
|
289
279
|
const { label, value } = item
|
|
290
280
|
|
|
291
281
|
if (value === null || value === undefined) {
|
|
@@ -369,7 +359,7 @@ export const naturalPersonEntityFrom = (naturalPerson: NonPersistedNaturalPerson
|
|
|
369
359
|
}
|
|
370
360
|
|
|
371
361
|
export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPerson => {
|
|
372
|
-
|
|
362
|
+
return {
|
|
373
363
|
id: naturalPerson.id,
|
|
374
364
|
firstName: naturalPerson.firstName,
|
|
375
365
|
middleName: naturalPerson.middleName,
|
|
@@ -381,8 +371,6 @@ export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPe
|
|
|
381
371
|
createdAt: naturalPerson.createdAt,
|
|
382
372
|
lastUpdatedAt: naturalPerson.lastUpdatedAt,
|
|
383
373
|
}
|
|
384
|
-
|
|
385
|
-
return replaceNullWithUndefined(result)
|
|
386
374
|
}
|
|
387
375
|
|
|
388
376
|
export const openIdConfigEntityFrom = (config: NonPersistedOpenIdConfig): OpenIdConfigEntity => {
|
|
@@ -414,7 +402,7 @@ export const organizationEntityFrom = (organization: NonPersistedOrganization):
|
|
|
414
402
|
}
|
|
415
403
|
|
|
416
404
|
export const organizationFrom = (organization: OrganizationEntity): Organization => {
|
|
417
|
-
|
|
405
|
+
return {
|
|
418
406
|
id: organization.id,
|
|
419
407
|
legalName: organization.legalName,
|
|
420
408
|
displayName: organization.displayName,
|
|
@@ -424,8 +412,6 @@ export const organizationFrom = (organization: OrganizationEntity): Organization
|
|
|
424
412
|
createdAt: organization.createdAt,
|
|
425
413
|
lastUpdatedAt: organization.lastUpdatedAt,
|
|
426
414
|
}
|
|
427
|
-
|
|
428
|
-
return replaceNullWithUndefined(result)
|
|
429
415
|
}
|
|
430
416
|
|
|
431
417
|
export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelationship): PartyRelationshipEntity => {
|
|
@@ -434,12 +420,11 @@ export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelat
|
|
|
434
420
|
partyRelationshipEntity.rightId = relationship.rightId
|
|
435
421
|
partyRelationshipEntity.ownerId = relationship.ownerId
|
|
436
422
|
partyRelationshipEntity.tenantId = relationship.tenantId
|
|
437
|
-
|
|
438
423
|
return partyRelationshipEntity
|
|
439
424
|
}
|
|
440
425
|
|
|
441
426
|
export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): PartyRelationship => {
|
|
442
|
-
|
|
427
|
+
return {
|
|
443
428
|
id: relationship.id,
|
|
444
429
|
leftId: relationship.leftId,
|
|
445
430
|
rightId: relationship.rightId,
|
|
@@ -448,8 +433,6 @@ export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): Pa
|
|
|
448
433
|
createdAt: relationship.createdAt,
|
|
449
434
|
lastUpdatedAt: relationship.lastUpdatedAt,
|
|
450
435
|
}
|
|
451
|
-
|
|
452
|
-
return replaceNullWithUndefined(result)
|
|
453
436
|
}
|
|
454
437
|
|
|
455
438
|
export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntity => {
|
|
@@ -467,7 +450,7 @@ export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntit
|
|
|
467
450
|
}
|
|
468
451
|
|
|
469
452
|
export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
|
|
470
|
-
|
|
453
|
+
return {
|
|
471
454
|
id: partyType.id,
|
|
472
455
|
type: partyType.type,
|
|
473
456
|
origin: partyType.origin,
|
|
@@ -477,8 +460,6 @@ export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
|
|
|
477
460
|
createdAt: partyType.createdAt,
|
|
478
461
|
lastUpdatedAt: partyType.lastUpdatedAt,
|
|
479
462
|
}
|
|
480
|
-
|
|
481
|
-
return replaceNullWithUndefined(result)
|
|
482
463
|
}
|
|
483
464
|
|
|
484
465
|
export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
|
|
@@ -492,7 +473,7 @@ export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
|
|
|
492
473
|
}
|
|
493
474
|
|
|
494
475
|
export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
|
|
495
|
-
|
|
476
|
+
return {
|
|
496
477
|
id: config.id,
|
|
497
478
|
clientId: config.clientId,
|
|
498
479
|
clientSecret: config.clientSecret,
|
|
@@ -504,12 +485,10 @@ export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
|
|
|
504
485
|
ownerId: config.ownerId,
|
|
505
486
|
tenantId: config.tenantId,
|
|
506
487
|
}
|
|
507
|
-
|
|
508
|
-
return replaceNullWithUndefined(result)
|
|
509
488
|
}
|
|
510
489
|
|
|
511
490
|
export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig => {
|
|
512
|
-
|
|
491
|
+
return {
|
|
513
492
|
id: config.id,
|
|
514
493
|
idOpts: { identifier: config.identifier },
|
|
515
494
|
stateId: '', // FIXME
|
|
@@ -518,8 +497,6 @@ export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig =>
|
|
|
518
497
|
ownerId: config.ownerId,
|
|
519
498
|
tenantId: config.tenantId,
|
|
520
499
|
}
|
|
521
|
-
|
|
522
|
-
return replaceNullWithUndefined(result)
|
|
523
500
|
}
|
|
524
501
|
|
|
525
502
|
export const isOpenIdConfig = (config: NonPersistedConnectionConfig | BaseConfigEntity): config is OpenIdConfig | OpenIdConfigEntity =>
|
|
@@ -3,14 +3,21 @@ import {
|
|
|
3
3
|
DocumentFormat,
|
|
4
4
|
IVerifiableCredential,
|
|
5
5
|
IVerifiablePresentation,
|
|
6
|
+
ObjectUtils,
|
|
6
7
|
OriginalVerifiableCredential,
|
|
7
8
|
OriginalVerifiablePresentation,
|
|
8
9
|
SdJwtDecodedVerifiableCredentialPayload,
|
|
9
10
|
} from '@sphereon/ssi-types'
|
|
10
11
|
import { computeEntryHash } from '@veramo/utils'
|
|
11
12
|
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
|
|
12
|
-
import {
|
|
13
|
-
|
|
13
|
+
import {
|
|
14
|
+
AddCredentialArgs,
|
|
15
|
+
CredentialDocumentFormat,
|
|
16
|
+
DigitalCredential,
|
|
17
|
+
DocumentType,
|
|
18
|
+
NonPersistedDigitalCredential,
|
|
19
|
+
RegulationType,
|
|
20
|
+
} from '../../types'
|
|
14
21
|
|
|
15
22
|
function determineDocumentType(raw: string): DocumentType {
|
|
16
23
|
const rawDocument = parseRawDocument(raw)
|
|
@@ -19,19 +26,26 @@ function determineDocumentType(raw: string): DocumentType {
|
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
const hasProof = CredentialMapper.hasProof(rawDocument)
|
|
22
|
-
const isCredential = CredentialMapper.isCredential(rawDocument)
|
|
29
|
+
const isCredential = isHex(raw) || ObjectUtils.isBase64(raw) || CredentialMapper.isCredential(rawDocument)
|
|
23
30
|
const isPresentation = CredentialMapper.isPresentation(rawDocument)
|
|
24
31
|
|
|
25
32
|
if (isCredential) {
|
|
26
|
-
return hasProof ? DocumentType.VC : DocumentType.C
|
|
33
|
+
return hasProof || isHex(raw) || ObjectUtils.isBase64(raw) ? DocumentType.VC : DocumentType.C
|
|
27
34
|
} else if (isPresentation) {
|
|
28
35
|
return hasProof ? DocumentType.VP : DocumentType.P
|
|
29
36
|
}
|
|
30
37
|
throw new Error(`Couldn't determine the type of the credential: ${raw}`)
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
function
|
|
34
|
-
|
|
40
|
+
export function isHex(input: string) {
|
|
41
|
+
return input.match(/^([0-9A-Fa-f])+$/g) !== null
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function parseRawDocument(raw: string): OriginalVerifiableCredential | OriginalVerifiablePresentation {
|
|
45
|
+
if (isHex(raw) || ObjectUtils.isBase64(raw)) {
|
|
46
|
+
// mso_mdoc
|
|
47
|
+
return raw
|
|
48
|
+
} else if (CredentialMapper.isJwtEncoded(raw) || CredentialMapper.isSdJwtEncoded(raw)) {
|
|
35
49
|
return raw
|
|
36
50
|
}
|
|
37
51
|
try {
|
|
@@ -41,6 +55,24 @@ function parseRawDocument(raw: string): OriginalVerifiableCredential | OriginalV
|
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
57
|
|
|
58
|
+
export function ensureRawDocument(input: string | object): string {
|
|
59
|
+
if (typeof input === 'string') {
|
|
60
|
+
if (isHex(input) || ObjectUtils.isBase64(input)) {
|
|
61
|
+
// mso_mdoc
|
|
62
|
+
return input
|
|
63
|
+
} else if (CredentialMapper.isJwtEncoded(input) || CredentialMapper.isSdJwtEncoded(input)) {
|
|
64
|
+
return input
|
|
65
|
+
}
|
|
66
|
+
throw Error('Unknown input to be mapped as rawDocument')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
return JSON.stringify(input)
|
|
71
|
+
} catch (e) {
|
|
72
|
+
throw new Error(`Can't stringify to a raw credential: ${input}`)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
44
76
|
function determineCredentialDocumentFormat(documentFormat: DocumentFormat): CredentialDocumentFormat {
|
|
45
77
|
switch (documentFormat) {
|
|
46
78
|
case DocumentFormat.JSONLD:
|
|
@@ -49,6 +81,8 @@ function determineCredentialDocumentFormat(documentFormat: DocumentFormat): Cred
|
|
|
49
81
|
return CredentialDocumentFormat.JWT
|
|
50
82
|
case DocumentFormat.SD_JWT_VC:
|
|
51
83
|
return CredentialDocumentFormat.SD_JWT
|
|
84
|
+
case DocumentFormat.MSO_MDOC:
|
|
85
|
+
return CredentialDocumentFormat.MSO_MDOC
|
|
52
86
|
default:
|
|
53
87
|
throw new Error(`Not supported document format: ${documentFormat}`)
|
|
54
88
|
}
|
|
@@ -78,6 +112,13 @@ function getValidFrom(uniformDocument: IVerifiableCredential | IVerifiablePresen
|
|
|
78
112
|
return undefined
|
|
79
113
|
}
|
|
80
114
|
|
|
115
|
+
const safeStringify = (object: any): string => {
|
|
116
|
+
if (typeof object === 'string') {
|
|
117
|
+
return object
|
|
118
|
+
}
|
|
119
|
+
return JSON.stringify(object)
|
|
120
|
+
}
|
|
121
|
+
|
|
81
122
|
export const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs: AddCredentialArgs): NonPersistedDigitalCredential => {
|
|
82
123
|
const documentType: DocumentType = determineDocumentType(addCredentialArgs.rawDocument)
|
|
83
124
|
const documentFormat: DocumentFormat = CredentialMapper.detectDocumentType(addCredentialArgs.rawDocument)
|
|
@@ -92,14 +133,16 @@ export const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs
|
|
|
92
133
|
const validFrom: Date | undefined = getValidFrom(uniformDocument)
|
|
93
134
|
const validUntil: Date | undefined = getValidUntil(uniformDocument)
|
|
94
135
|
const hash = computeEntryHash(addCredentialArgs.rawDocument)
|
|
136
|
+
const regulationType = addCredentialArgs.regulationType ?? RegulationType.NON_REGULATED
|
|
95
137
|
return {
|
|
96
138
|
...addCredentialArgs,
|
|
139
|
+
regulationType,
|
|
97
140
|
documentType,
|
|
98
141
|
documentFormat: determineCredentialDocumentFormat(documentFormat),
|
|
99
142
|
createdAt: new Date(),
|
|
100
143
|
credentialId: uniformDocument.id ?? hash,
|
|
101
144
|
hash,
|
|
102
|
-
uniformDocument:
|
|
145
|
+
uniformDocument: safeStringify(uniformDocument),
|
|
103
146
|
validFrom,
|
|
104
147
|
...(validUntil && { validUntil }),
|
|
105
148
|
lastUpdatedAt: new Date(),
|
|
@@ -107,11 +150,9 @@ export const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs
|
|
|
107
150
|
}
|
|
108
151
|
|
|
109
152
|
export const digitalCredentialFrom = (credentialEntity: DigitalCredentialEntity): DigitalCredential => {
|
|
110
|
-
|
|
153
|
+
return {
|
|
111
154
|
...credentialEntity,
|
|
112
155
|
}
|
|
113
|
-
|
|
114
|
-
return replaceNullWithUndefined(result)
|
|
115
156
|
}
|
|
116
157
|
|
|
117
158
|
export const digitalCredentialsFrom = (credentialEntities: Array<DigitalCredentialEntity>): DigitalCredential[] => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Hasher } from '@sphereon/ssi-types'
|
|
2
|
+
import sha from 'sha.js'
|
|
3
|
+
|
|
4
|
+
const supportedAlgorithms = ['sha256', 'sha384', 'sha512'] as const
|
|
5
|
+
type SupportedAlgorithms = (typeof supportedAlgorithms)[number]
|
|
6
|
+
|
|
7
|
+
// FIXME this is a weird place for this, but it does have good reach in ssi-sdk cunlike the copy in oid4vc-common
|
|
8
|
+
export const defaultHasher: Hasher = (data, algorithm) => {
|
|
9
|
+
const sanitizedAlgorithm = algorithm.toLowerCase().replace(/[-_]/g, '')
|
|
10
|
+
if (!supportedAlgorithms.includes(sanitizedAlgorithm as SupportedAlgorithms)) {
|
|
11
|
+
throw new Error(`Unsupported hashing algorithm ${algorithm}`)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return new Uint8Array(
|
|
15
|
+
sha(sanitizedAlgorithm as SupportedAlgorithms)
|
|
16
|
+
.update(data)
|
|
17
|
+
.digest(),
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -2,10 +2,9 @@ import { PresentationDefinitionItemEntity } from '../../entities/presentationDef
|
|
|
2
2
|
import { IPresentationDefinition } from '@sphereon/pex'
|
|
3
3
|
import { NonPersistedPresentationDefinitionItem, PartialPresentationDefinitionItem, PresentationDefinitionItem } from '../../types'
|
|
4
4
|
import { blake2bHex } from 'blakejs'
|
|
5
|
-
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
6
5
|
|
|
7
6
|
export const presentationDefinitionItemFrom = (entity: PresentationDefinitionItemEntity): PresentationDefinitionItem => {
|
|
8
|
-
|
|
7
|
+
return {
|
|
9
8
|
id: entity.id,
|
|
10
9
|
tenantId: entity.tenantId,
|
|
11
10
|
definitionId: entity.definitionId,
|
|
@@ -16,8 +15,6 @@ export const presentationDefinitionItemFrom = (entity: PresentationDefinitionIte
|
|
|
16
15
|
createdAt: entity.createdAt,
|
|
17
16
|
lastUpdatedAt: entity.lastUpdatedAt,
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
return replaceNullWithUndefined(result)
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
export const presentationDefinitionEntityItemFrom = (item: NonPersistedPresentationDefinitionItem): PresentationDefinitionItemEntity => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormattingUtils.d.ts","sourceRoot":"","sources":["../../src/utils/FormattingUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,QAAS,GAAG,KAAG,GAoBnD,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replaceNullWithUndefined = void 0;
|
|
4
|
-
const replaceNullWithUndefined = (obj) => {
|
|
5
|
-
if (obj === null) {
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
if (typeof obj !== 'object' || obj instanceof Date) {
|
|
9
|
-
return obj;
|
|
10
|
-
}
|
|
11
|
-
if (Array.isArray(obj)) {
|
|
12
|
-
return obj.map((value) => (0, exports.replaceNullWithUndefined)(value));
|
|
13
|
-
}
|
|
14
|
-
const result = {};
|
|
15
|
-
for (const key in obj) {
|
|
16
|
-
if (obj.hasOwnProperty(key)) {
|
|
17
|
-
result[key] = (0, exports.replaceNullWithUndefined)(obj[key]);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
};
|
|
22
|
-
exports.replaceNullWithUndefined = replaceNullWithUndefined;
|
|
23
|
-
//# sourceMappingURL=FormattingUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormattingUtils.js","sourceRoot":"","sources":["../../src/utils/FormattingUtils.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAAC,GAAQ,EAAO,EAAE;IACxD,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,YAAY,IAAI,EAAE,CAAC;QACnD,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,IAAA,gCAAwB,EAAC,KAAK,CAAC,CAAC,CAAA;IACjE,CAAC;IAED,MAAM,MAAM,GAAQ,EAAE,CAAA;IACtB,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAA,gCAAwB,EAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;QAClD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AApBY,QAAA,wBAAwB,4BAoBpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/eventLogger/MappingUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,eAAO,MAAM,cAAc,UAAW,gBAAgB,KAAG,iBAuBxD,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.auditEventFrom = void 0;
|
|
4
|
-
const FormattingUtils_1 = require("../FormattingUtils");
|
|
5
|
-
const auditEventFrom = (event) => {
|
|
6
|
-
const result = Object.assign(Object.assign({ id: event.id, description: event.description, timestamp: event.timestamp, level: event.level, correlationId: event.correlationId, actionType: event.actionType, actionSubType: event.actionSubType, initiatorType: event.initiatorType, partyAlias: event.partyAlias, partyCorrelationId: event.partyCorrelationId, partyCorrelationType: event.partyCorrelationType, subSystemType: event.subSystemType, system: event.system, systemAlias: event.systemAlias, systemCorrelationId: event.systemCorrelationId, systemCorrelationIdType: event.systemCorrelationIdType }, (event.data && { data: JSON.parse(event.data) })), (event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }));
|
|
7
|
-
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
8
|
-
};
|
|
9
|
-
exports.auditEventFrom = auditEventFrom;
|
|
10
|
-
//# sourceMappingURL=MappingUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/eventLogger/MappingUtils.ts"],"names":[],"mappings":";;;AAEA,wDAA6D;AAEtD,MAAM,cAAc,GAAG,CAAC,KAAuB,EAAqB,EAAE;IAC3E,MAAM,MAAM,iCACV,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,oBAAoB,EAAE,KAAK,CAAC,oBAAoB,EAChD,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,IACnD,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAChD,CAAC,KAAK,CAAC,cAAc,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,CAClF,CAAA;IAED,OAAO,IAAA,0CAAwB,EAAC,MAAM,CAAC,CAAA;AACzC,CAAC,CAAA;AAvBY,QAAA,cAAc,kBAuB1B"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CredentialBrandingEntity } from '../../entities/issuanceBranding/CredentialBrandingEntity';
|
|
2
|
-
import { BaseLocaleBrandingEntity } from '../../entities/issuanceBranding/BaseLocaleBrandingEntity';
|
|
3
|
-
import { IssuerBrandingEntity } from '../../entities/issuanceBranding/IssuerBrandingEntity';
|
|
4
|
-
import { ICredentialBranding, IIssuerBranding, ILocaleBranding } from '../../types';
|
|
5
|
-
export declare const credentialBrandingFrom: (credentialBranding: CredentialBrandingEntity) => ICredentialBranding;
|
|
6
|
-
export declare const issuerBrandingFrom: (issuerBranding: IssuerBrandingEntity) => IIssuerBranding;
|
|
7
|
-
export declare const localeBrandingFrom: (localeBranding: BaseLocaleBrandingEntity) => ILocaleBranding;
|
|
8
|
-
//# sourceMappingURL=MappingUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/issuanceBranding/MappingUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAA;AACnG,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAA;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAA;AAE3F,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEnF,eAAO,MAAM,sBAAsB,uBAAwB,wBAAwB,KAAG,mBAOrF,CAAA;AAED,eAAO,MAAM,kBAAkB,mBAAoB,oBAAoB,KAAG,eAOzE,CAAA;AAED,eAAO,MAAM,kBAAkB,mBAAoB,wBAAwB,KAAG,eAO7E,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.localeBrandingFrom = exports.issuerBrandingFrom = exports.credentialBrandingFrom = void 0;
|
|
4
|
-
const FormattingUtils_1 = require("../FormattingUtils");
|
|
5
|
-
const credentialBrandingFrom = (credentialBranding) => {
|
|
6
|
-
const result = Object.assign(Object.assign({}, credentialBranding), { localeBranding: credentialBranding.localeBranding.map((localeBranding) => (0, exports.localeBrandingFrom)(localeBranding)) });
|
|
7
|
-
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
8
|
-
};
|
|
9
|
-
exports.credentialBrandingFrom = credentialBrandingFrom;
|
|
10
|
-
const issuerBrandingFrom = (issuerBranding) => {
|
|
11
|
-
const result = Object.assign(Object.assign({}, issuerBranding), { localeBranding: issuerBranding.localeBranding.map((localeBranding) => (0, exports.localeBrandingFrom)(localeBranding)) });
|
|
12
|
-
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
13
|
-
};
|
|
14
|
-
exports.issuerBrandingFrom = issuerBrandingFrom;
|
|
15
|
-
const localeBrandingFrom = (localeBranding) => {
|
|
16
|
-
const result = Object.assign(Object.assign({}, localeBranding), { locale: localeBranding.locale === '' ? undefined : localeBranding.locale });
|
|
17
|
-
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
18
|
-
};
|
|
19
|
-
exports.localeBrandingFrom = localeBrandingFrom;
|
|
20
|
-
//# sourceMappingURL=MappingUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/issuanceBranding/MappingUtils.ts"],"names":[],"mappings":";;;AAGA,wDAA6D;AAGtD,MAAM,sBAAsB,GAAG,CAAC,kBAA4C,EAAuB,EAAE;IAC1G,MAAM,MAAM,mCACP,kBAAkB,KACrB,cAAc,EAAE,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,cAAwC,EAAE,EAAE,CAAC,IAAA,0BAAkB,EAAC,cAAc,CAAC,CAAC,GACxI,CAAA;IAED,OAAO,IAAA,0CAAwB,EAAC,MAAM,CAAC,CAAA;AACzC,CAAC,CAAA;AAPY,QAAA,sBAAsB,0BAOlC;AAEM,MAAM,kBAAkB,GAAG,CAAC,cAAoC,EAAmB,EAAE;IAC1F,MAAM,MAAM,mCACP,cAAc,KACjB,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,cAAwC,EAAE,EAAE,CAAC,IAAA,0BAAkB,EAAC,cAAc,CAAC,CAAC,GACpI,CAAA;IAED,OAAO,IAAA,0CAAwB,EAAC,MAAM,CAAC,CAAA;AACzC,CAAC,CAAA;AAPY,QAAA,kBAAkB,sBAO9B;AAEM,MAAM,kBAAkB,GAAG,CAAC,cAAwC,EAAmB,EAAE;IAC9F,MAAM,MAAM,mCACP,cAAc,KACjB,MAAM,EAAE,cAAc,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,GACzE,CAAA;IAED,OAAO,IAAA,0CAAwB,EAAC,MAAM,CAAC,CAAA;AACzC,CAAC,CAAA;AAPY,QAAA,kBAAkB,sBAO9B"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const replaceNullWithUndefined = (obj: any): any => {
|
|
2
|
-
if (obj === null) {
|
|
3
|
-
return undefined
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
if (typeof obj !== 'object' || obj instanceof Date) {
|
|
7
|
-
return obj
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (Array.isArray(obj)) {
|
|
11
|
-
return obj.map((value: any) => replaceNullWithUndefined(value))
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const result: any = {}
|
|
15
|
-
for (const key in obj) {
|
|
16
|
-
if (obj.hasOwnProperty(key)) {
|
|
17
|
-
result[key] = replaceNullWithUndefined(obj[key])
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return result
|
|
21
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { AuditEventEntity } from '../../entities/eventLogger/AuditEventEntity'
|
|
2
|
-
import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
3
|
-
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
4
|
-
|
|
5
|
-
export const auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
|
|
6
|
-
const result: AuditLoggingEvent = {
|
|
7
|
-
id: event.id,
|
|
8
|
-
description: event.description,
|
|
9
|
-
timestamp: event.timestamp,
|
|
10
|
-
level: event.level,
|
|
11
|
-
correlationId: event.correlationId,
|
|
12
|
-
actionType: event.actionType,
|
|
13
|
-
actionSubType: event.actionSubType,
|
|
14
|
-
initiatorType: event.initiatorType,
|
|
15
|
-
partyAlias: event.partyAlias,
|
|
16
|
-
partyCorrelationId: event.partyCorrelationId,
|
|
17
|
-
partyCorrelationType: event.partyCorrelationType,
|
|
18
|
-
subSystemType: event.subSystemType,
|
|
19
|
-
system: event.system,
|
|
20
|
-
systemAlias: event.systemAlias,
|
|
21
|
-
systemCorrelationId: event.systemCorrelationId,
|
|
22
|
-
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
23
|
-
...(event.data && { data: JSON.parse(event.data) }),
|
|
24
|
-
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return replaceNullWithUndefined(result)
|
|
28
|
-
}
|