@sphereon/ssi-sdk.credential-store 0.33.1-next.2 → 0.33.1-next.68
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/index.cjs +2056 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{ssi-sdk.credential-store.d.ts → index.d.cts} +235 -286
- package/dist/index.d.ts +231 -8
- package/dist/index.js +2035 -34
- package/dist/index.js.map +1 -1
- package/package.json +26 -15
- package/plugin.schema.json +332 -504
- package/src/agent/CredentialStore.ts +6 -6
- package/src/index.ts +2 -2
- package/src/types/ICredentialStore.ts +7 -7
- package/src/utils/filters.ts +1 -1
- package/dist/agent/CredentialStore.d.ts +0 -45
- package/dist/agent/CredentialStore.d.ts.map +0 -1
- package/dist/agent/CredentialStore.js +0 -253
- package/dist/agent/CredentialStore.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/tsdoc-metadata.json +0 -11
- package/dist/types/ICredentialStore.d.ts +0 -106
- package/dist/types/ICredentialStore.d.ts.map +0 -1
- package/dist/types/ICredentialStore.js +0 -13
- package/dist/types/ICredentialStore.js.map +0 -1
- package/dist/types/claims.d.ts +0 -43
- package/dist/types/claims.d.ts.map +0 -1
- package/dist/types/claims.js +0 -3
- package/dist/types/claims.js.map +0 -1
- package/dist/utils/filters.d.ts +0 -36
- package/dist/utils/filters.d.ts.map +0 -1
- package/dist/utils/filters.js +0 -90
- package/dist/utils/filters.js.map +0 -1
package/dist/utils/filters.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeFilter = exports.verifiableCredentialForRoleFilter = exports.credentialIdOrHashFilter = void 0;
|
|
4
|
-
const ssi_sdk_data_store_1 = require("@sphereon/ssi-sdk.data-store");
|
|
5
|
-
const uuid_1 = require("uuid");
|
|
6
|
-
/**
|
|
7
|
-
* Creates a filter to find a digital credential by its ID or hash.
|
|
8
|
-
*
|
|
9
|
-
* @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
|
|
10
|
-
* @param idOrHash - The ID or hash of the credential to search for.
|
|
11
|
-
* @returns A FindDigitalCredentialArgs array for filtering by ID or hash.
|
|
12
|
-
*/
|
|
13
|
-
const credentialIdOrHashFilter = (credentialRole, idOrHash) => {
|
|
14
|
-
const filter = [
|
|
15
|
-
{
|
|
16
|
-
hash: idOrHash,
|
|
17
|
-
credentialRole,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
credentialId: idOrHash,
|
|
21
|
-
credentialRole,
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
if ((0, uuid_1.validate)(idOrHash)) {
|
|
25
|
-
filter.push({
|
|
26
|
-
id: idOrHash,
|
|
27
|
-
credentialRole,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return filter;
|
|
31
|
-
};
|
|
32
|
-
exports.credentialIdOrHashFilter = credentialIdOrHashFilter;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a filter for verifiable credentials with a specific role.
|
|
35
|
-
*
|
|
36
|
-
* @param credentialRole - The role to filter by (e.g., ISSUER, HOLDER).
|
|
37
|
-
* @param withFilter - Optional additional filter criteria.
|
|
38
|
-
* @returns A FindDigitalCredentialArgs array for filtering verifiable credentials by role.
|
|
39
|
-
*/
|
|
40
|
-
const verifiableCredentialForRoleFilter = (credentialRole, withFilter) => {
|
|
41
|
-
const filter = [
|
|
42
|
-
{
|
|
43
|
-
documentType: ssi_sdk_data_store_1.DocumentType.VC,
|
|
44
|
-
credentialRole: credentialRole,
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
if (withFilter !== undefined) {
|
|
48
|
-
return (0, exports.mergeFilter)(withFilter, filter);
|
|
49
|
-
}
|
|
50
|
-
return filter;
|
|
51
|
-
};
|
|
52
|
-
exports.verifiableCredentialForRoleFilter = verifiableCredentialForRoleFilter;
|
|
53
|
-
/**
|
|
54
|
-
* Merges two FindDigitalCredentialArgs arrays into a single array.
|
|
55
|
-
*
|
|
56
|
-
* This function combines two filter arrays, merging objects at the same index
|
|
57
|
-
* and adding unique objects from both arrays. When merging objects, properties
|
|
58
|
-
* from filter2 overwrite those from filter1 if they exist in both.
|
|
59
|
-
*
|
|
60
|
-
* @param filter1 - The first FindDigitalCredentialArgs array to merge.
|
|
61
|
-
* @param filter2 - The second FindDigitalCredentialArgs array to merge.
|
|
62
|
-
* @returns A new FindDigitalCredentialArgs array containing the merged result.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* const filter1 = [{ documentType: DocumentType.VC }, { credentialRole: CredentialRole.ISSUER }];
|
|
66
|
-
* const filter2 = [{ documentType: DocumentType.VP }, { hash: 'abc123' }];
|
|
67
|
-
* const mergedFilter = mergeFilter(filter1, filter2);
|
|
68
|
-
* // Result: [{ documentType: DocumentType.VP }, { credentialRole: CredentialRole.ISSUER, hash: 'abc123' }]
|
|
69
|
-
*/
|
|
70
|
-
const mergeFilter = (filter1, filter2) => {
|
|
71
|
-
const mergedFilter = [];
|
|
72
|
-
const mergedMap = new Map();
|
|
73
|
-
filter1.forEach((obj, index) => {
|
|
74
|
-
mergedMap.set(index, Object.assign({}, obj));
|
|
75
|
-
});
|
|
76
|
-
filter2.forEach((obj, index) => {
|
|
77
|
-
if (mergedMap.has(index)) {
|
|
78
|
-
mergedMap.set(index, Object.assign(Object.assign({}, mergedMap.get(index)), obj));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
mergedMap.set(index, Object.assign({}, obj));
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
mergedMap.forEach((value) => {
|
|
85
|
-
mergedFilter.push(value);
|
|
86
|
-
});
|
|
87
|
-
return mergedFilter;
|
|
88
|
-
};
|
|
89
|
-
exports.mergeFilter = mergeFilter;
|
|
90
|
-
//# sourceMappingURL=filters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRo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