@sphereon/ssi-sdk.data-store 0.30.2-unstable.8 → 0.31.0
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/contact/ContactStore.d.ts.map +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.js +1 -3
- package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -1
- package/dist/entities/eventLogger/AuditEventEntity.d.ts +8 -4
- package/dist/entities/eventLogger/AuditEventEntity.d.ts.map +1 -1
- package/dist/entities/eventLogger/AuditEventEntity.js +28 -25
- package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +1 -8
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +1 -9
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.d.ts +10 -0
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.js +70 -0
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +2 -2
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +12 -16
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js +1 -11
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +1 -8
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +1 -8
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +4 -2
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +21 -15
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/TextAttributesEntity.js +1 -7
- package/dist/entities/issuanceBranding/TextAttributesEntity.js.map +1 -1
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts +4 -2
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts.map +1 -1
- package/dist/eventLogger/AbstractEventLoggerStore.js.map +1 -1
- package/dist/eventLogger/EventLoggerStore.d.ts +5 -3
- package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
- package/dist/eventLogger/EventLoggerStore.js +32 -3
- package/dist/eventLogger/EventLoggerStore.js.map +1 -1
- package/dist/index.d.ts +20 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -26
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js +5 -5
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +5 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -1
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts.map +1 -1
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +34 -6
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -1
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts.map +1 -1
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +7 -3
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js.map +1 -1
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts.map +1 -1
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +27 -1
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +1 -1
- package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
- package/dist/statusList/StatusListStore.js.map +1 -1
- package/dist/types/contact/contact.d.ts +3 -3
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/digitalCredential/digitalCredential.d.ts +2 -1
- package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -1
- package/dist/types/digitalCredential/digitalCredential.js +1 -0
- package/dist/types/digitalCredential/digitalCredential.js.map +1 -1
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +9 -2
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts.map +1 -1
- package/dist/types/eventLogger/eventLogger.d.ts +3 -2
- package/dist/types/eventLogger/eventLogger.d.ts.map +1 -1
- package/dist/types/issuanceBranding/issuanceBranding.d.ts +21 -4
- package/dist/types/issuanceBranding/issuanceBranding.d.ts.map +1 -1
- package/dist/utils/SortingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.js +2 -2
- package/dist/utils/contact/MappingUtils.js.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +4 -4
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/dist/utils/eventLogger/MappingUtils.d.ts +5 -1
- package/dist/utils/eventLogger/MappingUtils.d.ts.map +1 -1
- package/dist/utils/eventLogger/MappingUtils.js +62 -2
- package/dist/utils/eventLogger/MappingUtils.js.map +1 -1
- package/dist/utils/issuanceBranding/MappingUtils.d.ts +17 -1
- package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -1
- package/dist/utils/issuanceBranding/MappingUtils.js +90 -1
- package/dist/utils/issuanceBranding/MappingUtils.js.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.js +2 -2
- package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
- package/package.json +10 -9
- package/src/__tests__/contact.store.test.ts +46 -4
- package/src/__tests__/digitalCredential.entities.test.ts +1 -7
- package/src/__tests__/digitalCredential.store.test.ts +85 -4
- package/src/__tests__/eventLogger.entities.test.ts +60 -5
- package/src/__tests__/eventLogger.store.test.ts +461 -3
- package/src/__tests__/issuanceBranding.entities.test.ts +129 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +1 -3
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +1 -1
- package/src/entities/eventLogger/AuditEventEntity.ts +23 -28
- package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -11
- package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +1 -13
- package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +35 -0
- package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +11 -18
- package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -14
- package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +0 -9
- package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +1 -12
- package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +17 -17
- package/src/entities/issuanceBranding/TextAttributesEntity.ts +1 -9
- package/src/eventLogger/AbstractEventLoggerStore.ts +4 -2
- package/src/eventLogger/EventLoggerStore.ts +46 -11
- package/src/index.ts +20 -30
- package/src/issuanceBranding/IssuanceBrandingStore.ts +15 -9
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +11 -1
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +34 -6
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +1 -1
- package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +11 -3
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +27 -1
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +1 -1
- package/src/statusList/StatusListStore.ts +1 -1
- package/src/types/contact/contact.ts +3 -3
- package/src/types/digitalCredential/digitalCredential.ts +1 -0
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -2
- package/src/types/eventLogger/eventLogger.ts +3 -2
- package/src/types/issuanceBranding/issuanceBranding.ts +24 -6
- package/src/utils/contact/MappingUtils.ts +5 -2
- package/src/utils/eventLogger/MappingUtils.ts +91 -2
- package/src/utils/issuanceBranding/MappingUtils.ts +115 -2
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.localeBrandingFrom = exports.issuerBrandingFrom = exports.credentialBrandingFrom = void 0;
|
|
3
|
+
exports.credentialClaimsEntityFrom = exports.textAttributesEntityFrom = exports.issuerBrandingEntityFrom = exports.imageDimensionsEntityFrom = exports.imageAttributesEntityFrom = exports.credentialLocaleBrandingEntityFrom = exports.credentialBrandingEntityFrom = exports.backgroundAttributesEntityFrom = exports.issuerLocaleBrandingEntityFrom = exports.localeBrandingFrom = exports.issuerBrandingFrom = exports.credentialBrandingFrom = void 0;
|
|
4
4
|
const FormattingUtils_1 = require("../FormattingUtils");
|
|
5
|
+
const validators_1 = require("../../entities/validators");
|
|
6
|
+
const CredentialBrandingEntity_1 = require("../../entities/issuanceBranding/CredentialBrandingEntity");
|
|
7
|
+
const IssuerBrandingEntity_1 = require("../../entities/issuanceBranding/IssuerBrandingEntity");
|
|
8
|
+
const ImageAttributesEntity_1 = require("../../entities/issuanceBranding/ImageAttributesEntity");
|
|
9
|
+
const BackgroundAttributesEntity_1 = require("../../entities/issuanceBranding/BackgroundAttributesEntity");
|
|
10
|
+
const TextAttributesEntity_1 = require("../../entities/issuanceBranding/TextAttributesEntity");
|
|
11
|
+
const IssuerLocaleBrandingEntity_1 = require("../../entities/issuanceBranding/IssuerLocaleBrandingEntity");
|
|
12
|
+
const CredentialLocaleBrandingEntity_1 = require("../../entities/issuanceBranding/CredentialLocaleBrandingEntity");
|
|
13
|
+
const ImageDimensionsEntity_1 = require("../../entities/issuanceBranding/ImageDimensionsEntity");
|
|
14
|
+
const CredentialClaimsEntity_1 = require("../../entities/issuanceBranding/CredentialClaimsEntity");
|
|
5
15
|
const credentialBrandingFrom = (credentialBranding) => {
|
|
6
16
|
const result = Object.assign(Object.assign({}, credentialBranding), { localeBranding: credentialBranding.localeBranding.map((localeBranding) => (0, exports.localeBrandingFrom)(localeBranding)) });
|
|
7
17
|
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
@@ -17,4 +27,83 @@ const localeBrandingFrom = (localeBranding) => {
|
|
|
17
27
|
return (0, FormattingUtils_1.replaceNullWithUndefined)(result);
|
|
18
28
|
};
|
|
19
29
|
exports.localeBrandingFrom = localeBrandingFrom;
|
|
30
|
+
const issuerLocaleBrandingEntityFrom = (args) => {
|
|
31
|
+
const issuerLocaleBrandingEntity = new IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity();
|
|
32
|
+
issuerLocaleBrandingEntity.alias = (0, validators_1.isEmptyString)(args.alias) ? undefined : args.alias;
|
|
33
|
+
issuerLocaleBrandingEntity.locale = args.locale ? args.locale : '';
|
|
34
|
+
issuerLocaleBrandingEntity.logo = args.logo ? (0, exports.imageAttributesEntityFrom)(args.logo) : undefined;
|
|
35
|
+
issuerLocaleBrandingEntity.description = (0, validators_1.isEmptyString)(args.description) ? undefined : args.description;
|
|
36
|
+
issuerLocaleBrandingEntity.background = args.background ? (0, exports.backgroundAttributesEntityFrom)(args.background) : undefined;
|
|
37
|
+
issuerLocaleBrandingEntity.text = args.text ? (0, exports.textAttributesEntityFrom)(args.text) : undefined;
|
|
38
|
+
issuerLocaleBrandingEntity.clientUri = (0, validators_1.isEmptyString)(args.clientUri) ? undefined : args.clientUri;
|
|
39
|
+
issuerLocaleBrandingEntity.tosUri = (0, validators_1.isEmptyString)(args.tosUri) ? undefined : args.tosUri;
|
|
40
|
+
issuerLocaleBrandingEntity.policyUri = (0, validators_1.isEmptyString)(args.policyUri) ? undefined : args.policyUri;
|
|
41
|
+
issuerLocaleBrandingEntity.contacts = args.contacts;
|
|
42
|
+
return issuerLocaleBrandingEntity;
|
|
43
|
+
};
|
|
44
|
+
exports.issuerLocaleBrandingEntityFrom = issuerLocaleBrandingEntityFrom;
|
|
45
|
+
const backgroundAttributesEntityFrom = (args) => {
|
|
46
|
+
const backgroundAttributesEntity = new BackgroundAttributesEntity_1.BackgroundAttributesEntity();
|
|
47
|
+
backgroundAttributesEntity.color = (0, validators_1.isEmptyString)(args.color) ? undefined : args.color;
|
|
48
|
+
backgroundAttributesEntity.image = args.image ? (0, exports.imageAttributesEntityFrom)(args.image) : undefined;
|
|
49
|
+
return backgroundAttributesEntity;
|
|
50
|
+
};
|
|
51
|
+
exports.backgroundAttributesEntityFrom = backgroundAttributesEntityFrom;
|
|
52
|
+
const credentialBrandingEntityFrom = (args) => {
|
|
53
|
+
const credentialBrandingEntity = new CredentialBrandingEntity_1.CredentialBrandingEntity();
|
|
54
|
+
credentialBrandingEntity.issuerCorrelationId = args.issuerCorrelationId;
|
|
55
|
+
credentialBrandingEntity.vcHash = args.vcHash;
|
|
56
|
+
credentialBrandingEntity.localeBranding = args.localeBranding.map((localeBranding) => (0, exports.credentialLocaleBrandingEntityFrom)(localeBranding));
|
|
57
|
+
return credentialBrandingEntity;
|
|
58
|
+
};
|
|
59
|
+
exports.credentialBrandingEntityFrom = credentialBrandingEntityFrom;
|
|
60
|
+
const credentialLocaleBrandingEntityFrom = (args) => {
|
|
61
|
+
const credentialLocaleBrandingEntity = new CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity();
|
|
62
|
+
credentialLocaleBrandingEntity.alias = (0, validators_1.isEmptyString)(args.alias) ? undefined : args.alias;
|
|
63
|
+
credentialLocaleBrandingEntity.locale = args.locale ? args.locale : '';
|
|
64
|
+
credentialLocaleBrandingEntity.logo = args.logo ? (0, exports.imageAttributesEntityFrom)(args.logo) : undefined;
|
|
65
|
+
credentialLocaleBrandingEntity.description = (0, validators_1.isEmptyString)(args.description) ? undefined : args.description;
|
|
66
|
+
credentialLocaleBrandingEntity.background = args.background ? (0, exports.backgroundAttributesEntityFrom)(args.background) : undefined;
|
|
67
|
+
credentialLocaleBrandingEntity.text = args.text ? (0, exports.textAttributesEntityFrom)(args.text) : undefined;
|
|
68
|
+
credentialLocaleBrandingEntity.claims = args.claims ? args.claims.map((claim) => (0, exports.credentialClaimsEntityFrom)(claim)) : [];
|
|
69
|
+
return credentialLocaleBrandingEntity;
|
|
70
|
+
};
|
|
71
|
+
exports.credentialLocaleBrandingEntityFrom = credentialLocaleBrandingEntityFrom;
|
|
72
|
+
const imageAttributesEntityFrom = (args) => {
|
|
73
|
+
const imageAttributesEntity = new ImageAttributesEntity_1.ImageAttributesEntity();
|
|
74
|
+
imageAttributesEntity.uri = (0, validators_1.isEmptyString)(args.uri) ? undefined : args.uri;
|
|
75
|
+
imageAttributesEntity.dataUri = (0, validators_1.isEmptyString)(args.dataUri) ? undefined : args.dataUri;
|
|
76
|
+
imageAttributesEntity.mediaType = (0, validators_1.isEmptyString)(args.mediaType) ? undefined : args.mediaType;
|
|
77
|
+
imageAttributesEntity.alt = (0, validators_1.isEmptyString)(args.alt) ? undefined : args.alt;
|
|
78
|
+
imageAttributesEntity.dimensions = args.dimensions ? (0, exports.imageDimensionsEntityFrom)(args.dimensions) : undefined;
|
|
79
|
+
return imageAttributesEntity;
|
|
80
|
+
};
|
|
81
|
+
exports.imageAttributesEntityFrom = imageAttributesEntityFrom;
|
|
82
|
+
const imageDimensionsEntityFrom = (args) => {
|
|
83
|
+
const imageDimensionsEntity = new ImageDimensionsEntity_1.ImageDimensionsEntity();
|
|
84
|
+
imageDimensionsEntity.width = args.width;
|
|
85
|
+
imageDimensionsEntity.height = args.height;
|
|
86
|
+
return imageDimensionsEntity;
|
|
87
|
+
};
|
|
88
|
+
exports.imageDimensionsEntityFrom = imageDimensionsEntityFrom;
|
|
89
|
+
const issuerBrandingEntityFrom = (args) => {
|
|
90
|
+
const issuerBrandingEntity = new IssuerBrandingEntity_1.IssuerBrandingEntity();
|
|
91
|
+
issuerBrandingEntity.issuerCorrelationId = args.issuerCorrelationId;
|
|
92
|
+
issuerBrandingEntity.localeBranding = args.localeBranding.map((localeBranding) => (0, exports.issuerLocaleBrandingEntityFrom)(localeBranding));
|
|
93
|
+
return issuerBrandingEntity;
|
|
94
|
+
};
|
|
95
|
+
exports.issuerBrandingEntityFrom = issuerBrandingEntityFrom;
|
|
96
|
+
const textAttributesEntityFrom = (args) => {
|
|
97
|
+
const textAttributesEntity = new TextAttributesEntity_1.TextAttributesEntity();
|
|
98
|
+
textAttributesEntity.color = (0, validators_1.isEmptyString)(args.color) ? undefined : args.color;
|
|
99
|
+
return textAttributesEntity;
|
|
100
|
+
};
|
|
101
|
+
exports.textAttributesEntityFrom = textAttributesEntityFrom;
|
|
102
|
+
const credentialClaimsEntityFrom = (args) => {
|
|
103
|
+
const credentialClaimsEntity = new CredentialClaimsEntity_1.CredentialClaimsEntity();
|
|
104
|
+
credentialClaimsEntity.key = args.key;
|
|
105
|
+
credentialClaimsEntity.name = args.name;
|
|
106
|
+
return credentialClaimsEntity;
|
|
107
|
+
};
|
|
108
|
+
exports.credentialClaimsEntityFrom = credentialClaimsEntityFrom;
|
|
20
109
|
//# sourceMappingURL=MappingUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/issuanceBranding/MappingUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/issuanceBranding/MappingUtils.ts"],"names":[],"mappings":";;;AAAA,wDAA6D;AAC7D,0DAAyD;AACzD,uGAAmG;AAEnG,+FAA2F;AAC3F,iGAA6F;AAC7F,2GAAuG;AACvG,+FAA2F;AAC3F,2GAAuG;AACvG,mHAA+G;AAC/G,iGAA6F;AAC7F,mGAA+F;AAgBxF,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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O,oBAAoB,CAAA;AAC7B,CAAC,CAAA;AALY,QAAA,wBAAwB,4BAKpC;AAEM,MAAM,0BAA0B,GAAG,CAAC,IAA2B,EAA0B,EAAE;IAChG,MAAM,sBAAsB,GAA2B,IAAI,+CAAsB,EAAE,CAAA;IACnF,sBAAsB,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IACrC,sBAAsB,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IAEvC,OAAO,sBAAsB,CAAA;AAC/B,CAAC,CAAA;AANY,QAAA,0BAA0B,8BAMtC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.presentationDefinitionEntityItemFrom = exports.presentationDefinitionItemFrom = void 0;
|
|
4
|
+
exports.isPresentationDefinitionEqual = isPresentationDefinitionEqual;
|
|
4
5
|
const PresentationDefinitionItemEntity_1 = require("../../entities/presentationDefinition/PresentationDefinitionItemEntity");
|
|
5
6
|
const blakejs_1 = require("blakejs");
|
|
6
7
|
const FormattingUtils_1 = require("../FormattingUtils");
|
|
@@ -46,5 +47,4 @@ function isPresentationDefinitionEqual(base, compare) {
|
|
|
46
47
|
}
|
|
47
48
|
return false;
|
|
48
49
|
}
|
|
49
|
-
exports.isPresentationDefinitionEqual = isPresentationDefinitionEqual;
|
|
50
50
|
//# sourceMappingURL=MappingUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/presentationDefinition/MappingUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MappingUtils.js","sourceRoot":"","sources":["../../../src/utils/presentationDefinition/MappingUtils.ts"],"names":[],"mappings":";;;AAsCA,sEAgBC;AAtDD,6HAAyH;AAGzH,qCAAoC;AACpC,wDAA6D;AAEtD,MAAM,8BAA8B,GAAG,CAAC,MAAwC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IAAI,CAAC,YAAY,KAAK,OAAO,CAAC,YAAY;QAC1C,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ;QACjC,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO;QAChC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;QACzB,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAC/B,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,IAAI,CAAC,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;QACxD,OAAO,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACvF,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"typeorm-postgres:migration:run": "pnpm run typeorm -- migration:run -c migration-postgres"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@sphereon/kmp-
|
|
18
|
-
"@sphereon/pex": "5.0.0-unstable.
|
|
19
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.
|
|
20
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.
|
|
21
|
-
"@sphereon/ssi-sdk.agent-config": "0.
|
|
22
|
-
"@sphereon/ssi-sdk.core": "0.
|
|
23
|
-
"@sphereon/ssi-types": "0.
|
|
17
|
+
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.15",
|
|
18
|
+
"@sphereon/pex": "5.0.0-unstable.28",
|
|
19
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.26.0",
|
|
20
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.26.0",
|
|
21
|
+
"@sphereon/ssi-sdk.agent-config": "0.31.0",
|
|
22
|
+
"@sphereon/ssi-sdk.core": "0.31.0",
|
|
23
|
+
"@sphereon/ssi-types": "0.31.0",
|
|
24
24
|
"@veramo/core": "4.2.0",
|
|
25
25
|
"@veramo/utils": "4.2.0",
|
|
26
26
|
"blakejs": "^1.2.1",
|
|
@@ -53,5 +53,6 @@
|
|
|
53
53
|
"PostgreSQL",
|
|
54
54
|
"Contact Store"
|
|
55
55
|
],
|
|
56
|
-
"
|
|
56
|
+
"nx": {},
|
|
57
|
+
"gitHead": "3010f7bc57ed5f8d7953b6bf893e3164ea1821e8"
|
|
57
58
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import { DataStoreContactEntities, DataStoreMigrations, IdentityOrigin, MetadataItem, MetadataTypes, PartyOrigin } from '../index'
|
|
3
|
+
import { ConnectionType, DataStoreContactEntities, DataStoreMigrations, IdentityOrigin, MetadataItem, MetadataTypes, PartyOrigin } from '../index'
|
|
4
4
|
import { ContactStore } from '../contact/ContactStore'
|
|
5
5
|
import {
|
|
6
6
|
CorrelationIdentifierType,
|
|
@@ -367,6 +367,27 @@ describe('Contact store tests', (): void => {
|
|
|
367
367
|
correlationId: 'example_did3',
|
|
368
368
|
},
|
|
369
369
|
},
|
|
370
|
+
{
|
|
371
|
+
alias: 'test_alias4',
|
|
372
|
+
origin: IdentityOrigin.EXTERNAL,
|
|
373
|
+
roles: [CredentialRole.FEDERATION_TRUST_ANCHOR],
|
|
374
|
+
connection: {
|
|
375
|
+
type: ConnectionType.OPENID_CONNECT,
|
|
376
|
+
config: {
|
|
377
|
+
clientId: '138d7bf8-c930-4c6e-b928-97d3a4928b01',
|
|
378
|
+
clientSecret: '03b3955f-d020-4f2a-8a27-4e452d4e27a0',
|
|
379
|
+
scopes: ['auth'],
|
|
380
|
+
issuer: 'https://example.com/app-test',
|
|
381
|
+
redirectUrl: 'app:/callback',
|
|
382
|
+
dangerouslyAllowInsecureHttpRequests: true,
|
|
383
|
+
clientAuthMethod: <const>'post',
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
identifier: {
|
|
387
|
+
type: CorrelationIdentifierType.URL,
|
|
388
|
+
correlationId: 'example_url4',
|
|
389
|
+
},
|
|
390
|
+
},
|
|
370
391
|
],
|
|
371
392
|
electronicAddresses: [
|
|
372
393
|
{
|
|
@@ -391,7 +412,7 @@ describe('Contact store tests', (): void => {
|
|
|
391
412
|
}
|
|
392
413
|
const result: Array<Party> = await contactStore.getParties(args)
|
|
393
414
|
|
|
394
|
-
expect(result[0].identities.length).toEqual(
|
|
415
|
+
expect(result[0].identities.length).toEqual(4)
|
|
395
416
|
expect(result[0].electronicAddresses.length).toEqual(1)
|
|
396
417
|
})
|
|
397
418
|
|
|
@@ -1208,6 +1229,27 @@ describe('Contact store tests', (): void => {
|
|
|
1208
1229
|
correlationId: 'example_did3',
|
|
1209
1230
|
},
|
|
1210
1231
|
},
|
|
1232
|
+
{
|
|
1233
|
+
alias: 'test_alias4',
|
|
1234
|
+
origin: IdentityOrigin.EXTERNAL,
|
|
1235
|
+
roles: [CredentialRole.FEDERATION_TRUST_ANCHOR],
|
|
1236
|
+
connection: {
|
|
1237
|
+
type: ConnectionType.OPENID_CONNECT,
|
|
1238
|
+
config: {
|
|
1239
|
+
clientId: '138d7bf8-c930-4c6e-b928-97d3a4928b01',
|
|
1240
|
+
clientSecret: '03b3955f-d020-4f2a-8a27-4e452d4e27a0',
|
|
1241
|
+
scopes: ['auth'],
|
|
1242
|
+
issuer: 'https://example.com/app-test',
|
|
1243
|
+
redirectUrl: 'app:/callback',
|
|
1244
|
+
dangerouslyAllowInsecureHttpRequests: true,
|
|
1245
|
+
clientAuthMethod: <const>'post',
|
|
1246
|
+
},
|
|
1247
|
+
},
|
|
1248
|
+
identifier: {
|
|
1249
|
+
type: CorrelationIdentifierType.URL,
|
|
1250
|
+
correlationId: 'example_url4',
|
|
1251
|
+
},
|
|
1252
|
+
},
|
|
1211
1253
|
],
|
|
1212
1254
|
}
|
|
1213
1255
|
|
|
@@ -1215,8 +1257,8 @@ describe('Contact store tests', (): void => {
|
|
|
1215
1257
|
const result: Party = await contactStore.getParty({ partyId: savedParty.id })
|
|
1216
1258
|
|
|
1217
1259
|
expect(result.roles).toBeDefined()
|
|
1218
|
-
expect(result.roles.length).toEqual(
|
|
1219
|
-
expect(result.roles).toEqual([CredentialRole.VERIFIER, CredentialRole.ISSUER, CredentialRole.HOLDER])
|
|
1260
|
+
expect(result.roles.length).toEqual(4)
|
|
1261
|
+
expect(result.roles).toEqual([CredentialRole.VERIFIER, CredentialRole.ISSUER, CredentialRole.HOLDER, CredentialRole.FEDERATION_TRUST_ANCHOR])
|
|
1220
1262
|
})
|
|
1221
1263
|
|
|
1222
1264
|
it('should add relationship', async (): Promise<void> => {
|
|
@@ -3,16 +3,10 @@ import { DataSource } from 'typeorm'
|
|
|
3
3
|
import { CredentialRole, DataStoreDigitalCredentialEntities } from '../index'
|
|
4
4
|
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
5
5
|
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
6
|
-
import {
|
|
7
|
-
CredentialCorrelationType,
|
|
8
|
-
CredentialDocumentFormat,
|
|
9
|
-
DocumentType,
|
|
10
|
-
NonPersistedDigitalCredential,
|
|
11
|
-
} from '../types/digitalCredential/digitalCredential'
|
|
12
6
|
import { computeEntryHash } from '@veramo/utils'
|
|
13
|
-
import { AddCredentialArgs } from '../types/digitalCredential/IAbstractDigitalCredentialStore'
|
|
14
7
|
import { nonPersistedDigitalCredentialEntityFromAddArgs } from '../utils/digitalCredential/MappingUtils'
|
|
15
8
|
import { createHash } from 'crypto'
|
|
9
|
+
import { AddCredentialArgs, CredentialCorrelationType, CredentialDocumentFormat, DocumentType, NonPersistedDigitalCredential } from '../types'
|
|
16
10
|
|
|
17
11
|
describe('Database entities tests', (): void => {
|
|
18
12
|
let dbConnection: DataSource
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
+
import { IVerifiablePresentation } from '@sphereon/ssi-types'
|
|
3
|
+
import { createHash } from 'crypto'
|
|
2
4
|
import { DataSource } from 'typeorm'
|
|
3
5
|
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
4
6
|
import { CredentialRole, DataStoreDigitalCredentialEntities } from '../index'
|
|
5
7
|
import { DigitalCredentialStore } from '../digitalCredential/DigitalCredentialStore'
|
|
6
8
|
import {
|
|
9
|
+
AddCredentialArgs,
|
|
7
10
|
CredentialCorrelationType,
|
|
8
11
|
CredentialDocumentFormat,
|
|
9
12
|
CredentialStateType,
|
|
10
13
|
DocumentType,
|
|
11
14
|
DigitalCredential,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { createHash } from 'crypto'
|
|
15
|
+
GetCredentialsArgs,
|
|
16
|
+
GetCredentialsResponse,
|
|
17
|
+
} from '../types'
|
|
16
18
|
|
|
17
19
|
describe('Database entities tests', (): void => {
|
|
18
20
|
let dbConnection: DataSource
|
|
@@ -247,6 +249,85 @@ describe('Database entities tests', (): void => {
|
|
|
247
249
|
expect(result).toEqual(true)
|
|
248
250
|
})
|
|
249
251
|
|
|
252
|
+
it('should delete stored digital credential and children', async (): Promise<void> => {
|
|
253
|
+
const digitalCredentialParent: AddCredentialArgs = {
|
|
254
|
+
rawDocument:
|
|
255
|
+
'eyJraWQiOiJkaWQ6a2V5Ono2TWtyaGt5M3B1c20yNk1laUZhWFUzbjJuZWtyYW13RlVtZ0dyZUdHa0RWNnpRaiN6Nk1rcmhreTNwdXNtMjZNZWlGYVhVM24ybmVrcmFtd0ZVbWdHcmVHR2tEVjZ6UWoiLCJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vc3BoZXJlb24tb3BlbnNvdXJjZS5naXRodWIuaW8vc3NpLW1vYmlsZS13YWxsZXQvY29udGV4dC9zcGhlcmVvbi13YWxsZXQtaWRlbnRpdHktdjEuanNvbmxkIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJTcGhlcmVvbldhbGxldElkZW50aXR5Q3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJmaXJzdE5hbWUiOiJTIiwibGFzdE5hbWUiOiJLIiwiZW1haWxBZGRyZXNzIjoic0BrIn19LCJzdWIiOiJ1cm46dXVpZDpkZGE3YmYyNC04ZTdhLTQxZjgtYjY2Yy1hNDhkYmM1YjEwZmEiLCJqdGkiOiJ1cm46dXVpZDpkZGE3YmYyNC04ZTdhLTQxZjgtYjY2Yy1hNDhkYmM1YjEwZmEiLCJuYmYiOjE3MDg0NDA4MDgsImlzcyI6ImRpZDprZXk6ejZNa3Joa3kzcHVzbTI2TWVpRmFYVTNuMm5la3JhbXdGVW1nR3JlR0drRFY2elFqIn0.G0M84XVAxSmzGY-NQuB9NBofNrINSn6lvxW6761Vlq6ypvYgtc2xNdpiRmw8ryVNfnpzrr4Z5cB1RlrC05rJAw',
|
|
256
|
+
kmsKeyRef: 'testRef',
|
|
257
|
+
identifierMethod: 'did',
|
|
258
|
+
issuerCorrelationType: CredentialCorrelationType.DID,
|
|
259
|
+
subjectCorrelationType: CredentialCorrelationType.DID,
|
|
260
|
+
issuerCorrelationId: 'did:key:z6Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
261
|
+
subjectCorrelationId: 'did:key:z6Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
262
|
+
credentialRole: CredentialRole.VERIFIER,
|
|
263
|
+
tenantId: 'urn:uuid:nnag4b43-1e7a-98f8-a32c-a48dbc5b10mj',
|
|
264
|
+
}
|
|
265
|
+
const parentCredential: DigitalCredential = await digitalCredentialStore.addCredential(digitalCredentialParent)
|
|
266
|
+
expect(parentCredential).toBeDefined()
|
|
267
|
+
|
|
268
|
+
const digitalCredentialChild: AddCredentialArgs = {
|
|
269
|
+
rawDocument:
|
|
270
|
+
'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6dmVsb2NpdHk6djI6MHhjMTY3MTUxNmMyMTQ1ZDcwYjM0MGY1NjBhYjFjYjU4Y2M0ZDhhMDUyOjE2Mzc4MjY4NTEwMzM4MToxOTg2I2tleS0xIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIk9wZW5CYWRnZUNyZWRlbnRpYWwiLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sImlkIjoiZGlkOnZlbG9jaXR5OnYyOjB4YzE2NzE1MTZjMjE0NWQ3MGIzNDBmNTYwYWIxY2I1OGNjNGQ4YTA1MjoxNjM3ODI2ODUxMDMzODE6MTk4NiIsImNyZWRlbnRpYWxTdGF0dXMiOnsidHlwZSI6IlZlbG9jaXR5UmV2b2NhdGlvbkxpc3RKYW4yMDIxIiwiaWQiOiJldGhlcmV1bToweDFDMjk0NjFDNzQ4MGQxZDg1NzBkZjdjMEE0RjMxNEQwYkU4Y0Q1QmYvZ2V0UmV2b2tlZFN0YXR1cz9hZGRyZXNzPTB4YzE2NzE1MTZDMjE0NUQ3MEIzNDBGNTYwQUIxQ0I1OENjNEQ4YTA1MiZsaXN0SWQ9NTI5NDcyODgxNzIzMTQmaW5kZXg9NTYyNCJ9LCJsaW5rQ29kZUNvbW1pdG1lbnQiOns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GkiOiJkaWQ6dmVsb2NpdHk6djI6MHhjMTY3MTUxNmMyMTQ1ZDcwYjM0MGY1NjBhYjFjYjU4Y2M0ZDhhMDUyOjE2Mzc4MjY4NTEwMzM4MToxOTg2IiwiaXNzIjoiZGlkOmlvbjpFaUJhS2lkaHBIZmtmc2VqWk9VMWNPWFZ5YXZxOFlLX2hSX0xoMF9XQjU1UF9BIiwic3ViIjoiZGlkOmp3azpleUpqY25ZaU9pSnpaV053TWpVMmF6RWlMQ0pyZEhraU9pSkZReUlzSW5WelpTSTZJbk5wWnlJc0luZ2lPaUpEV1V0R2NubE5Vak5zZG5semJ6ZDRSMEp5U3pCclEyRllhR3BIYVd0V0xXczFPR0ZITUZJMFNYaHpJaXdpZVNJNklqRXROSGhMWjBwUGRGVnJiM1puUmpWcWNVYzFObUp4YW1sblQwSlRNV0ZPT0VkQk4xRXlhRGxSUm1zaWZRIiwiaWF0IjoxNjY3ODU2NTY5fQ.-SiM5d7UrYn1gdj2hU5T5LnLQzhIklOtoexbyebLMeha0K89vkujsbFN4HNFP2TSfRYFt0-jXwDaZ8RNKESwFA',
|
|
271
|
+
parentId: parentCredential.id,
|
|
272
|
+
kmsKeyRef: 'testRef',
|
|
273
|
+
identifierMethod: 'did',
|
|
274
|
+
issuerCorrelationType: CredentialCorrelationType.DID,
|
|
275
|
+
subjectCorrelationType: CredentialCorrelationType.DID,
|
|
276
|
+
issuerCorrelationId: 'did:key:z1Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
277
|
+
subjectCorrelationId: 'did:key:z6Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
278
|
+
credentialRole: CredentialRole.VERIFIER,
|
|
279
|
+
tenantId: 'urn:uuid:nnag4b43-1e7a-98f8-a32c-a48dbc5b10mj',
|
|
280
|
+
}
|
|
281
|
+
const childCredential: DigitalCredential = await digitalCredentialStore.addCredential(digitalCredentialChild)
|
|
282
|
+
expect(childCredential).toBeDefined()
|
|
283
|
+
|
|
284
|
+
let deleteResult: boolean = await digitalCredentialStore.removeCredential({ id: parentCredential.id })
|
|
285
|
+
expect(deleteResult).toEqual(true)
|
|
286
|
+
|
|
287
|
+
await expect(digitalCredentialStore.getCredential({ id: childCredential.id })).rejects.toThrow(
|
|
288
|
+
`No credential found for arg: ${JSON.stringify({ id: childCredential.id })}`,
|
|
289
|
+
)
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
it('should not delete stored parent digital credential if a child gets deleted', async (): Promise<void> => {
|
|
293
|
+
const digitalCredentialParent: AddCredentialArgs = {
|
|
294
|
+
rawDocument:
|
|
295
|
+
'eyJraWQiOiJkaWQ6a2V5Ono2TWtyaGt5M3B1c20yNk1laUZhWFUzbjJuZWtyYW13RlVtZ0dyZUdHa0RWNnpRaiN6Nk1rcmhreTNwdXNtMjZNZWlGYVhVM24ybmVrcmFtd0ZVbWdHcmVHR2tEVjZ6UWoiLCJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vc3BoZXJlb24tb3BlbnNvdXJjZS5naXRodWIuaW8vc3NpLW1vYmlsZS13YWxsZXQvY29udGV4dC9zcGhlcmVvbi13YWxsZXQtaWRlbnRpdHktdjEuanNvbmxkIl0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJTcGhlcmVvbldhbGxldElkZW50aXR5Q3JlZGVudGlhbCJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJmaXJzdE5hbWUiOiJTIiwibGFzdE5hbWUiOiJLIiwiZW1haWxBZGRyZXNzIjoic0BrIn19LCJzdWIiOiJ1cm46dXVpZDpkZGE3YmYyNC04ZTdhLTQxZjgtYjY2Yy1hNDhkYmM1YjEwZmEiLCJqdGkiOiJ1cm46dXVpZDpkZGE3YmYyNC04ZTdhLTQxZjgtYjY2Yy1hNDhkYmM1YjEwZmEiLCJuYmYiOjE3MDg0NDA4MDgsImlzcyI6ImRpZDprZXk6ejZNa3Joa3kzcHVzbTI2TWVpRmFYVTNuMm5la3JhbXdGVW1nR3JlR0drRFY2elFqIn0.G0M84XVAxSmzGY-NQuB9NBofNrINSn6lvxW6761Vlq6ypvYgtc2xNdpiRmw8ryVNfnpzrr4Z5cB1RlrC05rJAw',
|
|
296
|
+
kmsKeyRef: 'testRef',
|
|
297
|
+
identifierMethod: 'did',
|
|
298
|
+
issuerCorrelationType: CredentialCorrelationType.DID,
|
|
299
|
+
subjectCorrelationType: CredentialCorrelationType.DID,
|
|
300
|
+
issuerCorrelationId: 'did:key:z6Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
301
|
+
subjectCorrelationId: 'did:key:z6Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
302
|
+
credentialRole: CredentialRole.VERIFIER,
|
|
303
|
+
tenantId: 'urn:uuid:nnag4b43-1e7a-98f8-a32c-a48dbc5b10mj',
|
|
304
|
+
}
|
|
305
|
+
const parentCredential: DigitalCredential = await digitalCredentialStore.addCredential(digitalCredentialParent)
|
|
306
|
+
expect(parentCredential).toBeDefined()
|
|
307
|
+
|
|
308
|
+
const digitalCredentialChild: AddCredentialArgs = {
|
|
309
|
+
rawDocument:
|
|
310
|
+
'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6dmVsb2NpdHk6djI6MHhjMTY3MTUxNmMyMTQ1ZDcwYjM0MGY1NjBhYjFjYjU4Y2M0ZDhhMDUyOjE2Mzc4MjY4NTEwMzM4MToxOTg2I2tleS0xIn0.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIk9wZW5CYWRnZUNyZWRlbnRpYWwiLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsI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jXwDaZ8RNKESwFA',
|
|
311
|
+
parentId: parentCredential.id,
|
|
312
|
+
kmsKeyRef: 'testRef',
|
|
313
|
+
identifierMethod: 'did',
|
|
314
|
+
issuerCorrelationType: CredentialCorrelationType.DID,
|
|
315
|
+
subjectCorrelationType: CredentialCorrelationType.DID,
|
|
316
|
+
issuerCorrelationId: 'did:key:z1Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
317
|
+
subjectCorrelationId: 'did:key:z6Mkrhky3pusm26MeiFaXU3n2nekramwFUmgGreGGkDV6zQj',
|
|
318
|
+
credentialRole: CredentialRole.VERIFIER,
|
|
319
|
+
tenantId: 'urn:uuid:nnag4b43-1e7a-98f8-a32c-a48dbc5b10mj',
|
|
320
|
+
}
|
|
321
|
+
const childCredential: DigitalCredential = await digitalCredentialStore.addCredential(digitalCredentialChild)
|
|
322
|
+
expect(childCredential).toBeDefined()
|
|
323
|
+
|
|
324
|
+
let deleteResult: boolean = await digitalCredentialStore.removeCredential({ id: childCredential.id })
|
|
325
|
+
expect(deleteResult).toEqual(true)
|
|
326
|
+
|
|
327
|
+
const fetchedCredential: DigitalCredential = await digitalCredentialStore.getCredential({ id: parentCredential.id })
|
|
328
|
+
expect(fetchedCredential).toBeDefined()
|
|
329
|
+
})
|
|
330
|
+
|
|
250
331
|
it('should not delete stored digital credential if id not found', async (): Promise<void> => {
|
|
251
332
|
const result = await digitalCredentialStore.removeCredential({ id: 'unknown_id' })
|
|
252
333
|
expect(result).toEqual(false)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
-
import { PartyCorrelationType } from '@sphereon/ssi-sdk.core'
|
|
3
|
-
import { ActionType, InitiatorType, LogLevel, SubSystem, System, SystemCorrelationIdType } from '@sphereon/ssi-types'
|
|
2
|
+
import { CredentialType, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
|
|
3
|
+
import { ActionType, InitiatorType, LoggingEventType, LogLevel, SubSystem, System, SystemCorrelationIdType } from '@sphereon/ssi-types'
|
|
4
4
|
import { DataSource } from 'typeorm'
|
|
5
5
|
import { DataStoreEventLoggerEntities } from '../index'
|
|
6
|
-
import { DataStoreEventLoggerMigrations } from '../migrations
|
|
7
|
-
import {
|
|
8
|
-
import { NonPersistedAuditLoggingEvent } from '../types'
|
|
6
|
+
import { DataStoreEventLoggerMigrations } from '../migrations'
|
|
7
|
+
import { AuditEventEntity } from '../entities/eventLogger/AuditEventEntity'
|
|
8
|
+
import { NonPersistedAuditLoggingEvent, NonPersistedActivityLoggingEvent } from '../types'
|
|
9
|
+
import { activityEventEntityFrom, auditEventEntityFrom } from '../utils/eventLogger/MappingUtils'
|
|
9
10
|
|
|
10
11
|
describe('Database entities tests', (): void => {
|
|
11
12
|
let dbConnection: DataSource
|
|
@@ -55,6 +56,7 @@ describe('Database entities tests', (): void => {
|
|
|
55
56
|
|
|
56
57
|
expect(fromDb).toBeDefined()
|
|
57
58
|
expect(fromDb?.id).not.toBeNull()
|
|
59
|
+
expect(fromDb?.type).toEqual(LoggingEventType.AUDIT)
|
|
58
60
|
expect(fromDb?.timestamp).toEqual(auditEvent.timestamp)
|
|
59
61
|
expect(fromDb?.level).toEqual(auditEvent.level)
|
|
60
62
|
expect(fromDb?.correlationId).toEqual(auditEvent.correlationId)
|
|
@@ -73,4 +75,57 @@ describe('Database entities tests', (): void => {
|
|
|
73
75
|
expect(fromDb?.data).toEqual(JSON.stringify(auditEvent.data))
|
|
74
76
|
expect(fromDb?.diagnosticData).toEqual(JSON.stringify(auditEvent.diagnosticData))
|
|
75
77
|
})
|
|
78
|
+
|
|
79
|
+
it('should save activity event to database', async (): Promise<void> => {
|
|
80
|
+
const activityEvent: NonPersistedActivityLoggingEvent = {
|
|
81
|
+
timestamp: new Date(),
|
|
82
|
+
level: LogLevel.DEBUG,
|
|
83
|
+
originalCredential: 'test_credential_string',
|
|
84
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
85
|
+
parentCredentialHash: 'df7037831edbde7f0f65f723ef5494d6',
|
|
86
|
+
credentialType: CredentialType.SD_JWT,
|
|
87
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
88
|
+
system: System.GENERAL,
|
|
89
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
90
|
+
actionType: ActionType.CREATE,
|
|
91
|
+
actionSubType: 'Key generation',
|
|
92
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
93
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
94
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
95
|
+
systemAlias: 'test_alias',
|
|
96
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
97
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
98
|
+
partyAlias: 'test_alias',
|
|
99
|
+
description: 'test_description',
|
|
100
|
+
data: 'test_data_string',
|
|
101
|
+
diagnosticData: { data: 'test_data_string' },
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const activityEventEntity: AuditEventEntity = activityEventEntityFrom(activityEvent)
|
|
105
|
+
const fromDb: AuditEventEntity = await dbConnection.getRepository(AuditEventEntity).save(activityEventEntity)
|
|
106
|
+
|
|
107
|
+
expect(fromDb).toBeDefined()
|
|
108
|
+
expect(fromDb?.id).not.toBeNull()
|
|
109
|
+
expect(fromDb?.type).toEqual(LoggingEventType.ACTIVITY)
|
|
110
|
+
expect(fromDb?.timestamp).toEqual(activityEvent.timestamp)
|
|
111
|
+
expect(fromDb?.level).toEqual(activityEvent.level)
|
|
112
|
+
expect(fromDb?.correlationId).toEqual(activityEvent.correlationId)
|
|
113
|
+
expect(fromDb?.system).toEqual(activityEvent.system)
|
|
114
|
+
expect(fromDb?.subSystemType).toEqual(activityEvent.subSystemType)
|
|
115
|
+
expect(fromDb?.actionType).toEqual(activityEvent.actionType)
|
|
116
|
+
expect(fromDb?.actionSubType).toEqual(activityEvent.actionSubType)
|
|
117
|
+
expect(fromDb?.initiatorType).toEqual(activityEvent.initiatorType)
|
|
118
|
+
expect(fromDb?.systemCorrelationIdType).toEqual(activityEvent.systemCorrelationIdType)
|
|
119
|
+
expect(fromDb?.systemCorrelationId).toEqual(activityEvent.systemCorrelationId)
|
|
120
|
+
expect(fromDb?.systemAlias).toEqual(activityEvent.systemAlias)
|
|
121
|
+
expect(fromDb?.partyCorrelationType).toEqual(activityEvent.partyCorrelationType)
|
|
122
|
+
expect(fromDb?.partyCorrelationId).toEqual(activityEvent.partyCorrelationId)
|
|
123
|
+
expect(fromDb?.partyAlias).toEqual(activityEvent.partyAlias)
|
|
124
|
+
expect(fromDb?.description).toEqual(activityEvent.description)
|
|
125
|
+
expect(fromDb?.data).toEqual(JSON.stringify(activityEvent.data))
|
|
126
|
+
expect(fromDb?.diagnosticData).toEqual(JSON.stringify(activityEvent.diagnosticData))
|
|
127
|
+
expect(fromDb?.credentialHash).toEqual(activityEvent.credentialHash)
|
|
128
|
+
expect(fromDb?.parentCredentialHash).toEqual(activityEvent.parentCredentialHash)
|
|
129
|
+
expect(fromDb?.credentialType).toEqual(activityEvent.credentialType)
|
|
130
|
+
})
|
|
76
131
|
})
|