@sphereon/ssi-sdk-ext.identifier-resolution 0.24.1-unstable.75
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 +54 -0
- package/dist/agent/IdentifierResolution.d.ts +23 -0
- package/dist/agent/IdentifierResolution.d.ts.map +1 -0
- package/dist/agent/IdentifierResolution.js +66 -0
- package/dist/agent/IdentifierResolution.js.map +1 -0
- package/dist/functions/index.d.ts +13 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/functions/index.js +241 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/IIdentifierResolution.d.ts +170 -0
- package/dist/types/IIdentifierResolution.d.ts.map +1 -0
- package/dist/types/IIdentifierResolution.js +98 -0
- package/dist/types/IIdentifierResolution.js.map +1 -0
- package/package.json +66 -0
- package/plugin.schema.json +805 -0
- package/src/agent/IdentifierResolution.ts +69 -0
- package/src/functions/index.ts +267 -0
- package/src/index.ts +11 -0
- package/src/types/IIdentifierResolution.ts +297 -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 [yyyy] [name of copyright owner]
|
|
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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!--suppress HtmlDeprecatedAttribute -->
|
|
2
|
+
<h1 align="center">
|
|
3
|
+
<br>
|
|
4
|
+
<a href="https://www.sphereon.com"><img src="https://sphereon.com/content/themes/sphereon/assets/img/logo.svg" alt="Sphereon" width="400"></a>
|
|
5
|
+
<br>Managed and external identifier resolution
|
|
6
|
+
<br>
|
|
7
|
+
</h1>
|
|
8
|
+
|
|
9
|
+
A plugin that in a uniform way can resolve any supported external identifiers, as well as get managed identifiers.
|
|
10
|
+
|
|
11
|
+
Currently, it supports the following identifier methods and types:
|
|
12
|
+
|
|
13
|
+
- DIDs (and the internal IIdentifier type)
|
|
14
|
+
- JWKs (JWK object and public key in hex)
|
|
15
|
+
- kid, KMS key references and jwk thumbprints
|
|
16
|
+
- X.509 certificate chains
|
|
17
|
+
|
|
18
|
+
TODO:
|
|
19
|
+
|
|
20
|
+
- https .well-knowns (JWKSet)
|
|
21
|
+
- X.509 CN en SANs
|
|
22
|
+
|
|
23
|
+
Since the plugin dynamically looks for the correct agent plugins based on the types being resolved, this plugin should
|
|
24
|
+
be used for any and all identifier resolution.
|
|
25
|
+
|
|
26
|
+
No matter whether the plugin is doing resolution of external identifiers or managed/internal identifiers, the results
|
|
27
|
+
will always include certain objects, like the JWK key(s) associated, certificates etc. This ensures uniform handling in
|
|
28
|
+
all places that rely on key/identifier management.
|
|
29
|
+
|
|
30
|
+
### Installation
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
pnpm add @sphereon/ssi-sdk-ext.identifier-resolution
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Build
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
pnpm run build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Test
|
|
43
|
+
|
|
44
|
+
The test command runs:
|
|
45
|
+
|
|
46
|
+
- `prettier`
|
|
47
|
+
- `jest`
|
|
48
|
+
- `coverage`
|
|
49
|
+
|
|
50
|
+
You can also run only a single section of these tests, using for example `yarn test:unit`.
|
|
51
|
+
|
|
52
|
+
```shell
|
|
53
|
+
pnmp run test
|
|
54
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IAgentPlugin } from '@veramo/core';
|
|
2
|
+
import { IIdentifierResolution } from '../types/IIdentifierResolution';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class IdentifierResolution implements IAgentPlugin {
|
|
7
|
+
private readonly _crypto;
|
|
8
|
+
readonly schema: any;
|
|
9
|
+
readonly methods: IIdentifierResolution;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: Add a cache, as we are retrieving the same keys/info quite often
|
|
12
|
+
*/
|
|
13
|
+
constructor({ crypto: cryptoArg }: {
|
|
14
|
+
crypto: Crypto;
|
|
15
|
+
});
|
|
16
|
+
private identifierGetManaged;
|
|
17
|
+
private identifierGetManagedByDid;
|
|
18
|
+
private identifierGetManagedByKid;
|
|
19
|
+
private identifierGetManagedByJwk;
|
|
20
|
+
private identifierGetManagedByX5c;
|
|
21
|
+
private identifierResolveExternal;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=IdentifierResolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentifierResolution.d.ts","sourceRoot":"","sources":["../../src/agent/IdentifierResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAA4B,MAAM,cAAc,CAAA;AAgBpF,OAAO,EAA0B,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAE9F;;GAEG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAEhC,QAAQ,CAAC,MAAM,MAAgC;IAC/C,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAQtC;IAED;;OAEG;gBACS,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;YAIvC,oBAAoB;YAIpB,yBAAyB;YAOzB,yBAAyB;YAIzB,yBAAyB;YAIzB,yBAAyB;YAIzB,yBAAyB;CAGxC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
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.IdentifierResolution = void 0;
|
|
13
|
+
const functions_1 = require("../functions");
|
|
14
|
+
const index_1 = require("../index");
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
class IdentifierResolution {
|
|
19
|
+
/**
|
|
20
|
+
* TODO: Add a cache, as we are retrieving the same keys/info quite often
|
|
21
|
+
*/
|
|
22
|
+
constructor({ crypto: cryptoArg }) {
|
|
23
|
+
this.schema = index_1.schema.IMnemonicInfoGenerator;
|
|
24
|
+
this.methods = {
|
|
25
|
+
identifierManagedGet: this.identifierGetManaged.bind(this),
|
|
26
|
+
identifierManagedGetByDid: this.identifierGetManagedByDid.bind(this),
|
|
27
|
+
identifierManagedGetByKid: this.identifierGetManagedByKid.bind(this),
|
|
28
|
+
identifierManagedGetByJwk: this.identifierGetManagedByJwk.bind(this),
|
|
29
|
+
identifierManagedGetByX5c: this.identifierGetManagedByX5c.bind(this),
|
|
30
|
+
identifierExternalResolve: this.identifierResolveExternal.bind(this),
|
|
31
|
+
};
|
|
32
|
+
this._crypto = cryptoArg !== null && cryptoArg !== void 0 ? cryptoArg : global.crypto;
|
|
33
|
+
}
|
|
34
|
+
identifierGetManaged(args, context) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return yield (0, functions_1.getManagedIdentifier)(Object.assign(Object.assign({}, args), { crypto: this._crypto }), context);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
identifierGetManagedByDid(args, context) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'did' }), context));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
identifierGetManagedByKid(args, context) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'kid' }), context));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
identifierGetManagedByJwk(args, context) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'jwk' }), context));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
identifierGetManagedByX5c(args, context) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return (yield this.identifierGetManaged(Object.assign(Object.assign({}, args), { method: 'x5c' }), context));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
identifierResolveExternal(args, context) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield (0, functions_1.getManagedIdentifier)(Object.assign(Object.assign({}, args), { crypto: this._crypto }), context);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.IdentifierResolution = IdentifierResolution;
|
|
66
|
+
//# sourceMappingURL=IdentifierResolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentifierResolution.js","sourceRoot":"","sources":["../../src/agent/IdentifierResolution.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4CAAmD;AAEnD,oCAYiB;A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AAC,IAA8B,EAAE,OAAmC;;YACzG,OAAO,CAAC,MAAM,IAAI,CAAC,oBAAoB,iCAAM,IAAI,KAAE,MAAM,EAAE,KAAK,KAAI,OAAO,CAAC,CAA+B,CAAA;QAC7G,CAAC;KAAA;IAEa,yBAAyB,CAAC,IAA8B,EAAE,OAAmC;;YACzG,OAAO,CAAC,MAAM,IAAI,CAAC,oBAAoB,iCAAM,IAAI,KAAE,MAAM,EAAE,KAAK,KAAI,OAAO,CAAC,CAA+B,CAAA;QAC7G,CAAC;KAAA;IAEa,yBAAyB,CAAC,IAA4B,EAAE,OAAmC;;YACvG,OAAO,MAAM,IAAA,gCAAoB,kCAAM,IAAI,KAAE,MAAM,EAAE,IAAI,CAAC,OAAO,KAAI,OAAO,CAAC,CAAA;QAC/E,CAAC;KAAA;CACF;AA/CD,oDA+CC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IAgentContext, IDIDManager, IKeyManager, IResolver } from '@veramo/core';
|
|
2
|
+
import { ExternalIdentifierDidOpts, ExternalIdentifierDidResult, ExternalIdentifierOpts, ExternalIdentifierResult, ExternalIdentifierX5cOpts, ExternalIdentifierX5cResult, ManagedIdentifierOpts, ManagedIdentifierResult } from '../types/IIdentifierResolution';
|
|
3
|
+
export declare function resolveExternalIdentifier(opts: ExternalIdentifierOpts & {
|
|
4
|
+
crypto?: Crypto;
|
|
5
|
+
}, context: IAgentContext<any>): Promise<ExternalIdentifierResult>;
|
|
6
|
+
export declare function resolveExternalX5cIdentifier(opts: ExternalIdentifierX5cOpts & {
|
|
7
|
+
crypto?: Crypto;
|
|
8
|
+
}, context: IAgentContext<IResolver & IDIDManager>): Promise<ExternalIdentifierX5cResult>;
|
|
9
|
+
export declare function resolveExternalDidIdentifier(opts: ExternalIdentifierDidOpts, context: IAgentContext<IResolver & IDIDManager>): Promise<ExternalIdentifierDidResult>;
|
|
10
|
+
export declare function getManagedIdentifier(opts: ManagedIdentifierOpts & {
|
|
11
|
+
crypto?: Crypto;
|
|
12
|
+
}, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierResult>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAqB,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEpG,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAE3B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAW3B,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,gCAAgC,CAAA;AAEvC,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,sBAAsB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAC1B,OAAO,CAAC,wBAAwB,CAAC,CAcnC;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,GAAG;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,SAAS,GAAG,WAAW,CAAC,GAC9C,OAAO,CAAC,2BAA2B,CAAC,CAyEtC;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,aAAa,CAAC,SAAS,GAAG,WAAW,CAAC,GAC9C,OAAO,CAAC,2BAA2B,CAAC,CA0CtC;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,qBAAqB,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,EACD,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAoFlC"}
|
|
@@ -0,0 +1,241 @@
|
|
|
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.getManagedIdentifier = exports.resolveExternalDidIdentifier = exports.resolveExternalX5cIdentifier = exports.resolveExternalIdentifier = void 0;
|
|
13
|
+
const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
14
|
+
const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
15
|
+
const ssi_sdk_ext_x509_utils_1 = require("@sphereon/ssi-sdk-ext.x509-utils");
|
|
16
|
+
const ssi_sdk_agent_config_1 = require("@sphereon/ssi-sdk.agent-config");
|
|
17
|
+
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
18
|
+
const pkijs_1 = require("pkijs");
|
|
19
|
+
const IIdentifierResolution_1 = require("../types/IIdentifierResolution");
|
|
20
|
+
function resolveExternalIdentifier(opts, context) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
let method;
|
|
23
|
+
if ((0, IIdentifierResolution_1.isExternalIdentifierDidOpts)(opts)) {
|
|
24
|
+
return resolveExternalDidIdentifier(opts, context);
|
|
25
|
+
}
|
|
26
|
+
else if ((0, IIdentifierResolution_1.isExternalIdentifierX5cOpts)(opts)) {
|
|
27
|
+
return resolveExternalX5cIdentifier(opts, context);
|
|
28
|
+
}
|
|
29
|
+
else if ((0, IIdentifierResolution_1.isExternalIdentifierKidOpts)(opts)) {
|
|
30
|
+
method = 'kid';
|
|
31
|
+
}
|
|
32
|
+
else if ((0, IIdentifierResolution_1.isExternalIdentifierJwksUrlOpts)(opts)) {
|
|
33
|
+
method = 'jwks-url';
|
|
34
|
+
}
|
|
35
|
+
else if ((0, IIdentifierResolution_1.isExternalIdentifierOidcDiscoveryOpts)(opts)) {
|
|
36
|
+
method = 'oidc-discovery';
|
|
37
|
+
}
|
|
38
|
+
throw Error(`External resolution method ${method} is not yet implemented`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.resolveExternalIdentifier = resolveExternalIdentifier;
|
|
42
|
+
function resolveExternalX5cIdentifier(opts, context) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
|
+
if (!(0, IIdentifierResolution_1.isExternalIdentifierX5cOpts)(opts)) {
|
|
46
|
+
return Promise.reject('External x5c Identifier args need to be provided');
|
|
47
|
+
}
|
|
48
|
+
const verify = (_a = opts.verify) !== null && _a !== void 0 ? _a : true;
|
|
49
|
+
const x5c = opts.identifier;
|
|
50
|
+
if (x5c.length === 0) {
|
|
51
|
+
return Promise.reject('Empty certification chain is now allowed');
|
|
52
|
+
}
|
|
53
|
+
const certificates = x5c.map(ssi_sdk_ext_x509_utils_1.pemOrDerToX509Certificate);
|
|
54
|
+
let verificationResult;
|
|
55
|
+
let issuerJWK;
|
|
56
|
+
let jwks = [];
|
|
57
|
+
if (verify) {
|
|
58
|
+
// We use the agent plugin if it is available as that is more powerful, but revert to the function otherwise
|
|
59
|
+
if ((0, ssi_sdk_agent_config_1.contextHasPlugin)(context, 'verifyCertificateChain')) {
|
|
60
|
+
verificationResult = (yield context.agent.verifyCertificateChain({
|
|
61
|
+
chain: opts.identifier,
|
|
62
|
+
trustAnchors: (_b = opts.trustAnchors) !== null && _b !== void 0 ? _b : [],
|
|
63
|
+
verificationTime: opts.verificationTime,
|
|
64
|
+
})); // We need to cast, as we know this is the value and we do not want to rely on the x509 plugin perse
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
verificationResult = yield (0, ssi_sdk_ext_x509_utils_1.validateX509CertificateChain)({
|
|
68
|
+
chain: opts.identifier,
|
|
69
|
+
trustAnchors: (_c = opts.trustAnchors) !== null && _c !== void 0 ? _c : [],
|
|
70
|
+
verificationTime: opts.verificationTime,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (verificationResult.certificateChain) {
|
|
74
|
+
jwks = verificationResult.certificateChain.map((cert) => {
|
|
75
|
+
return {
|
|
76
|
+
jwk: cert.publicKeyJWK,
|
|
77
|
+
kid: cert.subject.dn.DN,
|
|
78
|
+
jwkThumbprint: (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)(cert.publicKeyJWK),
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!jwks) {
|
|
84
|
+
const cryptoEngine = new pkijs_1.CryptoEngine({
|
|
85
|
+
name: 'identifier_resolver_external',
|
|
86
|
+
crypto: (_d = opts.crypto) !== null && _d !== void 0 ? _d : global.crypto,
|
|
87
|
+
});
|
|
88
|
+
(0, pkijs_1.setEngine)(cryptoEngine.name, cryptoEngine);
|
|
89
|
+
jwks = yield Promise.all(certificates.map((cert) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const pk = yield cert.getPublicKey(undefined, cryptoEngine);
|
|
91
|
+
const jwk = (yield cryptoEngine.exportKey('jwk', pk));
|
|
92
|
+
return {
|
|
93
|
+
jwk,
|
|
94
|
+
kid: (0, ssi_sdk_ext_x509_utils_1.getSubjectDN)(cert).DN,
|
|
95
|
+
jwkThumbprint: (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk }),
|
|
96
|
+
};
|
|
97
|
+
})));
|
|
98
|
+
}
|
|
99
|
+
if (jwks.length === 0) {
|
|
100
|
+
return Promise.reject('Empty certification chain is now allowed');
|
|
101
|
+
}
|
|
102
|
+
if (!issuerJWK) {
|
|
103
|
+
issuerJWK = jwks[0].jwk;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
method: 'x5c',
|
|
107
|
+
verificationResult,
|
|
108
|
+
issuerJWK,
|
|
109
|
+
jwks,
|
|
110
|
+
certificates,
|
|
111
|
+
x5c,
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
exports.resolveExternalX5cIdentifier = resolveExternalX5cIdentifier;
|
|
116
|
+
function resolveExternalDidIdentifier(opts, context) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
var _a;
|
|
119
|
+
if (!(0, IIdentifierResolution_1.isExternalIdentifierDidOpts)(opts)) {
|
|
120
|
+
return Promise.reject('External DID Identifier args need to be provided');
|
|
121
|
+
}
|
|
122
|
+
else if (!(0, ssi_sdk_agent_config_1.contextHasPlugin)(context, 'resolveDid')) {
|
|
123
|
+
return Promise.reject(Error(`Cannot get external DID identifier if DID resolver plugin is not enabled!`));
|
|
124
|
+
}
|
|
125
|
+
const { uniresolverResolution = false, localResolution = true, resolverResolution = true } = opts;
|
|
126
|
+
const did = opts.identifier;
|
|
127
|
+
let parsed;
|
|
128
|
+
try {
|
|
129
|
+
parsed = (0, ssi_types_1.parseDid)(did);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
// Error from did resolution spec
|
|
133
|
+
return Promise.reject(error);
|
|
134
|
+
}
|
|
135
|
+
const didParsed = parsed;
|
|
136
|
+
const didResolutionResult = yield (0, ssi_sdk_ext_did_utils_1.getAgentResolver)(context, {
|
|
137
|
+
uniresolverResolution,
|
|
138
|
+
localResolution,
|
|
139
|
+
resolverResolution,
|
|
140
|
+
}).resolve(did);
|
|
141
|
+
const didDocument = (_a = didResolutionResult.didDocument) !== null && _a !== void 0 ? _a : undefined;
|
|
142
|
+
const didJwks = didDocument ? (0, ssi_sdk_ext_did_utils_1.didDocumentToJwks)(didDocument) : undefined;
|
|
143
|
+
const jwks = didJwks
|
|
144
|
+
? Array.from(new Set(Object.values(didJwks).flatMap((jwks) => jwks))).map((jwk) => {
|
|
145
|
+
return { jwk, jwkThumbprint: (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk }), kid: jwk.kid };
|
|
146
|
+
})
|
|
147
|
+
: [];
|
|
148
|
+
if (didResolutionResult === null || didResolutionResult === void 0 ? void 0 : didResolutionResult.didDocument) {
|
|
149
|
+
// @ts-ignore // Mandatory on the original object, but we already provide it directly
|
|
150
|
+
delete didResolutionResult['didDocument'];
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
method: 'did',
|
|
154
|
+
did,
|
|
155
|
+
jwks,
|
|
156
|
+
didJwks,
|
|
157
|
+
didDocument,
|
|
158
|
+
didResolutionResult,
|
|
159
|
+
didParsed,
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
exports.resolveExternalDidIdentifier = resolveExternalDidIdentifier;
|
|
164
|
+
function getManagedIdentifier(opts, context) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
167
|
+
let { method } = opts;
|
|
168
|
+
let identifier = undefined;
|
|
169
|
+
let keys = undefined;
|
|
170
|
+
let key = undefined;
|
|
171
|
+
let certificate = undefined;
|
|
172
|
+
let jwk = undefined;
|
|
173
|
+
let jwkThumbprint = undefined;
|
|
174
|
+
let x5c;
|
|
175
|
+
let controllerKeyId = undefined;
|
|
176
|
+
let did = undefined;
|
|
177
|
+
const cryptoImpl = (_a = opts.crypto) !== null && _a !== void 0 ? _a : crypto;
|
|
178
|
+
if ((0, IIdentifierResolution_1.isManagedIdentifierKidOpts)(opts)) {
|
|
179
|
+
method = 'kid';
|
|
180
|
+
if (!(0, ssi_sdk_agent_config_1.contextHasKeyManager)(context)) {
|
|
181
|
+
return Promise.reject(Error(`Cannot get Key/JWK identifier if KeyManager plugin is not enabled!`));
|
|
182
|
+
}
|
|
183
|
+
key = yield context.agent.keyManagerGet({ kid: (_b = opts.kmsKeyRef) !== null && _b !== void 0 ? _b : opts.identifier });
|
|
184
|
+
}
|
|
185
|
+
else if ((0, IIdentifierResolution_1.isManagedIdentifierDidOpts)(opts)) {
|
|
186
|
+
method = 'did';
|
|
187
|
+
if (!(0, ssi_sdk_agent_config_1.contextHasDidManager)(context)) {
|
|
188
|
+
return Promise.reject(Error(`Cannot get DID identifier if DID Manager plugin is not enabled!`));
|
|
189
|
+
}
|
|
190
|
+
if (typeof opts.identifier === 'string') {
|
|
191
|
+
identifier = yield context.agent.didManagerGet({ did: opts.identifier.split('#')[0] });
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
identifier = opts.identifier;
|
|
195
|
+
}
|
|
196
|
+
if (identifier) {
|
|
197
|
+
did = identifier.did;
|
|
198
|
+
keys = identifier === null || identifier === void 0 ? void 0 : identifier.keys; // fixme: We really want to return the vmRelationship keys here actually
|
|
199
|
+
key = yield (0, ssi_sdk_ext_did_utils_1.getFirstKeyWithRelation)(Object.assign(Object.assign({}, opts), { identifier, vmRelationship: (_c = opts.vmRelationship) !== null && _c !== void 0 ? _c : 'verificationMethod' }), context);
|
|
200
|
+
controllerKeyId = identifier.controllerKeyId;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else if ((0, IIdentifierResolution_1.isManagedIdentifierJwkOpts)(opts)) {
|
|
204
|
+
method = 'jwk';
|
|
205
|
+
if (!(0, ssi_sdk_agent_config_1.contextHasKeyManager)(context)) {
|
|
206
|
+
return Promise.reject(Error(`Cannot get Key/JWK identifier if KeyManager plugin is not enabled!`));
|
|
207
|
+
}
|
|
208
|
+
key = yield context.agent.keyManagerGet({ kid: (_d = opts.kmsKeyRef) !== null && _d !== void 0 ? _d : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk: opts.identifier }) });
|
|
209
|
+
}
|
|
210
|
+
else if ((0, IIdentifierResolution_1.isManagedIdentifierX5cOpts)(opts)) {
|
|
211
|
+
method = 'x5c';
|
|
212
|
+
x5c = opts.identifier;
|
|
213
|
+
if (x5c.length === 0) {
|
|
214
|
+
return Promise.reject(`Cannot resolve x5c when an empty x5c is passed in`);
|
|
215
|
+
}
|
|
216
|
+
else if (!(0, ssi_sdk_agent_config_1.contextHasKeyManager)(context)) {
|
|
217
|
+
return Promise.reject(Error(`Cannot get X5c identifier if KeyManager plugin is not enabled!`));
|
|
218
|
+
}
|
|
219
|
+
certificate = (0, ssi_sdk_ext_x509_utils_1.pemOrDerToX509Certificate)(x5c[0]);
|
|
220
|
+
const cryptoEngine = new pkijs_1.CryptoEngine({ name: 'identifier_resolver_managed', crypto: cryptoImpl });
|
|
221
|
+
(0, pkijs_1.setEngine)(cryptoEngine.name, cryptoEngine);
|
|
222
|
+
const pk = yield certificate.getPublicKey(undefined, cryptoEngine);
|
|
223
|
+
jwk = (yield cryptoEngine.subtle.exportKey('jwk', pk));
|
|
224
|
+
jwkThumbprint = (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
|
|
225
|
+
key = yield context.agent.keyManagerGet({ kid: (_e = opts.kmsKeyRef) !== null && _e !== void 0 ? _e : jwkThumbprint });
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return Promise.reject(Error(`Could not determine identifier method. Please provide explicitly`));
|
|
229
|
+
}
|
|
230
|
+
if (!key || ((0, IIdentifierResolution_1.isManagedIdentifierDidOpts)(opts) && !identifier)) {
|
|
231
|
+
console.log(`Cannot find identifier`, opts.identifier);
|
|
232
|
+
return Promise.reject(`Cannot find identifier ${opts.identifier}`);
|
|
233
|
+
}
|
|
234
|
+
jwk = jwk !== null && jwk !== void 0 ? jwk : (0, ssi_sdk_ext_key_utils_1.toJwk)(key.publicKeyHex, key.type, { key });
|
|
235
|
+
const thumbprint = (_g = jwkThumbprint !== null && jwkThumbprint !== void 0 ? jwkThumbprint : (_f = key.meta) === null || _f === void 0 ? void 0 : _f.jwkThumbprint) !== null && _g !== void 0 ? _g : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk });
|
|
236
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ method,
|
|
237
|
+
jwk, jwkThumbprint: thumbprint }, (identifier && { identifier })), (did && { did })), (controllerKeyId && { controllerKeyId })), (keys && { keys })), (certificate && { certificate: certificate.toJSON() })), { key, kmsKeyRef: key.kid });
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
exports.getManagedIdentifier = getManagedIdentifier;
|
|
241
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAA8G;AAC9G,2EAAoF;AACpF,6EAA8I;AAC9I,yEAA6G;AAC7G,mDAA0D;AAE1D,iCAA4D;AAC5D,0EAoBuC;AAEvC,SAAsB,yBAAyB,CAC7C,IAEC,EACD,OAA2B;;QAE3B,IAAI,MAA4C,CAAA;QAChD,IAAI,IAAA,mDAA2B,EAAC,IAAI,CAAC,EAAE,CAAC;YACtC,OAAO,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACpD,CAAC;aAAM,IAAI,IAAA,mDAA2B,EAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,OAAO,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACpD,CAAC;aAAM,IAAI,IAAA,mDAA2B,EAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,MAAM,GAAG,KAAK,CAAA;QAChB,CAAC;aAAM,IAAI,IAAA,uDAA+B,EAAC,IAAI,CAAC,EAAE,CAAC;YACjD,MAAM,GAAG,UAAU,CAAA;QACrB,CAAC;aAAM,IAAI,IAAA,6DAAqC,EAAC,IAAI,CAAC,EAAE,CAAC;YACvD,MAAM,GAAG,gBAAgB,CAAA;QAC3B,CAAC;Q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,IACtB,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,CAAC,GAC9B,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC,GAChB,CAAC,eAAe,IAAI,EAAE,eAAe,EAAE,CAAC,GACxC,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,GAClB,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,KACzD,GAAG,EACH,SAAS,EAAE,GAAG,CAAC,GAAG,GACQ,CAAA;IAC9B,CAAC;CAAA;AAzFD,oDAyFC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
declare const schema: any;
|
|
5
|
+
export { schema };
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export { IdentifierResolution } from './agent/IdentifierResolution';
|
|
10
|
+
export * from './types/IIdentifierResolution';
|
|
11
|
+
export * from './functions';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB;;GAEG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,cAAc,+BAA+B,CAAA;AAC7C,cAAc,aAAa,CAAA"}
|