@sphereon/ssi-sdk.credential-store 0.33.1-feature.vcdm2.tsup.31 → 0.33.1-next.2

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.
@@ -1,235 +1,286 @@
1
- import * as _sphereon_ssi_types from '@sphereon/ssi-types';
2
- import { HasherSync, OriginalVerifiableCredential, OriginalVerifiablePresentation, ICredential, IPresentation, IVerifiableCredential, IVerifiablePresentation } from '@sphereon/ssi-types';
3
- import { NonPersistedDigitalCredential, DigitalCredential, UpdateCredentialStateArgs, FindDigitalCredentialArgs, CredentialRole, AbstractDigitalCredentialStore } from '@sphereon/ssi-sdk.data-store';
4
- export { CredentialCorrelationType, CredentialDocumentFormat, CredentialRole, CredentialStateType, DigitalCredential, DocumentType, FindDigitalCredentialArgs, UpdateCredentialStateArgs } from '@sphereon/ssi-sdk.data-store';
5
- import { IPluginMethodMap, IAgentContext, IAgentPlugin } from '@veramo/core';
6
-
7
- type TClaimsColumns = 'context' | 'credentialType' | 'type' | 'value' | 'isObj' | 'id' | 'issuer' | 'subject' | 'expirationDate' | 'issuanceDate';
8
- /**
9
- * Represents the sort order of results from a {@link FindArgs} query.
10
- *
11
- * @beta This API may change without a BREAKING CHANGE notice.
12
- */
13
- interface Order<TColumns> {
14
- column: TColumns;
15
- direction: 'ASC' | 'DESC';
16
- }
17
- /**
18
- * Represents a WHERE predicate for a {@link FindArgs} query.
19
- * In situations where multiple WHERE predicates are present, they are combined with AND.
20
- *
21
- * @beta This API may change without a BREAKING CHANGE notice.
22
- */
23
- interface Where<TColumns> {
24
- column: TColumns;
25
- value?: string[];
26
- not?: boolean;
27
- op?: 'LessThan' | 'LessThanOrEqual' | 'MoreThan' | 'MoreThanOrEqual' | 'Equal' | 'Like' | 'Between' | 'In' | 'Any' | 'IsNull';
28
- }
29
- interface FindArgs<TColumns> {
30
- /**
31
- * Imposes constraints on the values of the given columns.
32
- * WHERE clauses are combined using AND.
33
- */
34
- where?: Where<TColumns>[];
35
- /**
36
- * Sorts the results according to the given array of column priorities.
37
- */
38
- order?: Order<TColumns>[];
39
- /**
40
- * Ignores the first number of entries in a {@link IDataStoreORM} query result.
41
- */
42
- skip?: number;
43
- /**
44
- * Returns at most this number of results from a {@link IDataStoreORM} query.
45
- */
46
- take?: number;
47
- }
48
- type FindClaimsArgs = FindArgs<TClaimsColumns>;
49
-
50
- interface ICredentialStore extends IPluginMethodMap {
51
- /**
52
- * Add a new credential.
53
- * @param args
54
- */
55
- crsAddCredential(args: AddCredentialArgs): Promise<DigitalCredential>;
56
- /**
57
- * Update credential the state of an existing credential.
58
- * @param args
59
- */
60
- crsUpdateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>;
61
- /**
62
- * Get a single credentials by primary key
63
- * @param args
64
- */
65
- crsGetCredential(args: GetCredentialArgs): Promise<DigitalCredential>;
66
- /**
67
- * Find one or more credentials using filters
68
- * @param args
69
- */
70
- crsGetCredentials(args: GetCredentialsArgs): Promise<Array<DigitalCredential>>;
71
- /**
72
- * Find one or more credentials using filters
73
- * @param args
74
- */
75
- crsGetUniqueCredentials(args: GetCredentialsArgs): Promise<Array<UniqueDigitalCredential>>;
76
- /**
77
- * Find one credential by id or hash
78
- * @param args
79
- */
80
- crsGetUniqueCredentialByIdOrHash(args: GetCredentialsByIdOrHashArgs): Promise<OptionalUniqueDigitalCredential>;
81
- /**
82
- * Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
83
- * @param args
84
- */
85
- crsGetCredentialsByClaims(args: GetCredentialsByClaimsArgs): Promise<Array<UniqueDigitalCredential>>;
86
- /**
87
- * Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
88
- * @param args
89
- */
90
- crsGetCredentialsByClaimsCount(args: GetCredentialsByClaimsArgs): Promise<number>;
91
- /**
92
- * Delete a single credentials by primary key
93
- * @param args
94
- */
95
- crsDeleteCredential(args: DeleteCredentialArgs): Promise<boolean>;
96
- /**
97
- * Delete multiple credentials records using filters
98
- * @param args
99
- */
100
- crsDeleteCredentials(args: DeleteCredentialsArgs): Promise<number>;
101
- }
102
- /**
103
- *
104
- * @param context
105
- * @internal
106
- */
107
- declare function contextHasCredentialStore(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ICredentialStore>;
108
- type GetCredentialArgs = {
109
- id: string;
110
- };
111
- type GetCredentialsArgs = {
112
- filter: FindDigitalCredentialArgs;
113
- };
114
- type GetCredentialsByClaimsArgs = {
115
- filter: FindClaimsArgs;
116
- credentialRole?: CredentialRole;
117
- tenantId?: string;
118
- };
119
- type GetCredentialsByIdOrHashArgs = {
120
- credentialRole: CredentialRole;
121
- idOrHash: string;
122
- };
123
- type DeleteCredentialArgs = {
124
- id: string;
125
- } | {
126
- hash: string;
127
- };
128
- type DeleteCredentialsArgs = GetCredentialsArgs;
129
- type AddDigitalCredential = Omit<NonPersistedDigitalCredential, 'id' | 'documentType' | 'documentFormat' | 'uniformDocument' | 'hash' | 'createdAt' | 'lastUpdatedAt' | 'validFrom' | 'validUntil'>;
130
- type AddCredentialArgs = {
131
- credential: AddDigitalCredential;
132
- opts?: {
133
- maxTimeSkewInMS?: number;
134
- hasher?: HasherSync;
135
- };
136
- };
137
- interface UniqueDigitalCredential {
138
- hash: string;
139
- id?: string;
140
- digitalCredential: DigitalCredential;
141
- originalVerifiableCredential?: OriginalVerifiableCredential;
142
- originalVerifiablePresentation?: OriginalVerifiablePresentation;
143
- originalCredential?: ICredential;
144
- originalPresentation?: IPresentation;
145
- uniformVerifiableCredential?: IVerifiableCredential;
146
- uniformVerifiablePresentation?: IVerifiablePresentation;
147
- }
148
- type OptionalUniqueDigitalCredential = UniqueDigitalCredential | undefined;
149
- type RequiredContext = IAgentContext<never>;
150
-
151
- declare const credentialStoreMethods: Array<string>;
152
- /**
153
- * {@inheritDoc ICRManager}
154
- */
155
- declare class CredentialStore implements IAgentPlugin {
156
- readonly schema: any;
157
- readonly methods: ICredentialStore;
158
- private readonly store;
159
- constructor(options: {
160
- store: AbstractDigitalCredentialStore;
161
- });
162
- /** {@inheritDoc ICredentialStore.crsAddCredential} */
163
- private crsAddCredential;
164
- /** {@inheritDoc ICredentialStore.crsUpdateCredentialState} */
165
- private crsUpdateCredentialState;
166
- /** {@inheritDoc ICredentialStore.crsGetCredential} */
167
- private crsGetCredential;
168
- /** {@inheritDoc ICredentialStore.crsGetCredentials} */
169
- private crsGetCredentials;
170
- /** {@inheritDoc ICredentialStore.crsGetUniqueCredentialByIdOrHash} */
171
- private crsGetUniqueCredentialByIdOrHash;
172
- /** {@inheritDoc ICredentialStore.crsGetUniqueCredentials} */
173
- private crsGetUniqueCredentials;
174
- /** {@inheritDoc ICredentialStore.crsDeleteCredential} */
175
- private crsDeleteCredential;
176
- /** {@inheritDoc ICredentialStore.crsDeleteCredentials} */
177
- private crsDeleteCredentials;
178
- /**
179
- * Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
180
- * @param args
181
- */
182
- private crsGetCredentialsByClaims;
183
- private getValueFromCredential;
184
- /**
185
- * Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
186
- * @param args
187
- */
188
- private crsGetCredentialsByClaimsCount;
189
- private secureParse;
190
- private toUniqueCredentials;
191
- }
192
-
193
- /**
194
- * Creates a filter to find a digital credential by its ID or hash.
195
- *
196
- * @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
197
- * @param idOrHash - The ID or hash of the credential to search for.
198
- * @returns A FindDigitalCredentialArgs array for filtering by ID or hash.
199
- */
200
- declare const credentialIdOrHashFilter: (credentialRole: CredentialRole, idOrHash: string) => FindDigitalCredentialArgs;
201
- /**
202
- * Creates a filter for verifiable credentials with a specific role.
203
- *
204
- * @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
205
- * @param withFilter - Optional additional filter criteria.
206
- * @returns A FindDigitalCredentialArgs array for filtering verifiable credentials by role.
207
- */
208
- declare const verifiableCredentialForRoleFilter: (credentialRole: CredentialRole, withFilter?: FindDigitalCredentialArgs) => FindDigitalCredentialArgs;
209
- /**
210
- * Merges two FindDigitalCredentialArgs arrays into a single array.
211
- *
212
- * This function combines two filter arrays, merging objects at the same index
213
- * and adding unique objects from both arrays. When merging objects, properties
214
- * from filter2 overwrite those from filter1 if they exist in both.
215
- *
216
- * @param filter1 - The first FindDigitalCredentialArgs array to merge.
217
- * @param filter2 - The second FindDigitalCredentialArgs array to merge.
218
- * @returns A new FindDigitalCredentialArgs array containing the merged result.
219
- *
220
- * @example
221
- * const filter1 = [{ documentType: DocumentType.VC }, { credentialRole: CredentialRole.ISSUER }];
222
- * const filter2 = [{ documentType: DocumentType.VP }, { hash: 'abc123' }];
223
- * const mergedFilter = mergeFilter(filter1, filter2);
224
- * // Result: [{ documentType: DocumentType.VP }, { credentialRole: CredentialRole.ISSUER, hash: 'abc123' }]
225
- */
226
- declare const mergeFilter: (filter1: FindDigitalCredentialArgs, filter2: FindDigitalCredentialArgs) => FindDigitalCredentialArgs;
227
-
228
- /**
229
- * @public
230
- */
231
- declare const schema: any;
232
-
233
- declare const logger: _sphereon_ssi_types.ISimpleLogger<unknown>;
234
-
235
- export { type AddCredentialArgs, type AddDigitalCredential, CredentialStore, type DeleteCredentialArgs, type DeleteCredentialsArgs, type FindArgs, type FindClaimsArgs, type GetCredentialArgs, type GetCredentialsArgs, type GetCredentialsByClaimsArgs, type GetCredentialsByIdOrHashArgs, type ICredentialStore, type OptionalUniqueDigitalCredential, type Order, type RequiredContext, type TClaimsColumns, type UniqueDigitalCredential, type Where, contextHasCredentialStore, credentialIdOrHashFilter, credentialStoreMethods, logger, mergeFilter, schema, verifiableCredentialForRoleFilter };
1
+ import { AbstractDigitalCredentialStore } from '@sphereon/ssi-sdk.data-store';
2
+ import { CredentialCorrelationType } from '@sphereon/ssi-sdk.data-store';
3
+ import { CredentialDocumentFormat } from '@sphereon/ssi-sdk.data-store';
4
+ import { CredentialRole } from '@sphereon/ssi-sdk.data-store';
5
+ import { CredentialStateType } from '@sphereon/ssi-sdk.data-store';
6
+ import { DigitalCredential } from '@sphereon/ssi-sdk.data-store';
7
+ import { DocumentType as DocumentType_2 } from '@sphereon/ssi-sdk.data-store';
8
+ import { FindDigitalCredentialArgs } from '@sphereon/ssi-sdk.data-store';
9
+ import { HasherSync } from '@sphereon/ssi-types';
10
+ import { IAgentContext } from '@veramo/core';
11
+ import { IAgentPlugin } from '@veramo/core';
12
+ import { ICredential } from '@sphereon/ssi-types';
13
+ import { IPluginMethodMap } from '@veramo/core';
14
+ import { IPresentation } from '@sphereon/ssi-types';
15
+ import { ISimpleLogger } from '@sphereon/ssi-types';
16
+ import { IVerifiableCredential } from '@sphereon/ssi-types';
17
+ import { IVerifiablePresentation } from '@sphereon/ssi-types';
18
+ import { NonPersistedDigitalCredential } from '@sphereon/ssi-sdk.data-store';
19
+ import { OriginalVerifiableCredential } from '@sphereon/ssi-types';
20
+ import { OriginalVerifiablePresentation } from '@sphereon/ssi-types';
21
+ import { UpdateCredentialStateArgs } from '@sphereon/ssi-sdk.data-store';
22
+
23
+ export declare type AddCredentialArgs = {
24
+ credential: AddDigitalCredential;
25
+ opts?: {
26
+ maxTimeSkewInMS?: number;
27
+ hasher?: HasherSync;
28
+ };
29
+ };
30
+
31
+ export declare type AddDigitalCredential = Omit<NonPersistedDigitalCredential, 'id' | 'documentType' | 'documentFormat' | 'uniformDocument' | 'hash' | 'createdAt' | 'lastUpdatedAt' | 'validFrom' | 'validUntil'>;
32
+
33
+ /**
34
+ *
35
+ * @param context
36
+ * @internal
37
+ */
38
+ export declare function contextHasCredentialStore(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ICredentialStore>;
39
+
40
+ export { CredentialCorrelationType }
41
+
42
+ export { CredentialDocumentFormat }
43
+
44
+ /**
45
+ * Creates a filter to find a digital credential by its ID or hash.
46
+ *
47
+ * @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
48
+ * @param idOrHash - The ID or hash of the credential to search for.
49
+ * @returns A FindDigitalCredentialArgs array for filtering by ID or hash.
50
+ */
51
+ export declare const credentialIdOrHashFilter: (credentialRole: CredentialRole, idOrHash: string) => FindDigitalCredentialArgs;
52
+
53
+ export { CredentialRole }
54
+
55
+ export { CredentialStateType }
56
+
57
+ /**
58
+ * {@inheritDoc ICRManager}
59
+ */
60
+ export declare class CredentialStore implements IAgentPlugin {
61
+ readonly schema: any;
62
+ readonly methods: ICredentialStore;
63
+ private readonly store;
64
+ constructor(options: {
65
+ store: AbstractDigitalCredentialStore;
66
+ });
67
+ /** {@inheritDoc ICredentialStore.crsAddCredential} */
68
+ private crsAddCredential;
69
+ /** {@inheritDoc ICredentialStore.crsUpdateCredentialState} */
70
+ private crsUpdateCredentialState;
71
+ /** {@inheritDoc ICredentialStore.crsGetCredential} */
72
+ private crsGetCredential;
73
+ /** {@inheritDoc ICredentialStore.crsGetCredentials} */
74
+ private crsGetCredentials;
75
+ /** {@inheritDoc ICredentialStore.crsGetUniqueCredentialByIdOrHash} */
76
+ private crsGetUniqueCredentialByIdOrHash;
77
+ /** {@inheritDoc ICredentialStore.crsGetUniqueCredentials} */
78
+ private crsGetUniqueCredentials;
79
+ /** {@inheritDoc ICredentialStore.crsDeleteCredential} */
80
+ private crsDeleteCredential;
81
+ /** {@inheritDoc ICredentialStore.crsDeleteCredentials} */
82
+ private crsDeleteCredentials;
83
+ /**
84
+ * Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
85
+ * @param args
86
+ */
87
+ private crsGetCredentialsByClaims;
88
+ private getValueFromCredential;
89
+ /**
90
+ * Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
91
+ * @param args
92
+ */
93
+ private crsGetCredentialsByClaimsCount;
94
+ private secureParse;
95
+ private toUniqueCredentials;
96
+ }
97
+
98
+ export declare const credentialStoreMethods: Array<string>;
99
+
100
+ export declare type DeleteCredentialArgs = {
101
+ id: string;
102
+ } | {
103
+ hash: string;
104
+ };
105
+
106
+ export declare type DeleteCredentialsArgs = GetCredentialsArgs;
107
+
108
+ export { DigitalCredential }
109
+
110
+ export { DocumentType_2 as DocumentType }
111
+
112
+ export declare interface FindArgs<TColumns> {
113
+ /**
114
+ * Imposes constraints on the values of the given columns.
115
+ * WHERE clauses are combined using AND.
116
+ */
117
+ where?: Where<TColumns>[];
118
+ /**
119
+ * Sorts the results according to the given array of column priorities.
120
+ */
121
+ order?: Order<TColumns>[];
122
+ /**
123
+ * Ignores the first number of entries in a {@link IDataStoreORM} query result.
124
+ */
125
+ skip?: number;
126
+ /**
127
+ * Returns at most this number of results from a {@link IDataStoreORM} query.
128
+ */
129
+ take?: number;
130
+ }
131
+
132
+ export declare type FindClaimsArgs = FindArgs<TClaimsColumns>;
133
+
134
+ export { FindDigitalCredentialArgs }
135
+
136
+ export declare type GetCredentialArgs = {
137
+ id: string;
138
+ };
139
+
140
+ export declare type GetCredentialsArgs = {
141
+ filter: FindDigitalCredentialArgs;
142
+ };
143
+
144
+ export declare type GetCredentialsByClaimsArgs = {
145
+ filter: FindClaimsArgs;
146
+ credentialRole?: CredentialRole;
147
+ tenantId?: string;
148
+ };
149
+
150
+ export declare type GetCredentialsByIdOrHashArgs = {
151
+ credentialRole: CredentialRole;
152
+ idOrHash: string;
153
+ };
154
+
155
+ export declare interface ICredentialStore extends IPluginMethodMap {
156
+ /**
157
+ * Add a new credential.
158
+ * @param args
159
+ */
160
+ crsAddCredential(args: AddCredentialArgs): Promise<DigitalCredential>;
161
+ /**
162
+ * Update credential the state of an existing credential.
163
+ * @param args
164
+ */
165
+ crsUpdateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>;
166
+ /**
167
+ * Get a single credentials by primary key
168
+ * @param args
169
+ */
170
+ crsGetCredential(args: GetCredentialArgs): Promise<DigitalCredential>;
171
+ /**
172
+ * Find one or more credentials using filters
173
+ * @param args
174
+ */
175
+ crsGetCredentials(args: GetCredentialsArgs): Promise<Array<DigitalCredential>>;
176
+ /**
177
+ * Find one or more credentials using filters
178
+ * @param args
179
+ */
180
+ crsGetUniqueCredentials(args: GetCredentialsArgs): Promise<Array<UniqueDigitalCredential>>;
181
+ /**
182
+ * Find one credential by id or hash
183
+ * @param args
184
+ */
185
+ crsGetUniqueCredentialByIdOrHash(args: GetCredentialsByIdOrHashArgs): Promise<OptionalUniqueDigitalCredential>;
186
+ /**
187
+ * Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
188
+ * @param args
189
+ */
190
+ crsGetCredentialsByClaims(args: GetCredentialsByClaimsArgs): Promise<Array<UniqueDigitalCredential>>;
191
+ /**
192
+ * Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
193
+ * @param args
194
+ */
195
+ crsGetCredentialsByClaimsCount(args: GetCredentialsByClaimsArgs): Promise<number>;
196
+ /**
197
+ * Delete a single credentials by primary key
198
+ * @param args
199
+ */
200
+ crsDeleteCredential(args: DeleteCredentialArgs): Promise<boolean>;
201
+ /**
202
+ * Delete multiple credentials records using filters
203
+ * @param args
204
+ */
205
+ crsDeleteCredentials(args: DeleteCredentialsArgs): Promise<number>;
206
+ }
207
+
208
+ export declare const logger: ISimpleLogger<unknown>;
209
+
210
+ /**
211
+ * Merges two FindDigitalCredentialArgs arrays into a single array.
212
+ *
213
+ * This function combines two filter arrays, merging objects at the same index
214
+ * and adding unique objects from both arrays. When merging objects, properties
215
+ * from filter2 overwrite those from filter1 if they exist in both.
216
+ *
217
+ * @param filter1 - The first FindDigitalCredentialArgs array to merge.
218
+ * @param filter2 - The second FindDigitalCredentialArgs array to merge.
219
+ * @returns A new FindDigitalCredentialArgs array containing the merged result.
220
+ *
221
+ * @example
222
+ * const filter1 = [{ documentType: DocumentType.VC }, { credentialRole: CredentialRole.ISSUER }];
223
+ * const filter2 = [{ documentType: DocumentType.VP }, { hash: 'abc123' }];
224
+ * const mergedFilter = mergeFilter(filter1, filter2);
225
+ * // Result: [{ documentType: DocumentType.VP }, { credentialRole: CredentialRole.ISSUER, hash: 'abc123' }]
226
+ */
227
+ export declare const mergeFilter: (filter1: FindDigitalCredentialArgs, filter2: FindDigitalCredentialArgs) => FindDigitalCredentialArgs;
228
+
229
+ export declare type OptionalUniqueDigitalCredential = UniqueDigitalCredential | undefined;
230
+
231
+ /**
232
+ * Represents the sort order of results from a {@link FindArgs} query.
233
+ *
234
+ * @beta This API may change without a BREAKING CHANGE notice.
235
+ */
236
+ export declare interface Order<TColumns> {
237
+ column: TColumns;
238
+ direction: 'ASC' | 'DESC';
239
+ }
240
+
241
+ export declare type RequiredContext = IAgentContext<never>;
242
+
243
+ /**
244
+ * @public
245
+ */
246
+ export declare const schema: any;
247
+
248
+ export declare type TClaimsColumns = 'context' | 'credentialType' | 'type' | 'value' | 'isObj' | 'id' | 'issuer' | 'subject' | 'expirationDate' | 'issuanceDate';
249
+
250
+ export declare interface UniqueDigitalCredential {
251
+ hash: string;
252
+ id?: string;
253
+ digitalCredential: DigitalCredential;
254
+ originalVerifiableCredential?: OriginalVerifiableCredential;
255
+ originalVerifiablePresentation?: OriginalVerifiablePresentation;
256
+ originalCredential?: ICredential;
257
+ originalPresentation?: IPresentation;
258
+ uniformVerifiableCredential?: IVerifiableCredential;
259
+ uniformVerifiablePresentation?: IVerifiablePresentation;
260
+ }
261
+
262
+ export { UpdateCredentialStateArgs }
263
+
264
+ /**
265
+ * Creates a filter for verifiable credentials with a specific role.
266
+ *
267
+ * @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
268
+ * @param withFilter - Optional additional filter criteria.
269
+ * @returns A FindDigitalCredentialArgs array for filtering verifiable credentials by role.
270
+ */
271
+ export declare const verifiableCredentialForRoleFilter: (credentialRole: CredentialRole, withFilter?: FindDigitalCredentialArgs) => FindDigitalCredentialArgs;
272
+
273
+ /**
274
+ * Represents a WHERE predicate for a {@link FindArgs} query.
275
+ * In situations where multiple WHERE predicates are present, they are combined with AND.
276
+ *
277
+ * @beta This API may change without a BREAKING CHANGE notice.
278
+ */
279
+ export declare interface Where<TColumns> {
280
+ column: TColumns;
281
+ value?: string[];
282
+ not?: boolean;
283
+ op?: 'LessThan' | 'LessThanOrEqual' | 'MoreThan' | 'MoreThanOrEqual' | 'Equal' | 'Like' | 'Between' | 'In' | 'Any' | 'IsNull';
284
+ }
285
+
286
+ export { }
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.52.1"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,106 @@
1
+ import { CredentialRole, DigitalCredential, FindDigitalCredentialArgs, NonPersistedDigitalCredential, UpdateCredentialStateArgs } from '@sphereon/ssi-sdk.data-store';
2
+ import { HasherSync, ICredential, IPresentation, IVerifiableCredential, IVerifiablePresentation, OriginalVerifiableCredential, OriginalVerifiablePresentation } from '@sphereon/ssi-types';
3
+ import { IAgentContext, IPluginMethodMap } from '@veramo/core';
4
+ import { FindClaimsArgs } from './claims';
5
+ export type { UpdateCredentialStateArgs };
6
+ export interface ICredentialStore extends IPluginMethodMap {
7
+ /**
8
+ * Add a new credential.
9
+ * @param args
10
+ */
11
+ crsAddCredential(args: AddCredentialArgs): Promise<DigitalCredential>;
12
+ /**
13
+ * Update credential the state of an existing credential.
14
+ * @param args
15
+ */
16
+ crsUpdateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>;
17
+ /**
18
+ * Get a single credentials by primary key
19
+ * @param args
20
+ */
21
+ crsGetCredential(args: GetCredentialArgs): Promise<DigitalCredential>;
22
+ /**
23
+ * Find one or more credentials using filters
24
+ * @param args
25
+ */
26
+ crsGetCredentials(args: GetCredentialsArgs): Promise<Array<DigitalCredential>>;
27
+ /**
28
+ * Find one or more credentials using filters
29
+ * @param args
30
+ */
31
+ crsGetUniqueCredentials(args: GetCredentialsArgs): Promise<Array<UniqueDigitalCredential>>;
32
+ /**
33
+ * Find one credential by id or hash
34
+ * @param args
35
+ */
36
+ crsGetUniqueCredentialByIdOrHash(args: GetCredentialsByIdOrHashArgs): Promise<OptionalUniqueDigitalCredential>;
37
+ /**
38
+ * Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
39
+ * @param args
40
+ */
41
+ crsGetCredentialsByClaims(args: GetCredentialsByClaimsArgs): Promise<Array<UniqueDigitalCredential>>;
42
+ /**
43
+ * Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
44
+ * @param args
45
+ */
46
+ crsGetCredentialsByClaimsCount(args: GetCredentialsByClaimsArgs): Promise<number>;
47
+ /**
48
+ * Delete a single credentials by primary key
49
+ * @param args
50
+ */
51
+ crsDeleteCredential(args: DeleteCredentialArgs): Promise<boolean>;
52
+ /**
53
+ * Delete multiple credentials records using filters
54
+ * @param args
55
+ */
56
+ crsDeleteCredentials(args: DeleteCredentialsArgs): Promise<number>;
57
+ }
58
+ /**
59
+ *
60
+ * @param context
61
+ * @internal
62
+ */
63
+ export declare function contextHasCredentialStore(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ICredentialStore>;
64
+ export type GetCredentialArgs = {
65
+ id: string;
66
+ };
67
+ export type GetCredentialsArgs = {
68
+ filter: FindDigitalCredentialArgs;
69
+ };
70
+ export type GetCredentialsByClaimsArgs = {
71
+ filter: FindClaimsArgs;
72
+ credentialRole?: CredentialRole;
73
+ tenantId?: string;
74
+ };
75
+ export type GetCredentialsByIdOrHashArgs = {
76
+ credentialRole: CredentialRole;
77
+ idOrHash: string;
78
+ };
79
+ export type DeleteCredentialArgs = {
80
+ id: string;
81
+ } | {
82
+ hash: string;
83
+ };
84
+ export type DeleteCredentialsArgs = GetCredentialsArgs;
85
+ export type AddDigitalCredential = Omit<NonPersistedDigitalCredential, 'id' | 'documentType' | 'documentFormat' | 'uniformDocument' | 'hash' | 'createdAt' | 'lastUpdatedAt' | 'validFrom' | 'validUntil'>;
86
+ export type AddCredentialArgs = {
87
+ credential: AddDigitalCredential;
88
+ opts?: {
89
+ maxTimeSkewInMS?: number;
90
+ hasher?: HasherSync;
91
+ };
92
+ };
93
+ export interface UniqueDigitalCredential {
94
+ hash: string;
95
+ id?: string;
96
+ digitalCredential: DigitalCredential;
97
+ originalVerifiableCredential?: OriginalVerifiableCredential;
98
+ originalVerifiablePresentation?: OriginalVerifiablePresentation;
99
+ originalCredential?: ICredential;
100
+ originalPresentation?: IPresentation;
101
+ uniformVerifiableCredential?: IVerifiableCredential;
102
+ uniformVerifiablePresentation?: IVerifiablePresentation;
103
+ }
104
+ export type OptionalUniqueDigitalCredential = UniqueDigitalCredential | undefined;
105
+ export type RequiredContext = IAgentContext<never>;
106
+ //# sourceMappingURL=ICredentialStore.d.ts.map