@sphereon/ssi-sdk.data-store-types 0.34.1-feat.SSISDK.55.243
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 -0
- package/README.md +0 -0
- package/dist/index.cjs +204 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +916 -0
- package/dist/index.d.ts +916 -0
- package/dist/index.js +183 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
- package/src/contact/AbstractContactStore.ts +71 -0
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +21 -0
- package/src/eventLogger/AbstractEventLoggerStore.ts +9 -0
- package/src/index.ts +11 -0
- package/src/issuanceBranding/AbstractIssuanceBrandingStore.ts +41 -0
- package/src/machineState/IAbstractMachineStateStore.ts +65 -0
- package/src/presentationDefinition/AbstractPDStore.ts +20 -0
- package/src/types/contact/IAbstractContactStore.ts +161 -0
- package/src/types/contact/contact.ts +295 -0
- package/src/types/contact/index.ts +2 -0
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +41 -0
- package/src/types/digitalCredential/enums.ts +63 -0
- package/src/types/digitalCredential/index.ts +3 -0
- package/src/types/digitalCredential/types.ts +40 -0
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +22 -0
- package/src/types/eventLogger/eventLogger.ts +4 -0
- package/src/types/index.ts +10 -0
- package/src/types/issuanceBranding/IAbstractIssuanceBrandingStore.ts +85 -0
- package/src/types/issuanceBranding/issuanceBranding.ts +138 -0
- package/src/types/machineState/IAbstractMachineStateStore.ts +68 -0
- package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -0
- package/src/types/presentationDefinition/presentationDefinition.ts +18 -0
- package/src/types/validation/validation.ts +3 -0
- package/src/utils/MappingUtils.ts +22 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ElectronicAddress,
|
|
3
|
+
Identity,
|
|
4
|
+
NonPersistedContact,
|
|
5
|
+
NonPersistedElectronicAddress,
|
|
6
|
+
NonPersistedIdentity,
|
|
7
|
+
NonPersistedPartyType,
|
|
8
|
+
NonPersistedPhysicalAddress,
|
|
9
|
+
PartialElectronicAddress,
|
|
10
|
+
PartialIdentity,
|
|
11
|
+
PartialParty,
|
|
12
|
+
PartialPartyRelationship,
|
|
13
|
+
PartialPartyType,
|
|
14
|
+
PartialPhysicalAddress,
|
|
15
|
+
Party,
|
|
16
|
+
PartyOrigin,
|
|
17
|
+
PartyRelationship,
|
|
18
|
+
PartyType,
|
|
19
|
+
PartyTypeType,
|
|
20
|
+
PhysicalAddress,
|
|
21
|
+
} from './contact'
|
|
22
|
+
|
|
23
|
+
export type FindPartyArgs = Array<PartialParty>
|
|
24
|
+
export type FindIdentityArgs = Array<PartialIdentity>
|
|
25
|
+
export type FindPartyTypeArgs = Array<PartialPartyType>
|
|
26
|
+
export type FindRelationshipArgs = Array<PartialPartyRelationship>
|
|
27
|
+
export type FindElectronicAddressArgs = Array<PartialElectronicAddress>
|
|
28
|
+
export type FindPhysicalAddressArgs = Array<PartialPhysicalAddress>
|
|
29
|
+
|
|
30
|
+
export type GetPartyArgs = {
|
|
31
|
+
partyId: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type GetPartiesArgs = {
|
|
35
|
+
filter?: FindPartyArgs
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type AddPartyArgs = {
|
|
39
|
+
uri?: string
|
|
40
|
+
partyType: NonPersistedPartyType
|
|
41
|
+
contact: NonPersistedContact
|
|
42
|
+
identities?: Array<NonPersistedIdentity>
|
|
43
|
+
electronicAddresses?: Array<NonPersistedElectronicAddress>
|
|
44
|
+
physicalAddresses?: Array<NonPersistedPhysicalAddress>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type UpdatePartyArgs = {
|
|
48
|
+
party: Omit<Party, 'identities' | 'electronicAddresses' | 'partyType' | 'createdAt' | 'lastUpdatedAt'>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type RemovePartyArgs = {
|
|
52
|
+
partyId: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type GetIdentityArgs = {
|
|
56
|
+
identityId: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type GetIdentitiesArgs = {
|
|
60
|
+
filter?: FindIdentityArgs
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type AddIdentityArgs = {
|
|
64
|
+
partyId: string
|
|
65
|
+
identity: NonPersistedIdentity
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type UpdateIdentityArgs = {
|
|
69
|
+
identity: Identity
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type RemoveIdentityArgs = {
|
|
73
|
+
identityId: string
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type RemoveRelationshipArgs = {
|
|
77
|
+
relationshipId: string
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type AddRelationshipArgs = {
|
|
81
|
+
leftId: string
|
|
82
|
+
rightId: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type GetRelationshipArgs = {
|
|
86
|
+
relationshipId: string
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type GetRelationshipsArgs = {
|
|
90
|
+
filter: FindRelationshipArgs
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type UpdateRelationshipArgs = {
|
|
94
|
+
relationship: Omit<PartyRelationship, 'createdAt' | 'lastUpdatedAt'>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type AddPartyTypeArgs = {
|
|
98
|
+
type: PartyTypeType
|
|
99
|
+
origin: PartyOrigin
|
|
100
|
+
name: string
|
|
101
|
+
tenantId: string
|
|
102
|
+
description?: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type GetPartyTypeArgs = {
|
|
106
|
+
partyTypeId: string
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type GetPartyTypesArgs = {
|
|
110
|
+
filter?: FindPartyTypeArgs
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type UpdatePartyTypeArgs = {
|
|
114
|
+
partyType: Omit<PartyType, 'createdAt' | 'lastUpdatedAt'>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type RemovePartyTypeArgs = {
|
|
118
|
+
partyTypeId: string
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type GetElectronicAddressArgs = {
|
|
122
|
+
electronicAddressId: string
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type GetElectronicAddressesArgs = {
|
|
126
|
+
filter?: FindElectronicAddressArgs
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type AddElectronicAddressArgs = {
|
|
130
|
+
partyId: string
|
|
131
|
+
electronicAddress: NonPersistedElectronicAddress
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type UpdateElectronicAddressArgs = {
|
|
135
|
+
electronicAddress: ElectronicAddress
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type RemoveElectronicAddressArgs = {
|
|
139
|
+
electronicAddressId: string
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export type GetPhysicalAddressArgs = {
|
|
143
|
+
physicalAddressId: string
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type GetPhysicalAddressesArgs = {
|
|
147
|
+
filter?: FindPhysicalAddressArgs
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export type AddPhysicalAddressArgs = {
|
|
151
|
+
partyId: string
|
|
152
|
+
physicalAddress: NonPersistedPhysicalAddress
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type UpdatePhysicalAddressArgs = {
|
|
156
|
+
physicalAddress: PhysicalAddress
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type RemovePhysicalAddressArgs = {
|
|
160
|
+
physicalAddressId: string
|
|
161
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
2
|
+
import { IIdentifier } from '@veramo/core'
|
|
3
|
+
import { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'
|
|
4
|
+
import { CredentialRole } from '@sphereon/ssi-types'
|
|
5
|
+
|
|
6
|
+
export type MetadataTypes = string | number | Date | boolean | undefined
|
|
7
|
+
|
|
8
|
+
export interface IMetadataEntity {
|
|
9
|
+
// TODO move to types
|
|
10
|
+
label: string
|
|
11
|
+
stringValue?: string
|
|
12
|
+
numberValue?: number
|
|
13
|
+
dateValue?: Date
|
|
14
|
+
boolValue?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Party = {
|
|
18
|
+
id: string
|
|
19
|
+
uri?: string
|
|
20
|
+
roles: Array<CredentialRole>
|
|
21
|
+
ownerId?: string
|
|
22
|
+
tenantId?: string
|
|
23
|
+
identities: Array<Identity>
|
|
24
|
+
electronicAddresses: Array<ElectronicAddress>
|
|
25
|
+
physicalAddresses: Array<PhysicalAddress>
|
|
26
|
+
contact: Contact
|
|
27
|
+
partyType: PartyType
|
|
28
|
+
/**
|
|
29
|
+
* TODO: Integrate branding logic here in the future. What we should do is make the issuance branding plugin part of the contact-manager and retrieve any branding there is.
|
|
30
|
+
*
|
|
31
|
+
* Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:
|
|
32
|
+
* 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).
|
|
33
|
+
* 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.
|
|
34
|
+
* 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.
|
|
35
|
+
*
|
|
36
|
+
* For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.
|
|
37
|
+
*/
|
|
38
|
+
branding?: IIssuerLocaleBranding
|
|
39
|
+
relationships: Array<PartyRelationship>
|
|
40
|
+
createdAt: Date
|
|
41
|
+
lastUpdatedAt: Date
|
|
42
|
+
}
|
|
43
|
+
export type NonPersistedParty = Omit<
|
|
44
|
+
Party,
|
|
45
|
+
| 'id'
|
|
46
|
+
| 'identities'
|
|
47
|
+
| 'electronicAddresses'
|
|
48
|
+
| 'physicalAddresses'
|
|
49
|
+
| 'contact'
|
|
50
|
+
| 'roles'
|
|
51
|
+
| 'partyType'
|
|
52
|
+
| 'relationships'
|
|
53
|
+
| 'createdAt'
|
|
54
|
+
| 'lastUpdatedAt'
|
|
55
|
+
> & {
|
|
56
|
+
identities?: Array<NonPersistedIdentity>
|
|
57
|
+
electronicAddresses?: Array<NonPersistedElectronicAddress>
|
|
58
|
+
physicalAddresses?: Array<NonPersistedPhysicalAddress>
|
|
59
|
+
contact: NonPersistedContact
|
|
60
|
+
partyType: NonPersistedPartyType
|
|
61
|
+
relationships?: Array<NonPersistedPartyRelationship>
|
|
62
|
+
}
|
|
63
|
+
export type PartialParty = Partial<
|
|
64
|
+
Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>
|
|
65
|
+
> & {
|
|
66
|
+
identities?: PartialIdentity
|
|
67
|
+
electronicAddresses?: PartialElectronicAddress
|
|
68
|
+
physicalAddresses?: PartialPhysicalAddress
|
|
69
|
+
contact?: PartialContact
|
|
70
|
+
partyType?: PartialPartyType
|
|
71
|
+
relationships?: PartialPartyRelationship
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type Identity = {
|
|
75
|
+
id: string
|
|
76
|
+
alias: string
|
|
77
|
+
ownerId?: string
|
|
78
|
+
tenantId?: string
|
|
79
|
+
origin: IdentityOrigin
|
|
80
|
+
roles: Array<CredentialRole>
|
|
81
|
+
identifier: CorrelationIdentifier
|
|
82
|
+
connection?: Connection
|
|
83
|
+
metadata?: Array<MetadataItem<MetadataTypes>>
|
|
84
|
+
createdAt: Date
|
|
85
|
+
lastUpdatedAt: Date
|
|
86
|
+
}
|
|
87
|
+
export type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {
|
|
88
|
+
origin: IdentityOrigin
|
|
89
|
+
identifier: NonPersistedCorrelationIdentifier
|
|
90
|
+
connection?: NonPersistedConnection
|
|
91
|
+
metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>
|
|
92
|
+
}
|
|
93
|
+
export type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {
|
|
94
|
+
identifier?: PartialCorrelationIdentifier
|
|
95
|
+
connection?: PartialConnection
|
|
96
|
+
metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>
|
|
97
|
+
origin?: IdentityOrigin
|
|
98
|
+
roles?: CredentialRole
|
|
99
|
+
partyId?: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type MetadataItem<T extends MetadataTypes> = {
|
|
103
|
+
id: string
|
|
104
|
+
label: string
|
|
105
|
+
value: T
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>
|
|
109
|
+
export type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>
|
|
110
|
+
|
|
111
|
+
export type CorrelationIdentifier = {
|
|
112
|
+
id: string
|
|
113
|
+
ownerId?: string
|
|
114
|
+
tenantId?: string
|
|
115
|
+
type: CorrelationIdentifierType
|
|
116
|
+
correlationId: string
|
|
117
|
+
}
|
|
118
|
+
export type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>
|
|
119
|
+
export type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>
|
|
120
|
+
|
|
121
|
+
export type Connection = {
|
|
122
|
+
id: string
|
|
123
|
+
ownerId?: string
|
|
124
|
+
tenantId?: string
|
|
125
|
+
type: ConnectionType
|
|
126
|
+
config: ConnectionConfig
|
|
127
|
+
}
|
|
128
|
+
export type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {
|
|
129
|
+
config: NonPersistedConnectionConfig
|
|
130
|
+
}
|
|
131
|
+
export type PartialConnection = Partial<Omit<Connection, 'config'>> & {
|
|
132
|
+
config: PartialConnectionConfig
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type OpenIdConfig = {
|
|
136
|
+
id: string
|
|
137
|
+
clientId: string
|
|
138
|
+
clientSecret: string
|
|
139
|
+
ownerId?: string
|
|
140
|
+
tenantId?: string
|
|
141
|
+
scopes: Array<string>
|
|
142
|
+
issuer: string
|
|
143
|
+
redirectUrl: string
|
|
144
|
+
dangerouslyAllowInsecureHttpRequests: boolean
|
|
145
|
+
clientAuthMethod: 'basic' | 'post' | undefined
|
|
146
|
+
}
|
|
147
|
+
export type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>
|
|
148
|
+
export type PartialOpenIdConfig = Partial<OpenIdConfig>
|
|
149
|
+
|
|
150
|
+
export type DidAuthConfig = {
|
|
151
|
+
id: string
|
|
152
|
+
idOpts: ManagedIdentifierOptsOrResult
|
|
153
|
+
stateId: string
|
|
154
|
+
ownerId?: string
|
|
155
|
+
tenantId?: string
|
|
156
|
+
redirectUrl: string
|
|
157
|
+
sessionId: string
|
|
158
|
+
}
|
|
159
|
+
export type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>
|
|
160
|
+
export type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {
|
|
161
|
+
identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export type ConnectionConfig = OpenIdConfig | DidAuthConfig
|
|
165
|
+
export type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig
|
|
166
|
+
export type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig
|
|
167
|
+
|
|
168
|
+
export type NaturalPerson = {
|
|
169
|
+
id: string
|
|
170
|
+
firstName: string
|
|
171
|
+
lastName: string
|
|
172
|
+
middleName?: string
|
|
173
|
+
displayName: string
|
|
174
|
+
metadata?: Array<MetadataItem<MetadataTypes>>
|
|
175
|
+
ownerId?: string
|
|
176
|
+
tenantId?: string
|
|
177
|
+
createdAt: Date
|
|
178
|
+
lastUpdatedAt: Date
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>
|
|
182
|
+
|
|
183
|
+
export type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {
|
|
184
|
+
metadata?: PartialMetadataItem<MetadataTypes>
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export type Organization = {
|
|
188
|
+
id: string
|
|
189
|
+
legalName: string
|
|
190
|
+
displayName: string
|
|
191
|
+
metadata?: Array<MetadataItem<MetadataTypes>>
|
|
192
|
+
ownerId?: string
|
|
193
|
+
tenantId?: string
|
|
194
|
+
createdAt: Date
|
|
195
|
+
lastUpdatedAt: Date
|
|
196
|
+
}
|
|
197
|
+
export type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>
|
|
198
|
+
export type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {
|
|
199
|
+
metadata?: PartialMetadataItem<MetadataTypes>
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export type Contact = NaturalPerson | Organization
|
|
203
|
+
export type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization
|
|
204
|
+
export type PartialContact = PartialNaturalPerson | PartialOrganization
|
|
205
|
+
|
|
206
|
+
export type PartyType = {
|
|
207
|
+
id: string
|
|
208
|
+
type: PartyTypeType
|
|
209
|
+
origin: PartyOrigin
|
|
210
|
+
name: string
|
|
211
|
+
tenantId: string
|
|
212
|
+
description?: string
|
|
213
|
+
createdAt: Date
|
|
214
|
+
lastUpdatedAt: Date
|
|
215
|
+
}
|
|
216
|
+
export type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {
|
|
217
|
+
id?: string
|
|
218
|
+
}
|
|
219
|
+
export type PartialPartyType = Partial<PartyType>
|
|
220
|
+
|
|
221
|
+
export type PartyRelationship = {
|
|
222
|
+
id: string
|
|
223
|
+
leftId: string
|
|
224
|
+
rightId: string
|
|
225
|
+
ownerId?: string
|
|
226
|
+
tenantId?: string
|
|
227
|
+
createdAt: Date
|
|
228
|
+
lastUpdatedAt: Date
|
|
229
|
+
}
|
|
230
|
+
export type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>
|
|
231
|
+
export type PartialPartyRelationship = Partial<PartyRelationship>
|
|
232
|
+
|
|
233
|
+
export type ElectronicAddress = {
|
|
234
|
+
id: string
|
|
235
|
+
type: ElectronicAddressType
|
|
236
|
+
electronicAddress: string
|
|
237
|
+
ownerId?: string
|
|
238
|
+
tenantId?: string
|
|
239
|
+
createdAt: Date
|
|
240
|
+
lastUpdatedAt: Date
|
|
241
|
+
}
|
|
242
|
+
export type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
|
|
243
|
+
export type PartialElectronicAddress = Partial<ElectronicAddress> & {
|
|
244
|
+
partyId?: string
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export type PhysicalAddress = {
|
|
248
|
+
id: string
|
|
249
|
+
type: PhysicalAddressType
|
|
250
|
+
streetName: string
|
|
251
|
+
streetNumber: string
|
|
252
|
+
postalCode: string
|
|
253
|
+
cityName: string
|
|
254
|
+
provinceName: string
|
|
255
|
+
countryCode: string
|
|
256
|
+
buildingName?: string
|
|
257
|
+
ownerId?: string
|
|
258
|
+
tenantId?: string
|
|
259
|
+
createdAt: Date
|
|
260
|
+
lastUpdatedAt: Date
|
|
261
|
+
}
|
|
262
|
+
export type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
|
|
263
|
+
export type PartialPhysicalAddress = Partial<PhysicalAddress> & {
|
|
264
|
+
partyId?: string
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export type ElectronicAddressType = 'email' | 'phone'
|
|
268
|
+
|
|
269
|
+
export type PhysicalAddressType = 'home' | 'visit' | 'postal'
|
|
270
|
+
|
|
271
|
+
export enum ConnectionType {
|
|
272
|
+
OPENID_CONNECT = 'OIDC',
|
|
273
|
+
SIOPv2 = 'SIOPv2',
|
|
274
|
+
SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export enum CorrelationIdentifierType {
|
|
278
|
+
DID = 'did',
|
|
279
|
+
URL = 'url',
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export enum PartyTypeType {
|
|
283
|
+
NATURAL_PERSON = 'naturalPerson',
|
|
284
|
+
ORGANIZATION = 'organization',
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export enum PartyOrigin {
|
|
288
|
+
INTERNAL = 'INTERNAL',
|
|
289
|
+
EXTERNAL = 'EXTERNAL',
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export enum IdentityOrigin {
|
|
293
|
+
INTERNAL = 'INTERNAL',
|
|
294
|
+
EXTERNAL = 'EXTERNAL',
|
|
295
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CredentialRole, type HasherSync } from '@sphereon/ssi-types'
|
|
2
|
+
import type { CredentialCorrelationType, CredentialStateType, RegulationType } from './enums'
|
|
3
|
+
import type { DigitalCredential } from './types'
|
|
4
|
+
|
|
5
|
+
export type GetCredentialArgs = { id: string } | { hash: string }
|
|
6
|
+
|
|
7
|
+
export type FindDigitalCredentialArgs = Array<Partial<DigitalCredential>>
|
|
8
|
+
|
|
9
|
+
export type GetCredentialsArgs = {
|
|
10
|
+
filter?: FindDigitalCredentialArgs
|
|
11
|
+
offset?: number
|
|
12
|
+
limit?: number
|
|
13
|
+
order?: string //| FindOptionsOrder<DigitalCredentialEntity>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type GetCredentialsResponse = {
|
|
17
|
+
data: Array<DigitalCredential>
|
|
18
|
+
total: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type AddCredentialArgs = {
|
|
22
|
+
rawDocument: string
|
|
23
|
+
kmsKeyRef?: string
|
|
24
|
+
identifierMethod?: string
|
|
25
|
+
regulationType?: RegulationType
|
|
26
|
+
parentId?: string
|
|
27
|
+
issuerCorrelationType: CredentialCorrelationType
|
|
28
|
+
subjectCorrelationType?: CredentialCorrelationType
|
|
29
|
+
issuerCorrelationId: string
|
|
30
|
+
subjectCorrelationId?: string
|
|
31
|
+
credentialRole: CredentialRole
|
|
32
|
+
tenantId?: string
|
|
33
|
+
state?: CredentialStateType
|
|
34
|
+
verifiedAt?: Date
|
|
35
|
+
revokedAt?: Date
|
|
36
|
+
opts?: { maxTimeSkewInMS?: number; hasher?: HasherSync }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type UpdateCredentialStateArgs = GetCredentialArgs & { verifiedState: CredentialStateType; verifiedAt?: Date; revokedAt?: Date }
|
|
40
|
+
|
|
41
|
+
export type RemoveCredentialArgs = GetCredentialArgs
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export enum DocumentType {
|
|
2
|
+
VC = 'VC',
|
|
3
|
+
VP = 'VP',
|
|
4
|
+
P = 'P',
|
|
5
|
+
C = 'C',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum RegulationType {
|
|
9
|
+
PID = 'PID',
|
|
10
|
+
QEAA = 'QEAA',
|
|
11
|
+
EAA = 'EAA',
|
|
12
|
+
NON_REGULATED = 'NON_REGULATED',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum CredentialDocumentFormat {
|
|
16
|
+
JSON_LD = 'JSON_LD',
|
|
17
|
+
JWT = 'JWT',
|
|
18
|
+
SD_JWT = 'SD_JWT',
|
|
19
|
+
MSO_MDOC = 'MSO_MDOC',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export namespace CredentialDocumentFormat {
|
|
23
|
+
export function fromSpecValue(credentialFormat: string) {
|
|
24
|
+
const format = credentialFormat.toLowerCase()
|
|
25
|
+
if (format.includes('sd')) {
|
|
26
|
+
return CredentialDocumentFormat.SD_JWT
|
|
27
|
+
} else if (format.includes('ldp')) {
|
|
28
|
+
return CredentialDocumentFormat.JSON_LD
|
|
29
|
+
} else if (format.includes('mso') || credentialFormat.includes('mdoc')) {
|
|
30
|
+
return CredentialDocumentFormat.MSO_MDOC
|
|
31
|
+
} else if (format.includes('jwt_')) {
|
|
32
|
+
return CredentialDocumentFormat.JWT
|
|
33
|
+
} else {
|
|
34
|
+
throw Error(`Could not map format ${format} to known format`)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {
|
|
39
|
+
switch (documentFormat) {
|
|
40
|
+
case CredentialDocumentFormat.SD_JWT:
|
|
41
|
+
return 'dc+sd-jwt'
|
|
42
|
+
case CredentialDocumentFormat.MSO_MDOC:
|
|
43
|
+
return 'mso_mdoc'
|
|
44
|
+
case CredentialDocumentFormat.JSON_LD:
|
|
45
|
+
return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'
|
|
46
|
+
case CredentialDocumentFormat.JWT:
|
|
47
|
+
return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export enum CredentialCorrelationType {
|
|
53
|
+
DID = 'DID',
|
|
54
|
+
X509_SAN = 'X509_SAN',
|
|
55
|
+
KID = 'KID',
|
|
56
|
+
URL = 'URL',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export enum CredentialStateType {
|
|
60
|
+
REVOKED = 'REVOKED',
|
|
61
|
+
VERIFIED = 'VERIFIED',
|
|
62
|
+
EXPIRED = 'EXPIRED',
|
|
63
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CredentialCorrelationType, CredentialDocumentFormat, CredentialStateType, DocumentType, RegulationType } from './enums'
|
|
2
|
+
import { CredentialRole } from '@sphereon/ssi-types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DigitalCredential
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type DigitalCredential = {
|
|
10
|
+
id: string
|
|
11
|
+
parentId?: string
|
|
12
|
+
documentType: DocumentType
|
|
13
|
+
documentFormat: CredentialDocumentFormat
|
|
14
|
+
credentialRole: CredentialRole
|
|
15
|
+
regulationType: RegulationType
|
|
16
|
+
rawDocument: string
|
|
17
|
+
uniformDocument: string
|
|
18
|
+
credentialId?: string
|
|
19
|
+
hash: string
|
|
20
|
+
kmsKeyRef?: string
|
|
21
|
+
identifierMethod?: string
|
|
22
|
+
issuerCorrelationType: CredentialCorrelationType
|
|
23
|
+
subjectCorrelationType?: CredentialCorrelationType
|
|
24
|
+
rpCorrelationType?: CredentialCorrelationType
|
|
25
|
+
isIssuerSigned?: boolean
|
|
26
|
+
issuerCorrelationId: string
|
|
27
|
+
subjectCorrelationId?: string
|
|
28
|
+
rpCorrelationId?: string
|
|
29
|
+
verifiedState?: CredentialStateType
|
|
30
|
+
tenantId?: string
|
|
31
|
+
createdAt: Date
|
|
32
|
+
presentedAt?: Date
|
|
33
|
+
lastUpdatedAt: Date
|
|
34
|
+
validUntil?: Date
|
|
35
|
+
validFrom?: Date
|
|
36
|
+
verifiedAt?: Date
|
|
37
|
+
revokedAt?: Date
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & { regulationType?: RegulationType }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PartialActivityLoggingEvent, PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from './eventLogger'
|
|
3
|
+
|
|
4
|
+
export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
|
|
5
|
+
|
|
6
|
+
export type FindActivityLoggingEventArgs = Array<PartialActivityLoggingEvent>
|
|
7
|
+
|
|
8
|
+
export type StoreAuditEventArgs = {
|
|
9
|
+
event: NonPersistedAuditLoggingEvent
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type StoreActivityEventArgs = {
|
|
13
|
+
event: NonPersistedActivityLoggingEvent
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type GetAuditEventsArgs = {
|
|
17
|
+
filter?: FindAuditLoggingEventArgs
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type GetActivityEventsArgs = {
|
|
21
|
+
filter?: FindActivityLoggingEventArgs
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './issuanceBranding/issuanceBranding'
|
|
2
|
+
export * from './issuanceBranding/IAbstractIssuanceBrandingStore'
|
|
3
|
+
export * from './contact'
|
|
4
|
+
export * from './presentationDefinition/presentationDefinition'
|
|
5
|
+
export * from './presentationDefinition/IAbstractPDStore'
|
|
6
|
+
export * from './validation/validation'
|
|
7
|
+
export * from './eventLogger/IAbstractEventLoggerStore'
|
|
8
|
+
export * from './eventLogger/eventLogger'
|
|
9
|
+
export * from './machineState/IAbstractMachineStateStore'
|
|
10
|
+
export * from './digitalCredential'
|