@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
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2024] [Sphereon International B.V.]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
File without changes
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
AbstractContactStore: () => AbstractContactStore,
|
|
25
|
+
AbstractDigitalCredentialStore: () => AbstractDigitalCredentialStore,
|
|
26
|
+
AbstractEventLoggerStore: () => AbstractEventLoggerStore,
|
|
27
|
+
AbstractIssuanceBrandingStore: () => AbstractIssuanceBrandingStore,
|
|
28
|
+
AbstractPDStore: () => AbstractPDStore,
|
|
29
|
+
ConnectionType: () => ConnectionType,
|
|
30
|
+
CorrelationIdentifierType: () => CorrelationIdentifierType,
|
|
31
|
+
CredentialCorrelationType: () => CredentialCorrelationType,
|
|
32
|
+
CredentialDocumentFormat: () => CredentialDocumentFormat,
|
|
33
|
+
CredentialStateType: () => CredentialStateType,
|
|
34
|
+
DocumentType: () => DocumentType,
|
|
35
|
+
IAbstractMachineStateStore: () => IAbstractMachineStateStore,
|
|
36
|
+
IdentityOrigin: () => IdentityOrigin,
|
|
37
|
+
PartyOrigin: () => PartyOrigin,
|
|
38
|
+
PartyTypeType: () => PartyTypeType,
|
|
39
|
+
RegulationType: () => RegulationType,
|
|
40
|
+
ensureRawDocument: () => ensureRawDocument
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(index_exports);
|
|
43
|
+
|
|
44
|
+
// src/contact/AbstractContactStore.ts
|
|
45
|
+
var AbstractContactStore = class {
|
|
46
|
+
static {
|
|
47
|
+
__name(this, "AbstractContactStore");
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/digitalCredential/AbstractDigitalCredentialStore.ts
|
|
52
|
+
var AbstractDigitalCredentialStore = class {
|
|
53
|
+
static {
|
|
54
|
+
__name(this, "AbstractDigitalCredentialStore");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/issuanceBranding/AbstractIssuanceBrandingStore.ts
|
|
59
|
+
var AbstractIssuanceBrandingStore = class {
|
|
60
|
+
static {
|
|
61
|
+
__name(this, "AbstractIssuanceBrandingStore");
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/eventLogger/AbstractEventLoggerStore.ts
|
|
66
|
+
var AbstractEventLoggerStore = class {
|
|
67
|
+
static {
|
|
68
|
+
__name(this, "AbstractEventLoggerStore");
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/machineState/IAbstractMachineStateStore.ts
|
|
73
|
+
var IAbstractMachineStateStore = class {
|
|
74
|
+
static {
|
|
75
|
+
__name(this, "IAbstractMachineStateStore");
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// src/presentationDefinition/AbstractPDStore.ts
|
|
80
|
+
var AbstractPDStore = class {
|
|
81
|
+
static {
|
|
82
|
+
__name(this, "AbstractPDStore");
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/types/contact/contact.ts
|
|
87
|
+
var ConnectionType = /* @__PURE__ */ (function(ConnectionType2) {
|
|
88
|
+
ConnectionType2["OPENID_CONNECT"] = "OIDC";
|
|
89
|
+
ConnectionType2["SIOPv2"] = "SIOPv2";
|
|
90
|
+
ConnectionType2["SIOPv2_OpenID4VP"] = "SIOPv2+OpenID4VP";
|
|
91
|
+
return ConnectionType2;
|
|
92
|
+
})({});
|
|
93
|
+
var CorrelationIdentifierType = /* @__PURE__ */ (function(CorrelationIdentifierType2) {
|
|
94
|
+
CorrelationIdentifierType2["DID"] = "did";
|
|
95
|
+
CorrelationIdentifierType2["URL"] = "url";
|
|
96
|
+
return CorrelationIdentifierType2;
|
|
97
|
+
})({});
|
|
98
|
+
var PartyTypeType = /* @__PURE__ */ (function(PartyTypeType2) {
|
|
99
|
+
PartyTypeType2["NATURAL_PERSON"] = "naturalPerson";
|
|
100
|
+
PartyTypeType2["ORGANIZATION"] = "organization";
|
|
101
|
+
return PartyTypeType2;
|
|
102
|
+
})({});
|
|
103
|
+
var PartyOrigin = /* @__PURE__ */ (function(PartyOrigin2) {
|
|
104
|
+
PartyOrigin2["INTERNAL"] = "INTERNAL";
|
|
105
|
+
PartyOrigin2["EXTERNAL"] = "EXTERNAL";
|
|
106
|
+
return PartyOrigin2;
|
|
107
|
+
})({});
|
|
108
|
+
var IdentityOrigin = /* @__PURE__ */ (function(IdentityOrigin2) {
|
|
109
|
+
IdentityOrigin2["INTERNAL"] = "INTERNAL";
|
|
110
|
+
IdentityOrigin2["EXTERNAL"] = "EXTERNAL";
|
|
111
|
+
return IdentityOrigin2;
|
|
112
|
+
})({});
|
|
113
|
+
|
|
114
|
+
// src/types/digitalCredential/enums.ts
|
|
115
|
+
var DocumentType = /* @__PURE__ */ (function(DocumentType2) {
|
|
116
|
+
DocumentType2["VC"] = "VC";
|
|
117
|
+
DocumentType2["VP"] = "VP";
|
|
118
|
+
DocumentType2["P"] = "P";
|
|
119
|
+
DocumentType2["C"] = "C";
|
|
120
|
+
return DocumentType2;
|
|
121
|
+
})({});
|
|
122
|
+
var RegulationType = /* @__PURE__ */ (function(RegulationType2) {
|
|
123
|
+
RegulationType2["PID"] = "PID";
|
|
124
|
+
RegulationType2["QEAA"] = "QEAA";
|
|
125
|
+
RegulationType2["EAA"] = "EAA";
|
|
126
|
+
RegulationType2["NON_REGULATED"] = "NON_REGULATED";
|
|
127
|
+
return RegulationType2;
|
|
128
|
+
})({});
|
|
129
|
+
var CredentialDocumentFormat = /* @__PURE__ */ (function(CredentialDocumentFormat2) {
|
|
130
|
+
CredentialDocumentFormat2["JSON_LD"] = "JSON_LD";
|
|
131
|
+
CredentialDocumentFormat2["JWT"] = "JWT";
|
|
132
|
+
CredentialDocumentFormat2["SD_JWT"] = "SD_JWT";
|
|
133
|
+
CredentialDocumentFormat2["MSO_MDOC"] = "MSO_MDOC";
|
|
134
|
+
return CredentialDocumentFormat2;
|
|
135
|
+
})({});
|
|
136
|
+
(function(CredentialDocumentFormat2) {
|
|
137
|
+
function fromSpecValue(credentialFormat) {
|
|
138
|
+
const format = credentialFormat.toLowerCase();
|
|
139
|
+
if (format.includes("sd")) {
|
|
140
|
+
return "SD_JWT";
|
|
141
|
+
} else if (format.includes("ldp")) {
|
|
142
|
+
return "JSON_LD";
|
|
143
|
+
} else if (format.includes("mso") || credentialFormat.includes("mdoc")) {
|
|
144
|
+
return "MSO_MDOC";
|
|
145
|
+
} else if (format.includes("jwt_")) {
|
|
146
|
+
return "JWT";
|
|
147
|
+
} else {
|
|
148
|
+
throw Error(`Could not map format ${format} to known format`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
__name(fromSpecValue, "fromSpecValue");
|
|
152
|
+
CredentialDocumentFormat2.fromSpecValue = fromSpecValue;
|
|
153
|
+
function toSpecValue(documentFormat, documentType) {
|
|
154
|
+
switch (documentFormat) {
|
|
155
|
+
case "SD_JWT":
|
|
156
|
+
return "dc+sd-jwt";
|
|
157
|
+
case "MSO_MDOC":
|
|
158
|
+
return "mso_mdoc";
|
|
159
|
+
case "JSON_LD":
|
|
160
|
+
return documentType === "C" || documentType === "VC" ? "ldp_vc" : "ldp_vp";
|
|
161
|
+
case "JWT":
|
|
162
|
+
return documentType === "C" || documentType === "VC" ? "jwt_vc_json" : "jwt_vp_json";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
__name(toSpecValue, "toSpecValue");
|
|
166
|
+
CredentialDocumentFormat2.toSpecValue = toSpecValue;
|
|
167
|
+
})(CredentialDocumentFormat || (CredentialDocumentFormat = {}));
|
|
168
|
+
var CredentialCorrelationType = /* @__PURE__ */ (function(CredentialCorrelationType2) {
|
|
169
|
+
CredentialCorrelationType2["DID"] = "DID";
|
|
170
|
+
CredentialCorrelationType2["X509_SAN"] = "X509_SAN";
|
|
171
|
+
CredentialCorrelationType2["KID"] = "KID";
|
|
172
|
+
CredentialCorrelationType2["URL"] = "URL";
|
|
173
|
+
return CredentialCorrelationType2;
|
|
174
|
+
})({});
|
|
175
|
+
var CredentialStateType = /* @__PURE__ */ (function(CredentialStateType2) {
|
|
176
|
+
CredentialStateType2["REVOKED"] = "REVOKED";
|
|
177
|
+
CredentialStateType2["VERIFIED"] = "VERIFIED";
|
|
178
|
+
CredentialStateType2["EXPIRED"] = "EXPIRED";
|
|
179
|
+
return CredentialStateType2;
|
|
180
|
+
})({});
|
|
181
|
+
|
|
182
|
+
// src/utils/MappingUtils.ts
|
|
183
|
+
var import_ssi_types = require("@sphereon/ssi-types");
|
|
184
|
+
function isHex(input) {
|
|
185
|
+
return input.match(/^([0-9A-Fa-f])+$/g) !== null;
|
|
186
|
+
}
|
|
187
|
+
__name(isHex, "isHex");
|
|
188
|
+
function ensureRawDocument(input) {
|
|
189
|
+
if (typeof input === "string") {
|
|
190
|
+
if (isHex(input) || import_ssi_types.ObjectUtils.isBase64(input)) {
|
|
191
|
+
return input;
|
|
192
|
+
} else if (import_ssi_types.CredentialMapper.isJwtEncoded(input) || import_ssi_types.CredentialMapper.isSdJwtEncoded(input)) {
|
|
193
|
+
return input;
|
|
194
|
+
}
|
|
195
|
+
throw Error("Unknown input to be mapped as rawDocument");
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
return JSON.stringify(input);
|
|
199
|
+
} catch (e) {
|
|
200
|
+
throw new Error(`Can't stringify to a raw credential: ${input}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
__name(ensureRawDocument, "ensureRawDocument");
|
|
204
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/contact/AbstractContactStore.ts","../src/digitalCredential/AbstractDigitalCredentialStore.ts","../src/issuanceBranding/AbstractIssuanceBrandingStore.ts","../src/eventLogger/AbstractEventLoggerStore.ts","../src/machineState/IAbstractMachineStateStore.ts","../src/presentationDefinition/AbstractPDStore.ts","../src/types/contact/contact.ts","../src/types/digitalCredential/enums.ts","../src/utils/MappingUtils.ts"],"sourcesContent":["// import {PartyCorrelationType} from \"@sphereon/ssi-sdk.core\";\n\nexport { AbstractContactStore } from './contact/AbstractContactStore'\nexport { AbstractDigitalCredentialStore } from './digitalCredential/AbstractDigitalCredentialStore'\nexport { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'\nexport { AbstractEventLoggerStore } from './eventLogger/AbstractEventLoggerStore'\nexport { IAbstractMachineStateStore } from './machineState/IAbstractMachineStateStore'\nexport { AbstractPDStore } from './presentationDefinition/AbstractPDStore'\n\nexport * from './types'\nexport * from './utils/MappingUtils'\n","import {\n AddElectronicAddressArgs,\n AddIdentityArgs,\n AddPartyArgs,\n AddPartyTypeArgs,\n AddPhysicalAddressArgs,\n AddRelationshipArgs,\n ElectronicAddress,\n GetElectronicAddressArgs,\n GetElectronicAddressesArgs,\n GetIdentitiesArgs,\n GetIdentityArgs,\n GetPartiesArgs,\n GetPartyArgs,\n GetPartyTypeArgs,\n GetPartyTypesArgs,\n GetPhysicalAddressArgs,\n GetPhysicalAddressesArgs,\n GetRelationshipArgs,\n GetRelationshipsArgs,\n Identity,\n Party,\n PartyRelationship,\n PartyType,\n PhysicalAddress,\n RemoveElectronicAddressArgs,\n RemoveIdentityArgs,\n RemovePartyArgs,\n RemovePartyTypeArgs,\n RemovePhysicalAddressArgs,\n RemoveRelationshipArgs,\n UpdateElectronicAddressArgs,\n UpdateIdentityArgs,\n UpdatePartyArgs,\n UpdatePartyTypeArgs,\n UpdatePhysicalAddressArgs,\n UpdateRelationshipArgs,\n} from '../types'\n\nexport abstract class AbstractContactStore {\n abstract getParty(args: GetPartyArgs): Promise<Party>\n abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>\n abstract addParty(args: AddPartyArgs): Promise<Party>\n abstract updateParty(args: UpdatePartyArgs): Promise<Party>\n abstract removeParty(args: RemovePartyArgs): Promise<void>\n abstract getIdentity(args: GetIdentityArgs): Promise<Identity>\n abstract getIdentities(args?: GetIdentitiesArgs): Promise<Array<Identity>>\n abstract addIdentity(args: AddIdentityArgs): Promise<Identity>\n abstract updateIdentity(args: UpdateIdentityArgs): Promise<Identity>\n abstract removeIdentity(args: RemoveIdentityArgs): Promise<void>\n abstract getRelationship(args: GetRelationshipArgs): Promise<PartyRelationship>\n abstract getRelationships(args?: GetRelationshipsArgs): Promise<Array<PartyRelationship>>\n abstract addRelationship(args: AddRelationshipArgs): Promise<PartyRelationship>\n abstract updateRelationship(args: UpdateRelationshipArgs): Promise<PartyRelationship>\n abstract removeRelationship(args: RemoveRelationshipArgs): Promise<void>\n abstract getPartyType(args: GetPartyTypeArgs): Promise<PartyType>\n abstract getPartyTypes(args?: GetPartyTypesArgs): Promise<Array<PartyType>>\n abstract addPartyType(args: AddPartyTypeArgs): Promise<PartyType>\n abstract updatePartyType(args: UpdatePartyTypeArgs): Promise<PartyType>\n abstract removePartyType(args: RemovePartyTypeArgs): Promise<void>\n abstract getElectronicAddress(args: GetElectronicAddressArgs): Promise<ElectronicAddress>\n abstract getElectronicAddresses(args?: GetElectronicAddressesArgs): Promise<Array<ElectronicAddress>>\n abstract addElectronicAddress(args: AddElectronicAddressArgs): Promise<ElectronicAddress>\n abstract updateElectronicAddress(args: UpdateElectronicAddressArgs): Promise<ElectronicAddress>\n abstract removeElectronicAddress(args: RemoveElectronicAddressArgs): Promise<void>\n abstract getPhysicalAddress(args: GetPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract getPhysicalAddresses(args?: GetPhysicalAddressesArgs): Promise<Array<PhysicalAddress>>\n abstract addPhysicalAddress(args: AddPhysicalAddressArgs): Promise<PhysicalAddress>\n abstract updatePhysicalAddress(args: UpdatePhysicalAddressArgs): Promise<PhysicalAddress>\n abstract removePhysicalAddress(args: RemovePhysicalAddressArgs): Promise<void>\n}\n","import {\n AddCredentialArgs,\n DigitalCredential,\n GetCredentialArgs,\n GetCredentialsArgs,\n GetCredentialsResponse,\n RemoveCredentialArgs,\n UpdateCredentialStateArgs,\n} from '../types'\n\nexport abstract class AbstractDigitalCredentialStore {\n abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>\n\n abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>\n\n abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>\n\n abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>\n\n abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>\n}\n","import type {\n IAddCredentialBrandingArgs,\n IAddCredentialLocaleBrandingArgs,\n IAddIssuerBrandingArgs,\n IAddIssuerLocaleBrandingArgs,\n ICredentialBranding,\n ICredentialLocaleBranding,\n IGetCredentialBrandingArgs,\n IGetCredentialLocaleBrandingArgs,\n IGetIssuerBrandingArgs,\n IGetIssuerLocaleBrandingArgs,\n IIssuerBranding,\n IIssuerLocaleBranding,\n IRemoveCredentialBrandingArgs,\n IRemoveCredentialLocaleBrandingArgs,\n IRemoveIssuerBrandingArgs,\n IRemoveIssuerLocaleBrandingArgs,\n IUpdateCredentialBrandingArgs,\n IUpdateCredentialLocaleBrandingArgs,\n IUpdateIssuerBrandingArgs,\n IUpdateIssuerLocaleBrandingArgs,\n} from '../types'\n\nexport abstract class AbstractIssuanceBrandingStore {\n public abstract addCredentialBranding(args: IAddCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialBranding(args?: IGetCredentialBrandingArgs): Promise<Array<ICredentialBranding>>\n public abstract updateCredentialBranding(args: IUpdateCredentialBrandingArgs): Promise<ICredentialBranding>\n public abstract removeCredentialBranding(args: IRemoveCredentialBrandingArgs): Promise<void>\n public abstract addCredentialLocaleBranding(args: IAddCredentialLocaleBrandingArgs): Promise<ICredentialBranding>\n public abstract getCredentialLocaleBranding(args?: IGetCredentialLocaleBrandingArgs): Promise<Array<ICredentialLocaleBranding>>\n public abstract updateCredentialLocaleBranding(args: IUpdateCredentialLocaleBrandingArgs): Promise<ICredentialLocaleBranding>\n public abstract removeCredentialLocaleBranding(args: IRemoveCredentialLocaleBrandingArgs): Promise<void>\n public abstract addIssuerBranding(args: IAddIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerBranding(args?: IGetIssuerBrandingArgs): Promise<Array<IIssuerBranding>>\n public abstract updateIssuerBranding(args: IUpdateIssuerBrandingArgs): Promise<IIssuerBranding>\n public abstract removeIssuerBranding(args: IRemoveIssuerBrandingArgs): Promise<void>\n public abstract addIssuerLocaleBranding(args: IAddIssuerLocaleBrandingArgs): Promise<IIssuerBranding>\n public abstract getIssuerLocaleBranding(args?: IGetIssuerLocaleBrandingArgs): Promise<Array<IIssuerLocaleBranding>>\n public abstract updateIssuerLocaleBranding(args: IUpdateIssuerLocaleBrandingArgs): Promise<IIssuerLocaleBranding>\n public abstract removeIssuerLocaleBranding(args: IRemoveIssuerLocaleBrandingArgs): Promise<void>\n}\n","import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'\nimport type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'\n\nexport abstract class AbstractEventLoggerStore {\n abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>\n abstract getActivityEvents(args: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>\n abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>\n abstract storeActivityEvent(args: StoreActivityEventArgs): Promise<ActivityLoggingEvent>\n}\n","import type {\n StoreMachineStateDeleteExpiredArgs,\n StoreMachineStateDeleteArgs,\n StoreMachineStatesFindActiveArgs,\n StoreFindMachineStatesArgs,\n StoreMachineStatePersistArgs,\n StoreMachineStateInfo,\n StoreMachineStateGetArgs,\n} from '../types'\n\n/**\n * Represents an abstract class for storing machine states.\n * This class provides methods for persisting, retrieving, and deleting machine states.\n *\n * @interface\n */\nexport abstract class IAbstractMachineStateStore {\n /**\n * Persists the machine state.\n *\n * @param {StoreMachineStatePersistArgs} state - The object containing the machine state to persist.\n * @return {Promise<StoreMachineStateInfo>} - A Promise that resolves to the information about the persisted machine state.\n */\n abstract persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds active machine states based on the given arguments.\n *\n * @param {StoreMachineStatesFindActiveArgs} args - The arguments for finding active machine states.\n * @return {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves with an array of active machine states.\n */\n abstract findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Retrieves the state of a particular machine.\n *\n * @param {StoreMachineStateGetArgs} args - The arguments for retrieving the machine state.\n * @returns {Promise<StoreMachineStateInfo>} - A promise that resolves to the machine state information.\n */\n abstract getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>\n\n /**\n * Finds the machine states based on the given arguments.\n *\n * @param {StoreFindMachineStatesArgs} [args] - The arguments to filter the machine states.\n * @returns {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves to an array of machine state information.\n */\n abstract findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>\n\n /**\n * Deletes a machine state.\n *\n * @param {StoreMachineStateDeleteArgs} args - The arguments for deleting the machine state.\n * @return {Promise<boolean>} - A promise that resolves to a boolean indicating if the machine state was successfully deleted or not.\n */\n abstract deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>\n\n /**\n * Deletes expired machine states from the database.\n *\n * @param {StoreMachineStateDeleteExpiredArgs} args - The arguments for deleting expired machine states.\n * @return {Promise<number>} - A promise that resolves to the number of deleted machine states.\n */\n abstract deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>\n}\n","import type {\n GetDefinitionArgs,\n GetDefinitionsArgs,\n DeleteDefinitionArgs,\n DcqlQueryItem,\n AddDefinitionArgs,\n UpdateDefinitionArgs,\n DeleteDefinitionsArgs,\n} from '../types'\n\nexport abstract class AbstractPDStore {\n abstract hasDefinition(args: GetDefinitionArgs): Promise<boolean>\n abstract hasDefinitions(args: GetDefinitionsArgs): Promise<boolean>\n abstract getDefinition(args: GetDefinitionArgs): Promise<DcqlQueryItem>\n abstract getDefinitions(args: GetDefinitionsArgs): Promise<Array<DcqlQueryItem>>\n abstract addDefinition(args: AddDefinitionArgs): Promise<DcqlQueryItem>\n abstract updateDefinition(args: UpdateDefinitionArgs): Promise<DcqlQueryItem>\n abstract deleteDefinition(args: DeleteDefinitionArgs): Promise<void>\n abstract deleteDefinitions(args: DeleteDefinitionsArgs): Promise<number>\n}\n","import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'\nimport { IIdentifier } from '@veramo/core'\nimport { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'\nimport { CredentialRole } from '@sphereon/ssi-types'\n\nexport type MetadataTypes = string | number | Date | boolean | undefined\n\nexport interface IMetadataEntity {\n // TODO move to types\n label: string\n stringValue?: string\n numberValue?: number\n dateValue?: Date\n boolValue?: boolean\n}\n\nexport type Party = {\n id: string\n uri?: string\n roles: Array<CredentialRole>\n ownerId?: string\n tenantId?: string\n identities: Array<Identity>\n electronicAddresses: Array<ElectronicAddress>\n physicalAddresses: Array<PhysicalAddress>\n contact: Contact\n partyType: PartyType\n /**\n * 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.\n *\n * Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:\n * 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).\n * 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.\n * 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.\n *\n * 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.\n */\n branding?: IIssuerLocaleBranding\n relationships: Array<PartyRelationship>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedParty = Omit<\n Party,\n | 'id'\n | 'identities'\n | 'electronicAddresses'\n | 'physicalAddresses'\n | 'contact'\n | 'roles'\n | 'partyType'\n | 'relationships'\n | 'createdAt'\n | 'lastUpdatedAt'\n> & {\n identities?: Array<NonPersistedIdentity>\n electronicAddresses?: Array<NonPersistedElectronicAddress>\n physicalAddresses?: Array<NonPersistedPhysicalAddress>\n contact: NonPersistedContact\n partyType: NonPersistedPartyType\n relationships?: Array<NonPersistedPartyRelationship>\n}\nexport type PartialParty = Partial<\n Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>\n> & {\n identities?: PartialIdentity\n electronicAddresses?: PartialElectronicAddress\n physicalAddresses?: PartialPhysicalAddress\n contact?: PartialContact\n partyType?: PartialPartyType\n relationships?: PartialPartyRelationship\n}\n\nexport type Identity = {\n id: string\n alias: string\n ownerId?: string\n tenantId?: string\n origin: IdentityOrigin\n roles: Array<CredentialRole>\n identifier: CorrelationIdentifier\n connection?: Connection\n metadata?: Array<MetadataItem<MetadataTypes>>\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {\n origin: IdentityOrigin\n identifier: NonPersistedCorrelationIdentifier\n connection?: NonPersistedConnection\n metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>\n}\nexport type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {\n identifier?: PartialCorrelationIdentifier\n connection?: PartialConnection\n metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>\n origin?: IdentityOrigin\n roles?: CredentialRole\n partyId?: string\n}\n\nexport type MetadataItem<T extends MetadataTypes> = {\n id: string\n label: string\n value: T\n}\n\nexport type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>\nexport type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>\n\nexport type CorrelationIdentifier = {\n id: string\n ownerId?: string\n tenantId?: string\n type: CorrelationIdentifierType\n correlationId: string\n}\nexport type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>\nexport type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>\n\nexport type Connection = {\n id: string\n ownerId?: string\n tenantId?: string\n type: ConnectionType\n config: ConnectionConfig\n}\nexport type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {\n config: NonPersistedConnectionConfig\n}\nexport type PartialConnection = Partial<Omit<Connection, 'config'>> & {\n config: PartialConnectionConfig\n}\n\nexport type OpenIdConfig = {\n id: string\n clientId: string\n clientSecret: string\n ownerId?: string\n tenantId?: string\n scopes: Array<string>\n issuer: string\n redirectUrl: string\n dangerouslyAllowInsecureHttpRequests: boolean\n clientAuthMethod: 'basic' | 'post' | undefined\n}\nexport type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>\nexport type PartialOpenIdConfig = Partial<OpenIdConfig>\n\nexport type DidAuthConfig = {\n id: string\n idOpts: ManagedIdentifierOptsOrResult\n stateId: string\n ownerId?: string\n tenantId?: string\n redirectUrl: string\n sessionId: string\n}\nexport type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>\nexport type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {\n identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier\n}\n\nexport type ConnectionConfig = OpenIdConfig | DidAuthConfig\nexport type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig\nexport type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig\n\nexport type NaturalPerson = {\n id: string\n firstName: string\n lastName: string\n middleName?: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\n\nexport type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>\n\nexport type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Organization = {\n id: string\n legalName: string\n displayName: string\n metadata?: Array<MetadataItem<MetadataTypes>>\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {\n metadata?: PartialMetadataItem<MetadataTypes>\n}\n\nexport type Contact = NaturalPerson | Organization\nexport type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization\nexport type PartialContact = PartialNaturalPerson | PartialOrganization\n\nexport type PartyType = {\n id: string\n type: PartyTypeType\n origin: PartyOrigin\n name: string\n tenantId: string\n description?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {\n id?: string\n}\nexport type PartialPartyType = Partial<PartyType>\n\nexport type PartyRelationship = {\n id: string\n leftId: string\n rightId: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPartyRelationship = Partial<PartyRelationship>\n\nexport type ElectronicAddress = {\n id: string\n type: ElectronicAddressType\n electronicAddress: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialElectronicAddress = Partial<ElectronicAddress> & {\n partyId?: string\n}\n\nexport type PhysicalAddress = {\n id: string\n type: PhysicalAddressType\n streetName: string\n streetNumber: string\n postalCode: string\n cityName: string\n provinceName: string\n countryCode: string\n buildingName?: string\n ownerId?: string\n tenantId?: string\n createdAt: Date\n lastUpdatedAt: Date\n}\nexport type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>\nexport type PartialPhysicalAddress = Partial<PhysicalAddress> & {\n partyId?: string\n}\n\nexport type ElectronicAddressType = 'email' | 'phone'\n\nexport type PhysicalAddressType = 'home' | 'visit' | 'postal'\n\nexport enum ConnectionType {\n OPENID_CONNECT = 'OIDC',\n SIOPv2 = 'SIOPv2',\n SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',\n}\n\nexport enum CorrelationIdentifierType {\n DID = 'did',\n URL = 'url',\n}\n\nexport enum PartyTypeType {\n NATURAL_PERSON = 'naturalPerson',\n ORGANIZATION = 'organization',\n}\n\nexport enum PartyOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n\nexport enum IdentityOrigin {\n INTERNAL = 'INTERNAL',\n EXTERNAL = 'EXTERNAL',\n}\n","export enum DocumentType {\n VC = 'VC',\n VP = 'VP',\n P = 'P',\n C = 'C',\n}\n\nexport enum RegulationType {\n PID = 'PID',\n QEAA = 'QEAA',\n EAA = 'EAA',\n NON_REGULATED = 'NON_REGULATED',\n}\n\nexport enum CredentialDocumentFormat {\n JSON_LD = 'JSON_LD',\n JWT = 'JWT',\n SD_JWT = 'SD_JWT',\n MSO_MDOC = 'MSO_MDOC',\n}\n\nexport namespace CredentialDocumentFormat {\n export function fromSpecValue(credentialFormat: string) {\n const format = credentialFormat.toLowerCase()\n if (format.includes('sd')) {\n return CredentialDocumentFormat.SD_JWT\n } else if (format.includes('ldp')) {\n return CredentialDocumentFormat.JSON_LD\n } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {\n return CredentialDocumentFormat.MSO_MDOC\n } else if (format.includes('jwt_')) {\n return CredentialDocumentFormat.JWT\n } else {\n throw Error(`Could not map format ${format} to known format`)\n }\n }\n\n export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {\n switch (documentFormat) {\n case CredentialDocumentFormat.SD_JWT:\n return 'dc+sd-jwt'\n case CredentialDocumentFormat.MSO_MDOC:\n return 'mso_mdoc'\n case CredentialDocumentFormat.JSON_LD:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'\n case CredentialDocumentFormat.JWT:\n return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'\n }\n }\n}\n\nexport enum CredentialCorrelationType {\n DID = 'DID',\n X509_SAN = 'X509_SAN',\n KID = 'KID',\n URL = 'URL',\n}\n\nexport enum CredentialStateType {\n REVOKED = 'REVOKED',\n VERIFIED = 'VERIFIED',\n EXPIRED = 'EXPIRED',\n}\n","import { CredentialMapper, ObjectUtils } from '@sphereon/ssi-types'\n\nfunction isHex(input: string) {\n return input.match(/^([0-9A-Fa-f])+$/g) !== null\n}\nexport function ensureRawDocument(input: string | object): string {\n if (typeof input === 'string') {\n if (isHex(input) || ObjectUtils.isBase64(input)) {\n // mso_mdoc\n return input\n } else if (CredentialMapper.isJwtEncoded(input) || CredentialMapper.isSdJwtEncoded(input)) {\n return input\n }\n throw Error('Unknown input to be mapped as rawDocument')\n }\n\n try {\n return JSON.stringify(input)\n } catch (e) {\n throw new Error(`Can't stringify to a raw credential: ${input}`)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACuCO,IAAeA,uBAAf,MAAeA;EAAtB,OAAsBA;;;AA+BtB;;;AC5DO,IAAeC,iCAAf,MAAeA;EAAtB,OAAsBA;;;AAUtB;;;ACGO,IAAeC,gCAAf,MAAeA;EAAtB,OAAsBA;;;AAiBtB;;;ACrCO,IAAeC,2BAAf,MAAeA;EAAtB,OAAsBA;;;AAKtB;;;ACQO,IAAeC,6BAAf,MAAeA;EANtB,OAMsBA;;;AAgDtB;;;ACtDO,IAAeC,kBAAf,MAAeA;EAAtB,OAAsBA;;;AAStB;;;AC2PO,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;SAAAA;;AAML,IAAKC,4BAAAA,0BAAAA,4BAAAA;;;SAAAA;;AAKL,IAAKC,gBAAAA,0BAAAA,gBAAAA;;;SAAAA;;AAKL,IAAKC,cAAAA,0BAAAA,cAAAA;;;SAAAA;;AAKL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;SAAAA;;;;ACnSL,IAAKC,eAAAA,0BAAAA,eAAAA;;;;;SAAAA;;AAOL,IAAKC,iBAAAA,0BAAAA,iBAAAA;;;;;SAAAA;;AAOL,IAAKC,2BAAAA,0BAAAA,2BAAAA;;;;;SAAAA;;UAOKA,2BAAAA;AACR,WAASC,cAAcC,kBAAwB;AACpD,UAAMC,SAASD,iBAAiBE,YAAW;AAC3C,QAAID,OAAOE,SAAS,IAAA,GAAO;AACzB,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,GAAQ;AACjC,aAAA;IACF,WAAWF,OAAOE,SAAS,KAAA,KAAUH,iBAAiBG,SAAS,MAAA,GAAS;AACtE,aAAA;IACF,WAAWF,OAAOE,SAAS,MAAA,GAAS;AAClC,aAAA;IACF,OAAO;AACL,YAAMC,MAAM,wBAAwBH,MAAAA,kBAAwB;IAC9D;EACF;AAbgBF;4BAAAA,gBAAAA;AAeT,WAASM,YAAYC,gBAA0CC,cAA0B;AAC9F,YAAQD,gBAAAA;MACN,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAO;MACT,KAAA;AACE,eAAOC,iBAAAA,OAAmCA,iBAAAA,OAAmC,WAAW;MAC1F,KAAA;AACE,eAAOA,iBAAAA,OAAmCA,iBAAAA,OAAmC,gBAAgB;IACjG;EACF;AAXgBF;4BAAAA,cAAAA;AAYlB,GA5BiBP,6BAAAA,2BAAAA,CAAAA,EAAAA;AA8BV,IAAKU,4BAAAA,0BAAAA,4BAAAA;;;;;SAAAA;;AAOL,IAAKC,sBAAAA,0BAAAA,sBAAAA;;;;SAAAA;;;;AC1DZ,uBAA8C;AAE9C,SAASC,MAAMC,OAAa;AAC1B,SAAOA,MAAMC,MAAM,mBAAA,MAAyB;AAC9C;AAFSF;AAGF,SAASG,kBAAkBF,OAAsB;AACtD,MAAI,OAAOA,UAAU,UAAU;AAC7B,QAAID,MAAMC,KAAAA,KAAUG,6BAAYC,SAASJ,KAAAA,GAAQ;AAE/C,aAAOA;IACT,WAAWK,kCAAiBC,aAAaN,KAAAA,KAAUK,kCAAiBE,eAAeP,KAAAA,GAAQ;AACzF,aAAOA;IACT;AACA,UAAMQ,MAAM,2CAAA;EACd;AAEA,MAAI;AACF,WAAOC,KAAKC,UAAUV,KAAAA;EACxB,SAASW,GAAG;AACV,UAAM,IAAIH,MAAM,wCAAwCR,KAAAA,EAAO;EACjE;AACF;AAhBgBE;","names":["AbstractContactStore","AbstractDigitalCredentialStore","AbstractIssuanceBrandingStore","AbstractEventLoggerStore","IAbstractMachineStateStore","AbstractPDStore","ConnectionType","CorrelationIdentifierType","PartyTypeType","PartyOrigin","IdentityOrigin","DocumentType","RegulationType","CredentialDocumentFormat","fromSpecValue","credentialFormat","format","toLowerCase","includes","Error","toSpecValue","documentFormat","documentType","CredentialCorrelationType","CredentialStateType","isHex","input","match","ensureRawDocument","ObjectUtils","isBase64","CredentialMapper","isJwtEncoded","isSdJwtEncoded","Error","JSON","stringify","e"]}
|