@sphereon/ssi-sdk.data-store 0.18.2-unstable.7 → 0.18.2-unstable.85
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/LICENSE +201 -201
- package/README.md +77 -77
- package/dist/contact/AbstractContactStore.d.ts +33 -23
- package/dist/contact/AbstractContactStore.d.ts.map +1 -1
- package/dist/contact/AbstractContactStore.js +6 -6
- package/dist/contact/AbstractContactStore.js.map +1 -1
- package/dist/contact/ContactStore.d.ts +44 -32
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/contact/ContactStore.js +528 -365
- package/dist/contact/ContactStore.js.map +1 -1
- package/dist/digitalCredential/AbstractDigitalCredentialStore.d.ts +10 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.d.ts.map +1 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.js +7 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.js.map +1 -0
- package/dist/digitalCredential/DigitalCredentialStore.d.ts +15 -0
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -0
- package/dist/digitalCredential/DigitalCredentialStore.js +97 -0
- package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -0
- package/dist/entities/contact/BaseConfigEntity.d.ts +6 -6
- package/dist/entities/contact/BaseConfigEntity.js +33 -33
- package/dist/entities/contact/BaseContactEntity.d.ts +9 -9
- package/dist/entities/contact/BaseContactEntity.js +53 -53
- package/dist/entities/contact/ConnectionEntity.d.ts +10 -10
- package/dist/entities/contact/ConnectionEntity.js +46 -46
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +10 -10
- package/dist/entities/contact/CorrelationIdentifierEntity.js +71 -71
- package/dist/entities/contact/DidAuthConfigEntity.d.ts +6 -6
- package/dist/entities/contact/DidAuthConfigEntity.js +32 -32
- package/dist/entities/contact/ElectronicAddressEntity.d.ts +14 -13
- package/dist/entities/contact/ElectronicAddressEntity.d.ts.map +1 -1
- package/dist/entities/contact/ElectronicAddressEntity.js +95 -91
- package/dist/entities/contact/ElectronicAddressEntity.js.map +1 -1
- package/dist/entities/contact/IdentityEntity.d.ts +20 -20
- package/dist/entities/contact/IdentityEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityEntity.js +128 -128
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +9 -9
- package/dist/entities/contact/IdentityMetadataItemEntity.js +68 -68
- package/dist/entities/contact/NaturalPersonEntity.d.ts +8 -8
- package/dist/entities/contact/NaturalPersonEntity.js +71 -71
- package/dist/entities/contact/OpenIdConfigEntity.d.ts +10 -10
- package/dist/entities/contact/OpenIdConfigEntity.js +48 -48
- package/dist/entities/contact/OrganizationEntity.d.ts +8 -8
- package/dist/entities/contact/OrganizationEntity.js +66 -66
- package/dist/entities/contact/PartyEntity.d.ts +21 -19
- package/dist/entities/contact/PartyEntity.d.ts.map +1 -1
- package/dist/entities/contact/PartyEntity.js +142 -131
- package/dist/entities/contact/PartyEntity.js.map +1 -1
- package/dist/entities/contact/PartyRelationshipEntity.d.ts +12 -12
- package/dist/entities/contact/PartyRelationshipEntity.js +94 -94
- package/dist/entities/contact/PartyTypeEntity.d.ts +14 -14
- package/dist/entities/contact/PartyTypeEntity.js +103 -103
- package/dist/entities/contact/PhysicalAddressEntity.d.ts +21 -0
- package/dist/entities/contact/PhysicalAddressEntity.d.ts.map +1 -0
- package/dist/entities/contact/PhysicalAddressEntity.js +126 -0
- package/dist/entities/contact/PhysicalAddressEntity.js.map +1 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts +23 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js +93 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -0
- package/dist/entities/eventLogger/AuditEventEntity.d.ts +26 -26
- package/dist/entities/eventLogger/AuditEventEntity.js +123 -123
- package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +10 -10
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +73 -73
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts +17 -17
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js +119 -119
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +14 -14
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +101 -101
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +48 -48
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +13 -13
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js +91 -91
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +38 -38
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +13 -13
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +94 -94
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +48 -48
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/TextAttributesEntity.js +61 -61
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts +18 -18
- package/dist/entities/statusList2021/StatusList2021Entity.js +114 -114
- package/dist/entities/statusList2021/StatusList2021EntryEntity.d.ts +10 -10
- package/dist/entities/statusList2021/StatusList2021EntryEntity.js +50 -50
- package/dist/entities/validators/index.d.ts +6 -6
- package/dist/entities/validators/index.js +26 -26
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts +6 -6
- package/dist/eventLogger/AbstractEventLoggerStore.js +6 -6
- package/dist/eventLogger/EventLoggerStore.d.ts +12 -12
- package/dist/eventLogger/EventLoggerStore.js +43 -43
- package/dist/index.d.ts +45 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -127
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts +19 -19
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js +6 -6
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +30 -30
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js +390 -374
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/migrations/generic/1-CreateContacts.d.ts +6 -6
- package/dist/migrations/generic/1-CreateContacts.js +77 -77
- package/dist/migrations/generic/2-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/generic/2-CreateIssuanceBranding.js +77 -77
- package/dist/migrations/generic/3-CreateContacts.d.ts +6 -6
- package/dist/migrations/generic/3-CreateContacts.js +77 -77
- package/dist/migrations/generic/4-CreateStatusList.d.ts +6 -6
- package/dist/migrations/generic/4-CreateStatusList.js +71 -71
- package/dist/migrations/generic/5-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/generic/5-CreateAuditEvents.js +77 -77
- package/dist/migrations/generic/{2-CreateContacts.d.ts → 6-CreateDigitalCredential.d.ts} +2 -2
- package/dist/migrations/generic/6-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/generic/{2-CreateContacts.js → 6-CreateDigitalCredential.js} +23 -23
- package/dist/migrations/generic/6-CreateDigitalCredential.js.map +1 -0
- package/dist/migrations/generic/index.d.ts +18 -16
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +30 -27
- package/dist/migrations/generic/index.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +10 -5
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts +6 -6
- package/dist/migrations/internal-migrations-ormconfig.js +26 -26
- package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts +6 -6
- package/dist/migrations/postgres/1659463079428-CreateContacts.js +56 -56
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +68 -68
- package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts +6 -6
- package/dist/migrations/postgres/1690925872592-CreateContacts.js +68 -68
- package/dist/migrations/postgres/1693866470001-CreateStatusList.d.ts +6 -6
- package/dist/migrations/postgres/1693866470001-CreateStatusList.js +31 -31
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +42 -42
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/{generic/3-CreateStatusList.d.ts → postgres/1708525189001-CreateDigitalCredential.d.ts} +2 -2
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +59 -0
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -0
- package/dist/migrations/sqlite/1659463069549-CreateContacts.d.ts +6 -6
- package/dist/migrations/sqlite/1659463069549-CreateContacts.js +78 -78
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +88 -88
- package/dist/migrations/sqlite/1690925872693-CreateContacts.d.ts +6 -6
- package/dist/migrations/sqlite/1690925872693-CreateContacts.d.ts.map +1 -1
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js +104 -107
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js.map +1 -1
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.d.ts +6 -6
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.js +31 -31
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +28 -28
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/{postgres/CreateStatusList1693866470001-CreateStatusList.d.ts → sqlite/1708525189002-CreateDigitalCredential.d.ts} +2 -2
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +50 -0
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js.map +1 -0
- package/dist/statusList/IStatusListStore.d.ts +19 -19
- package/dist/statusList/IStatusListStore.js +2 -2
- package/dist/statusList/StatusListStore.d.ts +35 -35
- package/dist/statusList/StatusListStore.js +212 -212
- package/dist/types/contact/IAbstractContactStore.d.ts +109 -74
- package/dist/types/contact/IAbstractContactStore.d.ts.map +1 -1
- package/dist/types/contact/IAbstractContactStore.js +2 -2
- package/dist/types/contact/contact.d.ts +196 -173
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/contact/contact.js +25 -25
- package/dist/types/contact/contact.js.map +1 -1
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts +27 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts.map +1 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.js +3 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.js.map +1 -0
- package/dist/types/digitalCredential/digitalCredential.d.ts +41 -0
- package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -0
- package/dist/types/digitalCredential/digitalCredential.js +28 -0
- package/dist/types/digitalCredential/digitalCredential.js.map +1 -0
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +9 -9
- package/dist/types/eventLogger/IAbstractEventLoggerStore.js +2 -2
- package/dist/types/eventLogger/eventLogger.d.ts +2 -2
- package/dist/types/eventLogger/eventLogger.js +2 -2
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +25 -25
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts +58 -58
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js +2 -2
- package/dist/types/issuanceBranding/issuanceBranding.d.ts +114 -114
- package/dist/types/issuanceBranding/issuanceBranding.js +2 -2
- package/dist/types/statusList/IAbstractStatusListStore.d.ts +37 -37
- package/dist/types/statusList/IAbstractStatusListStore.js +2 -2
- package/dist/types/statusList/statusList.d.ts +24 -24
- package/dist/types/statusList/statusList.js +2 -2
- package/dist/types/validation/validation.d.ts +3 -3
- package/dist/types/validation/validation.js +2 -2
- package/dist/utils/ValidatorUtils.d.ts +3 -3
- package/dist/utils/ValidatorUtils.js +12 -12
- package/dist/utils/contact/MappingUtils.d.ts +49 -46
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.js +326 -290
- package/dist/utils/contact/MappingUtils.js.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts +9 -0
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -0
- package/dist/utils/digitalCredential/MappingUtils.js +92 -0
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -0
- package/package.json +5 -4
- package/src/__tests__/contact.entities.test.ts +323 -23
- package/src/__tests__/contact.store.test.ts +586 -10
- package/src/__tests__/digitalCredential.entities.test.ts +247 -0
- package/src/__tests__/digitalCredential.store.test.ts +194 -0
- package/src/__tests__/eventLogger.entities.test.ts +73 -73
- package/src/__tests__/eventLogger.store.test.ts +136 -136
- package/src/contact/AbstractContactStore.ts +38 -17
- package/src/contact/ContactStore.ts +715 -501
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +16 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +107 -0
- package/src/entities/contact/ElectronicAddressEntity.ts +3 -0
- package/src/entities/contact/IdentityEntity.ts +1 -1
- package/src/entities/contact/PartyEntity.ts +11 -1
- package/src/entities/contact/PhysicalAddressEntity.ts +87 -0
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +64 -0
- package/src/entities/eventLogger/AuditEventEntity.ts +99 -99
- package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
- package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
- package/src/eventLogger/EventLoggerStore.ts +62 -62
- package/src/index.ts +131 -113
- package/src/issuanceBranding/IssuanceBrandingStore.ts +78 -62
- package/src/migrations/generic/1-CreateContacts.ts +66 -66
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
- package/src/migrations/generic/3-CreateContacts.ts +66 -66
- package/src/migrations/generic/4-CreateStatusList.ts +54 -54
- package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
- package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -0
- package/src/migrations/generic/index.ts +30 -27
- package/src/migrations/index.ts +8 -1
- package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +44 -0
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +158 -163
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +34 -0
- package/src/types/contact/IAbstractContactStore.ts +58 -8
- package/src/types/contact/contact.ts +29 -4
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +26 -0
- package/src/types/digitalCredential/digitalCredential.ts +45 -0
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
- package/src/types/eventLogger/eventLogger.ts +3 -3
- package/src/types/index.ts +9 -9
- package/src/utils/contact/MappingUtils.ts +39 -1
- package/src/utils/digitalCredential/MappingUtils.ts +112 -0
- package/dist/entities/contact/ContactEntity.d.ts +0 -16
- package/dist/entities/contact/ContactEntity.d.ts.map +0 -1
- package/dist/entities/contact/ContactEntity.js +0 -164
- package/dist/entities/contact/ContactEntity.js.map +0 -1
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts +0 -7
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +0 -1
- package/dist/migrations/generic/1-CreateIssuanceBranding.js +0 -96
- package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +0 -1
- package/dist/migrations/generic/2-CreateContacts.d.ts.map +0 -1
- package/dist/migrations/generic/2-CreateContacts.js.map +0 -1
- package/dist/migrations/generic/3-CreateStatusList.d.ts.map +0 -1
- package/dist/migrations/generic/3-CreateStatusList.js +0 -72
- package/dist/migrations/generic/3-CreateStatusList.js.map +0 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts.map +0 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js +0 -32
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js.map +0 -1
- package/dist/migrations/postgres/uuid.d.ts +0 -3
- package/dist/migrations/postgres/uuid.d.ts.map +0 -1
- package/dist/migrations/postgres/uuid.js +0 -25
- package/dist/migrations/postgres/uuid.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateDigitalCredential1708525189002 implements MigrationInterface {
|
|
4
|
+
name = 'CreateDigitalCredential1708525189002'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`
|
|
8
|
+
CREATE TABLE "DigitalCredential" (
|
|
9
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
10
|
+
"credential_type" varchar CHECK( "credential_type" IN ('VC', 'VP', 'C', 'P') ) NOT NULL,
|
|
11
|
+
"document_format" varchar CHECK( "document_format" IN ('JSON_LD', 'JWT', 'SD_JWT', 'MDOC') ) NOT NULL,
|
|
12
|
+
"raw" text NOT NULL,
|
|
13
|
+
"uniform_document" text NOT NULL,
|
|
14
|
+
"hash" text NOT NULL UNIQUE,
|
|
15
|
+
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID') ) NOT NULL,
|
|
16
|
+
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID') ),
|
|
17
|
+
"issuer_correlation_id" text NOT NULL,
|
|
18
|
+
"subject_correlation_id" text,
|
|
19
|
+
"verified_state" varchar CHECK( "verified_state" IN ('REVOKED', 'VERIFIED', 'EXPIRED') ),
|
|
20
|
+
"tenant_id" text,
|
|
21
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
22
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
23
|
+
"issued_at" datetime,
|
|
24
|
+
"expires_at" datetime,
|
|
25
|
+
"verification_date" datetime,
|
|
26
|
+
"revocation_date" datetime
|
|
27
|
+
)
|
|
28
|
+
`)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
32
|
+
await queryRunner.query(`DROP TABLE "DigitalCredential"`)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ElectronicAddress,
|
|
3
|
+
Identity,
|
|
3
4
|
NonPersistedContact,
|
|
5
|
+
NonPersistedElectronicAddress,
|
|
4
6
|
NonPersistedIdentity,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
NonPersistedPartyType,
|
|
8
|
+
NonPersistedPhysicalAddress,
|
|
9
|
+
PartialElectronicAddress,
|
|
8
10
|
PartialIdentity,
|
|
9
|
-
|
|
10
|
-
PartyType,
|
|
11
|
-
PartyRelationship,
|
|
11
|
+
PartialParty,
|
|
12
12
|
PartialPartyRelationship,
|
|
13
13
|
PartialPartyType,
|
|
14
|
-
|
|
14
|
+
PartialPhysicalAddress,
|
|
15
|
+
Party,
|
|
16
|
+
PartyRelationship,
|
|
17
|
+
PartyType,
|
|
18
|
+
PartyTypeEnum,
|
|
19
|
+
PhysicalAddress,
|
|
15
20
|
} from './contact'
|
|
16
21
|
|
|
17
22
|
export type FindPartyArgs = Array<PartialParty>
|
|
18
23
|
export type FindIdentityArgs = Array<PartialIdentity>
|
|
19
24
|
export type FindPartyTypeArgs = Array<PartialPartyType>
|
|
20
25
|
export type FindRelationshipArgs = Array<PartialPartyRelationship>
|
|
26
|
+
export type FindElectronicAddressArgs = Array<PartialElectronicAddress>
|
|
27
|
+
export type FindPhysicalAddressArgs = Array<PartialPhysicalAddress>
|
|
21
28
|
|
|
22
29
|
export type GetPartyArgs = {
|
|
23
30
|
partyId: string
|
|
@@ -33,6 +40,7 @@ export type AddPartyArgs = {
|
|
|
33
40
|
contact: NonPersistedContact
|
|
34
41
|
identities?: Array<NonPersistedIdentity>
|
|
35
42
|
electronicAddresses?: Array<NonPersistedElectronicAddress>
|
|
43
|
+
physicalAddresses?: Array<NonPersistedPhysicalAddress>
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
export type UpdatePartyArgs = {
|
|
@@ -107,3 +115,45 @@ export type UpdatePartyTypeArgs = {
|
|
|
107
115
|
export type RemovePartyTypeArgs = {
|
|
108
116
|
partyTypeId: string
|
|
109
117
|
}
|
|
118
|
+
|
|
119
|
+
export type GetElectronicAddressArgs = {
|
|
120
|
+
electronicAddressId: string
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export type GetElectronicAddressesArgs = {
|
|
124
|
+
filter?: FindElectronicAddressArgs
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type AddElectronicAddressArgs = {
|
|
128
|
+
partyId: string
|
|
129
|
+
electronicAddress: NonPersistedElectronicAddress
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export type UpdateElectronicAddressArgs = {
|
|
133
|
+
electronicAddress: ElectronicAddress
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type RemoveElectronicAddressArgs = {
|
|
137
|
+
electronicAddressId: string
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type GetPhysicalAddressArgs = {
|
|
141
|
+
physicalAddressId: string
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type GetPhysicalAddressesArgs = {
|
|
145
|
+
filter?: FindPhysicalAddressArgs
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export type AddPhysicalAddressArgs = {
|
|
149
|
+
partyId: string
|
|
150
|
+
physicalAddress: NonPersistedPhysicalAddress
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export type UpdatePhysicalAddressArgs = {
|
|
154
|
+
physicalAddress: PhysicalAddress
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export type RemovePhysicalAddressArgs = {
|
|
158
|
+
physicalAddressId: string
|
|
159
|
+
}
|
|
@@ -6,6 +6,7 @@ export type Party = {
|
|
|
6
6
|
roles: Array<IdentityRoleEnum>
|
|
7
7
|
identities: Array<Identity>
|
|
8
8
|
electronicAddresses: Array<ElectronicAddress>
|
|
9
|
+
physicalAddresses: Array<PhysicalAddress>
|
|
9
10
|
contact: Contact
|
|
10
11
|
partyType: PartyType
|
|
11
12
|
relationships: Array<PartyRelationship>
|
|
@@ -14,17 +15,19 @@ export type Party = {
|
|
|
14
15
|
}
|
|
15
16
|
export type NonPersistedParty = Omit<
|
|
16
17
|
Party,
|
|
17
|
-
'id' | 'identities' | 'electronicAddresses' | 'contact' | 'roles' | 'partyType' | 'relationships' | 'createdAt' | 'lastUpdatedAt'
|
|
18
|
+
'id' | 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'roles' | 'partyType' | 'relationships' | 'createdAt' | 'lastUpdatedAt'
|
|
18
19
|
> & {
|
|
19
20
|
identities?: Array<NonPersistedIdentity>
|
|
20
21
|
electronicAddresses?: Array<NonPersistedElectronicAddress>
|
|
22
|
+
physicalAddresses?: Array<NonPersistedPhysicalAddress>
|
|
21
23
|
contact: NonPersistedContact
|
|
22
24
|
partyType: NonPersistedPartyType
|
|
23
25
|
relationships?: Array<NonPersistedPartyRelationship>
|
|
24
26
|
}
|
|
25
|
-
export type PartialParty = Partial<Omit<Party, 'identities' | 'electronicAddresses' | 'contact' | 'partyType' | 'relationships'>> & {
|
|
27
|
+
export type PartialParty = Partial<Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>> & {
|
|
26
28
|
identities?: PartialIdentity
|
|
27
29
|
electronicAddresses?: PartialElectronicAddress
|
|
30
|
+
physicalAddresses?: PartialPhysicalAddress
|
|
28
31
|
contact?: PartialContact
|
|
29
32
|
partyType?: PartialPartyType
|
|
30
33
|
relationships?: PartialPartyRelationship
|
|
@@ -168,9 +171,31 @@ export type ElectronicAddress = {
|
|
|
168
171
|
lastUpdatedAt: Date
|
|
169
172
|
}
|
|
170
173
|
export type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
|
|
171
|
-
export type PartialElectronicAddress = Partial<ElectronicAddress>
|
|
174
|
+
export type PartialElectronicAddress = Partial<ElectronicAddress> & {
|
|
175
|
+
partyId?: string
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export type PhysicalAddress = {
|
|
179
|
+
id: string
|
|
180
|
+
type: PhysicalAddressType
|
|
181
|
+
streetName: string
|
|
182
|
+
streetNumber: string
|
|
183
|
+
postalCode: string
|
|
184
|
+
cityName: string
|
|
185
|
+
provinceName: string
|
|
186
|
+
countryCode: string
|
|
187
|
+
buildingName?: string
|
|
188
|
+
createdAt: Date
|
|
189
|
+
lastUpdatedAt: Date
|
|
190
|
+
}
|
|
191
|
+
export type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
|
|
192
|
+
export type PartialPhysicalAddress = Partial<PhysicalAddress> & {
|
|
193
|
+
partyId?: string
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export type ElectronicAddressType = 'email' | 'phone'
|
|
172
197
|
|
|
173
|
-
export type
|
|
198
|
+
export type PhysicalAddressType = 'home' | 'visit' | 'postal'
|
|
174
199
|
|
|
175
200
|
export enum IdentityRoleEnum {
|
|
176
201
|
ISSUER = 'issuer',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CredentialCorrelationType, CredentialStateType, DigitalCredential } from './digitalCredential'
|
|
2
|
+
|
|
3
|
+
export type GetDigitalCredentialArgs = { id: string } | { hash: string }
|
|
4
|
+
|
|
5
|
+
export type FindDigitalCredentialArgs = Array<Partial<DigitalCredential>>
|
|
6
|
+
|
|
7
|
+
// TODO: discuss about what args we want here
|
|
8
|
+
export type GetDigitalCredentialsArgs = {
|
|
9
|
+
filter?: FindDigitalCredentialArgs
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AddDigitalCredentialArgs = {
|
|
13
|
+
raw: string
|
|
14
|
+
issuerCorrelationType: CredentialCorrelationType
|
|
15
|
+
subjectCorrelationType?: CredentialCorrelationType
|
|
16
|
+
issuerCorrelationId: string
|
|
17
|
+
subjectCorrelationId?: string
|
|
18
|
+
tenantId?: string
|
|
19
|
+
state?: CredentialStateType
|
|
20
|
+
verificationDate?: Date
|
|
21
|
+
revocationDate?: Date
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type UpdateDigitalCredentialStateArgs = GetDigitalCredentialArgs & { verifiedState: CredentialStateType; verificationDate?: Date }
|
|
25
|
+
|
|
26
|
+
export type RemoveDigitalCredentialArgs = GetDigitalCredentialArgs
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id'>
|
|
2
|
+
|
|
3
|
+
export type DigitalCredential = {
|
|
4
|
+
id: string
|
|
5
|
+
credentialType: CredentialType
|
|
6
|
+
documentFormat: CredentialDocumentFormat
|
|
7
|
+
raw: string
|
|
8
|
+
hash: string
|
|
9
|
+
issuerCorrelationType: CredentialCorrelationType
|
|
10
|
+
subjectCorrelationType?: CredentialCorrelationType
|
|
11
|
+
issuerCorrelationId: string
|
|
12
|
+
subjectCorrelationId?: string
|
|
13
|
+
uniformDocument: string
|
|
14
|
+
verificationDate?: Date
|
|
15
|
+
verifiedState?: CredentialStateType
|
|
16
|
+
tenantId?: string
|
|
17
|
+
createdAt: Date
|
|
18
|
+
lastUpdatedAt: Date
|
|
19
|
+
issuedAt?: Date
|
|
20
|
+
expiresAt?: Date
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum CredentialType {
|
|
24
|
+
VC = 'VC',
|
|
25
|
+
VP = 'VP',
|
|
26
|
+
P = 'P',
|
|
27
|
+
C = 'C',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export enum CredentialDocumentFormat {
|
|
31
|
+
JSON_LD = 'JSON_LD',
|
|
32
|
+
JWT = 'JWT',
|
|
33
|
+
SD_JWT = 'SD_JWT',
|
|
34
|
+
MDOC = 'MDOC',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum CredentialCorrelationType {
|
|
38
|
+
DID = 'DID',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export enum CredentialStateType {
|
|
42
|
+
REVOKED = 'REVOKED',
|
|
43
|
+
VERIFIED = 'VERIFIED',
|
|
44
|
+
EXPIRED = 'EXPIRED',
|
|
45
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
-
import { NonPersistedAuditLoggingEvent } from './eventLogger'
|
|
3
|
-
|
|
4
|
-
export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
|
|
5
|
-
|
|
6
|
-
export type StoreAuditEventArgs = {
|
|
7
|
-
event: NonPersistedAuditLoggingEvent
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type GetAuditEventsArgs = {
|
|
11
|
-
filter?: FindAuditLoggingEventArgs
|
|
12
|
-
}
|
|
1
|
+
import { PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { NonPersistedAuditLoggingEvent } from './eventLogger'
|
|
3
|
+
|
|
4
|
+
export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
|
|
5
|
+
|
|
6
|
+
export type StoreAuditEventArgs = {
|
|
7
|
+
event: NonPersistedAuditLoggingEvent
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type GetAuditEventsArgs = {
|
|
11
|
+
filter?: FindAuditLoggingEventArgs
|
|
12
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
-
|
|
3
|
-
export type NonPersistedAuditLoggingEvent = Omit<AuditLoggingEvent, 'id'>
|
|
1
|
+
import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
|
|
3
|
+
export type NonPersistedAuditLoggingEvent = Omit<AuditLoggingEvent, 'id'>
|
package/src/types/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './issuanceBranding/issuanceBranding'
|
|
2
|
-
export * from './issuanceBranding/IAbstractIssuanceBrandingStore'
|
|
3
|
-
export * from './contact/contact'
|
|
4
|
-
export * from './contact/IAbstractContactStore'
|
|
5
|
-
export * from './validation/validation'
|
|
6
|
-
export * from './statusList/statusList'
|
|
7
|
-
export * from './statusList/IAbstractStatusListStore'
|
|
8
|
-
export * from './eventLogger/IAbstractEventLoggerStore'
|
|
9
|
-
export * from './eventLogger/eventLogger'
|
|
1
|
+
export * from './issuanceBranding/issuanceBranding'
|
|
2
|
+
export * from './issuanceBranding/IAbstractIssuanceBrandingStore'
|
|
3
|
+
export * from './contact/contact'
|
|
4
|
+
export * from './contact/IAbstractContactStore'
|
|
5
|
+
export * from './validation/validation'
|
|
6
|
+
export * from './statusList/statusList'
|
|
7
|
+
export * from './statusList/IAbstractStatusListStore'
|
|
8
|
+
export * from './eventLogger/IAbstractEventLoggerStore'
|
|
9
|
+
export * from './eventLogger/eventLogger'
|
|
@@ -22,11 +22,12 @@ import {
|
|
|
22
22
|
NonPersistedParty,
|
|
23
23
|
NonPersistedPartyRelationship,
|
|
24
24
|
NonPersistedPartyType,
|
|
25
|
+
NonPersistedPhysicalAddress,
|
|
25
26
|
OpenIdConfig,
|
|
26
27
|
Organization,
|
|
27
28
|
Party,
|
|
28
29
|
PartyRelationship,
|
|
29
|
-
PartyType,
|
|
30
|
+
PartyType, PhysicalAddress
|
|
30
31
|
} from '../../types'
|
|
31
32
|
import { PartyEntity } from '../../entities/contact/PartyEntity'
|
|
32
33
|
import { IdentityEntity } from '../../entities/contact/IdentityEntity'
|
|
@@ -42,6 +43,7 @@ import { DidAuthConfigEntity } from '../../entities/contact/DidAuthConfigEntity'
|
|
|
42
43
|
import { IdentityMetadataItemEntity } from '../../entities/contact/IdentityMetadataItemEntity'
|
|
43
44
|
import { OpenIdConfigEntity } from '../../entities/contact/OpenIdConfigEntity'
|
|
44
45
|
import { PartyTypeEntity } from '../../entities/contact/PartyTypeEntity'
|
|
46
|
+
import { PhysicalAddressEntity } from '../../entities/contact/PhysicalAddressEntity'
|
|
45
47
|
|
|
46
48
|
export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
|
|
47
49
|
const partyEntity: PartyEntity = new PartyEntity()
|
|
@@ -50,6 +52,9 @@ export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
|
|
|
50
52
|
partyEntity.electronicAddresses = party.electronicAddresses
|
|
51
53
|
? party.electronicAddresses.map((electronicAddress: NonPersistedElectronicAddress) => electronicAddressEntityFrom(electronicAddress))
|
|
52
54
|
: []
|
|
55
|
+
partyEntity.physicalAddresses = party.physicalAddresses
|
|
56
|
+
? party.physicalAddresses.map((physicalAddress: NonPersistedPhysicalAddress) => physicalAddressEntityFrom(physicalAddress))
|
|
57
|
+
: []
|
|
53
58
|
partyEntity.partyType = partyTypeEntityFrom(party.partyType)
|
|
54
59
|
partyEntity.contact = contactEntityFrom(party.contact)
|
|
55
60
|
|
|
@@ -65,6 +70,9 @@ export const partyFrom = (party: PartyEntity): Party => {
|
|
|
65
70
|
electronicAddresses: party.electronicAddresses
|
|
66
71
|
? party.electronicAddresses.map((electronicAddress: ElectronicAddressEntity) => electronicAddressFrom(electronicAddress))
|
|
67
72
|
: [],
|
|
73
|
+
physicalAddresses: party.physicalAddresses
|
|
74
|
+
? party.physicalAddresses.map((physicalAddress: PhysicalAddressEntity) => physicalAddressFrom(physicalAddress))
|
|
75
|
+
: [],
|
|
68
76
|
relationships: party.relationships ? party.relationships.map((relationship: PartyRelationshipEntity) => partyRelationshipFrom(relationship)) : [],
|
|
69
77
|
partyType: partyTypeFrom(party.partyType),
|
|
70
78
|
contact: contactFrom(party.contact),
|
|
@@ -168,6 +176,36 @@ export const electronicAddressFrom = (electronicAddress: ElectronicAddressEntity
|
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
178
|
|
|
179
|
+
export const physicalAddressEntityFrom = (physicalAddress: NonPersistedPhysicalAddress): PhysicalAddressEntity => {
|
|
180
|
+
const physicalAddressEntity: PhysicalAddressEntity = new PhysicalAddressEntity()
|
|
181
|
+
physicalAddressEntity.type = physicalAddress.type
|
|
182
|
+
physicalAddressEntity.streetName = physicalAddress.streetName
|
|
183
|
+
physicalAddressEntity.streetNumber = physicalAddress.streetNumber
|
|
184
|
+
physicalAddressEntity.postalCode = physicalAddress.postalCode
|
|
185
|
+
physicalAddressEntity.cityName = physicalAddress.cityName
|
|
186
|
+
physicalAddressEntity.provinceName = physicalAddress.provinceName
|
|
187
|
+
physicalAddressEntity.countryCode = physicalAddress.countryCode
|
|
188
|
+
physicalAddressEntity.buildingName = physicalAddress.buildingName
|
|
189
|
+
|
|
190
|
+
return physicalAddressEntity
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export const physicalAddressFrom = (physicalAddress: PhysicalAddressEntity): PhysicalAddress => {
|
|
194
|
+
return {
|
|
195
|
+
id: physicalAddress.id,
|
|
196
|
+
type: physicalAddress.type,
|
|
197
|
+
streetName: physicalAddress.streetName,
|
|
198
|
+
streetNumber: physicalAddress.streetNumber,
|
|
199
|
+
postalCode: physicalAddress.postalCode,
|
|
200
|
+
cityName: physicalAddress.cityName,
|
|
201
|
+
provinceName: physicalAddress.provinceName,
|
|
202
|
+
countryCode: physicalAddress.countryCode,
|
|
203
|
+
buildingName: physicalAddress.buildingName,
|
|
204
|
+
createdAt: physicalAddress.createdAt,
|
|
205
|
+
lastUpdatedAt: physicalAddress.lastUpdatedAt,
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
171
209
|
export const identityEntityFrom = (args: NonPersistedIdentity): IdentityEntity => {
|
|
172
210
|
const identityEntity: IdentityEntity = new IdentityEntity()
|
|
173
211
|
identityEntity.alias = args.alias
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { AddDigitalCredentialArgs } from '../../types/digitalCredential/IAbstractDigitalCredentialStore'
|
|
2
|
+
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
|
|
3
|
+
import {
|
|
4
|
+
CredentialMapper,
|
|
5
|
+
decodeSdJwtVc,
|
|
6
|
+
DocumentFormat,
|
|
7
|
+
IVerifiableCredential,
|
|
8
|
+
IVerifiablePresentation,
|
|
9
|
+
SdJwtDecodedVerifiableCredentialPayload,
|
|
10
|
+
} from '@sphereon/ssi-types'
|
|
11
|
+
import {
|
|
12
|
+
CredentialDocumentFormat,
|
|
13
|
+
CredentialType,
|
|
14
|
+
DigitalCredential,
|
|
15
|
+
NonPersistedDigitalCredential,
|
|
16
|
+
} from '../../types/digitalCredential/digitalCredential'
|
|
17
|
+
import { computeEntryHash } from '@veramo/utils'
|
|
18
|
+
import { createHash } from 'crypto'
|
|
19
|
+
|
|
20
|
+
function determineCredentialType(raw: string): CredentialType {
|
|
21
|
+
if (CredentialMapper.hasProof(raw)) {
|
|
22
|
+
if (CredentialMapper.isCredential(raw)) {
|
|
23
|
+
return CredentialType.VC
|
|
24
|
+
} else if (CredentialMapper.isPresentation(raw)) {
|
|
25
|
+
return CredentialType.VP
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
if (CredentialMapper.isCredential(raw)) {
|
|
29
|
+
return CredentialType.C
|
|
30
|
+
} else if (CredentialMapper.isPresentation(raw)) {
|
|
31
|
+
return CredentialType.P
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
throw new Error(`Couldn't determine the type of the credential: ${raw}`)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function determineCredentialDocumentFormat(documentFormat: DocumentFormat): CredentialDocumentFormat {
|
|
38
|
+
switch (documentFormat) {
|
|
39
|
+
case DocumentFormat.JSONLD:
|
|
40
|
+
return CredentialDocumentFormat.JSON_LD
|
|
41
|
+
case DocumentFormat.JWT:
|
|
42
|
+
return CredentialDocumentFormat.JWT
|
|
43
|
+
case DocumentFormat.SD_JWT_VC:
|
|
44
|
+
return CredentialDocumentFormat.SD_JWT
|
|
45
|
+
default:
|
|
46
|
+
throw new Error(`Not supported document format: ${documentFormat}`)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getExpiresAt(uniformDocument: IVerifiableCredential | IVerifiablePresentation | SdJwtDecodedVerifiableCredentialPayload): Date | undefined {
|
|
51
|
+
if ('expirationDate' in uniformDocument) {
|
|
52
|
+
return new Date(uniformDocument.expirationDate)
|
|
53
|
+
} else if ('exp' in uniformDocument) {
|
|
54
|
+
return new Date(uniformDocument.exp)
|
|
55
|
+
}
|
|
56
|
+
return undefined
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getIssuedAt(uniformDocument: IVerifiableCredential | IVerifiablePresentation | SdJwtDecodedVerifiableCredentialPayload): Date | undefined {
|
|
60
|
+
if ('issuanceDate' in uniformDocument) {
|
|
61
|
+
return new Date(uniformDocument.issuanceDate)
|
|
62
|
+
} else if (uniformDocument.proof && CredentialMapper.getFirstProof(uniformDocument as IVerifiableCredential | IVerifiablePresentation)) {
|
|
63
|
+
return new Date(CredentialMapper.getFirstProof(uniformDocument as IVerifiableCredential | IVerifiablePresentation)!.created)
|
|
64
|
+
} else if ('validFrom' in uniformDocument) {
|
|
65
|
+
return new Date(uniformDocument['validFrom'])
|
|
66
|
+
} else if ('iat' in uniformDocument) {
|
|
67
|
+
return new Date(uniformDocument['iat'] * 1000)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return undefined
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const handleSdJwt = (rawCredential: string): SdJwtDecodedVerifiableCredentialPayload => {
|
|
74
|
+
// todo ask about the hasher
|
|
75
|
+
return CredentialMapper.isSdJwtEncoded(rawCredential)
|
|
76
|
+
? decodeSdJwtVc(rawCredential, (data, algorithm) => createHash(algorithm).update(data).digest()).decodedPayload
|
|
77
|
+
: JSON.parse(rawCredential)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs: AddDigitalCredentialArgs): NonPersistedDigitalCredential => {
|
|
81
|
+
const credentialType: CredentialType = determineCredentialType(addCredentialArgs.raw)
|
|
82
|
+
const documentFormat: DocumentFormat = CredentialMapper.detectDocumentType(addCredentialArgs.raw)
|
|
83
|
+
const uniformDocument =
|
|
84
|
+
documentFormat === DocumentFormat.SD_JWT_VC
|
|
85
|
+
? handleSdJwt(addCredentialArgs.raw)
|
|
86
|
+
: credentialType === CredentialType.VC || credentialType === CredentialType.C
|
|
87
|
+
? CredentialMapper.toUniformCredential(addCredentialArgs.raw)
|
|
88
|
+
: CredentialMapper.toUniformPresentation(addCredentialArgs.raw)
|
|
89
|
+
const issuedAt: Date | undefined = getIssuedAt(uniformDocument)
|
|
90
|
+
const expiresAt: Date | undefined = getExpiresAt(uniformDocument)
|
|
91
|
+
return {
|
|
92
|
+
...addCredentialArgs,
|
|
93
|
+
credentialType,
|
|
94
|
+
documentFormat: determineCredentialDocumentFormat(documentFormat),
|
|
95
|
+
createdAt: new Date(),
|
|
96
|
+
hash: computeEntryHash(addCredentialArgs.raw),
|
|
97
|
+
uniformDocument: JSON.stringify(uniformDocument),
|
|
98
|
+
issuedAt,
|
|
99
|
+
expiresAt,
|
|
100
|
+
lastUpdatedAt: new Date(),
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const digitalCredentialFrom = (credentialEntity: DigitalCredentialEntity): DigitalCredential => {
|
|
105
|
+
return {
|
|
106
|
+
...credentialEntity,
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const digitalCredentialsFrom = (credentialEntities: Array<DigitalCredentialEntity>): DigitalCredential[] => {
|
|
111
|
+
return credentialEntities.map((credentialEntity) => digitalCredentialFrom(credentialEntity))
|
|
112
|
+
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from 'typeorm'
|
|
2
|
-
import { IBasicContact } from '../../types'
|
|
3
|
-
import { IdentityEntity } from './IdentityEntity'
|
|
4
|
-
export declare class ContactEntity extends BaseEntity {
|
|
5
|
-
id: string
|
|
6
|
-
name: string
|
|
7
|
-
alias: string
|
|
8
|
-
uri?: string
|
|
9
|
-
identities: Array<IdentityEntity>
|
|
10
|
-
createdAt: Date
|
|
11
|
-
lastUpdatedAt: Date
|
|
12
|
-
updateUpdatedDate(): void
|
|
13
|
-
validate(): Promise<undefined>
|
|
14
|
-
}
|
|
15
|
-
export declare const contactEntityFrom: (args: IBasicContact) => ContactEntity
|
|
16
|
-
//# sourceMappingURL=ContactEntity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContactEntity.d.ts","sourceRoot":"","sources":["../../../src/entities/contact/ContactEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAUX,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAA;AAGrE,qBACa,aAAc,SAAQ,UAAU;IAE3C,EAAE,EAAG,MAAM,CAAA;IAIX,IAAI,EAAG,MAAM,CAAA;IAIb,KAAK,EAAG,MAAM,CAAA;IAGd,GAAG,CAAC,EAAE,MAAM,CAAA;IASZ,UAAU,EAAG,KAAK,CAAC,cAAc,CAAC,CAAA;IAGlC,SAAS,EAAG,IAAI,CAAA;IAGhB,aAAa,EAAG,IAAI,CAAA;IAKpB,iBAAiB;IAMX,QAAQ;CAOf;AAED,eAAO,MAAM,iBAAiB,SAAU,aAAa,KAAG,aAQvD,CAAA"}
|