@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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AbstractDigitalCredentialStore } from '@sphereon/ssi-sdk.data-store';
|
|
2
|
+
import { IAgentPlugin } from '@veramo/core';
|
|
3
|
+
import { ICredentialStore } from '../types/ICredentialStore';
|
|
4
|
+
export declare const credentialStoreMethods: Array<string>;
|
|
5
|
+
/**
|
|
6
|
+
* {@inheritDoc ICRManager}
|
|
7
|
+
*/
|
|
8
|
+
export declare class CredentialStore implements IAgentPlugin {
|
|
9
|
+
readonly schema: any;
|
|
10
|
+
readonly methods: ICredentialStore;
|
|
11
|
+
private readonly store;
|
|
12
|
+
constructor(options: {
|
|
13
|
+
store: AbstractDigitalCredentialStore;
|
|
14
|
+
});
|
|
15
|
+
/** {@inheritDoc ICredentialStore.crsAddCredential} */
|
|
16
|
+
private crsAddCredential;
|
|
17
|
+
/** {@inheritDoc ICredentialStore.crsUpdateCredentialState} */
|
|
18
|
+
private crsUpdateCredentialState;
|
|
19
|
+
/** {@inheritDoc ICredentialStore.crsGetCredential} */
|
|
20
|
+
private crsGetCredential;
|
|
21
|
+
/** {@inheritDoc ICredentialStore.crsGetCredentials} */
|
|
22
|
+
private crsGetCredentials;
|
|
23
|
+
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentialByIdOrHash} */
|
|
24
|
+
private crsGetUniqueCredentialByIdOrHash;
|
|
25
|
+
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentials} */
|
|
26
|
+
private crsGetUniqueCredentials;
|
|
27
|
+
/** {@inheritDoc ICredentialStore.crsDeleteCredential} */
|
|
28
|
+
private crsDeleteCredential;
|
|
29
|
+
/** {@inheritDoc ICredentialStore.crsDeleteCredentials} */
|
|
30
|
+
private crsDeleteCredentials;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
33
|
+
* @param args
|
|
34
|
+
*/
|
|
35
|
+
private crsGetCredentialsByClaims;
|
|
36
|
+
private getValueFromCredential;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
39
|
+
* @param args
|
|
40
|
+
*/
|
|
41
|
+
private crsGetCredentialsByClaimsCount;
|
|
42
|
+
private secureParse;
|
|
43
|
+
private toUniqueCredentials;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=CredentialStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialStore.d.ts","sourceRoot":"","sources":["../../src/agent/CredentialStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAK/B,MAAM,8BAA8B,CAAA;AAGrC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,EAQL,gBAAgB,EAGjB,MAAM,2BAA2B,CAAA;AAIlC,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,MAAM,CAWhD,CAAA;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,YAAY;IAClD,QAAQ,CAAC,MAAM,MAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAWjC;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;gBAE1C,OAAO,EAAE;QAAE,KAAK,EAAE,8BAA8B,CAAA;KAAE;IAI9D,sDAAsD;YACxC,gBAAgB;IAI9B,8DAA8D;YAChD,wBAAwB;IAItC,sDAAsD;YACxC,gBAAgB;IAM9B,uDAAuD;YACzC,iBAAiB;IAO/B,sEAAsE;YACxD,gCAAgC;IAW9C,6DAA6D;YAC/C,uBAAuB;IAMrC,yDAAyD;YAC3C,mBAAmB;IAIjC,0DAA0D;YAC5C,oBAAoB;IAalC;;;OAGG;YACW,yBAAyB;IA4DvC,OAAO,CAAC,sBAAsB;IA2B9B;;;OAGG;YACW,8BAA8B;IAK5C,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,mBAAmB;CAoC5B"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CredentialStore = exports.credentialStoreMethods = void 0;
|
|
13
|
+
const ssi_sdk_data_store_1 = require("@sphereon/ssi-sdk.data-store");
|
|
14
|
+
const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
|
|
15
|
+
const index_1 = require("../index");
|
|
16
|
+
const filters_1 = require("../utils/filters");
|
|
17
|
+
// Exposing the methods here for any REST implementation
|
|
18
|
+
exports.credentialStoreMethods = [
|
|
19
|
+
'crsAddCredential',
|
|
20
|
+
'crsUpdateCredentialState',
|
|
21
|
+
'crsGetCredential',
|
|
22
|
+
'crsGetCredentials',
|
|
23
|
+
'crsDeleteCredential',
|
|
24
|
+
'crsDeleteCredentials',
|
|
25
|
+
'crsGetUniqueCredentials',
|
|
26
|
+
'crsGetUniqueCredentialByIdOrHash',
|
|
27
|
+
'crsGetCredentialsByClaims',
|
|
28
|
+
'crsGetCredentialsByClaimsCount',
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritDoc ICRManager}
|
|
32
|
+
*/
|
|
33
|
+
class CredentialStore {
|
|
34
|
+
constructor(options) {
|
|
35
|
+
this.schema = index_1.schema.ICredentialStore;
|
|
36
|
+
this.methods = {
|
|
37
|
+
crsAddCredential: this.crsAddCredential.bind(this),
|
|
38
|
+
crsUpdateCredentialState: this.crsUpdateCredentialState.bind(this),
|
|
39
|
+
crsGetCredential: this.crsGetCredential.bind(this),
|
|
40
|
+
crsGetCredentials: this.crsGetCredentials.bind(this),
|
|
41
|
+
crsGetUniqueCredentialByIdOrHash: this.crsGetUniqueCredentialByIdOrHash.bind(this),
|
|
42
|
+
crsGetUniqueCredentials: this.crsGetUniqueCredentials.bind(this),
|
|
43
|
+
crsDeleteCredential: this.crsDeleteCredential.bind(this),
|
|
44
|
+
crsDeleteCredentials: this.crsDeleteCredentials.bind(this),
|
|
45
|
+
crsGetCredentialsByClaims: this.crsGetCredentialsByClaims.bind(this),
|
|
46
|
+
crsGetCredentialsByClaimsCount: this.crsGetCredentialsByClaimsCount.bind(this),
|
|
47
|
+
};
|
|
48
|
+
this.store = options.store;
|
|
49
|
+
}
|
|
50
|
+
/** {@inheritDoc ICredentialStore.crsAddCredential} */
|
|
51
|
+
crsAddCredential(args) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return yield this.store.addCredential(Object.assign(Object.assign({}, args.credential), { opts: Object.assign(Object.assign({}, args.opts), { hasher: (_b = (_a = args.opts) === null || _a === void 0 ? void 0 : _a.hasher) !== null && _b !== void 0 ? _b : ssi_sdk_core_1.shaHasher }) }));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** {@inheritDoc ICredentialStore.crsUpdateCredentialState} */
|
|
58
|
+
crsUpdateCredentialState(args) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
return yield this.store.updateCredentialState(args);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** {@inheritDoc ICredentialStore.crsGetCredential} */
|
|
64
|
+
crsGetCredential(args) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const { id } = args;
|
|
67
|
+
return this.store.getCredential({ id });
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** {@inheritDoc ICredentialStore.crsGetCredentials} */
|
|
71
|
+
crsGetCredentials(args) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const { filter } = args;
|
|
74
|
+
const credentials = yield this.store.getCredentials({ filter });
|
|
75
|
+
return credentials.data;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentialByIdOrHash} */
|
|
79
|
+
crsGetUniqueCredentialByIdOrHash(args) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const credentials = yield this.crsGetCredentials({ filter: (0, filters_1.credentialIdOrHashFilter)(args.credentialRole, args.idOrHash) });
|
|
82
|
+
if (credentials.length === 0) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
else if (credentials.length > 1) {
|
|
86
|
+
index_1.logger.warning('Duplicate credentials detected in crsGetUniqueCredentialByIdOrHash', args);
|
|
87
|
+
}
|
|
88
|
+
return this.toUniqueCredentials(credentials)[0];
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** {@inheritDoc ICredentialStore.crsGetUniqueCredentials} */
|
|
92
|
+
crsGetUniqueCredentials(args) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const credentials = yield this.crsGetCredentials(args);
|
|
95
|
+
return this.toUniqueCredentials(credentials);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** {@inheritDoc ICredentialStore.crsDeleteCredential} */
|
|
99
|
+
crsDeleteCredential(args) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
return this.store.removeCredential(args);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/** {@inheritDoc ICredentialStore.crsDeleteCredentials} */
|
|
105
|
+
crsDeleteCredentials(args) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const credentials = yield this.crsGetCredentials(args);
|
|
108
|
+
let count = 0;
|
|
109
|
+
for (const credential of credentials) {
|
|
110
|
+
const result = yield this.store.removeCredential({ id: credential.id });
|
|
111
|
+
if (result) {
|
|
112
|
+
count++;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return count;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Returns a list of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
120
|
+
* @param args
|
|
121
|
+
*/
|
|
122
|
+
crsGetCredentialsByClaims(args) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const digitalCredentials = yield this.crsGetUniqueCredentials({
|
|
125
|
+
filter: [
|
|
126
|
+
// TODO SDK-25 Implement param for documentType & support VP filtering below
|
|
127
|
+
{
|
|
128
|
+
documentType: ssi_sdk_data_store_1.DocumentType.VC,
|
|
129
|
+
credentialRole: args.credentialRole,
|
|
130
|
+
tenantId: args.tenantId,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
documentType: ssi_sdk_data_store_1.DocumentType.C,
|
|
134
|
+
credentialRole: args.credentialRole,
|
|
135
|
+
tenantId: args.tenantId,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
});
|
|
139
|
+
// This a copy of how Veramo did this. TODO Use GraphQL in the future?
|
|
140
|
+
return digitalCredentials.filter((uniqueVC) => {
|
|
141
|
+
var _a, _b;
|
|
142
|
+
if (!uniqueVC.uniformVerifiableCredential) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
const credential = uniqueVC.uniformVerifiableCredential;
|
|
146
|
+
return ((_b = (_a = args.filter.where) === null || _a === void 0 ? void 0 : _a.every((whereClause) => {
|
|
147
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
148
|
+
const value = this.getValueFromCredential(credential, whereClause.column);
|
|
149
|
+
if (value === undefined) {
|
|
150
|
+
return whereClause.op === 'IsNull';
|
|
151
|
+
}
|
|
152
|
+
switch (whereClause.op) {
|
|
153
|
+
case 'In':
|
|
154
|
+
return (_a = whereClause.value) === null || _a === void 0 ? void 0 : _a.includes(value);
|
|
155
|
+
case 'Like':
|
|
156
|
+
return typeof value === 'string' && value.includes(((_b = whereClause.value) === null || _b === void 0 ? void 0 : _b[0]) || '');
|
|
157
|
+
case 'Between':
|
|
158
|
+
return value >= (((_c = whereClause.value) === null || _c === void 0 ? void 0 : _c[0]) || '') && value <= (((_d = whereClause.value) === null || _d === void 0 ? void 0 : _d[1]) || '');
|
|
159
|
+
case 'LessThan':
|
|
160
|
+
return value < (((_e = whereClause.value) === null || _e === void 0 ? void 0 : _e[0]) || '');
|
|
161
|
+
case 'LessThanOrEqual':
|
|
162
|
+
return value <= (((_f = whereClause.value) === null || _f === void 0 ? void 0 : _f[0]) || '');
|
|
163
|
+
case 'MoreThan':
|
|
164
|
+
return value > (((_g = whereClause.value) === null || _g === void 0 ? void 0 : _g[0]) || '');
|
|
165
|
+
case 'MoreThanOrEqual':
|
|
166
|
+
return value >= (((_h = whereClause.value) === null || _h === void 0 ? void 0 : _h[0]) || '');
|
|
167
|
+
case 'Any':
|
|
168
|
+
return Array.isArray(value) && value.some((v) => { var _a; return (_a = whereClause.value) === null || _a === void 0 ? void 0 : _a.includes(v); });
|
|
169
|
+
case 'IsNull':
|
|
170
|
+
return value === null || value === undefined;
|
|
171
|
+
case 'Equal':
|
|
172
|
+
default:
|
|
173
|
+
return value === ((_j = whereClause.value) === null || _j === void 0 ? void 0 : _j[0]);
|
|
174
|
+
}
|
|
175
|
+
})) !== null && _b !== void 0 ? _b : true);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
getValueFromCredential(credential, column) {
|
|
180
|
+
var _a, _b, _c, _d;
|
|
181
|
+
switch (column) {
|
|
182
|
+
case 'context':
|
|
183
|
+
return credential['@context'];
|
|
184
|
+
case 'credentialType':
|
|
185
|
+
return credential.type;
|
|
186
|
+
case 'type':
|
|
187
|
+
return Array.isArray(credential.credentialSubject) ? (_a = credential.credentialSubject[0]) === null || _a === void 0 ? void 0 : _a.type : (_b = credential.credentialSubject) === null || _b === void 0 ? void 0 : _b.type;
|
|
188
|
+
case 'value':
|
|
189
|
+
return JSON.stringify(credential.credentialSubject);
|
|
190
|
+
case 'isObj':
|
|
191
|
+
return typeof credential.credentialSubject === 'object';
|
|
192
|
+
case 'id':
|
|
193
|
+
return credential.id;
|
|
194
|
+
case 'issuer':
|
|
195
|
+
return typeof credential.issuer === 'string' ? credential.issuer : credential.issuer.id;
|
|
196
|
+
case 'subject':
|
|
197
|
+
return Array.isArray(credential.credentialSubject) ? (_c = credential.credentialSubject[0]) === null || _c === void 0 ? void 0 : _c.id : (_d = credential.credentialSubject) === null || _d === void 0 ? void 0 : _d.id;
|
|
198
|
+
case 'expirationDate':
|
|
199
|
+
return credential.expirationDate;
|
|
200
|
+
case 'issuanceDate':
|
|
201
|
+
return credential.issuanceDate;
|
|
202
|
+
default:
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Returns a count of UniqueDigitalCredentials that match the given filter based on the claims they contain.
|
|
208
|
+
* @param args
|
|
209
|
+
*/
|
|
210
|
+
crsGetCredentialsByClaimsCount(args) {
|
|
211
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
const credentialsByClaims = yield this.crsGetCredentialsByClaims(args);
|
|
213
|
+
return credentialsByClaims.length; // FIXME ?
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
secureParse(original) {
|
|
217
|
+
return (0, ssi_sdk_data_store_1.parseRawDocument)(original);
|
|
218
|
+
}
|
|
219
|
+
toUniqueCredentials(credentials) {
|
|
220
|
+
return Object.values(credentials.reduce((accumulator, credential) => {
|
|
221
|
+
var _a, _b, _c, _d;
|
|
222
|
+
const uniqueCredential = {
|
|
223
|
+
hash: credential.hash,
|
|
224
|
+
digitalCredential: credential,
|
|
225
|
+
};
|
|
226
|
+
switch (credential.documentType) {
|
|
227
|
+
case ssi_sdk_data_store_1.DocumentType.VC:
|
|
228
|
+
uniqueCredential.originalVerifiableCredential = this.secureParse(credential.rawDocument);
|
|
229
|
+
uniqueCredential.uniformVerifiableCredential = this.secureParse(credential.uniformDocument);
|
|
230
|
+
uniqueCredential.id = (_a = uniqueCredential.uniformVerifiableCredential) === null || _a === void 0 ? void 0 : _a.id;
|
|
231
|
+
break;
|
|
232
|
+
case ssi_sdk_data_store_1.DocumentType.VP:
|
|
233
|
+
uniqueCredential.originalVerifiablePresentation = this.secureParse(credential.rawDocument);
|
|
234
|
+
uniqueCredential.uniformVerifiablePresentation = this.secureParse(credential.uniformDocument);
|
|
235
|
+
uniqueCredential.id = (_b = uniqueCredential.uniformVerifiablePresentation) === null || _b === void 0 ? void 0 : _b.id;
|
|
236
|
+
break;
|
|
237
|
+
case ssi_sdk_data_store_1.DocumentType.P:
|
|
238
|
+
uniqueCredential.originalPresentation = this.secureParse(credential.rawDocument);
|
|
239
|
+
uniqueCredential.id = (_c = uniqueCredential.originalPresentation) === null || _c === void 0 ? void 0 : _c.id;
|
|
240
|
+
break;
|
|
241
|
+
case ssi_sdk_data_store_1.DocumentType.C:
|
|
242
|
+
uniqueCredential.originalCredential = this.secureParse(credential.rawDocument);
|
|
243
|
+
uniqueCredential.id = (_d = uniqueCredential.originalCredential) === null || _d === void 0 ? void 0 : _d.id;
|
|
244
|
+
break;
|
|
245
|
+
// TODO CBOR support
|
|
246
|
+
}
|
|
247
|
+
accumulator[credential.hash] = uniqueCredential;
|
|
248
|
+
return accumulator;
|
|
249
|
+
}, {}));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.CredentialStore = CredentialStore;
|
|
253
|
+
//# sourceMappingURL=CredentialStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialStore.js","sourceRoot":"","sources":["../../src/agent/CredentialStore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qEAMqC;AACrC,yDAAmE;AAGnE,oCAAyC;AACzC,8CAA2D;AAe3D,wDAAwD;AAC3C,QAAA,sBAAsB,GAAkB;IACnD,kBAAkB;IAClB,0BAA0B;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;IACtB,yBAAyB;IACzB,kCAAkC;IAClC,2BAA2B;IAC3B,gCAAgC;CACjC,CAAA;AAED;;GAEG;AACH,MAAa,eAAe;IAiB1B,YAAY,OAAkD;QAhBrD,WAAM,GAAG,cAAM,CAAC,gBAAgB,CAAA;QAChC,YAAO,GAAqB;YACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CA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AAY,CAAC,EAAE;oBAClB,gBAAgB,CAAC,8BAA8B,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;oBAC1F,gBAAgB,CAAC,6BAA6B,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;oBAC7F,gBAAgB,CAAC,EAAE,GAAG,MAAA,gBAAgB,CAAC,6BAA6B,0CAAE,EAAE,CAAA;oBACxE,MAAK;gBACP,KAAK,iCAAY,CAAC,CAAC;oBACjB,gBAAgB,CAAC,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;oBAChF,gBAAgB,CAAC,EAAE,GAAG,MAAA,gBAAgB,CAAC,oBAAoB,0CAAE,EAAE,CAAA;oBAC/D,MAAK;gBACP,KAAK,iCAAY,CAAC,CAAC;oBACjB,gBAAgB,CAAC,kBAAkB,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;oBAC9E,gBAAgB,CAAC,EAAE,GAAG,MAAA,gBAAgB,CAAC,kBAAkB,0CAAE,EAAE,CAAA;oBAC7D,MAAK;gBACP,oBAAoB;YACtB,CAAC;YACD,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAA;YAC/C,OAAO,WAAW,CAAA;QACpB,CAAC,EACD,EAA6C,CAC9C,CACF,CAAA;IACH,CAAC;CACF;AAhOD,0CAgOC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,235 +1,12 @@
|
|
|
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
1
|
/**
|
|
229
2
|
* @public
|
|
230
3
|
*/
|
|
231
4
|
declare const schema: any;
|
|
232
|
-
|
|
233
|
-
declare const logger:
|
|
234
|
-
|
|
235
|
-
export {
|
|
5
|
+
export { schema };
|
|
6
|
+
export declare const logger: import("@sphereon/ssi-types").ISimpleLogger<unknown>;
|
|
7
|
+
export { CredentialStore, credentialStoreMethods } from './agent/CredentialStore';
|
|
8
|
+
export { CredentialRole, CredentialStateType, CredentialCorrelationType, CredentialDocumentFormat, DocumentType, DigitalCredential, FindDigitalCredentialArgs, } from '@sphereon/ssi-sdk.data-store';
|
|
9
|
+
export * from './types/ICredentialStore';
|
|
10
|
+
export * from './types/claims';
|
|
11
|
+
export * from './utils/filters';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AAEjB,eAAO,MAAM,MAAM,sDAAmD,CAAA;AAEtE,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACjF,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,8BAA8B,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|