@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.
- package/dist/agent/CredentialStore.d.ts +45 -0
- package/dist/agent/CredentialStore.d.ts.map +1 -0
- package/dist/agent/CredentialStore.js +253 -0
- package/dist/agent/CredentialStore.js.map +1 -0
- package/dist/index.d.ts +8 -231
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -2209
- package/dist/index.js.map +1 -1
- package/dist/{index.d.cts → ssi-sdk.credential-store.d.ts} +286 -235
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/ICredentialStore.d.ts +106 -0
- package/dist/types/ICredentialStore.d.ts.map +1 -0
- package/dist/types/ICredentialStore.js +13 -0
- package/dist/types/ICredentialStore.js.map +1 -0
- package/dist/types/claims.d.ts +43 -0
- package/dist/types/claims.d.ts.map +1 -0
- package/dist/types/claims.js +3 -0
- package/dist/types/claims.js.map +1 -0
- package/dist/utils/filters.d.ts +36 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +90 -0
- package/dist/utils/filters.js.map +1 -0
- package/package.json +14 -24
- package/dist/index.cjs +0 -2230
- package/dist/index.cjs.map +0 -1
|
@@ -1,235 +1,286 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
declare
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
declare const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* @param
|
|
218
|
-
* @
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* const
|
|
223
|
-
* const
|
|
224
|
-
*
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|